From bf1fb5001525cc5b5ccf382c583699fc157007c3 Mon Sep 17 00:00:00 2001 From: Damien TUPINIER Date: Sun, 24 Nov 2024 15:24:51 +0100 Subject: [PATCH 1/8] Add OpenAPI generator configuration and templates Introduced configuration for PHP client generation using OpenAPI Generator. Updated .gitignore to include .idea directory and created necessary templates and configurations for code generation. --- .gitignore | 3 +- .openapi-generator-ignore | 25 + config-openapi-generator.yml | 70 ++ template/php-nextgen/.php-cs-fixer.dist.php | 29 + template/php-nextgen/.phplint.mustache | 11 + template/php-nextgen/.travis.yml | 12 + template/php-nextgen/ApiException.mustache | 109 ++ template/php-nextgen/Configuration.mustache | 543 ++++++++++ template/php-nextgen/HeaderSelector.mustache | 234 +++++ template/php-nextgen/ModelInterface.mustache | 101 ++ .../php-nextgen/ObjectSerializer.mustache | 601 +++++++++++ template/php-nextgen/README.mustache | 161 +++ template/php-nextgen/api.mustache | 942 ++++++++++++++++++ template/php-nextgen/api_doc.mustache | 104 ++ template/php-nextgen/api_test.mustache | 77 ++ template/php-nextgen/composer.mustache | 47 + template/php-nextgen/git_push.sh.mustache | 57 ++ template/php-nextgen/gitignore | 19 + template/php-nextgen/model.mustache | 47 + template/php-nextgen/model_abstract.mustache | 255 +++++ template/php-nextgen/model_doc.mustache | 10 + template/php-nextgen/model_enum.mustache | 16 + template/php-nextgen/model_generic.mustache | 386 +++++++ template/php-nextgen/model_test.mustache | 85 ++ template/php-nextgen/partial_header.mustache | 18 + .../php-nextgen/php_doc_auth_partial.mustache | 23 + template/php-nextgen/phpunit.xml.mustache | 18 + 27 files changed, 4002 insertions(+), 1 deletion(-) create mode 100644 .openapi-generator-ignore create mode 100644 config-openapi-generator.yml create mode 100644 template/php-nextgen/.php-cs-fixer.dist.php create mode 100644 template/php-nextgen/.phplint.mustache create mode 100644 template/php-nextgen/.travis.yml create mode 100644 template/php-nextgen/ApiException.mustache create mode 100644 template/php-nextgen/Configuration.mustache create mode 100644 template/php-nextgen/HeaderSelector.mustache create mode 100644 template/php-nextgen/ModelInterface.mustache create mode 100644 template/php-nextgen/ObjectSerializer.mustache create mode 100644 template/php-nextgen/README.mustache create mode 100644 template/php-nextgen/api.mustache create mode 100644 template/php-nextgen/api_doc.mustache create mode 100644 template/php-nextgen/api_test.mustache create mode 100644 template/php-nextgen/composer.mustache create mode 100644 template/php-nextgen/git_push.sh.mustache create mode 100644 template/php-nextgen/gitignore create mode 100644 template/php-nextgen/model.mustache create mode 100644 template/php-nextgen/model_abstract.mustache create mode 100644 template/php-nextgen/model_doc.mustache create mode 100644 template/php-nextgen/model_enum.mustache create mode 100644 template/php-nextgen/model_generic.mustache create mode 100644 template/php-nextgen/model_test.mustache create mode 100644 template/php-nextgen/partial_header.mustache create mode 100644 template/php-nextgen/php_doc_auth_partial.mustache create mode 100644 template/php-nextgen/phpunit.xml.mustache diff --git a/.gitignore b/.gitignore index 47f36f6..b187d36 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .DS_Store -vendor \ No newline at end of file +vendor +.idea diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 0000000..79b2e0d --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,25 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md + +.gitignore diff --git a/config-openapi-generator.yml b/config-openapi-generator.yml new file mode 100644 index 0000000..8fc98ef --- /dev/null +++ b/config-openapi-generator.yml @@ -0,0 +1,70 @@ +# config-openapi-generator.yml +generatorName: php-nextgen +outputDir: . +inputSpec: https://api.brevo.com/v3/swagger_definition_v3.yml +gitHost: github.com +gitUserId: getbrevo +gitRepoId: brevo-php +templateDirectory: ./template/php-nextgen +templateDir: ./template/php-nextgen + +# Package configuration +invokerPackage: Brevo\Client +artifactVersion: 3.0.0 +packageName: Brevo\Client +srcBasePath: lib +variableNamingConvention: camelCase + +# Server configuration +serverVariables: + host: https://api.brevo.com/v3 + +# HTTP client configuration +httpUserAgent: brevo_clientAPI/v3.0.0/php + +# PHP specific configurations +modelPackage: Models +apiPackage: Api +composerVendorName: getbrevo +composerProjectName: brevo-php + +# Composer metadata +artifactDescription: "Brevo's API v3 Php Library" +infoEmail: contact@brevo.com +infoName: "Brevo Developers" +infoUrl: https://www.brevo.com/ +licenseName: MIT +licenseUrl: https://raw.githubusercontent.com/getbrevo/brevo-php/refs/heads/main/LICENSE.md +artifactKeywords: + - brevo + - swagger + - php + - sdk + - api +composerAuthorName: "Brevo Developers" +composerAuthorEmail: contact@brevo.com +composerHomepage: https://github.com/getbrevo/brevo-php + +# Organization information +developerOrganization: "Brevo Developers" +developerOrganizationUrl: https://www.brevo.com/ +artifactUrl: https://github.com/getbrevo/brevo-php + +# Code generation options +sortParamsByRequiredFlag: true +sortModelPropertiesByRequiredFlag: true +ensureUniqueParams: true +hideGenerationTimestamp: true +legacyDiscriminatorBehavior: true + +# PHP quality settings +phpLegacySupport: false +phpUnitVer: 9.5.0 +disallowAdditionalPropertiesIfNotPresent: false + + +files: + model_abstract.mustache: + destinationFilename: lib/Models/AbstractModel.php + templateType: "SupportingFiles" + diff --git a/template/php-nextgen/.php-cs-fixer.dist.php b/template/php-nextgen/.php-cs-fixer.dist.php new file mode 100644 index 0000000..af9cf39 --- /dev/null +++ b/template/php-nextgen/.php-cs-fixer.dist.php @@ -0,0 +1,29 @@ +in(__DIR__) + ->exclude('vendor') + ->exclude('test') + ->exclude('tests') +; + +$config = new PhpCsFixer\Config(); +return $config->setRules([ + '@PSR12' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + 'no_leading_import_slash' => false, + ]) + ->setFinder($finder) +; diff --git a/template/php-nextgen/.phplint.mustache b/template/php-nextgen/.phplint.mustache new file mode 100644 index 0000000..583b66a --- /dev/null +++ b/template/php-nextgen/.phplint.mustache @@ -0,0 +1,11 @@ +path: + - ./{{srcBasePath}} + - ./{{testBasePath}} +jobs: 10 +extensions: + - php +exclude: + - vendor +warning: true +memory-limit: -1 +no-cache: true diff --git a/template/php-nextgen/.travis.yml b/template/php-nextgen/.travis.yml new file mode 100644 index 0000000..707be2a --- /dev/null +++ b/template/php-nextgen/.travis.yml @@ -0,0 +1,12 @@ +language: php +# Jammy Jellyfish environment has preinstalled PHP 8.1 +# Focal Fossa doesn't fit since it contains preinstalled PHP 7.4 only +# https://docs.travis-ci.com/user/reference/jammy/#php-support +dist: jammy +os: + - linux +php: + - 8.1 + - 8.2 +before_install: "composer install" +script: "vendor/bin/phpunit" diff --git a/template/php-nextgen/ApiException.mustache b/template/php-nextgen/ApiException.mustache new file mode 100644 index 0000000..6720e35 --- /dev/null +++ b/template/php-nextgen/ApiException.mustache @@ -0,0 +1,109 @@ +partial_header}} +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace {{invokerPackage}}; + +use Exception; +use stdClass; + +/** + * ApiException Class Doc Comment + * + * @package {{invokerPackage}} + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +class ApiException extends Exception +{ + /** + * The HTTP body of the server response either as Json or string. + * + * @var stdClass|string|null + */ + protected stdClass|string|null $responseBody; + + /** + * The HTTP header of the server response. + * + * @var string[][]|null + */ + protected ?array $responseHeaders; + + /** + * The deserialized response object + * + * @var mixed + */ + protected mixed $responseObject = null; + + /** + * Constructor + * + * @param string $message Error message + * @param int $code HTTP status code + * @param string[][]|null $responseHeaders HTTP response header + * @param stdClass|string|null $responseBody HTTP decoded body of the server response either as stdClass or string + */ + public function __construct(string $message = "", int $code = 0, ?array $responseHeaders = [], stdClass|string|null $responseBody = null) + { + parent::__construct($message, $code); + $this->responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[][]|null HTTP response header + */ + public function getResponseHeaders(): ?array + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return stdClass|string|null HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody(): stdClass|string|null + { + return $this->responseBody; + } + + /** + * Sets the deserialized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject(mixed $obj): void + { + $this->responseObject = $obj; + } + + /** + * Gets the deserialized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject(): mixed + { + return $this->responseObject; + } +} diff --git a/template/php-nextgen/Configuration.mustache b/template/php-nextgen/Configuration.mustache new file mode 100644 index 0000000..618276f --- /dev/null +++ b/template/php-nextgen/Configuration.mustache @@ -0,0 +1,543 @@ +partial_header}} +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace {{invokerPackage}}; + +use InvalidArgumentException; + +/** + * Configuration Class Doc Comment + * + * @package {{invokerPackage}} + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +class Configuration +{ + public const BOOLEAN_FORMAT_INT = 'int'; + public const BOOLEAN_FORMAT_STRING = 'string'; + + /** + * @var Configuration|null + */ + private static ?Configuration $defaultConfiguration = null; + + /** + * Associate array to store API key(s) + * + * @var string[] + */ + protected array $apiKeys = []; + + /** + * Associate array to store API prefix (e.g. Bearer) + * + * @var string[] + */ + protected array $apiKeyPrefixes = []; + + /** + * Access token for OAuth/Bearer authentication + * + * @var string + */ + protected string $accessToken = ''; + + /** + * Boolean format for query string + * + * @var string + */ + protected string $booleanFormatForQueryString = self::BOOLEAN_FORMAT_INT; + + /** + * Username for HTTP basic authentication + * + * @var string + */ + protected string $username = ''; + + /** + * Password for HTTP basic authentication + * + * @var string + */ + protected string $password = ''; + + /** + * The host + * + * @var string + */ + protected string $host = '{{basePath}}'; + + /** + * User agent of the HTTP request, set to "OpenAPI-Generator/{version}/PHP" by default + * + * @var string + */ + protected string $userAgent = '{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}{{^artifactVersion}}1.0.0{{/artifactVersion}}/PHP{{/httpUserAgent}}'; + + /** + * Debug switch (default set to false) + * + * @var bool + */ + protected bool $debug = false; + + /** + * Debug file location (log to STDOUT by default) + * + * @var string + */ + protected string $debugFile = 'php://output'; + + /** + * Debug file location (log to STDOUT by default) + * + * @var string + */ + protected string $tempFolderPath; + + /** + * Constructor + */ + public function __construct() + { + $this->tempFolderPath = sys_get_temp_dir(); + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey(string $apiKeyIdentifier, string $key): static + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string API key or token + */ + public function getApiKey(string $apiKeyIdentifier): ?string + { + return $this->apiKeys[$apiKeyIdentifier] ?? null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix(string $apiKeyIdentifier, string $prefix): static + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string + */ + public function getApiKeyPrefix(string $apiKeyIdentifier): ?string + { + return $this->apiKeyPrefixes[$apiKeyIdentifier] ?? null; + } + + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken(string $accessToken): static + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * @return string Access token for OAuth + */ + public function getAccessToken(): string + { + return $this->accessToken; + } + + /** + * Sets boolean format for query string. + * + * @param string $booleanFormat Boolean format for query string + * + * @return $this + */ + public function setBooleanFormatForQueryString(string $booleanFormat): static + { + $this->booleanFormatForQueryString = $booleanFormat; + + return $this; + } + + /** + * Gets boolean format for query string. + * + * @return string Boolean format for query string + */ + public function getBooleanFormatForQueryString(): string + { + return $this->booleanFormatForQueryString; + } + + /** + * Sets the username for HTTP basic authentication + * + * @param string $username Username for HTTP basic authentication + * + * @return $this + */ + public function setUsername(string $username): static + { + $this->username = $username; + return $this; + } + + /** + * Gets the username for HTTP basic authentication + * + * @return string Username for HTTP basic authentication + */ + public function getUsername(): string + { + return $this->username; + } + + /** + * Sets the password for HTTP basic authentication + * + * @param string $password Password for HTTP basic authentication + * + * @return $this + */ + public function setPassword(string $password): static + { + $this->password = $password; + return $this; + } + + /** + * Gets the password for HTTP basic authentication + * + * @return string Password for HTTP basic authentication + */ + public function getPassword(): string + { + return $this->password; + } + + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost(string $host): static + { + $this->host = $host; + return $this; + } + + /** + * Gets the host + * + * @return string Host + */ + public function getHost(): string + { + return $this->host; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws InvalidArgumentException + * @return $this + */ + public function setUserAgent(string $userAgent): static + { + $this->userAgent = $userAgent; + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent(): string + { + return $this->userAgent; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug(bool $debug): static + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug(): bool + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile(string $debugFile): static + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile(): string + { + return $this->debugFile; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath(string $tempFolderPath): static + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath(): string + { + return $this->tempFolderPath; + } + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration(): Configuration + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the default configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config): void + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport(): string + { + $report = 'PHP SDK ({{invokerPackage}}) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: {{version}}' . PHP_EOL; + {{#artifactVersion}} + $report .= ' SDK Package Version: {{.}}' . PHP_EOL; + {{/artifactVersion}} + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return null|string API key with the prefix + */ + public function getApiKeyWithPrefix(string $apiKeyIdentifier): ?string + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } + + /** + * Returns an array of host settings + * + * @return array an array of host settings + */ + public function getHostSettings(): array + { + return [ + {{#servers}} + [ + "url" => "{{{url}}}", + "description" => "{{{description}}}{{^description}}No description provided{{/description}}", + {{#variables}} + {{#-first}} + "variables" => [ + {{/-first}} + "{{{name}}}" => [ + "description" => "{{{description}}}{{^description}}No description provided{{/description}}", + "default_value" => "{{{defaultValue}}}", + {{#enumValues}} + {{#-first}} + "enum_values" => [ + {{/-first}} + "{{{.}}}"{{^-last}},{{/-last}} + {{#-last}} + ] + {{/-last}} + {{/enumValues}} + ]{{^-last}},{{/-last}} + {{#-last}} + ] + {{/-last}} + {{/variables}} + ]{{^-last}},{{/-last}} + {{/servers}} + ]; + } + + /** + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, int $hostIndex, array $variables = null): string + { + if (null === $variables) { + $variables = []; + } + + // check array index out of bound + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); + } + + $host = $hostSettings[$hostIndex]; + $url = $host["url"]; + + // go through variable and assign a value + foreach ($host["variables"] ?? [] as $name => $variable) { + if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + $url = str_replace("{".$name."}", $variables[$name], $url); + } else { + throw new InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); + } + } else { + // use default value + $url = str_replace("{".$name."}", $variable["default_value"], $url); + } + } + + return $url; + } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings(int $index, ?array $variables = null): string + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } +} diff --git a/template/php-nextgen/HeaderSelector.mustache b/template/php-nextgen/HeaderSelector.mustache new file mode 100644 index 0000000..e8ae3e2 --- /dev/null +++ b/template/php-nextgen/HeaderSelector.mustache @@ -0,0 +1,234 @@ +partial_header}} +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace {{invokerPackage}}; + +/** + * HeaderSelector Class Doc Comment + * + * @package {{invokerPackage}} + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +class HeaderSelector +{ + /** + * @param string[] $accept + * @param string $contentType + * @param bool $isMultipart + * @return string[] + */ + public function selectHeaders(array $accept, string $contentType, bool $isMultipart): array + { + $headers = []; + + $accept = $this->selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } + + $headers['Content-Type'] = $contentType; + } + + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided. + * + * @param string[] $accept Array of header + * + * @return null|string Accept (e.g. application/json) + */ + private function selectAcceptHeader(array $accept): ?string + { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { + return null; + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + if (count($headersWithJson) === 0) { + return implode(',', $accept); + } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); + } + + /** + * Given an Accept header, returns an associative array splitting the header and its weight + * + * @param string $header "Accept" Header + * + * @return array with the header and its weight + */ + private function getHeaderAndWeight(string $header): array + { + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; + } else { + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; + } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); + } +} diff --git a/template/php-nextgen/ModelInterface.mustache b/template/php-nextgen/ModelInterface.mustache new file mode 100644 index 0000000..b8deccf --- /dev/null +++ b/template/php-nextgen/ModelInterface.mustache @@ -0,0 +1,101 @@ +partial_header}} +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace {{modelPackage}}; + +/** + * Interface abstracting model access. + * + * @package {{modelPackage}} + * @author OpenAPI Generator team + */ +interface ModelInterface +{ + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array; + + /** + * Array of attributes where the key is the local name, and the value is the original name + * + * @return array + */ + public static function attributeMap(): array; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array; + + /** + * Show all the invalid properties with reasons. + * + * @return array + */ + public function listInvalidProperties(): array; + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool + */ + public function valid(): bool; + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool; + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool; +} diff --git a/template/php-nextgen/ObjectSerializer.mustache b/template/php-nextgen/ObjectSerializer.mustache new file mode 100644 index 0000000..9c57c88 --- /dev/null +++ b/template/php-nextgen/ObjectSerializer.mustache @@ -0,0 +1,601 @@ +partial_header}} +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace {{invokerPackage}}; + +use DateTimeInterface; +use DateTime; +use GuzzleHttp\Psr7\Utils; +use {{modelPackage}}\ModelInterface; + +/** + * ObjectSerializer Class Doc Comment + * + * @package {{invokerPackage}} + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +class ObjectSerializer +{ + /** @var string */ + private static string $dateTimeFormat = DateTimeInterface::ATOM; + + /** + * Change the date format + * + * @param string $format the new date format to use + * + * @return void + */ + public static function setDateTimeFormat(string $format): void + { + self::$dateTimeFormat = $format; + } + + /** + * Serialize data + * + * @param mixed $data the data to serialize + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data + * + * @return scalar|object|array|null serialized form of $data + */ + public static function sanitizeForSerialization(mixed $data, string $type = null, string $format = null): mixed + { + if (is_scalar($data) || null === $data) { + return $data; + } + + if ($data instanceof DateTime) { + return ($format === 'date') ? $data->format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if ($data instanceof \BackedEnum) { + return $data->value; + } + + if (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } + + if (is_object($data)) { + $values = []; + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null && !in_array($openAPIType, [{{&primitives}}], true)) { + if (is_subclass_of($openAPIType, '\BackedEnum')) { + if (is_scalar($value)) { + $value = $openAPIType::tryFrom($value); + if ($value === null) { + $imploded = implode("', '", array_map(fn($case) => $case->value, $openAPIType::cases())); + throw new \InvalidArgumentException( + sprintf( + "Invalid value for enum '%s', must be one of: '%s'", + $openAPIType::class, + $imploded + ) + ); + } + } + } + } + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); + } + } + return (object)$values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename(string $filename): string + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Shorter timestamp microseconds to 6 digits length. + * + * @param string $timestamp Original timestamp + * + * @return string the shorten timestamp + */ + public static function sanitizeTimestamp(string $timestamp): string + { + return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue(string $value): string + { + return rawurlencode(self::toString($value)); + } + + /** + * Checks if a value is empty, based on its OpenAPI type. + * + * @param mixed $value + * @param string $openApiType + * + * @return bool true if $value is empty + */ + private static function isEmptyValue(mixed $value, string $openApiType): bool + { + # If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + # Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + return match ($openApiType) { + # For numeric values, false and '' are considered empty. + # This comparison is safe for floating point values, since the previous call to empty() will + # filter out values that don't match 0. + 'int','integer' => $value !== 0, + 'number'|'float' => $value !== 0 && $value !== 0.0, + + # For boolean values, '' is considered empty + 'bool','boolean' => !in_array($value, [false, 0], true), + + # For string values, '' is considered empty. + 'string' => $value === '', + + # For all the other types, any value at this point can be considered empty. + default => true + }; + } + + /** + * Take query parameter properties and turn it into an array suitable for + * native http_build_query or GuzzleHttp\Psr7\Query::build. + * + * @param mixed $value Parameter value + * @param string $paramName Parameter name + * @param string $openApiType OpenAPIType e.g. array or object + * @param string $style Parameter serialization style + * @param bool $explode Parameter explode option + * @param bool $required Whether query param is required or not + * + * @return array + */ + public static function toQueryValue( + mixed $value, + string $paramName, + string $openApiType = 'string', + string $style = 'form', + bool $explode = true, + bool $required = true + ): array { + + # Check if we should omit this parameter from the query. This should only happen when: + # - Parameter is NOT required; AND + # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + # example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { + if ($required) { + return ["{$paramName}" => '']; + } else { + return []; + } + } + + # Handle DateTime objects in query + if($openApiType === "\DateTime" && $value instanceof DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + + $query = []; + $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; + + // since \GuzzleHttp\Psr7\Query::build fails with nested arrays + // need to flatten array first + $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { + if (!is_array($arr)) return $arr; + + foreach ($arr as $k => $v) { + $prop = ($style === 'deepObject') ? "{$name}[{$k}]" : $k; + + if (is_array($v)) { + $flattenArray($v, $prop, $result); + } else { + if ($style !== 'deepObject' && !$explode) { + // push key itself + $result[] = $prop; + } + $result[$prop] = $v; + } + } + return $result; + }; + + $value = $flattenArray($value, $paramName); + + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { + return $value; + } + + if ('boolean' === $openApiType && is_bool($value)) { + $value = self::convertBoolToQueryStringFormat($value); + } + + // handle style in serializeCollection + $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); + + return $query; + } + + /** + * Convert boolean value to format for query string. + * + * @param bool $value Boolean value + * + * @return int|string Boolean value in format + */ + public static function convertBoolToQueryStringFormat(bool $value): int|string + { + if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { + return $value ? 'true' : 'false'; + } + + return (int) $value; + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue(string $value): string + { + $callable = [$value, 'toHeaderValue']; + if (is_callable($callable)) { + return $callable(); + } + + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the http body (form parameter). If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string|\SplFileObject $value the value of the form parameter + * + * @return string the form string + */ + public static function toFormValue(string|\SplFileObject $value): string + { + if ($value instanceof \SplFileObject) { + return $value->getRealPath(); + } else { + return self::toString($value); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". + * + * @param string|bool|DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString(string|bool|DateTime $value): string + { + if ($value instanceof DateTime) { // datetime in ISO8601 format + return $value->format(self::$dateTimeFormat); + } elseif (is_bool($value)) { + return $value ? 'true' : 'false'; + } else { + return (string) $value; + } + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $style the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, string $style, bool $allowCollectionFormatMulti = false): string + { + if ($allowCollectionFormatMulti && ('multi' === $style)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + return match ($style) { + 'pipeDelimited', 'pipes' => implode('|', $collection), + 'tsv' => implode("\t", $collection), + 'spaceDelimited', 'ssv' => implode(' ', $collection), + default => implode(',', $collection), + }; + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[]|null $httpHeaders HTTP headers + * + * @return mixed a single or an array of $class instances + */ + public static function deserialize(mixed $data, string $class, array $httpHeaders = null): mixed + { + if (null === $data) { + return null; + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + + if (!is_array($data)) { + throw new \InvalidArgumentException("Invalid array '$class'"); + } + + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } + + if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } + + if ($class === 'mixed') { + settype($data, gettype($data)); + return $data; + } + + if ($class === '\DateTime') { + // Some APIs return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + try { + return new DateTime($data); + } catch (\Exception $exception) { + // Some APIs return a date-time with too high nanosecond + // precision for php's DateTime to handle. + // With provided regexp 6 digits of microseconds saved + return new DateTime(self::sanitizeTimestamp($data)); + } + } else { + return null; + } + } + + if ($class === '\Psr\Http\Message\StreamInterface') { + return Utils::streamFor($data); + } + + if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if ( + is_array($httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) + && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) + ) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } + + /** @psalm-suppress ParadoxicalCondition */ + // handle primitive types + if (in_array($class, ['\DateTime', '\SplFileObject'], true)) { + return $data; + } elseif (in_array($class, ['array', 'bool', 'boolean', 'float', 'double', 'int', 'integer', 'object', 'string', 'null'], true)) { + // type ref: https://www.php.net/manual/en/function.settype.php + // byte, mixed, void in the old php client were removed + settype($data, $class); + return $data; + } + + + if (is_subclass_of($class, '\BackedEnum')) { + $data = $class::tryFrom($data); + if ($data === null) { + $imploded = implode("', '", array_map(fn($case) => $case->value, $class::cases())); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\{{invokerPackage}}\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + + /** @var ModelInterface $instance */ + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + + continue; + } + + if (isset($data->{$instance::attributeMap()[$property]})) { + $propertyValue = $data->{$instance::attributeMap()[$property]}; + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } + + /** + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; + } +} diff --git a/template/php-nextgen/README.mustache b/template/php-nextgen/README.mustache new file mode 100644 index 0000000..6343a4d --- /dev/null +++ b/template/php-nextgen/README.mustache @@ -0,0 +1,161 @@ +# {{artifactDescription}} + +{{#appDescriptionWithNewLines}} +{{{.}}} +{{/appDescriptionWithNewLines}} + +{{#infoUrl}} +For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}). +{{/infoUrl}} + +Brevo's API matches the [OpenAPI v2 definition](https://www.openapis.org/). The specification can be downloaded [here](https://api.brevo.com/v3/swagger_definition.yml). + + +## Installation & Usage + +### Requirements + +PHP 8.1 and later. + +### Composer + +To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`: + +```json +{ + "require": { + "{{gitUserId}}/{{gitRepoId}}": "*" + } +} +``` + +Then run `composer install` + +### Manual Installation + +Download the files and include `autoload.php`: + +```php + php_doc_auth_partial}} +$apiInstance = new {{invokerPackage}}\Api\{{classname}}( + // 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(){{#hasAuthMethods}}, + $config{{/hasAuthMethods}} +); +{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}}{{#description}} | {{{.}}}{{/description}} +{{/allParams}} + +try { + {{#returnType}}$result = {{/returnType}}$apiInstance->{{{operationId}}}({{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} + print_r($result);{{/returnType}} +} catch (Exception $e) { + echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL; +} +{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} +``` + +## API Endpoints + +All URIs are relative to *{{basePath}}* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}} +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} +## Models + +{{#models}}{{#model}}- [{{{classname}}}]({{modelDocPath}}/{{{classname}}}.md){{/model}} +{{/models}} + +## Authorization +{{^authMethods}} +All endpoints do not require authorization. +{{/authMethods}} +{{#authMethods}} +{{#last}} Authentication schemes defined for the API:{{/last}} +### {{{name}}} +{{#isApiKey}} + +- **Type**: API key +- **API key parameter name**: {{{keyParamName}}} +- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} + +{{/isApiKey}} +{{#isBasic}} +{{#isBasicBasic}} + +- **Type**: HTTP basic authentication +{{/isBasicBasic}} +{{#isBasicBearer}} + +- **Type**: Bearer authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} +{{/isBasicBearer}} +{{/isBasic}} +{{#isOAuth}} + +- **Type**: `OAuth` +- **Flow**: `{{{flow}}}` +- **Authorization URL**: `{{{authorizationUrl}}}` +- **Scopes**: {{^scopes}}N/A{{/scopes}} +{{#scopes}} + - **{{{scope}}}**: {{{description}}} +{{/scopes}} +{{/isOAuth}} + +{{/authMethods}} +## Tests + +To run the tests, use: + +```bash +composer install +vendor/bin/phpunit +``` + +## Author + +{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} +{{/-last}}{{/apis}}{{/apiInfo}} +## About this package + +## partner-key + +The partner key should be passed in the request headers as `partner-key` along with `api-key` pair for successful authentication of partner (Optional). + +- **Type**: API key +- **API key parameter name**: partner-key +- **Location**: HTTP header + + +If you find a bug, please post the issue on [Github](https://github.com/getbrevo/brevo-php/issues). + +As always, if you need additional assistance, drop us a note [here](https://account.brevo.com/support). + +You can generate the PHP code with the CLI command: openapi-generator generate --skip-validate-spec -c config-openapi-generator.yml + +This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: `{{appVersion}}` +{{#artifactVersion}} + - Package version: `{{.}}` +{{/artifactVersion}} +{{^hideGenerationTimestamp}} + - Build date: `{{generatedDate}}` +{{/hideGenerationTimestamp}} + - Generator version: `{{generatorVersion}}` +- Build package: `{{generatorClass}}` + diff --git a/template/php-nextgen/api.mustache b/template/php-nextgen/api.mustache new file mode 100644 index 0000000..006cbbc --- /dev/null +++ b/template/php-nextgen/api.mustache @@ -0,0 +1,942 @@ +partial_header}} +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace {{apiPackage}}; + +use InvalidArgumentException; +use GuzzleHttp\Client; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\Exception\ConnectException; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\RequestOptions; +use GuzzleHttp\Promise\PromiseInterface; +use {{invokerPackage}}\ApiException; +use {{invokerPackage}}\Configuration; +use {{invokerPackage}}\HeaderSelector; +use {{invokerPackage}}\ObjectSerializer; + +/** + * {{classname}} Class Doc Comment + * + * @package {{invokerPackage}} + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +{{#operations}}class {{classname}} +{ + /** + * @var ClientInterface + */ + protected ClientInterface $client; + + /** + * @var Configuration + */ + protected Configuration $config; + + /** + * @var HeaderSelector + */ + protected HeaderSelector $headerSelector; + + /** + * @var int Host index + */ + protected int $hostIndex; + + /** @var string[] $contentTypes **/ + public const contentTypes = [{{#operation}} + '{{{operationId}}}' => [{{#consumes}} + '{{{mediaType}}}',{{/consumes}} + {{^consumes}} + 'application/json', +{{/consumes}} ],{{/operation}} + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + +{{#operation}} + /** + * Operation {{{operationId}}} +{{#summary}} + * + * {{.}} +{{/summary}} + * +{{#description}} + * {{.}} + * +{{/description}} +{{#vendorExtensions.x-group-parameters}} + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * +{{/vendorExtensions.x-group-parameters}} +{{#servers}} +{{#-first}} + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. +{{/-first}} + * URL: {{{url}}} +{{#variables}} +{{#-first}} + * Variables: +{{/-first}} + * - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} +{{#-first}} + * Allowed values: +{{/-first}} + * - {{{.}}}{{/enumValues}} +{{/variables}} +{{#-last}} + * +{{/-last}} +{{/servers}} +{{#allParams}} + * @param {{{dataType}}}{{^required}}|null{{/required}} ${{paramName}}{{#description}} {{.}}{{/description}}{{^description}} {{paramName}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} +{{/allParams}} +{{#servers}} +{{#-first}} + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. +{{/-first}} +{{/servers}} + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}void{{/returnType}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + public function {{operationId}}( + {{^vendorExtensions.x-group-parameters}} + {{#allParams}} + {{^required}}?{{/required}}{{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, + {{/allParams}} + {{#servers}} + {{#-first}} + ?int $hostIndex = null, + array $variables = [], + {{/-first}} + {{/servers}} + string $contentType = self::contentTypes['{{{operationId}}}'][0] + {{/vendorExtensions.x-group-parameters}} + {{#vendorExtensions.x-group-parameters}} + array $associative_array + {{/vendorExtensions.x-group-parameters}} + ): {{{vendorExtensions.x-php-return-type}}} + { + {{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});{{#returnType}} + return $response;{{/returnType}} + } + + /** + * Operation {{{operationId}}}WithHttpInfo +{{#summary}} + * + * {{.}} +{{/summary}} + * +{{#description}} + * {{.}} + * +{{/description}} +{{#vendorExtensions.x-group-parameters}} + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * +{{/vendorExtensions.x-group-parameters}} +{{#servers}} +{{#-first}} + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. +{{/-first}} + * URL: {{{url}}} +{{#variables}} +{{#-first}} + * Variables: +{{/-first}} + * - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} +{{#-first}} + * Allowed values: +{{/-first}} + * - {{{.}}}{{/enumValues}} +{{/variables}} +{{#-last}} + * +{{/-last}} +{{/servers}} +{{#allParams}} + * @param {{{dataType}}}{{^required}}|null{{/required}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} +{{/allParams}} +{{#servers}} +{{#-first}} + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. +{{/-first}} +{{/servers}} + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings) + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + public function {{operationId}}WithHttpInfo( + {{^vendorExtensions.x-group-parameters}} + {{#allParams}} + {{^required}}?{{/required}}{{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, + {{/allParams}} + {{#servers}} + {{#-first}} + ?int $hostIndex = null, + array $variables = [], + {{/-first}} + {{/servers}} + string $contentType = self::contentTypes['{{{operationId}}}'][0] + {{/vendorExtensions.x-group-parameters}} + {{#vendorExtensions.x-group-parameters}} + array $associative_array + {{/vendorExtensions.x-group-parameters}} + ): array + { + $request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + {{#returnType}} + {{#responses}} + {{#-first}} + + switch($statusCode) { + {{/-first}} + {{#dataType}} + {{^isRange}}{{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}} + if (in_array('{{{dataType}}}', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('{{{dataType}}}' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '{{{dataType}}}', []), + $response->getStatusCode(), + $response->getHeaders() + ];{{/isRange}} + {{/dataType}} + {{#-last}} + } + {{/-last}} + {{/responses}} + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '{{{returnType}}}'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + {{/returnType}} + {{^returnType}} + + return [null, $statusCode, $response->getHeaders()]; + {{/returnType}} + + } catch (ApiException $e) { + switch ($e->getCode()) { + {{#responses}} + {{#dataType}} + {{^isRange}}{{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}} + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '{{{dataType}}}', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break;{{/isRange}} + {{/dataType}} + {{/responses}} + } + throw $e; + } + } + + /** + * Operation {{{operationId}}}Async + * +{{#summary}} + * {{.}} + * +{{/summary}} +{{#description}} + * {{.}} + * +{{/description}} +{{#vendorExtensions.x-group-parameters}} + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * +{{/vendorExtensions.x-group-parameters}} +{{#servers}} +{{#-first}} + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. +{{/-first}} + * URL: {{{url}}} +{{#variables}} +{{#-first}} + * Variables: +{{/-first}} + * - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} +{{#-first}} + * Allowed values: +{{/-first}} + * - {{{.}}}{{/enumValues}} +{{/variables}} +{{#-last}} + * +{{/-last}} +{{/servers}} +{{#allParams}} + * @param {{{dataType}}}{{^required}}|null{{/required}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} +{{/allParams}} +{{#servers}} +{{#-first}} + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. +{{/-first}} +{{/servers}} + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + public function {{operationId}}Async( + {{^vendorExtensions.x-group-parameters}} + {{#allParams}} + {{^required}}?{{/required}}{{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, + {{/allParams}} + {{#servers}} + {{#-first}} + ?int $hostIndex = null, + array $variables = [], + {{/-first}} + {{/servers}} + string $contentType = self::contentTypes['{{{operationId}}}'][0] + {{/vendorExtensions.x-group-parameters}} + {{#vendorExtensions.x-group-parameters}} + array $associative_array + {{/vendorExtensions.x-group-parameters}} + ): PromiseInterface + { + return $this->{{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation {{{operationId}}}AsyncWithHttpInfo + * +{{#summary}} + * {{.}} + * +{{/summary}} +{{#description}} + * {{.}} + * +{{/description}} +{{#vendorExtensions.x-group-parameters}} + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * +{{/vendorExtensions.x-group-parameters}} +{{#servers}} +{{#-first}} + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. +{{/-first}} + * URL: {{{url}}} +{{#variables}} +{{#-first}} + * Variables: +{{/-first}} + * - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} +{{#-first}} + * Allowed values: +{{/-first}} + * - {{{.}}}{{/enumValues}} +{{/variables}} +{{#-last}} + * +{{/-last}} +{{/servers}} +{{#allParams}} + * @param {{{dataType}}}{{^required}}|null{{/required}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} +{{/allParams}} +{{#servers}} +{{#-first}} + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. +{{/-first}} +{{/servers}} + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + public function {{operationId}}AsyncWithHttpInfo( + {{^vendorExtensions.x-group-parameters}} + {{#allParams}} + ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, + {{/allParams}} + {{#servers}} + {{#-first}} + ?int $hostIndex = null, + array $variables = [], + {{/-first}} + {{/servers}} + string $contentType = self::contentTypes['{{{operationId}}}'][0] + {{/vendorExtensions.x-group-parameters}} + {{#vendorExtensions.x-group-parameters}} + array $associative_array + {{/vendorExtensions.x-group-parameters}} + ): PromiseInterface + { + $returnType = '{{{returnType}}}'; + $request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + {{#returnType}} + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + {{/returnType}} + {{^returnType}} + return [null, $response->getStatusCode(), $response->getHeaders()]; + {{/returnType}} + }, + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation '{{{operationId}}}' + * +{{#vendorExtensions.x-group-parameters}} + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * +{{/vendorExtensions.x-group-parameters}} +{{#servers}} +{{#-first}} + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. +{{/-first}} + * URL: {{{url}}} +{{#variables}} +{{#-first}} + * Variables: +{{/-first}} + * - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} +{{#-first}} + * Allowed values: +{{/-first}} + * - {{{.}}}{{/enumValues}} +{{/variables}} +{{#-last}} + * +{{/-last}} +{{/servers}} +{{#allParams}} + * @param {{{dataType}}}{{^required}}|null{{/required}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} +{{/allParams}} +{{#servers}} +{{#-first}} + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. +{{/-first}} +{{/servers}} + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + public function {{operationId}}Request( + {{^vendorExtensions.x-group-parameters}} + {{#allParams}} + ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, + {{/allParams}} + {{#servers}} + {{#-first}} + ?int $hostIndex = null, + array $variables = [], + {{/-first}} + {{/servers}} + string $contentType = self::contentTypes['{{{operationId}}}'][0] + {{/vendorExtensions.x-group-parameters}} + {{#vendorExtensions.x-group-parameters}} + array $associative_array + {{/vendorExtensions.x-group-parameters}} + ): Request + { + {{#vendorExtensions.x-group-parameters}} + // unbox the parameters from the associative array +{{#allParams}} + ${{paramName}} = array_key_exists('{{paramName}}', $associative_array) ? $associative_array['{{paramName}}'] : {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}; +{{/allParams}}{{#servers.0}} + $hostIndex = $associative_array['hostIndex']; + $variables = array_key_exists('variables', $associative_array) ? $associative_array['variables'] : []; +{{/servers.0}} + $contentType = $associative_array['contentType'] ?? self::contentTypes['{{{operationId}}}'][0]; + {{/vendorExtensions.x-group-parameters}}{{#allParams}} + {{#required}} + // verify the required parameter '{{paramName}}' is set + if (${{paramName}} === null || (is_array(${{paramName}}) && count(${{paramName}}) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter ${{paramName}} when calling {{operationId}}' + ); + } + {{/required}} + {{#hasValidation}} + {{#maxLength}} + if ({{^required}}${{paramName}} !== null && {{/required}}strlen(${{paramName}}) > {{maxLength}}) { + throw new InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.'); + } + {{/maxLength}} + {{#minLength}} + if ({{^required}}${{paramName}} !== null && {{/required}}strlen(${{paramName}}) < {{minLength}}) { + throw new InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); + } + {{/minLength}} + {{#maximum}} + if ({{^required}}${{paramName}} !== null && {{/required}}${{paramName}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) { + throw new InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}.'); + } + {{/maximum}} + {{#minimum}} + if ({{^required}}${{paramName}} !== null && {{/required}}${{paramName}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) { + throw new InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}.'); + } + {{/minimum}} + {{#pattern}} + if ({{^required}}${{paramName}} !== null && {{/required}}!preg_match("{{{pattern}}}", ${{paramName}})) { + throw new InvalidArgumentException("invalid value for \"{{paramName}}\" when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}."); + } + {{/pattern}} + {{#maxItems}} + if ({{^required}}${{paramName}} !== null && {{/required}}count(${{paramName}}) > {{maxItems}}) { + throw new InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{maxItems}}.'); + } + {{/maxItems}} + {{#minItems}} + if ({{^required}}${{paramName}} !== null && {{/required}}count(${{paramName}}) < {{minItems}}) { + throw new InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{minItems}}.'); + } + {{/minItems}} + {{/hasValidation}}{{/allParams}} + + $resourcePath = '{{{path}}}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + {{#queryParams}} + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + ${{paramName}}, + '{{baseName}}', // param base name + '{{#schema}}{{openApiType}}{{/schema}}', // openApiType + '{{style}}', // style + {{#isExplode}}true{{/isExplode}}{{^isExplode}}false{{/isExplode}}, // explode + {{required}} // required + ) ?? []); + {{/queryParams}} + + {{#headerParams}} + // header params + {{#collectionFormat}} + if (is_array(${{paramName}})) { + ${{paramName}} = ObjectSerializer::serializeCollection(${{paramName}}, '{{collectionFormat}}'); + } + {{/collectionFormat}} + if (${{paramName}} !== null) { + $headerParams['{{baseName}}'] = ObjectSerializer::toHeaderValue(${{paramName}}); + } + {{/headerParams}} + + {{#pathParams}} + // path params + {{#collectionFormat}} + if (is_array(${{paramName}})) { + ${{paramName}} = ObjectSerializer::serializeCollection(${{paramName}}, '{{collectionFormat}}'); + } + {{/collectionFormat}} + if (${{paramName}} !== null) { + $resourcePath = str_replace( + '{' . '{{baseName}}' . '}', + ObjectSerializer::toPathValue(${{paramName}}), + $resourcePath + ); + } + {{/pathParams}} + + {{#formParams}} + // form params + if (${{paramName}} !== null) { + {{#isFile}} + $multipart = true; + $formParams['{{baseName}}'] = []; + $paramFiles = is_array(${{paramName}}) ? ${{paramName}} : [${{paramName}}]; + foreach ($paramFiles as $paramFile) { + $formParams['{{baseName}}'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface + ? $paramFile + : \GuzzleHttp\Psr7\Utils::tryFopen( + ObjectSerializer::toFormValue($paramFile), + 'rb' + ); + } + {{/isFile}} + {{^isFile}} + $formParams['{{baseName}}'] = ObjectSerializer::toFormValue(${{paramName}}); + {{/isFile}} + } + {{/formParams}} + + $headers = $this->headerSelector->selectHeaders( + [{{#produces}}'{{{mediaType}}}', {{/produces}}], + $contentType, + $multipart + ); + + // for model (json/xml) + {{#bodyParams}} + if (isset(${{paramName}})) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization(${{paramName}})); + } else { + $httpBody = ${{paramName}}; + } + } elseif (count($formParams) > 0) { + {{/bodyParams}} + {{^bodyParams}} + if (count($formParams) > 0) { + {{/bodyParams}} + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + {{#authMethods}} + {{#isApiKey}} + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('{{keyParamName}}'); + if ($apiKey !== null) { + {{#isKeyInHeader}}$headers['{{keyParamName}}'] = $apiKey;{{/isKeyInHeader}}{{#isKeyInQuery}}$queryParams['{{keyParamName}}'] = $apiKey;{{/isKeyInQuery}} + } + {{/isApiKey}} + {{#isBasic}} + {{#isBasicBasic}} + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + {{/isBasicBasic}} + {{#isBasicBearer}} + // this endpoint requires Bearer{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + {{/isBasicBearer}} + {{/isBasic}} + {{#isOAuth}} + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + {{/isOAuth}} + {{/authMethods}} + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + {{#servers.0}} + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsFor{{operationId}}(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + {{/servers.0}} + {{^servers.0}} + $operationHost = $this->config->getHost(); + {{/servers.0}} + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + '{{httpMethod}}', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + {{#servers.0}} + /** + * Returns an array of host settings for Operation {{operationId}} + * + * @return array an array of host settings + */ + protected function getHostSettingsFor{{operationId}}(): array + { + return [ + {{#servers}} + [ + "url" => "{{{url}}}", + "description" => "{{{description}}}{{^description}}No description provided{{/description}}", + {{#variables}} + {{#-first}} + "variables" => [ + {{/-first}} + "{{{name}}}" => [ + "description" => "{{{description}}}{{^description}}No description provided{{/description}}", + "default_value" => "{{{defaultValue}}}", + {{#enumValues}} + {{#-first}} + "enum_values" => [ + {{/-first}} + "{{{.}}}", + {{#-last}} + ] + {{/-last}} + {{/enumValues}} + ]{{^-last}},{{/-last}} + {{#-last}} + ] + {{/-last}} + {{/variables}} + ]{{^-last}},{{/-last}} + {{/servers}} + ]; + } + + {{/servers.0}} + {{/operation}} + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $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; + } +} +{{/operations}} diff --git a/template/php-nextgen/api_doc.mustache b/template/php-nextgen/api_doc.mustache new file mode 100644 index 0000000..db04fa5 --- /dev/null +++ b/template/php-nextgen/api_doc.mustache @@ -0,0 +1,104 @@ +# {{invokerPackage}}\{{classname}}{{#description}} + +{{.}}{{/description}} + +All URIs are relative to {{basePath}}, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +{{#operations}}{{#operation}}| [**{{operationId}}()**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} | +{{/operation}}{{/operations}}{{#operations}}{{#operation}} + +## `{{{operationId}}}()` + +```php +{{{operationId}}}({{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}){{#returnType}}: {{{.}}}{{/returnType}} +``` +{{#servers}} +{{#-first}} +### URI(s): +{{/-first}} +- {{{url}}} {{#description}}{{.}}{{/description}}{{#variables}} +{{#-first}} + - Variables: +{{/-first}} + - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} +{{#-first}} + - Allowed values: +{{/-first}} + - {{{.}}}{{/enumValues}}{{#defaultValue}} + - Default value: {{{.}}} +{{/defaultValue}}{{/variables}}{{/servers}} +{{{summary}}}{{#notes}} + +{{{.}}}{{/notes}} + +### Example + +```php + php_doc_auth_partial}} +$apiInstance = new {{invokerPackage}}\Api\{{classname}}( + // 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(){{#hasAuthMethods}}, + $config{{/hasAuthMethods}} +); +{{^vendorExtensions.x-group-parameters}} +{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}}{{#description}} | {{{.}}}{{/description}} +{{/allParams}}{{#servers}}{{#-first}} +$hostIndex = 0; +$variables = [{{#variables}} + '{{{name}}}' => '{{{default}}}{{^default}}YOUR_VALUE{{/default}}',{{/variables}} +]; +{{/-first}}{{/servers}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}} +$associative_array = [ +{{#allParams}} '{{paramName}}' => {{{example}}}, // {{{dataType}}}{{#description}} | {{{.}}}{{/description}} +{{/allParams}} +{{#servers}}{{#-first}} + 'hostIndex' => 0, + $variables = [{{#variables}} + '{{{name}}}' => '{{{default}}}{{^default}}YOUR_VALUE{{/default}}',{{/variables}} + ], +{{/-first}}{{/servers}}]; +{{/vendorExtensions.x-group-parameters}} + +try { + {{#returnType}}$result = {{/returnType}}$apiInstance->{{{operationId}}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#servers}}{{#-first}}{{#allParams}}{{#-first}}, {{/-first}}{{/allParams}}$hostIndex, $variables{{/-first}}{{/servers}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associate_array{{/vendorExtensions.x-group-parameters}});{{#returnType}} + print_r($result);{{/returnType}} +} catch (Exception $e) { + echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +{{#vendorExtensions.x-group-parameters}} +Note: the input parameter is an associative array with the keys listed as the parameter names below. + +{{/vendorExtensions.x-group-parameters}} +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- |{{/-last}}{{/allParams}} +{{#allParams}}| **{{paramName}}** | {{#isFile}}**{{{dataType}}}**{{/isFile}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{{dataType}}}**](../Model/{{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}} | +{{/allParams}}{{#servers}}{{#-first}}| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |{{/-first}} +{{/servers}} + +### Return type + +{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**](../Model/{{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}} + +### Authorization + +{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}} + +### HTTP request headers + +- **Content-Type**: {{#consumes}}`{{{mediaType}}}`{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} +- **Accept**: {{#produces}}`{{{mediaType}}}`{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md){{/operation}}{{/operations}} diff --git a/template/php-nextgen/api_test.mustache b/template/php-nextgen/api_test.mustache new file mode 100644 index 0000000..f7c4012 --- /dev/null +++ b/template/php-nextgen/api_test.mustache @@ -0,0 +1,77 @@ +partial_header}} +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Please update the test case below to test the endpoint. + */ + +namespace {{invokerPackage}}\Test\Api; + +use {{invokerPackage}}\Configuration; +use {{invokerPackage}}\ApiException; +use {{invokerPackage}}\ObjectSerializer; +use PHPUnit\Framework\TestCase; + +/** + * {{classname}}Test Class Doc Comment + * + * @package {{invokerPackage}} + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +{{#operations}}class {{classname}}Test extends TestCase +{ + + /** + * Setup before running any test cases + */ + public static function setUpBeforeClass(): void + { + } + + /** + * Setup before running each test case + */ + public function setUp(): void + { + } + + /** + * Clean up after running each test case + */ + public function tearDown(): void + { + } + + /** + * Clean up after running all test cases + */ + public static function tearDownAfterClass(): void + { + } + {{#operation}} + + /** + * Test case for {{{operationId}}} + * + * {{{summary}}}. + * + */ + public function test{{vendorExtensions.x-test-operation-id}}() + { + // TODO: implement + self::markTestIncomplete('Not implemented'); + } + {{/operation}} +} +{{/operations}} diff --git a/template/php-nextgen/composer.mustache b/template/php-nextgen/composer.mustache new file mode 100644 index 0000000..1eb9eb8 --- /dev/null +++ b/template/php-nextgen/composer.mustache @@ -0,0 +1,47 @@ +{ + {{#composerPackageName}} + "name": "{{.}}", + {{/composerPackageName}} + "description": "Official Brevo provided RESTFul API V3 php library", + "keywords": [ + "brevo", + "swagger", + "php", + "sdk", + "api" + ], + "homepage": "https://github.com/getbrevo/brevo-php", + "license": "MIT", + "authors": [ + { + "name": "Brevo Developers", + "email": "contact@brevo.com", + "homepage": "https://www.brevo.com/" + } + ], + "require": { + "php": "^8.1", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "guzzlehttp/guzzle": "^7.4.5", + "guzzlehttp/psr7": "^2.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.5", + "overtrue/phplint": "^9.0", + "phpunit/phpunit": "^9.0" + }, + "autoload": { + "psr-4": { "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" } + }, + "autoload-dev": { + "psr-4": { "{{escapedInvokerPackage}}\\Test\\" : "{{testBasePath}}/" } + }, + "scripts": { + "test": [ + "@phplint" + ], + "phplint": "phplint" + } +} diff --git a/template/php-nextgen/git_push.sh.mustache b/template/php-nextgen/git_push.sh.mustache new file mode 100644 index 0000000..0e3776a --- /dev/null +++ b/template/php-nextgen/git_push.sh.mustache @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="{{{gitHost}}}" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="{{{gitUserId}}}" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="{{{gitRepoId}}}" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="{{{releaseNote}}}" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/template/php-nextgen/gitignore b/template/php-nextgen/gitignore new file mode 100644 index 0000000..cc2a4bd --- /dev/null +++ b/template/php-nextgen/gitignore @@ -0,0 +1,19 @@ +# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore + +composer.phar +/vendor/ + +# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control +# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file +# makes sense since it's a library(client SDK) and not a project +composer.lock + +# php-cs-fixer cache +.php_cs.cache +.php-cs-fixer.cache + +# PHPUnit cache +.phpunit.result.cache + +# PHPLint cache +build/phplint.cache diff --git a/template/php-nextgen/model.mustache b/template/php-nextgen/model.mustache new file mode 100644 index 0000000..323a21d --- /dev/null +++ b/template/php-nextgen/model.mustache @@ -0,0 +1,47 @@ +partial_header}} +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace {{modelPackage}}; +{{^isEnum}} +{{^parentSchema}} + +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use {{invokerPackage}}\ObjectSerializer; +{{/parentSchema}} +{{/isEnum}} + +/** + * {{classname}} Class Doc Comment + * +{{#description}} + * @description {{.}} +{{/description}} + * @package {{invokerPackage}} + * @author OpenAPI Generator team + * @link https://openapi-generator.tech +{{^isEnum}} + * @implements ArrayAccess +{{/isEnum}} + */ +{{#isEnum}}{{>model_enum}}{{/isEnum}}{{^isEnum}}{{>model_generic}}{{/isEnum}} +{{/model}}{{/models}} diff --git a/template/php-nextgen/model_abstract.mustache b/template/php-nextgen/model_abstract.mustache new file mode 100644 index 0000000..4b39606 --- /dev/null +++ b/template/php-nextgen/model_abstract.mustache @@ -0,0 +1,255 @@ + + */ + protected static array $openAPINullables = []; + + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + protected function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + protected function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + protected function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } + + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + +} diff --git a/template/php-nextgen/model_doc.mustache b/template/php-nextgen/model_doc.mustache new file mode 100644 index 0000000..43b0ab6 --- /dev/null +++ b/template/php-nextgen/model_doc.mustache @@ -0,0 +1,10 @@ +# {{#models}}{{#model}}# {{classname}} + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} |{{^required}} [optional]{{/required}}{{#isReadOnly}} [readonly]{{/isReadOnly}}{{#defaultValue}} [default to {{{.}}}]{{/defaultValue}} +{{/vars}} + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md){{/model}}{{/models}} diff --git a/template/php-nextgen/model_enum.mustache b/template/php-nextgen/model_enum.mustache new file mode 100644 index 0000000..d0a2437 --- /dev/null +++ b/template/php-nextgen/model_enum.mustache @@ -0,0 +1,16 @@ +enum {{classname}}: {{vendorExtensions.x-php-enum-type}} +{ + {{#allowableValues}} + {{#enumVars}} + {{#enumDescription}} + /** + * {{enumDescription}} + */ + {{/enumDescription}} + case {{{name}}} = {{{value}}}; +{{^-last}} + +{{/-last}} + {{/enumVars}} + {{/allowableValues}} +} diff --git a/template/php-nextgen/model_generic.mustache b/template/php-nextgen/model_generic.mustache new file mode 100644 index 0000000..b2a6392 --- /dev/null +++ b/template/php-nextgen/model_generic.mustache @@ -0,0 +1,386 @@ +class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^parentSchema}}extends AbstractModel{{/parentSchema}} +{ + public const DISCRIMINATOR = {{#discriminator}}'{{discriminatorName}}'{{/discriminator}}{{^discriminator}}null{{/discriminator}}; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '{{name}}'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + {{#vars}}'{{name}}' => '{{{dataType}}}'{{^-last}}, + {{/-last}}{{/vars}} + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + {{#vars}}'{{name}}' => {{#dataFormat}}'{{{.}}}'{{/dataFormat}}{{^dataFormat}}null{{/dataFormat}}{{^-last}}, + {{/-last}}{{/vars}} + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + {{#vars}}'{{name}}' => {{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{^-last}}, + {{/-last}}{{/vars}} + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + +{{#parentSchema}} /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes + parent::openAPITypes(); + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats + parent::openAPIFormats(); + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } +{{/parentSchema}} + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + {{#vars}}'{{name}}' => '{{baseName}}'{{^-last}}, + {{/-last}}{{/vars}} + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + {{#vars}}'{{name}}' => '{{setter}}'{{^-last}}, + {{/-last}}{{/vars}} + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + {{#vars}}'{{name}}' => '{{getter}}'{{^-last}}, + {{/-last}}{{/vars}} + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return {{#parentSchema}}parent::attributeMap() + {{/parentSchema}}self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return {{#parentSchema}}parent::setters() + {{/parentSchema}}self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return {{#parentSchema}}parent::getters() + {{/parentSchema}}self::$getters; + } + + {{#vars}} + {{#isEnum}} + {{#allowableValues}} + {{#enumVars}} + public const {{enumName}}_{{{name}}} = {{{value}}}; + {{/enumVars}} + {{/allowableValues}} + {{/isEnum}} + {{/vars}} + + {{#vars}} + {{#isEnum}} + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function {{getter}}AllowableValues() + { + return [ + {{#allowableValues}}{{#enumVars}}self::{{enumName}}_{{{name}}},{{^-last}} + {{/-last}}{{/enumVars}}{{/allowableValues}} + ]; + } + + {{/isEnum}} + {{/vars}} + {{^parentSchema}} + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + {{/parentSchema}} + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + {{#parentSchema}} + parent::__construct($data); + + {{/parentSchema}} + {{#vars}} + $this->setIfExists('{{name}}', $data ?? [], {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}); + {{/vars}} + {{#discriminator}} + + // Initialize discriminator property with the model name. + $this->container['{{discriminatorName}}'] = static::$openAPIModelName; + {{/discriminator}} + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + {{#parentSchema}} + $invalidProperties = parent::listInvalidProperties(); + {{/parentSchema}} + {{^parentSchema}} + $invalidProperties = []; + {{/parentSchema}} + + {{#vars}} + {{#required}} + if ($this->container['{{name}}'] === null) { + $invalidProperties[] = "'{{name}}' can't be null"; + } + {{/required}} + {{#isEnum}} + {{^isContainer}} + $allowedValues = $this->{{getter}}AllowableValues(); + if (!is_null($this->container['{{name}}']) && !in_array($this->container['{{name}}'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for '{{name}}', must be one of '%s'", + $this->container['{{name}}'], + implode("', '", $allowedValues) + ); + } + + {{/isContainer}} + {{/isEnum}} + {{#hasValidation}} + {{#maxLength}} + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}(mb_strlen($this->container['{{name}}']) > {{maxLength}})) { + $invalidProperties[] = "invalid value for '{{name}}', the character length must be smaller than or equal to {{{maxLength}}}."; + } + + {{/maxLength}} + {{#minLength}} + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}(mb_strlen($this->container['{{name}}']) < {{minLength}})) { + $invalidProperties[] = "invalid value for '{{name}}', the character length must be bigger than or equal to {{{minLength}}}."; + } + + {{/minLength}} + {{#maximum}} + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}($this->container['{{name}}'] >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}})) { + $invalidProperties[] = "invalid value for '{{name}}', must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}."; + } + + {{/maximum}} + {{#minimum}} + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}($this->container['{{name}}'] <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}})) { + $invalidProperties[] = "invalid value for '{{name}}', must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}."; + } + + {{/minimum}} + {{#pattern}} + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}!preg_match("{{{pattern}}}", $this->container['{{name}}'])) { + $invalidProperties[] = "invalid value for '{{name}}', must be conform to the pattern {{{pattern}}}."; + } + + {{/pattern}} + {{#maxItems}} + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}(count($this->container['{{name}}']) > {{maxItems}})) { + $invalidProperties[] = "invalid value for '{{name}}', number of items must be less than or equal to {{{maxItems}}}."; + } + + {{/maxItems}} + {{#minItems}} + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}(count($this->container['{{name}}']) < {{minItems}})) { + $invalidProperties[] = "invalid value for '{{name}}', number of items must be greater than or equal to {{{minItems}}}."; + } + + {{/minItems}} + {{/hasValidation}} + {{/vars}} + return $invalidProperties; + } + {{#vars}} + + /** + * Gets {{name}} + * + * @return {{{dataType}}}{{^required}}|null{{/required}} + {{#deprecated}} + * @deprecated + {{/deprecated}} + */ + public function {{getter}}(): {{vendorExtensions.x-php-prop-type}} + { + return $this->container['{{name}}']; + } + + /** + * Sets {{name}} + * + * @param {{{dataType}}}{{^required}}|null{{/required}} ${{name}}{{#description}} {{{.}}}{{/description}}{{^description}} {{{name}}}{{/description}} + * + * @return $this + {{#deprecated}} + * @deprecated + {{/deprecated}} + */ + public function {{setter}}({{vendorExtensions.x-php-prop-type}} ${{name}}): static + { + {{#isNullable}} + if (is_null(${{name}})) { + array_push($this->openAPINullablesSetToNull, '{{name}}'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('{{name}}', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + {{/isNullable}} + {{^isNullable}} + if (is_null(${{name}})) { + throw new InvalidArgumentException('non-nullable {{name}} cannot be null'); + } + {{/isNullable}} + {{#isEnum}} + $allowedValues = $this->{{getter}}AllowableValues(); + {{^isContainer}} + if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}!in_array(${{{name}}}, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for '{{name}}', must be one of '%s'", + ${{{name}}}, + implode("', '", $allowedValues) + ) + ); + } + {{/isContainer}} + {{#isContainer}} + if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}array_diff(${{{name}}}, $allowedValues)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value for '{{name}}', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + {{/isContainer}} + {{/isEnum}} + {{#hasValidation}} + {{#maxLength}} + if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(mb_strlen(${{name}}) > {{maxLength}})) { + throw new InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.'); + }{{/maxLength}} + {{#minLength}} + if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(mb_strlen(${{name}}) < {{minLength}})) { + throw new InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); + } + {{/minLength}} + {{#maximum}} + if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(${{name}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}})) { + throw new InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}.'); + } + {{/maximum}} + {{#minimum}} + if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(${{name}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}})) { + throw new InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}.'); + } + {{/minimum}} + {{#pattern}} + if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(!preg_match("{{{pattern}}}", ObjectSerializer::toString(${{name}})))) { + throw new InvalidArgumentException("invalid value for \${{name}} when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}."); + } + {{/pattern}} + {{#maxItems}} + if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(count(${{name}}) > {{maxItems}})) { + throw new InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{maxItems}}.'); + }{{/maxItems}} + {{#minItems}} + if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(count(${{name}}) < {{minItems}})) { + throw new InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{minItems}}.'); + } + {{/minItems}} + {{/hasValidation}} + $this->container['{{name}}'] = ${{name}}; + + return $this; + } + {{/vars}} +} diff --git a/template/php-nextgen/model_test.mustache b/template/php-nextgen/model_test.mustache new file mode 100644 index 0000000..4e6d790 --- /dev/null +++ b/template/php-nextgen/model_test.mustache @@ -0,0 +1,85 @@ +partial_header}} +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Please update the test case below to test the model. + */ + +namespace {{invokerPackage}}\Test\Model; + +use PHPUnit\Framework\TestCase; + +/** + * {{classname}}Test Class Doc Comment + * + * @description {{description}}{{^description}}{{classname}}{{/description}} + * @package {{invokerPackage}} + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +class {{classname}}Test extends TestCase +{ + + /** + * Setup before running any test case + */ + public static function setUpBeforeClass(): void + { + } + + /** + * Setup before running each test case + */ + public function setUp(): void + { + } + + /** + * Clean up after running each test case + */ + public function tearDown(): void + { + } + + /** + * Clean up after running all test cases + */ + public static function tearDownAfterClass(): void + { + } + + /** + * Test "{{classname}}" + */ + public function test{{classname}}() + { + // TODO: implement + self::markTestIncomplete('Not implemented'); + } +{{#vars}} + + /** + * Test attribute "{{name}}" + */ + public function testProperty{{nameInPascalCase}}() + { + // TODO: implement + self::markTestIncomplete('Not implemented'); + } +{{/vars}} +} +{{/model}} +{{/models}} diff --git a/template/php-nextgen/partial_header.mustache b/template/php-nextgen/partial_header.mustache new file mode 100644 index 0000000..fc90916 --- /dev/null +++ b/template/php-nextgen/partial_header.mustache @@ -0,0 +1,18 @@ +/** + {{#appName}} + * {{{.}}} + * + {{/appName}} + {{#appDescription}} + * {{{.}}} + * + {{/appDescription}} + {{#version}} + * The version of the OpenAPI document: {{{.}}} + {{/version}} + {{#infoEmail}} + * Contact: {{{.}}} + {{/infoEmail}} + * @generated Generated by: https://openapi-generator.tech + * Generator version: {{{generatorVersion}}} + */ diff --git a/template/php-nextgen/php_doc_auth_partial.mustache b/template/php-nextgen/php_doc_auth_partial.mustache new file mode 100644 index 0000000..2821506 --- /dev/null +++ b/template/php-nextgen/php_doc_auth_partial.mustache @@ -0,0 +1,23 @@ +{{#hasAuthMethods}}{{#authMethods}} +{{#isBasic}} +{{#isBasicBasic}} +// Configure HTTP basic authorization: {{{name}}} +$config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration() + ->setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); +{{/isBasicBasic}} +{{#isBasicBearer}} +// Configure Bearer{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} authorization: {{{name}}} +$config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); +{{/isBasicBearer}} +{{/isBasic}} +{{#isApiKey}} +// Configure API key authorization: {{{name}}} +$config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKey('{{{keyParamName}}}', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'Bearer'); +{{/isApiKey}} +{{#isOAuth}} +// Configure OAuth2 access token for authorization: {{{name}}} +$config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); +{{/isOAuth}}{{/authMethods}}{{/hasAuthMethods}} diff --git a/template/php-nextgen/phpunit.xml.mustache b/template/php-nextgen/phpunit.xml.mustache new file mode 100644 index 0000000..b72fb7c --- /dev/null +++ b/template/php-nextgen/phpunit.xml.mustache @@ -0,0 +1,18 @@ + + + + + {{apiSrcPath}} + {{modelSrcPath}} + + + + + {{apiTestPath}} + {{modelTestPath}} + + + + + + From a9460c86cc502f8947b47d8b1ae1301bf910fd76 Mon Sep 17 00:00:00 2001 From: Damien TUPINIER Date: Sun, 24 Nov 2024 15:48:47 +0100 Subject: [PATCH 2/8] Rename and update namespaces for models Renamed files and updated namespaces from `Brevo\Client\Model` to `Brevo\Client\Models` for improved consistency and organization. Also, adjusted related type references to match the new namespace structure. --- .../AbTestCampaignResult.php | 22 +++---- .../AbTestCampaignResultClickedLinks.php | 18 +++--- .../AbTestCampaignResultStatistics.php | 38 ++++++------ lib/{Model => Models}/AbTestVersionClicks.php | 16 ++--- .../AbTestVersionClicksInner.php | 6 +- lib/{Model => Models}/AbTestVersionStats.php | 2 +- lib/{Model => Models}/AddChildDomain.php | 2 +- lib/{Model => Models}/AddContactToList.php | 6 +- lib/{Model => Models}/AddCredits.php | 6 +- .../AuthenticateDomainModel.php | 6 +- lib/{Model => Models}/BlockDomain.php | 6 +- lib/{Model => Models}/Body.php | 2 +- lib/{Model => Models}/Body1.php | 6 +- lib/{Model => Models}/Body10.php | 6 +- lib/{Model => Models}/Body11.php | 6 +- lib/{Model => Models}/Body12.php | 6 +- lib/{Model => Models}/Body13.php | 6 +- lib/{Model => Models}/Body14.php | 6 +- lib/{Model => Models}/Body2.php | 6 +- lib/{Model => Models}/Body3.php | 2 +- lib/{Model => Models}/Body4.php | 2 +- lib/{Model => Models}/Body5.php | 6 +- lib/{Model => Models}/Body6.php | 6 +- lib/{Model => Models}/Body7.php | 6 +- lib/{Model => Models}/Body8.php | 12 ++-- lib/{Model => Models}/Body9.php | 6 +- lib/{Model => Models}/BodyVariablesItems.php | 16 ++--- lib/{Model => Models}/CompaniesList.php | 8 +-- lib/{Model => Models}/Company.php | 6 +- lib/{Model => Models}/CompanyAttributes.php | 16 ++--- .../CompanyAttributesInner.php | 2 +- lib/{Model => Models}/ComponentItems.php | 6 +- lib/{Model => Models}/Contact.php | 6 +- .../ConversationsMessage.php | 14 ++--- .../ConversationsMessageFile.php | 8 +-- .../ConversationsMessageFileImageInfo.php | 6 +- lib/{Model => Models}/CreateApiKeyRequest.php | 6 +- .../CreateApiKeyResponse.php | 2 +- lib/{Model => Models}/CreateAttribute.php | 14 ++--- .../CreateAttributeEnumeration.php | 2 +- lib/{Model => Models}/CreateCategoryModel.php | 2 +- lib/{Model => Models}/CreateChild.php | 8 +-- lib/{Model => Models}/CreateContact.php | 6 +- .../CreateCouponCollection.php | 6 +- lib/{Model => Models}/CreateCoupons.php | 2 +- lib/{Model => Models}/CreateDoiContact.php | 6 +- lib/{Model => Models}/CreateDomain.php | 2 +- lib/{Model => Models}/CreateDomainModel.php | 12 ++-- .../CreateDomainModelDnsRecords.php | 18 +++--- .../CreateDomainModelDnsRecordsDkimRecord.php | 2 +- lib/{Model => Models}/CreateEmailCampaign.php | 14 ++--- .../CreateEmailCampaignRecipients.php | 2 +- .../CreateEmailCampaignSender.php | 2 +- lib/{Model => Models}/CreateExternalFeed.php | 14 ++--- lib/{Model => Models}/CreateList.php | 6 +- lib/{Model => Models}/CreateModel.php | 6 +- lib/{Model => Models}/CreateProductModel.php | 6 +- lib/{Model => Models}/CreateReseller.php | 6 +- lib/{Model => Models}/CreateSender.php | 12 ++-- lib/{Model => Models}/CreateSenderIps.php | 2 +- lib/{Model => Models}/CreateSenderModel.php | 6 +- lib/{Model => Models}/CreateSmsCampaign.php | 12 ++-- .../CreateSmsCampaignRecipients.php | 2 +- lib/{Model => Models}/CreateSmtpEmail.php | 6 +- lib/{Model => Models}/CreateSmtpTemplate.php | 12 ++-- .../CreateSmtpTemplateSender.php | 6 +- lib/{Model => Models}/CreateSubAccount.php | 8 +-- .../CreateSubAccountResponse.php | 6 +- .../CreateUpdateBatchCategory.php | 8 +-- .../CreateUpdateBatchCategoryModel.php | 6 +- .../CreateUpdateBatchProducts.php | 12 ++-- .../CreateUpdateBatchProductsModel.php | 6 +- .../CreateUpdateCategories.php | 6 +- .../CreateUpdateCategory.php | 2 +- .../CreateUpdateContactModel.php | 2 +- lib/{Model => Models}/CreateUpdateFolder.php | 2 +- lib/{Model => Models}/CreateUpdateProduct.php | 2 +- .../CreateUpdateProducts.php | 6 +- lib/{Model => Models}/CreateWebhook.php | 22 +++---- .../CreateWhatsAppCampaign.php | 12 ++-- .../CreateWhatsAppCampaignRecipients.php | 2 +- .../CreateWhatsAppTemplate.php | 10 ++-- lib/{Model => Models}/CreatedBatchId.php | 6 +- lib/{Model => Models}/CreatedProcessId.php | 6 +- lib/{Model => Models}/Deal.php | 6 +- lib/{Model => Models}/DealAttributes.php | 16 ++--- lib/{Model => Models}/DealAttributesInner.php | 6 +- lib/{Model => Models}/DealsList.php | 12 ++-- lib/{Model => Models}/DeleteHardbounces.php | 6 +- .../EmailExportRecipients.php | 8 +-- lib/{Model => Models}/ErrorModel.php | 8 +-- lib/{Model => Models}/Event.php | 12 ++-- lib/{Model => Models}/EventIdentifiers.php | 2 +- .../ExportWebhooksHistory.php | 10 ++-- lib/{Model => Models}/FileData.php | 6 +- .../FileDownloadableLink.php | 6 +- lib/{Model => Models}/FileList.php | 2 +- lib/{Model => Models}/GetAccount.php | 26 ++++---- lib/{Model => Models}/GetAccountActivity.php | 12 ++-- .../GetAccountActivityLogs.php | 6 +- .../GetAccountMarketingAutomation.php | 6 +- lib/{Model => Models}/GetAccountPlan.php | 2 +- lib/{Model => Models}/GetAccountRelay.php | 12 ++-- lib/{Model => Models}/GetAccountRelayData.php | 6 +- lib/{Model => Models}/GetAggregatedReport.php | 6 +- lib/{Model => Models}/GetAllExternalFeeds.php | 12 ++-- .../GetAllExternalFeedsFeeds.php | 14 ++--- lib/{Model => Models}/GetAttributes.php | 12 ++-- .../GetAttributesAttributes.php | 8 +-- .../GetAttributesEnumeration.php | 6 +- lib/{Model => Models}/GetBlockedDomains.php | 6 +- lib/{Model => Models}/GetCampaignOverview.php | 10 ++-- .../GetCampaignRecipients.php | 2 +- lib/{Model => Models}/GetCampaignStats.php | 6 +- lib/{Model => Models}/GetCategories.php | 6 +- lib/{Model => Models}/GetCategoryDetails.php | 6 +- .../GetChildAccountCreationStatus.php | 2 +- lib/{Model => Models}/GetChildDomain.php | 6 +- lib/{Model => Models}/GetChildDomains.php | 16 ++--- lib/{Model => Models}/GetChildInfo.php | 20 +++---- lib/{Model => Models}/GetChildInfoApiKeys.php | 18 +++--- .../GetChildInfoApiKeysV2.php | 6 +- .../GetChildInfoApiKeysV3.php | 6 +- lib/{Model => Models}/GetChildInfoCredits.php | 6 +- .../GetChildInfoStatistics.php | 6 +- lib/{Model => Models}/GetChildrenList.php | 6 +- lib/{Model => Models}/GetClient.php | 6 +- .../GetContactCampaignStats.php | 60 +++++++++---------- .../GetContactCampaignStatsClicked.php | 12 ++-- .../GetContactCampaignStatsOpened.php | 6 +- ...tContactCampaignStatsTransacAttributes.php | 6 +- ...GetContactCampaignStatsUnsubscriptions.php | 18 +++--- lib/{Model => Models}/GetContactDetails.php | 2 +- lib/{Model => Models}/GetContacts.php | 6 +- .../GetCorporateInvitedUsersList.php | 12 ++-- ...CorporateInvitedUsersListFeatureAccess.php | 6 +- .../GetCorporateInvitedUsersListGroups.php | 6 +- .../GetCorporateInvitedUsersListUsers.php | 18 +++--- lib/{Model => Models}/GetCouponCollection.php | 6 +- .../GetDeviceBrowserStats.php | 6 +- .../GetDomainConfigurationModel.php | 8 +-- lib/{Model => Models}/GetDomainsList.php | 12 ++-- .../GetDomainsListDomains.php | 2 +- lib/{Model => Models}/GetEmailCampaign.php | 8 +-- lib/{Model => Models}/GetEmailCampaigns.php | 6 +- lib/{Model => Models}/GetEmailEventReport.php | 12 ++-- .../GetEmailEventReportEvents.php | 2 +- .../GetExtendedCampaignOverview.php | 10 ++-- .../GetExtendedCampaignOverviewSender.php | 6 +- .../GetExtendedCampaignStats.php | 30 +++++----- .../GetExtendedCampaignStatsGlobalStats.php | 16 ++--- lib/{Model => Models}/GetExtendedClient.php | 14 ++--- .../GetExtendedClientAddress.php | 6 +- .../GetExtendedContactDetails.php | 8 +-- .../GetExtendedContactDetailsStatistics.php | 54 ++++++++--------- ...xtendedContactDetailsStatisticsClicked.php | 12 ++-- ...endedContactDetailsStatisticsDelivered.php | 2 +- ...tExtendedContactDetailsStatisticsLinks.php | 6 +- ...edContactDetailsStatisticsMessagesSent.php | 6 +- ...ExtendedContactDetailsStatisticsOpened.php | 6 +- ...ontactDetailsStatisticsUnsubscriptions.php | 14 ++--- ...ticsUnsubscriptionsAdminUnsubscription.php | 6 +- ...sticsUnsubscriptionsUserUnsubscription.php | 6 +- lib/{Model => Models}/GetExtendedList.php | 14 ++--- .../GetExtendedListCampaignStats.php | 8 +-- .../GetExternalFeedByUUID.php | 8 +-- .../GetExternalFeedByUUIDHeaders.php | 6 +- lib/{Model => Models}/GetFolder.php | 2 +- lib/{Model => Models}/GetFolderLists.php | 6 +- lib/{Model => Models}/GetFolders.php | 2 +- .../GetInboundEmailEvents.php | 8 +-- .../GetInboundEmailEventsByUuid.php | 18 +++--- ...GetInboundEmailEventsByUuidAttachments.php | 6 +- .../GetInboundEmailEventsByUuidLogs.php | 2 +- .../GetInboundEmailEventsEvents.php | 6 +- lib/{Model => Models}/GetInvitedUsersList.php | 12 ++-- .../GetInvitedUsersListFeatureAccess.php | 6 +- .../GetInvitedUsersListUsers.php | 12 ++-- lib/{Model => Models}/GetIp.php | 6 +- lib/{Model => Models}/GetIpFromSender.php | 2 +- lib/{Model => Models}/GetIps.php | 12 ++-- lib/{Model => Models}/GetIpsFromSender.php | 8 +-- lib/{Model => Models}/GetList.php | 6 +- lib/{Model => Models}/GetLists.php | 6 +- lib/{Model => Models}/GetOrders.php | 2 +- lib/{Model => Models}/GetProcess.php | 8 +-- lib/{Model => Models}/GetProcesses.php | 12 ++-- lib/{Model => Models}/GetProductDetails.php | 6 +- lib/{Model => Models}/GetProducts.php | 6 +- lib/{Model => Models}/GetReports.php | 8 +-- lib/{Model => Models}/GetReportsReports.php | 6 +- .../GetScheduledEmailByBatchId.php | 12 ++-- .../GetScheduledEmailByBatchIdBatches.php | 8 +-- .../GetScheduledEmailByMessageId.php | 2 +- lib/{Model => Models}/GetSegments.php | 12 ++-- lib/{Model => Models}/GetSegmentsSegments.php | 6 +- lib/{Model => Models}/GetSendersList.php | 12 ++-- lib/{Model => Models}/GetSendersListIps.php | 6 +- .../GetSendersListSenders.php | 8 +-- .../GetSharedTemplateUrl.php | 6 +- lib/{Model => Models}/GetSmsCampaign.php | 2 +- .../GetSmsCampaignOverview.php | 8 +-- .../GetSmsCampaignRecipients.php | 16 ++--- lib/{Model => Models}/GetSmsCampaignStats.php | 2 +- lib/{Model => Models}/GetSmsCampaigns.php | 6 +- lib/{Model => Models}/GetSmsEventReport.php | 8 +-- .../GetSmsEventReportEvents.php | 8 +-- .../GetSmtpTemplateOverview.php | 8 +-- .../GetSmtpTemplateOverviewSender.php | 6 +- lib/{Model => Models}/GetSmtpTemplates.php | 12 ++-- lib/{Model => Models}/GetSsoToken.php | 2 +- lib/{Model => Models}/GetStatsByBrowser.php | 16 ++--- lib/{Model => Models}/GetStatsByDevice.php | 26 ++++---- lib/{Model => Models}/GetStatsByDomain.php | 2 +- .../GetTransacAggregatedSmsReport.php | 6 +- .../GetTransacBlockedContacts.php | 12 ++-- .../GetTransacBlockedContactsContacts.php | 8 +-- .../GetTransacBlockedContactsReason.php | 8 +-- .../GetTransacEmailContent.php | 12 ++-- .../GetTransacEmailContentEvents.php | 6 +- .../GetTransacEmailsList.php | 12 ++-- ...etTransacEmailsListTransactionalEmails.php | 2 +- lib/{Model => Models}/GetTransacSmsReport.php | 8 +-- .../GetTransacSmsReportReports.php | 6 +- lib/{Model => Models}/GetUserPermission.php | 12 ++-- .../GetUserPermissionPrivileges.php | 6 +- lib/{Model => Models}/GetWATemplates.php | 12 ++-- .../GetWATemplatesTemplates.php | 2 +- lib/{Model => Models}/GetWebhook.php | 20 +++---- lib/{Model => Models}/GetWebhookAuth.php | 6 +- lib/{Model => Models}/GetWebhookHeaders.php | 6 +- lib/{Model => Models}/GetWebhooks.php | 6 +- lib/{Model => Models}/GetWhatsAppConfig.php | 10 ++-- .../GetWhatsappCampaignOverview.php | 20 +++---- .../GetWhatsappCampaigns.php | 12 ++-- .../GetWhatsappCampaignsCampaigns.php | 8 +-- .../GetWhatsappEventReport.php | 8 +-- .../GetWhatsappEventReportEvents.php | 8 +-- lib/{Model => Models}/InlineResponse200.php | 2 +- lib/{Model => Models}/InlineResponse2001.php | 6 +- lib/{Model => Models}/InlineResponse2002.php | 2 +- lib/{Model => Models}/InlineResponse201.php | 6 +- lib/{Model => Models}/InlineResponse2011.php | 6 +- lib/{Model => Models}/InlineResponse2012.php | 6 +- lib/{Model => Models}/InlineResponse2013.php | 6 +- lib/{Model => Models}/InlineResponse2014.php | 6 +- lib/{Model => Models}/InlineResponse2015.php | 6 +- lib/{Model => Models}/InviteAdminUser.php | 8 +-- .../InviteAdminUserPrivileges.php | 10 ++-- lib/{Model => Models}/Inviteuser.php | 12 ++-- .../InviteuserPrivileges.php | 10 ++-- lib/{Model => Models}/ManageIp.php | 6 +- .../MasterDetailsResponse.php | 18 +++--- .../MasterDetailsResponseBillingInfo.php | 14 ++--- ...asterDetailsResponseBillingInfoAddress.php | 6 +- .../MasterDetailsResponseBillingInfoName.php | 6 +- .../MasterDetailsResponsePlanInfo.php | 8 +-- .../MasterDetailsResponsePlanInfoFeatures.php | 6 +- lib/{Model => Models}/ModelInterface.php | 6 +- lib/{Model => Models}/Note.php | 6 +- lib/{Model => Models}/NoteData.php | 2 +- lib/{Model => Models}/NoteId.php | 6 +- lib/{Model => Models}/NoteList.php | 16 ++--- lib/{Model => Models}/Order.php | 18 +++--- lib/{Model => Models}/OrderBatch.php | 8 +-- lib/{Model => Models}/OrderBilling.php | 6 +- lib/{Model => Models}/OrderProducts.php | 6 +- lib/{Model => Models}/Otp.php | 2 +- lib/{Model => Models}/Pipeline.php | 12 ++-- lib/{Model => Models}/PipelineStage.php | 2 +- lib/{Model => Models}/Pipelines.php | 16 ++--- lib/{Model => Models}/PostContactInfo.php | 12 ++-- .../PostContactInfoContacts.php | 6 +- lib/{Model => Models}/PostSendFailed.php | 2 +- .../PostSendSmsTestFailed.php | 6 +- .../PutRevokeUserPermission.php | 6 +- .../Putresendcancelinvitation.php | 2 +- .../RemainingCreditModel.php | 18 +++--- .../RemainingCreditModelChild.php | 6 +- .../RemainingCreditModelReseller.php | 6 +- .../RemoveContactFromList.php | 6 +- lib/{Model => Models}/RemoveCredits.php | 6 +- .../RequestContactExport.php | 8 +-- ...equestContactExportCustomContactFilter.php | 12 ++-- .../RequestContactImport.php | 18 +++--- .../RequestContactImportJsonBody.php | 6 +- .../RequestContactImportNewList.php | 6 +- .../RequestSmsRecipientExport.php | 2 +- lib/{Model => Models}/ScheduleSmtpEmail.php | 2 +- lib/{Model => Models}/SendReport.php | 8 +-- lib/{Model => Models}/SendReportEmail.php | 6 +- lib/{Model => Models}/SendSms.php | 2 +- lib/{Model => Models}/SendSmtpEmail.php | 44 +++++++------- .../SendSmtpEmailAttachment.php | 2 +- lib/{Model => Models}/SendSmtpEmailBcc.php | 2 +- lib/{Model => Models}/SendSmtpEmailCc.php | 6 +- .../SendSmtpEmailMessageVersions.php | 30 +++++----- .../SendSmtpEmailReplyTo.php | 6 +- .../SendSmtpEmailReplyTo1.php | 6 +- lib/{Model => Models}/SendSmtpEmailSender.php | 6 +- lib/{Model => Models}/SendSmtpEmailTo.php | 6 +- lib/{Model => Models}/SendSmtpEmailTo1.php | 6 +- lib/{Model => Models}/SendTestEmail.php | 2 +- lib/{Model => Models}/SendTestSms.php | 6 +- lib/{Model => Models}/SendTransacSms.php | 8 +-- lib/{Model => Models}/SendWhatsappMessage.php | 6 +- lib/{Model => Models}/SsoTokenRequest.php | 8 +-- .../SubAccountAppsToggleRequest.php | 6 +- .../SubAccountDetailsResponse.php | 12 ++-- .../SubAccountDetailsResponsePlanInfo.php | 18 +++--- ...bAccountDetailsResponsePlanInfoCredits.php | 8 +-- ...ntDetailsResponsePlanInfoCreditsEmails.php | 6 +- ...AccountDetailsResponsePlanInfoFeatures.php | 24 ++++---- ...ntDetailsResponsePlanInfoFeaturesInbox.php | 2 +- ...ilsResponsePlanInfoFeaturesLandingPage.php | 6 +- ...ntDetailsResponsePlanInfoFeaturesUsers.php | 6 +- .../SubAccountUpdatePlanRequest.php | 18 +++--- .../SubAccountUpdatePlanRequestCredits.php | 6 +- .../SubAccountUpdatePlanRequestFeatures.php | 6 +- lib/{Model => Models}/SubAccountsResponse.php | 12 ++-- .../SubAccountsResponseSubAccounts.php | 6 +- lib/{Model => Models}/Task.php | 2 +- lib/{Model => Models}/TaskList.php | 12 ++-- lib/{Model => Models}/TaskReminder.php | 8 +-- lib/{Model => Models}/TaskTypes.php | 2 +- lib/{Model => Models}/UpdateAttribute.php | 12 ++-- .../UpdateAttributeEnumeration.php | 6 +- lib/{Model => Models}/UpdateBatchContacts.php | 12 ++-- .../UpdateBatchContactsContacts.php | 6 +- .../UpdateBatchContactsModel.php | 2 +- .../UpdateCampaignStatus.php | 2 +- lib/{Model => Models}/UpdateChild.php | 2 +- .../UpdateChildAccountStatus.php | 2 +- lib/{Model => Models}/UpdateChildDomain.php | 6 +- lib/{Model => Models}/UpdateContact.php | 6 +- .../UpdateCouponCollection.php | 6 +- lib/{Model => Models}/UpdateEmailCampaign.php | 14 ++--- .../UpdateEmailCampaignRecipients.php | 6 +- .../UpdateEmailCampaignSender.php | 2 +- lib/{Model => Models}/UpdateExternalFeed.php | 14 ++--- lib/{Model => Models}/UpdateList.php | 6 +- lib/{Model => Models}/UpdateSender.php | 12 ++-- lib/{Model => Models}/UpdateSmsCampaign.php | 12 ++-- lib/{Model => Models}/UpdateSmtpTemplate.php | 12 ++-- .../UpdateSmtpTemplateSender.php | 2 +- lib/{Model => Models}/UpdateWebhook.php | 14 ++--- .../UpdateWhatsAppCampaign.php | 8 +-- lib/{Model => Models}/UploadImageModel.php | 6 +- .../UploadImageToGallery.php | 6 +- lib/{Model => Models}/VariablesItems.php | 6 +- lib/{Model => Models}/WhatsappCampStats.php | 6 +- .../WhatsappCampTemplate.php | 20 +++---- 352 files changed, 1466 insertions(+), 1466 deletions(-) rename lib/{Model => Models}/AbTestCampaignResult.php (96%) rename lib/{Model => Models}/AbTestCampaignResultClickedLinks.php (94%) rename lib/{Model => Models}/AbTestCampaignResultStatistics.php (89%) rename lib/{Model => Models}/AbTestVersionClicks.php (98%) rename lib/{Model => Models}/AbTestVersionClicksInner.php (99%) rename lib/{Model => Models}/AbTestVersionStats.php (99%) rename lib/{Model => Models}/AddChildDomain.php (99%) rename lib/{Model => Models}/AddContactToList.php (99%) rename lib/{Model => Models}/AddCredits.php (99%) rename lib/{Model => Models}/AuthenticateDomainModel.php (99%) rename lib/{Model => Models}/BlockDomain.php (99%) rename lib/{Model => Models}/Body.php (99%) rename lib/{Model => Models}/Body1.php (99%) rename lib/{Model => Models}/Body10.php (99%) rename lib/{Model => Models}/Body11.php (99%) rename lib/{Model => Models}/Body12.php (99%) rename lib/{Model => Models}/Body13.php (99%) rename lib/{Model => Models}/Body14.php (99%) rename lib/{Model => Models}/Body2.php (99%) rename lib/{Model => Models}/Body3.php (99%) rename lib/{Model => Models}/Body4.php (99%) rename lib/{Model => Models}/Body5.php (99%) rename lib/{Model => Models}/Body6.php (99%) rename lib/{Model => Models}/Body7.php (99%) rename lib/{Model => Models}/Body8.php (98%) rename lib/{Model => Models}/Body9.php (99%) rename lib/{Model => Models}/BodyVariablesItems.php (98%) rename lib/{Model => Models}/CompaniesList.php (97%) rename lib/{Model => Models}/Company.php (99%) rename lib/{Model => Models}/CompanyAttributes.php (98%) rename lib/{Model => Models}/CompanyAttributesInner.php (99%) rename lib/{Model => Models}/ComponentItems.php (99%) rename lib/{Model => Models}/Contact.php (99%) rename lib/{Model => Models}/ConversationsMessage.php (98%) rename lib/{Model => Models}/ConversationsMessageFile.php (97%) rename lib/{Model => Models}/ConversationsMessageFileImageInfo.php (99%) rename lib/{Model => Models}/CreateApiKeyRequest.php (99%) rename lib/{Model => Models}/CreateApiKeyResponse.php (99%) rename lib/{Model => Models}/CreateAttribute.php (95%) rename lib/{Model => Models}/CreateAttributeEnumeration.php (99%) rename lib/{Model => Models}/CreateCategoryModel.php (99%) rename lib/{Model => Models}/CreateChild.php (99%) rename lib/{Model => Models}/CreateContact.php (99%) rename lib/{Model => Models}/CreateCouponCollection.php (99%) rename lib/{Model => Models}/CreateCoupons.php (99%) rename lib/{Model => Models}/CreateDoiContact.php (99%) rename lib/{Model => Models}/CreateDomain.php (99%) rename lib/{Model => Models}/CreateDomainModel.php (97%) rename lib/{Model => Models}/CreateDomainModelDnsRecords.php (93%) rename lib/{Model => Models}/CreateDomainModelDnsRecordsDkimRecord.php (99%) rename lib/{Model => Models}/CreateEmailCampaign.php (98%) rename lib/{Model => Models}/CreateEmailCampaignRecipients.php (99%) rename lib/{Model => Models}/CreateEmailCampaignSender.php (99%) rename lib/{Model => Models}/CreateExternalFeed.php (98%) rename lib/{Model => Models}/CreateList.php (99%) rename lib/{Model => Models}/CreateModel.php (99%) rename lib/{Model => Models}/CreateProductModel.php (99%) rename lib/{Model => Models}/CreateReseller.php (99%) rename lib/{Model => Models}/CreateSender.php (96%) rename lib/{Model => Models}/CreateSenderIps.php (99%) rename lib/{Model => Models}/CreateSenderModel.php (99%) rename lib/{Model => Models}/CreateSmsCampaign.php (98%) rename lib/{Model => Models}/CreateSmsCampaignRecipients.php (99%) rename lib/{Model => Models}/CreateSmtpEmail.php (99%) rename lib/{Model => Models}/CreateSmtpTemplate.php (98%) rename lib/{Model => Models}/CreateSmtpTemplateSender.php (99%) rename lib/{Model => Models}/CreateSubAccount.php (99%) rename lib/{Model => Models}/CreateSubAccountResponse.php (99%) rename lib/{Model => Models}/CreateUpdateBatchCategory.php (96%) rename lib/{Model => Models}/CreateUpdateBatchCategoryModel.php (99%) rename lib/{Model => Models}/CreateUpdateBatchProducts.php (96%) rename lib/{Model => Models}/CreateUpdateBatchProductsModel.php (99%) rename lib/{Model => Models}/CreateUpdateCategories.php (99%) rename lib/{Model => Models}/CreateUpdateCategory.php (99%) rename lib/{Model => Models}/CreateUpdateContactModel.php (99%) rename lib/{Model => Models}/CreateUpdateFolder.php (99%) rename lib/{Model => Models}/CreateUpdateProduct.php (99%) rename lib/{Model => Models}/CreateUpdateProducts.php (99%) rename lib/{Model => Models}/CreateWebhook.php (97%) rename lib/{Model => Models}/CreateWhatsAppCampaign.php (97%) rename lib/{Model => Models}/CreateWhatsAppCampaignRecipients.php (99%) rename lib/{Model => Models}/CreateWhatsAppTemplate.php (99%) rename lib/{Model => Models}/CreatedBatchId.php (99%) rename lib/{Model => Models}/CreatedProcessId.php (99%) rename lib/{Model => Models}/Deal.php (99%) rename lib/{Model => Models}/DealAttributes.php (98%) rename lib/{Model => Models}/DealAttributesInner.php (99%) rename lib/{Model => Models}/DealsList.php (97%) rename lib/{Model => Models}/DeleteHardbounces.php (99%) rename lib/{Model => Models}/EmailExportRecipients.php (99%) rename lib/{Model => Models}/ErrorModel.php (99%) rename lib/{Model => Models}/Event.php (97%) rename lib/{Model => Models}/EventIdentifiers.php (99%) rename lib/{Model => Models}/ExportWebhooksHistory.php (99%) rename lib/{Model => Models}/FileData.php (99%) rename lib/{Model => Models}/FileDownloadableLink.php (99%) rename lib/{Model => Models}/FileList.php (99%) rename lib/{Model => Models}/GetAccount.php (92%) rename lib/{Model => Models}/GetAccountActivity.php (96%) rename lib/{Model => Models}/GetAccountActivityLogs.php (99%) rename lib/{Model => Models}/GetAccountMarketingAutomation.php (99%) rename lib/{Model => Models}/GetAccountPlan.php (99%) rename lib/{Model => Models}/GetAccountRelay.php (97%) rename lib/{Model => Models}/GetAccountRelayData.php (99%) rename lib/{Model => Models}/GetAggregatedReport.php (99%) rename lib/{Model => Models}/GetAllExternalFeeds.php (96%) rename lib/{Model => Models}/GetAllExternalFeedsFeeds.php (98%) rename lib/{Model => Models}/GetAttributes.php (95%) rename lib/{Model => Models}/GetAttributesAttributes.php (97%) rename lib/{Model => Models}/GetAttributesEnumeration.php (99%) rename lib/{Model => Models}/GetBlockedDomains.php (99%) rename lib/{Model => Models}/GetCampaignOverview.php (99%) rename lib/{Model => Models}/GetCampaignRecipients.php (99%) rename lib/{Model => Models}/GetCampaignStats.php (99%) rename lib/{Model => Models}/GetCategories.php (99%) rename lib/{Model => Models}/GetCategoryDetails.php (99%) rename lib/{Model => Models}/GetChildAccountCreationStatus.php (99%) rename lib/{Model => Models}/GetChildDomain.php (99%) rename lib/{Model => Models}/GetChildDomains.php (98%) rename lib/{Model => Models}/GetChildInfo.php (93%) rename lib/{Model => Models}/GetChildInfoApiKeys.php (94%) rename lib/{Model => Models}/GetChildInfoApiKeysV2.php (99%) rename lib/{Model => Models}/GetChildInfoApiKeysV3.php (99%) rename lib/{Model => Models}/GetChildInfoCredits.php (99%) rename lib/{Model => Models}/GetChildInfoStatistics.php (99%) rename lib/{Model => Models}/GetChildrenList.php (99%) rename lib/{Model => Models}/GetClient.php (99%) rename lib/{Model => Models}/GetContactCampaignStats.php (83%) rename lib/{Model => Models}/GetContactCampaignStatsClicked.php (96%) rename lib/{Model => Models}/GetContactCampaignStatsOpened.php (99%) rename lib/{Model => Models}/GetContactCampaignStatsTransacAttributes.php (99%) rename lib/{Model => Models}/GetContactCampaignStatsUnsubscriptions.php (90%) rename lib/{Model => Models}/GetContactDetails.php (99%) rename lib/{Model => Models}/GetContacts.php (99%) rename lib/{Model => Models}/GetCorporateInvitedUsersList.php (96%) rename lib/{Model => Models}/GetCorporateInvitedUsersListFeatureAccess.php (99%) rename lib/{Model => Models}/GetCorporateInvitedUsersListGroups.php (99%) rename lib/{Model => Models}/GetCorporateInvitedUsersListUsers.php (94%) rename lib/{Model => Models}/GetCouponCollection.php (99%) rename lib/{Model => Models}/GetDeviceBrowserStats.php (99%) rename lib/{Model => Models}/GetDomainConfigurationModel.php (97%) rename lib/{Model => Models}/GetDomainsList.php (96%) rename lib/{Model => Models}/GetDomainsListDomains.php (99%) rename lib/{Model => Models}/GetEmailCampaign.php (99%) rename lib/{Model => Models}/GetEmailCampaigns.php (99%) rename lib/{Model => Models}/GetEmailEventReport.php (96%) rename lib/{Model => Models}/GetEmailEventReportEvents.php (99%) rename lib/{Model => Models}/GetExtendedCampaignOverview.php (99%) rename lib/{Model => Models}/GetExtendedCampaignOverviewSender.php (99%) rename lib/{Model => Models}/GetExtendedCampaignStats.php (92%) rename lib/{Model => Models}/GetExtendedCampaignStatsGlobalStats.php (98%) rename lib/{Model => Models}/GetExtendedClient.php (96%) rename lib/{Model => Models}/GetExtendedClientAddress.php (99%) rename lib/{Model => Models}/GetExtendedContactDetails.php (98%) rename lib/{Model => Models}/GetExtendedContactDetailsStatistics.php (83%) rename lib/{Model => Models}/GetExtendedContactDetailsStatisticsClicked.php (96%) rename lib/{Model => Models}/GetExtendedContactDetailsStatisticsDelivered.php (99%) rename lib/{Model => Models}/GetExtendedContactDetailsStatisticsLinks.php (99%) rename lib/{Model => Models}/GetExtendedContactDetailsStatisticsMessagesSent.php (99%) rename lib/{Model => Models}/GetExtendedContactDetailsStatisticsOpened.php (99%) rename lib/{Model => Models}/GetExtendedContactDetailsStatisticsUnsubscriptions.php (90%) rename lib/{Model => Models}/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.php (99%) rename lib/{Model => Models}/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.php (99%) rename lib/{Model => Models}/GetExtendedList.php (96%) rename lib/{Model => Models}/GetExtendedListCampaignStats.php (97%) rename lib/{Model => Models}/GetExternalFeedByUUID.php (98%) rename lib/{Model => Models}/GetExternalFeedByUUIDHeaders.php (99%) rename lib/{Model => Models}/GetFolder.php (99%) rename lib/{Model => Models}/GetFolderLists.php (99%) rename lib/{Model => Models}/GetFolders.php (99%) rename lib/{Model => Models}/GetInboundEmailEvents.php (96%) rename lib/{Model => Models}/GetInboundEmailEventsByUuid.php (94%) rename lib/{Model => Models}/GetInboundEmailEventsByUuidAttachments.php (99%) rename lib/{Model => Models}/GetInboundEmailEventsByUuidLogs.php (99%) rename lib/{Model => Models}/GetInboundEmailEventsEvents.php (99%) rename lib/{Model => Models}/GetInvitedUsersList.php (96%) rename lib/{Model => Models}/GetInvitedUsersListFeatureAccess.php (99%) rename lib/{Model => Models}/GetInvitedUsersListUsers.php (97%) rename lib/{Model => Models}/GetIp.php (99%) rename lib/{Model => Models}/GetIpFromSender.php (99%) rename lib/{Model => Models}/GetIps.php (96%) rename lib/{Model => Models}/GetIpsFromSender.php (96%) rename lib/{Model => Models}/GetList.php (99%) rename lib/{Model => Models}/GetLists.php (99%) rename lib/{Model => Models}/GetOrders.php (99%) rename lib/{Model => Models}/GetProcess.php (99%) rename lib/{Model => Models}/GetProcesses.php (96%) rename lib/{Model => Models}/GetProductDetails.php (99%) rename lib/{Model => Models}/GetProducts.php (99%) rename lib/{Model => Models}/GetReports.php (96%) rename lib/{Model => Models}/GetReportsReports.php (99%) rename lib/{Model => Models}/GetScheduledEmailByBatchId.php (96%) rename lib/{Model => Models}/GetScheduledEmailByBatchIdBatches.php (99%) rename lib/{Model => Models}/GetScheduledEmailByMessageId.php (99%) rename lib/{Model => Models}/GetSegments.php (97%) rename lib/{Model => Models}/GetSegmentsSegments.php (99%) rename lib/{Model => Models}/GetSendersList.php (96%) rename lib/{Model => Models}/GetSendersListIps.php (99%) rename lib/{Model => Models}/GetSendersListSenders.php (97%) rename lib/{Model => Models}/GetSharedTemplateUrl.php (99%) rename lib/{Model => Models}/GetSmsCampaign.php (99%) rename lib/{Model => Models}/GetSmsCampaignOverview.php (99%) rename lib/{Model => Models}/GetSmsCampaignRecipients.php (98%) rename lib/{Model => Models}/GetSmsCampaignStats.php (99%) rename lib/{Model => Models}/GetSmsCampaigns.php (99%) rename lib/{Model => Models}/GetSmsEventReport.php (96%) rename lib/{Model => Models}/GetSmsEventReportEvents.php (99%) rename lib/{Model => Models}/GetSmtpTemplateOverview.php (98%) rename lib/{Model => Models}/GetSmtpTemplateOverviewSender.php (99%) rename lib/{Model => Models}/GetSmtpTemplates.php (96%) rename lib/{Model => Models}/GetSsoToken.php (99%) rename lib/{Model => Models}/GetStatsByBrowser.php (98%) rename lib/{Model => Models}/GetStatsByDevice.php (88%) rename lib/{Model => Models}/GetStatsByDomain.php (99%) rename lib/{Model => Models}/GetTransacAggregatedSmsReport.php (99%) rename lib/{Model => Models}/GetTransacBlockedContacts.php (96%) rename lib/{Model => Models}/GetTransacBlockedContactsContacts.php (97%) rename lib/{Model => Models}/GetTransacBlockedContactsReason.php (99%) rename lib/{Model => Models}/GetTransacEmailContent.php (97%) rename lib/{Model => Models}/GetTransacEmailContentEvents.php (99%) rename lib/{Model => Models}/GetTransacEmailsList.php (95%) rename lib/{Model => Models}/GetTransacEmailsListTransactionalEmails.php (99%) rename lib/{Model => Models}/GetTransacSmsReport.php (96%) rename lib/{Model => Models}/GetTransacSmsReportReports.php (99%) rename lib/{Model => Models}/GetUserPermission.php (96%) rename lib/{Model => Models}/GetUserPermissionPrivileges.php (99%) rename lib/{Model => Models}/GetWATemplates.php (96%) rename lib/{Model => Models}/GetWATemplatesTemplates.php (99%) rename lib/{Model => Models}/GetWebhook.php (97%) rename lib/{Model => Models}/GetWebhookAuth.php (99%) rename lib/{Model => Models}/GetWebhookHeaders.php (99%) rename lib/{Model => Models}/GetWebhooks.php (99%) rename lib/{Model => Models}/GetWhatsAppConfig.php (99%) rename lib/{Model => Models}/GetWhatsappCampaignOverview.php (97%) rename lib/{Model => Models}/GetWhatsappCampaigns.php (96%) rename lib/{Model => Models}/GetWhatsappCampaignsCampaigns.php (98%) rename lib/{Model => Models}/GetWhatsappEventReport.php (96%) rename lib/{Model => Models}/GetWhatsappEventReportEvents.php (99%) rename lib/{Model => Models}/InlineResponse200.php (99%) rename lib/{Model => Models}/InlineResponse2001.php (99%) rename lib/{Model => Models}/InlineResponse2002.php (99%) rename lib/{Model => Models}/InlineResponse201.php (99%) rename lib/{Model => Models}/InlineResponse2011.php (99%) rename lib/{Model => Models}/InlineResponse2012.php (99%) rename lib/{Model => Models}/InlineResponse2013.php (99%) rename lib/{Model => Models}/InlineResponse2014.php (99%) rename lib/{Model => Models}/InlineResponse2015.php (99%) rename lib/{Model => Models}/InviteAdminUser.php (97%) rename lib/{Model => Models}/InviteAdminUserPrivileges.php (99%) rename lib/{Model => Models}/Inviteuser.php (97%) rename lib/{Model => Models}/InviteuserPrivileges.php (99%) rename lib/{Model => Models}/ManageIp.php (99%) rename lib/{Model => Models}/MasterDetailsResponse.php (95%) rename lib/{Model => Models}/MasterDetailsResponseBillingInfo.php (94%) rename lib/{Model => Models}/MasterDetailsResponseBillingInfoAddress.php (99%) rename lib/{Model => Models}/MasterDetailsResponseBillingInfoName.php (99%) rename lib/{Model => Models}/MasterDetailsResponsePlanInfo.php (97%) rename lib/{Model => Models}/MasterDetailsResponsePlanInfoFeatures.php (99%) rename lib/{Model => Models}/ModelInterface.php (96%) rename lib/{Model => Models}/Note.php (99%) rename lib/{Model => Models}/NoteData.php (99%) rename lib/{Model => Models}/NoteId.php (99%) rename lib/{Model => Models}/NoteList.php (98%) rename lib/{Model => Models}/Order.php (97%) rename lib/{Model => Models}/OrderBatch.php (97%) rename lib/{Model => Models}/OrderBilling.php (99%) rename lib/{Model => Models}/OrderProducts.php (99%) rename lib/{Model => Models}/Otp.php (99%) rename lib/{Model => Models}/Pipeline.php (97%) rename lib/{Model => Models}/PipelineStage.php (99%) rename lib/{Model => Models}/Pipelines.php (98%) rename lib/{Model => Models}/PostContactInfo.php (96%) rename lib/{Model => Models}/PostContactInfoContacts.php (99%) rename lib/{Model => Models}/PostSendFailed.php (99%) rename lib/{Model => Models}/PostSendSmsTestFailed.php (99%) rename lib/{Model => Models}/PutRevokeUserPermission.php (99%) rename lib/{Model => Models}/Putresendcancelinvitation.php (99%) rename lib/{Model => Models}/RemainingCreditModel.php (94%) rename lib/{Model => Models}/RemainingCreditModelChild.php (99%) rename lib/{Model => Models}/RemainingCreditModelReseller.php (99%) rename lib/{Model => Models}/RemoveContactFromList.php (99%) rename lib/{Model => Models}/RemoveCredits.php (99%) rename lib/{Model => Models}/RequestContactExport.php (96%) rename lib/{Model => Models}/RequestContactExportCustomContactFilter.php (99%) rename lib/{Model => Models}/RequestContactImport.php (95%) rename lib/{Model => Models}/RequestContactImportJsonBody.php (99%) rename lib/{Model => Models}/RequestContactImportNewList.php (99%) rename lib/{Model => Models}/RequestSmsRecipientExport.php (99%) rename lib/{Model => Models}/ScheduleSmtpEmail.php (99%) rename lib/{Model => Models}/SendReport.php (97%) rename lib/{Model => Models}/SendReportEmail.php (99%) rename lib/{Model => Models}/SendSms.php (99%) rename lib/{Model => Models}/SendSmtpEmail.php (83%) rename lib/{Model => Models}/SendSmtpEmailAttachment.php (99%) rename lib/{Model => Models}/SendSmtpEmailBcc.php (99%) rename lib/{Model => Models}/SendSmtpEmailCc.php (99%) rename lib/{Model => Models}/SendSmtpEmailMessageVersions.php (90%) rename lib/{Model => Models}/SendSmtpEmailReplyTo.php (99%) rename lib/{Model => Models}/SendSmtpEmailReplyTo1.php (99%) rename lib/{Model => Models}/SendSmtpEmailSender.php (99%) rename lib/{Model => Models}/SendSmtpEmailTo.php (99%) rename lib/{Model => Models}/SendSmtpEmailTo1.php (99%) rename lib/{Model => Models}/SendTestEmail.php (99%) rename lib/{Model => Models}/SendTestSms.php (99%) rename lib/{Model => Models}/SendTransacSms.php (99%) rename lib/{Model => Models}/SendWhatsappMessage.php (99%) rename lib/{Model => Models}/SsoTokenRequest.php (99%) rename lib/{Model => Models}/SubAccountAppsToggleRequest.php (99%) rename lib/{Model => Models}/SubAccountDetailsResponse.php (97%) rename lib/{Model => Models}/SubAccountDetailsResponsePlanInfo.php (93%) rename lib/{Model => Models}/SubAccountDetailsResponsePlanInfoCredits.php (96%) rename lib/{Model => Models}/SubAccountDetailsResponsePlanInfoCreditsEmails.php (99%) rename lib/{Model => Models}/SubAccountDetailsResponsePlanInfoFeatures.php (90%) rename lib/{Model => Models}/SubAccountDetailsResponsePlanInfoFeaturesInbox.php (99%) rename lib/{Model => Models}/SubAccountDetailsResponsePlanInfoFeaturesLandingPage.php (99%) rename lib/{Model => Models}/SubAccountDetailsResponsePlanInfoFeaturesUsers.php (99%) rename lib/{Model => Models}/SubAccountUpdatePlanRequest.php (93%) rename lib/{Model => Models}/SubAccountUpdatePlanRequestCredits.php (99%) rename lib/{Model => Models}/SubAccountUpdatePlanRequestFeatures.php (99%) rename lib/{Model => Models}/SubAccountsResponse.php (96%) rename lib/{Model => Models}/SubAccountsResponseSubAccounts.php (99%) rename lib/{Model => Models}/Task.php (99%) rename lib/{Model => Models}/TaskList.php (97%) rename lib/{Model => Models}/TaskReminder.php (99%) rename lib/{Model => Models}/TaskTypes.php (99%) rename lib/{Model => Models}/UpdateAttribute.php (94%) rename lib/{Model => Models}/UpdateAttributeEnumeration.php (99%) rename lib/{Model => Models}/UpdateBatchContacts.php (96%) rename lib/{Model => Models}/UpdateBatchContactsContacts.php (99%) rename lib/{Model => Models}/UpdateBatchContactsModel.php (99%) rename lib/{Model => Models}/UpdateCampaignStatus.php (99%) rename lib/{Model => Models}/UpdateChild.php (99%) rename lib/{Model => Models}/UpdateChildAccountStatus.php (99%) rename lib/{Model => Models}/UpdateChildDomain.php (99%) rename lib/{Model => Models}/UpdateContact.php (99%) rename lib/{Model => Models}/UpdateCouponCollection.php (99%) rename lib/{Model => Models}/UpdateEmailCampaign.php (98%) rename lib/{Model => Models}/UpdateEmailCampaignRecipients.php (99%) rename lib/{Model => Models}/UpdateEmailCampaignSender.php (99%) rename lib/{Model => Models}/UpdateExternalFeed.php (98%) rename lib/{Model => Models}/UpdateList.php (99%) rename lib/{Model => Models}/UpdateSender.php (96%) rename lib/{Model => Models}/UpdateSmsCampaign.php (98%) rename lib/{Model => Models}/UpdateSmtpTemplate.php (98%) rename lib/{Model => Models}/UpdateSmtpTemplateSender.php (99%) rename lib/{Model => Models}/UpdateWebhook.php (96%) rename lib/{Model => Models}/UpdateWhatsAppCampaign.php (97%) rename lib/{Model => Models}/UploadImageModel.php (99%) rename lib/{Model => Models}/UploadImageToGallery.php (99%) rename lib/{Model => Models}/VariablesItems.php (99%) rename lib/{Model => Models}/WhatsappCampStats.php (99%) rename lib/{Model => Models}/WhatsappCampTemplate.php (95%) diff --git a/lib/Model/AbTestCampaignResult.php b/lib/Models/AbTestCampaignResult.php similarity index 96% rename from lib/Model/AbTestCampaignResult.php rename to lib/Models/AbTestCampaignResult.php index b9695a3..8146788 100644 --- a/lib/Model/AbTestCampaignResult.php +++ b/lib/Models/AbTestCampaignResult.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -63,8 +63,8 @@ class AbTestCampaignResult implements ModelInterface, ArrayAccess 'openRate' => 'string', 'clickRate' => 'string', 'winningVersionRate' => 'string', - 'statistics' => '\Brevo\Client\Model\AbTestCampaignResultStatistics', - 'clickedLinks' => '\Brevo\Client\Model\AbTestCampaignResultClickedLinks' + 'statistics' => '\Brevo\Client\Models\AbTestCampaignResultStatistics', + 'clickedLinks' => '\Brevo\Client\Models\AbTestCampaignResultClickedLinks' ]; /** @@ -200,9 +200,9 @@ public function getModelName() const WINNING_VERSION_B = 'B'; const WINNING_CRITERIA_OPEN = 'Open'; const WINNING_CRITERIA_CLICK = 'Click'; - - + + /** * Gets allowable values of the enum * @@ -218,7 +218,7 @@ public function getWinningVersionAllowableValues() self::WINNING_VERSION_B, ]; } - + /** * Gets allowable values of the enum * @@ -231,7 +231,7 @@ public function getWinningCriteriaAllowableValues() self::WINNING_CRITERIA_CLICK, ]; } - + /** * Associative array for storing property values @@ -463,7 +463,7 @@ public function setWinningVersionRate($winningVersionRate) /** * Gets statistics * - * @return \Brevo\Client\Model\AbTestCampaignResultStatistics + * @return \Brevo\Client\Models\AbTestCampaignResultStatistics */ public function getStatistics() { @@ -473,7 +473,7 @@ public function getStatistics() /** * Sets statistics * - * @param \Brevo\Client\Model\AbTestCampaignResultStatistics $statistics statistics + * @param \Brevo\Client\Models\AbTestCampaignResultStatistics $statistics statistics * * @return $this */ @@ -487,7 +487,7 @@ public function setStatistics($statistics) /** * Gets clickedLinks * - * @return \Brevo\Client\Model\AbTestCampaignResultClickedLinks + * @return \Brevo\Client\Models\AbTestCampaignResultClickedLinks */ public function getClickedLinks() { @@ -497,7 +497,7 @@ public function getClickedLinks() /** * Sets clickedLinks * - * @param \Brevo\Client\Model\AbTestCampaignResultClickedLinks $clickedLinks clickedLinks + * @param \Brevo\Client\Models\AbTestCampaignResultClickedLinks $clickedLinks clickedLinks * * @return $this */ diff --git a/lib/Model/AbTestCampaignResultClickedLinks.php b/lib/Models/AbTestCampaignResultClickedLinks.php similarity index 94% rename from lib/Model/AbTestCampaignResultClickedLinks.php rename to lib/Models/AbTestCampaignResultClickedLinks.php index 55733e5..897d99b 100644 --- a/lib/Model/AbTestCampaignResultClickedLinks.php +++ b/lib/Models/AbTestCampaignResultClickedLinks.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,8 +57,8 @@ class AbTestCampaignResultClickedLinks implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'versionA' => '\Brevo\Client\Model\AbTestVersionClicks', - 'versionB' => '\Brevo\Client\Model\AbTestVersionClicks' + 'versionA' => '\Brevo\Client\Models\AbTestVersionClicks', + 'versionB' => '\Brevo\Client\Models\AbTestVersionClicks' ]; /** @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -219,7 +219,7 @@ public function valid() /** * Gets versionA * - * @return \Brevo\Client\Model\AbTestVersionClicks + * @return \Brevo\Client\Models\AbTestVersionClicks */ public function getVersionA() { @@ -229,7 +229,7 @@ public function getVersionA() /** * Sets versionA * - * @param \Brevo\Client\Model\AbTestVersionClicks $versionA versionA + * @param \Brevo\Client\Models\AbTestVersionClicks $versionA versionA * * @return $this */ @@ -243,7 +243,7 @@ public function setVersionA($versionA) /** * Gets versionB * - * @return \Brevo\Client\Model\AbTestVersionClicks + * @return \Brevo\Client\Models\AbTestVersionClicks */ public function getVersionB() { @@ -253,7 +253,7 @@ public function getVersionB() /** * Sets versionB * - * @param \Brevo\Client\Model\AbTestVersionClicks $versionB versionB + * @param \Brevo\Client\Models\AbTestVersionClicks $versionB versionB * * @return $this */ diff --git a/lib/Model/AbTestCampaignResultStatistics.php b/lib/Models/AbTestCampaignResultStatistics.php similarity index 89% rename from lib/Model/AbTestCampaignResultStatistics.php rename to lib/Models/AbTestCampaignResultStatistics.php index e705a7f..5323fe2 100644 --- a/lib/Model/AbTestCampaignResultStatistics.php +++ b/lib/Models/AbTestCampaignResultStatistics.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,12 +57,12 @@ class AbTestCampaignResultStatistics implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'openers' => '\Brevo\Client\Model\AbTestVersionStats', - 'clicks' => '\Brevo\Client\Model\AbTestVersionStats', - 'unsubscribed' => '\Brevo\Client\Model\AbTestVersionStats', - 'hardBounces' => '\Brevo\Client\Model\AbTestVersionStats', - 'softBounces' => '\Brevo\Client\Model\AbTestVersionStats', - 'complaints' => '\Brevo\Client\Model\AbTestVersionStats' + 'openers' => '\Brevo\Client\Models\AbTestVersionStats', + 'clicks' => '\Brevo\Client\Models\AbTestVersionStats', + 'unsubscribed' => '\Brevo\Client\Models\AbTestVersionStats', + 'hardBounces' => '\Brevo\Client\Models\AbTestVersionStats', + 'softBounces' => '\Brevo\Client\Models\AbTestVersionStats', + 'complaints' => '\Brevo\Client\Models\AbTestVersionStats' ]; /** @@ -255,7 +255,7 @@ public function valid() /** * Gets openers * - * @return \Brevo\Client\Model\AbTestVersionStats + * @return \Brevo\Client\Models\AbTestVersionStats */ public function getOpeners() { @@ -265,7 +265,7 @@ public function getOpeners() /** * Sets openers * - * @param \Brevo\Client\Model\AbTestVersionStats $openers openers + * @param \Brevo\Client\Models\AbTestVersionStats $openers openers * * @return $this */ @@ -279,7 +279,7 @@ public function setOpeners($openers) /** * Gets clicks * - * @return \Brevo\Client\Model\AbTestVersionStats + * @return \Brevo\Client\Models\AbTestVersionStats */ public function getClicks() { @@ -289,7 +289,7 @@ public function getClicks() /** * Sets clicks * - * @param \Brevo\Client\Model\AbTestVersionStats $clicks clicks + * @param \Brevo\Client\Models\AbTestVersionStats $clicks clicks * * @return $this */ @@ -303,7 +303,7 @@ public function setClicks($clicks) /** * Gets unsubscribed * - * @return \Brevo\Client\Model\AbTestVersionStats + * @return \Brevo\Client\Models\AbTestVersionStats */ public function getUnsubscribed() { @@ -313,7 +313,7 @@ public function getUnsubscribed() /** * Sets unsubscribed * - * @param \Brevo\Client\Model\AbTestVersionStats $unsubscribed unsubscribed + * @param \Brevo\Client\Models\AbTestVersionStats $unsubscribed unsubscribed * * @return $this */ @@ -327,7 +327,7 @@ public function setUnsubscribed($unsubscribed) /** * Gets hardBounces * - * @return \Brevo\Client\Model\AbTestVersionStats + * @return \Brevo\Client\Models\AbTestVersionStats */ public function getHardBounces() { @@ -337,7 +337,7 @@ public function getHardBounces() /** * Sets hardBounces * - * @param \Brevo\Client\Model\AbTestVersionStats $hardBounces hardBounces + * @param \Brevo\Client\Models\AbTestVersionStats $hardBounces hardBounces * * @return $this */ @@ -351,7 +351,7 @@ public function setHardBounces($hardBounces) /** * Gets softBounces * - * @return \Brevo\Client\Model\AbTestVersionStats + * @return \Brevo\Client\Models\AbTestVersionStats */ public function getSoftBounces() { @@ -361,7 +361,7 @@ public function getSoftBounces() /** * Sets softBounces * - * @param \Brevo\Client\Model\AbTestVersionStats $softBounces softBounces + * @param \Brevo\Client\Models\AbTestVersionStats $softBounces softBounces * * @return $this */ @@ -375,7 +375,7 @@ public function setSoftBounces($softBounces) /** * Gets complaints * - * @return \Brevo\Client\Model\AbTestVersionStats + * @return \Brevo\Client\Models\AbTestVersionStats */ public function getComplaints() { @@ -385,7 +385,7 @@ public function getComplaints() /** * Sets complaints * - * @param \Brevo\Client\Model\AbTestVersionStats $complaints complaints + * @param \Brevo\Client\Models\AbTestVersionStats $complaints complaints * * @return $this */ diff --git a/lib/Model/AbTestVersionClicks.php b/lib/Models/AbTestVersionClicks.php similarity index 98% rename from lib/Model/AbTestVersionClicks.php rename to lib/Models/AbTestVersionClicks.php index 451cb82..cc38086 100644 --- a/lib/Model/AbTestVersionClicks.php +++ b/lib/Models/AbTestVersionClicks.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class AbTestVersionClicks implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - + ]; /** @@ -67,7 +67,7 @@ class AbTestVersionClicks implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerFormats = [ - + ]; /** @@ -97,7 +97,7 @@ public static function swaggerFormats() * @var string[] */ protected static $attributeMap = [ - + ]; /** @@ -106,7 +106,7 @@ public static function swaggerFormats() * @var string[] */ protected static $setters = [ - + ]; /** @@ -115,7 +115,7 @@ public static function swaggerFormats() * @var string[] */ protected static $getters = [ - + ]; /** @@ -159,9 +159,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/AbTestVersionClicksInner.php b/lib/Models/AbTestVersionClicksInner.php similarity index 99% rename from lib/Model/AbTestVersionClicksInner.php rename to lib/Models/AbTestVersionClicksInner.php index f1ef63d..4d60191 100644 --- a/lib/Model/AbTestVersionClicksInner.php +++ b/lib/Models/AbTestVersionClicksInner.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -168,9 +168,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/AbTestVersionStats.php b/lib/Models/AbTestVersionStats.php similarity index 99% rename from lib/Model/AbTestVersionStats.php rename to lib/Models/AbTestVersionStats.php index 7e93076..a0e81c9 100644 --- a/lib/Model/AbTestVersionStats.php +++ b/lib/Models/AbTestVersionStats.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/AddChildDomain.php b/lib/Models/AddChildDomain.php similarity index 99% rename from lib/Model/AddChildDomain.php rename to lib/Models/AddChildDomain.php index a47f8cf..0bb96d1 100644 --- a/lib/Model/AddChildDomain.php +++ b/lib/Models/AddChildDomain.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/AddContactToList.php b/lib/Models/AddContactToList.php similarity index 99% rename from lib/Model/AddContactToList.php rename to lib/Models/AddContactToList.php index 5f52693..c3bd132 100644 --- a/lib/Model/AddContactToList.php +++ b/lib/Models/AddContactToList.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/AddCredits.php b/lib/Models/AddCredits.php similarity index 99% rename from lib/Model/AddCredits.php rename to lib/Models/AddCredits.php index 6144e98..a98993d 100644 --- a/lib/Model/AddCredits.php +++ b/lib/Models/AddCredits.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/AuthenticateDomainModel.php b/lib/Models/AuthenticateDomainModel.php similarity index 99% rename from lib/Model/AuthenticateDomainModel.php rename to lib/Models/AuthenticateDomainModel.php index ad14e3e..96bf782 100644 --- a/lib/Model/AuthenticateDomainModel.php +++ b/lib/Models/AuthenticateDomainModel.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/BlockDomain.php b/lib/Models/BlockDomain.php similarity index 99% rename from lib/Model/BlockDomain.php rename to lib/Models/BlockDomain.php index 427488f..5f12045 100644 --- a/lib/Model/BlockDomain.php +++ b/lib/Models/BlockDomain.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/Body.php b/lib/Models/Body.php similarity index 99% rename from lib/Model/Body.php rename to lib/Models/Body.php index 0ad0717..28f5e2b 100644 --- a/lib/Model/Body.php +++ b/lib/Models/Body.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/Body1.php b/lib/Models/Body1.php similarity index 99% rename from lib/Model/Body1.php rename to lib/Models/Body1.php index b1a9608..87b3031 100644 --- a/lib/Model/Body1.php +++ b/lib/Models/Body1.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/Body10.php b/lib/Models/Body10.php similarity index 99% rename from lib/Model/Body10.php rename to lib/Models/Body10.php index 2e0f62f..9d22131 100644 --- a/lib/Model/Body10.php +++ b/lib/Models/Body10.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -183,9 +183,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/Body11.php b/lib/Models/Body11.php similarity index 99% rename from lib/Model/Body11.php rename to lib/Models/Body11.php index 0899cd0..ae655cc 100644 --- a/lib/Model/Body11.php +++ b/lib/Models/Body11.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/Body12.php b/lib/Models/Body12.php similarity index 99% rename from lib/Model/Body12.php rename to lib/Models/Body12.php index 8905dbf..7f03191 100644 --- a/lib/Model/Body12.php +++ b/lib/Models/Body12.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -173,9 +173,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/Body13.php b/lib/Models/Body13.php similarity index 99% rename from lib/Model/Body13.php rename to lib/Models/Body13.php index 7a8f8d4..b3cca88 100644 --- a/lib/Model/Body13.php +++ b/lib/Models/Body13.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/Body14.php b/lib/Models/Body14.php similarity index 99% rename from lib/Model/Body14.php rename to lib/Models/Body14.php index 9ec924d..6dbfeb0 100644 --- a/lib/Model/Body14.php +++ b/lib/Models/Body14.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -173,9 +173,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/Body2.php b/lib/Models/Body2.php similarity index 99% rename from lib/Model/Body2.php rename to lib/Models/Body2.php index f65c38f..8ab4bc2 100644 --- a/lib/Model/Body2.php +++ b/lib/Models/Body2.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -168,9 +168,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/Body3.php b/lib/Models/Body3.php similarity index 99% rename from lib/Model/Body3.php rename to lib/Models/Body3.php index fc74d91..27eb898 100644 --- a/lib/Model/Body3.php +++ b/lib/Models/Body3.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/Body4.php b/lib/Models/Body4.php similarity index 99% rename from lib/Model/Body4.php rename to lib/Models/Body4.php index 70e5320..8ff2089 100644 --- a/lib/Model/Body4.php +++ b/lib/Models/Body4.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/Body5.php b/lib/Models/Body5.php similarity index 99% rename from lib/Model/Body5.php rename to lib/Models/Body5.php index d87bba6..ca95aee 100644 --- a/lib/Model/Body5.php +++ b/lib/Models/Body5.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/Body6.php b/lib/Models/Body6.php similarity index 99% rename from lib/Model/Body6.php rename to lib/Models/Body6.php index 4175c72..4048ce3 100644 --- a/lib/Model/Body6.php +++ b/lib/Models/Body6.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/Body7.php b/lib/Models/Body7.php similarity index 99% rename from lib/Model/Body7.php rename to lib/Models/Body7.php index 30616fc..e592cda 100644 --- a/lib/Model/Body7.php +++ b/lib/Models/Body7.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -173,9 +173,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/Body8.php b/lib/Models/Body8.php similarity index 98% rename from lib/Model/Body8.php rename to lib/Models/Body8.php index c4abdf7..c07cc1f 100644 --- a/lib/Model/Body8.php +++ b/lib/Models/Body8.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -67,7 +67,7 @@ class Body8 implements ModelInterface, ArrayAccess 'contactsIds' => 'int[]', 'dealsIds' => 'string[]', 'companiesIds' => 'string[]', - 'reminder' => '\Brevo\Client\Model\TaskReminder' + 'reminder' => '\Brevo\Client\Models\TaskReminder' ]; /** @@ -208,9 +208,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -525,7 +525,7 @@ public function setCompaniesIds($companiesIds) /** * Gets reminder * - * @return \Brevo\Client\Model\TaskReminder + * @return \Brevo\Client\Models\TaskReminder */ public function getReminder() { @@ -535,7 +535,7 @@ public function getReminder() /** * Sets reminder * - * @param \Brevo\Client\Model\TaskReminder $reminder reminder + * @param \Brevo\Client\Models\TaskReminder $reminder reminder * * @return $this */ diff --git a/lib/Model/Body9.php b/lib/Models/Body9.php similarity index 99% rename from lib/Model/Body9.php rename to lib/Models/Body9.php index 6f12e43..eb47b5f 100644 --- a/lib/Model/Body9.php +++ b/lib/Models/Body9.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -203,9 +203,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/BodyVariablesItems.php b/lib/Models/BodyVariablesItems.php similarity index 98% rename from lib/Model/BodyVariablesItems.php rename to lib/Models/BodyVariablesItems.php index f5fa31c..047706f 100644 --- a/lib/Model/BodyVariablesItems.php +++ b/lib/Models/BodyVariablesItems.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class BodyVariablesItems implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - + ]; /** @@ -66,7 +66,7 @@ class BodyVariablesItems implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerFormats = [ - + ]; /** @@ -96,7 +96,7 @@ public static function swaggerFormats() * @var string[] */ protected static $attributeMap = [ - + ]; /** @@ -105,7 +105,7 @@ public static function swaggerFormats() * @var string[] */ protected static $setters = [ - + ]; /** @@ -114,7 +114,7 @@ public static function swaggerFormats() * @var string[] */ protected static $getters = [ - + ]; /** @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/CompaniesList.php b/lib/Models/CompaniesList.php similarity index 97% rename from lib/Model/CompaniesList.php rename to lib/Models/CompaniesList.php index f263577..c2c9a52 100644 --- a/lib/Model/CompaniesList.php +++ b/lib/Models/CompaniesList.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class CompaniesList implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'items' => '\Brevo\Client\Model\Company[]' + 'items' => '\Brevo\Client\Models\Company[]' ]; /** @@ -208,7 +208,7 @@ public function valid() /** * Gets items * - * @return \Brevo\Client\Model\Company[] + * @return \Brevo\Client\Models\Company[] */ public function getItems() { @@ -218,7 +218,7 @@ public function getItems() /** * Sets items * - * @param \Brevo\Client\Model\Company[] $items List of compaies + * @param \Brevo\Client\Models\Company[] $items List of compaies * * @return $this */ diff --git a/lib/Model/Company.php b/lib/Models/Company.php similarity index 99% rename from lib/Model/Company.php rename to lib/Models/Company.php index f0a5b0c..6e85243 100644 --- a/lib/Model/Company.php +++ b/lib/Models/Company.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -174,9 +174,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/CompanyAttributes.php b/lib/Models/CompanyAttributes.php similarity index 98% rename from lib/Model/CompanyAttributes.php rename to lib/Models/CompanyAttributes.php index 1ba5907..92c6b51 100644 --- a/lib/Model/CompanyAttributes.php +++ b/lib/Models/CompanyAttributes.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class CompanyAttributes implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - + ]; /** @@ -67,7 +67,7 @@ class CompanyAttributes implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerFormats = [ - + ]; /** @@ -97,7 +97,7 @@ public static function swaggerFormats() * @var string[] */ protected static $attributeMap = [ - + ]; /** @@ -106,7 +106,7 @@ public static function swaggerFormats() * @var string[] */ protected static $setters = [ - + ]; /** @@ -115,7 +115,7 @@ public static function swaggerFormats() * @var string[] */ protected static $getters = [ - + ]; /** @@ -159,9 +159,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/CompanyAttributesInner.php b/lib/Models/CompanyAttributesInner.php similarity index 99% rename from lib/Model/CompanyAttributesInner.php rename to lib/Models/CompanyAttributesInner.php index c41cc8a..86bb34f 100644 --- a/lib/Model/CompanyAttributesInner.php +++ b/lib/Models/CompanyAttributesInner.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/ComponentItems.php b/lib/Models/ComponentItems.php similarity index 99% rename from lib/Model/ComponentItems.php rename to lib/Models/ComponentItems.php index 69d5d34..63777bf 100644 --- a/lib/Model/ComponentItems.php +++ b/lib/Models/ComponentItems.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/Contact.php b/lib/Models/Contact.php similarity index 99% rename from lib/Model/Contact.php rename to lib/Models/Contact.php index a000b88..a81f6f7 100644 --- a/lib/Model/Contact.php +++ b/lib/Models/Contact.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -194,9 +194,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/ConversationsMessage.php b/lib/Models/ConversationsMessage.php similarity index 98% rename from lib/Model/ConversationsMessage.php rename to lib/Models/ConversationsMessage.php index b1eb84a..4e32b5d 100644 --- a/lib/Model/ConversationsMessage.php +++ b/lib/Models/ConversationsMessage.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -67,7 +67,7 @@ class ConversationsMessage implements ModelInterface, ArrayAccess 'createdAt' => 'int', 'isPushed' => 'bool', 'receivedFrom' => 'string', - 'file' => '\Brevo\Client\Model\ConversationsMessageFile' + 'file' => '\Brevo\Client\Models\ConversationsMessageFile' ]; /** @@ -206,9 +206,9 @@ public function getModelName() const TYPE_AGENT = 'agent'; const TYPE_VISITOR = 'visitor'; - - + + /** * Gets allowable values of the enum * @@ -221,7 +221,7 @@ public function getTypeAllowableValues() self::TYPE_VISITOR, ]; } - + /** * Associative array for storing property values @@ -519,7 +519,7 @@ public function setReceivedFrom($receivedFrom) /** * Gets file * - * @return \Brevo\Client\Model\ConversationsMessageFile + * @return \Brevo\Client\Models\ConversationsMessageFile */ public function getFile() { @@ -529,7 +529,7 @@ public function getFile() /** * Sets file * - * @param \Brevo\Client\Model\ConversationsMessageFile $file file + * @param \Brevo\Client\Models\ConversationsMessageFile $file file * * @return $this */ diff --git a/lib/Model/ConversationsMessageFile.php b/lib/Models/ConversationsMessageFile.php similarity index 97% rename from lib/Model/ConversationsMessageFile.php rename to lib/Models/ConversationsMessageFile.php index ef207ef..dda1d0a 100644 --- a/lib/Model/ConversationsMessageFile.php +++ b/lib/Models/ConversationsMessageFile.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -61,7 +61,7 @@ class ConversationsMessageFile implements ModelInterface, ArrayAccess 'size' => 'int', 'isImage' => 'bool', 'url' => 'string', - 'imageInfo' => '\Brevo\Client\Model\ConversationsMessageFileImageInfo' + 'imageInfo' => '\Brevo\Client\Models\ConversationsMessageFileImageInfo' ]; /** @@ -336,7 +336,7 @@ public function setUrl($url) /** * Gets imageInfo * - * @return \Brevo\Client\Model\ConversationsMessageFileImageInfo + * @return \Brevo\Client\Models\ConversationsMessageFileImageInfo */ public function getImageInfo() { @@ -346,7 +346,7 @@ public function getImageInfo() /** * Sets imageInfo * - * @param \Brevo\Client\Model\ConversationsMessageFileImageInfo $imageInfo imageInfo + * @param \Brevo\Client\Models\ConversationsMessageFileImageInfo $imageInfo imageInfo * * @return $this */ diff --git a/lib/Model/ConversationsMessageFileImageInfo.php b/lib/Models/ConversationsMessageFileImageInfo.php similarity index 99% rename from lib/Model/ConversationsMessageFileImageInfo.php rename to lib/Models/ConversationsMessageFileImageInfo.php index 2415cb4..a83a9b6 100644 --- a/lib/Model/ConversationsMessageFileImageInfo.php +++ b/lib/Models/ConversationsMessageFileImageInfo.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -169,9 +169,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/CreateApiKeyRequest.php b/lib/Models/CreateApiKeyRequest.php similarity index 99% rename from lib/Model/CreateApiKeyRequest.php rename to lib/Models/CreateApiKeyRequest.php index 79f8147..edf6659 100644 --- a/lib/Model/CreateApiKeyRequest.php +++ b/lib/Models/CreateApiKeyRequest.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/CreateApiKeyResponse.php b/lib/Models/CreateApiKeyResponse.php similarity index 99% rename from lib/Model/CreateApiKeyResponse.php rename to lib/Models/CreateApiKeyResponse.php index 828b444..2076727 100644 --- a/lib/Model/CreateApiKeyResponse.php +++ b/lib/Models/CreateApiKeyResponse.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/CreateAttribute.php b/lib/Models/CreateAttribute.php similarity index 95% rename from lib/Model/CreateAttribute.php rename to lib/Models/CreateAttribute.php index fb695e9..048d5da 100644 --- a/lib/Model/CreateAttribute.php +++ b/lib/Models/CreateAttribute.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -59,7 +59,7 @@ class CreateAttribute implements ModelInterface, ArrayAccess protected static $swaggerTypes = [ 'value' => 'string', 'isRecurring' => 'bool', - 'enumeration' => '\Brevo\Client\Model\CreateAttributeEnumeration[]', + 'enumeration' => '\Brevo\Client\Models\CreateAttributeEnumeration[]', 'type' => 'string' ]; @@ -179,9 +179,9 @@ public function getModelName() const TYPE_BOOLEAN = 'boolean'; const TYPE_ID = 'id'; const TYPE_CATEGORY = 'category'; - - + + /** * Gets allowable values of the enum * @@ -198,7 +198,7 @@ public function getTypeAllowableValues() self::TYPE_CATEGORY, ]; } - + /** * Associative array for storing property values @@ -304,7 +304,7 @@ public function setIsRecurring($isRecurring) /** * Gets enumeration * - * @return \Brevo\Client\Model\CreateAttributeEnumeration[] + * @return \Brevo\Client\Models\CreateAttributeEnumeration[] */ public function getEnumeration() { @@ -314,7 +314,7 @@ public function getEnumeration() /** * Sets enumeration * - * @param \Brevo\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\"}] + * @param \Brevo\Client\Models\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 */ diff --git a/lib/Model/CreateAttributeEnumeration.php b/lib/Models/CreateAttributeEnumeration.php similarity index 99% rename from lib/Model/CreateAttributeEnumeration.php rename to lib/Models/CreateAttributeEnumeration.php index b9da3d2..e74494b 100644 --- a/lib/Model/CreateAttributeEnumeration.php +++ b/lib/Models/CreateAttributeEnumeration.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/CreateCategoryModel.php b/lib/Models/CreateCategoryModel.php similarity index 99% rename from lib/Model/CreateCategoryModel.php rename to lib/Models/CreateCategoryModel.php index 10995f6..03cfd89 100644 --- a/lib/Model/CreateCategoryModel.php +++ b/lib/Models/CreateCategoryModel.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/CreateChild.php b/lib/Models/CreateChild.php similarity index 99% rename from lib/Model/CreateChild.php rename to lib/Models/CreateChild.php index ceba8b6..4a7fec7 100644 --- a/lib/Model/CreateChild.php +++ b/lib/Models/CreateChild.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -189,9 +189,9 @@ public function getModelName() const LANGUAGE_IT = 'it'; const LANGUAGE_DE = 'de'; const LANGUAGE_EN = 'en'; - - + + /** * Gets allowable values of the enum * @@ -208,7 +208,7 @@ public function getLanguageAllowableValues() self::LANGUAGE_EN, ]; } - + /** * Associative array for storing property values diff --git a/lib/Model/CreateContact.php b/lib/Models/CreateContact.php similarity index 99% rename from lib/Model/CreateContact.php rename to lib/Models/CreateContact.php index dd0b039..fde87aa 100644 --- a/lib/Model/CreateContact.php +++ b/lib/Models/CreateContact.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -193,9 +193,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/CreateCouponCollection.php b/lib/Models/CreateCouponCollection.php similarity index 99% rename from lib/Model/CreateCouponCollection.php rename to lib/Models/CreateCouponCollection.php index d489d57..e9760b7 100644 --- a/lib/Model/CreateCouponCollection.php +++ b/lib/Models/CreateCouponCollection.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/CreateCoupons.php b/lib/Models/CreateCoupons.php similarity index 99% rename from lib/Model/CreateCoupons.php rename to lib/Models/CreateCoupons.php index d082036..281ab6a 100644 --- a/lib/Model/CreateCoupons.php +++ b/lib/Models/CreateCoupons.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/CreateDoiContact.php b/lib/Models/CreateDoiContact.php similarity index 99% rename from lib/Model/CreateDoiContact.php rename to lib/Models/CreateDoiContact.php index c4df173..5163293 100644 --- a/lib/Model/CreateDoiContact.php +++ b/lib/Models/CreateDoiContact.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -183,9 +183,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/CreateDomain.php b/lib/Models/CreateDomain.php similarity index 99% rename from lib/Model/CreateDomain.php rename to lib/Models/CreateDomain.php index bc67da0..5026ecb 100644 --- a/lib/Model/CreateDomain.php +++ b/lib/Models/CreateDomain.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/CreateDomainModel.php b/lib/Models/CreateDomainModel.php similarity index 97% rename from lib/Model/CreateDomainModel.php rename to lib/Models/CreateDomainModel.php index edc3756..7f0f3cd 100644 --- a/lib/Model/CreateDomainModel.php +++ b/lib/Models/CreateDomainModel.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -60,7 +60,7 @@ class CreateDomainModel implements ModelInterface, ArrayAccess 'id' => 'int', 'domainName' => 'string', 'message' => 'string', - 'dnsRecords' => '\Brevo\Client\Model\CreateDomainModelDnsRecords' + 'dnsRecords' => '\Brevo\Client\Models\CreateDomainModelDnsRecords' ]; /** @@ -173,9 +173,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -300,7 +300,7 @@ public function setMessage($message) /** * Gets dnsRecords * - * @return \Brevo\Client\Model\CreateDomainModelDnsRecords + * @return \Brevo\Client\Models\CreateDomainModelDnsRecords */ public function getDnsRecords() { @@ -310,7 +310,7 @@ public function getDnsRecords() /** * Sets dnsRecords * - * @param \Brevo\Client\Model\CreateDomainModelDnsRecords $dnsRecords dnsRecords + * @param \Brevo\Client\Models\CreateDomainModelDnsRecords $dnsRecords dnsRecords * * @return $this */ diff --git a/lib/Model/CreateDomainModelDnsRecords.php b/lib/Models/CreateDomainModelDnsRecords.php similarity index 93% rename from lib/Model/CreateDomainModelDnsRecords.php rename to lib/Models/CreateDomainModelDnsRecords.php index 5ba3983..247fef7 100644 --- a/lib/Model/CreateDomainModelDnsRecords.php +++ b/lib/Models/CreateDomainModelDnsRecords.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,8 +57,8 @@ class CreateDomainModelDnsRecords implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'dkimRecord' => '\Brevo\Client\Model\CreateDomainModelDnsRecordsDkimRecord', - 'brevoCode' => '\Brevo\Client\Model\CreateDomainModelDnsRecordsDkimRecord' + 'dkimRecord' => '\Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord', + 'brevoCode' => '\Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord' ]; /** @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -213,7 +213,7 @@ public function valid() /** * Gets dkimRecord * - * @return \Brevo\Client\Model\CreateDomainModelDnsRecordsDkimRecord + * @return \Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord */ public function getDkimRecord() { @@ -223,7 +223,7 @@ public function getDkimRecord() /** * Sets dkimRecord * - * @param \Brevo\Client\Model\CreateDomainModelDnsRecordsDkimRecord $dkimRecord dkimRecord + * @param \Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord $dkimRecord dkimRecord * * @return $this */ @@ -237,7 +237,7 @@ public function setDkimRecord($dkimRecord) /** * Gets brevoCode * - * @return \Brevo\Client\Model\CreateDomainModelDnsRecordsDkimRecord + * @return \Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord */ public function getBrevoCode() { @@ -247,7 +247,7 @@ public function getBrevoCode() /** * Sets brevoCode * - * @param \Brevo\Client\Model\CreateDomainModelDnsRecordsDkimRecord $brevoCode brevoCode + * @param \Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord $brevoCode brevoCode * * @return $this */ diff --git a/lib/Model/CreateDomainModelDnsRecordsDkimRecord.php b/lib/Models/CreateDomainModelDnsRecordsDkimRecord.php similarity index 99% rename from lib/Model/CreateDomainModelDnsRecordsDkimRecord.php rename to lib/Models/CreateDomainModelDnsRecordsDkimRecord.php index 83bfad1..ebd55d2 100644 --- a/lib/Model/CreateDomainModelDnsRecordsDkimRecord.php +++ b/lib/Models/CreateDomainModelDnsRecordsDkimRecord.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/CreateEmailCampaign.php b/lib/Models/CreateEmailCampaign.php similarity index 98% rename from lib/Model/CreateEmailCampaign.php rename to lib/Models/CreateEmailCampaign.php index 5bb1049..7fc7d0f 100644 --- a/lib/Model/CreateEmailCampaign.php +++ b/lib/Models/CreateEmailCampaign.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class CreateEmailCampaign implements ModelInterface, ArrayAccess */ protected static $swaggerTypes = [ 'tag' => 'string', - 'sender' => '\Brevo\Client\Model\CreateEmailCampaignSender', + 'sender' => '\Brevo\Client\Models\CreateEmailCampaignSender', 'name' => 'string', 'htmlContent' => 'string', 'htmlUrl' => 'string', @@ -68,7 +68,7 @@ class CreateEmailCampaign implements ModelInterface, ArrayAccess 'previewText' => 'string', 'replyTo' => 'string', 'toField' => 'string', - 'recipients' => '\Brevo\Client\Model\CreateEmailCampaignRecipients', + 'recipients' => '\Brevo\Client\Models\CreateEmailCampaignRecipients', 'attachmentUrl' => 'string', 'inlineImageActivation' => 'bool', 'mirrorActive' => 'bool', @@ -464,7 +464,7 @@ public function setTag($tag) /** * Gets sender * - * @return \Brevo\Client\Model\CreateEmailCampaignSender + * @return \Brevo\Client\Models\CreateEmailCampaignSender */ public function getSender() { @@ -474,7 +474,7 @@ public function getSender() /** * Sets sender * - * @param \Brevo\Client\Model\CreateEmailCampaignSender $sender sender + * @param \Brevo\Client\Models\CreateEmailCampaignSender $sender sender * * @return $this */ @@ -704,7 +704,7 @@ public function setToField($toField) /** * Gets recipients * - * @return \Brevo\Client\Model\CreateEmailCampaignRecipients + * @return \Brevo\Client\Models\CreateEmailCampaignRecipients */ public function getRecipients() { @@ -714,7 +714,7 @@ public function getRecipients() /** * Sets recipients * - * @param \Brevo\Client\Model\CreateEmailCampaignRecipients $recipients recipients + * @param \Brevo\Client\Models\CreateEmailCampaignRecipients $recipients recipients * * @return $this */ diff --git a/lib/Model/CreateEmailCampaignRecipients.php b/lib/Models/CreateEmailCampaignRecipients.php similarity index 99% rename from lib/Model/CreateEmailCampaignRecipients.php rename to lib/Models/CreateEmailCampaignRecipients.php index c4d1cb5..3a6cf87 100644 --- a/lib/Model/CreateEmailCampaignRecipients.php +++ b/lib/Models/CreateEmailCampaignRecipients.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/CreateEmailCampaignSender.php b/lib/Models/CreateEmailCampaignSender.php similarity index 99% rename from lib/Model/CreateEmailCampaignSender.php rename to lib/Models/CreateEmailCampaignSender.php index 5b7185b..21e679d 100644 --- a/lib/Model/CreateEmailCampaignSender.php +++ b/lib/Models/CreateEmailCampaignSender.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/CreateExternalFeed.php b/lib/Models/CreateExternalFeed.php similarity index 98% rename from lib/Model/CreateExternalFeed.php rename to lib/Models/CreateExternalFeed.php index fa3fa2d..b53bf89 100644 --- a/lib/Model/CreateExternalFeed.php +++ b/lib/Models/CreateExternalFeed.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -63,7 +63,7 @@ class CreateExternalFeed implements ModelInterface, ArrayAccess 'username' => 'string', 'password' => 'string', 'token' => 'string', - 'headers' => '\Brevo\Client\Model\GetExternalFeedByUUIDHeaders[]', + 'headers' => '\Brevo\Client\Models\GetExternalFeedByUUIDHeaders[]', 'maxRetries' => 'int', 'cache' => 'bool' ]; @@ -201,9 +201,9 @@ public function getModelName() const AUTH_TYPE_BASIC = 'basic'; const AUTH_TYPE_TOKEN = 'token'; const AUTH_TYPE_NO_AUTH = 'noAuth'; - - + + /** * Gets allowable values of the enum * @@ -217,7 +217,7 @@ public function getAuthTypeAllowableValues() self::AUTH_TYPE_NO_AUTH, ]; } - + /** * Associative array for storing property values @@ -447,7 +447,7 @@ public function setToken($token) /** * Gets headers * - * @return \Brevo\Client\Model\GetExternalFeedByUUIDHeaders[] + * @return \Brevo\Client\Models\GetExternalFeedByUUIDHeaders[] */ public function getHeaders() { @@ -457,7 +457,7 @@ public function getHeaders() /** * Sets headers * - * @param \Brevo\Client\Model\GetExternalFeedByUUIDHeaders[] $headers Custom headers for the feed + * @param \Brevo\Client\Models\GetExternalFeedByUUIDHeaders[] $headers Custom headers for the feed * * @return $this */ diff --git a/lib/Model/CreateList.php b/lib/Models/CreateList.php similarity index 99% rename from lib/Model/CreateList.php rename to lib/Models/CreateList.php index cc7f5ee..dde4281 100644 --- a/lib/Model/CreateList.php +++ b/lib/Models/CreateList.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/CreateModel.php b/lib/Models/CreateModel.php similarity index 99% rename from lib/Model/CreateModel.php rename to lib/Models/CreateModel.php index 921fdd7..f95314c 100644 --- a/lib/Model/CreateModel.php +++ b/lib/Models/CreateModel.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/CreateProductModel.php b/lib/Models/CreateProductModel.php similarity index 99% rename from lib/Model/CreateProductModel.php rename to lib/Models/CreateProductModel.php index 4d475ea..6ecf601 100644 --- a/lib/Model/CreateProductModel.php +++ b/lib/Models/CreateProductModel.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/CreateReseller.php b/lib/Models/CreateReseller.php similarity index 99% rename from lib/Model/CreateReseller.php rename to lib/Models/CreateReseller.php index e9cc84d..1549e17 100644 --- a/lib/Model/CreateReseller.php +++ b/lib/Models/CreateReseller.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/CreateSender.php b/lib/Models/CreateSender.php similarity index 96% rename from lib/Model/CreateSender.php rename to lib/Models/CreateSender.php index 99c6e86..39b3684 100644 --- a/lib/Model/CreateSender.php +++ b/lib/Models/CreateSender.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -59,7 +59,7 @@ class CreateSender implements ModelInterface, ArrayAccess protected static $swaggerTypes = [ 'name' => 'string', 'email' => 'string', - 'ips' => '\Brevo\Client\Model\CreateSenderIps[]' + 'ips' => '\Brevo\Client\Models\CreateSenderIps[]' ]; /** @@ -168,9 +168,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -273,7 +273,7 @@ public function setEmail($email) /** * Gets ips * - * @return \Brevo\Client\Model\CreateSenderIps[] + * @return \Brevo\Client\Models\CreateSenderIps[] */ public function getIps() { @@ -283,7 +283,7 @@ public function getIps() /** * Sets ips * - * @param \Brevo\Client\Model\CreateSenderIps[] $ips Mandatory in case of dedicated IP, IPs to associate to the sender + * @param \Brevo\Client\Models\CreateSenderIps[] $ips Mandatory in case of dedicated IP, IPs to associate to the sender * * @return $this */ diff --git a/lib/Model/CreateSenderIps.php b/lib/Models/CreateSenderIps.php similarity index 99% rename from lib/Model/CreateSenderIps.php rename to lib/Models/CreateSenderIps.php index e2f5c77..78257c5 100644 --- a/lib/Model/CreateSenderIps.php +++ b/lib/Models/CreateSenderIps.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/CreateSenderModel.php b/lib/Models/CreateSenderModel.php similarity index 99% rename from lib/Model/CreateSenderModel.php rename to lib/Models/CreateSenderModel.php index d1c6d02..7b51328 100644 --- a/lib/Model/CreateSenderModel.php +++ b/lib/Models/CreateSenderModel.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -168,9 +168,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/CreateSmsCampaign.php b/lib/Models/CreateSmsCampaign.php similarity index 98% rename from lib/Model/CreateSmsCampaign.php rename to lib/Models/CreateSmsCampaign.php index af82549..e17a890 100644 --- a/lib/Model/CreateSmsCampaign.php +++ b/lib/Models/CreateSmsCampaign.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -60,7 +60,7 @@ class CreateSmsCampaign implements ModelInterface, ArrayAccess 'name' => 'string', 'sender' => 'string', 'content' => 'string', - 'recipients' => '\Brevo\Client\Model\CreateSmsCampaignRecipients', + 'recipients' => '\Brevo\Client\Models\CreateSmsCampaignRecipients', 'scheduledAt' => 'string', 'unicodeEnabled' => 'bool', 'organisationPrefix' => 'string', @@ -193,9 +193,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -338,7 +338,7 @@ public function setContent($content) /** * Gets recipients * - * @return \Brevo\Client\Model\CreateSmsCampaignRecipients + * @return \Brevo\Client\Models\CreateSmsCampaignRecipients */ public function getRecipients() { @@ -348,7 +348,7 @@ public function getRecipients() /** * Sets recipients * - * @param \Brevo\Client\Model\CreateSmsCampaignRecipients $recipients recipients + * @param \Brevo\Client\Models\CreateSmsCampaignRecipients $recipients recipients * * @return $this */ diff --git a/lib/Model/CreateSmsCampaignRecipients.php b/lib/Models/CreateSmsCampaignRecipients.php similarity index 99% rename from lib/Model/CreateSmsCampaignRecipients.php rename to lib/Models/CreateSmsCampaignRecipients.php index 080776a..f4a8cd3 100644 --- a/lib/Model/CreateSmsCampaignRecipients.php +++ b/lib/Models/CreateSmsCampaignRecipients.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/CreateSmtpEmail.php b/lib/Models/CreateSmtpEmail.php similarity index 99% rename from lib/Model/CreateSmtpEmail.php rename to lib/Models/CreateSmtpEmail.php index 5f2a3a5..0e8b522 100644 --- a/lib/Model/CreateSmtpEmail.php +++ b/lib/Models/CreateSmtpEmail.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/CreateSmtpTemplate.php b/lib/Models/CreateSmtpTemplate.php similarity index 98% rename from lib/Model/CreateSmtpTemplate.php rename to lib/Models/CreateSmtpTemplate.php index 1953e4f..0b4a736 100644 --- a/lib/Model/CreateSmtpTemplate.php +++ b/lib/Models/CreateSmtpTemplate.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class CreateSmtpTemplate implements ModelInterface, ArrayAccess */ protected static $swaggerTypes = [ 'tag' => 'string', - 'sender' => '\Brevo\Client\Model\CreateSmtpTemplateSender', + 'sender' => '\Brevo\Client\Models\CreateSmtpTemplateSender', 'templateName' => 'string', 'htmlContent' => 'string', 'htmlUrl' => 'string', @@ -203,9 +203,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -294,7 +294,7 @@ public function setTag($tag) /** * Gets sender * - * @return \Brevo\Client\Model\CreateSmtpTemplateSender + * @return \Brevo\Client\Models\CreateSmtpTemplateSender */ public function getSender() { @@ -304,7 +304,7 @@ public function getSender() /** * Sets sender * - * @param \Brevo\Client\Model\CreateSmtpTemplateSender $sender sender + * @param \Brevo\Client\Models\CreateSmtpTemplateSender $sender sender * * @return $this */ diff --git a/lib/Model/CreateSmtpTemplateSender.php b/lib/Models/CreateSmtpTemplateSender.php similarity index 99% rename from lib/Model/CreateSmtpTemplateSender.php rename to lib/Models/CreateSmtpTemplateSender.php index e208b3a..cf66365 100644 --- a/lib/Model/CreateSmtpTemplateSender.php +++ b/lib/Models/CreateSmtpTemplateSender.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -169,9 +169,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/CreateSubAccount.php b/lib/Models/CreateSubAccount.php similarity index 99% rename from lib/Model/CreateSubAccount.php rename to lib/Models/CreateSubAccount.php index ee0fbb6..9cf79e4 100644 --- a/lib/Model/CreateSubAccount.php +++ b/lib/Models/CreateSubAccount.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -179,9 +179,9 @@ public function getModelName() const LANGUAGE_ES = 'es'; const LANGUAGE_PT = 'pt'; const LANGUAGE_DE = 'de'; - - + + /** * Gets allowable values of the enum * @@ -198,7 +198,7 @@ public function getLanguageAllowableValues() self::LANGUAGE_DE, ]; } - + /** * Associative array for storing property values diff --git a/lib/Model/CreateSubAccountResponse.php b/lib/Models/CreateSubAccountResponse.php similarity index 99% rename from lib/Model/CreateSubAccountResponse.php rename to lib/Models/CreateSubAccountResponse.php index f542695..00e1b43 100644 --- a/lib/Model/CreateSubAccountResponse.php +++ b/lib/Models/CreateSubAccountResponse.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/CreateUpdateBatchCategory.php b/lib/Models/CreateUpdateBatchCategory.php similarity index 96% rename from lib/Model/CreateUpdateBatchCategory.php rename to lib/Models/CreateUpdateBatchCategory.php index 900b9aa..0ba45b5 100644 --- a/lib/Model/CreateUpdateBatchCategory.php +++ b/lib/Models/CreateUpdateBatchCategory.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class CreateUpdateBatchCategory implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'categories' => '\Brevo\Client\Model\CreateUpdateCategories[]', + 'categories' => '\Brevo\Client\Models\CreateUpdateCategories[]', 'updateEnabled' => 'bool' ]; @@ -216,7 +216,7 @@ public function valid() /** * Gets categories * - * @return \Brevo\Client\Model\CreateUpdateCategories[] + * @return \Brevo\Client\Models\CreateUpdateCategories[] */ public function getCategories() { @@ -226,7 +226,7 @@ public function getCategories() /** * Sets categories * - * @param \Brevo\Client\Model\CreateUpdateCategories[] $categories array of categories objects + * @param \Brevo\Client\Models\CreateUpdateCategories[] $categories array of categories objects * * @return $this */ diff --git a/lib/Model/CreateUpdateBatchCategoryModel.php b/lib/Models/CreateUpdateBatchCategoryModel.php similarity index 99% rename from lib/Model/CreateUpdateBatchCategoryModel.php rename to lib/Models/CreateUpdateBatchCategoryModel.php index 5777db1..6beaff7 100644 --- a/lib/Model/CreateUpdateBatchCategoryModel.php +++ b/lib/Models/CreateUpdateBatchCategoryModel.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/CreateUpdateBatchProducts.php b/lib/Models/CreateUpdateBatchProducts.php similarity index 96% rename from lib/Model/CreateUpdateBatchProducts.php rename to lib/Models/CreateUpdateBatchProducts.php index 082c8d2..620dd9b 100644 --- a/lib/Model/CreateUpdateBatchProducts.php +++ b/lib/Models/CreateUpdateBatchProducts.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class CreateUpdateBatchProducts implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'products' => '\Brevo\Client\Model\CreateUpdateProducts[]', + 'products' => '\Brevo\Client\Models\CreateUpdateProducts[]', 'updateEnabled' => 'bool' ]; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -216,7 +216,7 @@ public function valid() /** * Gets products * - * @return \Brevo\Client\Model\CreateUpdateProducts[] + * @return \Brevo\Client\Models\CreateUpdateProducts[] */ public function getProducts() { @@ -226,7 +226,7 @@ public function getProducts() /** * Sets products * - * @param \Brevo\Client\Model\CreateUpdateProducts[] $products array of products objects + * @param \Brevo\Client\Models\CreateUpdateProducts[] $products array of products objects * * @return $this */ diff --git a/lib/Model/CreateUpdateBatchProductsModel.php b/lib/Models/CreateUpdateBatchProductsModel.php similarity index 99% rename from lib/Model/CreateUpdateBatchProductsModel.php rename to lib/Models/CreateUpdateBatchProductsModel.php index e11a883..529df3e 100644 --- a/lib/Model/CreateUpdateBatchProductsModel.php +++ b/lib/Models/CreateUpdateBatchProductsModel.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/CreateUpdateCategories.php b/lib/Models/CreateUpdateCategories.php similarity index 99% rename from lib/Model/CreateUpdateCategories.php rename to lib/Models/CreateUpdateCategories.php index 7aa5c11..9e989d4 100644 --- a/lib/Model/CreateUpdateCategories.php +++ b/lib/Models/CreateUpdateCategories.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -173,9 +173,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/CreateUpdateCategory.php b/lib/Models/CreateUpdateCategory.php similarity index 99% rename from lib/Model/CreateUpdateCategory.php rename to lib/Models/CreateUpdateCategory.php index 3bfdcf4..83a0a48 100644 --- a/lib/Model/CreateUpdateCategory.php +++ b/lib/Models/CreateUpdateCategory.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/CreateUpdateContactModel.php b/lib/Models/CreateUpdateContactModel.php similarity index 99% rename from lib/Model/CreateUpdateContactModel.php rename to lib/Models/CreateUpdateContactModel.php index 19a6284..152e764 100644 --- a/lib/Model/CreateUpdateContactModel.php +++ b/lib/Models/CreateUpdateContactModel.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/CreateUpdateFolder.php b/lib/Models/CreateUpdateFolder.php similarity index 99% rename from lib/Model/CreateUpdateFolder.php rename to lib/Models/CreateUpdateFolder.php index fbad1c3..f43f852 100644 --- a/lib/Model/CreateUpdateFolder.php +++ b/lib/Models/CreateUpdateFolder.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/CreateUpdateProduct.php b/lib/Models/CreateUpdateProduct.php similarity index 99% rename from lib/Model/CreateUpdateProduct.php rename to lib/Models/CreateUpdateProduct.php index 8fd883d..69df187 100644 --- a/lib/Model/CreateUpdateProduct.php +++ b/lib/Models/CreateUpdateProduct.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/CreateUpdateProducts.php b/lib/Models/CreateUpdateProducts.php similarity index 99% rename from lib/Model/CreateUpdateProducts.php rename to lib/Models/CreateUpdateProducts.php index d519d05..4198bf7 100644 --- a/lib/Model/CreateUpdateProducts.php +++ b/lib/Models/CreateUpdateProducts.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -203,9 +203,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/CreateWebhook.php b/lib/Models/CreateWebhook.php similarity index 97% rename from lib/Model/CreateWebhook.php rename to lib/Models/CreateWebhook.php index 4f93c07..d9c637b 100644 --- a/lib/Model/CreateWebhook.php +++ b/lib/Models/CreateWebhook.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -63,8 +63,8 @@ class CreateWebhook implements ModelInterface, ArrayAccess 'type' => 'string', 'domain' => 'string', 'batched' => 'bool', - 'auth' => '\Brevo\Client\Model\GetWebhookAuth', - 'headers' => '\Brevo\Client\Model\GetWebhookHeaders[]' + 'auth' => '\Brevo\Client\Models\GetWebhookAuth', + 'headers' => '\Brevo\Client\Models\GetWebhookHeaders[]' ]; /** @@ -213,9 +213,9 @@ public function getModelName() const TYPE_TRANSACTIONAL = 'transactional'; const TYPE_MARKETING = 'marketing'; const TYPE_INBOUND = 'inbound'; - - + + /** * Gets allowable values of the enum * @@ -243,7 +243,7 @@ public function getEventsAllowableValues() self::EVENTS_INBOUND_EMAIL_PROCESSED, ]; } - + /** * Gets allowable values of the enum * @@ -257,7 +257,7 @@ public function getTypeAllowableValues() self::TYPE_INBOUND, ]; } - + /** * Associative array for storing property values @@ -487,7 +487,7 @@ public function setBatched($batched) /** * Gets auth * - * @return \Brevo\Client\Model\GetWebhookAuth + * @return \Brevo\Client\Models\GetWebhookAuth */ public function getAuth() { @@ -497,7 +497,7 @@ public function getAuth() /** * Sets auth * - * @param \Brevo\Client\Model\GetWebhookAuth $auth auth + * @param \Brevo\Client\Models\GetWebhookAuth $auth auth * * @return $this */ @@ -511,7 +511,7 @@ public function setAuth($auth) /** * Gets headers * - * @return \Brevo\Client\Model\GetWebhookHeaders[] + * @return \Brevo\Client\Models\GetWebhookHeaders[] */ public function getHeaders() { @@ -521,7 +521,7 @@ public function getHeaders() /** * Sets headers * - * @param \Brevo\Client\Model\GetWebhookHeaders[] $headers Custom headers to be send with webhooks + * @param \Brevo\Client\Models\GetWebhookHeaders[] $headers Custom headers to be send with webhooks * * @return $this */ diff --git a/lib/Model/CreateWhatsAppCampaign.php b/lib/Models/CreateWhatsAppCampaign.php similarity index 97% rename from lib/Model/CreateWhatsAppCampaign.php rename to lib/Models/CreateWhatsAppCampaign.php index d6faa21..73ce9a9 100644 --- a/lib/Model/CreateWhatsAppCampaign.php +++ b/lib/Models/CreateWhatsAppCampaign.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -60,7 +60,7 @@ class CreateWhatsAppCampaign implements ModelInterface, ArrayAccess 'name' => 'string', 'templateId' => 'int', 'scheduledAt' => 'string', - 'recipients' => '\Brevo\Client\Model\CreateWhatsAppCampaignRecipients' + 'recipients' => '\Brevo\Client\Models\CreateWhatsAppCampaignRecipients' ]; /** @@ -173,9 +173,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -309,7 +309,7 @@ public function setScheduledAt($scheduledAt) /** * Gets recipients * - * @return \Brevo\Client\Model\CreateWhatsAppCampaignRecipients + * @return \Brevo\Client\Models\CreateWhatsAppCampaignRecipients */ public function getRecipients() { @@ -319,7 +319,7 @@ public function getRecipients() /** * Sets recipients * - * @param \Brevo\Client\Model\CreateWhatsAppCampaignRecipients $recipients recipients + * @param \Brevo\Client\Models\CreateWhatsAppCampaignRecipients $recipients recipients * * @return $this */ diff --git a/lib/Model/CreateWhatsAppCampaignRecipients.php b/lib/Models/CreateWhatsAppCampaignRecipients.php similarity index 99% rename from lib/Model/CreateWhatsAppCampaignRecipients.php rename to lib/Models/CreateWhatsAppCampaignRecipients.php index 78311df..ef52e07 100644 --- a/lib/Model/CreateWhatsAppCampaignRecipients.php +++ b/lib/Models/CreateWhatsAppCampaignRecipients.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/CreateWhatsAppTemplate.php b/lib/Models/CreateWhatsAppTemplate.php similarity index 99% rename from lib/Model/CreateWhatsAppTemplate.php rename to lib/Models/CreateWhatsAppTemplate.php index 73d7f8a..9a1f4da 100644 --- a/lib/Model/CreateWhatsAppTemplate.php +++ b/lib/Models/CreateWhatsAppTemplate.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -192,9 +192,9 @@ public function getModelName() const CATEGORY_UTILITY = 'UTILITY'; const SOURCE_AUTOMATION = 'Automation'; const SOURCE_CONVERSATIONS = 'Conversations'; - - + + /** * Gets allowable values of the enum * @@ -207,7 +207,7 @@ public function getCategoryAllowableValues() self::CATEGORY_UTILITY, ]; } - + /** * Gets allowable values of the enum * @@ -220,7 +220,7 @@ public function getSourceAllowableValues() self::SOURCE_CONVERSATIONS, ]; } - + /** * Associative array for storing property values diff --git a/lib/Model/CreatedBatchId.php b/lib/Models/CreatedBatchId.php similarity index 99% rename from lib/Model/CreatedBatchId.php rename to lib/Models/CreatedBatchId.php index 28812b8..344235f 100644 --- a/lib/Model/CreatedBatchId.php +++ b/lib/Models/CreatedBatchId.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/CreatedProcessId.php b/lib/Models/CreatedProcessId.php similarity index 99% rename from lib/Model/CreatedProcessId.php rename to lib/Models/CreatedProcessId.php index 96341df..9096412 100644 --- a/lib/Model/CreatedProcessId.php +++ b/lib/Models/CreatedProcessId.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/Deal.php b/lib/Models/Deal.php similarity index 99% rename from lib/Model/Deal.php rename to lib/Models/Deal.php index a315359..98f05b3 100644 --- a/lib/Model/Deal.php +++ b/lib/Models/Deal.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -174,9 +174,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/DealAttributes.php b/lib/Models/DealAttributes.php similarity index 98% rename from lib/Model/DealAttributes.php rename to lib/Models/DealAttributes.php index 1ff6bf9..caec1c0 100644 --- a/lib/Model/DealAttributes.php +++ b/lib/Models/DealAttributes.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class DealAttributes implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - + ]; /** @@ -67,7 +67,7 @@ class DealAttributes implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerFormats = [ - + ]; /** @@ -97,7 +97,7 @@ public static function swaggerFormats() * @var string[] */ protected static $attributeMap = [ - + ]; /** @@ -106,7 +106,7 @@ public static function swaggerFormats() * @var string[] */ protected static $setters = [ - + ]; /** @@ -115,7 +115,7 @@ public static function swaggerFormats() * @var string[] */ protected static $getters = [ - + ]; /** @@ -159,9 +159,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/DealAttributesInner.php b/lib/Models/DealAttributesInner.php similarity index 99% rename from lib/Model/DealAttributesInner.php rename to lib/Models/DealAttributesInner.php index 23144be..50bf339 100644 --- a/lib/Model/DealAttributesInner.php +++ b/lib/Models/DealAttributesInner.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -179,9 +179,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/DealsList.php b/lib/Models/DealsList.php similarity index 97% rename from lib/Model/DealsList.php rename to lib/Models/DealsList.php index f517903..ac398b5 100644 --- a/lib/Model/DealsList.php +++ b/lib/Models/DealsList.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class DealsList implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'items' => '\Brevo\Client\Model\Deal[]' + 'items' => '\Brevo\Client\Models\Deal[]' ]; /** @@ -159,9 +159,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -208,7 +208,7 @@ public function valid() /** * Gets items * - * @return \Brevo\Client\Model\Deal[] + * @return \Brevo\Client\Models\Deal[] */ public function getItems() { @@ -218,7 +218,7 @@ public function getItems() /** * Sets items * - * @param \Brevo\Client\Model\Deal[] $items List of deals + * @param \Brevo\Client\Models\Deal[] $items List of deals * * @return $this */ diff --git a/lib/Model/DeleteHardbounces.php b/lib/Models/DeleteHardbounces.php similarity index 99% rename from lib/Model/DeleteHardbounces.php rename to lib/Models/DeleteHardbounces.php index fd256f5..faf9356 100644 --- a/lib/Model/DeleteHardbounces.php +++ b/lib/Models/DeleteHardbounces.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -168,9 +168,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/EmailExportRecipients.php b/lib/Models/EmailExportRecipients.php similarity index 99% rename from lib/Model/EmailExportRecipients.php rename to lib/Models/EmailExportRecipients.php index 4489fd9..522d962 100644 --- a/lib/Model/EmailExportRecipients.php +++ b/lib/Models/EmailExportRecipients.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -171,9 +171,9 @@ public function getModelName() const RECIPIENTS_TYPE_SOFT_BOUNCES = 'softBounces'; const RECIPIENTS_TYPE_HARD_BOUNCES = 'hardBounces'; const RECIPIENTS_TYPE_UNSUBSCRIBED = 'unsubscribed'; - - + + /** * Gets allowable values of the enum * @@ -192,7 +192,7 @@ public function getRecipientsTypeAllowableValues() self::RECIPIENTS_TYPE_UNSUBSCRIBED, ]; } - + /** * Associative array for storing property values diff --git a/lib/Model/ErrorModel.php b/lib/Models/ErrorModel.php similarity index 99% rename from lib/Model/ErrorModel.php rename to lib/Models/ErrorModel.php index 7d4591b..04797b4 100644 --- a/lib/Model/ErrorModel.php +++ b/lib/Models/ErrorModel.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -179,9 +179,9 @@ public function getModelName() const CODE_ACCOUNT_UNDER_VALIDATION = 'account_under_validation'; const CODE_NOT_ACCEPTABLE = 'not_acceptable'; const CODE_BAD_REQUEST = 'bad_request'; - - + + /** * Gets allowable values of the enum * @@ -208,7 +208,7 @@ public function getCodeAllowableValues() self::CODE_BAD_REQUEST, ]; } - + /** * Associative array for storing property values diff --git a/lib/Model/Event.php b/lib/Models/Event.php similarity index 97% rename from lib/Model/Event.php rename to lib/Models/Event.php index 8335cfe..e1eaf44 100644 --- a/lib/Model/Event.php +++ b/lib/Models/Event.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -59,7 +59,7 @@ class Event implements ModelInterface, ArrayAccess protected static $swaggerTypes = [ 'eventName' => 'string', 'eventDate' => 'string', - 'identifiers' => '\Brevo\Client\Model\EventIdentifiers', + 'identifiers' => '\Brevo\Client\Models\EventIdentifiers', 'contactProperties' => 'object', 'eventProperties' => 'object' ]; @@ -178,9 +178,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -285,7 +285,7 @@ public function setEventDate($eventDate) /** * Gets identifiers * - * @return \Brevo\Client\Model\EventIdentifiers + * @return \Brevo\Client\Models\EventIdentifiers */ public function getIdentifiers() { @@ -295,7 +295,7 @@ public function getIdentifiers() /** * Sets identifiers * - * @param \Brevo\Client\Model\EventIdentifiers $identifiers identifiers + * @param \Brevo\Client\Models\EventIdentifiers $identifiers identifiers * * @return $this */ diff --git a/lib/Model/EventIdentifiers.php b/lib/Models/EventIdentifiers.php similarity index 99% rename from lib/Model/EventIdentifiers.php rename to lib/Models/EventIdentifiers.php index a71997e..0d1d0c6 100644 --- a/lib/Model/EventIdentifiers.php +++ b/lib/Models/EventIdentifiers.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/ExportWebhooksHistory.php b/lib/Models/ExportWebhooksHistory.php similarity index 99% rename from lib/Model/ExportWebhooksHistory.php rename to lib/Models/ExportWebhooksHistory.php index 4d36844..5f8a096 100644 --- a/lib/Model/ExportWebhooksHistory.php +++ b/lib/Models/ExportWebhooksHistory.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -222,9 +222,9 @@ public function getModelName() const EVENT_UNIQUE_OPENED = 'uniqueOpened'; const EVENT_LOADED_BY_PROXY = 'loadedByProxy'; const EVENT_ALL_EVENTS = 'allEvents'; - - + + /** * Gets allowable values of the enum * @@ -237,7 +237,7 @@ public function getTypeAllowableValues() self::TYPE_MARKETING, ]; } - + /** * Gets allowable values of the enum * @@ -265,7 +265,7 @@ public function getEventAllowableValues() self::EVENT_ALL_EVENTS, ]; } - + /** * Associative array for storing property values diff --git a/lib/Model/FileData.php b/lib/Models/FileData.php similarity index 99% rename from lib/Model/FileData.php rename to lib/Models/FileData.php index 7b7ef4f..215c76b 100644 --- a/lib/Model/FileData.php +++ b/lib/Models/FileData.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -209,9 +209,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/FileDownloadableLink.php b/lib/Models/FileDownloadableLink.php similarity index 99% rename from lib/Model/FileDownloadableLink.php rename to lib/Models/FileDownloadableLink.php index 003c6c6..1a9cdf3 100644 --- a/lib/Model/FileDownloadableLink.php +++ b/lib/Models/FileDownloadableLink.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/FileList.php b/lib/Models/FileList.php similarity index 99% rename from lib/Model/FileList.php rename to lib/Models/FileList.php index 9fe810f..7a817a3 100644 --- a/lib/Model/FileList.php +++ b/lib/Models/FileList.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/GetAccount.php b/lib/Models/GetAccount.php similarity index 92% rename from lib/Model/GetAccount.php rename to lib/Models/GetAccount.php index fe969b4..7d55464 100644 --- a/lib/Model/GetAccount.php +++ b/lib/Models/GetAccount.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \Brevo\Client\ObjectSerializer; /** @@ -38,7 +38,7 @@ * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ -class GetAccount extends GetExtendedClient +class GetAccount extends GetExtendedClient { const DISCRIMINATOR = null; @@ -55,9 +55,9 @@ class GetAccount extends GetExtendedClient * @var string[] */ protected static $swaggerTypes = [ - 'plan' => '\Brevo\Client\Model\GetAccountPlan[]', - 'relay' => '\Brevo\Client\Model\GetAccountRelay', - 'marketingAutomation' => '\Brevo\Client\Model\GetAccountMarketingAutomation' + 'plan' => '\Brevo\Client\Models\GetAccountPlan[]', + 'relay' => '\Brevo\Client\Models\GetAccountRelay', + 'marketingAutomation' => '\Brevo\Client\Models\GetAccountMarketingAutomation' ]; /** @@ -166,9 +166,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** @@ -219,7 +219,7 @@ public function valid() /** * Gets plan * - * @return \Brevo\Client\Model\GetAccountPlan[] + * @return \Brevo\Client\Models\GetAccountPlan[] */ public function getPlan() { @@ -229,7 +229,7 @@ public function getPlan() /** * Sets plan * - * @param \Brevo\Client\Model\GetAccountPlan[] $plan Information about your plans and credits + * @param \Brevo\Client\Models\GetAccountPlan[] $plan Information about your plans and credits * * @return $this */ @@ -243,7 +243,7 @@ public function setPlan($plan) /** * Gets relay * - * @return \Brevo\Client\Model\GetAccountRelay + * @return \Brevo\Client\Models\GetAccountRelay */ public function getRelay() { @@ -253,7 +253,7 @@ public function getRelay() /** * Sets relay * - * @param \Brevo\Client\Model\GetAccountRelay $relay relay + * @param \Brevo\Client\Models\GetAccountRelay $relay relay * * @return $this */ @@ -267,7 +267,7 @@ public function setRelay($relay) /** * Gets marketingAutomation * - * @return \Brevo\Client\Model\GetAccountMarketingAutomation + * @return \Brevo\Client\Models\GetAccountMarketingAutomation */ public function getMarketingAutomation() { @@ -277,7 +277,7 @@ public function getMarketingAutomation() /** * Sets marketingAutomation * - * @param \Brevo\Client\Model\GetAccountMarketingAutomation $marketingAutomation marketingAutomation + * @param \Brevo\Client\Models\GetAccountMarketingAutomation $marketingAutomation marketingAutomation * * @return $this */ diff --git a/lib/Model/GetAccountActivity.php b/lib/Models/GetAccountActivity.php similarity index 96% rename from lib/Model/GetAccountActivity.php rename to lib/Models/GetAccountActivity.php index 6d48d87..108ba48 100644 --- a/lib/Model/GetAccountActivity.php +++ b/lib/Models/GetAccountActivity.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class GetAccountActivity implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'logs' => '\Brevo\Client\Model\GetAccountActivityLogs[]' + 'logs' => '\Brevo\Client\Models\GetAccountActivityLogs[]' ]; /** @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -207,7 +207,7 @@ public function valid() /** * Gets logs * - * @return \Brevo\Client\Model\GetAccountActivityLogs[] + * @return \Brevo\Client\Models\GetAccountActivityLogs[] */ public function getLogs() { @@ -217,7 +217,7 @@ public function getLogs() /** * Sets logs * - * @param \Brevo\Client\Model\GetAccountActivityLogs[] $logs Get user activity logs + * @param \Brevo\Client\Models\GetAccountActivityLogs[] $logs Get user activity logs * * @return $this */ diff --git a/lib/Model/GetAccountActivityLogs.php b/lib/Models/GetAccountActivityLogs.php similarity index 99% rename from lib/Model/GetAccountActivityLogs.php rename to lib/Models/GetAccountActivityLogs.php index 4e4baa1..c45fb2d 100644 --- a/lib/Model/GetAccountActivityLogs.php +++ b/lib/Models/GetAccountActivityLogs.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -178,9 +178,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetAccountMarketingAutomation.php b/lib/Models/GetAccountMarketingAutomation.php similarity index 99% rename from lib/Model/GetAccountMarketingAutomation.php rename to lib/Models/GetAccountMarketingAutomation.php index fa2ee05..dfc1a53 100644 --- a/lib/Model/GetAccountMarketingAutomation.php +++ b/lib/Models/GetAccountMarketingAutomation.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetAccountPlan.php b/lib/Models/GetAccountPlan.php similarity index 99% rename from lib/Model/GetAccountPlan.php rename to lib/Models/GetAccountPlan.php index caadcb8..eeffdb0 100644 --- a/lib/Model/GetAccountPlan.php +++ b/lib/Models/GetAccountPlan.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/GetAccountRelay.php b/lib/Models/GetAccountRelay.php similarity index 97% rename from lib/Model/GetAccountRelay.php rename to lib/Models/GetAccountRelay.php index 7af1aa4..20abb76 100644 --- a/lib/Model/GetAccountRelay.php +++ b/lib/Models/GetAccountRelay.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -59,7 +59,7 @@ class GetAccountRelay implements ModelInterface, ArrayAccess */ protected static $swaggerTypes = [ 'enabled' => 'bool', - 'data' => '\Brevo\Client\Model\GetAccountRelayData' + 'data' => '\Brevo\Client\Models\GetAccountRelayData' ]; /** @@ -164,9 +164,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -244,7 +244,7 @@ public function setEnabled($enabled) /** * Gets data * - * @return \Brevo\Client\Model\GetAccountRelayData + * @return \Brevo\Client\Models\GetAccountRelayData */ public function getData() { @@ -254,7 +254,7 @@ public function getData() /** * Sets data * - * @param \Brevo\Client\Model\GetAccountRelayData $data data + * @param \Brevo\Client\Models\GetAccountRelayData $data data * * @return $this */ diff --git a/lib/Model/GetAccountRelayData.php b/lib/Models/GetAccountRelayData.php similarity index 99% rename from lib/Model/GetAccountRelayData.php rename to lib/Models/GetAccountRelayData.php index c9ef3b9..00cf4c4 100644 --- a/lib/Model/GetAccountRelayData.php +++ b/lib/Models/GetAccountRelayData.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -169,9 +169,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetAggregatedReport.php b/lib/Models/GetAggregatedReport.php similarity index 99% rename from lib/Model/GetAggregatedReport.php rename to lib/Models/GetAggregatedReport.php index 3ab89d2..570c7ff 100644 --- a/lib/Model/GetAggregatedReport.php +++ b/lib/Models/GetAggregatedReport.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -218,9 +218,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetAllExternalFeeds.php b/lib/Models/GetAllExternalFeeds.php similarity index 96% rename from lib/Model/GetAllExternalFeeds.php rename to lib/Models/GetAllExternalFeeds.php index 5d2a4d9..b060e3f 100644 --- a/lib/Model/GetAllExternalFeeds.php +++ b/lib/Models/GetAllExternalFeeds.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class GetAllExternalFeeds implements ModelInterface, ArrayAccess */ protected static $swaggerTypes = [ 'count' => 'int', - 'feeds' => '\Brevo\Client\Model\GetAllExternalFeedsFeeds[]' + 'feeds' => '\Brevo\Client\Models\GetAllExternalFeedsFeeds[]' ]; /** @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -237,7 +237,7 @@ public function setCount($count) /** * Gets feeds * - * @return \Brevo\Client\Model\GetAllExternalFeedsFeeds[] + * @return \Brevo\Client\Models\GetAllExternalFeedsFeeds[] */ public function getFeeds() { @@ -247,7 +247,7 @@ public function getFeeds() /** * Sets feeds * - * @param \Brevo\Client\Model\GetAllExternalFeedsFeeds[] $feeds feeds + * @param \Brevo\Client\Models\GetAllExternalFeedsFeeds[] $feeds feeds * * @return $this */ diff --git a/lib/Model/GetAllExternalFeedsFeeds.php b/lib/Models/GetAllExternalFeedsFeeds.php similarity index 98% rename from lib/Model/GetAllExternalFeedsFeeds.php rename to lib/Models/GetAllExternalFeedsFeeds.php index fa998bd..5ebdbf4 100644 --- a/lib/Model/GetAllExternalFeedsFeeds.php +++ b/lib/Models/GetAllExternalFeedsFeeds.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -64,7 +64,7 @@ class GetAllExternalFeedsFeeds implements ModelInterface, ArrayAccess 'username' => 'string', 'password' => 'string', 'token' => 'string', - 'headers' => '\Brevo\Client\Model\GetExternalFeedByUUIDHeaders[]', + 'headers' => '\Brevo\Client\Models\GetExternalFeedByUUIDHeaders[]', 'maxRetries' => 'int', 'cache' => 'bool', 'createdAt' => '\DateTime', @@ -216,9 +216,9 @@ public function getModelName() const AUTH_TYPE_BASIC = 'basic'; const AUTH_TYPE_TOKEN = 'token'; const AUTH_TYPE_NO_AUTH = 'noAuth'; - - + + /** * Gets allowable values of the enum * @@ -232,7 +232,7 @@ public function getAuthTypeAllowableValues() self::AUTH_TYPE_NO_AUTH, ]; } - + /** * Associative array for storing property values @@ -510,7 +510,7 @@ public function setToken($token) /** * Gets headers * - * @return \Brevo\Client\Model\GetExternalFeedByUUIDHeaders[] + * @return \Brevo\Client\Models\GetExternalFeedByUUIDHeaders[] */ public function getHeaders() { @@ -520,7 +520,7 @@ public function getHeaders() /** * Sets headers * - * @param \Brevo\Client\Model\GetExternalFeedByUUIDHeaders[] $headers Custom headers for the feed + * @param \Brevo\Client\Models\GetExternalFeedByUUIDHeaders[] $headers Custom headers for the feed * * @return $this */ diff --git a/lib/Model/GetAttributes.php b/lib/Models/GetAttributes.php similarity index 95% rename from lib/Model/GetAttributes.php rename to lib/Models/GetAttributes.php index 76861a9..d24d86f 100644 --- a/lib/Model/GetAttributes.php +++ b/lib/Models/GetAttributes.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class GetAttributes implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'attributes' => '\Brevo\Client\Model\GetAttributesAttributes[]' + 'attributes' => '\Brevo\Client\Models\GetAttributesAttributes[]' ]; /** @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -210,7 +210,7 @@ public function valid() /** * Gets attributes * - * @return \Brevo\Client\Model\GetAttributesAttributes[] + * @return \Brevo\Client\Models\GetAttributesAttributes[] */ public function getAttributes() { @@ -220,7 +220,7 @@ public function getAttributes() /** * Sets attributes * - * @param \Brevo\Client\Model\GetAttributesAttributes[] $attributes Listing of available contact attributes in your account + * @param \Brevo\Client\Models\GetAttributesAttributes[] $attributes Listing of available contact attributes in your account * * @return $this */ diff --git a/lib/Model/GetAttributesAttributes.php b/lib/Models/GetAttributesAttributes.php similarity index 97% rename from lib/Model/GetAttributesAttributes.php rename to lib/Models/GetAttributesAttributes.php index 7588373..a9290ba 100644 --- a/lib/Model/GetAttributesAttributes.php +++ b/lib/Models/GetAttributesAttributes.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -60,7 +60,7 @@ class GetAttributesAttributes implements ModelInterface, ArrayAccess 'name' => 'string', 'category' => 'string', 'type' => 'string', - 'enumeration' => '\Brevo\Client\Model\GetAttributesEnumeration[]', + 'enumeration' => '\Brevo\Client\Models\GetAttributesEnumeration[]', 'calculatedValue' => 'string' ]; @@ -385,7 +385,7 @@ public function setType($type) /** * Gets enumeration * - * @return \Brevo\Client\Model\GetAttributesEnumeration[] + * @return \Brevo\Client\Models\GetAttributesEnumeration[] */ public function getEnumeration() { @@ -395,7 +395,7 @@ public function getEnumeration() /** * Sets enumeration * - * @param \Brevo\Client\Model\GetAttributesEnumeration[] $enumeration Parameter only available for \"category\" type attributes. + * @param \Brevo\Client\Models\GetAttributesEnumeration[] $enumeration Parameter only available for \"category\" type attributes. * * @return $this */ diff --git a/lib/Model/GetAttributesEnumeration.php b/lib/Models/GetAttributesEnumeration.php similarity index 99% rename from lib/Model/GetAttributesEnumeration.php rename to lib/Models/GetAttributesEnumeration.php index 32e3179..8b726cc 100644 --- a/lib/Model/GetAttributesEnumeration.php +++ b/lib/Models/GetAttributesEnumeration.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetBlockedDomains.php b/lib/Models/GetBlockedDomains.php similarity index 99% rename from lib/Model/GetBlockedDomains.php rename to lib/Models/GetBlockedDomains.php index a2e5808..d4bb11e 100644 --- a/lib/Model/GetBlockedDomains.php +++ b/lib/Models/GetBlockedDomains.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -159,9 +159,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetCampaignOverview.php b/lib/Models/GetCampaignOverview.php similarity index 99% rename from lib/Model/GetCampaignOverview.php rename to lib/Models/GetCampaignOverview.php index 7c9bf6c..23d6a5c 100644 --- a/lib/Model/GetCampaignOverview.php +++ b/lib/Models/GetCampaignOverview.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -231,9 +231,9 @@ public function getModelName() const STATUS_QUEUED = 'queued'; const STATUS_SUSPENDED = 'suspended'; const STATUS_IN_PROCESS = 'in_process'; - - + + /** * Gets allowable values of the enum * @@ -246,7 +246,7 @@ public function getTypeAllowableValues() self::TYPE_TRIGGER, ]; } - + /** * Gets allowable values of the enum * @@ -263,7 +263,7 @@ public function getStatusAllowableValues() self::STATUS_IN_PROCESS, ]; } - + /** * Associative array for storing property values diff --git a/lib/Model/GetCampaignRecipients.php b/lib/Models/GetCampaignRecipients.php similarity index 99% rename from lib/Model/GetCampaignRecipients.php rename to lib/Models/GetCampaignRecipients.php index 70bc51a..1d14587 100644 --- a/lib/Model/GetCampaignRecipients.php +++ b/lib/Models/GetCampaignRecipients.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/GetCampaignStats.php b/lib/Models/GetCampaignStats.php similarity index 99% rename from lib/Model/GetCampaignStats.php rename to lib/Models/GetCampaignStats.php index fb2a6a7..03c5f2e 100644 --- a/lib/Model/GetCampaignStats.php +++ b/lib/Models/GetCampaignStats.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -233,9 +233,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetCategories.php b/lib/Models/GetCategories.php similarity index 99% rename from lib/Model/GetCategories.php rename to lib/Models/GetCategories.php index 596ab12..e893017 100644 --- a/lib/Model/GetCategories.php +++ b/lib/Models/GetCategories.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetCategoryDetails.php b/lib/Models/GetCategoryDetails.php similarity index 99% rename from lib/Model/GetCategoryDetails.php rename to lib/Models/GetCategoryDetails.php index 0b4d072..866c4a4 100644 --- a/lib/Model/GetCategoryDetails.php +++ b/lib/Models/GetCategoryDetails.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -183,9 +183,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetChildAccountCreationStatus.php b/lib/Models/GetChildAccountCreationStatus.php similarity index 99% rename from lib/Model/GetChildAccountCreationStatus.php rename to lib/Models/GetChildAccountCreationStatus.php index 33d8821..e7fe87d 100644 --- a/lib/Model/GetChildAccountCreationStatus.php +++ b/lib/Models/GetChildAccountCreationStatus.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/GetChildDomain.php b/lib/Models/GetChildDomain.php similarity index 99% rename from lib/Model/GetChildDomain.php rename to lib/Models/GetChildDomain.php index 0fe663a..47c6a3b 100644 --- a/lib/Model/GetChildDomain.php +++ b/lib/Models/GetChildDomain.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetChildDomains.php b/lib/Models/GetChildDomains.php similarity index 98% rename from lib/Model/GetChildDomains.php rename to lib/Models/GetChildDomains.php index b54947f..2ad8a64 100644 --- a/lib/Model/GetChildDomains.php +++ b/lib/Models/GetChildDomains.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class GetChildDomains implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - + ]; /** @@ -66,7 +66,7 @@ class GetChildDomains implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerFormats = [ - + ]; /** @@ -96,7 +96,7 @@ public static function swaggerFormats() * @var string[] */ protected static $attributeMap = [ - + ]; /** @@ -105,7 +105,7 @@ public static function swaggerFormats() * @var string[] */ protected static $setters = [ - + ]; /** @@ -114,7 +114,7 @@ public static function swaggerFormats() * @var string[] */ protected static $getters = [ - + ]; /** @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetChildInfo.php b/lib/Models/GetChildInfo.php similarity index 93% rename from lib/Model/GetChildInfo.php rename to lib/Models/GetChildInfo.php index 0b909b7..9eb352b 100644 --- a/lib/Model/GetChildInfo.php +++ b/lib/Models/GetChildInfo.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \Brevo\Client\ObjectSerializer; /** @@ -55,11 +55,11 @@ class GetChildInfo extends GetClient * @var string[] */ protected static $swaggerTypes = [ - 'credits' => '\Brevo\Client\Model\GetChildInfoCredits', - 'statistics' => '\Brevo\Client\Model\GetChildInfoStatistics', + 'credits' => '\Brevo\Client\Models\GetChildInfoCredits', + 'statistics' => '\Brevo\Client\Models\GetChildInfoStatistics', 'password' => 'string', 'ips' => 'string[]', - 'apiKeys' => '\Brevo\Client\Model\GetChildInfoApiKeys' + 'apiKeys' => '\Brevo\Client\Models\GetChildInfoApiKeys' ]; /** @@ -228,7 +228,7 @@ public function valid() /** * Gets credits * - * @return \Brevo\Client\Model\GetChildInfoCredits + * @return \Brevo\Client\Models\GetChildInfoCredits */ public function getCredits() { @@ -238,7 +238,7 @@ public function getCredits() /** * Sets credits * - * @param \Brevo\Client\Model\GetChildInfoCredits $credits credits + * @param \Brevo\Client\Models\GetChildInfoCredits $credits credits * * @return $this */ @@ -252,7 +252,7 @@ public function setCredits($credits) /** * Gets statistics * - * @return \Brevo\Client\Model\GetChildInfoStatistics + * @return \Brevo\Client\Models\GetChildInfoStatistics */ public function getStatistics() { @@ -262,7 +262,7 @@ public function getStatistics() /** * Sets statistics * - * @param \Brevo\Client\Model\GetChildInfoStatistics $statistics statistics + * @param \Brevo\Client\Models\GetChildInfoStatistics $statistics statistics * * @return $this */ @@ -324,7 +324,7 @@ public function setIps($ips) /** * Gets apiKeys * - * @return \Brevo\Client\Model\GetChildInfoApiKeys + * @return \Brevo\Client\Models\GetChildInfoApiKeys */ public function getApiKeys() { @@ -334,7 +334,7 @@ public function getApiKeys() /** * Sets apiKeys * - * @param \Brevo\Client\Model\GetChildInfoApiKeys $apiKeys apiKeys + * @param \Brevo\Client\Models\GetChildInfoApiKeys $apiKeys apiKeys * * @return $this */ diff --git a/lib/Model/GetChildInfoApiKeys.php b/lib/Models/GetChildInfoApiKeys.php similarity index 94% rename from lib/Model/GetChildInfoApiKeys.php rename to lib/Models/GetChildInfoApiKeys.php index 63fd407..4ae18d1 100644 --- a/lib/Model/GetChildInfoApiKeys.php +++ b/lib/Models/GetChildInfoApiKeys.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,8 +58,8 @@ class GetChildInfoApiKeys implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'v2' => '\Brevo\Client\Model\GetChildInfoApiKeysV2[]', - 'v3' => '\Brevo\Client\Model\GetChildInfoApiKeysV3[]' + 'v2' => '\Brevo\Client\Models\GetChildInfoApiKeysV2[]', + 'v3' => '\Brevo\Client\Models\GetChildInfoApiKeysV3[]' ]; /** @@ -164,9 +164,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -217,7 +217,7 @@ public function valid() /** * Gets v2 * - * @return \Brevo\Client\Model\GetChildInfoApiKeysV2[] + * @return \Brevo\Client\Models\GetChildInfoApiKeysV2[] */ public function getV2() { @@ -227,7 +227,7 @@ public function getV2() /** * Sets v2 * - * @param \Brevo\Client\Model\GetChildInfoApiKeysV2[] $v2 v2 + * @param \Brevo\Client\Models\GetChildInfoApiKeysV2[] $v2 v2 * * @return $this */ @@ -241,7 +241,7 @@ public function setV2($v2) /** * Gets v3 * - * @return \Brevo\Client\Model\GetChildInfoApiKeysV3[] + * @return \Brevo\Client\Models\GetChildInfoApiKeysV3[] */ public function getV3() { @@ -251,7 +251,7 @@ public function getV3() /** * Sets v3 * - * @param \Brevo\Client\Model\GetChildInfoApiKeysV3[] $v3 v3 + * @param \Brevo\Client\Models\GetChildInfoApiKeysV3[] $v3 v3 * * @return $this */ diff --git a/lib/Model/GetChildInfoApiKeysV2.php b/lib/Models/GetChildInfoApiKeysV2.php similarity index 99% rename from lib/Model/GetChildInfoApiKeysV2.php rename to lib/Models/GetChildInfoApiKeysV2.php index 4215b8a..e57a51b 100644 --- a/lib/Model/GetChildInfoApiKeysV2.php +++ b/lib/Models/GetChildInfoApiKeysV2.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetChildInfoApiKeysV3.php b/lib/Models/GetChildInfoApiKeysV3.php similarity index 99% rename from lib/Model/GetChildInfoApiKeysV3.php rename to lib/Models/GetChildInfoApiKeysV3.php index 8b58a1f..be8a8dd 100644 --- a/lib/Model/GetChildInfoApiKeysV3.php +++ b/lib/Models/GetChildInfoApiKeysV3.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetChildInfoCredits.php b/lib/Models/GetChildInfoCredits.php similarity index 99% rename from lib/Model/GetChildInfoCredits.php rename to lib/Models/GetChildInfoCredits.php index b79dd86..81f2c01 100644 --- a/lib/Model/GetChildInfoCredits.php +++ b/lib/Models/GetChildInfoCredits.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -164,9 +164,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetChildInfoStatistics.php b/lib/Models/GetChildInfoStatistics.php similarity index 99% rename from lib/Model/GetChildInfoStatistics.php rename to lib/Models/GetChildInfoStatistics.php index 730f10d..7da5fae 100644 --- a/lib/Model/GetChildInfoStatistics.php +++ b/lib/Models/GetChildInfoStatistics.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -169,9 +169,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetChildrenList.php b/lib/Models/GetChildrenList.php similarity index 99% rename from lib/Model/GetChildrenList.php rename to lib/Models/GetChildrenList.php index 0d48062..704d5ca 100644 --- a/lib/Model/GetChildrenList.php +++ b/lib/Models/GetChildrenList.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetClient.php b/lib/Models/GetClient.php similarity index 99% rename from lib/Model/GetClient.php rename to lib/Models/GetClient.php index 53d7b2f..06fb685 100644 --- a/lib/Model/GetClient.php +++ b/lib/Models/GetClient.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -173,9 +173,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetContactCampaignStats.php b/lib/Models/GetContactCampaignStats.php similarity index 83% rename from lib/Model/GetContactCampaignStats.php rename to lib/Models/GetContactCampaignStats.php index 963af44..7579be3 100644 --- a/lib/Model/GetContactCampaignStats.php +++ b/lib/Models/GetContactCampaignStats.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,15 +58,15 @@ class GetContactCampaignStats implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'messagesSent' => '\Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[]', - 'hardBounces' => '\Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[]', - 'softBounces' => '\Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[]', - 'complaints' => '\Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[]', - 'unsubscriptions' => '\Brevo\Client\Model\GetContactCampaignStatsUnsubscriptions', - 'opened' => '\Brevo\Client\Model\GetContactCampaignStatsOpened[]', - 'clicked' => '\Brevo\Client\Model\GetContactCampaignStatsClicked[]', - 'transacAttributes' => '\Brevo\Client\Model\GetContactCampaignStatsTransacAttributes[]', - 'delivered' => '\Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[]' + 'messagesSent' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[]', + 'hardBounces' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[]', + 'softBounces' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[]', + 'complaints' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[]', + 'unsubscriptions' => '\Brevo\Client\Models\GetContactCampaignStatsUnsubscriptions', + 'opened' => '\Brevo\Client\Models\GetContactCampaignStatsOpened[]', + 'clicked' => '\Brevo\Client\Models\GetContactCampaignStatsClicked[]', + 'transacAttributes' => '\Brevo\Client\Models\GetContactCampaignStatsTransacAttributes[]', + 'delivered' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[]' ]; /** @@ -199,9 +199,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -256,7 +256,7 @@ public function valid() /** * Gets messagesSent * - * @return \Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] */ public function getMessagesSent() { @@ -266,7 +266,7 @@ public function getMessagesSent() /** * Sets messagesSent * - * @param \Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $messagesSent messagesSent + * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] $messagesSent messagesSent * * @return $this */ @@ -280,7 +280,7 @@ public function setMessagesSent($messagesSent) /** * Gets hardBounces * - * @return \Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] */ public function getHardBounces() { @@ -290,7 +290,7 @@ public function getHardBounces() /** * Sets hardBounces * - * @param \Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $hardBounces hardBounces + * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] $hardBounces hardBounces * * @return $this */ @@ -304,7 +304,7 @@ public function setHardBounces($hardBounces) /** * Gets softBounces * - * @return \Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] */ public function getSoftBounces() { @@ -314,7 +314,7 @@ public function getSoftBounces() /** * Sets softBounces * - * @param \Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $softBounces softBounces + * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] $softBounces softBounces * * @return $this */ @@ -328,7 +328,7 @@ public function setSoftBounces($softBounces) /** * Gets complaints * - * @return \Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] */ public function getComplaints() { @@ -338,7 +338,7 @@ public function getComplaints() /** * Sets complaints * - * @param \Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $complaints complaints + * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] $complaints complaints * * @return $this */ @@ -352,7 +352,7 @@ public function setComplaints($complaints) /** * Gets unsubscriptions * - * @return \Brevo\Client\Model\GetContactCampaignStatsUnsubscriptions + * @return \Brevo\Client\Models\GetContactCampaignStatsUnsubscriptions */ public function getUnsubscriptions() { @@ -362,7 +362,7 @@ public function getUnsubscriptions() /** * Sets unsubscriptions * - * @param \Brevo\Client\Model\GetContactCampaignStatsUnsubscriptions $unsubscriptions unsubscriptions + * @param \Brevo\Client\Models\GetContactCampaignStatsUnsubscriptions $unsubscriptions unsubscriptions * * @return $this */ @@ -376,7 +376,7 @@ public function setUnsubscriptions($unsubscriptions) /** * Gets opened * - * @return \Brevo\Client\Model\GetContactCampaignStatsOpened[] + * @return \Brevo\Client\Models\GetContactCampaignStatsOpened[] */ public function getOpened() { @@ -386,7 +386,7 @@ public function getOpened() /** * Sets opened * - * @param \Brevo\Client\Model\GetContactCampaignStatsOpened[] $opened opened + * @param \Brevo\Client\Models\GetContactCampaignStatsOpened[] $opened opened * * @return $this */ @@ -400,7 +400,7 @@ public function setOpened($opened) /** * Gets clicked * - * @return \Brevo\Client\Model\GetContactCampaignStatsClicked[] + * @return \Brevo\Client\Models\GetContactCampaignStatsClicked[] */ public function getClicked() { @@ -410,7 +410,7 @@ public function getClicked() /** * Sets clicked * - * @param \Brevo\Client\Model\GetContactCampaignStatsClicked[] $clicked clicked + * @param \Brevo\Client\Models\GetContactCampaignStatsClicked[] $clicked clicked * * @return $this */ @@ -424,7 +424,7 @@ public function setClicked($clicked) /** * Gets transacAttributes * - * @return \Brevo\Client\Model\GetContactCampaignStatsTransacAttributes[] + * @return \Brevo\Client\Models\GetContactCampaignStatsTransacAttributes[] */ public function getTransacAttributes() { @@ -434,7 +434,7 @@ public function getTransacAttributes() /** * Sets transacAttributes * - * @param \Brevo\Client\Model\GetContactCampaignStatsTransacAttributes[] $transacAttributes transacAttributes + * @param \Brevo\Client\Models\GetContactCampaignStatsTransacAttributes[] $transacAttributes transacAttributes * * @return $this */ @@ -448,7 +448,7 @@ public function setTransacAttributes($transacAttributes) /** * Gets delivered * - * @return \Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] */ public function getDelivered() { @@ -458,7 +458,7 @@ public function getDelivered() /** * Sets delivered * - * @param \Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $delivered delivered + * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] $delivered delivered * * @return $this */ diff --git a/lib/Model/GetContactCampaignStatsClicked.php b/lib/Models/GetContactCampaignStatsClicked.php similarity index 96% rename from lib/Model/GetContactCampaignStatsClicked.php rename to lib/Models/GetContactCampaignStatsClicked.php index 8dc1d58..65078f9 100644 --- a/lib/Model/GetContactCampaignStatsClicked.php +++ b/lib/Models/GetContactCampaignStatsClicked.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class GetContactCampaignStatsClicked implements ModelInterface, ArrayAccess */ protected static $swaggerTypes = [ 'campaignId' => 'int', - 'links' => '\Brevo\Client\Model\GetExtendedContactDetailsStatisticsLinks[]' + 'links' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsLinks[]' ]; /** @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -243,7 +243,7 @@ public function setCampaignId($campaignId) /** * Gets links * - * @return \Brevo\Client\Model\GetExtendedContactDetailsStatisticsLinks[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsLinks[] */ public function getLinks() { @@ -253,7 +253,7 @@ public function getLinks() /** * Sets links * - * @param \Brevo\Client\Model\GetExtendedContactDetailsStatisticsLinks[] $links links + * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsLinks[] $links links * * @return $this */ diff --git a/lib/Model/GetContactCampaignStatsOpened.php b/lib/Models/GetContactCampaignStatsOpened.php similarity index 99% rename from lib/Model/GetContactCampaignStatsOpened.php rename to lib/Models/GetContactCampaignStatsOpened.php index fd17f29..5ce69b8 100644 --- a/lib/Model/GetContactCampaignStatsOpened.php +++ b/lib/Models/GetContactCampaignStatsOpened.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -173,9 +173,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetContactCampaignStatsTransacAttributes.php b/lib/Models/GetContactCampaignStatsTransacAttributes.php similarity index 99% rename from lib/Model/GetContactCampaignStatsTransacAttributes.php rename to lib/Models/GetContactCampaignStatsTransacAttributes.php index e070a8f..1caa691 100644 --- a/lib/Model/GetContactCampaignStatsTransacAttributes.php +++ b/lib/Models/GetContactCampaignStatsTransacAttributes.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -168,9 +168,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetContactCampaignStatsUnsubscriptions.php b/lib/Models/GetContactCampaignStatsUnsubscriptions.php similarity index 90% rename from lib/Model/GetContactCampaignStatsUnsubscriptions.php rename to lib/Models/GetContactCampaignStatsUnsubscriptions.php index 801f31d..e989bf9 100644 --- a/lib/Model/GetContactCampaignStatsUnsubscriptions.php +++ b/lib/Models/GetContactCampaignStatsUnsubscriptions.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,8 +57,8 @@ class GetContactCampaignStatsUnsubscriptions implements ModelInterface, ArrayAcc * @var string[] */ protected static $swaggerTypes = [ - 'userUnsubscription' => '\Brevo\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[]', - 'adminUnsubscription' => '\Brevo\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[]' + 'userUnsubscription' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[]', + 'adminUnsubscription' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[]' ]; /** @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -219,7 +219,7 @@ public function valid() /** * Gets userUnsubscription * - * @return \Brevo\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[] */ public function getUserUnsubscription() { @@ -229,7 +229,7 @@ public function getUserUnsubscription() /** * Sets userUnsubscription * - * @param \Brevo\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[] $userUnsubscription Contact has unsubscribed via the unsubscription link in the email + * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[] $userUnsubscription Contact has unsubscribed via the unsubscription link in the email * * @return $this */ @@ -243,7 +243,7 @@ public function setUserUnsubscription($userUnsubscription) /** * Gets adminUnsubscription * - * @return \Brevo\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[] */ public function getAdminUnsubscription() { @@ -253,7 +253,7 @@ public function getAdminUnsubscription() /** * Sets adminUnsubscription * - * @param \Brevo\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[] $adminUnsubscription Contact has been unsubscribed from the administrator + * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[] $adminUnsubscription Contact has been unsubscribed from the administrator * * @return $this */ diff --git a/lib/Model/GetContactDetails.php b/lib/Models/GetContactDetails.php similarity index 99% rename from lib/Model/GetContactDetails.php rename to lib/Models/GetContactDetails.php index da37f94..8a572a3 100644 --- a/lib/Model/GetContactDetails.php +++ b/lib/Models/GetContactDetails.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/GetContacts.php b/lib/Models/GetContacts.php similarity index 99% rename from lib/Model/GetContacts.php rename to lib/Models/GetContacts.php index 0be86d9..af655cd 100644 --- a/lib/Model/GetContacts.php +++ b/lib/Models/GetContacts.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetCorporateInvitedUsersList.php b/lib/Models/GetCorporateInvitedUsersList.php similarity index 96% rename from lib/Model/GetCorporateInvitedUsersList.php rename to lib/Models/GetCorporateInvitedUsersList.php index 989c089..bea7d3c 100644 --- a/lib/Model/GetCorporateInvitedUsersList.php +++ b/lib/Models/GetCorporateInvitedUsersList.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class GetCorporateInvitedUsersList implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'users' => '\Brevo\Client\Model\GetCorporateInvitedUsersListUsers[]' + 'users' => '\Brevo\Client\Models\GetCorporateInvitedUsersListUsers[]' ]; /** @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -207,7 +207,7 @@ public function valid() /** * Gets users * - * @return \Brevo\Client\Model\GetCorporateInvitedUsersListUsers[] + * @return \Brevo\Client\Models\GetCorporateInvitedUsersListUsers[] */ public function getUsers() { @@ -217,7 +217,7 @@ public function getUsers() /** * Sets users * - * @param \Brevo\Client\Model\GetCorporateInvitedUsersListUsers[] $users Get invited users list + * @param \Brevo\Client\Models\GetCorporateInvitedUsersListUsers[] $users Get invited users list * * @return $this */ diff --git a/lib/Model/GetCorporateInvitedUsersListFeatureAccess.php b/lib/Models/GetCorporateInvitedUsersListFeatureAccess.php similarity index 99% rename from lib/Model/GetCorporateInvitedUsersListFeatureAccess.php rename to lib/Models/GetCorporateInvitedUsersListFeatureAccess.php index 38544b2..3acfa2e 100644 --- a/lib/Model/GetCorporateInvitedUsersListFeatureAccess.php +++ b/lib/Models/GetCorporateInvitedUsersListFeatureAccess.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -174,9 +174,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetCorporateInvitedUsersListGroups.php b/lib/Models/GetCorporateInvitedUsersListGroups.php similarity index 99% rename from lib/Model/GetCorporateInvitedUsersListGroups.php rename to lib/Models/GetCorporateInvitedUsersListGroups.php index c6c882b..d059605 100644 --- a/lib/Model/GetCorporateInvitedUsersListGroups.php +++ b/lib/Models/GetCorporateInvitedUsersListGroups.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -164,9 +164,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetCorporateInvitedUsersListUsers.php b/lib/Models/GetCorporateInvitedUsersListUsers.php similarity index 94% rename from lib/Model/GetCorporateInvitedUsersListUsers.php rename to lib/Models/GetCorporateInvitedUsersListUsers.php index 1bb9cae..68b9478 100644 --- a/lib/Model/GetCorporateInvitedUsersListUsers.php +++ b/lib/Models/GetCorporateInvitedUsersListUsers.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,11 +57,11 @@ class GetCorporateInvitedUsersListUsers implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'groups' => '\Brevo\Client\Model\GetCorporateInvitedUsersListGroups', + 'groups' => '\Brevo\Client\Models\GetCorporateInvitedUsersListGroups', 'email' => 'string', 'isOwner' => 'string', 'status' => 'string', - 'featureAccess' => '\Brevo\Client\Model\GetCorporateInvitedUsersListFeatureAccess' + 'featureAccess' => '\Brevo\Client\Models\GetCorporateInvitedUsersListFeatureAccess' ]; /** @@ -178,9 +178,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -246,7 +246,7 @@ public function valid() /** * Gets groups * - * @return \Brevo\Client\Model\GetCorporateInvitedUsersListGroups + * @return \Brevo\Client\Models\GetCorporateInvitedUsersListGroups */ public function getGroups() { @@ -256,7 +256,7 @@ public function getGroups() /** * Sets groups * - * @param \Brevo\Client\Model\GetCorporateInvitedUsersListGroups $groups groups + * @param \Brevo\Client\Models\GetCorporateInvitedUsersListGroups $groups groups * * @return $this */ @@ -342,7 +342,7 @@ public function setStatus($status) /** * Gets featureAccess * - * @return \Brevo\Client\Model\GetCorporateInvitedUsersListFeatureAccess + * @return \Brevo\Client\Models\GetCorporateInvitedUsersListFeatureAccess */ public function getFeatureAccess() { @@ -352,7 +352,7 @@ public function getFeatureAccess() /** * Sets featureAccess * - * @param \Brevo\Client\Model\GetCorporateInvitedUsersListFeatureAccess $featureAccess featureAccess + * @param \Brevo\Client\Models\GetCorporateInvitedUsersListFeatureAccess $featureAccess featureAccess * * @return $this */ diff --git a/lib/Model/GetCouponCollection.php b/lib/Models/GetCouponCollection.php similarity index 99% rename from lib/Model/GetCouponCollection.php rename to lib/Models/GetCouponCollection.php index 69d4b47..17f4fe1 100644 --- a/lib/Model/GetCouponCollection.php +++ b/lib/Models/GetCouponCollection.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -183,9 +183,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetDeviceBrowserStats.php b/lib/Models/GetDeviceBrowserStats.php similarity index 99% rename from lib/Model/GetDeviceBrowserStats.php rename to lib/Models/GetDeviceBrowserStats.php index 81a3e75..90f7e77 100644 --- a/lib/Model/GetDeviceBrowserStats.php +++ b/lib/Models/GetDeviceBrowserStats.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -173,9 +173,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetDomainConfigurationModel.php b/lib/Models/GetDomainConfigurationModel.php similarity index 97% rename from lib/Model/GetDomainConfigurationModel.php rename to lib/Models/GetDomainConfigurationModel.php index 52ee44b..898d3fa 100644 --- a/lib/Model/GetDomainConfigurationModel.php +++ b/lib/Models/GetDomainConfigurationModel.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -60,7 +60,7 @@ class GetDomainConfigurationModel implements ModelInterface, ArrayAccess 'domain' => 'string', 'verified' => 'bool', 'authenticated' => 'bool', - 'dnsRecords' => '\Brevo\Client\Model\CreateDomainModelDnsRecords' + 'dnsRecords' => '\Brevo\Client\Models\CreateDomainModelDnsRecords' ]; /** @@ -309,7 +309,7 @@ public function setAuthenticated($authenticated) /** * Gets dnsRecords * - * @return \Brevo\Client\Model\CreateDomainModelDnsRecords + * @return \Brevo\Client\Models\CreateDomainModelDnsRecords */ public function getDnsRecords() { @@ -319,7 +319,7 @@ public function getDnsRecords() /** * Sets dnsRecords * - * @param \Brevo\Client\Model\CreateDomainModelDnsRecords $dnsRecords dnsRecords + * @param \Brevo\Client\Models\CreateDomainModelDnsRecords $dnsRecords dnsRecords * * @return $this */ diff --git a/lib/Model/GetDomainsList.php b/lib/Models/GetDomainsList.php similarity index 96% rename from lib/Model/GetDomainsList.php rename to lib/Models/GetDomainsList.php index 1ed1db7..3e50427 100644 --- a/lib/Model/GetDomainsList.php +++ b/lib/Models/GetDomainsList.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class GetDomainsList implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'domains' => '\Brevo\Client\Model\GetDomainsListDomains[]' + 'domains' => '\Brevo\Client\Models\GetDomainsListDomains[]' ]; /** @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -207,7 +207,7 @@ public function valid() /** * Gets domains * - * @return \Brevo\Client\Model\GetDomainsListDomains[] + * @return \Brevo\Client\Models\GetDomainsListDomains[] */ public function getDomains() { @@ -217,7 +217,7 @@ public function getDomains() /** * Sets domains * - * @param \Brevo\Client\Model\GetDomainsListDomains[] $domains List of the domains available in your account + * @param \Brevo\Client\Models\GetDomainsListDomains[] $domains List of the domains available in your account * * @return $this */ diff --git a/lib/Model/GetDomainsListDomains.php b/lib/Models/GetDomainsListDomains.php similarity index 99% rename from lib/Model/GetDomainsListDomains.php rename to lib/Models/GetDomainsListDomains.php index 27d25bf..e145cbd 100644 --- a/lib/Model/GetDomainsListDomains.php +++ b/lib/Models/GetDomainsListDomains.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/GetEmailCampaign.php b/lib/Models/GetEmailCampaign.php similarity index 99% rename from lib/Model/GetEmailCampaign.php rename to lib/Models/GetEmailCampaign.php index c27c352..177d888 100644 --- a/lib/Model/GetEmailCampaign.php +++ b/lib/Models/GetEmailCampaign.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -73,7 +73,7 @@ class GetEmailCampaign implements ModelInterface, ArrayAccess 'testSent' => 'bool', 'header' => 'string', 'footer' => 'string', - 'sender' => '\Brevo\Client\Model\GetExtendedCampaignOverviewSender', + 'sender' => '\Brevo\Client\Models\GetExtendedCampaignOverviewSender', 'replyTo' => 'string', 'toField' => 'string', 'htmlContent' => 'string', @@ -886,7 +886,7 @@ public function setFooter($footer) /** * Gets sender * - * @return \Brevo\Client\Model\GetExtendedCampaignOverviewSender + * @return \Brevo\Client\Models\GetExtendedCampaignOverviewSender */ public function getSender() { @@ -896,7 +896,7 @@ public function getSender() /** * Sets sender * - * @param \Brevo\Client\Model\GetExtendedCampaignOverviewSender $sender sender + * @param \Brevo\Client\Models\GetExtendedCampaignOverviewSender $sender sender * * @return $this */ diff --git a/lib/Model/GetEmailCampaigns.php b/lib/Models/GetEmailCampaigns.php similarity index 99% rename from lib/Model/GetEmailCampaigns.php rename to lib/Models/GetEmailCampaigns.php index 9f624c5..004c07a 100644 --- a/lib/Model/GetEmailCampaigns.php +++ b/lib/Models/GetEmailCampaigns.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetEmailEventReport.php b/lib/Models/GetEmailEventReport.php similarity index 96% rename from lib/Model/GetEmailEventReport.php rename to lib/Models/GetEmailEventReport.php index 47d443e..6733cbc 100644 --- a/lib/Model/GetEmailEventReport.php +++ b/lib/Models/GetEmailEventReport.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class GetEmailEventReport implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'events' => '\Brevo\Client\Model\GetEmailEventReportEvents[]' + 'events' => '\Brevo\Client\Models\GetEmailEventReportEvents[]' ]; /** @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -207,7 +207,7 @@ public function valid() /** * Gets events * - * @return \Brevo\Client\Model\GetEmailEventReportEvents[] + * @return \Brevo\Client\Models\GetEmailEventReportEvents[] */ public function getEvents() { @@ -217,7 +217,7 @@ public function getEvents() /** * Sets events * - * @param \Brevo\Client\Model\GetEmailEventReportEvents[] $events events + * @param \Brevo\Client\Models\GetEmailEventReportEvents[] $events events * * @return $this */ diff --git a/lib/Model/GetEmailEventReportEvents.php b/lib/Models/GetEmailEventReportEvents.php similarity index 99% rename from lib/Model/GetEmailEventReportEvents.php rename to lib/Models/GetEmailEventReportEvents.php index ccaef2f..ef11bab 100644 --- a/lib/Model/GetEmailEventReportEvents.php +++ b/lib/Models/GetEmailEventReportEvents.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/GetExtendedCampaignOverview.php b/lib/Models/GetExtendedCampaignOverview.php similarity index 99% rename from lib/Model/GetExtendedCampaignOverview.php rename to lib/Models/GetExtendedCampaignOverview.php index cd7b110..211a3dc 100644 --- a/lib/Model/GetExtendedCampaignOverview.php +++ b/lib/Models/GetExtendedCampaignOverview.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -73,7 +73,7 @@ class GetExtendedCampaignOverview implements ModelInterface, ArrayAccess 'testSent' => 'bool', 'header' => 'string', 'footer' => 'string', - 'sender' => '\Brevo\Client\Model\GetExtendedCampaignOverviewSender', + 'sender' => '\Brevo\Client\Models\GetExtendedCampaignOverviewSender', 'replyTo' => 'string', 'toField' => 'string', 'htmlContent' => 'string', @@ -307,7 +307,7 @@ public function getModelName() const STATUS_SUSPENDED = 'suspended'; const STATUS_IN_PROCESS = 'in_process'; - + /** @@ -868,7 +868,7 @@ public function setFooter($footer) /** * Gets sender * - * @return \Brevo\Client\Model\GetExtendedCampaignOverviewSender + * @return \Brevo\Client\Models\GetExtendedCampaignOverviewSender */ public function getSender() { @@ -878,7 +878,7 @@ public function getSender() /** * Sets sender * - * @param \Brevo\Client\Model\GetExtendedCampaignOverviewSender $sender sender + * @param \Brevo\Client\Models\GetExtendedCampaignOverviewSender $sender sender * * @return $this */ diff --git a/lib/Model/GetExtendedCampaignOverviewSender.php b/lib/Models/GetExtendedCampaignOverviewSender.php similarity index 99% rename from lib/Model/GetExtendedCampaignOverviewSender.php rename to lib/Models/GetExtendedCampaignOverviewSender.php index eb289f5..3e46c7c 100644 --- a/lib/Model/GetExtendedCampaignOverviewSender.php +++ b/lib/Models/GetExtendedCampaignOverviewSender.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -168,9 +168,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetExtendedCampaignStats.php b/lib/Models/GetExtendedCampaignStats.php similarity index 92% rename from lib/Model/GetExtendedCampaignStats.php rename to lib/Models/GetExtendedCampaignStats.php index efe202a..922592b 100644 --- a/lib/Model/GetExtendedCampaignStats.php +++ b/lib/Models/GetExtendedCampaignStats.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,14 +57,14 @@ class GetExtendedCampaignStats implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'globalStats' => '\Brevo\Client\Model\GetExtendedCampaignStatsGlobalStats', + 'globalStats' => '\Brevo\Client\Models\GetExtendedCampaignStatsGlobalStats', 'campaignStats' => 'object[]', 'mirrorClick' => 'int', 'remaining' => 'int', 'linksStats' => 'object', - 'statsByDomain' => '\Brevo\Client\Model\GetStatsByDomain', - 'statsByDevice' => '\Brevo\Client\Model\GetStatsByDevice', - 'statsByBrowser' => '\Brevo\Client\Model\GetStatsByBrowser' + 'statsByDomain' => '\Brevo\Client\Models\GetStatsByDomain', + 'statsByDevice' => '\Brevo\Client\Models\GetStatsByDevice', + 'statsByBrowser' => '\Brevo\Client\Models\GetStatsByBrowser' ]; /** @@ -193,9 +193,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -273,7 +273,7 @@ public function valid() /** * Gets globalStats * - * @return \Brevo\Client\Model\GetExtendedCampaignStatsGlobalStats + * @return \Brevo\Client\Models\GetExtendedCampaignStatsGlobalStats */ public function getGlobalStats() { @@ -283,7 +283,7 @@ public function getGlobalStats() /** * Sets globalStats * - * @param \Brevo\Client\Model\GetExtendedCampaignStatsGlobalStats $globalStats globalStats + * @param \Brevo\Client\Models\GetExtendedCampaignStatsGlobalStats $globalStats globalStats * * @return $this */ @@ -393,7 +393,7 @@ public function setLinksStats($linksStats) /** * Gets statsByDomain * - * @return \Brevo\Client\Model\GetStatsByDomain + * @return \Brevo\Client\Models\GetStatsByDomain */ public function getStatsByDomain() { @@ -403,7 +403,7 @@ public function getStatsByDomain() /** * Sets statsByDomain * - * @param \Brevo\Client\Model\GetStatsByDomain $statsByDomain statsByDomain + * @param \Brevo\Client\Models\GetStatsByDomain $statsByDomain statsByDomain * * @return $this */ @@ -417,7 +417,7 @@ public function setStatsByDomain($statsByDomain) /** * Gets statsByDevice * - * @return \Brevo\Client\Model\GetStatsByDevice + * @return \Brevo\Client\Models\GetStatsByDevice */ public function getStatsByDevice() { @@ -427,7 +427,7 @@ public function getStatsByDevice() /** * Sets statsByDevice * - * @param \Brevo\Client\Model\GetStatsByDevice $statsByDevice Statistics about the campaign on the basis of various devices + * @param \Brevo\Client\Models\GetStatsByDevice $statsByDevice Statistics about the campaign on the basis of various devices * * @return $this */ @@ -441,7 +441,7 @@ public function setStatsByDevice($statsByDevice) /** * Gets statsByBrowser * - * @return \Brevo\Client\Model\GetStatsByBrowser + * @return \Brevo\Client\Models\GetStatsByBrowser */ public function getStatsByBrowser() { @@ -451,7 +451,7 @@ public function getStatsByBrowser() /** * Sets statsByBrowser * - * @param \Brevo\Client\Model\GetStatsByBrowser $statsByBrowser Statistics about the campaign on the basis of various browsers + * @param \Brevo\Client\Models\GetStatsByBrowser $statsByBrowser Statistics about the campaign on the basis of various browsers * * @return $this */ diff --git a/lib/Model/GetExtendedCampaignStatsGlobalStats.php b/lib/Models/GetExtendedCampaignStatsGlobalStats.php similarity index 98% rename from lib/Model/GetExtendedCampaignStatsGlobalStats.php rename to lib/Models/GetExtendedCampaignStatsGlobalStats.php index 03d1ced..bdef9e5 100644 --- a/lib/Model/GetExtendedCampaignStatsGlobalStats.php +++ b/lib/Models/GetExtendedCampaignStatsGlobalStats.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class GetExtendedCampaignStatsGlobalStats implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - + ]; /** @@ -67,7 +67,7 @@ class GetExtendedCampaignStatsGlobalStats implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerFormats = [ - + ]; /** @@ -97,7 +97,7 @@ public static function swaggerFormats() * @var string[] */ protected static $attributeMap = [ - + ]; /** @@ -106,7 +106,7 @@ public static function swaggerFormats() * @var string[] */ protected static $setters = [ - + ]; /** @@ -115,7 +115,7 @@ public static function swaggerFormats() * @var string[] */ protected static $getters = [ - + ]; /** @@ -159,9 +159,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetExtendedClient.php b/lib/Models/GetExtendedClient.php similarity index 96% rename from lib/Model/GetExtendedClient.php rename to lib/Models/GetExtendedClient.php index a4eb983..d3f63ce 100644 --- a/lib/Model/GetExtendedClient.php +++ b/lib/Models/GetExtendedClient.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \Brevo\Client\ObjectSerializer; /** @@ -38,7 +38,7 @@ * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ -class GetExtendedClient extends GetClient +class GetExtendedClient extends GetClient { const DISCRIMINATOR = null; @@ -55,7 +55,7 @@ class GetExtendedClient extends GetClient * @var string[] */ protected static $swaggerTypes = [ - 'address' => '\Brevo\Client\Model\GetExtendedClientAddress' + 'address' => '\Brevo\Client\Models\GetExtendedClientAddress' ]; /** @@ -156,9 +156,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** @@ -204,7 +204,7 @@ public function valid() /** * Gets address * - * @return \Brevo\Client\Model\GetExtendedClientAddress + * @return \Brevo\Client\Models\GetExtendedClientAddress */ public function getAddress() { @@ -214,7 +214,7 @@ public function getAddress() /** * Sets address * - * @param \Brevo\Client\Model\GetExtendedClientAddress $address address + * @param \Brevo\Client\Models\GetExtendedClientAddress $address address * * @return $this */ diff --git a/lib/Model/GetExtendedClientAddress.php b/lib/Models/GetExtendedClientAddress.php similarity index 99% rename from lib/Model/GetExtendedClientAddress.php rename to lib/Models/GetExtendedClientAddress.php index 7b4691f..d66f903 100644 --- a/lib/Model/GetExtendedClientAddress.php +++ b/lib/Models/GetExtendedClientAddress.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -174,9 +174,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetExtendedContactDetails.php b/lib/Models/GetExtendedContactDetails.php similarity index 98% rename from lib/Model/GetExtendedContactDetails.php rename to lib/Models/GetExtendedContactDetails.php index 6651b44..fa15194 100644 --- a/lib/Model/GetExtendedContactDetails.php +++ b/lib/Models/GetExtendedContactDetails.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -66,7 +66,7 @@ class GetExtendedContactDetails implements ModelInterface, ArrayAccess 'listIds' => 'int[]', 'listUnsubscribed' => 'int[]', 'attributes' => 'object', - 'statistics' => '\Brevo\Client\Model\GetExtendedContactDetailsStatistics' + 'statistics' => '\Brevo\Client\Models\GetExtendedContactDetailsStatistics' ]; /** @@ -505,7 +505,7 @@ public function setAttributes($attributes) /** * Gets statistics * - * @return \Brevo\Client\Model\GetExtendedContactDetailsStatistics + * @return \Brevo\Client\Models\GetExtendedContactDetailsStatistics */ public function getStatistics() { @@ -515,7 +515,7 @@ public function getStatistics() /** * Sets statistics * - * @param \Brevo\Client\Model\GetExtendedContactDetailsStatistics $statistics statistics + * @param \Brevo\Client\Models\GetExtendedContactDetailsStatistics $statistics statistics * * @return $this */ diff --git a/lib/Model/GetExtendedContactDetailsStatistics.php b/lib/Models/GetExtendedContactDetailsStatistics.php similarity index 83% rename from lib/Model/GetExtendedContactDetailsStatistics.php rename to lib/Models/GetExtendedContactDetailsStatistics.php index f5f05be..1a4cabb 100644 --- a/lib/Model/GetExtendedContactDetailsStatistics.php +++ b/lib/Models/GetExtendedContactDetailsStatistics.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,15 +58,15 @@ class GetExtendedContactDetailsStatistics implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'messagesSent' => '\Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[]', - 'hardBounces' => '\Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[]', - 'softBounces' => '\Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[]', - 'complaints' => '\Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[]', - 'unsubscriptions' => '\Brevo\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptions', - 'opened' => '\Brevo\Client\Model\GetExtendedContactDetailsStatisticsOpened[]', - 'clicked' => '\Brevo\Client\Model\GetExtendedContactDetailsStatisticsClicked[]', + 'messagesSent' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[]', + 'hardBounces' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[]', + 'softBounces' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[]', + 'complaints' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[]', + 'unsubscriptions' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptions', + 'opened' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsOpened[]', + 'clicked' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsClicked[]', 'transacAttributes' => 'object[]', - 'delivered' => '\Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[]' + 'delivered' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[]' ]; /** @@ -199,9 +199,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -256,7 +256,7 @@ public function valid() /** * Gets messagesSent * - * @return \Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] */ public function getMessagesSent() { @@ -266,7 +266,7 @@ public function getMessagesSent() /** * Sets messagesSent * - * @param \Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $messagesSent Listing of the sent campaign for the contact + * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] $messagesSent Listing of the sent campaign for the contact * * @return $this */ @@ -280,7 +280,7 @@ public function setMessagesSent($messagesSent) /** * Gets hardBounces * - * @return \Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] */ public function getHardBounces() { @@ -290,7 +290,7 @@ public function getHardBounces() /** * Sets hardBounces * - * @param \Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $hardBounces Listing of the hardbounes generated by the contact + * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] $hardBounces Listing of the hardbounes generated by the contact * * @return $this */ @@ -304,7 +304,7 @@ public function setHardBounces($hardBounces) /** * Gets softBounces * - * @return \Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] */ public function getSoftBounces() { @@ -314,7 +314,7 @@ public function getSoftBounces() /** * Sets softBounces * - * @param \Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $softBounces Listing of the softbounes generated by the contact + * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] $softBounces Listing of the softbounes generated by the contact * * @return $this */ @@ -328,7 +328,7 @@ public function setSoftBounces($softBounces) /** * Gets complaints * - * @return \Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] */ public function getComplaints() { @@ -338,7 +338,7 @@ public function getComplaints() /** * Sets complaints * - * @param \Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $complaints Listing of the complaints generated by the contact + * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] $complaints Listing of the complaints generated by the contact * * @return $this */ @@ -352,7 +352,7 @@ public function setComplaints($complaints) /** * Gets unsubscriptions * - * @return \Brevo\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptions + * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptions */ public function getUnsubscriptions() { @@ -362,7 +362,7 @@ public function getUnsubscriptions() /** * Sets unsubscriptions * - * @param \Brevo\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptions $unsubscriptions unsubscriptions + * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptions $unsubscriptions unsubscriptions * * @return $this */ @@ -376,7 +376,7 @@ public function setUnsubscriptions($unsubscriptions) /** * Gets opened * - * @return \Brevo\Client\Model\GetExtendedContactDetailsStatisticsOpened[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsOpened[] */ public function getOpened() { @@ -386,7 +386,7 @@ public function getOpened() /** * Sets opened * - * @param \Brevo\Client\Model\GetExtendedContactDetailsStatisticsOpened[] $opened Listing of the openings generated by the contact + * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsOpened[] $opened Listing of the openings generated by the contact * * @return $this */ @@ -400,7 +400,7 @@ public function setOpened($opened) /** * Gets clicked * - * @return \Brevo\Client\Model\GetExtendedContactDetailsStatisticsClicked[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsClicked[] */ public function getClicked() { @@ -410,7 +410,7 @@ public function getClicked() /** * Sets clicked * - * @param \Brevo\Client\Model\GetExtendedContactDetailsStatisticsClicked[] $clicked Listing of the clicks generated by the contact + * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsClicked[] $clicked Listing of the clicks generated by the contact * * @return $this */ @@ -448,7 +448,7 @@ public function setTransacAttributes($transacAttributes) /** * Gets delivered * - * @return \Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] */ public function getDelivered() { @@ -458,7 +458,7 @@ public function getDelivered() /** * Sets delivered * - * @param \Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $delivered Listing of the delivered campaign for the contact + * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] $delivered Listing of the delivered campaign for the contact * * @return $this */ diff --git a/lib/Model/GetExtendedContactDetailsStatisticsClicked.php b/lib/Models/GetExtendedContactDetailsStatisticsClicked.php similarity index 96% rename from lib/Model/GetExtendedContactDetailsStatisticsClicked.php rename to lib/Models/GetExtendedContactDetailsStatisticsClicked.php index ad3fbe3..5984d9a 100644 --- a/lib/Model/GetExtendedContactDetailsStatisticsClicked.php +++ b/lib/Models/GetExtendedContactDetailsStatisticsClicked.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class GetExtendedContactDetailsStatisticsClicked implements ModelInterface, Arra */ protected static $swaggerTypes = [ 'campaignId' => 'int', - 'links' => '\Brevo\Client\Model\GetExtendedContactDetailsStatisticsLinks[]' + 'links' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsLinks[]' ]; /** @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -243,7 +243,7 @@ public function setCampaignId($campaignId) /** * Gets links * - * @return \Brevo\Client\Model\GetExtendedContactDetailsStatisticsLinks[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsLinks[] */ public function getLinks() { @@ -253,7 +253,7 @@ public function getLinks() /** * Sets links * - * @param \Brevo\Client\Model\GetExtendedContactDetailsStatisticsLinks[] $links Listing of the clicked links for the campaign + * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsLinks[] $links Listing of the clicked links for the campaign * * @return $this */ diff --git a/lib/Model/GetExtendedContactDetailsStatisticsDelivered.php b/lib/Models/GetExtendedContactDetailsStatisticsDelivered.php similarity index 99% rename from lib/Model/GetExtendedContactDetailsStatisticsDelivered.php rename to lib/Models/GetExtendedContactDetailsStatisticsDelivered.php index 42aeeec..217aab4 100644 --- a/lib/Model/GetExtendedContactDetailsStatisticsDelivered.php +++ b/lib/Models/GetExtendedContactDetailsStatisticsDelivered.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/GetExtendedContactDetailsStatisticsLinks.php b/lib/Models/GetExtendedContactDetailsStatisticsLinks.php similarity index 99% rename from lib/Model/GetExtendedContactDetailsStatisticsLinks.php rename to lib/Models/GetExtendedContactDetailsStatisticsLinks.php index 7365eb9..7aa2a6b 100644 --- a/lib/Model/GetExtendedContactDetailsStatisticsLinks.php +++ b/lib/Models/GetExtendedContactDetailsStatisticsLinks.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -173,9 +173,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetExtendedContactDetailsStatisticsMessagesSent.php b/lib/Models/GetExtendedContactDetailsStatisticsMessagesSent.php similarity index 99% rename from lib/Model/GetExtendedContactDetailsStatisticsMessagesSent.php rename to lib/Models/GetExtendedContactDetailsStatisticsMessagesSent.php index be2cdac..3ff5187 100644 --- a/lib/Model/GetExtendedContactDetailsStatisticsMessagesSent.php +++ b/lib/Models/GetExtendedContactDetailsStatisticsMessagesSent.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetExtendedContactDetailsStatisticsOpened.php b/lib/Models/GetExtendedContactDetailsStatisticsOpened.php similarity index 99% rename from lib/Model/GetExtendedContactDetailsStatisticsOpened.php rename to lib/Models/GetExtendedContactDetailsStatisticsOpened.php index 00599ef..f74fb92 100644 --- a/lib/Model/GetExtendedContactDetailsStatisticsOpened.php +++ b/lib/Models/GetExtendedContactDetailsStatisticsOpened.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -173,9 +173,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetExtendedContactDetailsStatisticsUnsubscriptions.php b/lib/Models/GetExtendedContactDetailsStatisticsUnsubscriptions.php similarity index 90% rename from lib/Model/GetExtendedContactDetailsStatisticsUnsubscriptions.php rename to lib/Models/GetExtendedContactDetailsStatisticsUnsubscriptions.php index 0105dec..faa096e 100644 --- a/lib/Model/GetExtendedContactDetailsStatisticsUnsubscriptions.php +++ b/lib/Models/GetExtendedContactDetailsStatisticsUnsubscriptions.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,8 +58,8 @@ class GetExtendedContactDetailsStatisticsUnsubscriptions implements ModelInterfa * @var string[] */ protected static $swaggerTypes = [ - 'userUnsubscription' => '\Brevo\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[]', - 'adminUnsubscription' => '\Brevo\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[]' + 'userUnsubscription' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[]', + 'adminUnsubscription' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[]' ]; /** @@ -220,7 +220,7 @@ public function valid() /** * Gets userUnsubscription * - * @return \Brevo\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[] */ public function getUserUnsubscription() { @@ -230,7 +230,7 @@ public function getUserUnsubscription() /** * Sets userUnsubscription * - * @param \Brevo\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[] $userUnsubscription Contact unsubscribe via unsubscription link in a campaign + * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[] $userUnsubscription Contact unsubscribe via unsubscription link in a campaign * * @return $this */ @@ -244,7 +244,7 @@ public function setUserUnsubscription($userUnsubscription) /** * Gets adminUnsubscription * - * @return \Brevo\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[] */ public function getAdminUnsubscription() { @@ -254,7 +254,7 @@ public function getAdminUnsubscription() /** * Sets adminUnsubscription * - * @param \Brevo\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[] $adminUnsubscription Contact has been unsubscribed from the administrator + * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[] $adminUnsubscription Contact has been unsubscribed from the administrator * * @return $this */ diff --git a/lib/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.php b/lib/Models/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.php similarity index 99% rename from lib/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.php rename to lib/Models/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.php index 99a7b85..32688a2 100644 --- a/lib/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.php +++ b/lib/Models/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.php b/lib/Models/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.php similarity index 99% rename from lib/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.php rename to lib/Models/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.php index 6a9aaf9..16f28c2 100644 --- a/lib/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.php +++ b/lib/Models/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -168,9 +168,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetExtendedList.php b/lib/Models/GetExtendedList.php similarity index 96% rename from lib/Model/GetExtendedList.php rename to lib/Models/GetExtendedList.php index 09f6804..2f5c253 100644 --- a/lib/Model/GetExtendedList.php +++ b/lib/Models/GetExtendedList.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \Brevo\Client\ObjectSerializer; /** @@ -38,7 +38,7 @@ * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ -class GetExtendedList extends GetList +class GetExtendedList extends GetList { const DISCRIMINATOR = null; @@ -57,7 +57,7 @@ class GetExtendedList extends GetList protected static $swaggerTypes = [ 'folderId' => 'int', 'createdAt' => 'string', - 'campaignStats' => '\Brevo\Client\Model\GetExtendedListCampaignStats[]', + 'campaignStats' => '\Brevo\Client\Models\GetExtendedListCampaignStats[]', 'dynamicList' => 'bool' ]; @@ -171,9 +171,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** @@ -273,7 +273,7 @@ public function setCreatedAt($createdAt) /** * Gets campaignStats * - * @return \Brevo\Client\Model\GetExtendedListCampaignStats[] + * @return \Brevo\Client\Models\GetExtendedListCampaignStats[] */ public function getCampaignStats() { @@ -283,7 +283,7 @@ public function getCampaignStats() /** * Sets campaignStats * - * @param \Brevo\Client\Model\GetExtendedListCampaignStats[] $campaignStats campaignStats + * @param \Brevo\Client\Models\GetExtendedListCampaignStats[] $campaignStats campaignStats * * @return $this */ diff --git a/lib/Model/GetExtendedListCampaignStats.php b/lib/Models/GetExtendedListCampaignStats.php similarity index 97% rename from lib/Model/GetExtendedListCampaignStats.php rename to lib/Models/GetExtendedListCampaignStats.php index 468b511..1e555f5 100644 --- a/lib/Model/GetExtendedListCampaignStats.php +++ b/lib/Models/GetExtendedListCampaignStats.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class GetExtendedListCampaignStats implements ModelInterface, ArrayAccess */ protected static $swaggerTypes = [ 'campaignId' => 'int', - 'stats' => '\Brevo\Client\Model\GetCampaignStats' + 'stats' => '\Brevo\Client\Models\GetCampaignStats' ]; /** @@ -243,7 +243,7 @@ public function setCampaignId($campaignId) /** * Gets stats * - * @return \Brevo\Client\Model\GetCampaignStats + * @return \Brevo\Client\Models\GetCampaignStats */ public function getStats() { @@ -253,7 +253,7 @@ public function getStats() /** * Sets stats * - * @param \Brevo\Client\Model\GetCampaignStats $stats stats + * @param \Brevo\Client\Models\GetCampaignStats $stats stats * * @return $this */ diff --git a/lib/Model/GetExternalFeedByUUID.php b/lib/Models/GetExternalFeedByUUID.php similarity index 98% rename from lib/Model/GetExternalFeedByUUID.php rename to lib/Models/GetExternalFeedByUUID.php index 685bda8..02cd256 100644 --- a/lib/Model/GetExternalFeedByUUID.php +++ b/lib/Models/GetExternalFeedByUUID.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -64,7 +64,7 @@ class GetExternalFeedByUUID implements ModelInterface, ArrayAccess 'username' => 'string', 'password' => 'string', 'token' => 'string', - 'headers' => '\Brevo\Client\Model\GetExternalFeedByUUIDHeaders[]', + 'headers' => '\Brevo\Client\Models\GetExternalFeedByUUIDHeaders[]', 'maxRetries' => 'int', 'cache' => 'bool', 'createdAt' => '\DateTime', @@ -510,7 +510,7 @@ public function setToken($token) /** * Gets headers * - * @return \Brevo\Client\Model\GetExternalFeedByUUIDHeaders[] + * @return \Brevo\Client\Models\GetExternalFeedByUUIDHeaders[] */ public function getHeaders() { @@ -520,7 +520,7 @@ public function getHeaders() /** * Sets headers * - * @param \Brevo\Client\Model\GetExternalFeedByUUIDHeaders[] $headers Custom headers for the feed + * @param \Brevo\Client\Models\GetExternalFeedByUUIDHeaders[] $headers Custom headers for the feed * * @return $this */ diff --git a/lib/Model/GetExternalFeedByUUIDHeaders.php b/lib/Models/GetExternalFeedByUUIDHeaders.php similarity index 99% rename from lib/Model/GetExternalFeedByUUIDHeaders.php rename to lib/Models/GetExternalFeedByUUIDHeaders.php index 29c89e1..afe7f62 100644 --- a/lib/Model/GetExternalFeedByUUIDHeaders.php +++ b/lib/Models/GetExternalFeedByUUIDHeaders.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetFolder.php b/lib/Models/GetFolder.php similarity index 99% rename from lib/Model/GetFolder.php rename to lib/Models/GetFolder.php index 24b2fd1..bfab91a 100644 --- a/lib/Model/GetFolder.php +++ b/lib/Models/GetFolder.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/GetFolderLists.php b/lib/Models/GetFolderLists.php similarity index 99% rename from lib/Model/GetFolderLists.php rename to lib/Models/GetFolderLists.php index 60b3c25..01ad999 100644 --- a/lib/Model/GetFolderLists.php +++ b/lib/Models/GetFolderLists.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetFolders.php b/lib/Models/GetFolders.php similarity index 99% rename from lib/Model/GetFolders.php rename to lib/Models/GetFolders.php index 1935c41..d5eed21 100644 --- a/lib/Model/GetFolders.php +++ b/lib/Models/GetFolders.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/GetInboundEmailEvents.php b/lib/Models/GetInboundEmailEvents.php similarity index 96% rename from lib/Model/GetInboundEmailEvents.php rename to lib/Models/GetInboundEmailEvents.php index c95405b..14b7ce2 100644 --- a/lib/Model/GetInboundEmailEvents.php +++ b/lib/Models/GetInboundEmailEvents.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class GetInboundEmailEvents implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'events' => '\Brevo\Client\Model\GetInboundEmailEventsEvents[]' + 'events' => '\Brevo\Client\Models\GetInboundEmailEventsEvents[]' ]; /** @@ -207,7 +207,7 @@ public function valid() /** * Gets events * - * @return \Brevo\Client\Model\GetInboundEmailEventsEvents[] + * @return \Brevo\Client\Models\GetInboundEmailEventsEvents[] */ public function getEvents() { @@ -217,7 +217,7 @@ public function getEvents() /** * Sets events * - * @param \Brevo\Client\Model\GetInboundEmailEventsEvents[] $events events + * @param \Brevo\Client\Models\GetInboundEmailEventsEvents[] $events events * * @return $this */ diff --git a/lib/Model/GetInboundEmailEventsByUuid.php b/lib/Models/GetInboundEmailEventsByUuid.php similarity index 94% rename from lib/Model/GetInboundEmailEventsByUuid.php rename to lib/Models/GetInboundEmailEventsByUuid.php index 5607781..6ba54ff 100644 --- a/lib/Model/GetInboundEmailEventsByUuid.php +++ b/lib/Models/GetInboundEmailEventsByUuid.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -63,8 +63,8 @@ class GetInboundEmailEventsByUuid implements ModelInterface, ArrayAccess 'sender' => 'string', 'messageId' => 'string', 'subject' => 'string', - 'attachments' => '\Brevo\Client\Model\GetInboundEmailEventsByUuidAttachments[]', - 'logs' => '\Brevo\Client\Model\GetInboundEmailEventsByUuidLogs[]' + 'attachments' => '\Brevo\Client\Models\GetInboundEmailEventsByUuidAttachments[]', + 'logs' => '\Brevo\Client\Models\GetInboundEmailEventsByUuidLogs[]' ]; /** @@ -193,9 +193,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -393,7 +393,7 @@ public function setSubject($subject) /** * Gets attachments * - * @return \Brevo\Client\Model\GetInboundEmailEventsByUuidAttachments[] + * @return \Brevo\Client\Models\GetInboundEmailEventsByUuidAttachments[] */ public function getAttachments() { @@ -403,7 +403,7 @@ public function getAttachments() /** * Sets attachments * - * @param \Brevo\Client\Model\GetInboundEmailEventsByUuidAttachments[] $attachments List of attachments of the email. This will be present only after the processing is done. + * @param \Brevo\Client\Models\GetInboundEmailEventsByUuidAttachments[] $attachments List of attachments of the email. This will be present only after the processing is done. * * @return $this */ @@ -417,7 +417,7 @@ public function setAttachments($attachments) /** * Gets logs * - * @return \Brevo\Client\Model\GetInboundEmailEventsByUuidLogs[] + * @return \Brevo\Client\Models\GetInboundEmailEventsByUuidLogs[] */ public function getLogs() { @@ -427,7 +427,7 @@ public function getLogs() /** * Sets logs * - * @param \Brevo\Client\Model\GetInboundEmailEventsByUuidLogs[] $logs List of events/logs that describe the lifecycle of the email on SIB platform + * @param \Brevo\Client\Models\GetInboundEmailEventsByUuidLogs[] $logs List of events/logs that describe the lifecycle of the email on SIB platform * * @return $this */ diff --git a/lib/Model/GetInboundEmailEventsByUuidAttachments.php b/lib/Models/GetInboundEmailEventsByUuidAttachments.php similarity index 99% rename from lib/Model/GetInboundEmailEventsByUuidAttachments.php rename to lib/Models/GetInboundEmailEventsByUuidAttachments.php index ce25827..17e9fc8 100644 --- a/lib/Model/GetInboundEmailEventsByUuidAttachments.php +++ b/lib/Models/GetInboundEmailEventsByUuidAttachments.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -173,9 +173,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetInboundEmailEventsByUuidLogs.php b/lib/Models/GetInboundEmailEventsByUuidLogs.php similarity index 99% rename from lib/Model/GetInboundEmailEventsByUuidLogs.php rename to lib/Models/GetInboundEmailEventsByUuidLogs.php index 3addbe4..53657a6 100644 --- a/lib/Model/GetInboundEmailEventsByUuidLogs.php +++ b/lib/Models/GetInboundEmailEventsByUuidLogs.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/GetInboundEmailEventsEvents.php b/lib/Models/GetInboundEmailEventsEvents.php similarity index 99% rename from lib/Model/GetInboundEmailEventsEvents.php rename to lib/Models/GetInboundEmailEventsEvents.php index 966dc43..9009829 100644 --- a/lib/Model/GetInboundEmailEventsEvents.php +++ b/lib/Models/GetInboundEmailEventsEvents.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -173,9 +173,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetInvitedUsersList.php b/lib/Models/GetInvitedUsersList.php similarity index 96% rename from lib/Model/GetInvitedUsersList.php rename to lib/Models/GetInvitedUsersList.php index 15e8982..ec8ea3b 100644 --- a/lib/Model/GetInvitedUsersList.php +++ b/lib/Models/GetInvitedUsersList.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class GetInvitedUsersList implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'users' => '\Brevo\Client\Model\GetInvitedUsersListUsers[]' + 'users' => '\Brevo\Client\Models\GetInvitedUsersListUsers[]' ]; /** @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -207,7 +207,7 @@ public function valid() /** * Gets users * - * @return \Brevo\Client\Model\GetInvitedUsersListUsers[] + * @return \Brevo\Client\Models\GetInvitedUsersListUsers[] */ public function getUsers() { @@ -217,7 +217,7 @@ public function getUsers() /** * Sets users * - * @param \Brevo\Client\Model\GetInvitedUsersListUsers[] $users Get invited users list + * @param \Brevo\Client\Models\GetInvitedUsersListUsers[] $users Get invited users list * * @return $this */ diff --git a/lib/Model/GetInvitedUsersListFeatureAccess.php b/lib/Models/GetInvitedUsersListFeatureAccess.php similarity index 99% rename from lib/Model/GetInvitedUsersListFeatureAccess.php rename to lib/Models/GetInvitedUsersListFeatureAccess.php index 07ad614..b17c4b9 100644 --- a/lib/Model/GetInvitedUsersListFeatureAccess.php +++ b/lib/Models/GetInvitedUsersListFeatureAccess.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -169,9 +169,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetInvitedUsersListUsers.php b/lib/Models/GetInvitedUsersListUsers.php similarity index 97% rename from lib/Model/GetInvitedUsersListUsers.php rename to lib/Models/GetInvitedUsersListUsers.php index 4978dd4..ea39111 100644 --- a/lib/Model/GetInvitedUsersListUsers.php +++ b/lib/Models/GetInvitedUsersListUsers.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -60,7 +60,7 @@ class GetInvitedUsersListUsers implements ModelInterface, ArrayAccess 'email' => 'string', 'isOwner' => 'string', 'status' => 'string', - 'featureAccess' => '\Brevo\Client\Model\GetInvitedUsersListFeatureAccess' + 'featureAccess' => '\Brevo\Client\Models\GetInvitedUsersListFeatureAccess' ]; /** @@ -173,9 +173,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -309,7 +309,7 @@ public function setStatus($status) /** * Gets featureAccess * - * @return \Brevo\Client\Model\GetInvitedUsersListFeatureAccess + * @return \Brevo\Client\Models\GetInvitedUsersListFeatureAccess */ public function getFeatureAccess() { @@ -319,7 +319,7 @@ public function getFeatureAccess() /** * Sets featureAccess * - * @param \Brevo\Client\Model\GetInvitedUsersListFeatureAccess $featureAccess featureAccess + * @param \Brevo\Client\Models\GetInvitedUsersListFeatureAccess $featureAccess featureAccess * * @return $this */ diff --git a/lib/Model/GetIp.php b/lib/Models/GetIp.php similarity index 99% rename from lib/Model/GetIp.php rename to lib/Models/GetIp.php index 322d6fc..cc58291 100644 --- a/lib/Model/GetIp.php +++ b/lib/Models/GetIp.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -173,9 +173,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetIpFromSender.php b/lib/Models/GetIpFromSender.php similarity index 99% rename from lib/Model/GetIpFromSender.php rename to lib/Models/GetIpFromSender.php index 4802c9a..df0af00 100644 --- a/lib/Model/GetIpFromSender.php +++ b/lib/Models/GetIpFromSender.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/GetIps.php b/lib/Models/GetIps.php similarity index 96% rename from lib/Model/GetIps.php rename to lib/Models/GetIps.php index fbd6cd4..169e1b1 100644 --- a/lib/Model/GetIps.php +++ b/lib/Models/GetIps.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class GetIps implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'ips' => '\Brevo\Client\Model\GetIp[]' + 'ips' => '\Brevo\Client\Models\GetIp[]' ]; /** @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -210,7 +210,7 @@ public function valid() /** * Gets ips * - * @return \Brevo\Client\Model\GetIp[] + * @return \Brevo\Client\Models\GetIp[] */ public function getIps() { @@ -220,7 +220,7 @@ public function getIps() /** * Sets ips * - * @param \Brevo\Client\Model\GetIp[] $ips Dedicated IP(s) available on your account + * @param \Brevo\Client\Models\GetIp[] $ips Dedicated IP(s) available on your account * * @return $this */ diff --git a/lib/Model/GetIpsFromSender.php b/lib/Models/GetIpsFromSender.php similarity index 96% rename from lib/Model/GetIpsFromSender.php rename to lib/Models/GetIpsFromSender.php index de5b679..7f02ace 100644 --- a/lib/Model/GetIpsFromSender.php +++ b/lib/Models/GetIpsFromSender.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class GetIpsFromSender implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'ips' => '\Brevo\Client\Model\GetIpFromSender[]' + 'ips' => '\Brevo\Client\Models\GetIpFromSender[]' ]; /** @@ -210,7 +210,7 @@ public function valid() /** * Gets ips * - * @return \Brevo\Client\Model\GetIpFromSender[] + * @return \Brevo\Client\Models\GetIpFromSender[] */ public function getIps() { @@ -220,7 +220,7 @@ public function getIps() /** * Sets ips * - * @param \Brevo\Client\Model\GetIpFromSender[] $ips Dedicated IP(s) linked to a sender + * @param \Brevo\Client\Models\GetIpFromSender[] $ips Dedicated IP(s) linked to a sender * * @return $this */ diff --git a/lib/Model/GetList.php b/lib/Models/GetList.php similarity index 99% rename from lib/Model/GetList.php rename to lib/Models/GetList.php index e01ef48..4480dbe 100644 --- a/lib/Model/GetList.php +++ b/lib/Models/GetList.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -178,9 +178,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetLists.php b/lib/Models/GetLists.php similarity index 99% rename from lib/Model/GetLists.php rename to lib/Models/GetLists.php index 57c93ee..0c803cc 100644 --- a/lib/Model/GetLists.php +++ b/lib/Models/GetLists.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetOrders.php b/lib/Models/GetOrders.php similarity index 99% rename from lib/Model/GetOrders.php rename to lib/Models/GetOrders.php index cca4fc1..f151445 100644 --- a/lib/Model/GetOrders.php +++ b/lib/Models/GetOrders.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/GetProcess.php b/lib/Models/GetProcess.php similarity index 99% rename from lib/Model/GetProcess.php rename to lib/Models/GetProcess.php index 1bdea77..b26f897 100644 --- a/lib/Model/GetProcess.php +++ b/lib/Models/GetProcess.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -176,9 +176,9 @@ public function getModelName() const STATUS_QUEUED = 'queued'; const STATUS_IN_PROCESS = 'in_process'; const STATUS_COMPLETED = 'completed'; - - + + /** * Gets allowable values of the enum * @@ -192,7 +192,7 @@ public function getStatusAllowableValues() self::STATUS_COMPLETED, ]; } - + /** * Associative array for storing property values diff --git a/lib/Model/GetProcesses.php b/lib/Models/GetProcesses.php similarity index 96% rename from lib/Model/GetProcesses.php rename to lib/Models/GetProcesses.php index c4ca6d5..790d320 100644 --- a/lib/Model/GetProcesses.php +++ b/lib/Models/GetProcesses.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class GetProcesses implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'processes' => '\Brevo\Client\Model\GetProcess[]', + 'processes' => '\Brevo\Client\Models\GetProcess[]', 'count' => 'int' ]; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -213,7 +213,7 @@ public function valid() /** * Gets processes * - * @return \Brevo\Client\Model\GetProcess[] + * @return \Brevo\Client\Models\GetProcess[] */ public function getProcesses() { @@ -223,7 +223,7 @@ public function getProcesses() /** * Sets processes * - * @param \Brevo\Client\Model\GetProcess[] $processes List of processes available on your account + * @param \Brevo\Client\Models\GetProcess[] $processes List of processes available on your account * * @return $this */ diff --git a/lib/Model/GetProductDetails.php b/lib/Models/GetProductDetails.php similarity index 99% rename from lib/Model/GetProductDetails.php rename to lib/Models/GetProductDetails.php index 328ac97..a607070 100644 --- a/lib/Model/GetProductDetails.php +++ b/lib/Models/GetProductDetails.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -228,9 +228,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetProducts.php b/lib/Models/GetProducts.php similarity index 99% rename from lib/Model/GetProducts.php rename to lib/Models/GetProducts.php index 3e432a0..9d1dc33 100644 --- a/lib/Model/GetProducts.php +++ b/lib/Models/GetProducts.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetReports.php b/lib/Models/GetReports.php similarity index 96% rename from lib/Model/GetReports.php rename to lib/Models/GetReports.php index 07d8bf7..ff05088 100644 --- a/lib/Model/GetReports.php +++ b/lib/Models/GetReports.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class GetReports implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'reports' => '\Brevo\Client\Model\GetReportsReports[]' + 'reports' => '\Brevo\Client\Models\GetReportsReports[]' ]; /** @@ -207,7 +207,7 @@ public function valid() /** * Gets reports * - * @return \Brevo\Client\Model\GetReportsReports[] + * @return \Brevo\Client\Models\GetReportsReports[] */ public function getReports() { @@ -217,7 +217,7 @@ public function getReports() /** * Sets reports * - * @param \Brevo\Client\Model\GetReportsReports[] $reports reports + * @param \Brevo\Client\Models\GetReportsReports[] $reports reports * * @return $this */ diff --git a/lib/Model/GetReportsReports.php b/lib/Models/GetReportsReports.php similarity index 99% rename from lib/Model/GetReportsReports.php rename to lib/Models/GetReportsReports.php index 49106d6..81add3c 100644 --- a/lib/Model/GetReportsReports.php +++ b/lib/Models/GetReportsReports.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -218,9 +218,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetScheduledEmailByBatchId.php b/lib/Models/GetScheduledEmailByBatchId.php similarity index 96% rename from lib/Model/GetScheduledEmailByBatchId.php rename to lib/Models/GetScheduledEmailByBatchId.php index fc0ad3e..539a57e 100644 --- a/lib/Model/GetScheduledEmailByBatchId.php +++ b/lib/Models/GetScheduledEmailByBatchId.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class GetScheduledEmailByBatchId implements ModelInterface, ArrayAccess */ protected static $swaggerTypes = [ 'count' => 'int', - 'batches' => '\Brevo\Client\Model\GetScheduledEmailByBatchIdBatches[]' + 'batches' => '\Brevo\Client\Models\GetScheduledEmailByBatchIdBatches[]' ]; /** @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -237,7 +237,7 @@ public function setCount($count) /** * Gets batches * - * @return \Brevo\Client\Model\GetScheduledEmailByBatchIdBatches[] + * @return \Brevo\Client\Models\GetScheduledEmailByBatchIdBatches[] */ public function getBatches() { @@ -247,7 +247,7 @@ public function getBatches() /** * Sets batches * - * @param \Brevo\Client\Model\GetScheduledEmailByBatchIdBatches[] $batches batches + * @param \Brevo\Client\Models\GetScheduledEmailByBatchIdBatches[] $batches batches * * @return $this */ diff --git a/lib/Model/GetScheduledEmailByBatchIdBatches.php b/lib/Models/GetScheduledEmailByBatchIdBatches.php similarity index 99% rename from lib/Model/GetScheduledEmailByBatchIdBatches.php rename to lib/Models/GetScheduledEmailByBatchIdBatches.php index 59bc501..30919b4 100644 --- a/lib/Model/GetScheduledEmailByBatchIdBatches.php +++ b/lib/Models/GetScheduledEmailByBatchIdBatches.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -172,9 +172,9 @@ public function getModelName() const STATUS_QUEUED = 'queued'; const STATUS_PROCESSED = 'processed'; const STATUS_ERROR = 'error'; - - + + /** * Gets allowable values of the enum * @@ -189,7 +189,7 @@ public function getStatusAllowableValues() self::STATUS_ERROR, ]; } - + /** * Associative array for storing property values diff --git a/lib/Model/GetScheduledEmailByMessageId.php b/lib/Models/GetScheduledEmailByMessageId.php similarity index 99% rename from lib/Model/GetScheduledEmailByMessageId.php rename to lib/Models/GetScheduledEmailByMessageId.php index 7064a41..abdebe3 100644 --- a/lib/Model/GetScheduledEmailByMessageId.php +++ b/lib/Models/GetScheduledEmailByMessageId.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/GetSegments.php b/lib/Models/GetSegments.php similarity index 97% rename from lib/Model/GetSegments.php rename to lib/Models/GetSegments.php index 96c0b51..8b262dc 100644 --- a/lib/Model/GetSegments.php +++ b/lib/Models/GetSegments.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class GetSegments implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'segments' => '\Brevo\Client\Model\GetSegmentsSegments', + 'segments' => '\Brevo\Client\Models\GetSegmentsSegments', 'count' => 'int' ]; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -213,7 +213,7 @@ public function valid() /** * Gets segments * - * @return \Brevo\Client\Model\GetSegmentsSegments + * @return \Brevo\Client\Models\GetSegmentsSegments */ public function getSegments() { @@ -223,7 +223,7 @@ public function getSegments() /** * Sets segments * - * @param \Brevo\Client\Model\GetSegmentsSegments $segments segments + * @param \Brevo\Client\Models\GetSegmentsSegments $segments segments * * @return $this */ diff --git a/lib/Model/GetSegmentsSegments.php b/lib/Models/GetSegmentsSegments.php similarity index 99% rename from lib/Model/GetSegmentsSegments.php rename to lib/Models/GetSegmentsSegments.php index fed8fc0..62f591a 100644 --- a/lib/Model/GetSegmentsSegments.php +++ b/lib/Models/GetSegmentsSegments.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -173,9 +173,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetSendersList.php b/lib/Models/GetSendersList.php similarity index 96% rename from lib/Model/GetSendersList.php rename to lib/Models/GetSendersList.php index 4651dc8..6c3fe54 100644 --- a/lib/Model/GetSendersList.php +++ b/lib/Models/GetSendersList.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class GetSendersList implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'senders' => '\Brevo\Client\Model\GetSendersListSenders[]' + 'senders' => '\Brevo\Client\Models\GetSendersListSenders[]' ]; /** @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -207,7 +207,7 @@ public function valid() /** * Gets senders * - * @return \Brevo\Client\Model\GetSendersListSenders[] + * @return \Brevo\Client\Models\GetSendersListSenders[] */ public function getSenders() { @@ -217,7 +217,7 @@ public function getSenders() /** * Sets senders * - * @param \Brevo\Client\Model\GetSendersListSenders[] $senders List of the senders available in your account + * @param \Brevo\Client\Models\GetSendersListSenders[] $senders List of the senders available in your account * * @return $this */ diff --git a/lib/Model/GetSendersListIps.php b/lib/Models/GetSendersListIps.php similarity index 99% rename from lib/Model/GetSendersListIps.php rename to lib/Models/GetSendersListIps.php index 8bfc1fb..1ab3c0a 100644 --- a/lib/Model/GetSendersListIps.php +++ b/lib/Models/GetSendersListIps.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -168,9 +168,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetSendersListSenders.php b/lib/Models/GetSendersListSenders.php similarity index 97% rename from lib/Model/GetSendersListSenders.php rename to lib/Models/GetSendersListSenders.php index b621f86..bdf1ddf 100644 --- a/lib/Model/GetSendersListSenders.php +++ b/lib/Models/GetSendersListSenders.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -61,7 +61,7 @@ class GetSendersListSenders implements ModelInterface, ArrayAccess 'name' => 'string', 'email' => 'string', 'active' => 'bool', - 'ips' => '\Brevo\Client\Model\GetSendersListIps[]' + 'ips' => '\Brevo\Client\Models\GetSendersListIps[]' ]; /** @@ -339,7 +339,7 @@ public function setActive($active) /** * Gets ips * - * @return \Brevo\Client\Model\GetSendersListIps[] + * @return \Brevo\Client\Models\GetSendersListIps[] */ public function getIps() { @@ -349,7 +349,7 @@ public function getIps() /** * Sets ips * - * @param \Brevo\Client\Model\GetSendersListIps[] $ips List of dedicated IP(s) available in the account. This data is displayed only for dedicated IPs + * @param \Brevo\Client\Models\GetSendersListIps[] $ips List of dedicated IP(s) available in the account. This data is displayed only for dedicated IPs * * @return $this */ diff --git a/lib/Model/GetSharedTemplateUrl.php b/lib/Models/GetSharedTemplateUrl.php similarity index 99% rename from lib/Model/GetSharedTemplateUrl.php rename to lib/Models/GetSharedTemplateUrl.php index 62e3eb3..ae0a083 100644 --- a/lib/Model/GetSharedTemplateUrl.php +++ b/lib/Models/GetSharedTemplateUrl.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetSmsCampaign.php b/lib/Models/GetSmsCampaign.php similarity index 99% rename from lib/Model/GetSmsCampaign.php rename to lib/Models/GetSmsCampaign.php index 4499ec6..248cb80 100644 --- a/lib/Model/GetSmsCampaign.php +++ b/lib/Models/GetSmsCampaign.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/GetSmsCampaignOverview.php b/lib/Models/GetSmsCampaignOverview.php similarity index 99% rename from lib/Model/GetSmsCampaignOverview.php rename to lib/Models/GetSmsCampaignOverview.php index 739cde9..27aea91 100644 --- a/lib/Model/GetSmsCampaignOverview.php +++ b/lib/Models/GetSmsCampaignOverview.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -199,9 +199,9 @@ public function getModelName() const STATUS_QUEUED = 'queued'; const STATUS_SUSPENDED = 'suspended'; const STATUS_IN_PROCESS = 'inProcess'; - - + + /** * Gets allowable values of the enum * @@ -218,7 +218,7 @@ public function getStatusAllowableValues() self::STATUS_IN_PROCESS, ]; } - + /** * Associative array for storing property values diff --git a/lib/Model/GetSmsCampaignRecipients.php b/lib/Models/GetSmsCampaignRecipients.php similarity index 98% rename from lib/Model/GetSmsCampaignRecipients.php rename to lib/Models/GetSmsCampaignRecipients.php index fecf2a6..306d51f 100644 --- a/lib/Model/GetSmsCampaignRecipients.php +++ b/lib/Models/GetSmsCampaignRecipients.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class GetSmsCampaignRecipients implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - + ]; /** @@ -66,7 +66,7 @@ class GetSmsCampaignRecipients implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerFormats = [ - + ]; /** @@ -96,7 +96,7 @@ public static function swaggerFormats() * @var string[] */ protected static $attributeMap = [ - + ]; /** @@ -105,7 +105,7 @@ public static function swaggerFormats() * @var string[] */ protected static $setters = [ - + ]; /** @@ -114,7 +114,7 @@ public static function swaggerFormats() * @var string[] */ protected static $getters = [ - + ]; /** @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetSmsCampaignStats.php b/lib/Models/GetSmsCampaignStats.php similarity index 99% rename from lib/Model/GetSmsCampaignStats.php rename to lib/Models/GetSmsCampaignStats.php index d6b528d..c1ac408 100644 --- a/lib/Model/GetSmsCampaignStats.php +++ b/lib/Models/GetSmsCampaignStats.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/GetSmsCampaigns.php b/lib/Models/GetSmsCampaigns.php similarity index 99% rename from lib/Model/GetSmsCampaigns.php rename to lib/Models/GetSmsCampaigns.php index 09a711d..555778f 100644 --- a/lib/Model/GetSmsCampaigns.php +++ b/lib/Models/GetSmsCampaigns.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetSmsEventReport.php b/lib/Models/GetSmsEventReport.php similarity index 96% rename from lib/Model/GetSmsEventReport.php rename to lib/Models/GetSmsEventReport.php index 89833ec..e14dac0 100644 --- a/lib/Model/GetSmsEventReport.php +++ b/lib/Models/GetSmsEventReport.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class GetSmsEventReport implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'events' => '\Brevo\Client\Model\GetSmsEventReportEvents[]' + 'events' => '\Brevo\Client\Models\GetSmsEventReportEvents[]' ]; /** @@ -207,7 +207,7 @@ public function valid() /** * Gets events * - * @return \Brevo\Client\Model\GetSmsEventReportEvents[] + * @return \Brevo\Client\Models\GetSmsEventReportEvents[] */ public function getEvents() { @@ -217,7 +217,7 @@ public function getEvents() /** * Sets events * - * @param \Brevo\Client\Model\GetSmsEventReportEvents[] $events events + * @param \Brevo\Client\Models\GetSmsEventReportEvents[] $events events * * @return $this */ diff --git a/lib/Model/GetSmsEventReportEvents.php b/lib/Models/GetSmsEventReportEvents.php similarity index 99% rename from lib/Model/GetSmsEventReportEvents.php rename to lib/Models/GetSmsEventReportEvents.php index d10ee82..c7e6ac3 100644 --- a/lib/Model/GetSmsEventReportEvents.php +++ b/lib/Models/GetSmsEventReportEvents.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -198,9 +198,9 @@ public function getModelName() const EVENT_REPLIES = 'replies'; const EVENT_BLOCKED = 'blocked'; const EVENT_REJECTED = 'rejected'; - - + + /** * Gets allowable values of the enum * @@ -221,7 +221,7 @@ public function getEventAllowableValues() self::EVENT_REJECTED, ]; } - + /** * Associative array for storing property values diff --git a/lib/Model/GetSmtpTemplateOverview.php b/lib/Models/GetSmtpTemplateOverview.php similarity index 98% rename from lib/Model/GetSmtpTemplateOverview.php rename to lib/Models/GetSmtpTemplateOverview.php index 4a42b55..a9d728e 100644 --- a/lib/Model/GetSmtpTemplateOverview.php +++ b/lib/Models/GetSmtpTemplateOverview.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -62,7 +62,7 @@ class GetSmtpTemplateOverview implements ModelInterface, ArrayAccess 'subject' => 'string', 'isActive' => 'bool', 'testSent' => 'bool', - 'sender' => '\Brevo\Client\Model\GetSmtpTemplateOverviewSender', + 'sender' => '\Brevo\Client\Models\GetSmtpTemplateOverviewSender', 'replyTo' => 'string', 'toField' => 'string', 'tag' => 'string', @@ -435,7 +435,7 @@ public function setTestSent($testSent) /** * Gets sender * - * @return \Brevo\Client\Model\GetSmtpTemplateOverviewSender + * @return \Brevo\Client\Models\GetSmtpTemplateOverviewSender */ public function getSender() { @@ -445,7 +445,7 @@ public function getSender() /** * Sets sender * - * @param \Brevo\Client\Model\GetSmtpTemplateOverviewSender $sender sender + * @param \Brevo\Client\Models\GetSmtpTemplateOverviewSender $sender sender * * @return $this */ diff --git a/lib/Model/GetSmtpTemplateOverviewSender.php b/lib/Models/GetSmtpTemplateOverviewSender.php similarity index 99% rename from lib/Model/GetSmtpTemplateOverviewSender.php rename to lib/Models/GetSmtpTemplateOverviewSender.php index c753826..350a104 100644 --- a/lib/Model/GetSmtpTemplateOverviewSender.php +++ b/lib/Models/GetSmtpTemplateOverviewSender.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -168,9 +168,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetSmtpTemplates.php b/lib/Models/GetSmtpTemplates.php similarity index 96% rename from lib/Model/GetSmtpTemplates.php rename to lib/Models/GetSmtpTemplates.php index fd481a4..bc94a2c 100644 --- a/lib/Model/GetSmtpTemplates.php +++ b/lib/Models/GetSmtpTemplates.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class GetSmtpTemplates implements ModelInterface, ArrayAccess */ protected static $swaggerTypes = [ 'count' => 'int', - 'templates' => '\Brevo\Client\Model\GetSmtpTemplateOverview[]' + 'templates' => '\Brevo\Client\Models\GetSmtpTemplateOverview[]' ]; /** @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -237,7 +237,7 @@ public function setCount($count) /** * Gets templates * - * @return \Brevo\Client\Model\GetSmtpTemplateOverview[] + * @return \Brevo\Client\Models\GetSmtpTemplateOverview[] */ public function getTemplates() { @@ -247,7 +247,7 @@ public function getTemplates() /** * Sets templates * - * @param \Brevo\Client\Model\GetSmtpTemplateOverview[] $templates templates + * @param \Brevo\Client\Models\GetSmtpTemplateOverview[] $templates templates * * @return $this */ diff --git a/lib/Model/GetSsoToken.php b/lib/Models/GetSsoToken.php similarity index 99% rename from lib/Model/GetSsoToken.php rename to lib/Models/GetSsoToken.php index 37dd969..4edbc99 100644 --- a/lib/Model/GetSsoToken.php +++ b/lib/Models/GetSsoToken.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/GetStatsByBrowser.php b/lib/Models/GetStatsByBrowser.php similarity index 98% rename from lib/Model/GetStatsByBrowser.php rename to lib/Models/GetStatsByBrowser.php index f999856..e860229 100644 --- a/lib/Model/GetStatsByBrowser.php +++ b/lib/Models/GetStatsByBrowser.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class GetStatsByBrowser implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - + ]; /** @@ -66,7 +66,7 @@ class GetStatsByBrowser implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerFormats = [ - + ]; /** @@ -96,7 +96,7 @@ public static function swaggerFormats() * @var string[] */ protected static $attributeMap = [ - + ]; /** @@ -105,7 +105,7 @@ public static function swaggerFormats() * @var string[] */ protected static $setters = [ - + ]; /** @@ -114,7 +114,7 @@ public static function swaggerFormats() * @var string[] */ protected static $getters = [ - + ]; /** @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetStatsByDevice.php b/lib/Models/GetStatsByDevice.php similarity index 88% rename from lib/Model/GetStatsByDevice.php rename to lib/Models/GetStatsByDevice.php index ab3d9b5..ab755d3 100644 --- a/lib/Model/GetStatsByDevice.php +++ b/lib/Models/GetStatsByDevice.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,10 +57,10 @@ class GetStatsByDevice implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'desktop' => 'map[string,\Brevo\Client\Model\GetDeviceBrowserStats]', - 'mobile' => 'map[string,\Brevo\Client\Model\GetDeviceBrowserStats]', - 'tablet' => 'map[string,\Brevo\Client\Model\GetDeviceBrowserStats]', - 'unknown' => 'map[string,\Brevo\Client\Model\GetDeviceBrowserStats]' + 'desktop' => 'map[string,\Brevo\Client\Models\GetDeviceBrowserStats]', + 'mobile' => 'map[string,\Brevo\Client\Models\GetDeviceBrowserStats]', + 'tablet' => 'map[string,\Brevo\Client\Models\GetDeviceBrowserStats]', + 'unknown' => 'map[string,\Brevo\Client\Models\GetDeviceBrowserStats]' ]; /** @@ -225,7 +225,7 @@ public function valid() /** * Gets desktop * - * @return map[string,\Brevo\Client\Model\GetDeviceBrowserStats] + * @return map[string,\Brevo\Client\Models\GetDeviceBrowserStats] */ public function getDesktop() { @@ -235,7 +235,7 @@ public function getDesktop() /** * Sets desktop * - * @param map[string,\Brevo\Client\Model\GetDeviceBrowserStats] $desktop Statistics of the campaign on the basis of desktop devices + * @param map[string,\Brevo\Client\Models\GetDeviceBrowserStats] $desktop Statistics of the campaign on the basis of desktop devices * * @return $this */ @@ -249,7 +249,7 @@ public function setDesktop($desktop) /** * Gets mobile * - * @return map[string,\Brevo\Client\Model\GetDeviceBrowserStats] + * @return map[string,\Brevo\Client\Models\GetDeviceBrowserStats] */ public function getMobile() { @@ -259,7 +259,7 @@ public function getMobile() /** * Sets mobile * - * @param map[string,\Brevo\Client\Model\GetDeviceBrowserStats] $mobile Statistics of the campaign on the basis of mobile devices + * @param map[string,\Brevo\Client\Models\GetDeviceBrowserStats] $mobile Statistics of the campaign on the basis of mobile devices * * @return $this */ @@ -273,7 +273,7 @@ public function setMobile($mobile) /** * Gets tablet * - * @return map[string,\Brevo\Client\Model\GetDeviceBrowserStats] + * @return map[string,\Brevo\Client\Models\GetDeviceBrowserStats] */ public function getTablet() { @@ -283,7 +283,7 @@ public function getTablet() /** * Sets tablet * - * @param map[string,\Brevo\Client\Model\GetDeviceBrowserStats] $tablet Statistics of the campaign on the basis of tablet devices + * @param map[string,\Brevo\Client\Models\GetDeviceBrowserStats] $tablet Statistics of the campaign on the basis of tablet devices * * @return $this */ @@ -297,7 +297,7 @@ public function setTablet($tablet) /** * Gets unknown * - * @return map[string,\Brevo\Client\Model\GetDeviceBrowserStats] + * @return map[string,\Brevo\Client\Models\GetDeviceBrowserStats] */ public function getUnknown() { @@ -307,7 +307,7 @@ public function getUnknown() /** * Sets unknown * - * @param map[string,\Brevo\Client\Model\GetDeviceBrowserStats] $unknown Statistics of the campaign on the basis of unknown devices + * @param map[string,\Brevo\Client\Models\GetDeviceBrowserStats] $unknown Statistics of the campaign on the basis of unknown devices * * @return $this */ diff --git a/lib/Model/GetStatsByDomain.php b/lib/Models/GetStatsByDomain.php similarity index 99% rename from lib/Model/GetStatsByDomain.php rename to lib/Models/GetStatsByDomain.php index fca7c01..df8cf2a 100644 --- a/lib/Model/GetStatsByDomain.php +++ b/lib/Models/GetStatsByDomain.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/GetTransacAggregatedSmsReport.php b/lib/Models/GetTransacAggregatedSmsReport.php similarity index 99% rename from lib/Model/GetTransacAggregatedSmsReport.php rename to lib/Models/GetTransacAggregatedSmsReport.php index 97c0af0..c80d5d6 100644 --- a/lib/Model/GetTransacAggregatedSmsReport.php +++ b/lib/Models/GetTransacAggregatedSmsReport.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -203,9 +203,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetTransacBlockedContacts.php b/lib/Models/GetTransacBlockedContacts.php similarity index 96% rename from lib/Model/GetTransacBlockedContacts.php rename to lib/Models/GetTransacBlockedContacts.php index 0481377..8bde94e 100644 --- a/lib/Model/GetTransacBlockedContacts.php +++ b/lib/Models/GetTransacBlockedContacts.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class GetTransacBlockedContacts implements ModelInterface, ArrayAccess */ protected static $swaggerTypes = [ 'count' => 'int', - 'contacts' => '\Brevo\Client\Model\GetTransacBlockedContactsContacts[]' + 'contacts' => '\Brevo\Client\Models\GetTransacBlockedContactsContacts[]' ]; /** @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -237,7 +237,7 @@ public function setCount($count) /** * Gets contacts * - * @return \Brevo\Client\Model\GetTransacBlockedContactsContacts[] + * @return \Brevo\Client\Models\GetTransacBlockedContactsContacts[] */ public function getContacts() { @@ -247,7 +247,7 @@ public function getContacts() /** * Sets contacts * - * @param \Brevo\Client\Model\GetTransacBlockedContactsContacts[] $contacts contacts + * @param \Brevo\Client\Models\GetTransacBlockedContactsContacts[] $contacts contacts * * @return $this */ diff --git a/lib/Model/GetTransacBlockedContactsContacts.php b/lib/Models/GetTransacBlockedContactsContacts.php similarity index 97% rename from lib/Model/GetTransacBlockedContactsContacts.php rename to lib/Models/GetTransacBlockedContactsContacts.php index d66e52a..d8312b4 100644 --- a/lib/Model/GetTransacBlockedContactsContacts.php +++ b/lib/Models/GetTransacBlockedContactsContacts.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -59,7 +59,7 @@ class GetTransacBlockedContactsContacts implements ModelInterface, ArrayAccess protected static $swaggerTypes = [ 'email' => 'string', 'senderEmail' => 'string', - 'reason' => '\Brevo\Client\Model\GetTransacBlockedContactsReason', + 'reason' => '\Brevo\Client\Models\GetTransacBlockedContactsReason', 'blockedAt' => 'string' ]; @@ -285,7 +285,7 @@ public function setSenderEmail($senderEmail) /** * Gets reason * - * @return \Brevo\Client\Model\GetTransacBlockedContactsReason + * @return \Brevo\Client\Models\GetTransacBlockedContactsReason */ public function getReason() { @@ -295,7 +295,7 @@ public function getReason() /** * Sets reason * - * @param \Brevo\Client\Model\GetTransacBlockedContactsReason $reason reason + * @param \Brevo\Client\Models\GetTransacBlockedContactsReason $reason reason * * @return $this */ diff --git a/lib/Model/GetTransacBlockedContactsReason.php b/lib/Models/GetTransacBlockedContactsReason.php similarity index 99% rename from lib/Model/GetTransacBlockedContactsReason.php rename to lib/Models/GetTransacBlockedContactsReason.php index ea51329..d1137b7 100644 --- a/lib/Model/GetTransacBlockedContactsReason.php +++ b/lib/Models/GetTransacBlockedContactsReason.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -170,9 +170,9 @@ public function getModelName() const CODE_UNSUBSCRIBED_VIA_API = 'unsubscribedViaApi'; const CODE_HARD_BOUNCE = 'hardBounce'; const CODE_CONTACT_FLAGGED_AS_SPAM = 'contactFlaggedAsSpam'; - - + + /** * Gets allowable values of the enum * @@ -189,7 +189,7 @@ public function getCodeAllowableValues() self::CODE_CONTACT_FLAGGED_AS_SPAM, ]; } - + /** * Associative array for storing property values diff --git a/lib/Model/GetTransacEmailContent.php b/lib/Models/GetTransacEmailContent.php similarity index 97% rename from lib/Model/GetTransacEmailContent.php rename to lib/Models/GetTransacEmailContent.php index 75e2357..9d06c4a 100644 --- a/lib/Model/GetTransacEmailContent.php +++ b/lib/Models/GetTransacEmailContent.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -61,7 +61,7 @@ class GetTransacEmailContent implements ModelInterface, ArrayAccess 'subject' => 'string', 'templateId' => 'int', 'date' => 'string', - 'events' => '\Brevo\Client\Model\GetTransacEmailContentEvents[]', + 'events' => '\Brevo\Client\Models\GetTransacEmailContentEvents[]', 'body' => 'string', 'attachmentCount' => 'int' ]; @@ -188,9 +188,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -357,7 +357,7 @@ public function setDate($date) /** * Gets events * - * @return \Brevo\Client\Model\GetTransacEmailContentEvents[] + * @return \Brevo\Client\Models\GetTransacEmailContentEvents[] */ public function getEvents() { @@ -367,7 +367,7 @@ public function getEvents() /** * Sets events * - * @param \Brevo\Client\Model\GetTransacEmailContentEvents[] $events Series of events which occurred on the transactional email + * @param \Brevo\Client\Models\GetTransacEmailContentEvents[] $events Series of events which occurred on the transactional email * * @return $this */ diff --git a/lib/Model/GetTransacEmailContentEvents.php b/lib/Models/GetTransacEmailContentEvents.php similarity index 99% rename from lib/Model/GetTransacEmailContentEvents.php rename to lib/Models/GetTransacEmailContentEvents.php index 138080e..21d96d9 100644 --- a/lib/Model/GetTransacEmailContentEvents.php +++ b/lib/Models/GetTransacEmailContentEvents.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetTransacEmailsList.php b/lib/Models/GetTransacEmailsList.php similarity index 95% rename from lib/Model/GetTransacEmailsList.php rename to lib/Models/GetTransacEmailsList.php index ff752dd..218e746 100644 --- a/lib/Model/GetTransacEmailsList.php +++ b/lib/Models/GetTransacEmailsList.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class GetTransacEmailsList implements ModelInterface, ArrayAccess */ protected static $swaggerTypes = [ 'count' => 'int', - 'transactionalEmails' => '\Brevo\Client\Model\GetTransacEmailsListTransactionalEmails[]' + 'transactionalEmails' => '\Brevo\Client\Models\GetTransacEmailsListTransactionalEmails[]' ]; /** @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -237,7 +237,7 @@ public function setCount($count) /** * Gets transactionalEmails * - * @return \Brevo\Client\Model\GetTransacEmailsListTransactionalEmails[] + * @return \Brevo\Client\Models\GetTransacEmailsListTransactionalEmails[] */ public function getTransactionalEmails() { @@ -247,7 +247,7 @@ public function getTransactionalEmails() /** * Sets transactionalEmails * - * @param \Brevo\Client\Model\GetTransacEmailsListTransactionalEmails[] $transactionalEmails transactionalEmails + * @param \Brevo\Client\Models\GetTransacEmailsListTransactionalEmails[] $transactionalEmails transactionalEmails * * @return $this */ diff --git a/lib/Model/GetTransacEmailsListTransactionalEmails.php b/lib/Models/GetTransacEmailsListTransactionalEmails.php similarity index 99% rename from lib/Model/GetTransacEmailsListTransactionalEmails.php rename to lib/Models/GetTransacEmailsListTransactionalEmails.php index 23df786..bbb5141 100644 --- a/lib/Model/GetTransacEmailsListTransactionalEmails.php +++ b/lib/Models/GetTransacEmailsListTransactionalEmails.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/GetTransacSmsReport.php b/lib/Models/GetTransacSmsReport.php similarity index 96% rename from lib/Model/GetTransacSmsReport.php rename to lib/Models/GetTransacSmsReport.php index 9363b55..6d04640 100644 --- a/lib/Model/GetTransacSmsReport.php +++ b/lib/Models/GetTransacSmsReport.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class GetTransacSmsReport implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'reports' => '\Brevo\Client\Model\GetTransacSmsReportReports[]' + 'reports' => '\Brevo\Client\Models\GetTransacSmsReportReports[]' ]; /** @@ -207,7 +207,7 @@ public function valid() /** * Gets reports * - * @return \Brevo\Client\Model\GetTransacSmsReportReports[] + * @return \Brevo\Client\Models\GetTransacSmsReportReports[] */ public function getReports() { @@ -217,7 +217,7 @@ public function getReports() /** * Sets reports * - * @param \Brevo\Client\Model\GetTransacSmsReportReports[] $reports reports + * @param \Brevo\Client\Models\GetTransacSmsReportReports[] $reports reports * * @return $this */ diff --git a/lib/Model/GetTransacSmsReportReports.php b/lib/Models/GetTransacSmsReportReports.php similarity index 99% rename from lib/Model/GetTransacSmsReportReports.php rename to lib/Models/GetTransacSmsReportReports.php index 87d2bdd..081204b 100644 --- a/lib/Model/GetTransacSmsReportReports.php +++ b/lib/Models/GetTransacSmsReportReports.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -203,9 +203,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetUserPermission.php b/lib/Models/GetUserPermission.php similarity index 96% rename from lib/Model/GetUserPermission.php rename to lib/Models/GetUserPermission.php index 5ce95fd..039c183 100644 --- a/lib/Model/GetUserPermission.php +++ b/lib/Models/GetUserPermission.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -60,7 +60,7 @@ class GetUserPermission implements ModelInterface, ArrayAccess protected static $swaggerTypes = [ 'email' => 'string', 'status' => 'string', - 'privileges' => '\Brevo\Client\Model\GetUserPermissionPrivileges[]' + 'privileges' => '\Brevo\Client\Models\GetUserPermissionPrivileges[]' ]; /** @@ -169,9 +169,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -277,7 +277,7 @@ public function setStatus($status) /** * Gets privileges * - * @return \Brevo\Client\Model\GetUserPermissionPrivileges[] + * @return \Brevo\Client\Models\GetUserPermissionPrivileges[] */ public function getPrivileges() { @@ -287,7 +287,7 @@ public function getPrivileges() /** * Sets privileges * - * @param \Brevo\Client\Model\GetUserPermissionPrivileges[] $privileges Granular feature permissions given to the user. + * @param \Brevo\Client\Models\GetUserPermissionPrivileges[] $privileges Granular feature permissions given to the user. * * @return $this */ diff --git a/lib/Model/GetUserPermissionPrivileges.php b/lib/Models/GetUserPermissionPrivileges.php similarity index 99% rename from lib/Model/GetUserPermissionPrivileges.php rename to lib/Models/GetUserPermissionPrivileges.php index 03a5d17..107f82d 100644 --- a/lib/Model/GetUserPermissionPrivileges.php +++ b/lib/Models/GetUserPermissionPrivileges.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetWATemplates.php b/lib/Models/GetWATemplates.php similarity index 96% rename from lib/Model/GetWATemplates.php rename to lib/Models/GetWATemplates.php index 9d4eebd..f9a81ff 100644 --- a/lib/Model/GetWATemplates.php +++ b/lib/Models/GetWATemplates.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class GetWATemplates implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'templates' => '\Brevo\Client\Model\GetWATemplatesTemplates[]', + 'templates' => '\Brevo\Client\Models\GetWATemplatesTemplates[]', 'count' => 'int' ]; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -219,7 +219,7 @@ public function valid() /** * Gets templates * - * @return \Brevo\Client\Model\GetWATemplatesTemplates[] + * @return \Brevo\Client\Models\GetWATemplatesTemplates[] */ public function getTemplates() { @@ -229,7 +229,7 @@ public function getTemplates() /** * Sets templates * - * @param \Brevo\Client\Model\GetWATemplatesTemplates[] $templates templates + * @param \Brevo\Client\Models\GetWATemplatesTemplates[] $templates templates * * @return $this */ diff --git a/lib/Model/GetWATemplatesTemplates.php b/lib/Models/GetWATemplatesTemplates.php similarity index 99% rename from lib/Model/GetWATemplatesTemplates.php rename to lib/Models/GetWATemplatesTemplates.php index f1aef50..fe683c8 100644 --- a/lib/Model/GetWATemplatesTemplates.php +++ b/lib/Models/GetWATemplatesTemplates.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/GetWebhook.php b/lib/Models/GetWebhook.php similarity index 97% rename from lib/Model/GetWebhook.php rename to lib/Models/GetWebhook.php index 0e4871d..e962291 100644 --- a/lib/Model/GetWebhook.php +++ b/lib/Models/GetWebhook.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -65,8 +65,8 @@ class GetWebhook implements ModelInterface, ArrayAccess 'createdAt' => 'string', 'modifiedAt' => 'string', 'batched' => 'bool', - 'auth' => '\Brevo\Client\Model\GetWebhookAuth', - 'headers' => '\Brevo\Client\Model\GetWebhookHeaders[]' + 'auth' => '\Brevo\Client\Models\GetWebhookAuth', + 'headers' => '\Brevo\Client\Models\GetWebhookHeaders[]' ]; /** @@ -205,9 +205,9 @@ public function getModelName() const TYPE_MARKETING = 'marketing'; const TYPE_TRANSACTIONAL = 'transactional'; - - + + /** * Gets allowable values of the enum * @@ -220,7 +220,7 @@ public function getTypeAllowableValues() self::TYPE_TRANSACTIONAL, ]; } - + /** * Associative array for storing property values @@ -506,7 +506,7 @@ public function setBatched($batched) /** * Gets auth * - * @return \Brevo\Client\Model\GetWebhookAuth + * @return \Brevo\Client\Models\GetWebhookAuth */ public function getAuth() { @@ -516,7 +516,7 @@ public function getAuth() /** * Sets auth * - * @param \Brevo\Client\Model\GetWebhookAuth $auth auth + * @param \Brevo\Client\Models\GetWebhookAuth $auth auth * * @return $this */ @@ -530,7 +530,7 @@ public function setAuth($auth) /** * Gets headers * - * @return \Brevo\Client\Model\GetWebhookHeaders[] + * @return \Brevo\Client\Models\GetWebhookHeaders[] */ public function getHeaders() { @@ -540,7 +540,7 @@ public function getHeaders() /** * Sets headers * - * @param \Brevo\Client\Model\GetWebhookHeaders[] $headers Custom headers to be send with webhooks + * @param \Brevo\Client\Models\GetWebhookHeaders[] $headers Custom headers to be send with webhooks * * @return $this */ diff --git a/lib/Model/GetWebhookAuth.php b/lib/Models/GetWebhookAuth.php similarity index 99% rename from lib/Model/GetWebhookAuth.php rename to lib/Models/GetWebhookAuth.php index 234333d..f4b3db1 100644 --- a/lib/Model/GetWebhookAuth.php +++ b/lib/Models/GetWebhookAuth.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -164,9 +164,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetWebhookHeaders.php b/lib/Models/GetWebhookHeaders.php similarity index 99% rename from lib/Model/GetWebhookHeaders.php rename to lib/Models/GetWebhookHeaders.php index aa1f6f0..c4bf9ba 100644 --- a/lib/Model/GetWebhookHeaders.php +++ b/lib/Models/GetWebhookHeaders.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetWebhooks.php b/lib/Models/GetWebhooks.php similarity index 99% rename from lib/Model/GetWebhooks.php rename to lib/Models/GetWebhooks.php index 6737fe2..c964b21 100644 --- a/lib/Model/GetWebhooks.php +++ b/lib/Models/GetWebhooks.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/GetWhatsAppConfig.php b/lib/Models/GetWhatsAppConfig.php similarity index 99% rename from lib/Model/GetWhatsAppConfig.php rename to lib/Models/GetWhatsAppConfig.php index 37b1719..50d1b03 100644 --- a/lib/Model/GetWhatsAppConfig.php +++ b/lib/Models/GetWhatsAppConfig.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -189,9 +189,9 @@ public function getModelName() const PHONE_NUMBER_NAME_STATUS_APPROVED = 'APPROVED'; const PHONE_NUMBER_NAME_STATUS_PENDING = 'PENDING'; const PHONE_NUMBER_NAME_STATUS_REJECTED = 'REJECTED'; - - + + /** * Gets allowable values of the enum * @@ -205,7 +205,7 @@ public function getPhoneNumberQualityAllowableValues() self::PHONE_NUMBER_QUALITY_RED, ]; } - + /** * Gets allowable values of the enum * @@ -219,7 +219,7 @@ public function getPhoneNumberNameStatusAllowableValues() self::PHONE_NUMBER_NAME_STATUS_REJECTED, ]; } - + /** * Associative array for storing property values diff --git a/lib/Model/GetWhatsappCampaignOverview.php b/lib/Models/GetWhatsappCampaignOverview.php similarity index 97% rename from lib/Model/GetWhatsappCampaignOverview.php rename to lib/Models/GetWhatsappCampaignOverview.php index 6d534b4..4315b60 100644 --- a/lib/Model/GetWhatsappCampaignOverview.php +++ b/lib/Models/GetWhatsappCampaignOverview.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -62,8 +62,8 @@ class GetWhatsappCampaignOverview implements ModelInterface, ArrayAccess 'campaignStatus' => 'string', 'scheduledAt' => 'string', 'senderNumber' => 'string', - 'stats' => '\Brevo\Client\Model\WhatsappCampStats', - 'template' => '\Brevo\Client\Model\WhatsappCampTemplate', + 'stats' => '\Brevo\Client\Models\WhatsappCampStats', + 'template' => '\Brevo\Client\Models\WhatsappCampTemplate', 'createdAt' => 'string', 'modifiedAt' => 'string' ]; @@ -206,9 +206,9 @@ public function getModelName() const CAMPAIGN_STATUS_SUSPENDED = 'suspended'; const CAMPAIGN_STATUS_REJECTED = 'rejected'; const CAMPAIGN_STATUS_SENT = 'sent'; - - + + /** * Gets allowable values of the enum * @@ -227,7 +227,7 @@ public function getCampaignStatusAllowableValues() self::CAMPAIGN_STATUS_SENT, ]; } - + /** * Associative array for storing property values @@ -440,7 +440,7 @@ public function setSenderNumber($senderNumber) /** * Gets stats * - * @return \Brevo\Client\Model\WhatsappCampStats + * @return \Brevo\Client\Models\WhatsappCampStats */ public function getStats() { @@ -450,7 +450,7 @@ public function getStats() /** * Sets stats * - * @param \Brevo\Client\Model\WhatsappCampStats $stats stats + * @param \Brevo\Client\Models\WhatsappCampStats $stats stats * * @return $this */ @@ -464,7 +464,7 @@ public function setStats($stats) /** * Gets template * - * @return \Brevo\Client\Model\WhatsappCampTemplate + * @return \Brevo\Client\Models\WhatsappCampTemplate */ public function getTemplate() { @@ -474,7 +474,7 @@ public function getTemplate() /** * Sets template * - * @param \Brevo\Client\Model\WhatsappCampTemplate $template template + * @param \Brevo\Client\Models\WhatsappCampTemplate $template template * * @return $this */ diff --git a/lib/Model/GetWhatsappCampaigns.php b/lib/Models/GetWhatsappCampaigns.php similarity index 96% rename from lib/Model/GetWhatsappCampaigns.php rename to lib/Models/GetWhatsappCampaigns.php index 2534986..92f53e7 100644 --- a/lib/Model/GetWhatsappCampaigns.php +++ b/lib/Models/GetWhatsappCampaigns.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class GetWhatsappCampaigns implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'campaigns' => '\Brevo\Client\Model\GetWhatsappCampaignsCampaigns[]', + 'campaigns' => '\Brevo\Client\Models\GetWhatsappCampaignsCampaigns[]', 'count' => 'int' ]; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -213,7 +213,7 @@ public function valid() /** * Gets campaigns * - * @return \Brevo\Client\Model\GetWhatsappCampaignsCampaigns[] + * @return \Brevo\Client\Models\GetWhatsappCampaignsCampaigns[] */ public function getCampaigns() { @@ -223,7 +223,7 @@ public function getCampaigns() /** * Sets campaigns * - * @param \Brevo\Client\Model\GetWhatsappCampaignsCampaigns[] $campaigns campaigns + * @param \Brevo\Client\Models\GetWhatsappCampaignsCampaigns[] $campaigns campaigns * * @return $this */ diff --git a/lib/Model/GetWhatsappCampaignsCampaigns.php b/lib/Models/GetWhatsappCampaignsCampaigns.php similarity index 98% rename from lib/Model/GetWhatsappCampaignsCampaigns.php rename to lib/Models/GetWhatsappCampaignsCampaigns.php index 32d2ceb..ab44aea 100644 --- a/lib/Model/GetWhatsappCampaignsCampaigns.php +++ b/lib/Models/GetWhatsappCampaignsCampaigns.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -65,7 +65,7 @@ class GetWhatsappCampaignsCampaigns implements ModelInterface, ArrayAccess 'errorReason' => 'string', 'invalidatedContacts' => 'int', 'readPercentage' => 'float', - 'stats' => '\Brevo\Client\Model\WhatsappCampStats', + 'stats' => '\Brevo\Client\Models\WhatsappCampStats', 'createdAt' => 'string', 'modifiedAt' => 'string' ]; @@ -524,7 +524,7 @@ public function setReadPercentage($readPercentage) /** * Gets stats * - * @return \Brevo\Client\Model\WhatsappCampStats + * @return \Brevo\Client\Models\WhatsappCampStats */ public function getStats() { @@ -534,7 +534,7 @@ public function getStats() /** * Sets stats * - * @param \Brevo\Client\Model\WhatsappCampStats $stats stats + * @param \Brevo\Client\Models\WhatsappCampStats $stats stats * * @return $this */ diff --git a/lib/Model/GetWhatsappEventReport.php b/lib/Models/GetWhatsappEventReport.php similarity index 96% rename from lib/Model/GetWhatsappEventReport.php rename to lib/Models/GetWhatsappEventReport.php index 1ebd730..3724ecd 100644 --- a/lib/Model/GetWhatsappEventReport.php +++ b/lib/Models/GetWhatsappEventReport.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class GetWhatsappEventReport implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'events' => '\Brevo\Client\Model\GetWhatsappEventReportEvents[]' + 'events' => '\Brevo\Client\Models\GetWhatsappEventReportEvents[]' ]; /** @@ -207,7 +207,7 @@ public function valid() /** * Gets events * - * @return \Brevo\Client\Model\GetWhatsappEventReportEvents[] + * @return \Brevo\Client\Models\GetWhatsappEventReportEvents[] */ public function getEvents() { @@ -217,7 +217,7 @@ public function getEvents() /** * Sets events * - * @param \Brevo\Client\Model\GetWhatsappEventReportEvents[] $events events + * @param \Brevo\Client\Models\GetWhatsappEventReportEvents[] $events events * * @return $this */ diff --git a/lib/Model/GetWhatsappEventReportEvents.php b/lib/Models/GetWhatsappEventReportEvents.php similarity index 99% rename from lib/Model/GetWhatsappEventReportEvents.php rename to lib/Models/GetWhatsappEventReportEvents.php index 8a45339..eeca293 100644 --- a/lib/Model/GetWhatsappEventReportEvents.php +++ b/lib/Models/GetWhatsappEventReportEvents.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -200,9 +200,9 @@ public function getModelName() const EVENT_UNSUBSCRIBE = 'unsubscribe'; const EVENT_REPLY = 'reply'; const EVENT_SOFT_BOUNCE = 'soft-bounce'; - - + + /** * Gets allowable values of the enum * @@ -220,7 +220,7 @@ public function getEventAllowableValues() self::EVENT_SOFT_BOUNCE, ]; } - + /** * Associative array for storing property values diff --git a/lib/Model/InlineResponse200.php b/lib/Models/InlineResponse200.php similarity index 99% rename from lib/Model/InlineResponse200.php rename to lib/Models/InlineResponse200.php index 29347f6..0df5afd 100644 --- a/lib/Model/InlineResponse200.php +++ b/lib/Models/InlineResponse200.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/InlineResponse2001.php b/lib/Models/InlineResponse2001.php similarity index 99% rename from lib/Model/InlineResponse2001.php rename to lib/Models/InlineResponse2001.php index 4ffa18c..ad99f5f 100644 --- a/lib/Model/InlineResponse2001.php +++ b/lib/Models/InlineResponse2001.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -159,9 +159,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/InlineResponse2002.php b/lib/Models/InlineResponse2002.php similarity index 99% rename from lib/Model/InlineResponse2002.php rename to lib/Models/InlineResponse2002.php index 52f600e..897ef78 100644 --- a/lib/Model/InlineResponse2002.php +++ b/lib/Models/InlineResponse2002.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/InlineResponse201.php b/lib/Models/InlineResponse201.php similarity index 99% rename from lib/Model/InlineResponse201.php rename to lib/Models/InlineResponse201.php index 0c085bb..9618a07 100644 --- a/lib/Model/InlineResponse201.php +++ b/lib/Models/InlineResponse201.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/InlineResponse2011.php b/lib/Models/InlineResponse2011.php similarity index 99% rename from lib/Model/InlineResponse2011.php rename to lib/Models/InlineResponse2011.php index 78d2ddc..dbe5594 100644 --- a/lib/Model/InlineResponse2011.php +++ b/lib/Models/InlineResponse2011.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -159,9 +159,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/InlineResponse2012.php b/lib/Models/InlineResponse2012.php similarity index 99% rename from lib/Model/InlineResponse2012.php rename to lib/Models/InlineResponse2012.php index 8cc8472..80ce895 100644 --- a/lib/Model/InlineResponse2012.php +++ b/lib/Models/InlineResponse2012.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -159,9 +159,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/InlineResponse2013.php b/lib/Models/InlineResponse2013.php similarity index 99% rename from lib/Model/InlineResponse2013.php rename to lib/Models/InlineResponse2013.php index 4ee7657..86d6bed 100644 --- a/lib/Model/InlineResponse2013.php +++ b/lib/Models/InlineResponse2013.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/InlineResponse2014.php b/lib/Models/InlineResponse2014.php similarity index 99% rename from lib/Model/InlineResponse2014.php rename to lib/Models/InlineResponse2014.php index d1cecdb..7410025 100644 --- a/lib/Model/InlineResponse2014.php +++ b/lib/Models/InlineResponse2014.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/InlineResponse2015.php b/lib/Models/InlineResponse2015.php similarity index 99% rename from lib/Model/InlineResponse2015.php rename to lib/Models/InlineResponse2015.php index 65f1c00..36ee774 100644 --- a/lib/Model/InlineResponse2015.php +++ b/lib/Models/InlineResponse2015.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/InviteAdminUser.php b/lib/Models/InviteAdminUser.php similarity index 97% rename from lib/Model/InviteAdminUser.php rename to lib/Models/InviteAdminUser.php index 75dbb6b..0f1564a 100644 --- a/lib/Model/InviteAdminUser.php +++ b/lib/Models/InviteAdminUser.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -60,7 +60,7 @@ class InviteAdminUser implements ModelInterface, ArrayAccess 'email' => 'string', 'allFeaturesAccess' => 'bool', 'groupIds' => 'string[]', - 'privileges' => '\Brevo\Client\Model\InviteAdminUserPrivileges[]' + 'privileges' => '\Brevo\Client\Models\InviteAdminUserPrivileges[]' ]; /** @@ -306,7 +306,7 @@ public function setGroupIds($groupIds) /** * Gets privileges * - * @return \Brevo\Client\Model\InviteAdminUserPrivileges[] + * @return \Brevo\Client\Models\InviteAdminUserPrivileges[] */ public function getPrivileges() { @@ -316,7 +316,7 @@ public function getPrivileges() /** * Sets privileges * - * @param \Brevo\Client\Model\InviteAdminUserPrivileges[] $privileges privileges + * @param \Brevo\Client\Models\InviteAdminUserPrivileges[] $privileges privileges * * @return $this */ diff --git a/lib/Model/InviteAdminUserPrivileges.php b/lib/Models/InviteAdminUserPrivileges.php similarity index 99% rename from lib/Model/InviteAdminUserPrivileges.php rename to lib/Models/InviteAdminUserPrivileges.php index 32b2f8c..e677bc3 100644 --- a/lib/Model/InviteAdminUserPrivileges.php +++ b/lib/Models/InviteAdminUserPrivileges.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -170,9 +170,9 @@ public function getModelName() const FEATURE_APP_MANAGEMENT = 'app_management'; const PERMISSIONS_ALL = 'all'; const PERMISSIONS_NONE = 'none'; - - + + /** * Gets allowable values of the enum * @@ -187,7 +187,7 @@ public function getFeatureAllowableValues() self::FEATURE_APP_MANAGEMENT, ]; } - + /** * Gets allowable values of the enum * @@ -200,7 +200,7 @@ public function getPermissionsAllowableValues() self::PERMISSIONS_NONE, ]; } - + /** * Associative array for storing property values diff --git a/lib/Model/Inviteuser.php b/lib/Models/Inviteuser.php similarity index 97% rename from lib/Model/Inviteuser.php rename to lib/Models/Inviteuser.php index 88a888a..5f1ffdc 100644 --- a/lib/Model/Inviteuser.php +++ b/lib/Models/Inviteuser.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -59,7 +59,7 @@ class Inviteuser implements ModelInterface, ArrayAccess protected static $swaggerTypes = [ 'email' => 'string', 'allFeaturesAccess' => 'bool', - 'privileges' => '\Brevo\Client\Model\InviteuserPrivileges[]' + 'privileges' => '\Brevo\Client\Models\InviteuserPrivileges[]' ]; /** @@ -168,9 +168,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -276,7 +276,7 @@ public function setAllFeaturesAccess($allFeaturesAccess) /** * Gets privileges * - * @return \Brevo\Client\Model\InviteuserPrivileges[] + * @return \Brevo\Client\Models\InviteuserPrivileges[] */ public function getPrivileges() { @@ -286,7 +286,7 @@ public function getPrivileges() /** * Sets privileges * - * @param \Brevo\Client\Model\InviteuserPrivileges[] $privileges privileges + * @param \Brevo\Client\Models\InviteuserPrivileges[] $privileges privileges * * @return $this */ diff --git a/lib/Model/InviteuserPrivileges.php b/lib/Models/InviteuserPrivileges.php similarity index 99% rename from lib/Model/InviteuserPrivileges.php rename to lib/Models/InviteuserPrivileges.php index 5832ae9..d1d61ba 100644 --- a/lib/Model/InviteuserPrivileges.php +++ b/lib/Models/InviteuserPrivileges.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -206,9 +206,9 @@ public function getModelName() const PERMISSIONS_API_KEYS = 'api_keys'; const PERMISSIONS_AUTHORIZED_IPS = 'authorized_ips'; const PERMISSIONS_NONE = 'none'; - - + + /** * Gets allowable values of the enum * @@ -234,7 +234,7 @@ public function getFeatureAllowableValues() self::FEATURE_PUSH_NOTIFICATIONS, ]; } - + /** * Gets allowable values of the enum * @@ -272,7 +272,7 @@ public function getPermissionsAllowableValues() self::PERMISSIONS_NONE, ]; } - + /** * Associative array for storing property values diff --git a/lib/Model/ManageIp.php b/lib/Models/ManageIp.php similarity index 99% rename from lib/Model/ManageIp.php rename to lib/Models/ManageIp.php index d3c973c..40aaed2 100644 --- a/lib/Model/ManageIp.php +++ b/lib/Models/ManageIp.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/MasterDetailsResponse.php b/lib/Models/MasterDetailsResponse.php similarity index 95% rename from lib/Model/MasterDetailsResponse.php rename to lib/Models/MasterDetailsResponse.php index 3b98206..d02bb9f 100644 --- a/lib/Model/MasterDetailsResponse.php +++ b/lib/Models/MasterDetailsResponse.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -62,8 +62,8 @@ class MasterDetailsResponse implements ModelInterface, ArrayAccess 'id' => 'int', 'currencyCode' => 'string', 'timezone' => 'string', - 'billingInfo' => '\Brevo\Client\Model\MasterDetailsResponseBillingInfo', - 'planInfo' => '\Brevo\Client\Model\MasterDetailsResponsePlanInfo' + 'billingInfo' => '\Brevo\Client\Models\MasterDetailsResponseBillingInfo', + 'planInfo' => '\Brevo\Client\Models\MasterDetailsResponsePlanInfo' ]; /** @@ -188,9 +188,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -363,7 +363,7 @@ public function setTimezone($timezone) /** * Gets billingInfo * - * @return \Brevo\Client\Model\MasterDetailsResponseBillingInfo + * @return \Brevo\Client\Models\MasterDetailsResponseBillingInfo */ public function getBillingInfo() { @@ -373,7 +373,7 @@ public function getBillingInfo() /** * Sets billingInfo * - * @param \Brevo\Client\Model\MasterDetailsResponseBillingInfo $billingInfo billingInfo + * @param \Brevo\Client\Models\MasterDetailsResponseBillingInfo $billingInfo billingInfo * * @return $this */ @@ -387,7 +387,7 @@ public function setBillingInfo($billingInfo) /** * Gets planInfo * - * @return \Brevo\Client\Model\MasterDetailsResponsePlanInfo + * @return \Brevo\Client\Models\MasterDetailsResponsePlanInfo */ public function getPlanInfo() { @@ -397,7 +397,7 @@ public function getPlanInfo() /** * Sets planInfo * - * @param \Brevo\Client\Model\MasterDetailsResponsePlanInfo $planInfo planInfo + * @param \Brevo\Client\Models\MasterDetailsResponsePlanInfo $planInfo planInfo * * @return $this */ diff --git a/lib/Model/MasterDetailsResponseBillingInfo.php b/lib/Models/MasterDetailsResponseBillingInfo.php similarity index 94% rename from lib/Model/MasterDetailsResponseBillingInfo.php rename to lib/Models/MasterDetailsResponseBillingInfo.php index 519790b..80ff499 100644 --- a/lib/Model/MasterDetailsResponseBillingInfo.php +++ b/lib/Models/MasterDetailsResponseBillingInfo.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -60,8 +60,8 @@ class MasterDetailsResponseBillingInfo implements ModelInterface, ArrayAccess protected static $swaggerTypes = [ 'email' => 'string', 'companyName' => 'string', - 'name' => '\Brevo\Client\Model\MasterDetailsResponseBillingInfoName', - 'address' => '\Brevo\Client\Model\MasterDetailsResponseBillingInfoAddress' + 'name' => '\Brevo\Client\Models\MasterDetailsResponseBillingInfoName', + 'address' => '\Brevo\Client\Models\MasterDetailsResponseBillingInfoAddress' ]; /** @@ -274,7 +274,7 @@ public function setCompanyName($companyName) /** * Gets name * - * @return \Brevo\Client\Model\MasterDetailsResponseBillingInfoName + * @return \Brevo\Client\Models\MasterDetailsResponseBillingInfoName */ public function getName() { @@ -284,7 +284,7 @@ public function getName() /** * Sets name * - * @param \Brevo\Client\Model\MasterDetailsResponseBillingInfoName $name name + * @param \Brevo\Client\Models\MasterDetailsResponseBillingInfoName $name name * * @return $this */ @@ -298,7 +298,7 @@ public function setName($name) /** * Gets address * - * @return \Brevo\Client\Model\MasterDetailsResponseBillingInfoAddress + * @return \Brevo\Client\Models\MasterDetailsResponseBillingInfoAddress */ public function getAddress() { @@ -308,7 +308,7 @@ public function getAddress() /** * Sets address * - * @param \Brevo\Client\Model\MasterDetailsResponseBillingInfoAddress $address address + * @param \Brevo\Client\Models\MasterDetailsResponseBillingInfoAddress $address address * * @return $this */ diff --git a/lib/Model/MasterDetailsResponseBillingInfoAddress.php b/lib/Models/MasterDetailsResponseBillingInfoAddress.php similarity index 99% rename from lib/Model/MasterDetailsResponseBillingInfoAddress.php rename to lib/Models/MasterDetailsResponseBillingInfoAddress.php index 0fd11cf..90fbfb8 100644 --- a/lib/Model/MasterDetailsResponseBillingInfoAddress.php +++ b/lib/Models/MasterDetailsResponseBillingInfoAddress.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -179,9 +179,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/MasterDetailsResponseBillingInfoName.php b/lib/Models/MasterDetailsResponseBillingInfoName.php similarity index 99% rename from lib/Model/MasterDetailsResponseBillingInfoName.php rename to lib/Models/MasterDetailsResponseBillingInfoName.php index 9eaebdf..9181de4 100644 --- a/lib/Model/MasterDetailsResponseBillingInfoName.php +++ b/lib/Models/MasterDetailsResponseBillingInfoName.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -164,9 +164,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/MasterDetailsResponsePlanInfo.php b/lib/Models/MasterDetailsResponsePlanInfo.php similarity index 97% rename from lib/Model/MasterDetailsResponsePlanInfo.php rename to lib/Models/MasterDetailsResponsePlanInfo.php index 366576b..ec4c5a1 100644 --- a/lib/Model/MasterDetailsResponsePlanInfo.php +++ b/lib/Models/MasterDetailsResponsePlanInfo.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -63,7 +63,7 @@ class MasterDetailsResponsePlanInfo implements ModelInterface, ArrayAccess 'price' => 'float', 'planPeriod' => 'string', 'subAccounts' => 'int', - 'features' => '\Brevo\Client\Model\MasterDetailsResponsePlanInfoFeatures[]' + 'features' => '\Brevo\Client\Models\MasterDetailsResponsePlanInfoFeatures[]' ]; /** @@ -390,7 +390,7 @@ public function setSubAccounts($subAccounts) /** * Gets features * - * @return \Brevo\Client\Model\MasterDetailsResponsePlanInfoFeatures[] + * @return \Brevo\Client\Models\MasterDetailsResponsePlanInfoFeatures[] */ public function getFeatures() { @@ -400,7 +400,7 @@ public function getFeatures() /** * Sets features * - * @param \Brevo\Client\Model\MasterDetailsResponsePlanInfoFeatures[] $features List of provided features in the plan + * @param \Brevo\Client\Models\MasterDetailsResponsePlanInfoFeatures[] $features List of provided features in the plan * * @return $this */ diff --git a/lib/Model/MasterDetailsResponsePlanInfoFeatures.php b/lib/Models/MasterDetailsResponsePlanInfoFeatures.php similarity index 99% rename from lib/Model/MasterDetailsResponsePlanInfoFeatures.php rename to lib/Models/MasterDetailsResponsePlanInfoFeatures.php index cb40811..d64a597 100644 --- a/lib/Model/MasterDetailsResponsePlanInfoFeatures.php +++ b/lib/Models/MasterDetailsResponsePlanInfoFeatures.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -188,9 +188,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/ModelInterface.php b/lib/Models/ModelInterface.php similarity index 96% rename from lib/Model/ModelInterface.php rename to lib/Models/ModelInterface.php index 4aebc13..2fd91a2 100644 --- a/lib/Model/ModelInterface.php +++ b/lib/Models/ModelInterface.php @@ -5,7 +5,7 @@ * PHP version 5 * * @category Class - * @package Brevo\Client\Model + * @package Brevo\Client\Models * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -27,12 +27,12 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; /** * Interface abstracting model access. * - * @package Brevo\Client\Model + * @package Brevo\Client\Models * @author Swagger Codegen team */ interface ModelInterface diff --git a/lib/Model/Note.php b/lib/Models/Note.php similarity index 99% rename from lib/Model/Note.php rename to lib/Models/Note.php index 8b73bc0..930bdcb 100644 --- a/lib/Model/Note.php +++ b/lib/Models/Note.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -189,9 +189,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/NoteData.php b/lib/Models/NoteData.php similarity index 99% rename from lib/Model/NoteData.php rename to lib/Models/NoteData.php index 0b23fb0..0f9e248 100644 --- a/lib/Model/NoteData.php +++ b/lib/Models/NoteData.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/NoteId.php b/lib/Models/NoteId.php similarity index 99% rename from lib/Model/NoteId.php rename to lib/Models/NoteId.php index 30d6181..70cb27f 100644 --- a/lib/Model/NoteId.php +++ b/lib/Models/NoteId.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -159,9 +159,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/NoteList.php b/lib/Models/NoteList.php similarity index 98% rename from lib/Model/NoteList.php rename to lib/Models/NoteList.php index 93e4cad..65f7a81 100644 --- a/lib/Model/NoteList.php +++ b/lib/Models/NoteList.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class NoteList implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - + ]; /** @@ -67,7 +67,7 @@ class NoteList implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerFormats = [ - + ]; /** @@ -97,7 +97,7 @@ public static function swaggerFormats() * @var string[] */ protected static $attributeMap = [ - + ]; /** @@ -106,7 +106,7 @@ public static function swaggerFormats() * @var string[] */ protected static $setters = [ - + ]; /** @@ -115,7 +115,7 @@ public static function swaggerFormats() * @var string[] */ protected static $getters = [ - + ]; /** @@ -159,9 +159,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/Order.php b/lib/Models/Order.php similarity index 97% rename from lib/Model/Order.php rename to lib/Models/Order.php index 688f576..a47cf06 100644 --- a/lib/Model/Order.php +++ b/lib/Models/Order.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -62,9 +62,9 @@ class Order implements ModelInterface, ArrayAccess 'updatedAt' => 'string', 'status' => 'string', 'amount' => 'float', - 'products' => '\Brevo\Client\Model\OrderProducts[]', + 'products' => '\Brevo\Client\Models\OrderProducts[]', 'email' => 'string', - 'billing' => '\Brevo\Client\Model\OrderBilling', + 'billing' => '\Brevo\Client\Models\OrderBilling', 'coupons' => 'string[]' ]; @@ -198,9 +198,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -393,7 +393,7 @@ public function setAmount($amount) /** * Gets products * - * @return \Brevo\Client\Model\OrderProducts[] + * @return \Brevo\Client\Models\OrderProducts[] */ public function getProducts() { @@ -403,7 +403,7 @@ public function getProducts() /** * Sets products * - * @param \Brevo\Client\Model\OrderProducts[] $products products + * @param \Brevo\Client\Models\OrderProducts[] $products products * * @return $this */ @@ -441,7 +441,7 @@ public function setEmail($email) /** * Gets billing * - * @return \Brevo\Client\Model\OrderBilling + * @return \Brevo\Client\Models\OrderBilling */ public function getBilling() { @@ -451,7 +451,7 @@ public function getBilling() /** * Sets billing * - * @param \Brevo\Client\Model\OrderBilling $billing billing + * @param \Brevo\Client\Models\OrderBilling $billing billing * * @return $this */ diff --git a/lib/Model/OrderBatch.php b/lib/Models/OrderBatch.php similarity index 97% rename from lib/Model/OrderBatch.php rename to lib/Models/OrderBatch.php index 98a9fed..117ee04 100644 --- a/lib/Model/OrderBatch.php +++ b/lib/Models/OrderBatch.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class OrderBatch implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'orders' => '\Brevo\Client\Model\Order[]', + 'orders' => '\Brevo\Client\Models\Order[]', 'notifyUrl' => 'string', 'historical' => 'bool' ]; @@ -222,7 +222,7 @@ public function valid() /** * Gets orders * - * @return \Brevo\Client\Model\Order[] + * @return \Brevo\Client\Models\Order[] */ public function getOrders() { @@ -232,7 +232,7 @@ public function getOrders() /** * Sets orders * - * @param \Brevo\Client\Model\Order[] $orders array of order objects + * @param \Brevo\Client\Models\Order[] $orders array of order objects * * @return $this */ diff --git a/lib/Model/OrderBilling.php b/lib/Models/OrderBilling.php similarity index 99% rename from lib/Model/OrderBilling.php rename to lib/Models/OrderBilling.php index ded706a..6171da5 100644 --- a/lib/Model/OrderBilling.php +++ b/lib/Models/OrderBilling.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -189,9 +189,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/OrderProducts.php b/lib/Models/OrderProducts.php similarity index 99% rename from lib/Model/OrderProducts.php rename to lib/Models/OrderProducts.php index 1a921c2..2e2127e 100644 --- a/lib/Model/OrderProducts.php +++ b/lib/Models/OrderProducts.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -174,9 +174,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/Otp.php b/lib/Models/Otp.php similarity index 99% rename from lib/Model/Otp.php rename to lib/Models/Otp.php index 89a28c0..29c9610 100644 --- a/lib/Model/Otp.php +++ b/lib/Models/Otp.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/Pipeline.php b/lib/Models/Pipeline.php similarity index 97% rename from lib/Model/Pipeline.php rename to lib/Models/Pipeline.php index 02ab62c..effb700 100644 --- a/lib/Model/Pipeline.php +++ b/lib/Models/Pipeline.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -60,7 +60,7 @@ class Pipeline implements ModelInterface, ArrayAccess protected static $swaggerTypes = [ 'pipeline' => 'string', 'pipelineName' => 'string', - 'stages' => '\Brevo\Client\Model\PipelineStage[]' + 'stages' => '\Brevo\Client\Models\PipelineStage[]' ]; /** @@ -169,9 +169,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -268,7 +268,7 @@ public function setPipelineName($pipelineName) /** * Gets stages * - * @return \Brevo\Client\Model\PipelineStage[] + * @return \Brevo\Client\Models\PipelineStage[] */ public function getStages() { @@ -278,7 +278,7 @@ public function getStages() /** * Sets stages * - * @param \Brevo\Client\Model\PipelineStage[] $stages List of stages + * @param \Brevo\Client\Models\PipelineStage[] $stages List of stages * * @return $this */ diff --git a/lib/Model/PipelineStage.php b/lib/Models/PipelineStage.php similarity index 99% rename from lib/Model/PipelineStage.php rename to lib/Models/PipelineStage.php index cf6d2f8..6b3135f 100644 --- a/lib/Model/PipelineStage.php +++ b/lib/Models/PipelineStage.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/Pipelines.php b/lib/Models/Pipelines.php similarity index 98% rename from lib/Model/Pipelines.php rename to lib/Models/Pipelines.php index c07200d..9e98b53 100644 --- a/lib/Model/Pipelines.php +++ b/lib/Models/Pipelines.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class Pipelines implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - + ]; /** @@ -67,7 +67,7 @@ class Pipelines implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerFormats = [ - + ]; /** @@ -97,7 +97,7 @@ public static function swaggerFormats() * @var string[] */ protected static $attributeMap = [ - + ]; /** @@ -106,7 +106,7 @@ public static function swaggerFormats() * @var string[] */ protected static $setters = [ - + ]; /** @@ -115,7 +115,7 @@ public static function swaggerFormats() * @var string[] */ protected static $getters = [ - + ]; /** @@ -159,9 +159,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/PostContactInfo.php b/lib/Models/PostContactInfo.php similarity index 96% rename from lib/Model/PostContactInfo.php rename to lib/Models/PostContactInfo.php index 46d17d2..c93b0fe 100644 --- a/lib/Model/PostContactInfo.php +++ b/lib/Models/PostContactInfo.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class PostContactInfo implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'contacts' => '\Brevo\Client\Model\PostContactInfoContacts' + 'contacts' => '\Brevo\Client\Models\PostContactInfoContacts' ]; /** @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -210,7 +210,7 @@ public function valid() /** * Gets contacts * - * @return \Brevo\Client\Model\PostContactInfoContacts + * @return \Brevo\Client\Models\PostContactInfoContacts */ public function getContacts() { @@ -220,7 +220,7 @@ public function getContacts() /** * Sets contacts * - * @param \Brevo\Client\Model\PostContactInfoContacts $contacts contacts + * @param \Brevo\Client\Models\PostContactInfoContacts $contacts contacts * * @return $this */ diff --git a/lib/Model/PostContactInfoContacts.php b/lib/Models/PostContactInfoContacts.php similarity index 99% rename from lib/Model/PostContactInfoContacts.php rename to lib/Models/PostContactInfoContacts.php index 978c032..8687357 100644 --- a/lib/Model/PostContactInfoContacts.php +++ b/lib/Models/PostContactInfoContacts.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -173,9 +173,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/PostSendFailed.php b/lib/Models/PostSendFailed.php similarity index 99% rename from lib/Model/PostSendFailed.php rename to lib/Models/PostSendFailed.php index 8c7567d..3f93078 100644 --- a/lib/Model/PostSendFailed.php +++ b/lib/Models/PostSendFailed.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/PostSendSmsTestFailed.php b/lib/Models/PostSendSmsTestFailed.php similarity index 99% rename from lib/Model/PostSendSmsTestFailed.php rename to lib/Models/PostSendSmsTestFailed.php index a74ea9d..95c6f5b 100644 --- a/lib/Model/PostSendSmsTestFailed.php +++ b/lib/Models/PostSendSmsTestFailed.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -173,9 +173,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/PutRevokeUserPermission.php b/lib/Models/PutRevokeUserPermission.php similarity index 99% rename from lib/Model/PutRevokeUserPermission.php rename to lib/Models/PutRevokeUserPermission.php index b527afd..6f89332 100644 --- a/lib/Model/PutRevokeUserPermission.php +++ b/lib/Models/PutRevokeUserPermission.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -159,9 +159,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/Putresendcancelinvitation.php b/lib/Models/Putresendcancelinvitation.php similarity index 99% rename from lib/Model/Putresendcancelinvitation.php rename to lib/Models/Putresendcancelinvitation.php index ba77e8b..860236e 100644 --- a/lib/Model/Putresendcancelinvitation.php +++ b/lib/Models/Putresendcancelinvitation.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/RemainingCreditModel.php b/lib/Models/RemainingCreditModel.php similarity index 94% rename from lib/Model/RemainingCreditModel.php rename to lib/Models/RemainingCreditModel.php index 2502d8c..4551bb0 100644 --- a/lib/Model/RemainingCreditModel.php +++ b/lib/Models/RemainingCreditModel.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,8 +57,8 @@ class RemainingCreditModel implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'child' => '\Brevo\Client\Model\RemainingCreditModelChild', - 'reseller' => '\Brevo\Client\Model\RemainingCreditModelReseller' + 'child' => '\Brevo\Client\Models\RemainingCreditModelChild', + 'reseller' => '\Brevo\Client\Models\RemainingCreditModelReseller' ]; /** @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -219,7 +219,7 @@ public function valid() /** * Gets child * - * @return \Brevo\Client\Model\RemainingCreditModelChild + * @return \Brevo\Client\Models\RemainingCreditModelChild */ public function getChild() { @@ -229,7 +229,7 @@ public function getChild() /** * Sets child * - * @param \Brevo\Client\Model\RemainingCreditModelChild $child child + * @param \Brevo\Client\Models\RemainingCreditModelChild $child child * * @return $this */ @@ -243,7 +243,7 @@ public function setChild($child) /** * Gets reseller * - * @return \Brevo\Client\Model\RemainingCreditModelReseller + * @return \Brevo\Client\Models\RemainingCreditModelReseller */ public function getReseller() { @@ -253,7 +253,7 @@ public function getReseller() /** * Sets reseller * - * @param \Brevo\Client\Model\RemainingCreditModelReseller $reseller reseller + * @param \Brevo\Client\Models\RemainingCreditModelReseller $reseller reseller * * @return $this */ diff --git a/lib/Model/RemainingCreditModelChild.php b/lib/Models/RemainingCreditModelChild.php similarity index 99% rename from lib/Model/RemainingCreditModelChild.php rename to lib/Models/RemainingCreditModelChild.php index 98b9769..6689df9 100644 --- a/lib/Model/RemainingCreditModelChild.php +++ b/lib/Models/RemainingCreditModelChild.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -164,9 +164,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/RemainingCreditModelReseller.php b/lib/Models/RemainingCreditModelReseller.php similarity index 99% rename from lib/Model/RemainingCreditModelReseller.php rename to lib/Models/RemainingCreditModelReseller.php index 288b708..e83291c 100644 --- a/lib/Model/RemainingCreditModelReseller.php +++ b/lib/Models/RemainingCreditModelReseller.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/RemoveContactFromList.php b/lib/Models/RemoveContactFromList.php similarity index 99% rename from lib/Model/RemoveContactFromList.php rename to lib/Models/RemoveContactFromList.php index b34889c..7770f62 100644 --- a/lib/Model/RemoveContactFromList.php +++ b/lib/Models/RemoveContactFromList.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -168,9 +168,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/RemoveCredits.php b/lib/Models/RemoveCredits.php similarity index 99% rename from lib/Model/RemoveCredits.php rename to lib/Models/RemoveCredits.php index a214ae6..3a953d0 100644 --- a/lib/Model/RemoveCredits.php +++ b/lib/Models/RemoveCredits.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/RequestContactExport.php b/lib/Models/RequestContactExport.php similarity index 96% rename from lib/Model/RequestContactExport.php rename to lib/Models/RequestContactExport.php index 37de0a5..2b673c8 100644 --- a/lib/Model/RequestContactExport.php +++ b/lib/Models/RequestContactExport.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class RequestContactExport implements ModelInterface, ArrayAccess */ protected static $swaggerTypes = [ 'exportAttributes' => 'string[]', - 'customContactFilter' => '\Brevo\Client\Model\RequestContactExportCustomContactFilter', + 'customContactFilter' => '\Brevo\Client\Models\RequestContactExportCustomContactFilter', 'notifyUrl' => 'string' ]; @@ -246,7 +246,7 @@ public function setExportAttributes($exportAttributes) /** * Gets customContactFilter * - * @return \Brevo\Client\Model\RequestContactExportCustomContactFilter + * @return \Brevo\Client\Models\RequestContactExportCustomContactFilter */ public function getCustomContactFilter() { @@ -256,7 +256,7 @@ public function getCustomContactFilter() /** * Sets customContactFilter * - * @param \Brevo\Client\Model\RequestContactExportCustomContactFilter $customContactFilter customContactFilter + * @param \Brevo\Client\Models\RequestContactExportCustomContactFilter $customContactFilter customContactFilter * * @return $this */ diff --git a/lib/Model/RequestContactExportCustomContactFilter.php b/lib/Models/RequestContactExportCustomContactFilter.php similarity index 99% rename from lib/Model/RequestContactExportCustomContactFilter.php rename to lib/Models/RequestContactExportCustomContactFilter.php index baf63ba..c6ada0e 100644 --- a/lib/Model/RequestContactExportCustomContactFilter.php +++ b/lib/Models/RequestContactExportCustomContactFilter.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -198,9 +198,9 @@ public function getModelName() const ACTION_FOR_SMS_CAMPAIGNS_HARD_BOUNCES = 'hardBounces'; const ACTION_FOR_SMS_CAMPAIGNS_SOFT_BOUNCES = 'softBounces'; const ACTION_FOR_SMS_CAMPAIGNS_UNSUBSCRIBED = 'unsubscribed'; - - + + /** * Gets allowable values of the enum * @@ -215,7 +215,7 @@ public function getActionForContactsAllowableValues() self::ACTION_FOR_CONTACTS_UNSUBSCRIBED_PER_LIST, ]; } - + /** * Gets allowable values of the enum * @@ -233,7 +233,7 @@ public function getActionForEmailCampaignsAllowableValues() self::ACTION_FOR_EMAIL_CAMPAIGNS_SOFT_BOUNCES, ]; } - + /** * Gets allowable values of the enum * @@ -247,7 +247,7 @@ public function getActionForSmsCampaignsAllowableValues() self::ACTION_FOR_SMS_CAMPAIGNS_UNSUBSCRIBED, ]; } - + /** * Associative array for storing property values diff --git a/lib/Model/RequestContactImport.php b/lib/Models/RequestContactImport.php similarity index 95% rename from lib/Model/RequestContactImport.php rename to lib/Models/RequestContactImport.php index 5e89021..926521f 100644 --- a/lib/Model/RequestContactImport.php +++ b/lib/Models/RequestContactImport.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -59,10 +59,10 @@ class RequestContactImport implements ModelInterface, ArrayAccess protected static $swaggerTypes = [ 'fileUrl' => 'string', 'fileBody' => 'string', - 'jsonBody' => '\Brevo\Client\Model\RequestContactImportJsonBody[]', + 'jsonBody' => '\Brevo\Client\Models\RequestContactImportJsonBody[]', 'listIds' => 'int[]', 'notifyUrl' => 'string', - 'newList' => '\Brevo\Client\Model\RequestContactImportNewList', + 'newList' => '\Brevo\Client\Models\RequestContactImportNewList', 'emailBlacklist' => 'bool', 'disableNotification' => 'bool', 'smsBlacklist' => 'bool', @@ -208,9 +208,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -315,7 +315,7 @@ public function setFileBody($fileBody) /** * Gets jsonBody * - * @return \Brevo\Client\Model\RequestContactImportJsonBody[] + * @return \Brevo\Client\Models\RequestContactImportJsonBody[] */ public function getJsonBody() { @@ -325,7 +325,7 @@ public function getJsonBody() /** * Sets jsonBody * - * @param \Brevo\Client\Model\RequestContactImportJsonBody[] $jsonBody **Mandatory if fileUrl and fileBody is not defined.** JSON content to be imported. **Maximum allowed json body size is 10MB** . However we recommend a safe limit of around 8 MB to avoid the issues caused due to increase of json body size while parsing. Please use fileUrl instead to import bigger files. + * @param \Brevo\Client\Models\RequestContactImportJsonBody[] $jsonBody **Mandatory if fileUrl and fileBody is not defined.** JSON content to be imported. **Maximum allowed json body size is 10MB** . However we recommend a safe limit of around 8 MB to avoid the issues caused due to increase of json body size while parsing. Please use fileUrl instead to import bigger files. * * @return $this */ @@ -387,7 +387,7 @@ public function setNotifyUrl($notifyUrl) /** * Gets newList * - * @return \Brevo\Client\Model\RequestContactImportNewList + * @return \Brevo\Client\Models\RequestContactImportNewList */ public function getNewList() { @@ -397,7 +397,7 @@ public function getNewList() /** * Sets newList * - * @param \Brevo\Client\Model\RequestContactImportNewList $newList newList + * @param \Brevo\Client\Models\RequestContactImportNewList $newList newList * * @return $this */ diff --git a/lib/Model/RequestContactImportJsonBody.php b/lib/Models/RequestContactImportJsonBody.php similarity index 99% rename from lib/Model/RequestContactImportJsonBody.php rename to lib/Models/RequestContactImportJsonBody.php index dca681a..88c57ed 100644 --- a/lib/Model/RequestContactImportJsonBody.php +++ b/lib/Models/RequestContactImportJsonBody.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/RequestContactImportNewList.php b/lib/Models/RequestContactImportNewList.php similarity index 99% rename from lib/Model/RequestContactImportNewList.php rename to lib/Models/RequestContactImportNewList.php index 9b1ffe7..60b24c3 100644 --- a/lib/Model/RequestContactImportNewList.php +++ b/lib/Models/RequestContactImportNewList.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -164,9 +164,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/RequestSmsRecipientExport.php b/lib/Models/RequestSmsRecipientExport.php similarity index 99% rename from lib/Model/RequestSmsRecipientExport.php rename to lib/Models/RequestSmsRecipientExport.php index c9a592c..4881788 100644 --- a/lib/Model/RequestSmsRecipientExport.php +++ b/lib/Models/RequestSmsRecipientExport.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/ScheduleSmtpEmail.php b/lib/Models/ScheduleSmtpEmail.php similarity index 99% rename from lib/Model/ScheduleSmtpEmail.php rename to lib/Models/ScheduleSmtpEmail.php index e0f077c..4c18304 100644 --- a/lib/Model/ScheduleSmtpEmail.php +++ b/lib/Models/ScheduleSmtpEmail.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/SendReport.php b/lib/Models/SendReport.php similarity index 97% rename from lib/Model/SendReport.php rename to lib/Models/SendReport.php index 84b0c60..5a4cc62 100644 --- a/lib/Model/SendReport.php +++ b/lib/Models/SendReport.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class SendReport implements ModelInterface, ArrayAccess */ protected static $swaggerTypes = [ 'language' => 'string', - 'email' => '\Brevo\Client\Model\SendReportEmail' + 'email' => '\Brevo\Client\Models\SendReportEmail' ]; /** @@ -280,7 +280,7 @@ public function setLanguage($language) /** * Gets email * - * @return \Brevo\Client\Model\SendReportEmail + * @return \Brevo\Client\Models\SendReportEmail */ public function getEmail() { @@ -290,7 +290,7 @@ public function getEmail() /** * Sets email * - * @param \Brevo\Client\Model\SendReportEmail $email email + * @param \Brevo\Client\Models\SendReportEmail $email email * * @return $this */ diff --git a/lib/Model/SendReportEmail.php b/lib/Models/SendReportEmail.php similarity index 99% rename from lib/Model/SendReportEmail.php rename to lib/Models/SendReportEmail.php index a5aa068..37c6a25 100644 --- a/lib/Model/SendReportEmail.php +++ b/lib/Models/SendReportEmail.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -164,9 +164,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/SendSms.php b/lib/Models/SendSms.php similarity index 99% rename from lib/Model/SendSms.php rename to lib/Models/SendSms.php index b7d1dae..0b49e80 100644 --- a/lib/Model/SendSms.php +++ b/lib/Models/SendSms.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/SendSmtpEmail.php b/lib/Models/SendSmtpEmail.php similarity index 83% rename from lib/Model/SendSmtpEmail.php rename to lib/Models/SendSmtpEmail.php index 58386de..d892bcc 100644 --- a/lib/Model/SendSmtpEmail.php +++ b/lib/Models/SendSmtpEmail.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,19 +57,19 @@ class SendSmtpEmail implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'sender' => '\Brevo\Client\Model\SendSmtpEmailSender', - 'to' => '\Brevo\Client\Model\SendSmtpEmailTo[]', - 'bcc' => '\Brevo\Client\Model\SendSmtpEmailBcc[]', - 'cc' => '\Brevo\Client\Model\SendSmtpEmailCc[]', + 'sender' => '\Brevo\Client\Models\SendSmtpEmailSender', + 'to' => '\Brevo\Client\Models\SendSmtpEmailTo[]', + 'bcc' => '\Brevo\Client\Models\SendSmtpEmailBcc[]', + 'cc' => '\Brevo\Client\Models\SendSmtpEmailCc[]', 'htmlContent' => 'string', 'textContent' => 'string', 'subject' => 'string', - 'replyTo' => '\Brevo\Client\Model\SendSmtpEmailReplyTo', - 'attachment' => '\Brevo\Client\Model\SendSmtpEmailAttachment[]', + 'replyTo' => '\Brevo\Client\Models\SendSmtpEmailReplyTo', + 'attachment' => '\Brevo\Client\Models\SendSmtpEmailAttachment[]', 'headers' => 'object', 'templateId' => 'int', 'params' => 'object', - 'messageVersions' => '\Brevo\Client\Model\SendSmtpEmailMessageVersions[]', + 'messageVersions' => '\Brevo\Client\Models\SendSmtpEmailMessageVersions[]', 'tags' => 'string[]', 'scheduledAt' => '\DateTime', 'batchId' => 'string' @@ -297,7 +297,7 @@ public function valid() /** * Gets sender * - * @return \Brevo\Client\Model\SendSmtpEmailSender + * @return \Brevo\Client\Models\SendSmtpEmailSender */ public function getSender() { @@ -307,7 +307,7 @@ public function getSender() /** * Sets sender * - * @param \Brevo\Client\Model\SendSmtpEmailSender $sender sender + * @param \Brevo\Client\Models\SendSmtpEmailSender $sender sender * * @return $this */ @@ -321,7 +321,7 @@ public function setSender($sender) /** * Gets to * - * @return \Brevo\Client\Model\SendSmtpEmailTo[] + * @return \Brevo\Client\Models\SendSmtpEmailTo[] */ public function getTo() { @@ -331,7 +331,7 @@ public function getTo() /** * Sets to * - * @param \Brevo\Client\Model\SendSmtpEmailTo[] $to Mandatory if messageVersions are not passed, ignored if messageVersions are passed. List of email addresses and names (optional) of the recipients. For example, [{\"name\":\"Jimmy\", \"email\":\"jimmy98@example.com\"}, {\"name\":\"Joe\", \"email\":\"joe@example.com\"}] + * @param \Brevo\Client\Models\SendSmtpEmailTo[] $to Mandatory if messageVersions are not passed, ignored if messageVersions are passed. 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 */ @@ -345,7 +345,7 @@ public function setTo($to) /** * Gets bcc * - * @return \Brevo\Client\Model\SendSmtpEmailBcc[] + * @return \Brevo\Client\Models\SendSmtpEmailBcc[] */ public function getBcc() { @@ -355,7 +355,7 @@ public function getBcc() /** * Sets bcc * - * @param \Brevo\Client\Model\SendSmtpEmailBcc[] $bcc List of email addresses and names (optional) of the recipients in bcc + * @param \Brevo\Client\Models\SendSmtpEmailBcc[] $bcc List of email addresses and names (optional) of the recipients in bcc * * @return $this */ @@ -369,7 +369,7 @@ public function setBcc($bcc) /** * Gets cc * - * @return \Brevo\Client\Model\SendSmtpEmailCc[] + * @return \Brevo\Client\Models\SendSmtpEmailCc[] */ public function getCc() { @@ -379,7 +379,7 @@ public function getCc() /** * Sets cc * - * @param \Brevo\Client\Model\SendSmtpEmailCc[] $cc List of email addresses and names (optional) of the recipients in cc + * @param \Brevo\Client\Models\SendSmtpEmailCc[] $cc List of email addresses and names (optional) of the recipients in cc * * @return $this */ @@ -465,7 +465,7 @@ public function setSubject($subject) /** * Gets replyTo * - * @return \Brevo\Client\Model\SendSmtpEmailReplyTo + * @return \Brevo\Client\Models\SendSmtpEmailReplyTo */ public function getReplyTo() { @@ -475,7 +475,7 @@ public function getReplyTo() /** * Sets replyTo * - * @param \Brevo\Client\Model\SendSmtpEmailReplyTo $replyTo replyTo + * @param \Brevo\Client\Models\SendSmtpEmailReplyTo $replyTo replyTo * * @return $this */ @@ -489,7 +489,7 @@ public function setReplyTo($replyTo) /** * Gets attachment * - * @return \Brevo\Client\Model\SendSmtpEmailAttachment[] + * @return \Brevo\Client\Models\SendSmtpEmailAttachment[] */ public function getAttachment() { @@ -499,7 +499,7 @@ public function getAttachment() /** * Sets attachment * - * @param \Brevo\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\":\"myAttachmentFromUrl.jpg\"}, {\"content\":\"base64 example content\", \"name\":\"myAttachmentFromBase64.jpg\"}]`. 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, eps, odt, mp3, m4a, m4v, wma, ogg, flac, wav, aif, aifc, aiff, mp4, mov, avi, mkv, mpeg, mpg, wmv, pkpass and xlsm ( If 'templateId' is passed and is in New Template Language format then both attachment url and content are accepted. If template is in Old template Language format, then 'attachment' is ignored ) + * @param \Brevo\Client\Models\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\":\"myAttachmentFromUrl.jpg\"}, {\"content\":\"base64 example content\", \"name\":\"myAttachmentFromBase64.jpg\"}]`. 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, eps, odt, mp3, m4a, m4v, wma, ogg, flac, wav, aif, aifc, aiff, mp4, mov, avi, mkv, mpeg, mpg, wmv, pkpass and xlsm ( If 'templateId' is passed and is in New Template Language format then both attachment url and content are accepted. If template is in Old template Language format, then 'attachment' is ignored ) * * @return $this */ @@ -585,7 +585,7 @@ public function setParams($params) /** * Gets messageVersions * - * @return \Brevo\Client\Model\SendSmtpEmailMessageVersions[] + * @return \Brevo\Client\Models\SendSmtpEmailMessageVersions[] */ public function getMessageVersions() { @@ -595,7 +595,7 @@ public function getMessageVersions() /** * Sets messageVersions * - * @param \Brevo\Client\Model\SendSmtpEmailMessageVersions[] $messageVersions You can customize and send out multiple versions of a mail. templateId can be customized only if global parameter contains templateId. htmlContent and textContent can be customized only if any of the two, htmlContent or textContent, is present in global parameters. Some global parameters such as **to(mandatory), bcc, cc, replyTo, subject** can also be customized specific to each version. Total number of recipients in one API request must not exceed 2000. However, you can still pass upto 99 recipients maximum in one message version. The size of individual params in all the messageVersions shall not exceed 100 KB limit and that of cumulative params shall not exceed 1000 KB. You can follow this **step-by-step guide** on how to use **messageVersions** to batch send emails - https://developers.brevo.com/docs/batch-send-transactional-emails + * @param \Brevo\Client\Models\SendSmtpEmailMessageVersions[] $messageVersions You can customize and send out multiple versions of a mail. templateId can be customized only if global parameter contains templateId. htmlContent and textContent can be customized only if any of the two, htmlContent or textContent, is present in global parameters. Some global parameters such as **to(mandatory), bcc, cc, replyTo, subject** can also be customized specific to each version. Total number of recipients in one API request must not exceed 2000. However, you can still pass upto 99 recipients maximum in one message version. The size of individual params in all the messageVersions shall not exceed 100 KB limit and that of cumulative params shall not exceed 1000 KB. You can follow this **step-by-step guide** on how to use **messageVersions** to batch send emails - https://developers.brevo.com/docs/batch-send-transactional-emails * * @return $this */ diff --git a/lib/Model/SendSmtpEmailAttachment.php b/lib/Models/SendSmtpEmailAttachment.php similarity index 99% rename from lib/Model/SendSmtpEmailAttachment.php rename to lib/Models/SendSmtpEmailAttachment.php index 4775f9c..7421133 100644 --- a/lib/Model/SendSmtpEmailAttachment.php +++ b/lib/Models/SendSmtpEmailAttachment.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/SendSmtpEmailBcc.php b/lib/Models/SendSmtpEmailBcc.php similarity index 99% rename from lib/Model/SendSmtpEmailBcc.php rename to lib/Models/SendSmtpEmailBcc.php index 507c7f5..c079efb 100644 --- a/lib/Model/SendSmtpEmailBcc.php +++ b/lib/Models/SendSmtpEmailBcc.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/SendSmtpEmailCc.php b/lib/Models/SendSmtpEmailCc.php similarity index 99% rename from lib/Model/SendSmtpEmailCc.php rename to lib/Models/SendSmtpEmailCc.php index e332a05..485af01 100644 --- a/lib/Model/SendSmtpEmailCc.php +++ b/lib/Models/SendSmtpEmailCc.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/SendSmtpEmailMessageVersions.php b/lib/Models/SendSmtpEmailMessageVersions.php similarity index 90% rename from lib/Model/SendSmtpEmailMessageVersions.php rename to lib/Models/SendSmtpEmailMessageVersions.php index 4f9d0f6..7edc596 100644 --- a/lib/Model/SendSmtpEmailMessageVersions.php +++ b/lib/Models/SendSmtpEmailMessageVersions.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,11 +57,11 @@ class SendSmtpEmailMessageVersions implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'to' => '\Brevo\Client\Model\SendSmtpEmailTo1[]', + 'to' => '\Brevo\Client\Models\SendSmtpEmailTo1[]', 'params' => 'map[string,object]', - 'bcc' => '\Brevo\Client\Model\SendSmtpEmailBcc[]', - 'cc' => '\Brevo\Client\Model\SendSmtpEmailCc[]', - 'replyTo' => '\Brevo\Client\Model\SendSmtpEmailReplyTo1', + 'bcc' => '\Brevo\Client\Models\SendSmtpEmailBcc[]', + 'cc' => '\Brevo\Client\Models\SendSmtpEmailCc[]', + 'replyTo' => '\Brevo\Client\Models\SendSmtpEmailReplyTo1', 'subject' => 'string' ]; @@ -183,9 +183,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -240,7 +240,7 @@ public function valid() /** * Gets to * - * @return \Brevo\Client\Model\SendSmtpEmailTo1[] + * @return \Brevo\Client\Models\SendSmtpEmailTo1[] */ public function getTo() { @@ -250,7 +250,7 @@ public function getTo() /** * Sets to * - * @param \Brevo\Client\Model\SendSmtpEmailTo1[] $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\"}] + * @param \Brevo\Client\Models\SendSmtpEmailTo1[] $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 */ @@ -288,7 +288,7 @@ public function setParams($params) /** * Gets bcc * - * @return \Brevo\Client\Model\SendSmtpEmailBcc[] + * @return \Brevo\Client\Models\SendSmtpEmailBcc[] */ public function getBcc() { @@ -298,7 +298,7 @@ public function getBcc() /** * Sets bcc * - * @param \Brevo\Client\Model\SendSmtpEmailBcc[] $bcc List of email addresses and names (optional) of the recipients in bcc + * @param \Brevo\Client\Models\SendSmtpEmailBcc[] $bcc List of email addresses and names (optional) of the recipients in bcc * * @return $this */ @@ -312,7 +312,7 @@ public function setBcc($bcc) /** * Gets cc * - * @return \Brevo\Client\Model\SendSmtpEmailCc[] + * @return \Brevo\Client\Models\SendSmtpEmailCc[] */ public function getCc() { @@ -322,7 +322,7 @@ public function getCc() /** * Sets cc * - * @param \Brevo\Client\Model\SendSmtpEmailCc[] $cc List of email addresses and names (optional) of the recipients in cc + * @param \Brevo\Client\Models\SendSmtpEmailCc[] $cc List of email addresses and names (optional) of the recipients in cc * * @return $this */ @@ -336,7 +336,7 @@ public function setCc($cc) /** * Gets replyTo * - * @return \Brevo\Client\Model\SendSmtpEmailReplyTo1 + * @return \Brevo\Client\Models\SendSmtpEmailReplyTo1 */ public function getReplyTo() { @@ -346,7 +346,7 @@ public function getReplyTo() /** * Sets replyTo * - * @param \Brevo\Client\Model\SendSmtpEmailReplyTo1 $replyTo replyTo + * @param \Brevo\Client\Models\SendSmtpEmailReplyTo1 $replyTo replyTo * * @return $this */ diff --git a/lib/Model/SendSmtpEmailReplyTo.php b/lib/Models/SendSmtpEmailReplyTo.php similarity index 99% rename from lib/Model/SendSmtpEmailReplyTo.php rename to lib/Models/SendSmtpEmailReplyTo.php index e5231f7..caf08dc 100644 --- a/lib/Model/SendSmtpEmailReplyTo.php +++ b/lib/Models/SendSmtpEmailReplyTo.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -164,9 +164,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/SendSmtpEmailReplyTo1.php b/lib/Models/SendSmtpEmailReplyTo1.php similarity index 99% rename from lib/Model/SendSmtpEmailReplyTo1.php rename to lib/Models/SendSmtpEmailReplyTo1.php index 56280ed..e2a83d4 100644 --- a/lib/Model/SendSmtpEmailReplyTo1.php +++ b/lib/Models/SendSmtpEmailReplyTo1.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -164,9 +164,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/SendSmtpEmailSender.php b/lib/Models/SendSmtpEmailSender.php similarity index 99% rename from lib/Model/SendSmtpEmailSender.php rename to lib/Models/SendSmtpEmailSender.php index b27b168..d64d7ce 100644 --- a/lib/Model/SendSmtpEmailSender.php +++ b/lib/Models/SendSmtpEmailSender.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -169,9 +169,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/SendSmtpEmailTo.php b/lib/Models/SendSmtpEmailTo.php similarity index 99% rename from lib/Model/SendSmtpEmailTo.php rename to lib/Models/SendSmtpEmailTo.php index e7c164b..5d06a00 100644 --- a/lib/Model/SendSmtpEmailTo.php +++ b/lib/Models/SendSmtpEmailTo.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/SendSmtpEmailTo1.php b/lib/Models/SendSmtpEmailTo1.php similarity index 99% rename from lib/Model/SendSmtpEmailTo1.php rename to lib/Models/SendSmtpEmailTo1.php index 58dafdf..91abc02 100644 --- a/lib/Model/SendSmtpEmailTo1.php +++ b/lib/Models/SendSmtpEmailTo1.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/SendTestEmail.php b/lib/Models/SendTestEmail.php similarity index 99% rename from lib/Model/SendTestEmail.php rename to lib/Models/SendTestEmail.php index ba33577..a798afb 100644 --- a/lib/Model/SendTestEmail.php +++ b/lib/Models/SendTestEmail.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/SendTestSms.php b/lib/Models/SendTestSms.php similarity index 99% rename from lib/Model/SendTestSms.php rename to lib/Models/SendTestSms.php index 3eaeead..39ccb47 100644 --- a/lib/Model/SendTestSms.php +++ b/lib/Models/SendTestSms.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/SendTransacSms.php b/lib/Models/SendTransacSms.php similarity index 99% rename from lib/Model/SendTransacSms.php rename to lib/Models/SendTransacSms.php index 4ab8659..a44ecf2 100644 --- a/lib/Model/SendTransacSms.php +++ b/lib/Models/SendTransacSms.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -195,9 +195,9 @@ public function getModelName() const TYPE_TRANSACTIONAL = 'transactional'; const TYPE_MARKETING = 'marketing'; - - + + /** * Gets allowable values of the enum * @@ -210,7 +210,7 @@ public function getTypeAllowableValues() self::TYPE_MARKETING, ]; } - + /** * Associative array for storing property values diff --git a/lib/Model/SendWhatsappMessage.php b/lib/Models/SendWhatsappMessage.php similarity index 99% rename from lib/Model/SendWhatsappMessage.php rename to lib/Models/SendWhatsappMessage.php index ecb3ce4..d985d8d 100644 --- a/lib/Model/SendWhatsappMessage.php +++ b/lib/Models/SendWhatsappMessage.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -178,9 +178,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/SsoTokenRequest.php b/lib/Models/SsoTokenRequest.php similarity index 99% rename from lib/Model/SsoTokenRequest.php rename to lib/Models/SsoTokenRequest.php index b29cedc..183df46 100644 --- a/lib/Model/SsoTokenRequest.php +++ b/lib/Models/SsoTokenRequest.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -181,9 +181,9 @@ public function getModelName() const TARGET_SENDERS = 'senders'; const TARGET_SMS_CAMPAIGN = 'sms_campaign'; const TARGET_SMS_TRANSACTIONAL = 'sms_transactional'; - - + + /** * Gets allowable values of the enum * @@ -202,7 +202,7 @@ public function getTargetAllowableValues() self::TARGET_SMS_TRANSACTIONAL, ]; } - + /** * Associative array for storing property values diff --git a/lib/Model/SubAccountAppsToggleRequest.php b/lib/Models/SubAccountAppsToggleRequest.php similarity index 99% rename from lib/Model/SubAccountAppsToggleRequest.php rename to lib/Models/SubAccountAppsToggleRequest.php index f7b9392..f255c00 100644 --- a/lib/Model/SubAccountAppsToggleRequest.php +++ b/lib/Models/SubAccountAppsToggleRequest.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -219,9 +219,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/SubAccountDetailsResponse.php b/lib/Models/SubAccountDetailsResponse.php similarity index 97% rename from lib/Model/SubAccountDetailsResponse.php rename to lib/Models/SubAccountDetailsResponse.php index 0c1deca..55a7fd4 100644 --- a/lib/Model/SubAccountDetailsResponse.php +++ b/lib/Models/SubAccountDetailsResponse.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -60,7 +60,7 @@ class SubAccountDetailsResponse implements ModelInterface, ArrayAccess 'name' => 'string', 'email' => 'string', 'companyName' => 'string', - 'planInfo' => '\Brevo\Client\Model\SubAccountDetailsResponsePlanInfo' + 'planInfo' => '\Brevo\Client\Models\SubAccountDetailsResponsePlanInfo' ]; /** @@ -173,9 +173,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -297,7 +297,7 @@ public function setCompanyName($companyName) /** * Gets planInfo * - * @return \Brevo\Client\Model\SubAccountDetailsResponsePlanInfo + * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfo */ public function getPlanInfo() { @@ -307,7 +307,7 @@ public function getPlanInfo() /** * Sets planInfo * - * @param \Brevo\Client\Model\SubAccountDetailsResponsePlanInfo $planInfo planInfo + * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfo $planInfo planInfo * * @return $this */ diff --git a/lib/Model/SubAccountDetailsResponsePlanInfo.php b/lib/Models/SubAccountDetailsResponsePlanInfo.php similarity index 93% rename from lib/Model/SubAccountDetailsResponsePlanInfo.php rename to lib/Models/SubAccountDetailsResponsePlanInfo.php index 5283b78..5926a80 100644 --- a/lib/Model/SubAccountDetailsResponsePlanInfo.php +++ b/lib/Models/SubAccountDetailsResponsePlanInfo.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,8 +58,8 @@ class SubAccountDetailsResponsePlanInfo implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'credits' => '\Brevo\Client\Model\SubAccountDetailsResponsePlanInfoCredits', - 'features' => '\Brevo\Client\Model\SubAccountDetailsResponsePlanInfoFeatures', + 'credits' => '\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCredits', + 'features' => '\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeatures', 'planType' => 'string' ]; @@ -169,9 +169,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -220,7 +220,7 @@ public function valid() /** * Gets credits * - * @return \Brevo\Client\Model\SubAccountDetailsResponsePlanInfoCredits + * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCredits */ public function getCredits() { @@ -230,7 +230,7 @@ public function getCredits() /** * Sets credits * - * @param \Brevo\Client\Model\SubAccountDetailsResponsePlanInfoCredits $credits credits + * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCredits $credits credits * * @return $this */ @@ -244,7 +244,7 @@ public function setCredits($credits) /** * Gets features * - * @return \Brevo\Client\Model\SubAccountDetailsResponsePlanInfoFeatures + * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeatures */ public function getFeatures() { @@ -254,7 +254,7 @@ public function getFeatures() /** * Sets features * - * @param \Brevo\Client\Model\SubAccountDetailsResponsePlanInfoFeatures $features features + * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeatures $features features * * @return $this */ diff --git a/lib/Model/SubAccountDetailsResponsePlanInfoCredits.php b/lib/Models/SubAccountDetailsResponsePlanInfoCredits.php similarity index 96% rename from lib/Model/SubAccountDetailsResponsePlanInfoCredits.php rename to lib/Models/SubAccountDetailsResponsePlanInfoCredits.php index 425dace..b336841 100644 --- a/lib/Model/SubAccountDetailsResponsePlanInfoCredits.php +++ b/lib/Models/SubAccountDetailsResponsePlanInfoCredits.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -59,7 +59,7 @@ class SubAccountDetailsResponsePlanInfoCredits implements ModelInterface, ArrayA */ protected static $swaggerTypes = [ 'sms' => 'int', - 'emails' => '\Brevo\Client\Model\SubAccountDetailsResponsePlanInfoCreditsEmails' + 'emails' => '\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsEmails' ]; /** @@ -238,7 +238,7 @@ public function setSms($sms) /** * Gets emails * - * @return \Brevo\Client\Model\SubAccountDetailsResponsePlanInfoCreditsEmails + * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsEmails */ public function getEmails() { @@ -248,7 +248,7 @@ public function getEmails() /** * Sets emails * - * @param \Brevo\Client\Model\SubAccountDetailsResponsePlanInfoCreditsEmails $emails emails + * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsEmails $emails emails * * @return $this */ diff --git a/lib/Model/SubAccountDetailsResponsePlanInfoCreditsEmails.php b/lib/Models/SubAccountDetailsResponsePlanInfoCreditsEmails.php similarity index 99% rename from lib/Model/SubAccountDetailsResponsePlanInfoCreditsEmails.php rename to lib/Models/SubAccountDetailsResponsePlanInfoCreditsEmails.php index dd1b582..1817f27 100644 --- a/lib/Model/SubAccountDetailsResponsePlanInfoCreditsEmails.php +++ b/lib/Models/SubAccountDetailsResponsePlanInfoCreditsEmails.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -164,9 +164,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/SubAccountDetailsResponsePlanInfoFeatures.php b/lib/Models/SubAccountDetailsResponsePlanInfoFeatures.php similarity index 90% rename from lib/Model/SubAccountDetailsResponsePlanInfoFeatures.php rename to lib/Models/SubAccountDetailsResponsePlanInfoFeatures.php index b79a45f..9993e7e 100644 --- a/lib/Model/SubAccountDetailsResponsePlanInfoFeatures.php +++ b/lib/Models/SubAccountDetailsResponsePlanInfoFeatures.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,9 +58,9 @@ class SubAccountDetailsResponsePlanInfoFeatures implements ModelInterface, Array * @var string[] */ protected static $swaggerTypes = [ - 'inbox' => '\Brevo\Client\Model\SubAccountDetailsResponsePlanInfoFeaturesInbox', - 'landingPage' => '\Brevo\Client\Model\SubAccountDetailsResponsePlanInfoFeaturesLandingPage', - 'users' => '\Brevo\Client\Model\SubAccountDetailsResponsePlanInfoFeaturesUsers' + 'inbox' => '\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesInbox', + 'landingPage' => '\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesLandingPage', + 'users' => '\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesUsers' ]; /** @@ -169,9 +169,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -220,7 +220,7 @@ public function valid() /** * Gets inbox * - * @return \Brevo\Client\Model\SubAccountDetailsResponsePlanInfoFeaturesInbox + * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesInbox */ public function getInbox() { @@ -230,7 +230,7 @@ public function getInbox() /** * Sets inbox * - * @param \Brevo\Client\Model\SubAccountDetailsResponsePlanInfoFeaturesInbox $inbox inbox + * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesInbox $inbox inbox * * @return $this */ @@ -244,7 +244,7 @@ public function setInbox($inbox) /** * Gets landingPage * - * @return \Brevo\Client\Model\SubAccountDetailsResponsePlanInfoFeaturesLandingPage + * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesLandingPage */ public function getLandingPage() { @@ -254,7 +254,7 @@ public function getLandingPage() /** * Sets landingPage * - * @param \Brevo\Client\Model\SubAccountDetailsResponsePlanInfoFeaturesLandingPage $landingPage landingPage + * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesLandingPage $landingPage landingPage * * @return $this */ @@ -268,7 +268,7 @@ public function setLandingPage($landingPage) /** * Gets users * - * @return \Brevo\Client\Model\SubAccountDetailsResponsePlanInfoFeaturesUsers + * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesUsers */ public function getUsers() { @@ -278,7 +278,7 @@ public function getUsers() /** * Sets users * - * @param \Brevo\Client\Model\SubAccountDetailsResponsePlanInfoFeaturesUsers $users users + * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesUsers $users users * * @return $this */ diff --git a/lib/Model/SubAccountDetailsResponsePlanInfoFeaturesInbox.php b/lib/Models/SubAccountDetailsResponsePlanInfoFeaturesInbox.php similarity index 99% rename from lib/Model/SubAccountDetailsResponsePlanInfoFeaturesInbox.php rename to lib/Models/SubAccountDetailsResponsePlanInfoFeaturesInbox.php index 76e2f65..f2812e6 100644 --- a/lib/Model/SubAccountDetailsResponsePlanInfoFeaturesInbox.php +++ b/lib/Models/SubAccountDetailsResponsePlanInfoFeaturesInbox.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/SubAccountDetailsResponsePlanInfoFeaturesLandingPage.php b/lib/Models/SubAccountDetailsResponsePlanInfoFeaturesLandingPage.php similarity index 99% rename from lib/Model/SubAccountDetailsResponsePlanInfoFeaturesLandingPage.php rename to lib/Models/SubAccountDetailsResponsePlanInfoFeaturesLandingPage.php index 3bce42d..614cf47 100644 --- a/lib/Model/SubAccountDetailsResponsePlanInfoFeaturesLandingPage.php +++ b/lib/Models/SubAccountDetailsResponsePlanInfoFeaturesLandingPage.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -164,9 +164,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/SubAccountDetailsResponsePlanInfoFeaturesUsers.php b/lib/Models/SubAccountDetailsResponsePlanInfoFeaturesUsers.php similarity index 99% rename from lib/Model/SubAccountDetailsResponsePlanInfoFeaturesUsers.php rename to lib/Models/SubAccountDetailsResponsePlanInfoFeaturesUsers.php index 3700796..d1636e5 100644 --- a/lib/Model/SubAccountDetailsResponsePlanInfoFeaturesUsers.php +++ b/lib/Models/SubAccountDetailsResponsePlanInfoFeaturesUsers.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -164,9 +164,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/SubAccountUpdatePlanRequest.php b/lib/Models/SubAccountUpdatePlanRequest.php similarity index 93% rename from lib/Model/SubAccountUpdatePlanRequest.php rename to lib/Models/SubAccountUpdatePlanRequest.php index 385a1f0..3a58801 100644 --- a/lib/Model/SubAccountUpdatePlanRequest.php +++ b/lib/Models/SubAccountUpdatePlanRequest.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,8 +58,8 @@ class SubAccountUpdatePlanRequest implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'credits' => '\Brevo\Client\Model\SubAccountUpdatePlanRequestCredits', - 'features' => '\Brevo\Client\Model\SubAccountUpdatePlanRequestFeatures' + 'credits' => '\Brevo\Client\Models\SubAccountUpdatePlanRequestCredits', + 'features' => '\Brevo\Client\Models\SubAccountUpdatePlanRequestFeatures' ]; /** @@ -164,9 +164,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -214,7 +214,7 @@ public function valid() /** * Gets credits * - * @return \Brevo\Client\Model\SubAccountUpdatePlanRequestCredits + * @return \Brevo\Client\Models\SubAccountUpdatePlanRequestCredits */ public function getCredits() { @@ -224,7 +224,7 @@ public function getCredits() /** * Sets credits * - * @param \Brevo\Client\Model\SubAccountUpdatePlanRequestCredits $credits credits + * @param \Brevo\Client\Models\SubAccountUpdatePlanRequestCredits $credits credits * * @return $this */ @@ -238,7 +238,7 @@ public function setCredits($credits) /** * Gets features * - * @return \Brevo\Client\Model\SubAccountUpdatePlanRequestFeatures + * @return \Brevo\Client\Models\SubAccountUpdatePlanRequestFeatures */ public function getFeatures() { @@ -248,7 +248,7 @@ public function getFeatures() /** * Sets features * - * @param \Brevo\Client\Model\SubAccountUpdatePlanRequestFeatures $features features + * @param \Brevo\Client\Models\SubAccountUpdatePlanRequestFeatures $features features * * @return $this */ diff --git a/lib/Model/SubAccountUpdatePlanRequestCredits.php b/lib/Models/SubAccountUpdatePlanRequestCredits.php similarity index 99% rename from lib/Model/SubAccountUpdatePlanRequestCredits.php rename to lib/Models/SubAccountUpdatePlanRequestCredits.php index c116f68..03f4cb6 100644 --- a/lib/Model/SubAccountUpdatePlanRequestCredits.php +++ b/lib/Models/SubAccountUpdatePlanRequestCredits.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -159,9 +159,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/SubAccountUpdatePlanRequestFeatures.php b/lib/Models/SubAccountUpdatePlanRequestFeatures.php similarity index 99% rename from lib/Model/SubAccountUpdatePlanRequestFeatures.php rename to lib/Models/SubAccountUpdatePlanRequestFeatures.php index d0d20fb..902cd42 100644 --- a/lib/Model/SubAccountUpdatePlanRequestFeatures.php +++ b/lib/Models/SubAccountUpdatePlanRequestFeatures.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -169,9 +169,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/SubAccountsResponse.php b/lib/Models/SubAccountsResponse.php similarity index 96% rename from lib/Model/SubAccountsResponse.php rename to lib/Models/SubAccountsResponse.php index 6f6e088..982d901 100644 --- a/lib/Model/SubAccountsResponse.php +++ b/lib/Models/SubAccountsResponse.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class SubAccountsResponse implements ModelInterface, ArrayAccess */ protected static $swaggerTypes = [ 'count' => 'int', - 'subAccounts' => '\Brevo\Client\Model\SubAccountsResponseSubAccounts[]' + 'subAccounts' => '\Brevo\Client\Models\SubAccountsResponseSubAccounts[]' ]; /** @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -237,7 +237,7 @@ public function setCount($count) /** * Gets subAccounts * - * @return \Brevo\Client\Model\SubAccountsResponseSubAccounts[] + * @return \Brevo\Client\Models\SubAccountsResponseSubAccounts[] */ public function getSubAccounts() { @@ -247,7 +247,7 @@ public function getSubAccounts() /** * Sets subAccounts * - * @param \Brevo\Client\Model\SubAccountsResponseSubAccounts[] $subAccounts subAccounts + * @param \Brevo\Client\Models\SubAccountsResponseSubAccounts[] $subAccounts subAccounts * * @return $this */ diff --git a/lib/Model/SubAccountsResponseSubAccounts.php b/lib/Models/SubAccountsResponseSubAccounts.php similarity index 99% rename from lib/Model/SubAccountsResponseSubAccounts.php rename to lib/Models/SubAccountsResponseSubAccounts.php index 1641dfa..00cc7d7 100644 --- a/lib/Model/SubAccountsResponseSubAccounts.php +++ b/lib/Models/SubAccountsResponseSubAccounts.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -173,9 +173,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/Task.php b/lib/Models/Task.php similarity index 99% rename from lib/Model/Task.php rename to lib/Models/Task.php index 08d27b3..4a32253 100644 --- a/lib/Model/Task.php +++ b/lib/Models/Task.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/TaskList.php b/lib/Models/TaskList.php similarity index 97% rename from lib/Model/TaskList.php rename to lib/Models/TaskList.php index 51115b6..8589d53 100644 --- a/lib/Model/TaskList.php +++ b/lib/Models/TaskList.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class TaskList implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'items' => '\Brevo\Client\Model\Task[]' + 'items' => '\Brevo\Client\Models\Task[]' ]; /** @@ -159,9 +159,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -208,7 +208,7 @@ public function valid() /** * Gets items * - * @return \Brevo\Client\Model\Task[] + * @return \Brevo\Client\Models\Task[] */ public function getItems() { @@ -218,7 +218,7 @@ public function getItems() /** * Sets items * - * @param \Brevo\Client\Model\Task[] $items List of tasks + * @param \Brevo\Client\Models\Task[] $items List of tasks * * @return $this */ diff --git a/lib/Model/TaskReminder.php b/lib/Models/TaskReminder.php similarity index 99% rename from lib/Model/TaskReminder.php rename to lib/Models/TaskReminder.php index fb84ad0..3312fe7 100644 --- a/lib/Model/TaskReminder.php +++ b/lib/Models/TaskReminder.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -173,9 +173,9 @@ public function getModelName() const UNIT_HOURS = 'hours'; const UNIT_WEEKS = 'weeks'; const UNIT_DAYS = 'days'; - - + + /** * Gets allowable values of the enum * @@ -190,7 +190,7 @@ public function getUnitAllowableValues() self::UNIT_DAYS, ]; } - + /** * Associative array for storing property values diff --git a/lib/Model/TaskTypes.php b/lib/Models/TaskTypes.php similarity index 99% rename from lib/Model/TaskTypes.php rename to lib/Models/TaskTypes.php index 305351e..3bb56ef 100644 --- a/lib/Model/TaskTypes.php +++ b/lib/Models/TaskTypes.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/UpdateAttribute.php b/lib/Models/UpdateAttribute.php similarity index 94% rename from lib/Model/UpdateAttribute.php rename to lib/Models/UpdateAttribute.php index d286e99..0aa8bf3 100644 --- a/lib/Model/UpdateAttribute.php +++ b/lib/Models/UpdateAttribute.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class UpdateAttribute implements ModelInterface, ArrayAccess */ protected static $swaggerTypes = [ 'value' => 'string', - 'enumeration' => '\Brevo\Client\Model\UpdateAttributeEnumeration[]' + 'enumeration' => '\Brevo\Client\Models\UpdateAttributeEnumeration[]' ]; /** @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -237,7 +237,7 @@ public function setValue($value) /** * Gets enumeration * - * @return \Brevo\Client\Model\UpdateAttributeEnumeration[] + * @return \Brevo\Client\Models\UpdateAttributeEnumeration[] */ public function getEnumeration() { @@ -247,7 +247,7 @@ public function getEnumeration() /** * Sets enumeration * - * @param \Brevo\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\"}] + * @param \Brevo\Client\Models\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 */ diff --git a/lib/Model/UpdateAttributeEnumeration.php b/lib/Models/UpdateAttributeEnumeration.php similarity index 99% rename from lib/Model/UpdateAttributeEnumeration.php rename to lib/Models/UpdateAttributeEnumeration.php index 81d9b66..0e2b120 100644 --- a/lib/Model/UpdateAttributeEnumeration.php +++ b/lib/Models/UpdateAttributeEnumeration.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/UpdateBatchContacts.php b/lib/Models/UpdateBatchContacts.php similarity index 96% rename from lib/Model/UpdateBatchContacts.php rename to lib/Models/UpdateBatchContacts.php index f922dd7..d97a34f 100644 --- a/lib/Model/UpdateBatchContacts.php +++ b/lib/Models/UpdateBatchContacts.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -57,7 +57,7 @@ class UpdateBatchContacts implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'contacts' => '\Brevo\Client\Model\UpdateBatchContactsContacts[]' + 'contacts' => '\Brevo\Client\Models\UpdateBatchContactsContacts[]' ]; /** @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -207,7 +207,7 @@ public function valid() /** * Gets contacts * - * @return \Brevo\Client\Model\UpdateBatchContactsContacts[] + * @return \Brevo\Client\Models\UpdateBatchContactsContacts[] */ public function getContacts() { @@ -217,7 +217,7 @@ public function getContacts() /** * Sets contacts * - * @param \Brevo\Client\Model\UpdateBatchContactsContacts[] $contacts List of contacts to be updated + * @param \Brevo\Client\Models\UpdateBatchContactsContacts[] $contacts List of contacts to be updated * * @return $this */ diff --git a/lib/Model/UpdateBatchContactsContacts.php b/lib/Models/UpdateBatchContactsContacts.php similarity index 99% rename from lib/Model/UpdateBatchContactsContacts.php rename to lib/Models/UpdateBatchContactsContacts.php index 5de1c5c..8ecfec7 100644 --- a/lib/Model/UpdateBatchContactsContacts.php +++ b/lib/Models/UpdateBatchContactsContacts.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -203,9 +203,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/UpdateBatchContactsModel.php b/lib/Models/UpdateBatchContactsModel.php similarity index 99% rename from lib/Model/UpdateBatchContactsModel.php rename to lib/Models/UpdateBatchContactsModel.php index afe0a6d..2060e07 100644 --- a/lib/Model/UpdateBatchContactsModel.php +++ b/lib/Models/UpdateBatchContactsModel.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/UpdateCampaignStatus.php b/lib/Models/UpdateCampaignStatus.php similarity index 99% rename from lib/Model/UpdateCampaignStatus.php rename to lib/Models/UpdateCampaignStatus.php index 98aa902..6c645df 100644 --- a/lib/Model/UpdateCampaignStatus.php +++ b/lib/Models/UpdateCampaignStatus.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/UpdateChild.php b/lib/Models/UpdateChild.php similarity index 99% rename from lib/Model/UpdateChild.php rename to lib/Models/UpdateChild.php index ddcb0d2..de73cf8 100644 --- a/lib/Model/UpdateChild.php +++ b/lib/Models/UpdateChild.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/UpdateChildAccountStatus.php b/lib/Models/UpdateChildAccountStatus.php similarity index 99% rename from lib/Model/UpdateChildAccountStatus.php rename to lib/Models/UpdateChildAccountStatus.php index 6fc4ce2..89b7167 100644 --- a/lib/Model/UpdateChildAccountStatus.php +++ b/lib/Models/UpdateChildAccountStatus.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/UpdateChildDomain.php b/lib/Models/UpdateChildDomain.php similarity index 99% rename from lib/Model/UpdateChildDomain.php rename to lib/Models/UpdateChildDomain.php index db4d98b..c5e4e96 100644 --- a/lib/Model/UpdateChildDomain.php +++ b/lib/Models/UpdateChildDomain.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/UpdateContact.php b/lib/Models/UpdateContact.php similarity index 99% rename from lib/Model/UpdateContact.php rename to lib/Models/UpdateContact.php index ff38522..83e8045 100644 --- a/lib/Model/UpdateContact.php +++ b/lib/Models/UpdateContact.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -188,9 +188,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/UpdateCouponCollection.php b/lib/Models/UpdateCouponCollection.php similarity index 99% rename from lib/Model/UpdateCouponCollection.php rename to lib/Models/UpdateCouponCollection.php index fe6b87c..c8a2808 100644 --- a/lib/Model/UpdateCouponCollection.php +++ b/lib/Models/UpdateCouponCollection.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/UpdateEmailCampaign.php b/lib/Models/UpdateEmailCampaign.php similarity index 98% rename from lib/Model/UpdateEmailCampaign.php rename to lib/Models/UpdateEmailCampaign.php index 0fc74b8..d7a5470 100644 --- a/lib/Model/UpdateEmailCampaign.php +++ b/lib/Models/UpdateEmailCampaign.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class UpdateEmailCampaign implements ModelInterface, ArrayAccess */ protected static $swaggerTypes = [ 'tag' => 'string', - 'sender' => '\Brevo\Client\Model\UpdateEmailCampaignSender', + 'sender' => '\Brevo\Client\Models\UpdateEmailCampaignSender', 'name' => 'string', 'htmlContent' => 'string', 'htmlUrl' => 'string', @@ -67,7 +67,7 @@ class UpdateEmailCampaign implements ModelInterface, ArrayAccess 'previewText' => 'string', 'replyTo' => 'string', 'toField' => 'string', - 'recipients' => '\Brevo\Client\Model\UpdateEmailCampaignRecipients', + 'recipients' => '\Brevo\Client\Models\UpdateEmailCampaignRecipients', 'attachmentUrl' => 'string', 'inlineImageActivation' => 'bool', 'mirrorActive' => 'bool', @@ -458,7 +458,7 @@ public function setTag($tag) /** * Gets sender * - * @return \Brevo\Client\Model\UpdateEmailCampaignSender + * @return \Brevo\Client\Models\UpdateEmailCampaignSender */ public function getSender() { @@ -468,7 +468,7 @@ public function getSender() /** * Sets sender * - * @param \Brevo\Client\Model\UpdateEmailCampaignSender $sender sender + * @param \Brevo\Client\Models\UpdateEmailCampaignSender $sender sender * * @return $this */ @@ -674,7 +674,7 @@ public function setToField($toField) /** * Gets recipients * - * @return \Brevo\Client\Model\UpdateEmailCampaignRecipients + * @return \Brevo\Client\Models\UpdateEmailCampaignRecipients */ public function getRecipients() { @@ -684,7 +684,7 @@ public function getRecipients() /** * Sets recipients * - * @param \Brevo\Client\Model\UpdateEmailCampaignRecipients $recipients recipients + * @param \Brevo\Client\Models\UpdateEmailCampaignRecipients $recipients recipients * * @return $this */ diff --git a/lib/Model/UpdateEmailCampaignRecipients.php b/lib/Models/UpdateEmailCampaignRecipients.php similarity index 99% rename from lib/Model/UpdateEmailCampaignRecipients.php rename to lib/Models/UpdateEmailCampaignRecipients.php index 11e1e8a..2a2bc8d 100644 --- a/lib/Model/UpdateEmailCampaignRecipients.php +++ b/lib/Models/UpdateEmailCampaignRecipients.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -169,9 +169,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/UpdateEmailCampaignSender.php b/lib/Models/UpdateEmailCampaignSender.php similarity index 99% rename from lib/Model/UpdateEmailCampaignSender.php rename to lib/Models/UpdateEmailCampaignSender.php index a0e3f2d..996d840 100644 --- a/lib/Model/UpdateEmailCampaignSender.php +++ b/lib/Models/UpdateEmailCampaignSender.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/UpdateExternalFeed.php b/lib/Models/UpdateExternalFeed.php similarity index 98% rename from lib/Model/UpdateExternalFeed.php rename to lib/Models/UpdateExternalFeed.php index f6034cc..26bc855 100644 --- a/lib/Model/UpdateExternalFeed.php +++ b/lib/Models/UpdateExternalFeed.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -63,7 +63,7 @@ class UpdateExternalFeed implements ModelInterface, ArrayAccess 'username' => 'string', 'password' => 'string', 'token' => 'string', - 'headers' => '\Brevo\Client\Model\GetExternalFeedByUUIDHeaders[]', + 'headers' => '\Brevo\Client\Models\GetExternalFeedByUUIDHeaders[]', 'maxRetries' => 'int', 'cache' => 'bool' ]; @@ -201,9 +201,9 @@ public function getModelName() const AUTH_TYPE_BASIC = 'basic'; const AUTH_TYPE_TOKEN = 'token'; const AUTH_TYPE_NO_AUTH = 'noAuth'; - - + + /** * Gets allowable values of the enum * @@ -217,7 +217,7 @@ public function getAuthTypeAllowableValues() self::AUTH_TYPE_NO_AUTH, ]; } - + /** * Associative array for storing property values @@ -441,7 +441,7 @@ public function setToken($token) /** * Gets headers * - * @return \Brevo\Client\Model\GetExternalFeedByUUIDHeaders[] + * @return \Brevo\Client\Models\GetExternalFeedByUUIDHeaders[] */ public function getHeaders() { @@ -451,7 +451,7 @@ public function getHeaders() /** * Sets headers * - * @param \Brevo\Client\Model\GetExternalFeedByUUIDHeaders[] $headers Custom headers for the feed + * @param \Brevo\Client\Models\GetExternalFeedByUUIDHeaders[] $headers Custom headers for the feed * * @return $this */ diff --git a/lib/Model/UpdateList.php b/lib/Models/UpdateList.php similarity index 99% rename from lib/Model/UpdateList.php rename to lib/Models/UpdateList.php index 076cbe5..1413509 100644 --- a/lib/Model/UpdateList.php +++ b/lib/Models/UpdateList.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/UpdateSender.php b/lib/Models/UpdateSender.php similarity index 96% rename from lib/Model/UpdateSender.php rename to lib/Models/UpdateSender.php index 7f5548a..f847c8d 100644 --- a/lib/Model/UpdateSender.php +++ b/lib/Models/UpdateSender.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -59,7 +59,7 @@ class UpdateSender implements ModelInterface, ArrayAccess protected static $swaggerTypes = [ 'name' => 'string', 'email' => 'string', - 'ips' => '\Brevo\Client\Model\CreateSenderIps[]' + 'ips' => '\Brevo\Client\Models\CreateSenderIps[]' ]; /** @@ -168,9 +168,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -267,7 +267,7 @@ public function setEmail($email) /** * Gets ips * - * @return \Brevo\Client\Model\CreateSenderIps[] + * @return \Brevo\Client\Models\CreateSenderIps[] */ public function getIps() { @@ -277,7 +277,7 @@ public function getIps() /** * Sets ips * - * @param \Brevo\Client\Model\CreateSenderIps[] $ips Only in case of dedicated IP, IPs to associate to the sender. If passed, will replace all the existing IPs. + * @param \Brevo\Client\Models\CreateSenderIps[] $ips Only in case of dedicated IP, IPs to associate to the sender. If passed, will replace all the existing IPs. * * @return $this */ diff --git a/lib/Model/UpdateSmsCampaign.php b/lib/Models/UpdateSmsCampaign.php similarity index 98% rename from lib/Model/UpdateSmsCampaign.php rename to lib/Models/UpdateSmsCampaign.php index b7eea8a..85122a3 100644 --- a/lib/Model/UpdateSmsCampaign.php +++ b/lib/Models/UpdateSmsCampaign.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -60,7 +60,7 @@ class UpdateSmsCampaign implements ModelInterface, ArrayAccess 'name' => 'string', 'sender' => 'string', 'content' => 'string', - 'recipients' => '\Brevo\Client\Model\CreateSmsCampaignRecipients', + 'recipients' => '\Brevo\Client\Models\CreateSmsCampaignRecipients', 'scheduledAt' => 'string', 'unicodeEnabled' => 'bool', 'organisationPrefix' => 'string', @@ -193,9 +193,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -329,7 +329,7 @@ public function setContent($content) /** * Gets recipients * - * @return \Brevo\Client\Model\CreateSmsCampaignRecipients + * @return \Brevo\Client\Models\CreateSmsCampaignRecipients */ public function getRecipients() { @@ -339,7 +339,7 @@ public function getRecipients() /** * Sets recipients * - * @param \Brevo\Client\Model\CreateSmsCampaignRecipients $recipients recipients + * @param \Brevo\Client\Models\CreateSmsCampaignRecipients $recipients recipients * * @return $this */ diff --git a/lib/Model/UpdateSmtpTemplate.php b/lib/Models/UpdateSmtpTemplate.php similarity index 98% rename from lib/Model/UpdateSmtpTemplate.php rename to lib/Models/UpdateSmtpTemplate.php index a9d6dba..90ca350 100644 --- a/lib/Model/UpdateSmtpTemplate.php +++ b/lib/Models/UpdateSmtpTemplate.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -58,7 +58,7 @@ class UpdateSmtpTemplate implements ModelInterface, ArrayAccess */ protected static $swaggerTypes = [ 'tag' => 'string', - 'sender' => '\Brevo\Client\Model\UpdateSmtpTemplateSender', + 'sender' => '\Brevo\Client\Models\UpdateSmtpTemplateSender', 'templateName' => 'string', 'htmlContent' => 'string', 'htmlUrl' => 'string', @@ -203,9 +203,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values @@ -285,7 +285,7 @@ public function setTag($tag) /** * Gets sender * - * @return \Brevo\Client\Model\UpdateSmtpTemplateSender + * @return \Brevo\Client\Models\UpdateSmtpTemplateSender */ public function getSender() { @@ -295,7 +295,7 @@ public function getSender() /** * Sets sender * - * @param \Brevo\Client\Model\UpdateSmtpTemplateSender $sender sender + * @param \Brevo\Client\Models\UpdateSmtpTemplateSender $sender sender * * @return $this */ diff --git a/lib/Model/UpdateSmtpTemplateSender.php b/lib/Models/UpdateSmtpTemplateSender.php similarity index 99% rename from lib/Model/UpdateSmtpTemplateSender.php rename to lib/Models/UpdateSmtpTemplateSender.php index 6997349..037ec9c 100644 --- a/lib/Model/UpdateSmtpTemplateSender.php +++ b/lib/Models/UpdateSmtpTemplateSender.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; diff --git a/lib/Model/UpdateWebhook.php b/lib/Models/UpdateWebhook.php similarity index 96% rename from lib/Model/UpdateWebhook.php rename to lib/Models/UpdateWebhook.php index 6b8d016..c3df9b8 100644 --- a/lib/Model/UpdateWebhook.php +++ b/lib/Models/UpdateWebhook.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -62,8 +62,8 @@ class UpdateWebhook implements ModelInterface, ArrayAccess 'events' => 'string[]', 'domain' => 'string', 'batched' => 'bool', - 'auth' => '\Brevo\Client\Model\GetWebhookAuth', - 'headers' => '\Brevo\Client\Model\GetWebhookHeaders[]' + 'auth' => '\Brevo\Client\Models\GetWebhookAuth', + 'headers' => '\Brevo\Client\Models\GetWebhookHeaders[]' ]; /** @@ -417,7 +417,7 @@ public function setBatched($batched) /** * Gets auth * - * @return \Brevo\Client\Model\GetWebhookAuth + * @return \Brevo\Client\Models\GetWebhookAuth */ public function getAuth() { @@ -427,7 +427,7 @@ public function getAuth() /** * Sets auth * - * @param \Brevo\Client\Model\GetWebhookAuth $auth auth + * @param \Brevo\Client\Models\GetWebhookAuth $auth auth * * @return $this */ @@ -441,7 +441,7 @@ public function setAuth($auth) /** * Gets headers * - * @return \Brevo\Client\Model\GetWebhookHeaders[] + * @return \Brevo\Client\Models\GetWebhookHeaders[] */ public function getHeaders() { @@ -451,7 +451,7 @@ public function getHeaders() /** * Sets headers * - * @param \Brevo\Client\Model\GetWebhookHeaders[] $headers Custom headers to be send with webhooks + * @param \Brevo\Client\Models\GetWebhookHeaders[] $headers Custom headers to be send with webhooks * * @return $this */ diff --git a/lib/Model/UpdateWhatsAppCampaign.php b/lib/Models/UpdateWhatsAppCampaign.php similarity index 97% rename from lib/Model/UpdateWhatsAppCampaign.php rename to lib/Models/UpdateWhatsAppCampaign.php index 20a4879..8affe31 100644 --- a/lib/Model/UpdateWhatsAppCampaign.php +++ b/lib/Models/UpdateWhatsAppCampaign.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -60,7 +60,7 @@ class UpdateWhatsAppCampaign implements ModelInterface, ArrayAccess 'campaignName' => 'string', 'campaignStatus' => 'string', 'rescheduleFor' => 'string', - 'recipients' => '\Brevo\Client\Model\CreateWhatsAppCampaignRecipients' + 'recipients' => '\Brevo\Client\Models\CreateWhatsAppCampaignRecipients' ]; /** @@ -329,7 +329,7 @@ public function setRescheduleFor($rescheduleFor) /** * Gets recipients * - * @return \Brevo\Client\Model\CreateWhatsAppCampaignRecipients + * @return \Brevo\Client\Models\CreateWhatsAppCampaignRecipients */ public function getRecipients() { @@ -339,7 +339,7 @@ public function getRecipients() /** * Sets recipients * - * @param \Brevo\Client\Model\CreateWhatsAppCampaignRecipients $recipients recipients + * @param \Brevo\Client\Models\CreateWhatsAppCampaignRecipients $recipients recipients * * @return $this */ diff --git a/lib/Model/UploadImageModel.php b/lib/Models/UploadImageModel.php similarity index 99% rename from lib/Model/UploadImageModel.php rename to lib/Models/UploadImageModel.php index 7285b8f..4f64eb4 100644 --- a/lib/Model/UploadImageModel.php +++ b/lib/Models/UploadImageModel.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -158,9 +158,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/UploadImageToGallery.php b/lib/Models/UploadImageToGallery.php similarity index 99% rename from lib/Model/UploadImageToGallery.php rename to lib/Models/UploadImageToGallery.php index 7510add..3b7124a 100644 --- a/lib/Model/UploadImageToGallery.php +++ b/lib/Models/UploadImageToGallery.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -163,9 +163,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/VariablesItems.php b/lib/Models/VariablesItems.php similarity index 99% rename from lib/Model/VariablesItems.php rename to lib/Models/VariablesItems.php index e6c6864..6e2af07 100644 --- a/lib/Model/VariablesItems.php +++ b/lib/Models/VariablesItems.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -168,9 +168,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/WhatsappCampStats.php b/lib/Models/WhatsappCampStats.php similarity index 99% rename from lib/Model/WhatsappCampStats.php rename to lib/Models/WhatsappCampStats.php index 8aacad6..9e92538 100644 --- a/lib/Model/WhatsappCampStats.php +++ b/lib/Models/WhatsappCampStats.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -178,9 +178,9 @@ public function getModelName() return self::$swaggerModelName; } - - + + /** * Associative array for storing property values diff --git a/lib/Model/WhatsappCampTemplate.php b/lib/Models/WhatsappCampTemplate.php similarity index 95% rename from lib/Model/WhatsappCampTemplate.php rename to lib/Models/WhatsappCampTemplate.php index 21e1005..8614d26 100644 --- a/lib/Model/WhatsappCampTemplate.php +++ b/lib/Models/WhatsappCampTemplate.php @@ -27,7 +27,7 @@ * Do not edit the class manually. */ -namespace Brevo\Client\Model; +namespace Brevo\Client\Models; use \ArrayAccess; use \Brevo\Client\ObjectSerializer; @@ -63,9 +63,9 @@ class WhatsappCampTemplate implements ModelInterface, ArrayAccess 'containsButton' => 'bool', 'displayHeader' => 'bool', 'headerType' => 'string', - 'components' => '\Brevo\Client\Model\ComponentItems[]', - 'headerVariables' => '\Brevo\Client\Model\VariablesItems[]', - 'bodyVariables' => '\Brevo\Client\Model\VariablesItems[]', + 'components' => '\Brevo\Client\Models\ComponentItems[]', + 'headerVariables' => '\Brevo\Client\Models\VariablesItems[]', + 'bodyVariables' => '\Brevo\Client\Models\VariablesItems[]', 'buttonType' => 'string', 'hideFooter' => 'bool' ]; @@ -411,7 +411,7 @@ public function setHeaderType($headerType) /** * Gets components * - * @return \Brevo\Client\Model\ComponentItems[] + * @return \Brevo\Client\Models\ComponentItems[] */ public function getComponents() { @@ -421,7 +421,7 @@ public function getComponents() /** * Sets components * - * @param \Brevo\Client\Model\ComponentItems[] $components array of component item objects + * @param \Brevo\Client\Models\ComponentItems[] $components array of component item objects * * @return $this */ @@ -435,7 +435,7 @@ public function setComponents($components) /** * Gets headerVariables * - * @return \Brevo\Client\Model\VariablesItems[] + * @return \Brevo\Client\Models\VariablesItems[] */ public function getHeaderVariables() { @@ -445,7 +445,7 @@ public function getHeaderVariables() /** * Sets headerVariables * - * @param \Brevo\Client\Model\VariablesItems[] $headerVariables array of variables item object + * @param \Brevo\Client\Models\VariablesItems[] $headerVariables array of variables item object * * @return $this */ @@ -459,7 +459,7 @@ public function setHeaderVariables($headerVariables) /** * Gets bodyVariables * - * @return \Brevo\Client\Model\VariablesItems[] + * @return \Brevo\Client\Models\VariablesItems[] */ public function getBodyVariables() { @@ -469,7 +469,7 @@ public function getBodyVariables() /** * Sets bodyVariables * - * @param \Brevo\Client\Model\VariablesItems[] $bodyVariables array of variables item variables + * @param \Brevo\Client\Models\VariablesItems[] $bodyVariables array of variables item variables * * @return $this */ From c8105ee8ce91556877940f990be11ff38f45a238 Mon Sep 17 00:00:00 2001 From: Damien TUPINIER Date: Sun, 24 Nov 2024 19:27:17 +0100 Subject: [PATCH 3/8] Add Swagger definition for Brevo API v3 --- swagger_definition_v3.yml | 25383 ++++++++++++++++++++++++++++++++++++ 1 file changed, 25383 insertions(+) create mode 100644 swagger_definition_v3.yml diff --git a/swagger_definition_v3.yml b/swagger_definition_v3.yml new file mode 100644 index 0000000..36cbea4 --- /dev/null +++ b/swagger_definition_v3.yml @@ -0,0 +1,25383 @@ +openapi: 3.0.1 +info: + title: Brevo API + description: | + Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : + - Manage your campaigns and get the statistics + - Manage your contacts + - Send transactional Emails and SMS + - and much more... + + You can download our wrappers at https://github.com/orgs/brevo + + **Possible responses** + | Code | Message | + | :-------------: | ------------- | + | 200 | OK. Successful Request | + | 201 | OK. Successful Creation | + | 202 | OK. Request accepted | + | 204 | OK. Successful Update/Deletion | + | 400 | Error. Bad Request | + | 401 | Error. Authentication Needed | + | 402 | Error. Not enough credit, plan upgrade needed | + | 403 | Error. Permission denied | + | 404 | Error. Object does not exist | + | 405 | Error. Method not allowed | + | 406 | Error. Not Acceptable | + | 422 | Error. Unprocessable Entity | + contact: + name: Brevo Support + url: https://account.brevo.com/support + email: contact@brevo.com + license: + name: MIT + url: http://opensource.org/licenses/MIT + version: 3.0.0 +servers: +- url: https://api.brevo.com/v3 +security: +- api-key: [] +paths: + /emailCampaigns: + get: + tags: + - Email Campaigns + summary: Return all your created email campaigns + operationId: getEmailCampaigns + parameters: + - name: type + in: query + description: Filter on the type of the campaigns + schema: + type: string + enum: + - classic + - trigger + - name: status + in: query + description: Filter on the status of the campaign + schema: + type: string + enum: + - suspended + - archive + - sent + - queued + - draft + - inProcess + - name : statistics + in : query + description : Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response.This option only returns data for events occurred in the last 6 months.For older campaigns, it’s advisable to use the **Get Campaign Report** endpoint. + schema: + type: string + enum: + - globalStats + - linksStats + - statsByDomain + - name: startDate + in: query + description: | + **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. + **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. + **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) + schema: + type: string + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 100 + minimum: 0 + type: integer + format: int64 + default: 50 + - name: offset + in: query + description: Index of the first document in the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + - name: excludeHtmlContent + in : query + description: Use this flag to exclude htmlContent from the response body. If set to **true**, htmlContent field will be returned as empty string in the response body + schema : + type : boolean + enum : + - true + - false + responses: + 200: + description: Email campaigns informations + content: + application/json: + schema: + $ref: '#/components/schemas/getEmailCampaigns' + examples: + response: + value: + count: 2 + campaigns: + - id: 12 + name: EN - Sales Summer 2017 + subject: 20% OFF for 2017 Summer Sales + previewText: Don't miss the sale + type: classic + status: sent + scheduledAt: 2017-06-01T12:30:00Z + testSent: true + header: '[DEFAULT_HEADER]' + footer: '[DEFAULT_FOOTER]' + sender: + email: marketing@mycompany.com + name: Marketing + id: 26 + replyTo: replyto@domain.com + toField: '{FNAME} {LNAME}' + htmlContent: This is my HTML Content + shareLink: http://example.com/fhsgccc.html?t=9865448900 + tag: Newsletter + createdAt: 2017-05-01T12:30:00Z + modifiedAt: 2017-05-01T12:30:00Z + inlineImageActivation: true + mirrorActive: true + recurring: false + recipients: + lists: + - 5 + exclusionLists: + - 13 + statistics: + globalStats: + uniqueClicks: 2300 + clickers: 2665 + complaints: 1 + delivered: 19765 + sent: 19887 + softBounces: 100 + hardBounces: 87 + uniqueViews: 7779 + trackableViews: 5661 + trackableViewsRate: 23.45 + estimatedViews: 560 + unsubscriptions: 2 + viewed: 8999 + campaignStats: + - listId: 5 + uniqueClicks: 2300 + clickers: 2665 + complaints: 1 + delivered: 19765 + sent: 19887 + softBounces: 100 + hardBounces: 87 + uniqueViews: 7779 + trackableViews: 5661 + unsubscriptions: 2 + viewed: 8999 + deferred: 30 + mirrorClick: 120 + remaining: 1000 + linksStats: + http://myUrl1.domain.com: 80 + statsByDomain: + yahoo.com: + uniqueClicks: 298 + clickers: 533 + complaints: 0 + sent: 25601 + softBounces: 5 + hardBounces: 0 + uniqueViews: 3527 + unsubscriptions: 17 + viewed: 5255 + delivered: 25596 + hotmail.co.uk: + uniqueClicks: 1970 + clickers: 2720 + complaints: 5 + sent: 117055 + softBounces: 111 + hardBounces: 0 + uniqueViews: 21111 + unsubscriptions: 105 + viewed: 35251 + delivered: 117056 + - id: 22 + name: Weekly - 1 + subject: Week 1 - Newsletter + previewText: your weekly newsletter + type: Classic + status: draft + scheduledAt: "" + testSent: false + header: '[DEFAULT_HEADER]' + footer: '[DEFAULT_FOOTER]' + sender: + email: newsletter@mycompany.com + name: Newsletter + id: 26 + replyTo: replyto@domain.com + toField: '{FNAME} {LNAME}' + htmlContent: This is my HTML Content + shareLink: http://example.com/fhsgccc.html?t=9865448900 + tag: Newsletter + createdAt: 2017-05-01T12:30:00Z + modifiedAt: 2017-05-01T12:30:00Z + inlineImageActivation: true + mirrorActive: true + recurring: false + recipients: + lists: + - 10 + exclusionLists: + - 45 + statistics: + globalStats: + uniqueClicks: 2300 + clickers: 2665 + complaints: 1 + delivered: 19765 + sent: 19887 + softBounces: 100 + hardBounces: 87 + uniqueViews: 7779 + trackableViews: 5661 + trackableViewsRate: 23.45 + estimatedViews: 560 + unsubscriptions: 2 + viewed: 8999 + campaignStats: + - listId: 10 + uniqueClicks: 2300 + clickers: 2665 + complaints: 1 + delivered: 19765 + sent: 19887 + softBounces: 100 + hardBounces: 87 + uniqueViews: 7779 + trackableViews: 5661 + unsubscriptions: 2 + viewed: 8999 + deferred: 30 + mirrorClick: 120 + remaining: 1000 + linksStats: + http://myUrl1.domain.com: + nbClick: 80 + http://myUrl2.domain.com: + nbClick: 80 + http://myUrl3.domain.com: + nbClick: 80 + statsByDomain: + gmail: + uniqueClicks: 2300 + clickers: 2665 + complaints: 1 + delivered: 19765 + sent: 19887 + softBounces: 100 + hardBounces: 87 + uniqueViews: 7779 + unsubscriptions: 2 + viewed: 8999 + deferred: 30 + aol: + uniqueClicks: 2300 + clickers: 2665 + complaints: 1 + delivered: 19765 + sent: 19887 + softBounces: 100 + hardBounces: 87 + uniqueViews: 7779 + unsubscriptions: 2 + viewed: 8999 + deferred: 30 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + post: + tags: + - Email Campaigns + summary: Create an email campaign + operationId: createEmailCampaign + requestBody: + description: Values to create a campaign + content: + application/json: + schema: + $ref: '#/components/schemas/createEmailCampaign' + required: true + responses: + 201: + $ref: '#/components/responses/createModel' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /emailCampaigns/{campaignId}: + get: + tags: + - Email Campaigns + summary: Get an email campaign report + operationId: getEmailCampaign + parameters: + - name: campaignId + in: path + description: Id of the campaign + required: true + schema: + type: integer + format: int64 + - name : statistics + in : query + description : Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. + required: false + schema: + type: string + enum: + - globalStats + - linksStats + - statsByDomain + - statsByDevice + - statsByBrowser + responses: + 200: + description: Email campaign informations + content: + application/json: + schema: + $ref: '#/components/schemas/getEmailCampaign' + examples: + response: + value: + id: 22 + name: Weekly - 1 + subject: Week 1 - Newsletter + previewText: your weekly newsletter! + type: classic + status: draft + scheduledAt: 2017-09-22T12:30:00Z + testSent: false + header: '[DEFAULT_HEADER]' + footer: '[DEFAULT_FOOTER]' + sender: + email: newsletter@mycompany.com + name: Newsletter + id: 26 + replyTo: replyto@domain.com + toField: '{FNAME} {LNAME}' + htmlContent: This is my HTML Content + shareLink: http://dhh.brevo.com/fhsgccc.html?t=9865448900 + tag: Newsletter + createdAt: 2017-05-01T12:30:00Z + modifiedAt: 2017-05-01T12:30:00Z + inlineImageActivation: true + mirrorActive: true + recurring: false + recipients: + lists: + - 22 + exclusionLists: + - 45 + statistics: + globalStats: + uniqueClicks: 2300 + clickers: 2665 + complaints: 1 + delivered: 19765 + sent: 19887 + softBounces: 100 + hardBounces: 87 + uniqueViews: 7779 + trackableViews: 5661 + trackableViewsRate: 23.45 + estimatedViews: 560 + unsubscriptions: 2 + viewed: 8999 + campaignStats: + - listId: 22 + uniqueClicks: 2300 + clickers: 2665 + complaints: 1 + delivered: 19765 + sent: 19887 + softBounces: 100 + hardBounces: 87 + uniqueViews: 7779 + trackableViews: 5661 + unsubscriptions: 2 + viewed: 8999 + deferred: 30 + mirrorClick: 120 + remaining: 1000 + linksStats: + http://myUrl1.domain.com: + nbClick: 80 + http://myUrl2.domain.com: + nbClick: 80 + http://myUrl3.domain.com: + nbClick: 80 + statsByDomain: + gmail: + uniqueClicks: 2300 + clickers: 2665 + complaints: 1 + delivered: 19765 + sent: 19887 + softBounces: 100 + hardBounces: 87 + uniqueViews: 7779 + unsubscriptions: 2 + viewed: 8999 + deferred: 30 + statsByDevice: + desktop: + mac: + clickers: 1 + uniqueClicks: 0 + viewed: 2 + uniqueViews: 1 + mobile: + androidMobile: + clickers: 1 + uniqueClicks: 0 + viewed: 1 + uniqueViews: 0 + iPhone: + clickers: 1 + uniqueClicks: 0 + viewed: 2 + uniqueViews: 0 + statsByBrowser: + thunderbird: + clickers: 1 + uniqueClicks: 0 + viewed: 1 + uniqueViews: 0 + safari: + clickers: 1 + uniqueClicks: 0 + viewed: 1 + uniqueViews: 0 + internetExplorer: + clickers: 0 + uniqueClicks: 0 + viewed: 1 + uniqueViews: 0 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Campaign ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + put: + tags: + - Email Campaigns + summary: Update an email campaign + operationId: updateEmailCampaign + parameters: + - name: campaignId + in: path + description: Id of the campaign + required: true + schema: + type: integer + format: int64 + requestBody: + description: Values to update a campaign + content: + application/json: + schema: + $ref: '#/components/schemas/updateEmailCampaign' + required: true + responses: + 204: + description: Email campaign updated + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Campaign ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + delete: + tags: + - Email Campaigns + summary: Delete an email campaign + operationId: deleteEmailCampaign + parameters: + - name: campaignId + in: path + description: id of the campaign + required: true + schema: + type: integer + format: int64 + responses: + 204: + description: Email campaign has been deleted + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Campaign ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /emailCampaigns/{campaignId}/sendNow: + post: + tags: + - Email Campaigns + summary: Send an email campaign immediately, based on campaignId + operationId: sendEmailCampaignNow + parameters: + - name: campaignId + in: path + description: Id of the campaign + required: true + schema: + type: integer + format: int64 + responses: + 204: + description: Email campaign has been scheduled + content: {} + 400: + description: Campaign could not be sent + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 402: + description: You don't have enough credit to send your campaign. Please update your plan + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Campaign ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /emailCampaigns/{campaignId}/sendTest: + post: + tags: + - Email Campaigns + summary: Send an email campaign to your test list + operationId: sendTestEmail + parameters: + - name: campaignId + in: path + description: Id of the campaign + required: true + schema: + type: integer + format: int64 + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/sendTestEmail' + required: true + responses: + 204: + description: Test email has been sent successfully to all recipients + content: {} + 400: + description: Test email could not be sent to the following email addresses + content: + application/json: + schema: + $ref: '#/components/schemas/postSendFailed' + 404: + description: Campaign ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/postSendFailed' + /emailCampaigns/{campaignId}/status: + put: + tags: + - Email Campaigns + summary: Update an email campaign status + operationId: updateCampaignStatus + parameters: + - name: campaignId + in: path + description: Id of the campaign + required: true + schema: + type: integer + format: int64 + requestBody: + description: Status of the campaign + content: + application/json: + schema: + $ref: '#/components/schemas/updateCampaignStatus' + required: true + responses: + 204: + description: The campaign status has been updated successfully + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Campaign ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /emailCampaigns/{campaignId}/sendReport: + post: + tags: + - Email Campaigns + summary: Send the report of a campaign + description: A PDF will be sent to the specified email addresses + operationId: sendReport + parameters: + - name: campaignId + in: path + description: Id of the campaign + required: true + schema: + type: integer + format: int64 + requestBody: + description: Values for send a report + content: + application/json: + schema: + $ref: '#/components/schemas/sendReport' + required: true + responses: + 204: + description: Report has been successfully sent to the defined recipients + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Campaign ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /emailCampaigns/{campaignId}/abTestCampaignResult: + get: + tags: + - Email Campaigns + summary: Get an A/B test email campaign results + description: Obtain winning version of an A/B test email campaign + operationId: getAbTestCampaignResult + parameters: + - name: campaignId + in: path + description: Id of the A/B test campaign + required: true + schema: + type: integer + format: int64 + responses: + 200: + description: A/B test email campaign Result + content: + application/json: + schema: + $ref: '#/components/schemas/abTestCampaignResult' + examples: + response: + value: + winningVersion: B + winningCriteria: Click + openRate: 100% + clickRate: 50% + winningVersionRate: 0% + statistics: + openers: + Version A: 20% + Version B: 100% + clicks: + Version A: 0% + Version B: 50% + unsubscribed: + Version A: 20% + Version B: 0% + softBounces: + Version A: 0% + Version B: 0% + hardBounces: + Version A: 0% + Version B: 0% + complaints: + Version A: 0% + Version B: 0% + clickedLinks: + Version A: + - link: https://google.com + clicksCount: 0 + clickRate: 0% + - link: https://youtube.com + clicksCount: 0 + clickRate: 0% + Version B: + - link: http://www.github.com + clicksCount: 2 + clickRate: 40% + - link: http://www.stackoverflow.com + clicksCount: 3 + clickRate: 60% + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: A/B test Email Campaign not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /emailCampaigns/{campaignId}/sharedUrl: + get: + tags: + - Email Campaigns + summary: Get a shared template url + description: Get a unique URL to share & import an email template from one Brevo + account to another. + operationId: getSharedTemplateUrl + parameters: + - name: campaignId + in: path + description: Id of the campaign or template + required: true + schema: + type: integer + format: int64 + responses: + 200: + description: Shared template URL information + content: + application/json: + schema: + $ref: '#/components/schemas/getSharedTemplateUrl' + examples: + response: + value: + sharedUrl: https://my.brevo.com/pt2YU7R5W_guXlowgumy_VX4pFsKu._zd0Gjj96x1_GMmzc1Qps5ZIpj6nx- + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Campaign/Template ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 405: + description: Only email campaigns or templates are allowed + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /emailCampaigns/{campaignId}/exportRecipients: + post: + tags: + - Email Campaigns + summary: Export the recipients of an email campaign + operationId: emailExportRecipients + parameters: + - name: campaignId + in: path + description: Id of the campaign + required: true + schema: + type: integer + format: int64 + requestBody: + description: Values to send for a recipient export request + content: + application/json: + schema: + $ref: '#/components/schemas/emailExportRecipients' + required: false + responses: + 202: + $ref: '#/components/responses/createdProcessId' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Campaign ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /emailCampaigns/images: + post: + tags: + - Email Campaigns + summary: Upload an image to your account's image gallery + operationId: uploadImageToGallery + requestBody: + description: Parameters to upload an image + content: + application/json: + schema: + $ref: '#/components/schemas/uploadImageToGallery' + required: true + responses: + 201: + description: Image has been successfully uploaded + content: + application/json: + schema: + $ref: '#/components/schemas/uploadImageModel' + examples: + response: + value: + url: 'https://img.mailinblue.com/100000/images/rnb/original/62casdase8wewq9df1c2f27c.jpeg' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /smtp/email: + post: + tags: + - Transactional emails + summary: Send a transactional email + operationId: sendTransacEmail + requestBody: + description: Values to send a transactional email + content: + application/json: + schema: + $ref: '#/components/schemas/sendSmtpEmail' + required: true + responses: + 201: + description: transactional email sent + content: + application/json: + schema: + $ref: '#/components/schemas/createSmtpEmail' + examples: + response: + value: + messageId: '<201798300811.5787683@relay.domain.com>' + 202: + description: transactional email scheduled + content: + application/json: + schema: + $ref: '#/components/schemas/scheduleSmtpEmail' + examples: + response: + value: + messageId: '<201798300811.5787683@relay.domain.com>' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /smtp/emails: + get: + tags: + - Transactional emails + summary: Get the list of transactional emails on the basis of allowed filters + description: This endpoint will show the list of emails for past 30 days by + default. To retrieve emails before that time, please pass startDate and endDate + in query filters. + operationId: getTransacEmailsList + parameters: + - name: email + in: query + description: | + **Mandatory if templateId and messageId are not passed in query filters.** Email address to which transactional email has been sent. + schema: + type: string + - name: templateId + in: query + description: | + **Mandatory if email and messageId are not passed in query filters.** Id of the template that was used to compose transactional email. + schema: + type: integer + format: int64 + - name: messageId + in: query + description: | + **Mandatory if templateId and email are not passed in query filters.** Message ID of the transactional email sent. + schema: + type: string + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the list. **Maximum time period that can be selected is one month**. + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the list. **Maximum time period that can be selected is one month.** + schema: + type: string + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + - name: limit + in: query + description: Number of documents returned per page + schema: + maximum: 1000 + minimum: 0 + type: integer + format: int64 + default: 500 + - name: offset + in: query + description: Index of the first document in the page + schema: + type: integer + format: int64 + default: 0 + responses: + 200: + description: List of transactional emails + content: + application/json: + schema: + $ref: '#/components/schemas/getTransacEmailsList' + examples: + response: + value: + count: 120 + transactionalEmails: + - email: abc@xyz.com + subject: summer camp + templateId: 15 + messageId: <201798300811.5787683@relay.domain.com> + uuid: 5a78c-209ok98262910-std2341 + date: 2019-05-25T11:53:26Z + - email: test@test.com + subject: details verification + templateId: 15 + messageId: <201798300811.5700093@relay.domain.com> + uuid: 5a78c-209ok98262910-s99a341 + date: 2019-05-25T07:28:11Z + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /smtp/emails/{uuid}: + get: + tags: + - Transactional emails + summary: Get the personalized content of a sent transactional email + operationId: getTransacEmailContent + parameters: + - name: uuid + in: path + description: Unique id of the transactional email that has been sent to a + particular contact + required: true + schema: + type: string + responses: + 200: + description: Transactional email content + content: + application/json: + schema: + $ref: '#/components/schemas/getTransacEmailContent' + examples: + response: + value: + email: abc@example.com + subject: Summer Camps + templateId: 12 + date: 2016-02-25T11:53:26Z + events: + - name: sent + time: 2016-02-25T11:53:26Z + - name: delivered + time: 2016-02-25T11:55:26Z + - name: opened + time: 2016-02-26T09:53:26Z + body:

Greetings from the team

+

This is the actual html content sent

+ /smtp/log/{identifier}: + delete: + tags: + - Transactional emails + summary: Delete an SMTP transactional log + parameters: + - name: identifier + in: path + description: MessageId or Email of the transactional log(s) to delete + required: true + schema: + type: string + responses: + 204: + description: Transactional Logs deleted + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Message ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /smtp/templates: + get: + tags: + - Transactional emails + summary: Get the list of email templates + operationId: getSmtpTemplates + parameters: + - name: templateStatus + in: query + description: Filter on the status of the template. Active = true, inactive + = false + schema: + type: boolean + - name: limit + in: query + description: Number of documents returned per page + schema: + maximum: 1000 + minimum: 0 + type: integer + format: int64 + default: 50 + - name: offset + in: query + description: Index of the first document in the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + responses: + 200: + description: transactional email templates informations + content: + application/json: + schema: + $ref: '#/components/schemas/getSmtpTemplates' + examples: + response: + value: + count: 2 + templates: + - id: 5 + name: ChristomasTimeTemplate + subject: Merry Christmas + isActive: false + testSent: false + sender: + name: John + email: john.smith@example.com + id: 23 + replyTo: replyto@domain.com + toField: "" + tag: Festival + htmlContent: HTML CONTENT 1 + createdAt: 2016-02-24T14:44:24Z + modifiedAt: 2016-02-24T15:37:11Z + - id: 12 + name: SummerSales2017Template + subject: Enjoy our summer Sales ! + isActive: true + testSent: false + sender: + name: John + email: john.smith@example.com + id: 23 + replyTo: replyto@domain.com + toField: "" + tag: Summer + htmlContent: HTML CONTENT 2 + createdAt: 2016-02-25T11:53:26Z + modifiedAt: 2016-02-25T11:53:26Z + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + post: + tags: + - Transactional emails + summary: Create an email template + operationId: createSmtpTemplate + requestBody: + description: values to update in transactional email template + content: + application/json: + schema: + $ref: '#/components/schemas/createSmtpTemplate' + required: true + responses: + 201: + # transactional email template created + $ref: '#/components/responses/createModel' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /smtp/templates/{templateId}: + get: + tags: + - Transactional emails + summary: Returns the template information + operationId: getSmtpTemplate + parameters: + - name: templateId + in: path + description: id of the template + required: true + schema: + type: integer + format: int64 + responses: + 200: + description: Email template informations + content: + application/json: + schema: + $ref: '#/components/schemas/getSmtpTemplateOverview' + examples: + response: + value: + id: 33 + name: OrderConfirmation + subject: 'Order Confirmation : Thanks for your Purchase !' + isActive: true + testSent: false + sender: + name: John + email: john.smith@example.com + id: 26 + replyTo: replyto@domain.com + toField: "" + tag: "" + htmlContent: HTML CONTENT 4 + createdAt: 2016-02-25T11:53:26Z + modifiedAt: 2016-02-25T11:53:26Z + doiTemplate: false + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Template ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + put: + tags: + - Transactional emails + summary: Update an email template + operationId: updateSmtpTemplate + parameters: + - name: templateId + in: path + description: id of the template + required: true + schema: + type: integer + format: int64 + requestBody: + description: values to update in transactional email template + content: + application/json: + schema: + $ref: '#/components/schemas/updateSmtpTemplate' + required: true + responses: + 204: + description: transactional email template updated + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Template ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + delete: + tags: + - Transactional emails + summary: Delete an inactive email template + operationId: deleteSmtpTemplate + parameters: + - name: templateId + in: path + description: id of the template + required: true + schema: + type: integer + format: int64 + responses: + 204: + description: Inactive transactional email template has been deleted + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Template ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /smtp/templates/{templateId}/sendTest: + post: + tags: + - Transactional emails + summary: Send a template to your test list + operationId: sendTestTemplate + parameters: + - name: templateId + in: path + description: Id of the template + required: true + schema: + type: integer + format: int64 + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/sendTestEmail' + required: true + responses: + 204: + description: Test email has been sent successfully to all recipients + content: {} + 400: + description: Test email could not be sent to the following email addresses + content: + application/json: + schema: + $ref: '#/components/schemas/postSendFailed' + 404: + description: Template ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /smtp/statistics/aggregatedReport: + get: + tags: + - Transactional emails + summary: Get your transactional email activity aggregated over a period of time + description: This endpoint will show the aggregated stats for past 90 days by default if `startDate` and `endDate` OR `days` is not passed. The date range can not exceed 90 days + operationId: getAggregatedSmtpReport + parameters: + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate + schema: + type: string + - name: days + in: query + description: | + Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ + schema: + type: integer + format: int64 + - name: tag + in: query + description: Tag of the emails + schema: + type: string + responses: + 200: + description: Aggregated report informations + content: + application/json: + schema: + $ref: '#/components/schemas/getAggregatedReport' + examples: + response: + value: + range: 2016-09-08|2017-04-28 + requests: 19887 + delivered: 18996 + hardBounces: 234 + softBounces: 1533 + clicks: 9987 + uniqueClicks: 8766 + opens: 17654 + uniqueOpens: 13688 + spamReports: 1 + blocked: 2 + invalid: 0 + unsubscribed: 2 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /smtp/statistics/reports: + get: + tags: + - Transactional emails + summary: Get your transactional email activity aggregated per day + operationId: getSmtpReport + parameters: + - name: limit + in: query + description: Number of documents returned per page + schema: + maximum: 30 + minimum: 0 + type: integer + format: int64 + default: 10 + - name: offset + in: query + description: Index of the first document on the page + schema: + type: integer + format: int64 + default: 0 + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD) + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD) + schema: + type: string + - name: days + in: query + description: | + Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ + schema: + type: integer + format: int64 + - name: tag + in: query + description: Tag of the emails + schema: + type: string + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + responses: + 200: + description: Aggregated report informations + content: + application/json: + schema: + $ref: '#/components/schemas/getReports' + examples: + response: + value: + reports: + - date: 2017-04-30 + requests: 10756 + delivered: 10103 + hardBounces: 21 + softBounces: 137 + clicks: 1026 + uniqueClicks: 720 + opens: 5091 + uniqueOpens: 2318 + spamReports: 0 + blocked: 519 + invalid: 1 + unsubscribed: 0 + - date: 2017-05-01 + requests: 18812 + delivered: 17499 + hardBounces: 34 + softBounces: 254 + clicks: 1514 + uniqueClicks: 1090 + opens: 10089 + uniqueOpens: 4393 + spamReports: 0 + blocked: 920 + invalid: 2 + unsubscribed: 3 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /smtp/statistics/events: + get: + tags: + - Transactional emails + summary: Get all your transactional email activity (unaggregated events) + description: This endpoint will show the aggregated stats for past 30 days by default if `startDate` and `endDate` OR `days` is not passed. The date range can not exceed 90 days + operationId: getEmailEventReport + parameters: + - name: limit + in: query + description: Number limitation for the result returned + schema: + maximum: 5000 + type: integer + format: int64 + default: 2500 + minimum: 0 + - name: offset + in: query + description: Beginning point in the list to retrieve from. + schema: + type: integer + format: int64 + default: 0 + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate + schema: + type: string + - name: days + in: query + description: | + Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ + schema: + type: integer + format: int64 + - name: email + in: query + description: Filter the report for a specific email addresses + schema: + type: string + format: email + - name: event + in: query + description: Filter the report for a specific event type + schema: + type: string + enum: + - bounces + - hardBounces + - softBounces + - delivered + - spam + - requests + - opened + - clicks + - invalid + - deferred + - blocked + - unsubscribed + - error + - loadedByProxy + - name: tags + in: query + description: Filter the report for tags (serialized and urlencoded array). To pass multiple tags, a format of string separated by commas is used such as **"one, two, three"** + schema: + type: string + - name: messageId + in: query + description: Filter on a specific message id + schema: + type: string + - name: templateId + in: query + description: Filter on a specific template id + schema: + type: integer + format: int64 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + responses: + 200: + description: Email events report informations + content: + application/json: + schema: + $ref: '#/components/schemas/getEmailEventReport' + examples: + response: + value: + events: + - email: john.smith@example.com + date: 2017-03-12T12:30:00Z + messageId: <201798300811.5787683@example.domain.com> + event: deferred + reason: Error connection timeout + tag: OrderConfirmation + from: john@example.com + templateId: 4 + - email: john.smith@example.com + date: 2017-03-13T16:30:00Z + messageId: <201798300811.5787683@example.domain.com> + event: delivered + tag: OrderConfirmation + from: john@example.com + templateId: 5 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /smtp/blockedContacts/{email}: + delete: + tags: + - Transactional emails + summary: Unblock or resubscribe a transactional contact + parameters: + - name: email + in: path + description: contact email (urlencoded) to unblock. + required: true + schema: + type: string + responses: + 204: + description: Contact unblocked + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Contact email not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /smtp/blockedContacts: + get: + tags: + - Transactional emails + summary: Get the list of blocked or unsubscribed transactional contacts + operationId: getTransacBlockedContacts + parameters: + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the blocked or unsubscribed contacts + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the blocked or unsubscribed contacts + schema: + type: string + - name: limit + in: query + description: Number of documents returned per page + schema: + maximum: 100 + type: integer + format: int64 + default: 50 + minimum: 0 + - name: offset + in: query + description: Index of the first document on the page + schema: + type: integer + format: int64 + default: 0 + - name: senders + in: query + description: Comma separated list of emails of the senders from which contacts + are blocked or unsubscribed + style: form + explode: false + schema: + type: array + items: + type: string + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + responses: + 200: + description: List of blocked or unsubscribed transactional contacts + content: + application/json: + schema: + $ref: '#/components/schemas/getTransacBlockedContacts' + examples: + response: + value: + count: 1 + contacts: + - email: abc@xyz.com + senderEmail: ez312@gmal.com + reason: + message: Admin blocked + code: adminBlocked + blockedAt: 2017-05-01T12:30:00Z + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /smtp/blockedDomains: + get: + tags: + - Transactional emails + summary: Get the list of blocked domains + description: Get the list of blocked domains + operationId: getBlockedDomains + responses: + 200: + description: List of blocked domains + content: + application/json: + schema: + $ref: '#/components/schemas/getBlockedDomains' + examples: + response: + value: + domains: + - example.com + - testdomain.com + post: + tags: + - Transactional emails + summary: Add a new domain to the list of blocked domains + description: Blocks a new domain in order to avoid messages being sent to the same + operationId: blockNewDomain + requestBody: + description: Name of the domain to be blocked + content: + application/json: + schema: + $ref: '#/components/schemas/blockDomain' + required: true + responses: + 201: + description: Domain is successfully blocked + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /smtp/blockedDomains/{domain}: + delete: + tags: + - Transactional emails + summary: Unblock an existing domain from the list of blocked domains + description: Unblocks an existing domain from the list of blocked domains + operationId: deleteBlockedDomain + parameters: + - name: domain + description: The name of the domain to be deleted + in: path + required: true + schema: + type: string + responses: + 204: + description: Domain is successfully deleted from the list of blocked domains + content: {} + 404: + description: Domain not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /smtp/deleteHardbounces: + post: + tags: + - Transactional emails + summary: Delete hardbounces + description: Delete hardbounces. To use carefully (e.g. in case of temporary + ISP failures) + operationId: deleteHardbounces + requestBody: + description: values to delete hardbounces + content: + application/json: + schema: + $ref: '#/components/schemas/deleteHardbounces' + required: false + responses: + 204: + description: Hardbounces deleted + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /smtp/emailStatus/{identifier}: + get: + tags: + - Transactional emails + summary: Fetch scheduled emails by batchId or messageId + description: Fetch scheduled batch of emails by batchId or single scheduled email by messageId (Can retrieve data upto 30 days old) + operationId: getScheduledEmailById + parameters: + - name: identifier + description: The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. + in: path + required: true + examples: + batchId: + value: 4320f270-a4e3-4a2e-b591-edfe30a5e627 + summary: batchId of scheduled batch + messageId: + value: <202202231031.53307417725@smtp-relay.mailin.fr> + summary: messageId of scheduled email + schema: + type: string + - name: startDate + description: Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. + in: query + example: '2022-02-02' + required: false + schema: + type: string + format: date + - name: endDate + description: Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. + in: query + example: '2022-03-02' + required: false + schema: + type: string + format: date + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. Not valid when identifier is `messageId`. + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + - name: status + in: query + description: Filter the records by `status` of the scheduled email batch or message. Not valid when identifier is `messageId`. + required: false + schema: + type: string + enum: + - processed + - inProgress + - queued + - name: limit + description: Number of documents returned per page. Not valid when identifier is `messageId`. + in: query + required: false + example: 100 + schema: + type: integer + format: int64 + default: 100 + maximum: 500 + minimum: 0 + - name: offset + description: Index of the first document on the page. Not valid when identifier is `messageId`. + in: query + required: false + example: 0 + schema: + type: integer + format : int64 + default: 0 + responses: + 200: + description: Scheduled email batches + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/getScheduledEmailByBatchId' + - $ref: '#/components/schemas/getScheduledEmailByMessageId' + examples: + batchId: + value: + { + "count": 3, + "batches": [ + { + "scheduledAt": "2022-02-28T11:36:43.576000000Z", + "createdAt": "2022-02-26T11:36:43.576000000Z", + "status": "queued" + }, + { + "scheduledAt": "2022-02-25T11:36:43.576000000Z", + "createdAt": "2022-02-24T11:36:43.576000000Z", + "status": "processed" + }, + { + "scheduledAt": "2022-02-26T11:36:43.576000000Z", + "createdAt": "2022-02-25T11:36:43.576000000Z", + "status": "inProgress" + } + ] + } + messageId: + value: + { + "scheduledAt": "2022-02-28T11:36:43.576000000Z", + "createdAt": "2022-02-26T11:36:43.576000000Z", + "status": "queued" + } + 400: + description: Invalid parameters passed + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Record(s) for identifier not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /smtp/email/{identifier}: + delete: + tags: + - Transactional emails + summary: Delete scheduled emails by batchId or messageId + description: Delete scheduled batch of emails by batchId or single scheduled email by messageId + operationId: deleteScheduledEmailById + parameters: + - name: identifier + description: The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. + in: path + required: true + examples: + batchId: + value: 4320f270-a4e3-4a2e-b591-edfe30a5e627 + summary: batchId of scheduled batch + messageId: + value: <202202231031.53307417725@smtp-relay.mailin.fr> + summary: messageId of scheduled email + schema: + type: string + responses: + 204: + description: Scheduled email(s) deleted + content: {} + 400: + description: Invalid parameters passed + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Record(s) for identifier not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /contacts: + get: + tags: + - Contacts + summary: Get all the contacts + operationId: getContacts + parameters: + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 1000 + minimum: 0 + type: integer + format: int64 + default: 50 + - name: offset + in: query + description: Index of the first document of the page + schema: + type: integer + format: int64 + default: 0 + - name: modifiedSince + in: query + description: | + 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.** + schema: + type: string + - name: createdSince + in: query + description: | + Filter (urlencoded) the contacts created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** + schema: + type: string + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + - name: segmentId + in: query + description: Id of the segment. **Either listIds or segmentId can be passed.** + schema: + type: integer + format: int64 + - name: listIds + in: query + description: Ids of the list. **Either listIds or segmentId can be passed.** + schema: + type: array + items: + type: integer + format: int64 + - name: filter + in: query + description: | + Filter the contacts on the basis of attributes. **Allowed operator: equals. (e.g. filter=equals(FIRSTNAME,"Antoine"), filter=equals(B1, true), filter=equals(DOB, "1989-11-23"))** + schema: + type: string + responses: + 200: + description: All contacts listed + content: + application/json: + schema: + $ref: '#/components/schemas/getContacts' + examples: + response: + value: + contacts: + - email: contact1@example.com + id: 247 + emailBlacklisted: true + smsBlacklisted: true + createdAt: 2017-05-01T17:05:03Z + modifiedAt: 2017-05-01T17:05:03Z + listIds: + - 43 + - 58 + attributes: + SMS: "33058407250" + IDENTIFICATION: 1-3RHQ-259 + CIV: MS + LAST_NAME: Brennon + FIRST_NAME: Meg + DOB: 1986-05-02 + ADDRESS: 1 5th avenue + ZIP_CODE: "44300" + CITY: New-York + ACTION_CODE: 17HH98CH + - email: 33058407248@mailin-sms.com + id: 245 + emailBlacklisted: true + smsBlacklisted: false + createdAt: 2017-05-01T17:05:03Z + modifiedAt: 2017-05-01T17:05:03Z + listIds: + - 43 + - 61 + - 58 + attributes: + SMS: "33058407248" + IDENTIFICATION: 1-78JS-432 + CIV: MS + LAST_NAME: Press + FIRST_NAME: Sophia + DOB: 1980-09-11 + ADDRESS: 5 Flower Street + ZIP_CODE: "44119" + CITY: Seattle + ACTION_CODE: 17HU765 + count: 3 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 429: + description: Too Many Requests + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + post: + tags: + - Contacts + summary: Create a contact + description: Creates new contacts on Brevo. Contacts can be created by passing either -

+ 1. email address of the contact (email_id),
+ 2. phone number of the contact (to be passed as "SMS" field in "attributes" along with proper country code), For example- {"SMS":"+91xxxxxxxxxx"} or {"SMS":"0091xxxxxxxxxx"}
+ 3. ext_id
+ operationId: createContact + requestBody: + description: Values to create a contact + content: + application/json: + schema: + $ref: '#/components/schemas/createContact' + required: true + responses: + 201: + description: Contact created + content: + application/json: + schema: + $ref: '#/components/schemas/createUpdateContactModel' + examples: + response: + value: + id: 21 + 204: + description: Contact updated + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/contactErrorModel' + 425: + description: Too Early + content: + application/json: + schema: + $ref: '#/components/schemas/contactErrorModel' + /contacts/doubleOptinConfirmation: + post: + tags: + - Contacts + summary: Create Contact via DOI (Double-Opt-In) Flow + operationId: createDoiContact + requestBody: + description: Values to create the Double opt-in (DOI) contact + content: + application/json: + schema: + $ref: '#/components/schemas/createDoiContact' + required: true + responses: + 201: + description: DOI Contact created + content: {} + 204: + description: DOI Contact updated + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + x-codegen-request-body-name: createDoiContact + /contacts/{identifier}: + get: + tags: + - Contacts + summary: Get a contact's details + description: There are 2 ways to get a contact

+ Option 1- https://api.brevo.com/v3/contacts/{identifier}

+ Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={}
+
+ Option 1 only works if identifierType is email_id (for EMAIL), phone_id (for SMS) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL, SMS and ID of the contact.

+ Option 2 works for all identifierType, use email_id for EMAIL attribute, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute

Along with the contact details, this endpoint will show the statistics of contact for the recent 90 days by default. To fetch the earlier statistics, please use Get contact campaign stats ``https://developers.brevo.com/reference/contacts-7#getcontactstats`` endpoint with the appropriate date ranges. + operationId: getContactInfo + parameters: + - name: identifier + in: path + description: Email (urlencoded) OR ID of the contact OR its SMS attribute value OR EXT_ID attribute (urlencoded) + required: true + schema: + oneOf: + - type: string + - type: integer + - name: identifierType + in: query + description: email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute + schema: + type: string + enum: + - email_id + - phone_id + - contact_id + - ext_id + - whatsapp_id + - landline_number_id + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. + schema: + type: string + responses: + 200: + description: Contact informations + content: + application/json: + schema: + $ref: '#/components/schemas/getExtendedContactDetails' + examples: + response: + value: + email: peggy.rain@example.com + id: 42 + emailBlacklisted: false + smsBlacklisted: false + createdAt: 2017-05-02T16:40:31Z + modifiedAt: 2017-05-02T16:40:31Z + attributes: + FIRST_NAME: Peggy + LAST_NAME: Rain + SMS: "3087433387669" + CIV: "1" + DOB: 1986-04-13 + ADDRESS: 987 5th avenue + ZIP_CODE: "87544" + CITY: New-York + AREA: NY + listIds: + - 40 + statistics: + messagesSent: + - campaignId: 21 + eventTime: 2016-05-03T20:15:13Z + - campaignId: 42 + eventTime: 2016-10-17T10:30:01Z + opened: + - campaignId: 21 + count: 2 + eventTime: 2016-05-03T21:24:56Z + ip: 66.249.93.118 + - campaignId: 68 + count: 1 + eventTime: 2017-01-30T13:56:40Z + ip: 66.249.93.217 + clicked: + - campaignId: 21 + links: + - count: 2 + eventTime: 2016-05-03T21:25:01Z + ip: 66.249.93.118 + url: https://url.domain.com/fbe5387ec717e333628380454f68670010b205ff/1/go?uid={EMAIL}&utm_source=brevo&utm_campaign=test_camp&utm_medium=email + delivered: + - campaignId: 21 + count: 2 + eventTime: 2016-05-03T21:24:56Z + ip: 66.249.93.118 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Contact's email not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + delete: + tags: + - Contacts + summary: Delete a contact + description: There are 2 ways to delete a contact

+ Option 1- https://api.brevo.com/v3/contacts/{identifier}

+ Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={}
+
+ Option 1 only works if identifierType is email_id (for EMAIL) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL and ID of the contact.

+ Option 2 works for all identifierType, use email_id for EMAIL attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute. + operationId: deleteContact + parameters: + - name: identifier + in: path + description: Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) + required: true + schema: + oneOf: + - type: string + - type: integer + - name: identifierType + in: query + description: email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute + schema: + type: string + enum: + - email_id + - contact_id + - ext_id + - phone_id + - whatsapp_id + - landline_number_id + responses: + 204: + description: Contact deleted + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Contact not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 405: + description: You're not allowed to delete registered email contact with + Brevo + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + put: + tags: + - Contacts + summary: Update a contact + description: There are 2 ways to update a contact

+ Option 1- https://api.brevo.com/v3/contacts/{identifier}

+ Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={}
+
+ Option 1 only works if identifierType is email_id (for EMAIL) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL and ID of the contact.

+ Option 2 works for all identifierType, use email_id for EMAIL attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute + operationId: updateContact + parameters: + - name: identifier + in: path + description: Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value + required: true + schema: + oneOf: + - type: string + - type: integer + - name: identifierType + in: query + description: email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute + schema: + type: string + enum: + - email_id + - contact_id + - ext_id + - phone_id + - whatsapp_id + - landline_number_id + requestBody: + description: Values to update a contact + content: + application/json: + schema: + $ref: '#/components/schemas/updateContact' + required: true + responses: + 204: + description: Contact updated + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/contactErrorModel' + 404: + description: Contact's email not found + content: + application/json: + schema: + $ref: '#/components/schemas/contactErrorModel' + 425: + description: Too Early + content: + application/json: + schema: + $ref: '#/components/schemas/contactErrorModel' + x-codegen-request-body-name: updateContact + /contacts/batch: + post: + tags: + - Contacts + summary: Update multiple contacts + operationId: updateBatchContacts + requestBody: + description: Values to update multiple contacts + content: + application/json: + schema: + $ref: '#/components/schemas/updateBatchContacts' + required: true + responses: + 204: + description: All contacts updated + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /contacts/{identifier}/campaignStats: + get: + tags: + - Contacts + summary: Get email campaigns' statistics for a contact + operationId: getContactStats + parameters: + - name: identifier + in: path + description: Email (urlencoded) OR ID of the contact + required: true + schema: + oneOf: + - type: string + - type: integer + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days + schema: + type: string + responses: + 200: + description: Contact campaign statistics informations + content: + application/json: + schema: + $ref: '#/components/schemas/getContactCampaignStats' + examples: + response: + value: + messagesSent: + - campaignId: 21 + eventTime: 2016-05-03T20:15:13Z + - campaignId: 42 + eventTime: 2016-10-17T10:30:01Z + - campaignId: 45 + eventTime: 2016-11-09T11:45:02Z + opened: + - campaignId: 21 + count: 2 + eventTime: 2016-05-03T21:24:56Z + ip: 66.249.93.118 + - campaignId: 45 + count: 1 + eventTime: 2017-01-30T13:56:40Z + ip: 66.249.93.217 + clicked: + - campaignId: 21 + links: + - count: 2 + eventTime: 2016-05-03T21:25:01Z + ip: 66.249.93.118 + url: https://url.domain.com/fbe5387ec717e333628380454f68670010b205ff/1/go?uid={EMAIL}&utm_source=brevo&utm_campaign=test_camp&utm_medium=email + delivered: + - campaignId: 21 + count: 2 + eventTime: 2016-05-03T21:24:56Z + ip: 66.249.93.118 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Contact's email not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /contacts/attributes: + get: + tags: + - Contacts + summary: List all attributes + operationId: getAttributes + responses: + 200: + description: Attributes listed + content: + application/json: + schema: + $ref: '#/components/schemas/getAttributes' + examples: + response: + value: + attributes: + - name: LASTNAME + category: normal + type: text + - name: FIRSTNAME + category: normal + type: text + - name: DOB + category: normal + type: date + - name: GENDER + category: category + type: text + enumeration: + - value: 1 + label: Men + - value: 2 + label: Women + - value: 3 + label: Kid + /contacts/attributes/{attributeCategory}/{attributeName}: + put: + tags: + - Contacts + summary: Update contact attribute + operationId: updateAttribute + parameters: + - name: attributeCategory + in: path + description: Category of the attribute + required: true + schema: + type: string + enum: + - category + - calculated + - global + - normal + - name: attributeName + in: path + description: Name of the existing attribute + required: true + schema: + type: string + requestBody: + description: Values to update an attribute + content: + application/json: + schema: + $ref: '#/components/schemas/updateAttribute' + required: true + responses: + 204: + description: Attribute updated + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Attribute not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + x-codegen-request-body-name: updateAttribute + post: + tags: + - Contacts + summary: Create contact attribute + operationId: createAttribute + parameters: + - name: attributeCategory + in: path + description: Category of the attribute + required: true + schema: + type: string + enum: + - normal + - transactional + - category + - calculated + - global + - name: attributeName + in: path + description: Name of the attribute + required: true + schema: + type: string + requestBody: + description: Values to create an attribute + content: + application/json: + schema: + $ref: '#/components/schemas/createAttribute' + required: true + responses: + 201: + description: Attribute created + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + delete: + tags: + - Contacts + summary: Delete an attribute + operationId: deleteAttribute + parameters: + - name: attributeCategory + in: path + description: Category of the attribute + required: true + schema: + type: string + enum: + - normal + - transactional + - category + - calculated + - global + - name: attributeName + in: path + description: Name of the existing attribute + required: true + schema: + type: string + responses: + 204: + description: Attribute deleted + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Attribute not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /contacts/attributes/{attributeType}/{multipleChoiceAttribute}/{multipleChoiceAttributeOption}: + delete: + tags: + - Contacts + summary: Delete a multiple-choice attribute option + operationId: deleteMultiAttributeOptions + parameters: + - name: attributeType + in: path + description: Type of the attribute + required: true + schema: + type: string + enum: + - multiple-choice + - name: multipleChoiceAttribute + in: path + description: Name of the existing muliple-choice attribute + required: true + schema: + type: string + - name: multipleChoiceAttributeOption + in: path + description: Name of the existing multiple-choice attribute option that you want to delete + required: true + schema: + type: string + responses: + 204: + description: Multiple-Choice Attribute Option Deleted Successfully. + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Attribute not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /contacts/folders: + get: + tags: + - Contacts + summary: Get all folders + operationId: getFolders + parameters: + - name: limit + in: query + description: Number of documents per page + required: false + schema: + maximum: 50 + minimum: 0 + type: integer + format: int64 + default: 10 + - name: offset + in: query + description: Index of the first document of the page + required: false + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + responses: + 200: + description: Folders informations + content: + application/json: + schema: + $ref: '#/components/schemas/getFolders' + examples: + response: + value: + folders: + - id: 42 + name: Ninja_Form + totalBlacklisted: 98 + totalSubscribers: 4567 + uniqueSubscribers: 4665 + - id: 29 + name: Prestashop + totalBlacklisted: 10 + totalSubscribers: 6543 + uniqueSubscribers: 6553 + count: 2 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + post: + tags: + - Contacts + summary: Create a folder + operationId: createFolder + requestBody: + description: Name of the folder + content: + application/json: + schema: + $ref: '#/components/schemas/createUpdateFolder' + required: true + responses: + 201: + # description: Folder created + $ref: '#/components/responses/createModel' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + x-codegen-request-body-name: createFolder + /contacts/folders/{folderId}: + get: + tags: + - Contacts + summary: Returns a folder's details + operationId: getFolder + parameters: + - name: folderId + in: path + description: id of the folder + required: true + schema: + type: integer + format: int64 + responses: + 200: + description: Folder details + content: + application/json: + schema: + $ref: '#/components/schemas/getFolder' + examples: + response: + value: + id: 1 + name: Client_Folder + totalBlacklisted: 987 + totalSubscribers: 16778 + uniqueSubscribers: 17765 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Folder ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + put: + tags: + - Contacts + summary: Update a folder + operationId: updateFolder + parameters: + - name: folderId + in: path + description: Id of the folder + required: true + schema: + type: integer + format: int64 + requestBody: + description: Name of the folder + content: + application/json: + schema: + $ref: '#/components/schemas/createUpdateFolder' + required: true + responses: + 204: + description: Folder updated + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Folder ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + x-codegen-request-body-name: updateFolder + delete: + tags: + - Contacts + summary: Delete a folder (and all its lists) + operationId: deleteFolder + parameters: + - name: folderId + in: path + description: Id of the folder + required: true + schema: + type: integer + format: int64 + responses: + 204: + description: Folder deleted + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Folder ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /contacts/folders/{folderId}/lists: + get: + tags: + - Contacts + summary: Get lists in a folder + operationId: getFolderLists + parameters: + - name: folderId + in: path + description: Id of the folder + required: true + schema: + type: integer + format: int64 + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 50 + minimum: 0 + type: integer + format: int64 + default: 10 + - name: offset + in: query + description: Index of the first document of the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + responses: + 200: + description: Folder's Lists details + content: + application/json: + schema: + $ref: '#/components/schemas/getFolderLists' + examples: + response: + value: + lists: + - id: 46 + name: Reactiv + totalSubscribers: 7655 + totalBlacklisted: 0 + uniqueSubscribers: 7655 + - id: 41 + name: NY_Area + totalSubscribers: 3654 + totalBlacklisted: 23 + uniqueSubscribers: 3677 + - id: 22 + name: VIP_Customer + totalSubscribers: 8753 + totalBlacklisted: 72 + uniqueSubscribers: 8825 + count: 3 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Folder ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /contacts/lists: + get: + tags: + - Contacts + summary: Get all the lists + operationId: getLists + parameters: + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 50 + minimum: 0 + type: integer + format: int64 + default: 10 + - name: offset + in: query + description: Index of the first document of the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + responses: + 200: + description: Lists informations + content: + application/json: + schema: + $ref: '#/components/schemas/getLists' + examples: + response: + value: + lists: + - id: 53 + name: Spanish_Speakers + totalSubscribers: 5432 + totalBlacklisted: 65 + uniqueSubscribers: 5497 + folderId: 1 + - id: 50 + name: Other + totalSubscribers: 10976 + totalBlacklisted: 765 + uniqueSubscribers: 11741 + folderId: 2 + count: 2 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + post: + tags: + - Contacts + summary: Create a list + operationId: createList + requestBody: + description: Values to create a list + content: + application/json: + schema: + $ref: '#/components/schemas/createList' + required: true + responses: + 201: + # description: List created + $ref: '#/components/responses/createModel' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /contacts/lists/{listId}: + get: + tags: + - Contacts + summary: Get a list's details + operationId: getList + parameters: + - name: listId + in: path + description: Id of the list + required: true + schema: + type: integer + format: int64 + - name: startDate + in: query + description: | + **Mandatory if endDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. + **Prefer to pass your timezone in date-time format for accurate result** + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. + **Prefer to pass your timezone in date-time format for accurate result** + schema: + type: string + responses: + 200: + description: List informations + content: + application/json: + schema: + $ref: '#/components/schemas/getExtendedList' + examples: + response: + value: + id: 12 + name: Newsletter_Weekly + startDate: 2023-10-0T00:00:00Z + endDate: 2023-04-0T00:00:00Z + totalSubscribers: 6533 + totalBlacklisted: 63 + uniqueSubscribers: 6596 + folderId: 1 + createdAt: 2016-02-26T11:56:08Z + campaignStats: + - campaignId: 15 + stats: + uniqueClicks: 701 + clickers: 789 + complaints: 0 + delivered: 6632 + sent: 6645 + softBounces: 34 + hardBounces: 4 + uniqueViews: 3442 + unsubscriptions: 4 + viewed: 4322 + deferred: 0 + - campaignId: 45 + stats: + uniqueClicks: 654 + clickers: 788 + complaints: 1 + delivered: 4078 + sent: 4334 + softBounces: 18 + hardBounces: 2 + uniqueViews: 987 + unsubscriptions: 4 + viewed: 1555 + deferred: 0 + dynamicList: false + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: List ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + put: + tags: + - Contacts + summary: Update a list + operationId: updateList + parameters: + - name: listId + in: path + description: Id of the list + required: true + schema: + type: integer + format: int64 + requestBody: + description: Values to update a list + content: + application/json: + schema: + $ref: '#/components/schemas/updateList' + required: true + responses: + 204: + description: List updated + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: List ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + delete: + tags: + - Contacts + summary: Delete a list + operationId: deleteList + parameters: + - name: listId + in: path + description: Id of the list + required: true + schema: + type: integer + format: int64 + responses: + 204: + description: List deleted + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: List ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /contacts/segments: + get: + tags: + - Contacts + summary: Get all the segments + operationId: getSegments + parameters: + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 50 + minimum: 0 + type: integer + format: int64 + default: 10 + - name: offset + in: query + description: Index of the first document of the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + responses: + 200: + description: Segments informations + content: + application/json: + schema: + $ref: '#/components/schemas/getSegments' + examples: + response: + value: + segments: + - id: 53 + segmentName: Segment1 + categoryName: Name1 + updatedAt: 2017-03-12T12:30:00Z + - id: 50 + segmentName: Segment2 + categoryName: Name2 + updatedAt: 2017-03-12T12:30:00Z + count: 2 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /contacts/lists/{listId}/contacts: + get: + tags: + - Contacts + summary: Get contacts in a list + operationId: getContactsFromList + parameters: + - name: listId + in: path + description: Id of the list + required: true + schema: + type: integer + format: int64 + - name: modifiedSince + in: query + description: | + 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.** + schema: + type: string + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 500 + minimum: 0 + type: integer + format: int64 + default: 50 + - name: offset + in: query + description: Index of the first document of the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + responses: + 200: + description: Contact informations + content: + application/json: + schema: + $ref: '#/components/schemas/getContacts' + examples: + response: + value: + contacts: + - email: alex.pain@example.com + id: 45 + emailBlacklisted: false + smsBlacklisted: true + createdAt: 2017-05-12T12:30:00Z + modifiedAt: 2017-05-12T12:30:00Z + listIds: + - 12 + - 9 + - 20 + listUnsubscribed: + - 1 + - 2 + attributes: + LASTNAME: Pain + FIRSTNAME: Alex + DOB: 2010-12-31 + GENDER: Kid + - email: john.smith@example.com + id: 32 + emailBlacklisted: true + smsBlacklisted: false + createdAt: 2017-05-12T12:30:00Z + modifiedAt: 2017-05-12T12:30:00Z + listIds: + - 12 + listUnsubscribed: + - 1 + attributes: + LASTNAME: Smith + FIRSTNAME: John + DOB: 1986-06-21 + GENDER: Men + - email: helen.rose@example.com + id: 65 + emailBlacklisted: true + smsBlacklisted: false + createdAt: 2017-05-12T12:30:00Z + modifiedAt: 2017-05-12T12:30:00Z + listIds: + - 12 + - 9 + - 20 + listUnsubscribed: + - 1 + attributes: + LASTNAME: Rose + FIRSTNAME: Helen + DOB: 1988-11-02 + GENDER: Women + SMS: "3375599887766" + count: 17655 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: List ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /contacts/lists/{listId}/contacts/add: + post: + tags: + - Contacts + summary: Add existing contacts to a list + operationId: addContactToList + parameters: + - name: listId + in: path + description: Id of the list + required: true + schema: + type: integer + format: int64 + requestBody: + description: Emails addresses OR IDs OR EXT_ID attributes of the contacts + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/addContactToListByEmails' + - $ref: '#/components/schemas/addContactToListByIDs' + - $ref: '#/components/schemas/addContactToListByExtIDs' + examples: + emailsArray: + summary: Passing emails array + value: + emails: + - jeff32@example.com + - jim56@example.com + idsArray: + summary: Passing ids array + value: + ids: + - 1 + - 2 + extIdsArray: + summary: Passing extIds array + value: + extIds: + - ext234 + - ext456 + required: true + responses: + 201: + description: All contacts have been added successfully to the list with + details of failed ones + content: + application/json: + schema: + $ref: '#/components/schemas/postContactInfo' + examples: + emailsArray: + summary: Response example when emails array is passed + value: + success: + - jeff32@example.com + - jim56@example.com + failure: + - david@example.com + idsArray: + summary: Response example when ids array is passed + value: + success: + - 1 + - 2 + failure: + - 5 + extIdsArray: + summary: Response example when extIds array is passed + value: + success: + - ext123 + failure: + - ext345 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: List ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /contacts/lists/{listId}/contacts/remove: + post: + tags: + - Contacts + summary: Delete a contact from a list + operationId: removeContactFromList + parameters: + - name: listId + in: path + description: Id of the list + required: true + schema: + type: integer + format: int64 + requestBody: + description: Emails adresses OR IDs OR EXT_ID attributes of the contacts OR 'all' true + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/removeContactFromListByEmails' + - $ref: '#/components/schemas/removeContactFromListByIDs' + - $ref: '#/components/schemas/removeContactFromListByAll' + - $ref: '#/components/schemas/removeContactFromListByExtIDs' + examples: + emailsArray: + summary: Passing emails array + value: + emails: + - jeff32@example.com + - jim56@example.com + idsArray: + summary: Passing ids array + value: + ids: + - 1 + - 2 + extIdsArray: + summary: Passing extIds array + value: + extIds: + - ext234 + - ext456 + allTrue: + summary: Passing 'all' true + value: + all: true + required: true + responses: + 201: + description: All contacts have been removed successfully from the list with + details of failed ones + content: + application/json: + schema: + $ref: '#/components/schemas/postContactInfo' + examples: + emailsArray: + summary: Response example when emails array is passed + value: + success: + - jeff32@example.com + - jim56@example.com + failure: + - david@example.com + idsArray: + summary: Response example when ids array is passed + value: + success: + - 1 + - 2 + failure: + - 5 + allTrue: + summary: Response example when 'all' is passed as true + value: + total: 23 + processId: 5 + extIdsArray: + summary: Response example when extIds array is passed + value: + success: + - ext123 + failure: + - ext345 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: List ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + x-codegen-request-body-name: contactEmails + /contacts/export: + post: + tags: + - Contacts + summary: Export contacts + description: It returns the background process ID which on completion calls + the notify URL that you have set in the input. File will be available in csv. + operationId: requestContactExport + requestBody: + description: Values to request a contact export + content: + application/json: + schema: + $ref: '#/components/schemas/requestContactExport' + required: true + responses: + 202: + # description: Contact export request has been accepted + $ref: '#/components/responses/createdProcessId' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 429: + description: Too Many Requests + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /contacts/import: + post: + tags: + - Contacts + summary: Import contacts + description: | + It returns the background process ID which on completion calls + the notify URL that you have set in the input. + + **Note**: + - Any contact attribute that doesn't exist in your account will be ignored at import end. + operationId: importContacts + requestBody: + description: Values to import contacts in Brevo. To know more about the + expected format, please have a look at ``https://help.brevo.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` + content: + application/json: + schema: + $ref: '#/components/schemas/requestContactImport' + required: true + responses: + 202: + # description: Contact import request has been accepted + $ref: '#/components/responses/createdProcessId' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /smsCampaigns: + get: + tags: + - SMS Campaigns + summary: Returns the information for all your created SMS campaigns + operationId: getSmsCampaigns + parameters: + - name: status + in: query + description: Status of campaign. + schema: + type: string + enum: + - suspended + - archive + - sent + - queued + - draft + - inProcess + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) + schema: + type: string + - name: limit + in: query + description: Number limitation for the result returned + schema: + maximum: 1000 + minimum: 0 + type: integer + format: int64 + default: 500 + - name: offset + in: query + description: Beginning point in the list to retrieve from. + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + responses: + 200: + description: SMS campaigns informations + content: + application/json: + schema: + $ref: '#/components/schemas/getSmsCampaigns' + examples: + response: + value: + campaigns: + - id: 2 + name: PROMO CODE + status: sent + content: Visit our Store and get some discount ! + scheduledAt: 2017-06-01T12:30:00Z + testSent: true + sender: MyCompany + createdAt: 2017-06-01T12:30:00Z + modifiedAt: 2017-05-01T12:30:00Z + sentDate: 2017-06-01T12:30:00Z + recipients: + lists: + - 21 + exclusionLists: + - 13 + statistics: + delivered: 2987 + sent: 3000 + processing: 0 + softBounces: 3 + hardBounces: 1 + unsubscriptions: 3 + answered: 2 + - id: 10 + name: SUMMER SALE + status: draft + content: Summer Sale is starting tomorrow. Get extra 10% with this + code:SUM17 + scheduledAt: 2017-08-04T12:30:00Z + testSent: false + sender: MyCompany + createdAt: 2017-06-01T12:30:00Z + modifiedAt: 2017-05-01T12:30:00Z + sentDate: 2017-06-01T12:30:00Z + recipients: + lists: + - 21 + exclusionLists: + - 13 + statistics: + delivered: 2987 + sent: 3000 + processing: 0 + softBounces: 3 + hardBounces: 1 + unsubscriptions: 3 + answered: 2 + count: 12 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + post: + tags: + - SMS Campaigns + summary: Creates an SMS campaign + operationId: createSmsCampaign + requestBody: + description: Values to create an SMS Campaign + content: + application/json: + schema: + $ref: '#/components/schemas/createSmsCampaign' + required: true + responses: + 201: + # description: SMS campaign created + $ref: '#/components/responses/createModel' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /smsCampaigns/{campaignId}: + get: + tags: + - SMS Campaigns + summary: Get an SMS campaign + operationId: getSmsCampaign + parameters: + - name: campaignId + in: path + description: id of the SMS campaign + required: true + schema: + type: integer + format: int64 + responses: + 200: + description: SMS campaign informations + content: + application/json: + schema: + $ref: '#/components/schemas/getSmsCampaign' + examples: + response: + value: + id: 2 + name: PROMO CODE + status: sent + content: Visit our Store and get some discount ! + scheduledAt: 2017-06-01T12:30:00Z + testSent: true + sender: MyCompany + createdAt: 2017-06-01T12:30:00Z + modifiedAt: 2017-05-01T12:30:00Z + recipients: + lists: + - 21 + exclusionLists: + - 13 + statistics: + delivered: 2987 + sent: 3000 + processing: 0 + softBounces: 3 + hardBounces: 1 + unsubscriptions: 3 + answered: 2 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Campaign ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + put: + tags: + - SMS Campaigns + summary: Update an SMS campaign + operationId: updateSmsCampaign + parameters: + - name: campaignId + in: path + description: id of the SMS campaign + required: true + schema: + type: integer + format: int64 + requestBody: + description: Values to update an SMS Campaign + content: + application/json: + schema: + $ref: '#/components/schemas/updateSmsCampaign' + required: true + responses: + 204: + description: SMS campaign updated + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Campaign ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + delete: + tags: + - SMS Campaigns + summary: Delete an SMS campaign + operationId: deleteSmsCampaign + parameters: + - name: campaignId + in: path + description: id of the SMS campaign + required: true + schema: + type: integer + format: int64 + responses: + 204: + description: SMS campaign has been deleted + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Campaign ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /smsCampaigns/{campaignId}/sendNow: + post: + tags: + - SMS Campaigns + summary: Send your SMS campaign immediately + operationId: sendSmsCampaignNow + parameters: + - name: campaignId + in: path + description: id of the campaign + required: true + schema: + type: integer + format: int64 + responses: + 204: + description: SMS campaign has been scheduled + content: {} + 400: + description: SMS Campaign could not be sent + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 402: + description: You don't have enough credit to send your campaign. Please + update your plan + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Campaign ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /smsCampaigns/{campaignId}/status: + put: + tags: + - SMS Campaigns + summary: Update a campaign's status + operationId: updateSmsCampaignStatus + parameters: + - name: campaignId + in: path + description: id of the campaign + required: true + schema: + type: integer + format: int64 + requestBody: + description: Status of the campaign. + content: + application/json: + schema: + $ref: '#/components/schemas/updateCampaignStatus' + required: true + responses: + 204: + description: The campaign status has been updated successfully + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Campaign ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + x-codegen-request-body-name: status + /smsCampaigns/{campaignId}/sendTest: + post: + tags: + - SMS Campaigns + summary: Send a test SMS campaign + operationId: sendTestSms + parameters: + - name: campaignId + in: path + description: Id of the SMS campaign + required: true + schema: + type: integer + format: int64 + requestBody: + description: | + Mobile number of the recipient with the country code. This number **must belong to one of your contacts in Brevo account and must not be blacklisted** + content: + application/json: + schema: + $ref: '#/components/schemas/sendTestSms' + required: true + responses: + 204: + description: Test SMS has been sent successfully to the recipient + content: {} + 400: + description: Test SMS could not be sent to the following email addresses + content: + application/json: + schema: + $ref: '#/components/schemas/postSendSmsTestFailed' + 404: + description: Campaign ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /smsCampaigns/{campaignId}/exportRecipients: + post: + tags: + - SMS Campaigns + summary: Export an SMS campaign's recipients + description: It returns the background process ID which on completion calls + the notify URL that you have set in the input. + operationId: requestSmsRecipientExport + parameters: + - name: campaignId + in: path + description: id of the campaign + required: true + schema: + type: integer + format: int64 + requestBody: + description: Values to send for a recipient export request + content: + application/json: + schema: + $ref: '#/components/schemas/requestSmsRecipientExport' + required: false + responses: + 202: + # description: Recipient export request has been accepted + $ref: '#/components/responses/createdProcessId' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Campaign ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + x-codegen-request-body-name: recipientExport + /smsCampaigns/{campaignId}/sendReport: + post: + tags: + - SMS Campaigns + summary: Send an SMS campaign's report + description: Send report of Sent and Archived campaign, to the specified email + addresses, with respective data and a pdf attachment in detail. + operationId: sendSmsReport + parameters: + - name: campaignId + in: path + description: id of the campaign + required: true + schema: + type: integer + format: int64 + requestBody: + description: Values for send a report + content: + application/json: + schema: + $ref: '#/components/schemas/sendReport' + required: true + responses: + 204: + description: Report has been successfully sent to the defined recipients + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Campaign ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /transactionalSMS/sms: + post: + tags: + - Transactional SMS + summary: Send SMS message to a mobile number + operationId: sendTransacSms + requestBody: + description: Values to send a transactional SMS + content: + application/json: + schema: + $ref: '#/components/schemas/sendTransacSms' + required: true + responses: + 201: + description: SMS has been sent successfully to the recipient + content: + application/json: + schema: + $ref: '#/components/schemas/sendSms' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 402: + description: You don't have enough credit to send your SMS. Please update + your plan + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + x-codegen-request-body-name: sendTransacSms + /transactionalSMS/statistics/aggregatedReport: + get: + tags: + - Transactional SMS + summary: Get your SMS activity aggregated over a period of time + operationId: getTransacAggregatedSmsReport + parameters: + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report + schema: + type: string + - name: days + in: query + description: | + Number of days in the past including today (positive integer). **Not compatible with startDate and endDate** + schema: + type: integer + format: int64 + - name: tag + in: query + description: Filter on a tag + schema: + type: string + responses: + 200: + description: Aggregated SMS report informations + content: + application/json: + schema: + $ref: '#/components/schemas/getTransacAggregatedSmsReport' + examples: + response: + value: + range: 2015-05-22|2017-11-29 + requests: 54 + delivered: 16 + hardBounces: 5 + softBounces: 26 + blocked: 4 + unsubscribed: 10 + replied: 8 + accepted: 6 + rejected: 14 + skipped: 3 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /transactionalSMS/statistics/reports: + get: + tags: + - Transactional SMS + summary: Get your SMS activity aggregated per day + operationId: getTransacSmsReport + parameters: + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report + schema: + type: string + - name: days + in: query + description: | + Number of days in the past including today (positive integer). **Not compatible with 'startDate' and 'endDate'** + schema: + type: integer + format: int64 + - name: tag + in: query + description: Filter on a tag + schema: + type: string + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + responses: + 200: + description: Aggregated SMS report informations + content: + application/json: + schema: + $ref: '#/components/schemas/getTransacSmsReport' + examples: + response: + value: + reports: + - date: 2017-04-30 + requests: 10756 + delivered: 10103 + hardBounces: 21 + softBounces: 137 + blocked: 1026 + unsubscribed: 720 + replied: 5091 + accepted: 2318 + rejected: 0 + skipped: 0 + - date: 2017-05-01 + requests: 18812 + delivered: 17499 + hardBounces: 34 + softBounces: 254 + blocked: 1514 + unsubscribed: 1090 + replied: 10089 + accepted: 4393 + rejected: 0 + skipped: 0 + - date: 2017-05-02 + requests: 14321 + delivered: 13427 + hardBounces: 16 + softBounces: 176 + blocked: 1646 + unsubscribed: 1170 + replied: 11563 + accepted: 4689 + rejected: 0 + skipped: 1 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /transactionalSMS/statistics/events: + get: + tags: + - Transactional SMS + summary: Get all your SMS activity (unaggregated events) + operationId: getSmsEvents + parameters: + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 100 + minimum: 0 + type: integer + format: int64 + default: 50 + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report + schema: + type: string + - name: offset + in: query + description: Index of the first document of the page + schema: + type: integer + format: int64 + default: 0 + - name: days + in: query + description: | + Number of days in the past including today (positive integer). **Not compatible with 'startDate' and 'endDate'** + schema: + type: integer + format: int64 + - name: phoneNumber + in: query + description: Filter the report for a specific phone number + schema: + type: string + - name: event + in: query + description: Filter the report for specific events + schema: + type: string + enum: + - bounces + - hardBounces + - softBounces + - delivered + - sent + - accepted + - unsubscription + - replies + - blocked + - rejected + - skipped + - name: tags + in: query + description: Filter the report for specific tags passed as a serialized urlencoded + array + schema: + type: string + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + responses: + 200: + description: Sms events report informations + content: + application/json: + schema: + $ref: '#/components/schemas/getSmsEventReport' + examples: + response: + value: + events: + - phoneNumber: "00911059469013" + date: 2015-05-20T12:30:00Z + messageId: "1473139351170140" + event: sent + reason: Recipient is currently unreachable + tag: cabWaiting + - phoneNumber: "00911059469013" + date: 2015-05-20T16:30:00Z + messageId: "1473139351170140" + event: delivered + reason: Recipient is currently unreachable + tag: cabRequest + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /whatsappCampaigns/{campaignId}: + get: + tags: + - WhatsApp Campaigns + summary: Get a WhatsApp campaign + operationId: getWhatsAppCampaign + parameters: + - name: campaignId + in: path + description: Id of the campaign + required: true + schema: + type: integer + format: int64 + responses: + 200: + description: Get WhatsApp campaign information on the basis of campaignId + content: + application/json: + schema: + $ref: '#/components/schemas/getWhatsappCampaignOverview' + examples: + response: + value: + id: 1672035851100690 + campaignName: Test WhatsApp Campaign + campaignStatus: sent + scheduledAt: 2022-12-26T09:50:00Z + senderNumber: 9368207029 + recipients: + type: list + includedLists: + - 22 + excludedLists: + - 45 + template : + name : "official_campaign8" + category: "MARKETING" + language: "en" + contains_button : true + display_header : false + components : + - type : "BODY" + text : "making it look like readable English." + - type: "BUTTONS" + buttons : + - type: "URL" + text: "vLorem Ipsum is simply du" + url : "app.brevo" + - type: "PHONE_NUMBER" + text: "Lorem Ipsum is simply dum" + phone_number: "+918800613137" + header_variables : + - name: "FIRSTNAME" + default: "INVALID HEADER" + index: 1 + datatype: "text" + header_type : "text" + body_variable: [] + button_type : "CALL_TO_ACTION" + header_footer: true + stats: + sent: 3, + delivered: 3, + read: 2, + unsubscribe: 0, + notSent: 4 + createdAt: 2022-12-26T06:50:00Z + modifiedAt: 2022-12-26T08:50:00Z + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Campaign Id not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + delete: + tags: + - WhatsApp Campaigns + summary: Delete a WhatsApp campaign + operationId: deleteWhatsAppCampaign + parameters: + - name: campaignId + in: path + description: id of the campaign + required: true + schema: + type: integer + format: int64 + responses: + 204: + description: WhatsApp campaign has been deleted + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Campaign Id not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + put: + tags: + - WhatsApp Campaigns + summary: Update a WhatsApp campaign + operationId: updateWhatsAppCampaign + parameters: + - name: campaignId + in: path + description: id of the campaign + required: true + schema: + type: integer + format: int64 + requestBody: + description: Values to update a WhatsApp Campaign + content: + application/json: + schema: + $ref: '#/components/schemas/updateWhatsAppCampaign' + required: true + responses : + 204: + description: WhatsApp campaign has been deleted + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /whatsappCampaigns/template-list: + get: + tags: + - WhatsApp Campaigns + summary: Return all your created WhatsApp templates + operationId: getWhatsAppTemplates + parameters: + - name: startDate + in: query + description: | + **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. + **Prefer to pass your timezone in date-time format for accurate result** + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. + **Prefer to pass your timezone in date-time format for accurate result** + schema: + type: string + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 100 + minimum: 0 + type: integer + format: int64 + default: 50 + - name: offset + in: query + description: Index of the first document in the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + - name: source + in: query + description: source of the template + required: false + schema: + type: string + enum: + - Automation + - Conversations + responses: + 200: + description: WhatsApp templates informations + content: + application/json: + schema: + $ref: '#/components/schemas/getWhatsappTemplates' + examples: + response: + value: + count: 2 + templates: + - id: 235 + name: campaign_22 + type: whatsapp + status: approved + language: en + category: 'MARKETING' + errorReason: 'NONE' + createdAt: 2017-05-01T12:30:00Z + modifiedAt: 2017-05-01T12:30:00Z + - id: 124 + name: test-template + type: whatsapp + status: draft + language: '' + category: 'MARKETING' + errorReason: 'NONE' + createdAt: 2017-0 + modifiedAt: 2017-05-01T12:30:00Z + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /whatsappCampaigns: + post: + tags: + - WhatsApp Campaigns + summary : Create and Send a WhatsApp campaign + operationId: createWhatsAppCampaign + requestBody: + description: Values to create a WhatsApp Campaign + content: + application/json: + schema: + $ref: '#/components/schemas/createWhatsAppCampaign' + required: true + responses: + 201: + $ref: '#/components/responses/createModel' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + get: + tags: + - WhatsApp Campaigns + summary: Return all your created WhatsApp campaigns + operationId: getWhatsAppCampaigns + parameters: + - name: startDate + in: query + description: | + **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the WhatsApp campaigns created. + **Prefer to pass your timezone in date-time format for accurate result** + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the WhatsApp campaigns created. + **Prefer to pass your timezone in date-time format for accurate result** + schema: + type: string + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 100 + minimum: 0 + type: integer + format: int64 + default: 50 + - name: offset + in: query + description: Index of the first document in the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + responses: + 200: + description: WhatsApp campaigns information + content: + application/json: + schema: + $ref: '#/components/schemas/getWhatsappCampaigns' + examples: + response: + value: + count: 23 + campaigns: + - id: 1672035851100690 + campaignName: campaign_22 + campaignStatus: sent + templateId : 637660278078655 + scheduledAt: 2022-12-27T09:50:00Z + errorReason : "" + invalidatedContacts : 0 + stats: + sent: 3 + delivered: 3 + read: 2 + unsubscribe: 0 + notSent: 4 + readPercentage : 28.57 + createdAt: 2017-05-01T12:30:00Z + modifiedAt: 2017-05-01T12:30:00Z + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /whatsappCampaigns/template : + post : + tags: + - WhatsApp Campaigns + summary : Create a WhatsApp template + operationId : createWhatsAppTemplate + requestBody: + description : Values to create a WhatsApp template + content: + application/json: + schema: + $ref : '#/components/schemas/createWhatsAppTemplate' + required : true + responses: + 201: + $ref : '#/components/responses/createModel' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /whatsappCampaigns/template/approval/{templateId} : + post: + tags : + - WhatsApp Campaigns + summary : Send your WhatsApp template for approval + operationId : sendWhatsAppTemplateApproval + parameters : + - name : templateId + in : path + description : id of the template + required: true + schema : + type : integer + format : int64 + responses : + 200: + description: WhatsApp template sent for approval + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /whatsappCampaigns/config : + get: + tags: + - WhatsApp Campaigns + summary: Get your WhatsApp API account information + operationId: getWhatsAppConfig + responses: + 200: + description: Get all the information of your WhatsApp API account + content: + application/json: + schema: + $ref: '#/components/schemas/getWhatsAppConfig' + examples: + response: + value: + whatsappBusinessAccountID : 105569359072383 + sendingLimit : TIER_1K + phoneNumberQuality : GREEN + whatsappBusinessAccountStatus : APPROVED + businessStatus : verified + phoneNumberNameStatus : APPROVED + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /loyalty/config/programs: + get: + tags: + - Program + summary: Get loyalty program list + description: Returns list of loyalty programs + operationId: getLPList + parameters: + - name: limit + in: query + schema: + type: integer + format: int64 + default: 200 + description: Number of documents per page + - name: offset + in: query + schema: + type: integer + format: int64 + default: 0 + description: Index of the first document in the page + - name: sortField + in: query + description: Sort documents by field + schema: + type: string + default: updatedAt + enum: + - name + - createdAt + - updatedAt + - name: sort + in: query + description: Sort the documents in the ascending or descending order + schema: + type: string + default: desc + enum: + - asc + - desc + responses: + '200': + description: Loyalty Program page + content: + application/json: + schema: + $ref: '#/components/schemas/loyaltyProgramPage' + '204': + description: Loyalty Program empty page + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLimit: + summary: Invalid limit + value: + error: "Invalid limit parameter value" + invalidLimitMin: + summary: Invalid limit minimum + value: + error: "limit must be greater than 0" + invalidOffset: + summary: Invalid offset + value: + error: "Invalid offset parameter value" + invalidOffsetMin: + summary: Invalid offset minimum + value: + error: "Offset must be 0 or greater" + invalidSort: + summary: Invalid sort field + value: + error: "sort must be one of [asc desc]" + invalidSortField: + summary: Invalid sort field + value: + error: "sortField must be one of [name created_at updated_at]" + invalidOrganisationId: + summary: Parsing error + value: + error: "Parsing error: organization id" + post: + tags: + - Program + summary: Create loyalty program + description: Creates loyalty program + operationId: createNewLP + requestBody: + description: Loyalty Program information + content: + application/json: + schema: + $ref: '#/components/schemas/createLoyaltyProgramPayload' + responses: + '201': + description: Loyalty Program information + content: + application/json: + schema: + $ref: '#/components/schemas/loyaltyProgram' + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + parsingError: + summary: Parsing error + value: + error: "Parsing error: unmarshal json" + invalidOrganisationId: + summary: Parsing error + value: + error: "Parsing error: organization id" + '401': + description: Loyalty application is inactive + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + inactiveLoyaltyProgram: + summary: Inactive loyalty program + value: + error: "Loyalty application is inactive" + '409': + description: Loyalty program name already exists + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + nameAlreadyExists: + summary: Name already exists + value: + error: "Loyalty program name already exists" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + nameIsRequired: + summary: Name is required field + value: + error: "name is a required field" + /loyalty/config/programs/{loyaltyProgramId}: + get: + tags: + - Program + summary: Get loyalty program Info + description: Returns loyalty program + operationId: getLoyaltyProgramInfo + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + responses: + '200': + description: Loyalty Program information + content: + application/json: + schema: + $ref: '#/components/schemas/loyaltyProgram' + '401': + description: Cannot authenticate request + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "Request authentication failed" + programNotValid: + summary: Loyalty program is not valid for the client + value: + error: "Loyalty program is not valid for the client" + '404': + description: Loyalty Program not found + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + failedToGetDeDetails: + summary: Failed to get de details + value: + error: "failed to get de details" + put: + tags: + - Program + summary: Update loyalty program + description: Updates loyalty program + operationId: updateLoyaltyProgram + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + requestBody: + description: Loyalty Program information + content: + application/json: + schema: + $ref: '#/components/schemas/updateLoyaltyProgramPayload' + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/loyaltyProgram' + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidBody: + summary: Invalid Body + value: + error: "Invalid body: invalid format" + '401': + description: Cannot authenticate request + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "Request authentication failed" + programNotValid: + summary: Loyalty program is not valid for the client + value: + error: "Loyalty program is not valid for the client" + '404': + description: Loyalty Program not found + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + cannotUpdateLoyaltyProgram: + summary: Cannot update loyalty program + value: + error: "Cannot update Loyalty Program" + '409': + description: Loyalty program name already exists + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + loyaltyProgramAlreadyExists: + summary: Loyalty program name already exists + value: + error: "Loyalty program name already exists" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + nameIsRequired: + summary: Name is required field + value: + error: "name is a required field" + failedToGetDeDetails: + summary: Failed to get de details + value: + error: "failed to get de details" + patch: + tags: + - Program + summary: Partially update loyalty program + description: Partially updates loyalty program + operationId: partiallyUpdateLoyaltyProgram + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + requestBody: + description: Loyalty Program information + content: + application/json: + schema: + $ref: '#/components/schemas/patchLoyaltyProgramPayload' + responses: + '200': + description: Loyalty Program information + content: + application/json: + schema: + $ref: '#/components/schemas/loyaltyProgram' + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidBody: + summary: Invalid Body + value: + error: "Invalid body: invalid format" + invalidBodyEmpty: + summary: Invalid body empty + value: + error: "Invalid body: empty" + '401': + description: Cannot authenticate request + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "Request authentication failed" + programNotValid: + summary: Loyalty program is not valid for the client + value: + error: "Loyalty program is not valid for the client" + '404': + description: Loyalty Program not found + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + cannotUpdateLoyaltyProgram: + summary: Cannot patch loyalty program + value: + error: "Cannot patch Loyalty Program" + '409': + description: Loyalty program name already exists + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + loyaltyProgramAlreadyExists: + summary: Loyalty program name already exists + value: + error: "Loyalty program name already exists" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + nameIsRequired: + summary: Name is required field + value: + error: "name is a required field" + failedToGetDeDetails: + summary: Failed to get de details + value: + error: "failed to get de details" + delete: + tags: + - Program + summary: Delete Loyalty Program + description: Deletes Loyalty Program + operationId: deleteLoyaltyProgram + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + responses: + '204': + description: Successful operation + '401': + description: Cannot authenticate request + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "Request authentication failed" + programNotValid: + summary: Loyalty program is not valid for the client + value: + error: "Loyalty program is not valid for the client" + '404': + description: Loyalty Program not found + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + loyaltyProgramNotFound: + summary: Loyalty program not found + value: + error: "Loyalty program not found" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + failedToGetDeDetails: + summary: Failed to get de details + value: + error: "failed to get de details" + /loyalty/config/programs/{loyaltyProgramId}/publish: + post: + tags: + - Program + summary: Publish loyalty program + description: Publishes loyalty program + operationId: publishLoyaltyProgram + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + responses: + '200': + description: Successful operation + '401': + description: Cannot authenticate request + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "Request authentication failed" + programNotValid: + summary: Loyalty program is not valid for the client + value: + error: "Loyalty program is not valid for the client" + '404': + description: Loyalty Program not found + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + loyaltyProgramNotFound: + summary: Loyalty program not found + value: + error: "Not Found" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + failedToGetDeDetails: + summary: Failed to get de details + value: + error: "failed to get de details" + /loyalty/config/programs/{loyaltyProgramId}/subscriptions: + post: + tags: + - Program + summary: Create subscription + description: Subscribes to a loyalty program + operationId: subscribeToLoyaltyProgram + parameters: + - name: loyaltyProgramId + in: path + description: Loyalty Program ID + required: true + schema: + type: string + format: uuid + requestBody: + description: Subscription information + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/createSubscriptionPayload' + responses: + '201': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/createSubscriptionResponse' + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + parsingError: + summary: Parsing error + value: + error: "Parsing error: unmarshal json" + '401': + description: Cannot authenticate request + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "Request authentication failed" + programNotValid: + summary: Loyalty program is not valid for the client + value: + error: "Loyalty program is not valid for the client" + '404': + description: Invalid contact ID + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + contactIdFound: + summary: Contact id not found + value: + error: "Invalid contact id" + '422': + description: Loyalty Program is inactive or loyalty subscription ID is already assigned to a contact + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + failedToGetDeDetails: + summary: Failed to get de details + value: + error: "failed to get de details" + contactIdIsRequired: + summary: Contact id is required field + value: + error: "contact Id is a required field" + programIsInactive: + summary: Loyalty program is inactive + value: + error: "Loyalty program is inactive" + contactExists: + summary: Contact already exists + value: + error: "Subscription for this contact already exists" + cannotCreateSubscription: + summary: Cannot create subscription + value: + error: "Cannot create Subscription" + /loyalty/config/programs/{loyaltyProgramId}/subscriptions-members: + post: + tags: + - Program + summary: Create subscription member + description: Add member to a subscription + operationId: subscribeMemberToASubscription + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + requestBody: + description: Subscription Member information + content: + application/json: + schema: + $ref: '#/components/schemas/createSubscriptionMemberPayload' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/createSubscriptionMemberResponse' + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + ownerContactAsMember: + summary: Owner contact as member + value: + error: "Failed to decode request payload" + '401': + description: Cannot authenticate request + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "Request authentication failed" + programNotValid: + summary: Loyalty program is not valid for the client + value: + error: "Loyalty program is not valid for the client" + '404': + description: Contact id not found/ cannot validate loyalty program and organization id + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + contactIdFound: + summary: Contact id found + value: + error: "Contact id not found" + invalidMapping: + summary: Invalid mapping + value: + error: "Cannot validate loyalty program and organization id" + '409': + description: Subscription member already exists/ owner contact cannot be added as member + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + duplicateSubscriptionMember: + summary: Duplicate subscription member + value: + error: "Subscription member already exists" + ownerContactAsMember: + summary: Owner contact as member + value: + error: "Owner contact cannot be added as member" + '422': + description: Loyalty Program is inactive or loyalty subscription ID is already assigned to a contact + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + failedToGetDeDetails: + summary: Failed to get de details + value: + error: "failed to get de details" + memberContactIdsRequired: + summary: Member contact ids is required field + value: + error: "memberContactIds is required field" + delete: + tags: + - Program + summary: Delete subscription member + description: Deletes member from a subscription + operationId: deleteContactMembers + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + - name: contactId + in: query + description: Contact Id + required: true + schema: + type: integer + - name: memberContactIds + in: query + description: Member Contact Ids, comma-seperated + required: true + schema: + type: integer + responses: + '204': + description: Successful operation + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + failedToDecode: + summary: Failed to decode request payload + value: + error: "Failed to decode request payload" + '401': + description: Cannot authenticate request + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "Request authentication failed" + programNotValid: + summary: Loyalty program is not valid for the client + value: + error: "Loyalty program is not valid for the client" + '404': + description: Contact id not found/ cannot validate loyalty program and organization id + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + subscriptionNotFound: + summary: Contact subscription not found + value: + error: "Contact subscription not found" + '422': + description: Loyalty Program is inactive or loyalty subscription ID is already assigned to a contact + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + failedToGetDeDetails: + summary: Failed to get de details + value: + error: "failed to get de details" + memberContactIdRequired: + summary: Member contact id is required + value: + error: "memberContactIds is required" + /loyalty/config/programs/{loyaltyProgramId}/contact/{contactId}: + delete: + tags: + - Program + summary: Delete subscription + description: Deletes subscription + operationId: deleteSubscriptionMember + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + - name: contactId + in: path + required: true + schema: + type: string + format: uuid + description: Contact Id + responses: + '204': + description: Successful operation + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + contactIdInvalid: + summary: Invalid contact id + value: + error: "Invalid contact id: invalid format" + '401': + description: Cannot authenticate request + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "Request authentication failed" + programNotValid: + summary: Loyalty program is not valid for the client + value: + error: "Loyalty program is not valid for the client" + '404': + description: Contact id not found/ cannot validate loyalty program and organization id + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidMapping: + summary: Invalid mapping + value: + error: "Cannot validate loyalty program and organization id" + '422': + description: Loyalty Program is inactive or loyalty subscription ID is already assigned to a contact + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + failedToGetDeDetails: + summary: Failed to get de details + value: + error: "failed to get de details" + cannotDeleteSubscription: + summary: Cannot delete subscription + value: + error: Cannot delete Subscription" + get: + tags: + - Program + summary: Get subscription info + description: Get subscription info + operationId: getSubscriptionMember + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + - name: contactId + in: path + required: true + schema: + type: string + format: uuid + description: Contact Id + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/getSubscriptionMemberResponse' + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + InvalidContactId: + summary: Invalid contact id + value: + error: "invalid contact id: missing" + '401': + description: Cannot authenticate request + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "Request authentication failed" + programNotValid: + summary: Loyalty program is not valid for the client + value: + error: "Loyalty program is not valid for the client" + '422': + description: Loyalty Program is inactive or loyalty subscription ID is already assigned to a contact + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + failedToGetDeDetails: + summary: Failed to get de details + value: + error: "failed to get de details" + /loyalty/config/programs/{loyaltyProgramId}/account-info: + get: + tags: + - Program + summary: Get Subscription Data + description: Get Information of balances, tiers, rewards and subscription members for a subscription + operationId: getParameterSubscriptionInfo + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + - name: contactId + in: query + description: One of contact id or loyalty subscription id is required + required: true + schema: + type: integer + - name: loyaltySubscriptionId + in: query + description: Loyalty Subscription Id + required: false + schema: + type: string + - name: params + in: query + description: Add query params (balance, tier, reward, or member) + required: false + schema: + type: array + items: + type: string + enum: + - balance + - tier + - reward + - member + uniqueItems: true + style: form + explode: false + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/getSubscriptionInfoResponse' + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + contactIdIsInvalid: + summary: Contact id is valid + value: + error: "invalid contact id: invalid format" + contactIdOrLoyaltySubscriptionIdNotProvided: + summary: Contact id or loyalty subscription id not provided + value: + error: "either contact id or loyalty subscription id is invalid" + invalidComponent: + summary: Invalid component + value: + error: "invalid component: " + '401': + description: Cannot authenticate request + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "Request authentication failed" + programNotValid: + summary: Loyalty program is not valid for the client + value: + error: "Loyalty program is not valid for the client" + '422': + description: Contact Id is invalid + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidContactId: + summary: Invalid contact id + value: + error: "invalid contact id" + subscriptionIdNotFound: + summary: Subscription id not found + value: + error: "subscription id not found" + invalidLoyaltySubscriptionId: + summary: Invalid loyalty subscription id + value: + error: "invalid loyalty subscription id" + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + failedToGetDeDetails: + summary: Failed to get de details + value: + error: "failed to get de details" + + # Offer + /loyalty/offer/programs/{loyaltyProgramId}/rewards/attribute: + post: + tags: + - Rewards + summary: Attribute reward to a contact + description: Attributes reward to a new contact + operationId: attributeReward + parameters: + - name: loyaltyProgramId + description: "Loyalty Program Id" + in: path + required: true + schema: + type: string + format: uuid + requestBody: + description: Attribute reward information (One of contactId and loyaltySubscriptionId must be provided.) + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/attributeRewardPayload' + responses: + '200': + description: Attributed reward information + content: + application/json: + schema: + $ref: '#/components/schemas/rewardAttributionResponse' + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + parsingError: + summary: Parsing error + value: + error: "Parsing error: unmarshal json" + '401': + description: Cannot authenticate request + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "Request authentication failed" + '403': + description: Cannot authenticate request + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + programNotValid: + summary: Loyalty program is not valid for the client + value: + error: "Loyalty program is not valid for the client" + '412': + description: Attributed reward errors, precondition failed + content: + application/json: + schema: + $ref: '#/components/schemas/attributedRewardFailedConditionErrorResponse' + examples: + rewardAttributionNotValid: + summary: Reward attribution is not valid + value: + error: "Reward attribution not valid" + rewardAttributionDisabled: + summary: Reward disabled + value: + error: "Reward disabled" + invalidPeriod: + summary: Invalid reward attribution period + value: + error: "Invalid reward attribution period" + invalidCase: + summary: Invalid reward attribution case + value: + error: "Invalid reward attribution case" + limitExceed: + summary: Limit exceeded + value: + error: "Limit exceeded" + attributionLimitExceed: + summary: Attribution limit exceeded + value: + error: "Attribute limit per customer exceeded" + totalAttributionLimitExceed: + summary: Total attribution count exceeded + value: + error: "Total attribution count exceeded" + '422': + description: Unprocessable Content + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + failedToGetDeDetails: + summary: Failed to get de details + value: + error: "failed to get de details" + rewardIdRequired: + summary: RewardId is required field + value: + error: "rewardId is a required field" + '424': + description: Invalid subcomponent + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + poolNotFound: + summary: Pool not found + value: + error: "Pool not found" + /loyalty/offer/programs/{loyaltyProgramId}/rewards/validate: + post: + tags: + - Rewards + summary: Validates a voucher + description: Validates a reward for a contact and return the response + operationId: validateReward + parameters: + - name: loyaltyProgramId + description: "Loyalty Program Id" + in: path + required: true + schema: + type: string + format: uuid + requestBody: + description: Validate reward information (One of contactId and loyaltySubscriptionId must be present, or one of code and attributedRewardId must be present.) + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/validateRewardPayload' + responses: + '200': + description: Validated reward information + content: + application/json: + schema: + $ref: '#/components/schemas/validatedRewardResponse' + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + parsingError: + summary: Parsing error + value: + error: "Parsing error: unmarshal json" + '401': + description: Cannot authenticate request + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "Request authentication failed" + '403': + description: Cannot authenticate request + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + programNotValid: + summary: Loyalty program is not valid for the client + value: + error: "Loyalty program is not valid for the client" + '404': + description: Validated reward errors, subscription not found + content: + application/json: + schema: + $ref: '#/components/schemas/subscriptionNotFoundErrorResponse' + examples: + subscriptionNotFound: + summary: Subscription not found + value: + error: "Subscription not found" + pointOfSellNotFound: + summary: Point of sell id not found + value: + error: "Point of sell id not found" + '422': + description: Unprocessable Content + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + oneOfContactIdSubscriptionIdRequired: + summary: Either contact id or loyalty subscription id is required. + value: + error: "Either contact id or loyalty subscription id must be provided" + '424': + description: Invalid subcomponent + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidServiceOrActionRule: + summary: Invalid service or action of rule + value: + error: "Invalid service or action of rule" + /loyalty/offer/programs/{loyaltyProgramId}/rewards/redeem: + post: + tags: + - Rewards + summary: Redeem reward + description: Redeems/Burn a reward for a contact + operationId: redeemReward + parameters: + - name: loyaltyProgramId + description: "Loyalty Program Id" + in: path + required: true + schema: + type: string + format: uuid + requestBody: + description: Redeemed reward information (Either contactId or loyaltySubscriptionId must be present.) + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/redeemRewardPayload' + responses: + '200': + description: Redeemed reward information + content: + application/json: + schema: + $ref: '#/components/schemas/rewardRedeemResponse' + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + parsingError: + summary: Parsing error + value: + error: "Parsing error: unmarshal json" + redemptionNotAllowed: + summary: Reward redemption not allowed + value: + error: "Reward redemption not allowed" + ruleConditionViolated: + summary: Rule condition violated + value: + error: "Rule condition violated" + '401': + description: Cannot authenticate request + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "Request authentication failed" + '403': + description: Cannot authenticate request + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + programNotValid: + summary: Loyalty program is not valid for the client + value: + error: "Loyalty program is not valid for the client" + '404': + description: Validated reward errors, subscription not found + content: + application/json: + schema: + $ref: '#/components/schemas/subscriptionNotFoundErrorResponse' + examples: + pointOfSellNotFound: + summary: Point of sell id not found + value: + error: "Point of sell id not found" + subscriptionNotFound: + summary: Subscription not found + value: + error: "Subscription not found" + '412': + description: Attributed reward errors, precondition failed + content: + application/json: + schema: + $ref: '#/components/schemas/redeemedRewardFailedConditionErrorResponse' + examples: + codeInvalid: + summary: Code is invalid + value: + error: "Code is invalid" + codeAlreadyConsumed: + summary: Code already consumed + value: + error: "Code is invalid" + codeExpired: + summary: Code is expired + value: + error: "Code is expired" + codeDeleted: + summary: Code is deleted + value: + error: "Code is deleted" + rewardLimitReached: + summary: Reward limit reached + value: + error: "Reward limit for redeem reached" + rewardTotalReached: + summary: Reward total redeem limit reached + value: + error: "Reward total redeem limit reached" + rewardPerCustomerReached: + summary: Reward per consumer redeem limit reached + value: + error: "Reward per consumer redeem limit reached" + '422': + description: Unprocessable Content + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + oneOfContactIdSubscriptionIdRequired: + summary: Either contact id or loyalty subscription id is required. + value: + error: "Either contact id or loyalty subscription id must be provided" + /loyalty/offer/programs/{loyaltyProgramId}/offers: + get: + tags: + - Rewards + summary: Get Reward list + description: Returns a list of rewards for a given loyalty program + operationId: getOffersList + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + - name: limit + in: query + schema: + type: integer + default: 100 + description: Number of documents per page + - name: offset + in: query + schema: + type: integer + format: int64 + default: 0 + description: Index of the first document in the page + - name: rewardState + in: query + schema: + type: string + enum: [all, active, pending, disabled, expired] + default: all + description: State of the reward + - name: rewardVersion + in: query + schema: + type: string + enum: [active, draft] + default: draft + description: Select 'active' to retrieve list of all rewards which are live for clients. + Select draft to retrieve list of all non deleted rewards. + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/offersListResponse' + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + parsingError: + summary: Parsing error + value: + error: "Parsing error: query params" + '401': + description: Cannot authenticate request + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "Request authentication failed" + '403': + description: Cannot authenticate request + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + programNotValid: + summary: Loyalty program is not valid for the client + value: + error: "Loyalty program is not valid for the client" + '422': + description: Unprocessable Content + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + invalidOffsetMin: + summary: Invalid offset minimum + value: + error: "Offset must be 0 or greater" + /loyalty/offer/programs/{loyaltyProgramId}/rewards/revoke: + delete: + tags: + - Rewards + summary: Revoke reward + description: Revokes reward + operationId: revokeReward + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + - name: attributedRewardId + in: query + required: true + schema: + type: string + format: uuid + description: Attributed Reward Id + responses: + '204': + description: Successful operation + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + attributedRewardIdMissing: + summary: Attributed reward id is required + value: + error: "Attributed reward id is required" + '404': + description: Loyalty Program not found + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + loyaltyProgramNotFound: + summary: Loyalty program not found + value: + error: "Loyalty program not found" + + # Balance + /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions: + get: + tags: + - Balance + summary: Get balance definition list + description: Returns balance definition page + operationId: getBalanceDefinitionList + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + - name: limit + in: query + schema: + type: integer + default: 50 + description: Number of documents per page + - name: offset + in: query + schema: + type: integer + format: int64 + default: 0 + description: Index of the first document in the page + - name: sortField + in: query + schema: + type: string + enum: [name, createdAt, updatedAt] + default: name + description: Sort documents by field + - name: sort + in: query + schema: + type: string + enum: [asc, desc] + default: desc + description: Sort the documents in the ascending or descending order + - name: version + in: query + schema: + type: string + enum: [active, draft] + default: draft + description: Select 'active' to retrieve list of all balances which are live for clients. Select draft to retrieve list of all non deleted balances. + responses: + '200': + description: Balance definition + content: + application/json: + schema: + $ref: '#/components/schemas/balanceDefinitionPage' + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program id + value: + error: "Invalid loyalty program id: invalid format" + invalidLimit: + summary: Invalid limit parameter value + value: + error: "Invalid limit parameter value" + invalidOffset: + summary: Invalid offset parameter value + value: + error: "Invalid offset parameter value" + '401': + description: Cannot authenticate request + content: + application/json: + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "request authentication failed" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/validationError' + examples: + limitTooLow: + summary: Limit must be greater than 0 + value: + error: "limit must be greater than 0" + limitTooHigh: + summary: Limit must be less than or equal to 500 + value: + error: "limit must be less than or equal to 500" + offsetTooLow: + summary: Offset must be greater than or equal to 0 + value: + error: "offset must be greater than or equal to 0" + invalidSortField: + summary: Sort field must be one of [name createdAt updatedAt] + value: + error: "sortField must be one of [name createdAt updatedAt]" + invalidSort: + summary: Sort must be one of [asc desc] + value: + error: "sort must be one of [asc desc]" + invalidVersion: + summary: Version must be one of [active draft] + value: + error: "version must be one of [active draft]" + post: + tags: + - Balance + summary: Create balance definition + description: Creates balance definition and returns information + parameters: + - name: loyaltyProgramId + description: Loyalty Program Id + in: path + required: true + schema: + type: string + format: uuid + requestBody: + description: Balance definition information + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/createBalanceDefinitionPayload' + responses: + '201': + description: Balance definition information + content: + application/json: + schema: + $ref: '#/components/schemas/balanceDefinition' + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + minAmtGTmaxAmt: + summary: Min amount is greater than max amount + value: + error: "min amount is greater than max amount" + '401': + description: Cannot authenticate request + content: + application/json: + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "request authentication failed" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/validationError' + examples: + missingNameField: + summary: Name is a required field + value: + error: "name is a required field" + nameTooLong: + summary: Name must be a maximum of 128 characters in length + value: + error: "name must be a maximum of 128 characters in length" + descriptionTooLong: + summary: Description must be a maximum of 128 characters in length + value: + error: "description must be a maximum of 128 characters in length" + missingUnitField: + summary: Unit is a required field + value: + error: "unit is a required field" + unitTooLong: + summary: Unit must be a maximum of 32 characters in length + value: + error: "unit must be a maximum of 32 characters in length" + creditLimitTooLow: + summary: Max credit amount limit must be greater than 0 + value: + error: "maxCreditAmountLimit must be greater than 0" + debitLimitTooLow: + summary: Max debit amount limit must be greater than 0 + value: + error: "maxDebitAmountLimit must be greater than 0" + invalidOvertakingStrategy: + summary: Balance option amount overtaking strategy must be one of [strict partial] + value: + error: "balanceOptionAmountOvertakingStrategy must be one of [strict partial]" + invalidCreditRounding: + summary: Balance option credit rounding option must be one of [lower upper natural] + value: + error: "balanceOptionCreditRounding must be one of [lower upper natural]" + invalidDebitRounding: + summary: Balance option debit rounding option must be one of [lower upper natural] + value: + error: "balanceOptionDebitRounding must be one of [lower upper natural]" + invalidDurationValue: + summary: Balance availability duration value must be greater than 0 + value: + error: "balanceAvailabilityDurationValue must be greater than 0" + invalidDurationUnit: + summary: Balance availability duration unit must be one of [day week month year] + value: + error: "balanceAvailabilityDurationUnit must be one of [day week month year]" + invalidDurationModifier: + summary: Balance availability duration modifier must be one of [noModification startOfPeriod endOfPeriod] + value: + error: "balanceAvailabilityDurationModifier must be one of [noModification startOfPeriod endOfPeriod]" + conflictingExpirationAndDuration: + summary: Only one of balance expiration date or duration can be present + value: + error: "only one of balance expiration date/duration can be present" + invalidDateTimeFormat: + summary: Invalid date time format, should be of format dd/mm + value: + error: "invalid date time could not be parsed, should be of format dd/mm" + + /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId}: + get: + tags: + - Balance + summary: Get balance definition + description: Returns balance definition + parameters: + - name: loyaltyProgramId + description: Loyalty Program Id + in: path + required: true + schema: + type: string + format: uuid + - name: balanceDefinitionId + description: Balance Definition Id + in: path + required: true + schema: + type: string + format: uuid + - name: version + description: Select active to get balance definition configuration which is live for the clients. Select draft to retrieve balance definition configuration with the recent edits + in: query + required: false + schema: + enum: + - active + - draft + default: draft + responses: + '200': + description: Balance definition information + content: + application/json: + schema: + $ref: '#/components/schemas/balanceDefinition' + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program id + value: + error: "Invalid loyalty program id: invalid format" + invalidBalanceDefinitionId: + summary: Invalid balance definition id + value: + error: "Invalid balance definition id: invalid format" + '401': + description: Cannot authenticate request + content: + application/json: + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "request authentication failed" + '404': + description: Balance definition not found + content: + application/json: + examples: + missingNameField: + summary: Not found + value: + error: "not found" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/validationError' + examples: + invalidVersion: + summary: Version must be one of [active draft] + value: + error: "version must be one of [active draft]" + put: + tags: + - Balance + summary: Update balance definition + description: Updates Balance definition + parameters: + - name: loyaltyProgramId + description: Loyalty Program Id + in: path + required: true + schema: + type: string + format: uuid + - name: balanceDefinitionId + description: Balance Definition Id + in: path + required: true + schema: + type: string + format: uuid + requestBody: + description: Balance definition information + content: + application/json: + schema: + $ref: '#/components/schemas/updateBalanceDefinitionPayload' + responses: + '200': + description: Balance definition information + content: + application/json: + schema: + $ref: '#/components/schemas/balanceDefinition' + '400': + description: Bad request errors + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidBalanceDefinitionId: + summary: Invalid balance definition id + value: + error: "Invalid balance definition id: invalid format" + invalidLoyaltyProgramId: + summary: Invalid loyalty program id + value: + error: "Invalid loyalty program id: invalid format" + parsingError: + summary: JSON parsing error + value: + error: "Parsing error: unmarshal json" + minAmountGreaterThanMax: + summary: Minimum amount greater than maximum amount + value: + error: "min amount is greater than max amount" + '401': + description: Cannot authenticate request + content: + application/json: + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "request authentication failed" + '404': + description: Balance definition not found + content: + application/json: + examples: + missingNameField: + summary: Not found + value: + error: "not found" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/validationError' + examples: + missingNameField: + summary: Name is a required field + value: + error: "name is a required field" + nameTooLong: + summary: Name must be a maximum of 128 characters in length + value: + error: "name must be a maximum of 128 characters in length" + descriptionTooLong: + summary: Description must be a maximum of 128 characters in length + value: + error: "description must be a maximum of 128 characters in length" + missingUnitField: + summary: Unit is a required field + value: + error: "unit is a required field" + unitTooLong: + summary: Unit must be a maximum of 32 characters in length + value: + error: "unit must be a maximum of 32 characters in length" + creditLimitTooLow: + summary: Max credit amount limit must be greater than 0 + value: + error: "maxCreditAmountLimit must be greater than 0" + debitLimitTooLow: + summary: Max debit amount limit must be greater than 0 + value: + error: "maxDebitAmountLimit must be greater than 0" + invalidOvertakingStrategy: + summary: Balance option amount overtaking strategy must be one of [strict partial] + value: + error: "balanceOptionAmountOvertakingStrategy must be one of [strict partial]" + invalidCreditRounding: + summary: Balance option credit rounding option must be one of [lower upper natural] + value: + error: "balanceOptionCreditRounding must be one of [lower upper natural]" + invalidDebitRounding: + summary: Balance option debit rounding option must be one of [lower upper natural] + value: + error: "balanceOptionDebitRounding must be one of [lower upper natural]" + invalidDurationValue: + summary: Balance availability duration value must be greater than 0 + value: + error: "balanceAvailabilityDurationValue must be greater than 0" + invalidDurationUnit: + summary: Balance availability duration unit must be one of [day week month year] + value: + error: "balanceAvailabilityDurationUnit must be one of [day week month year]" + invalidDurationModifier: + summary: Balance availability duration modifier must be one of [noModification startOfPeriod endOfPeriod] + value: + error: "balanceAvailabilityDurationModifier must be one of [noModification startOfPeriod endOfPeriod]" + conflictingExpirationAndDuration: + summary: Only one of balance expiration date or duration can be present + value: + error: "only one of balance expiration date/duration can be present" + invalidDateTimeFormat: + summary: Invalid date time format, should be of format dd/mm + value: + error: "invalid date time could not be parsed, should be of format dd/mm" + delete: + tags: + - Balance + summary: Delete balance definition + description: Delete Balance definition + parameters: + - name: loyaltyProgramId + description: Loyalty Program Id + in: path + required: true + schema: + type: string + format: uuid + - name: balanceDefinitionId + description: Balance Definition Id + in: path + required: true + schema: + type: string + format: uuid + responses: + '204': + description: Successful operation + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program id + value: + error: "Invalid loyalty program id: invalid format" + invalidBalanceDefinitionId: + summary: Invalid balance definition id + value: + error: "Invalid balance definition id: invalid format" + '401': + description: Cannot authenticate request + content: + application/json: + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "request authentication failed" + '404': + description: Balance definition not found + content: + application/json: + examples: + notFound: + summary: Not found + value: + error: "not found" + + /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId}/limits: + post: + tags: + - Balance + summary: Create balance limits + description: Creates balance limit and send the created UUID along with the data + parameters: + - name: loyaltyProgramId + description: Loyalty Program Id + in: path + required: true + schema: + type: string + format: uuid + - name: balanceDefinitionId + description: Balance Definition Id + in: path + required: true + schema: + type: string + format: uuid + requestBody: + description: Balance definition information + content: + application/json: + schema: + $ref: '#/components/schemas/balanceLimit' + responses: + '201': + description: Balance limit information + content: + application/json: + schema: + $ref: '#/components/schemas/balanceLimitPayload' + '400': + description: Bad request errors + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program id + value: + error: "Invalid loyalty program id" + invalidBalanceDefinitionId: + summary: Invalid balance definition id + value: + error: "Invalid balance definition id" + parsingError: + summary: JSON parsing error + value: + error: "Parsing error: unmarshal json" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/validationError' + examples: + invalidTransactionType: + summary: Invalid transaction type + value: + error: "transactionType must be one of [credit debit]" + invalidDurationValue: + summary: Invalid duration value + value: + error: "durationValue must be greater than 0" + invalidDurationUnit: + summary: Invalid duration unit + value: + error: "durationUnit must be one of [day week month year]" + invalidValue: + summary: Invalid value + value: + error: "value must be greater than 0" + invalidConstraintType: + summary: Invalid constraint type + value: + error: "constraintType must be one of [transaction amount]" + /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId}/limits/{balanceLimitId}: + get: + tags: + - Balance + summary: Get balance limits + description: Fetches balance limits and send the created UUID along with the data + parameters: + - name: loyaltyProgramId + description: Loyalty Program Id + in: path + required: true + schema: + type: string + format: uuid + - name: balanceDefinitionId + description: Balance definition id + in: path + required: true + schema: + type: string + format: uuid + - name: balanceLimitId + description: Balance limit id + in: path + required: true + schema: + type: string + format: uuid + - name: version + description: Select active to get balance definition configuration which is live for the clients. Select draft to retrieve balance definition configuration with the recent edits + in: query + required: false + schema: + enum: + - active + - draft + default: draft + responses: + '200': + description: Fetched balance limits + content: + application/json: + schema: + $ref: '#/components/schemas/balanceLimitPayload' + '400': + description: Bad request errors + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program id + value: + error: "Invalid loyalty program id" + invalidBalanceDefinitionId: + summary: Invalid balance definition id + value: + error: "Invalid balance definition id" + invalidBalanceLimitId: + summary: Invalid balance limit id + value: + error: "Invalid balance limit id" + '404': + description: Required entity not found + content: + application/json: + examples: + notFound: + summary: Balance limit not found + value: + error: "balance limit not found" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/validationError' + examples: + invalidVersion: + summary: Version must be one of [active draft] + value: + error: "version must be one of [active draft]" + delete: + tags: + - Balance + summary: Delete balance limit + description: Delete balance limit + parameters: + - name: loyaltyProgramId + description: Loyalty Program Id + in: path + required: true + schema: + type: string + format: uuid + - name: balanceDefinitionId + description: Balance Definition Id + in: path + required: true + schema: + type: string + format: uuid + - name: balanceLimitId + description: Id of the limit to be deleted + in: path + required: true + schema: + type: string + format: uuid + responses: + '204': + description: Indicates balance limit is deleted + '400': + description: Bad request errors + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program id + value: + error: "Invalid loyalty program id" + invalidBalanceDefinitionId: + summary: Invalid balance definition id + value: + error: "Invalid balance definition id" + invalidBalanceLimitId: + summary: Invalid balance limit id + value: + error: "Invalid balance limit id" + '404': + description: Required entity not found + content: + application/json: + examples: + notFound: + summary: Not found + value: + error: "not found" + put: + tags: + - Balance + summary: Updates balance limit + description: Updates balance limit + parameters: + - name: loyaltyProgramId + description: Loyalty Program Id + in: path + required: true + schema: + type: string + format: uuid + - name: balanceDefinitionId + description: Balance Definition Id + in: path + required: true + schema: + type: string + format: uuid + - name: balanceLimitId + description: Balance Limit Id + in: path + required: true + schema: + type: string + format: uuid + requestBody: + description: Balance limit request + content: + application/json: + schema: + $ref: '#/components/schemas/balanceLimit' + responses: + '200': + description: Updated balance limit information + content: + application/json: + schema: + $ref: '#/components/schemas/balanceLimitPayload' + '400': + description: Bad request errors + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program id + value: + error: "Invalid loyalty program id" + invalidBalanceDefinitionId: + summary: Invalid balance definition id + value: + error: "Invalid balance definition id" + invalidBalanceLimitId: + summary: Invalid balance limit id + value: + error: "Invalid balance limit id" + parsingError: + summary: JSON parsing error + value: + error: "Parsing error: unmarshal json" + '404': + description: Required entity not found + content: + application/json: + examples: + notFound: + summary: Not found + value: + error: "not found" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/validationError' + examples: + invalidTransactionType: + summary: Invalid transaction type + value: + error: "transactionType must be one of [credit debit]" + invalidDurationValue: + summary: Invalid duration value + value: + error: "durationValue must be greater than 0" + invalidDurationUnit: + summary: Invalid duration unit + value: + error: "durationUnit must be one of [day week month year]" + invalidValue: + summary: Invalid value + value: + error: "value must be greater than 0" + invalidConstraintType: + summary: Invalid constraint type + value: + error: "constraintType must be one of [transaction amount]" + /loyalty/balance/programs/{loyaltyProgramId}/subscriptions/{contactId}/balances: + get: + tags: + - Balance + summary: Get subscription balances + description: Returns subscription balances + operationId: getSubscriptionBalances + parameters: + - name: loyaltyProgramId + in: path + description: Loyalty Program Id + required: true + schema: + type: string + format: uuid + - name: contactId + in: path + description: Contact id + required: true + schema: + type: string + format: uuid + responses: + '200': + description: Balance page + content: + application/json: + schema: + $ref: '#/components/schemas/balancePage' + '400': + description: Bad request errors + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program id + value: + error: "Invalid loyalty program id" + invalidContactId: + summary: Invalid contact id + value: + error: "Invalid contact id" + '401': + description: Cannot authenticate request + content: + application/json: + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "request authentication failed" + '404': + description: Subscription not found + content: + application/json: + examples: + authenticationFailed: + summary: Not found + value: + error: "not found" + /loyalty/balance/programs/{loyaltyProgramId}/contact-balances: + get: + tags: + - Balance + summary: Get balance list + description: Returns balance list + operationId: getContactBalances + parameters: + - name: loyaltyProgramId + in: path + description: Loyalty program id + required: true + schema: + type: string + format: uuid + - name: limit + in: query + description: Number of documents per page + required: false + schema: + type: string + format: integer + default: 100 + minimum: 1 + maximum: 500 + - name: offset + in: query + description: Index of the first document in the page + required: false + schema: + type: string + format: integer + default: 0 + - name: balanceDefinitionId + in: query + description: Balance Definition Id + required: true + schema: + type: string + format: uuid + - name: sort + in: query + description: Sort the documents in the ascending or descending order + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + - name: sortField + in: query + description: Sort documents by field + required: false + schema: + type: string + default: updatedAt + enum: + - value + - updatedAt + responses: + '200': + description: Contact balances + content: + application/json: + schema: + $ref: '#/components/schemas/contactBalances' + '400': + description: Bad request errors + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program id + value: + error: "Invalid loyalty program id" + parsingError: + summary: JSON parsing error + value: + error: "Parsing error: unmarshal json" + '401': + description: Cannot authenticate request + content: + application/json: + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "request authentication failed" + '404': + description: Balance definition id does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/balanceDefinitionIdDoesNotExist' + examples: + balanceDefinitionNotFound: + summary: Provided balance definition ID does not exist + value: + error: "Provided balance definition id does not exist" + subscriptionDataNotFound: + summary: Subscription data not found for some contacts + value: + error: "Subscription data not found for some contacts" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/validationError' + examples: + limitTooLow: + summary: Limit must be greater than or equal to 1 + value: + error: "limit must be greater than or equal to 1" + limitTooHigh: + summary: Limit must be less than or equal to 500 + value: + error: "limit must be less than or equal to 500" + offsetTooLow: + summary: Offset must be greater than or equal to 0 + value: + error: "offset must be greater than or equal to 0" + invalidSortField: + summary: Sort field must be one of [value updatedAt] + value: + error: "sortField must be one of [value updatedAt]" + invalidSortOrder: + summary: Sort must be one of [asc desc] + value: + error: "sort must be one of [asc desc]" + missingBalanceDefinitionId: + summary: Balance definition ID is a required field + value: + error: "balanceDefinitionId is a required field" + + /loyalty/balance/programs/{loyaltyProgramId}/transactions: + post: + tags: + - Balance + summary: Create new transaction + description: Creates new transaction and returns information + operationId: beginTransaction + parameters: + - name: loyaltyProgramId + in: path + description: Loyalty Program Id + required: true + schema: + type: string + format: uuid + requestBody: + description: Transaction information + content: + application/json: + schema: + $ref: '#/components/schemas/createTransactionPayload' + responses: + '201': + description: Transaction information + content: + application/json: + schema: + $ref: '#/components/schemas/transaction' + '400': + description: Bad request errors + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program id format + value: + error: "Invalid loyalty program id: invalid format" + parsingError: + summary: JSON parsing error + value: + error: "Parsing error: unmarshal json" + '401': + description: Cannot authenticate request + content: + application/json: + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "request authentication failed" + '417': + description: Transaction rejected + content: + application/json: + examples: + rejectTransactionDueToInsufficientAmount: + summary: Insufficient amount + value: + error: "reject transaction: insufficient amount" + maxBalanceExceeded: + summary: Balance amount exceeds maximum balance amount limit + value: + error: "reject transaction: balance amount exceeds maximum balance amount limit" + minBalanceExceeded: + summary: Balance amount is less than minimum balance amount limit + value: + error: "reject transaction: balance amount is less than minimum balance amount limit" + creditLimitExceeded: + summary: Exceeds credit transaction amount limit + value: + error: "reject transaction: exceeds credit transaction amount limit" + debitLimitExceeded: + summary: Exceeds debit transaction amount limit + value: + error: "reject transaction: exceeds debit transaction amount limit" + creditCountLimitExceeded: + summary: Exceeds credit transaction count limit + value: + error: "reject transaction: exceeds credit transaction count limit" + debitCountLimitExceeded: + summary: Exceeds debit transaction count limit + value: + error: "reject transaction: exceeds debit transaction count limit" + alreadyClosed: + summary: Transaction is already closed, state transition is not allowed + value: + error: "transaction is already closed, state transition is not allowed" + aboveMaxCreditAmountLimit: + summary: Amount falls above maximum credit amount limit + value: + error: "reject transaction: amount falls above maximum credit amount limit" + aboveMaxDebitAmountLimit: + summary: Amount falls above maximum debit amount limit + value: + error: "reject transaction: amount falls above maximum debit amount limit" + insufficientAmount: + summary: Insufficient amount + value: + error: "insufficient amount" + rejectTransaction: + summary: Transaction rejected + value: + error: "reject transaction" + contactNotFound: + summary: Contact id not found + value: + error: "contact id not found" + '404': + description: Balance not found + content: + application/json: + examples: + transactionNotFound: + summary: Not found + value: + error: "not found" + + /loyalty/balance/programs/{loyaltyProgramId}/transactions/{transactionId}/complete: + post: + tags: + - Balance + summary: Complete transaction + description: Completes transaction + operationId: completeTransaction + parameters: + - name: loyaltyProgramId + in: path + description: Loyalty Program Id + required: true + schema: + type: string + format: uuid + - name: transactionId + in: path + description: Transaction Id + required: true + schema: + type: string + format: uuid + requestBody: + description: Transaction information + content: + application/json: + schema: + $ref: '#/components/schemas/completeTransactionPayload' + responses: + '200': + description: Transaction information + content: + application/json: + schema: + $ref: '#/components/schemas/completedTransaction' + '400': + description: Bad request errors + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program id format + value: + error: "Invalid loyalty program id: invalid format" + invalidTransactionId: + summary: Invalid transaction id format + value: + error: "Invalid transaction id: invalid format" + parsingError: + summary: JSON parsing error + value: + error: "Parsing error: unmarshal json" + '401': + description: Cannot authenticate request + content: + application/json: + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "request authentication failed" + '404': + description: Transaction not found + content: + application/json: + examples: + transactionNotFound: + summary: Not found + value: + error: "not found" + '417': + description: Transaction rejected + content: + application/json: + examples: + insufficientAmount: + summary: Reject transaction due to insufficient amount + value: + error: "reject transaction: insufficient amount" + maxBalanceExceeded: + summary: Balance amount exceeds maximum balance amount limit + value: + error: "reject transaction: balance amount exceeds maximum balance amount limit" + minBalanceExceeded: + summary: Balance amount is less than minimum balance amount limit + value: + error: "reject transaction: balance amount is less than minimum balance amount limit" + creditLimitExceeded: + summary: Exceeds credit transaction amount limit + value: + error: "reject transaction: exceeds credit transaction amount limit" + debitLimitExceeded: + summary: Exceeds debit transaction amount limit + value: + error: "reject transaction: exceeds debit transaction amount limit" + creditCountLimitExceeded: + summary: Exceeds credit transaction count limit + value: + error: "reject transaction: exceeds credit transaction count limit" + debitCountLimitExceeded: + summary: Exceeds debit transaction count limit + value: + error: "reject transaction: exceeds debit transaction count limit" + alreadyClosed: + summary: Transaction is already closed, state transition is not allowed + value: + error: "transaction is already closed, state transition is not allowed" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/validationError' + examples: + invalidBalanceExpiryMinValue: + summary: Invalid balance expiry value (min) + value: + error: "balanceExpiryInMinutes must be greater than 0" + invalidBalanceExpiryMaxValue: + summary: Invalid balance expiry value (max) + value: + error: "balanceExpiryInMinutes must be less than or equal to 32767" + /loyalty/balance/programs/{loyaltyProgramId}/transactions/{transactionId}/cancel: + post: + tags: + - Balance + summary: Cancel transaction + description: Cancels transaction + operationId: cancelTransaction + parameters: + - name: loyaltyProgramId + in: path + description: Loyalty program Id + required: true + schema: + type: string + format: uuid + - name: transactionId + in: path + description: Transaction Id + required: true + schema: + type: string + format: uuid + responses: + '200': + description: Transaction information + content: + application/json: + schema: + $ref: '#/components/schemas/cancelledTransaction' + '400': + description: Bad request errors + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program id + value: + error: "Invalid loyalty program id: invalid uuid" + invalidTransactionId: + summary: Invalid transaction id + value: + error: "Invalid transaction id: invalid uuid" + '401': + description: Cannot authenticate request + content: + application/json: + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "request authentication failed" + '404': + description: Transaction not found + content: + application/json: + examples: + contactIdNotFound: + summary: Contact id not found + value: + error: "contact id not found" + notFound: + summary: Not found + value: + error: "not found" + '417': + description: Transaction rejected + content: + application/json: + examples: + alreadyClosed: + summary: Transaction is already closed, state transition is not allowed + value: + error: "transaction is already closed, state transition is not allowed" + /loyalty/balance/programs/{loyaltyProgramId}/create-order: + post: + tags: + - Balance + summary: Create balance order + description: Returns created order + operationId: createBalanceOrder + parameters: + - name: loyaltyProgramId + in: path + description: Loyalty Program Id + required: true + schema: + type: string + format: uuid + requestBody: + description: Create order information + content: + application/json: + schema: + $ref: '#/components/schemas/createOrderPayload' + responses: + '201': + description: Create order + content: + application/json: + schema: + $ref: '#/components/schemas/createOrderPayload' + '400': + description: Bad request errors + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program id format + value: + error: "Invalid loyalty program id: invalid format" + parsingError: + summary: JSON parsing error + value: + error: "Parsing error: unmarshal json" + '401': + description: Cannot authenticate request + content: + application/json: + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "request authentication failed" + '404': + description: Subscription not found + content: + application/json: + examples: + notFound: + summary: Subscription not found + value: + error: "subscription not found" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/validationError' + examples: + missingAmount: + summary: Missing amount + value: + error: "amount is a required field" + invalidAmount: + summary: Invalid amount + value: + error: "amount must not equal to 0" + missingDueAt: + summary: Missing due date + value: + error: "dueAt is a required field" + missingContactId: + summary: Missing contact id + value: + error: "contactId is a required field" + invalidContactId: + summary: Invalid contact id + value: + error: "contactId must be greater than or equal to 1" + missingBalanceDefinitionId: + summary: Missing balance definition id + value: + error: "balanceDefinitionId is a required field" + invalidDueAt: + summary: Invalid due date + value: + error: "dueAt should be a valid RC3339 format and ahead of current time" + invalidExpiresAt: + summary: Invalid expiration date + value: + error: "expiresAt should be a valid RC3339 format and ahead of current time" + invalidBalanceDefinitionId: + summary: Invalid balance definition id + value: + error: "balanceDefinitionId should be a uuid" + expiresAtAheadOfDueAt: + summary: Invalid expiration time + value: + error: "expiresAt must be ahead of due order time" + + #Tier + /loyalty/tier/programs/{loyaltyProgramId}/tier-groups: + post: + tags: + - Tier + summary: Create tier group + description: Creates tier group for the specified loyalty program + operationId: createTierGroup + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + requestBody: + required: true + description: Subscription Member information + content: + application/json: + schema: + $ref: '#/components/schemas/createTierGroupRequest' + responses: + '201': + description: Tier group created successfully + content: + application/json: + schema: + $ref: '#/components/schemas/tierGroup' + '400': + description: Invalid request parameters + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyaltyProgram Id + value: + message: "Invalid loyaltyProgram Id" + noParametersProvided: + summary: No parameters provided + value: + message: "Either scheduled date or duration parameters is not provided for schedule" + parsingError: + summary: Parsing error + value: + message: "Parsing error: unmarshal json" + '403': + description: Request authentication failed + '409': + description: Tier group name already exists + content: + application/json: + schema: + $ref: '#/components/schemas/errorResponse' + examples: + tierGroupNameExists: + summary: Tier group name already exists + value: + message: "Tier group name already exists" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/validationError' + examples: + nameRequired: + summary: Name is a required field + value: + message: "Name is a required field" + nameMaxLength: + summary: Name must be a maximum of 128 characters + value: + message: "Name must be a maximum of 128 characters in length" + upgradeStrategyInvalid: + summary: Upgrade strategy invalid + value: + message: "upgradeStrategy must be one of [real_time anniversary]" + downgradeStrategyInvalid: + summary: Downgrade strategy invalid + value: + message: "downgradeStrategy must be one of [real_time anniversary]" + invalidRequestPayload: + summary: Invalid request payload + value: + message: "Invalid request payload" + get: + tags: + - Tier + summary: Get tier group page + description: Return a list of tier groups for the specified loyalty program + operationId: getListOfTierGroups + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + - name: version + in: query + schema: + type: string + enum: [active, draft] + default: draft + description: Select 'active' to retrieve list of all tier groups which are live for clients. + Select draft to retrieve list of all non deleted tier groups. + responses: + '200': + description: Tier group page + content: + application/json: + schema: + $ref: '#/components/schemas/tierGroupPage' + '400': + description: Invalid request parameters + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyaltyProgram Id + value: + message: "Invalid loyaltyProgram Id" + '401': + description: Request authentication failed + content: + application/json: + schema: + $ref: '#/components/schemas/unauthorizedResponse' + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "request authentication failed" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/validationError' + examples: + versionInvalid: + summary: Version invalid + value: + message: "version must be one of [active draft]" + + /loyalty/tier/programs/{loyaltyProgramId}/tier-groups/{tierGroupId}: + put: + tags: + - Tier + summary: Update tier group + description: Modifies an existing tier group for the specified loyalty program + operationId: updateTierGroup + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + - name: tierGroupId + in: path + required: true + schema: + type: string + format: uuid + description: Tier group Id + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/updateTierGroupRequest' + responses: + '200': + description: Tier group updated successfully + content: + application/json: + schema: + $ref: '#/components/schemas/tierGroup' + '400': + description: Invalid request parameters + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program id + value: + message: "Invalid loyalty program id: invalid format" + invalidTierGroupId: + summary: Invalid tier group id + value: + message: "Invalid tier group id: invalid format" + noParametersProvided: + summary: No parameters provided + value: + message: "Either scheduled date or duration parameters is not provided for schedule" + parsingError: + summary: Parsing error + value: + message: "Parsing error: unmarshal json" + '401': + description: Request authentication failed + content: + application/json: + schema: + $ref: '#/components/schemas/unauthorizedResponse' + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "request authentication failed" + '404': + description: Tier Group not found + content: + application/json: + schema: + type: object + properties: + message: + type: string + examples: + tierGroupNotFound: + summary: Tier group not found + value: + message: "Tier group not found" + tierInOrderNotFound: + summary: One or more tiers in tier order not found + value: + message: "One or more tiers in tier order does not exist" + '409': + description: Tier group name already exists + content: + application/json: + schema: + $ref: '#/components/schemas/errorResponse' + examples: + tierGroupNameExists: + summary: Tier group name already exists + value: + message: "Tier group name already exists" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/validationError' + examples: + invalidRequestPayload: + summary: Invalid request payload + value: + message: "Invalid request payload" + nameRequired: + summary: Name is a required field + value: + message: "Name is a required field" + nameMaxLength: + summary: Name must be a maximum of 128 characters + value: + message: "Name must be a maximum of 128 characters in length" + upgradeStrategyInvalid: + summary: Invalid upgrade strategy + value: + message: "upgradeStrategy must be one of [real_time anniversary]" + downgradeStrategyInvalid: + summary: Invalid downgrade strategy + value: + message: "downgradeStrategy must be one of [real_time anniversary]" + + delete: + tags: + - Tier + summary: Delete tier group + description: Deletes tier group for the specified loyalty program + operationId: deleteTierGroup + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + - name: tierGroupId + in: path + required: true + schema: + type: string + format: uuid + description: Tier group Id + responses: + '204': + description: Tier group deleted successfully + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program id + value: + message: "Invalid loyalty program id: invalid format" + invalidTierGroupId: + summary: Invalid tier group id + value: + message: "Invalid group id: invalid format" + '401': + description: Request Authentication Failed + content: + application/json: + schema: + $ref: '#/components/schemas/unauthorizedResponse' + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "request authentication failed" + '404': + description: Tier group not found + content: + application/json: + examples: + tierGroupNotFound: + summary: Tier group not found + value: + message: "Tier group not found" + + get: + tags: + - Tier + summary: Get tier group by Id + description: Returns the specified tier group for the specified loyalty program + operationId: getTierGroup + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + - name: tierGroupId + in: path + required: true + schema: + type: string + format: uuid + description: Tier group Id + - name: version + in: query + schema: + type: string + enum: [active, draft] + default: draft + description: Select active to retrieve active version of tier group. Select draft to retrieve latest changes in tier group. + responses: + '200': + description: Tier group + content: + application/json: + schema: + $ref: '#/components/schemas/tierGroup' + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program id + value: + message: "Invalid loyalty program id: invalid format" + invalidTierGroupId: + summary: Invalid tier group id + value: + message: "Invalid group id: invalid format" + '401': + description: Request Authentication Failed + content: + application/json: + schema: + $ref: '#/components/schemas/unauthorizedResponse' + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "request authentication failed" + '404': + description: Tier group not found + content: + application/json: + examples: + tierGroupNotFound: + summary: Tier group not found + value: + message: "Tier group not found" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/validationError' + examples: + versionInvalid: + summary: Version invalid + value: + message: "version must be one of [active draft]" + + /loyalty/tier/programs/{loyaltyProgramId}/tiers: + get: + tags: + - Tier + summary: Get tier page + description: Returns tier page + operationId: getLoyaltyProgramTier + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + - name: version + in: query + schema: + type: string + enum: [active, draft] + default: draft + description: Select 'active' to retrieve list of all tiers which are live for clients. + Select draft to retrieve list of all non deleted tiers. + responses: + '200': + description: Loyalty program tier page + content: + application/json: + schema: + $ref: '#/components/schemas/loyaltyTierPage' + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + message: "Invalid loyalty program id: invalid format" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/validationError' + examples: + invalidVersion: + summary: Version must be one of [active draft] + value: + message: "Version must be one of [active draft]" + + /loyalty/tier/programs/{loyaltyProgramId}/tier-groups/{tierGroupId}/tiers: + post: + tags: + - Tier + summary: Create new tier + description: Creates a new tier for the specified tier group + operationId: createTierForTierGroup + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + - name: tierGroupId + in: path + required: true + schema: + type: string + format: uuid + description: Tier group Id + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/tierRequest' + responses: + '201': + description: Tier created successfully + content: + application/json: + schema: + $ref: '#/components/schemas/tier' + '400': + description: Invalid request parameters + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program id + value: + message: "Invalid loyalty program id: invalid format" + invalidGroupId: + summary: Invalid group id + value: + message: "Invalid group id: invalid format" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/validationError' + examples: + parsingError: + summary: Parsing error + value: + message: "Parsing error: unmarshal json" + invalidRequestPayload: + summary: Invalid request payload + value: + message: "Invalid request payload" + nameRequired: + summary: Name is a required field + value: + message: "Name is a required field" + nameMaxLength: + summary: Name must be a maximum of 128 characters + value: + message: "Name must be a maximum of 128 characters in length" + accessConditionsRequired: + summary: Access conditions are required + value: + message: "accessConditions is a required field" + balanceDefinitionRequired: + summary: Balance definition is required + value: + message: "balanceDefinitionId is a required field" + minimumValueRequired: + summary: Minimum value is required + value: + message: "minimumValue is a required field" + + /loyalty/tier/programs/{loyaltyProgramId}/tiers/{tierId}: + delete: + tags: + - Tier + summary: Delete tier + description: Deletes an existing tier for the specified tier group + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + - name: tierId + in: path + required: true + schema: + type: string + format: uuid + description: Tier Id + responses: + '204': + description: Tier deleted successfully + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + message: "Invalid loyalty program id: invalid format" + invalidTierId: + summary: Invalid tier Id + value: + message: "Invalid tier id: invalid format" + '404': + description: Tier not found + content: + application/json: + examples: + tierNotFound: + summary: Tier not found + value: + message: "Tier not found" + + put: + tags: + - Tier + summary: Update tier + description: Modifies an existing tier for the specified tier group + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + - name: tierId + in: path + required: true + schema: + type: string + format: uuid + description: Tier Id + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/tierRequest' + responses: + '200': + description: Tier updated successfully + content: + application/json: + schema: + $ref: '#/components/schemas/tier' + '400': + description: Invalid request parameters + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + message: "Invalid loyalty program id: invalid format" + invalidRequestPayload: + summary: Invalid request payload + value: + message: "Invalid request payload" + '404': + description: Tier not found + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/validationError' + examples: + nameRequired: + summary: Name is a required field + value: + message: "Name is a required field" + nameMaxLength: + summary: Name must be a maximum of 128 characters + value: + message: "Name must be a maximum of 128 characters in length" + accessConditionsRequired: + summary: accessConditions is a required field + value: + message: "accessConditions is a required field" + balanceDefinitionIdRequired: + summary: balanceDefinitionId is a required field + value: + message: "balanceDefinitionId is a required field" + minimumValueRequired: + summary: minimumValue is a required field + value: + message: "minimumValue is a required field" + parsingError: + summary: Parsing error + value: + message: "Parsing error: unmarshal json" + + /loyalty/tier/programs/{loyaltyProgramId}/contacts/{contactId}/tiers/{tierId}: + post: + tags: + - Tier + summary: Add subscription to a tier + description: Assigns a subscription tier to a specific contact within a loyalty program + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + - name: contactId + in: path + required: true + schema: + type: string + format: uuid + description: Contact Id + - name: tierId + in: path + required: true + schema: + type: string + format: uuid + description: Tier Id + responses: + '200': + description: Tier assigned successfully + content: + application/json: + schema: + $ref: '#/components/schemas/tierForContact' + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program ID + value: + message: "Invalid loyalty program id: invalid format" + invalidTierId: + summary: Invalid tier ID + value: + message: "Invalid tier id: invalid format" + invalidContactId: + summary: Invalid contact ID + value: + message: "Invalid contact id: invalid format" + '404': + description: Tier not found + content: + application/json: + schema: + type: object + properties: + message: + type: string + examples: + tierNotFound: + summary: Tier not found + value: + message: "Tier not found" + '409': + description: Tier already assigned + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + tierAlreadyAssigned: + summary: Tier already assigned + value: + message: "Tier already assigned" + '422': + description: Validation errors + content: + application/json: + schema: + $ref: '#/components/schemas/validationError' + examples: + contactNotSubscribed: + summary: Contact is not subscribed to the loyalty program + value: + message: "Contact is not subscribed to the loyalty program" + + /senders: + get: + tags: + - Senders + summary: Get the list of all your senders + operationId: getSenders + parameters: + - name: ip + in: query + description: | + Filter your senders for a specific ip. **Available for dedicated IP usage only** + schema: + type: string + - name: domain + in: query + description: Filter your senders for a specific domain + schema: + type: string + responses: + 200: + description: list of senders + content: + application/json: + schema: + $ref: '#/components/schemas/getSendersList' + examples: + response: + value: + senders: + - id: 1 + name: Marketing + email: marketing@mycompany.com + active: true + ips: + - ip: 123.98.689.7 + domain: mycompany.com + weight: 100 + - id: 2 + name: Newsletter + email: newsletter@mycompany.com + active: false + ips: + - ip: 123.98.689.7 + domain: mycompany.com + weight: 50 + - ip: 123.98.643.2 + domain: news.mycompany.com + weight: 50 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + post: + tags: + - Senders + summary: Create a new sender + operationId: createSender + requestBody: + description: sender's name + content: + application/json: + schema: + $ref: '#/components/schemas/createSender' + required: false + responses: + 201: + description: sender created + content: + application/json: + schema: + $ref: '#/components/schemas/createSenderModel' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + x-codegen-request-body-name: sender + /senders/{senderId}: + put: + tags: + - Senders + summary: Update a sender + operationId: updateSender + parameters: + - name: senderId + in: path + description: Id of the sender + required: true + schema: + type: integer + format: int64 + requestBody: + description: sender's name + content: + application/json: + schema: + $ref: '#/components/schemas/updateSender' + required: false + responses: + 204: + description: sender updated + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Sender ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + x-codegen-request-body-name: sender + delete: + tags: + - Senders + summary: Delete a sender + operationId: deleteSender + parameters: + - name: senderId + in: path + description: Id of the sender + required: true + schema: + type: integer + format: int64 + responses: + 204: + description: sender deleted + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Sender ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /senders/{senderId}/validate: + put: + tags: + - Senders + summary: Validate Sender using OTP + operationId: validateSenderByOTP + parameters: + - name: senderId + in: path + description: Id of the sender + required: true + schema: + type: integer + format: int64 + requestBody: + description: otp + content: + application/json: + schema: + $ref: '#/components/schemas/otp' + required: false + responses: + 204: + description: Sender verified + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Sender ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + x-codegen-request-body-name: sender + /senders/{senderId}/ips: + get: + tags: + - Senders + summary: Get all the dedicated IPs for a sender + operationId: getIpsFromSender + parameters: + - name: senderId + in: path + description: Id of the sender + required: true + schema: + type: integer + format: int64 + responses: + 200: + description: list of dedicated IPs + content: + application/json: + schema: + $ref: '#/components/schemas/getIpsFromSender' + examples: + response: + value: + ips: + - id: 3 + ip: 123.65.8.22 + domain: mailing.myshop.dom + weight: 40 + - id: 5 + ip: 123.43.21.3 + domain: newsletter.myshop.dom + weight: 60 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Sender ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /senders/ips: + get: + tags: + - Senders + summary: Get all the dedicated IPs for your account + operationId: getIps + responses: + 200: + description: list of dedicated IPs + content: + application/json: + schema: + $ref: '#/components/schemas/getIps' + examples: + response: + value: + ips: + - id: 3 + ip: 67.145.89.3 + active: true + domain: mailing.myshop.com + - id: 5 + ip: 76.76.125.9 + active: true + domain: newsletter.myshop.com + - id: 6 + ip: 123.65.8.22 + active: false + domain: notifications.myshop.com + /senders/domains: + get: + tags: + - Domains + summary: Get the list of all your domains + operationId: getDomains + responses: + 200: + description: list of domains + content: + application/json: + schema: + $ref: '#/components/schemas/getDomainsList' + examples: + response: + value: + domains: + - id: 1 + domain_name: mycompany.com + authenticated: true + verified: true + ip: 123.98.689.7 + - id: 2 + domain_name: myexample.com + authenticated: false + verified: true + ip: null + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + post: + tags: + - Domains + summary: Create a new domain + operationId: createDomain + requestBody: + description: domain's name + content: + application/json: + schema: + $ref: '#/components/schemas/createDomain' + required: false + responses: + 200: + description: domain created + content: + application/json: + schema: + $ref: '#/components/schemas/createDomainModel' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + x-codegen-request-body-name: domain + /senders/domains/{domainName}: + delete: + tags: + - Domains + summary: Delete a domain + operationId: deleteDomain + parameters: + - name: domainName + in: path + description: Domain name + required: true + schema: + type: string + responses: + 200: + description: domain deleted + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Domain does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + get: + tags: + - Domains + summary: Validate domain configuration + operationId: getDomainConfiguration + parameters: + - name: domainName + in: path + description: Domain name + required: true + schema: + type: string + responses: + 200: + description: domain configuration + content: + application/json: + schema: + $ref: '#/components/schemas/getDomainConfigurationModel' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Domain does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /senders/domains/{domainName}/authenticate: + put: + tags: + - Domains + summary: Authenticate a domain + operationId: authenticateDomain + parameters: + - name: domainName + in: path + description: Domain name + required: true + schema: + type: string + responses: + 200: + description: domain authenticated + content: + application/json: + schema: + $ref: '#/components/schemas/authenticateDomainModel' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Domain does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + + /webhooks: + get: + tags: + - Webhooks + summary: Get all webhooks + operationId: getWebhooks + parameters: + - name: type + in: query + description: Filter on webhook type + schema: + type: string + default: transactional + enum: + - marketing + - transactional + - inbound + - name: sort + in: query + description: Sort the results in the ascending/descending order of webhook creation + required: false + schema: + type: string + enum: + - asc + - desc + default: desc + responses: + 200: + description: Webhooks informations + content: + application/json: + schema: + $ref: '#/components/schemas/getWebhooks' + examples: + response: + value: + webhooks: + - url: https://example.domain.com/webhook/events/kzfxxxxxxxx0uyo1 + id: 9864 + description: Webhook triggered on campaign openings + events: + - opened + type: transac + createdAt: 2016-07-18T12:30:09Z + modifiedAt: 2016-07-18T16:00:50Z + batched: true + auth: + type: bearer + token: test-auth-token1234 + headers: + - key: cf-secret + value: test-header-value + - url: http://exmaple.domain.com/15kxxxxxn1 + id: 22770 + description: Webhook triggered on campaign hard bounces + events: + - hardBounces + type: marketing + createdAt: 2017-02-20T14:30:00Z + modifiedAt: 2017-02-20T19:00:00Z + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + post: + tags: + - Webhooks + summary: Create a webhook + operationId: createWebhook + requestBody: + description: Values to create a webhook + content: + application/json: + schema: + $ref: '#/components/schemas/createWebhook' + required: true + responses: + 201: + # description: Webhook created + $ref: '#/components/responses/createModel' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /webhooks/{webhookId}: + get: + tags: + - Webhooks + summary: Get a webhook details + operationId: getWebhook + parameters: + - name: webhookId + in: path + description: Id of the webhook + required: true + schema: + type: integer + format: int64 + responses: + 200: + description: Webhook informations + content: + application/json: + schema: + $ref: '#/components/schemas/getWebhook' + examples: + response: + value: + url: http://example.domain.com/1brxxxxxx5p1 + id: 7287 + description: Webhook triggered on campaign openings and addition of + lists + events: + - listAdditions + - opened + type: marketing + createdAt: 2016-06-07T09:10:10Z + modifiedAt: 2016-06-08T11:30:00Z + batched: true + auth: + type: bearer + token: test-auth-token1234 + headers: + - key: cf-secret + value: test-header-value + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Webhook ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + put: + tags: + - Webhooks + summary: Update a webhook + operationId: updateWebhook + parameters: + - name: webhookId + in: path + description: Id of the webhook + required: true + schema: + type: integer + format: int64 + requestBody: + description: Values to update a webhook + content: + application/json: + schema: + $ref: '#/components/schemas/updateWebhook' + required: true + responses: + 204: + description: Webhook updated + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Webhook ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + x-codegen-request-body-name: updateWebhook + delete: + tags: + - Webhooks + summary: Delete a webhook + operationId: deleteWebhook + parameters: + - name: webhookId + in: path + description: Id of the webhook + required: true + schema: + type: integer + format: int64 + responses: + 204: + description: Webhook deleted + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Webhook ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /webhooks/export: + post: + tags: + - Webhooks + summary: Export all webhook events + description: This endpoint will submit a request to get the history of webhooks in the CSV file. The link to download the CSV file will be sent to the webhook that was provided in the notifyURL. + operationId: exportWebhooksHistory + requestBody: + description: Values to submit for webhooks history + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/exportWebhooksHistory' + required: true + responses: + 202: + description: Request accepted + content: + application/json: + schema: + $ref: '#/components/schemas/createdProcessId' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /account: + get: + tags: + - Account + summary: Get your account information, plan and credits details + operationId: getAccount + responses: + 200: + description: account informations + content: + application/json: + schema: + $ref: '#/components/schemas/getAccount' + examples: + response: + value: + plan: + - type: payAsYouGo + credits: 5000 + creditsType: sendLimit + - type: subscription + credits: 39983 + creditsType: sendLimit + startDate: 2017-03-11 + endDate: 2017-04-11 + - type: sms + credits: 999.5360000000001 + creditsType: sendLimit + relay: + enabled: true + data: + userName: john.smith@example.com + relay: smtp-relay.domain.com + port: 587 + marketingAutomation: + key: kzfr5xxxxxxttuyo1 + enabled: true + email: john.smith@example.com + firstName: John + lastName: Smith + companyName: MyShop + address: + city: New-York + street: 1677B 8th Avenue + zipCode: "7665" + country: USA + /organization/activities: + get: + tags: + - Account + - Master account + summary: Get user activity logs + operationId: getAccountActivity + parameters: + - name: startDate + description: Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. + in: query + required: false + schema: + type: string + - name: endDate + description: Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. + in: query + required: false + schema: + type: string + - name: limit + description: Number of documents per page + in: query + required: false + schema: + type: integer + format: int64 + default: 10 + maximum: 100 + minimum: 1 + - name: offset + description: Index of the first document in the page. + in: query + required: false + schema: + type: integer + format: int64 + default : 0 + responses: + 200: + description: list of user activity logs + content: + application/json: + schema: + $ref: '#/components/schemas/getAccountActivity' + examples: + response: + value: + logs: + - action: login-success + date: 2023-03-16T16:49:23+05:30 + user_email: test@mycompany.com + user_ip: 192.158.1.34 + user_agent: Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) + - action: update-profile + date: 2023-03-15T16:49:23+05:30 + user_email: test@myexample.com + user_ip: 192.158.1.38 + user_agent: Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) + count: 2 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /organization/invited/users: + get: + tags: + - User + summary: Get the list of all your users + operationId: getInvitedUsersList + responses: + 200: + description: list of all your users + content: + application/json: + schema: + $ref: '#/components/schemas/getInvitedUsersList' + examples: + response: + value: + users: + - email: owner@company.com + is_owner: true + status: active + feature_access: + marketing: owner + conversations: owner + crm: owner + - email: pendingInvitedUser@company.com + is_owner: false + status: pending + feature_access: + marketing: custom + conversations: none + crm: full + - email: connectedInvitedUser@company.com + is_owner: false + status: active + feature_access: + marketing: none + conversations: full + crm: none + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /organization/user/{email}/permissions: + get: + tags: + - User + summary: Check user permission + operationId: getUserPermission + parameters: + - name: email + description: Email of the invited user. + in: path + required: true + schema: + type: string + responses: + 200: + description: list of all the user's permissions + content: + application/json: + schema: + $ref: '#/components/schemas/getUserPermission' + examples: + response: + value: + email: invitedUser@company.com + status: active + privileges: + - feature: Email campaign + permissions: + - Create / edit / delete + - Send / schedule / suspend + - feature: Templates + permissions: + - Create / edit / delete + - Activate / deactivate + - feature: SMS campaign + permissions: + - Create / edit / delete + - Send / schedule / suspend + - feature: Facebook Ads + permissions: + - Schedule / pause + - feature: Landing pages + permissions: + - All + - feature: Workflows + permissions: + - Create / edit / delete + - Activate / deactivate / Pause + - feature: Contacts + permissions: + - View + - Contact forms + - feature: SMTP & API + permissions: + - SMTP + - API Keys + - Authorized IPs + - feature: User management + permissions: + - None + - feature: Sales Platform + permissions: + - Create / edit / delete owned deals and tasks + - Manage deals and tasks from other users + - Reports + - Settings + - feature: Conversations + permissions: + - None + - feature: Senders, Domains & Dedicated IPs + permissions: + - Senders management + - Domains management + - Dedicated IPs management + - feature: Push + permissions: + - View + - Create / edit / delete + - Send + - Settings + - feature: Companies + permissions: + - Create / edit / delete owned companies + - Manage companies from other users + - Settings + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + + /organization/user/invitation/revoke/{email}: + put: + tags: + - User + summary: Revoke user permission + operationId: putRevokeUserPermission + parameters: + - name: email + description: Email of the invited user. + in: path + required: true + schema: + type: string + responses: + 200: + description: Credit note exists + content: + application/json: + schema: + $ref: '#/components/schemas/putRevokeUserPermissionResponse' + 403: + description: Unauthorized access + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /organization/user/invitation/{action}/{email}: + put: + tags: + - User + summary: Resend / Cancel invitation + operationId: putresendcancelinvitation + parameters: + - name: action + description: action + in: path + required: true + schema: + type: string + enum: + - resend + - cancel + - name: email + description: Email of the invited user. + in: path + required: true + schema: + type: string + responses: + 200: + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/putresendcancelinvitationResponse' + 403: + description: Unauthorized access + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /organization/user/invitation/send: + post: + tags: + - User + summary: Send invitation to user + description: | + `Feature` - A Feature represents a specific functionality like Email campaign, Deals, Calls, Automations, etc. on Brevo. While inviting a user, determine which feature you want to manage access to. You must specify the feature accurately to avoid errors. + + `Permission` - A Permission defines the level of access or control a user has over a specific feature. While inviting user, decide on the permission level required for the selected feature. Make sure the chosen permission is related to the selected feature. + + Features and their respective permissions are as below: + + - `email_campaigns`: + - "create_edit_delete" + - "send_schedule_suspend" + - `sms_campaigns`: + - "create_edit_delete" + - "send_schedule_suspend" + - `contacts`: + - "view" + - "create_edit_delete" + - "import" + - "export" + - "list_and_attributes" + - "forms" + - `templates`: + - "create_edit_delete" + - "activate_deactivate" + - `workflows`: + - "create_edit_delete" + - "activate_deactivate_pause" + - "settings" + - `facebook_ads`: + - "create_edit_delete" + - "schedule_pause" + - `landing_pages`: + - "all" + - `transactional_emails`: + - "settings" + - "logs" + - `smtp_api`: + - "smtp" + - "api_keys" + - "authorized_ips" + - `user_management`: + - "all" + - `sales_platform`: + - "create_edit_deals" + - "delete_owned_deals" + - "manage_others_deals_tasks" + - "reports" + - "settings" + - `phone`: + - "all" + - `conversations`: + - "access" + - "assign" + - "configure" + - `senders_domains_dedicated_ips`: + - "senders_management" + - "domains_management" + - "dedicated_ips_management" + - `push_notifications`: + - "view" + - "create_edit_delete" + - "send" + - "settings" + - `companies`: + - "manage_owned_companies" + - "manage_other_companies" + - "settings" + + **Note**: + - If `all_features_access: false` then only privileges are required otherwise if `true` then it's assumed that all permissions will be there for the invited user. + - The availability of feature and its permission depends on your current plan. Please select the features and permissions accordingly. + operationId: inviteuser + requestBody: + description: Values to create an invitation + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/inviteuser' + responses: + 200: + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/inviteuserResponse' + 400: + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /organization/user/update/permissions: + post: + tags: + - User + summary: Update permission for a user + description: | + `Feature` - A Feature represents a specific functionality like Email campaign, Deals, Calls, Automations, etc. on Brevo. While inviting a user, determine which feature you want to manage access to. You must specify the feature accurately to avoid errors. + + `Permission` - A Permission defines the level of access or control a user has over a specific feature. While inviting user, decide on the permission level required for the selected feature. Make sure the chosen permission is related to the selected feature. + + Features and their respective permissions are as below: + + - `email_campaigns`: + - "create_edit_delete" + - "send_schedule_suspend" + - `sms_campaigns`: + - "create_edit_delete" + - "send_schedule_suspend" + - `contacts`: + - "view" + - "create_edit_delete" + - "import" + - "export" + - "list_and_attributes" + - "forms" + - `templates`: + - "create_edit_delete" + - "activate_deactivate" + - `workflows`: + - "create_edit_delete" + - "activate_deactivate_pause" + - "settings" + - `facebook_ads`: + - "create_edit_delete" + - "schedule_pause" + - `landing_pages`: + - "all" + - `transactional_emails`: + - "settings" + - "logs" + - `smtp_api`: + - "smtp" + - "api_keys" + - "authorized_ips" + - `user_management`: + - "all" + - `sales_platform`: + - "create_edit_deals" + - "delete_owned_deals" + - "manage_others_deals_tasks" + - "reports" + - "settings" + - `phone`: + - "all" + - `conversations`: + - "access" + - "assign" + - "configure" + - `senders_domains_dedicated_ips`: + - "senders_management" + - "domains_management" + - "dedicated_ips_management" + - `push_notifications`: + - "view" + - "create_edit_delete" + - "send" + - "settings" + - `companies`: + - "manage_owned_companies" + - "manage_other_companies" + - "settings" + + **Note**: + - The privileges array remains the same as in the send invitation; the user simply needs to provide the permissions that need to be updated. + - The availability of feature and its permission depends on your current plan. Please select the features and permissions accordingly. + operationId: EditUserPermission + requestBody: + description: Values to create an invitation + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/inviteuser' + responses: + 200: + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/updateUserResponse' + 400: + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + + /processes: + get: + tags: + - Process + summary: Return all the processes for your account + operationId: getProcesses + parameters: + - name: limit + in: query + description: Number limitation for the result returned + schema: + maximum: 50 + minimum: 0 + type: integer + format: int64 + default: 10 + - name: offset + in: query + description: Beginning point in the list to retrieve from. + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + responses: + 200: + description: processes informations + content: + application/json: + schema: + $ref: '#/components/schemas/getProcesses' + examples: + response: + value: + processes: + - id: 40 + status: completed + name: TRANS-CALC + - id: 43 + status: queued + name: TRANS-GLOBAL-CALC + - id: 194 + status: completed + name: SEARCH_EXPORT_USERS + export_url: filename.csv + count: 3 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /processes/{processId}: + get: + tags: + - Process + summary: Return the informations for a process + operationId: getProcess + parameters: + - name: processId + in: path + description: Id of the process + required: true + schema: + type: integer + format: int64 + responses: + 200: + description: process informations + content: + application/json: + schema: + $ref: '#/components/schemas/getProcess' + examples: + response: + value: + id: 194 + status: completed + name: SEARCH_EXPORT_USERS + export_url: filename.csv + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Process ID not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + example: + code: invalid_parameter + message: processId is invalid + /inbound/events: + get: + tags: + - Inbound Parsing + summary: Get the list of all the events for the received emails. + description: This endpoint will show the list of all the events for the received emails. + operationId: getInboundEmailEvents + parameters: + - name: sender + description: Email address of the sender. + in: query + required: false + schema: + type: string + - name: startDate + description: Mandatory if endDate is used. Starting date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) from which you want to fetch the list. Maximum time period that can be selected is one month. + in: query + required: false + schema: + type: string + format: datetime + - name: endDate + description: Mandatory if startDate is used. Ending date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) till which you want to fetch the list. Maximum time period that can be selected is one month. + in: query + required: false + schema: + type: string + format: datetime + - name: limit + description: Number of documents returned per page + in: query + required: false + schema: + type: integer + format: int64 + default: 100 + maximum: 500 + minimum: 0 + - name: offset + description: Index of the first document on the page + in: query + required: false + schema: + type: integer + format : int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation + required: false + schema: + type: string + enum: + - asc + - desc + default: desc + responses: + 200: + description: List of events for received emails. + content: + application/json: + schema: + $ref: '#/components/schemas/getInboundEmailEvents' + examples: + response: + value: + events: + - uuid: "1a825d56-029b-4a41-b8e4-1a825d56" + date: "2017-03-11T12:30:00.000Z" + sender: "john@example.com" + recipient: "alexa@example.com" + - uuid: "1a825d56-029b-4a41-b8e4-61670463431b" + date: "2017-03-12T12:30:00.000Z" + sender: "alice@example.com" + recipient: "bob@example.com" + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /inbound/events/{uuid}: + get: + tags: + - Inbound Parsing + summary: Fetch all events history for one particular received email. + description: This endpoint will show the list of all events history for one particular received email. + operationId: getInboundEmailEventsByUuid + parameters: + - name: uuid + description: 'UUID to fetch events specific to recieved email' + in: path + required: true + schema: + type: string + responses: + 200: + description: Email campaign informations + content: + application/json: + schema: + $ref: '#/components/schemas/getInboundEmailEventsByUuid' + examples: + response: + value: + receivedAt: "2017-03-12T12:30:00.000Z" + deliveredAt: "2017-03-12T12:31:00.000Z" + sender: "alice@example.com" + recipient: "bob@example.com" + messageId: "" + subject: "Re: Question about your API" + attachments: + - name: "invoice.pdf" + contentType: "application/pdf" + contentId: null + contentLength: 12345 + logs: + - date: "2017-03-12T12:30:00.000Z" + type: "received" + - date: "2017-03-12T12:30:04.000Z" + type: "webhookFailed" + - date: "2017-03-12T12:31:04.000Z" + type: "webhookDelivered" + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + + /inbound/attachments/{downloadToken}: + get: + tags: + - Inbound Parsing + summary: Retrieve inbound attachment with download token. + description: This endpoint will retrieve inbound attachment with download token. + operationId: getInboundEmailAttachment + parameters: + - name: downloadToken + description: 'Token to fetch a particular attachment' + in: path + required: true + schema: + type: string + responses: + 200: + description: Attachment information + content: + application/octet-stream: + schema: + type: string + format: binary + headers: + Content-Type: + schema: + type: string + example: image/png + Content-Disposition: + schema: + type: string + example: attachment; filename="download.png" + Content-Length: + schema: + type: integer + example: 4032 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: attachment not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + + /corporate/subAccount: + get: + tags: + - Master account + summary: Get the list of all the sub-accounts of the master account. + description: This endpoint will provide the list all the sub-accounts of the master account. + parameters: + - name: offset + description: 'Index of the first sub-account in the page' + in: query + required: true + schema: + type: integer + - name: limit + description: 'Number of sub-accounts to be displayed on each page' + in: query + required: true + schema: + type: integer + responses: + 200: + description: Sub-accounts list + content: + application/json: + schema: + $ref: '#/components/schemas/subAccountsResponse' + examples: + response: + value: + count: 3 + subAccounts: + - id: 4043629 + companyName: "Company1" + active: true, + createdAt: 1631523176 + groups: + - id: 5f8f8c3b5f56a02d4433b3a8 + name: Group 1 + - id: 4fbf3c3b1f56a02ac465b1a0 + name: Group 2 + - id: 3984002 + companyName: "Company2" + active: true + createdAt: 1629439311 + groups: [] + - id: 3524191 + companyName: "Company3" + active: true + createdAt: 1614713641 + groups: [] + + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + post: + tags: + - Master account + summary: Create a new sub-account under a master account. + description: This endpoint will create a new sub-account under a master account + requestBody: + description: Request body with sub-account organization name + content: + application/json: + schema: + $ref: '#/components/schemas/createSubAccount' + required: true + + responses: + 201: + description: Created sub-account ID + content: + application/json: + schema: + $ref: '#/components/schemas/createSubAccountResponse' + examples: + response: + value: + id: 4109344 + 400: + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + example: + code: missing_parameter + message: Missing companyName attribute in the request + /corporate/subAccount/{id}: + get: + tags: + - Master account + summary: Get sub-account details + description: This endpoint will provide the details for the specified sub-account company + parameters: + - name: id + description: 'Id of the sub-account organization' + schema: + type: integer + format: int64 + in: path + required: true + responses: + 200: + description: Sub-account organization details + content: + application/json: + schema: + $ref: '#/components/schemas/subAccountDetailsResponse' + example: + name: "Uday Pandit" + email: "uday+1@brevo.com" + companyName: "API-Sub-26thOct21-4" + groups: + - name: "Group1" + id: "5f8f8c3b5f56a02d4433b3a7" + - name: "Group2" + id: "5f8f8c3b5f56a02d4433b3a8" + planInfo: + credits: + emails: + quantity: 2000 + remaining: 1955 + sms: + quantity: 2000 + remaining: 1955 + wpSubscribers: + quantity: 2000 + remaining: 1955 + whatsapp: + quantity: 100 + remaining: 50 + externalFeeds: + quantity: 1 + remaining: 1 + features: + inbox: + quantity: 20 + remaining: 12 + landingPage: + quantity: 25 + remaining: 14 + users: + quantity: 30 + remaining: 14 + planType: paid + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + delete: + tags: + - Master account + summary: Delete a sub-account + parameters: + - name: id + description: 'Id of the sub-account organization to be deleted' + schema: + type: integer + format: int64 + in: path + required: true + responses: + 204: + description: Returned when sub-account is deleted succesfully + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + example: + code: missing_parameter + message: Sub-account 2039dfsddf885 is not valid + 404: + description: sub-account not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + example: + code: document_not_found + message: Sub-account 2039885 was not found + /corporate/subAccount/{id}/plan: + put: + tags: + - Master account + summary: Update sub-account plan + description: This endpoint will update the sub-account plan. On the Corporate solution new version v2, you can set an unlimited number of credits in your sub-organization. Please pass the value “-1" to set the consumable in unlimited mode. + parameters: + - name: id + in: path + description: Id of the sub-account organization + required: true + schema: + type: integer + format: int64 + requestBody: + description: Values to update a sub-account plan + content: + application/json: + schema: + $ref: '#/components/schemas/subAccountUpdatePlanRequest' + required: true + responses: + 204: + description: Sub account plan updated + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 403: + description: Current account is not a master account + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + code: "permission_denied" + message: "Access forbidden." + /corporate/ssoToken: + post: + tags: + - Master account + summary: Generate SSO token to access admin account + description: This endpoint generates an SSO token to authenticate and access the admin account using the endpoint https://account-app.brevo.com/account/login/corporate/sso/[token], where [token] will be replaced by the actual token. + requestBody: + content: + application/json: + schema: + required: + - email + type: object + properties: + email: + type: string + description: User email of admin account + example: vipin+ent-user@brevo.com + responses: + 200: + description: Session token + content: + application/json: + schema: + $ref: '#/components/schemas/getSsoToken' + examples: + response: + value: + token: 5cadaxxxxxxxxxxxxxxxxxxxx5a179f85a0 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + example: + code: "invalid_parameter" + message: "Invalid email address" + 403: + description: Current account is not an admin account + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + code: "permission_denied" + message: "Access forbidden." + /corporate/subAccount/ssoToken: + post: + tags: + - Master account + summary: Generate SSO token to access sub-account + description: This endpoint generates an sso token to authenticate and access a sub-account of the master using the account endpoint https://account-app.brevo.com/account/login/sub-account/sso/[token], where [token] will be replaced by the actual token. + requestBody: + content: + application/json: + schema: + required: + - id + type: object + properties: + id: + type: integer + format: int64 + description: Id of the sub-account organization + example: 3232323 + email: + type: string + description: User email of sub-account organization + example: vipin+subaccount@brevo.com + target: + type: string + description: | + **Set target after login success** + * **automation** - Redirect to Automation after login + * **email_campaign** - Redirect to Email Campaign after login + * **contacts** - Redirect to Contacts after login + * **landing_pages** - Redirect to Landing Pages after login + * **email_transactional** - Redirect to Email Transactional after login + * **senders** - Redirect to Senders after login + * **sms_campaign** - Redirect to Sms Campaign after login + * **sms_transactional** - Redirect to Sms Transactional after login + enum: + - automation + - email_campaign + - contacts + - landing_pages + - email_transactional + - senders + - sms_campaign + - sms_transactional + example: contacts + url: + type: string + description: Set the full target URL after login success. The user will land directly on this target URL after login + example: https://app.brevo.com/senders/domain/list + responses: + 200: + description: Session token + content: + application/json: + schema: + $ref: '#/components/schemas/getSsoToken' + examples: + response: + value: + token: 5cadaxxxxxxxxxxxxxxxxxxxx5a179f85a0 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + example: + code: "invalid_parameter" + message: "Invalid sub-account id." + 403: + description: Current account is not a master account + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + code: "permission_denied" + message: "Access forbidden." + /corporate/masterAccount: + get: + tags: + - Master account + summary: Get the details of requested master account + description: This endpoint will provide the details of the master account. + responses: + 200: + description: Master account details + content: + application/json: + schema: + $ref: '#/components/schemas/masterDetailsResponse' + example: + email: "sample@example.com" + companyName: "Corp Sample 1-1" + id: 1003286 + currencyCode: "INR" + timezone: "Europe/Paris" + billingInfo: + email: "sample@example.com" + companyName: "Corp Sample 1-1" + name: + givenName: "Uday" + familyName: "Pandit" + address: + streetAddress: "C-92" + locality: "Pandav Nagar, New Delhi" + postalCode: "560048" + stateCode: "UP" + countryCode: "IN" + planInfo: + currencyCode: "INR" + nextBillingAt: 1637739295 + price: 2100 + planPeriod: "month" + subAccounts: 15 + features: + - name: "MULTI_USER" + unitValue: 1 + quantity: 10 + used: 15 + remaining: 0 + - name: "ADVANCED_REPORTING" + unitValue: 1 + quantity: 12 + used: 1 + remaining: 11 + - name: "INBOX" + unitValue: 1 + quantity: 10 + used: 10 + remaining: 0 + - name: "LANDING_PAGE" + unitValue: 5 + quantity: 10 + used: 11 + remaining: 0 + - name: "RECURRING_CREDITS" + unitValue: 1 + quantity: 500 + used: 1 + remaining: 499 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /corporate/subAccount/key: + post: + tags: + - Master account + summary: Create an API key for a sub-account + description: This endpoint will generate an API v3 key for a sub account + requestBody: + content: + application/json: + schema: + required: + - id + - name + type: object + properties: + id: + type: integer + format: int64 + description: Id of the sub-account organization + example: 3232323 + name: + type: string + description: Name of the API key + example: My Api Key + responses: + 201: + description: API key + content: + application/json: + schema: + $ref: '#/components/schemas/createApiKeyResponse' + examples: + response: + value: + status: "success" + key: "xkeysib-21881axxxxxcc92e04-mIrexxxx7z" + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + example: + code: "invalid_parameter" + message: "id should be a positive number" + /corporate/subAccount/{id}/applications/toggle: + put: + tags: + - Master account + summary: Enable/disable sub-account application(s) + description: API endpoints for the Corporate owner to enable/disable applications on the sub-account + parameters: + - name: id + in: path + description: Id of the sub-account organization (mandatory) + required: true + schema: + type: integer + format: int64 + requestBody: + description: List of applications to activate or deactivate on a sub-account + content: + application/json: + schema: + $ref: '#/components/schemas/subAccountAppsToggleRequest' + required: true + responses: + 204: + description: Sub-account application(s) enabled/disabled + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 403: + description: Current account is not a master account + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + code: "permission_denied" + message: "Access forbidden." + /corporate/group: + post: + tags: + - Master account + summary: Create a group of sub-accounts + description: This endpoint allows to create a group of sub-accounts + requestBody: + content: + application/json: + schema: + required: + - groupName + type: object + properties: + groupName: + type: string + description: The name of the group of sub-accounts + example: My group + subAccountIds: + items: + type: integer + format: int64 + type: array + description: Pass the list of sub-account Ids to be included in the group + example: [234322, 325553, 893432] + + responses: + 201: + description: Group ID + content: + application/json: + schema: + type: object + properties: + id: + type: string + examples: + response: + value: + id: 659xxxxxxxxxxxxxxxx6ef9c8 + 400: + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + example: + code: invalid_parameter + message: Invalid request + /corporate/ip: + get: + tags: + - Master account + summary: List of all IPs + description: This endpoint allows you to retrieve the list of active IPs on your Admin account + responses: + 200: + description: List of all IPs + content: + application/json: + schema: + type: array + items: + type: object + properties: + ip: + type: string + domain: + type: string + transactional: + type: boolean + examples: + response: + value: + - ip: "192.168.1.1" + domain: "example.com" + transactional: true + - ip: "192.168.1.2" + domain: "example.com" + transactional: false + + /corporate/subAccount/ip/associate: + post: + tags: + - Master account + summary: Associate an IP to sub-accounts + description: This endpoint allows to associate an IP to sub-accounts + requestBody: + content: + application/json: + schema: + required: + - ip + - ids + type: object + properties: + ip: + type: string + description: IP address + example: 103.11.32.88 + ids: + items: + type: integer + format: int64 + type: array + description: Pass the list of sub-account Ids to be associated with the IP address + example: [234322, 325553, 893432] + + responses: + 201: + description: IP has been associated with sub-accounts successfully + content: + application/json: + schema: + type: object + examples: + response: + value: + [] + 400: + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + example: + code: invalid id + message: Invalid request + /corporate/subAccount/ip/dissociate: + put: + tags: + - Master account + summary: Dissociate an IP to sub-accounts + description: This endpoint allows to dissociate an IP from sub-accounts + requestBody: + content: + application/json: + schema: + required: + - ip + - ids + type: object + properties: + ip: + type: string + description: IP address + example: 103.11.32.88 + ids: + items: + type: integer + format: int64 + type: array + description: Pass the list of sub-account Ids to be dissociated from the IP address + example: [234322, 325553, 893432] + + responses: + 204: + description: IP has been dissociated from sub-accounts successfully + content: {} + 400: + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + example: + code: invalid id + message: Invalid request + /corporate/group/{id}: + get: + tags: + - Master account + summary: GET a group details + description: This endpoint allows you to retrieve a specific group’s information such as the list of sub-organizations and the user associated with the group. + parameters: + - name: id + in: path + description: Id of the group of sub-organization + required: true + schema: + type: string + responses: + 200: + description: Group details + content: + application/json: + schema: + $ref: '#/components/schemas/corporateGroupDetailsResponse' + example: + group: + id: 5f926dba72a405440a4efc97 + groupName: My group + createdAt: "2024-02-09T06:14:40+00:00" + sub-accounts: + - id: 7866556 + companyName: My sub organization + createdAt: "2024-02-09T06:14:40+00:00" + - id: 6563051 + companyName: Your sub organization + createdAt: "2024-01-05T03:11:40+00:00" + users: + - email: my-user@my-org.com + lastName: Smith + firstName: John + - email: your-user@your-org.com + put: + tags: + - Master account + summary: Update a group of sub-accounts + description: This endpoint allows to update a group of sub-accounts + parameters: + - name: id + in: path + description: Id of the group + required: true + schema: + type: string + requestBody: + description: Group details to be updated. + content: + application/json: + schema: + type: object + properties: + groupName: + type: string + description: The name of the group of sub-accounts + example: My group + subAccountIds: + items: + type: integer + format: int64 + type: array + description: Pass the list of sub-account Ids to be included in the group + example: [234322, 325553, 893432] + required: true + responses: + 204: + description: Group details updated + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + example: + code: invalid_parameter + message: Invalid request + delete: + tags: + - Master account + summary: Delete a group + description: This endpoint allows you to delete a group of sub-organizations. When a group is deleted, the sub-organizations are no longer part of this group. The users associated with the group are no longer associated with the group once deleted. + parameters: + - name: id + description: Id of the group + schema: + type: string + in: path + required: true + responses: + 204: + description: Group deleted + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + example: + code: invalid_parameter + message: Invalid request + /corporate/group/unlink/{groupId}/subAccounts: + put: + tags: + - Master account + summary: Delete sub-account from group + description: This endpoint allows you to remove a sub-organization from a group. + parameters: + - name: groupId + in: path + description: Group id + required: true + schema: + type: string + requestBody: + required: true + description: List of sub-account ids + content: + application/json: + schema: + required: + - subAccountIds + type: object + properties: + subAccountIds: + type: array + description: List of sub-account ids + items: + type: integer + format: int64 + example: [423432, 234323, 87678] + responses: + 204: + description: SubAccounts removed from the group + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + example: + code: invalid_parameter + message: subAccountIds should be array of numeric ids only + /corporate/user/invitation/send: + post: + tags: + - Master account + summary: Send invitation to an admin user + description: | + `This endpoint allows you to invite a member to manage the Admin account + + Features and their respective permissions are as below: + + - `my_plan`: + - "all" + - `api`: + - "none" + - `user_management`: + - "all" + - `app_management` | Not available in ENTv2: + - "all" + - `sub_organization_groups` + - "create" + - "edit_delete" + - `create_sub_organizations` + - "all" + - `manage_sub_organizations` + - "all" + - `analytics` + - "download_data" + - "create_alerts" + - "my_looks" + - "explore_create" + - `security` + - "all" + + **Note**: + - If `all_features_access: false` then only privileges are required otherwise if `true` then it's assumed that all permissions will be there for the invited admin user. + operationId: inviteAdminUser + requestBody: + description: Payload to send an invitation + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/inviteAdminUser' + responses: + 201: + description: Invitation ID + content: + application/json: + schema: + type: object + properties: + id: + type: string + examples: + response: + value: + id: 659xxxxxxxxxxxxxxxx6ef9c8 + 400: + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /corporate/user/invitation/{action}/{email}: + put: + tags: + - Master account + summary: Resend / cancel admin user invitation + description: | + This endpoint will allow the user to: + - Resend an admin user invitation + - Cancel an admin user invitation + parameters: + - name: action + in: path + description: Action to be performed (cancel / resend) + required: true + schema: + type: string + enum: + - resend + - cancel + - name: email + in: path + description: Email address of the recipient + required: true + schema: + type: string + responses: + 200: + description: Response of the action performed + content: + application/json: + schema: + type: object + properties: + message: + type: string + description: Action success message + example: + message: Invitation resent successfully + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + example: + code: invalid_parameter + message: Invitation not found + /corporate/user/revoke/{email}: + delete: + tags: + - Master account + summary: Revoke an admin user + description: This endpoint allows to revoke/remove an invited member of your Admin account + parameters: + - name: email + description: Email of the invited user + schema: + type: string + in: path + required: true + responses: + 204: + description: User revoked + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + example: + code: invalid_parameter + message: Invalid request + /corporate/invited/users: + get: + tags: + - Master account + summary: Get the list of all admin users + description: This endpoint allows you to list all Admin users of your Admin account + operationId: getCorporateInvitedUsersList + responses: + 200: + description: list of all admin users + content: + application/json: + schema: + $ref: '#/components/schemas/getCorporateInvitedUsersList' + examples: + response: + value: + users: + - groups: + - id: 65b1f22c09d6ed67ef1cd123, + name: Test Group1 + - id: 43b1f16c09db4d67af1cd342, + name: Test Group2 + email: master-user2@company.com + is_owner: false + status: active + feature_access: + user_management: ["none"] + api_keys: ["all"] + my_plan: ["all"] + apps_management: ["none"] + sub_organization_groups: ["create", "edit_delete"] + create_sub_organizations: ["all"] + manage_sub_organizations: ["all"] + analytics: ["download_data", "create_alerts","my_looks","explore_create"] + security: ["all"] + - groups: [] + email: master-user3@company.com + is_owner: false + status: active + feature_access: + user_management: ["all"] + api_keys: ["none"] + my_plan: ["none"] + apps_management: ["all"] + sub_organization_groups: ["edit_delete"] + create_sub_organizations: ["all"] + manage_sub_organizations: ["all"] + analytics: ["create_alerts"] + security: ["none"] + /corporate/user/{email}/permissions: + get: + tags: + - Master account + summary: Check admin user permissions + description: This endpoint will provide the list of admin user permissions + operationId: getCorporateUserPermission + parameters: + - name: email + description: Email of the invited user. + in: path + required: true + schema: + type: string + responses: + 200: + description: List of user's permissions + content: + application/json: + schema: + $ref: '#/components/schemas/getCorporateUserPermission' + examples: + response: + value: + email: invitedUser@company.com + status: active + groups: + - id: 6543ab3667ffbb00142e4486 + name: Support + - id: 174bab366732bbce142e4412 + name: Technical + feature_access: + api_keys: ["all"] + my_plan: ["all"] + user_management: ["none"] + apps_management: ["all"] + sub_organization_groups: ["create", "edit_delete"] + create_sub_organizations: ["all"] + manage_sub_organizations: ["all"] + analytics: ["download_data", "create_alerts","my_looks","explore_create"] + security: ["all"] + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + put: + tags: + - Master account + summary: Change admin user permissions + description: This endpoint will allow you to change the permissions of Admin users of your Admin account + parameters: + - name: email + in: path + description: Email address of Admin user + required: true + schema: + type: string + requestBody: + required: true + description: Values to update an admin user permissions + content: + application/json: + example: + all_features_access: false + privileges: + - feature: user_management + permissions: ["all"] + - feature: api + permissions: ["all"] + - feature: my_plan + permissions: ["none"] + - feature: apps_management + permissions: ["all"] + - feature: create_sub_organizations + permissions: ["all"] + - feature: sub_organization_groups + permissions: ["create","edit_delete"] + - feature: manage_sub_organizations + permissions: ["all"] + - feature: security + permissions: ["none"] + - feature: analytics + permissions: ["create_alerts","download_data","my_looks","explore_create"] + schema: + required: + - all_features_access + - privileges + type: object + properties: + all_features_access: + description: All access to the features + type: boolean + example: true + enum: + - true + - false + privileges: + type: array + items: + type: object + description: Permission on features + properties: + feature: + type: string + description: feature name + enum: + - user_management + - api + - my_plan + - apps_management + - analytics + - sub_organization_groups + - create_sub_organizations + - manage_sub_organizations + - security + example: user_management + permissions: + type: array + description: Permission for the feature + items: + type: string + enum: + - all + - none + - create + - edit_delete + - create_alerts + - download_data + - my_looks + - explore_create + example: ["all"] + responses: + 204: + description: User permissions has been modified + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + example: + code: invalid_parameter + message: Invalid email + /corporate/groups: + get: + tags: + - Master account + summary: Get the list of groups + description: This endpoint allows you to list all groups created on your Admin account. + operationId: getSubAccountGroups + responses: + 200: + description: list of all the sub-account groups + content: + application/json: + schema: + type: array + items: + type: object + properties: + id: + type: string + description: Unique id of the group + groupName: + type: string + description: The name of the group of sub-accounts + example: + - id: d3b142c709d6ed67ef1cd903 + groupName: My group 1 + - id: a5b192a709d6ed67ef8fd922 + groupName: My group 2 + - id: bbb142c709d6ed67ef1cd910 + groupName: My group 3 + + /companies: + get: + tags: + - Companies + summary: Get all Companies + parameters: + - name: filters + in: query + schema: + type: string + description: Filter by attrbutes. If you have filter for owner on your side please send it as {"attributes.owner":"6299dcf3874a14eacbc65c46"} + - name: linkedContactsIds + in: query + schema: + type: integer + format: int64 + description: Filter by linked contacts ids + - name: linkedDealsIds + in: query + schema: + type: string + format: objectID + description: Filter by linked Deals ids + - name: page + in: query + schema: + type: integer + format: int64 + description: Index of the first document of the page + - name: limit + in: query + schema: + type: integer + format: int64 + description: Number of documents per page + - name: sort + in: query + schema: + type: string + enum: + - asc + - desc + description: Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed + - name: sortBy + in: query + schema: + type: string + description: The field used to sort field names. + responses: + 200: + description: Returns companies list with filters + content: + application/json: + schema: + $ref: '#/components/schemas/CompaniesList' + 400: + description: Returned when query params are invalid + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Not valid data." + post: + tags: + - Companies + summary: Create a company + requestBody: + required: true + description: Company create data. + content: + application/json: + schema: + required: + - name + properties: + name: + type: string + description: Name of company + example: "company" + attributes: + type: object + description: Attributes for company creation + example: { + "domain": "https://example.com", + "industry": "Fabric", + "owner": "60e68d60582a3b006f524197" + } + countryCode: + type: integer + format: int64 + description: Country code if phone_number is passed in attributes. + example: 91 + linkedContactsIds: + items: + type: integer + format: int64 + type: array + description: Contact ids to be linked with company + example: [ 1, 2, 3] + linkedDealsIds: + items: + type: string + format: objectID + type: array + description: Deal ids to be linked with company + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + type: object + responses: + 200: + description: Created new Company + content: + application/json: + schema: + required: + - id + type: object + description: Created company id + properties: + id: + type: string + description: Unique company id + example: "61a5cd07ca1347c82306ad06" + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Not valid data." + /companies/{id}: + get: + tags: + - Companies + summary: Get a company + parameters: + - name: id + in: path + required: true + schema: + type: string + description: Get Company Details + responses: + 200: + description: Returns the Company + content: + application/json: + schema: + $ref: '#/components/schemas/Company' + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Route company id is not valid." + 404: + description: Returned when item not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Document not found" + delete: + tags: + - Companies + summary: Delete a company + parameters: + - name: id + in: path + required: true + schema: + type: string + description: Company ID to delete + responses: + 204: + description: When company deleted + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Route company id is not valid." + 404: + description: Returned when item not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Document not found" + patch: + tags: + - Companies + summary: Update a company + parameters: + - name: id + in: path + required: true + schema: + type: string + requestBody: + required: true + description: Updated company details. + content: + application/json: + schema: + properties: + name: + type: string + description: Name of company + example: "company" + attributes: + type: object + description: Attributes for company update + example: { + "category": "label_2", + "domain": "xyz", + "date": "2022-05-04T00:00:00+05:30", + "industry": "flipkart", + "number_of_contacts": 1, + "number_of_employees": 100, + "owner": "5b1a17d914b73d35a76ca0c7", + "phone_number": "81718441912", + "revenue": 10000.34222 + } + countryCode: + type: integer + format: int64 + description: Country code if phone_number is passed in attributes. + example: 91 + type: object + responses: + 200: + description: Company updated successfully + content: + application/json: + schema: + $ref: '#/components/schemas/Company' + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Route attribute id is not valid." + 404: + description: Returned when company id is not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Document not found" + /companies/attributes: + get: + tags: + - Companies + summary: Get company attributes + responses: + 200: + description: Returns list of company attributes + content: + application/json: + schema: + $ref: '#/components/schemas/CompanyAttributes' + /companies/link-unlink/{id}: + patch: + tags: + - Companies + summary: Link and Unlink company with contact and deal + parameters: + - name: id + in: path + required: true + schema: + type: string + requestBody: + required: true + description: Linked / Unlinked contacts and deals ids. + content: + application/json: + schema: + properties: + linkContactIds: + items: + type: integer + format: int64 + type: array + description: Contact ids for contacts to be linked with company + example: [ 1, 2, 3] + unlinkContactIds: + items: + type: integer + format: int64 + type: array + description: Contact ids for contacts to be unlinked from company + example: [ 4, 5, 6] + linkDealsIds: + items: + type: string + type: array + description: Deal ids for deals to be linked with company + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + unlinkDealsIds: + items: + type: string + type: array + description: Deal ids for deals to be unlinked from company + example: [ "61a5ce58c5d4795761045994", "61a5ce58c5d479576104595" , "61a5ce58c5d4795761045996"] + type: object + responses: + 204: + description: Successfully linked/unlinked contacts/deals with the company. + 400: + description: Returned when query params are invalid or invalid data provided in request. + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Not valid data." + /companies/import: + post: + tags: + - Companies + summary: Import companies(creation and updation) + description: Import companies from a CSV file with mapping options. + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary + description: | + The CSV file to upload.The file should have the first row as the mapping attribute. Some default attribute names are + (a) company_id [brevo mongoID to update deals] + (b) associated_contact + (c) associated_deal + (f) any other attribute with internal name + + example: false + mapping: + type: object + description: | + The mapping options in JSON format. Here is an example of the JSON structure: + ```json + { + "link_entities": true, // Determines whether to link related entities during the import process + "unlink_entities": false, // Determines whether to unlink related entities during the import process + "update_existing_records": true, // Determines whether to update based on company ID or treat every row as create + "unset_empty_attributes": false // Determines whether to unset a specific attribute during update if the values input is blank + } + ``` + responses: + '200': + description: Successfully imported deals + content: + application/json: + schema: + type: object + properties: + processId: + type: integer + description: The ID of the import process + example: 50 + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + message: + type: string + example: "Bad request : With reason" + /crm/pipeline/details: + get: + tags: + - Deals + summary: Get pipeline stages + description: This endpoint is deprecated. Prefer /crm/pipeline/details/{pipelineID} instead. + deprecated: true + responses: + 200: + description: Returns list of pipeline stages + content: + application/json: + schema: + $ref: '#/components/schemas/Pipeline' + /crm/pipeline/details/{pipelineID}: + get: + tags: + - Deals + summary: Get a pipeline + parameters: + - name: pipelineID + in: path + required: true + schema: + type: string + responses: + 200: + description: Returns pipeline and its details + content: + application/json: + schema: + $ref: '#/components/schemas/Pipelines' + 400: + description: Returned when pipeline id is invalid or does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + Pipeline Not Exist: + value: + "message": "Pipeline not found" + /crm/pipeline/details/all: + get: + tags: + - Deals + summary: Get all pipelines + responses: + 200: + description: Returns list of pipeline and its details + content: + application/json: + schema: + $ref: '#/components/schemas/Pipelines' + 400: + description: Returned when pipeline id is invalid or does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + Pipeline Not Exist: + value: + "message": "Pipeline not found" + /crm/attributes/deals: + get: + tags: + - Deals + summary: Get deal attributes + responses: + 200: + description: Returns list of deal attributes + content: + application/json: + schema: + $ref: '#/components/schemas/DealAttributes' + /crm/deals: + get: + tags: + - Deals + summary: Get all deals + parameters: + - name: filters[attributes.deal_name] + in: query + schema: + type: string + description: Filter by attributes. If you have a filter for the owner on your end, please send it as filters[attributes.deal_owner] and utilize the account email for the filtering. + - name: filters[linkedCompaniesIds] + in: query + schema: + type: string + description: Filter by linked companies ids + - name: filters[linkedContactsIds] + in: query + schema: + type: string + description: Filter by linked companies ids + - name: offset + in: query + schema: + type: integer + format: int64 + description: Index of the first document of the page + - name: limit + in: query + schema: + type: integer + format: int64 + description: Number of documents per page + - name: sort + in: query + schema: + type: string + enum: + - asc + - desc + description: Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed + responses: + 200: + description: Returns deals list with filters + content: + application/json: + schema: + $ref: '#/components/schemas/DealsList' + 400: + description: Returned when query params are invalid + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Not valid data." + post: + tags: + - Deals + summary: Create a deal + requestBody: + required: true + description: Deal create data. + content: + application/json: + schema: + required: + - name + properties: + name: + type: string + description: Name of deal + example: "Deal: Connect with company" + attributes: + type: object + description: | + Attributes for deal creation + + To assign owner of a Deal you can send attributes.deal_owner and utilize the account email or ID. + + If you want to create a deal on a specific pipeline and stage you can use the following attributes `pipeline` and `deal_stage`. + + Pipeline and deal_stage are ids you can fetch using this endpoint `/crm/pipeline/details/{pipelineID}` + example: { + deal_owner: "6093d2425a9b436e9519d034", + amount: 12 + } + linkedContactsIds: + items: + type: integer + format: int64 + type: array + description: Contact ids to be linked with deal + example: [ 1, 2, 3] + linkedCompaniesIds: + items: + type: string + format: objectID + type: array + description: Company ids to be linked with deal + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + type: object + responses: + 201: + description: Created new Deal + content: + application/json: + schema: + required: + - id + type: object + description: Created deal id + properties: + id: + type: string + description: Unique deal id + example: "61a5cd07ca1347c82306ad06" + 400: + description: Returned when invalid data posted + /crm/deals/{id}: + get: + tags: + - Deals + summary: Get a deal + parameters: + - name: id + in: path + required: true + schema: + type: string + responses: + 200: + description: Returns the deal by id + content: + application/json: + schema: + $ref: '#/components/schemas/Deal' + 400: + description: Returned when task id is invalid + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Route attribute id is not valid." + 404: + description: Returned when item not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Document not found" + delete: + tags: + - Deals + summary: Delete a deal + parameters: + - name: id + in: path + required: true + schema: + type: string + responses: + 204: + description: Returned when item deleted + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Route attribute id is not valid." + 404: + description: Returned when deal id is not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Document not found" + patch: + tags: + - Deals + summary: Update a deal + parameters: + - name: id + in: path + required: true + schema: + type: string + requestBody: + required: true + description: Updated deal details. + content: + application/json: + schema: + properties: + name: + type: string + description: Name of deal + example: "Deal: Connect with client" + attributes: + type: object + description: | + Attributes for deal update + + To assign owner of a Deal you can send attributes.deal_owner and utilize the account email or ID. + + If you wish to update the pipeline of a deal you need to provide the `pipeline` and the `deal_stage` + + Pipeline and deal_stage are ids you can fetch using this endpoint `/crm/pipeline/details/{pipelineID}` + example: { + deal_owner: "6093d2425a9b436e9519d034", + amount: 12 + } + type: object + responses: + 204: + description: Deal updated successfully + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Route attribute id is not valid." + 404: + description: Returned when deal id is not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Document not found" + /crm/deals/link-unlink/{id}: + patch: + tags: + - Deals + summary: Link and Unlink a deal with contacts and companies + parameters: + - name: id + in: path + required: true + schema: + type: string + requestBody: + required: true + description: Linked / Unlinked contacts and companies ids. + content: + application/json: + schema: + properties: + linkContactIds: + items: + type: integer + format: int64 + type: array + description: Contact ids for contacts to be linked with deal + example: [ 1, 2, 3] + unlinkContactIds: + items: + type: integer + format: int64 + type: array + description: Contact ids for contacts to be unlinked from deal + example: [ 4, 5, 6] + linkCompanyIds: + items: + type: string + type: array + description: Company ids to be linked with deal + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + unlinkCompanyIds: + items: + type: string + type: array + description: Company ids to be unlinked from deal + example: [ "61a5ce58c5d4795761045994", "61a5ce58c5d479576104595" , "61a5ce58c5d4795761045996"] + type: object + responses: + 204: + description: Successfully linked/unlinked contacts/companies with the deal. + 400: + description: Returned when query params are invalid or invalid data provided in request. + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Not valid data." + /crm/deals/import: + post: + tags: + - Deals + summary: Import deals(creation and updation) + description: Import deals from a CSV file with mapping options. + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary + description: | + The CSV file to upload.The file should have the first row as the mapping attribute. Some default attribute names are + (a) deal_id [brevo mongoID to update deals] + (b) associated_contact + (c) associated_company + (f) any other attribute with internal name + + example: false + mapping: + type: object + description: | + The mapping options in JSON format. Here is an example of the JSON structure: + ```json + { + "link_entities": true, // Determines whether to link related entities during the import process + "unlink_entities": false, // Determines whether to unlink related entities during the import process + "update_existing_records": true, // Determines whether to update based on company ID or treat every row as create + "unset_empty_attributes": false // Determines whether to unset a specific attribute during update if the values input is blank + } + ``` + responses: + '200': + description: Successfully imported deals + content: + application/json: + schema: + type: object + properties: + processId: + type: integer + description: The ID of the import process + example: 50 + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + message: + type: string + example: "Bad request : With reason" + /crm/tasktypes: + get: + tags: + - Tasks + summary: Get all task types + responses: + 200: + description: Returns all the Task types + content: + application/json: + schema: + $ref: '#/components/schemas/TaskTypes' + /crm/tasks: + get: + tags: + - Tasks + summary: Get all tasks + parameters: + - name: filter[type] + in: query + schema: + type: string + description: Filter by task type (ID) + - name: filter[status] + in: query + schema: + type: string + enum: + - done + - undone + description: Filter by task status + - name: filter[date] + in: query + schema: + type: string + enum: + - overdue + - today + - tomorrow + - week + - range + description: Filter by date + - name: filter[assignTo] + in: query + schema: + type: string + description: Filter by the "assignTo" ID. You can utilize account emails for the "assignTo" attribute. + - name: filter[contacts] + in: query + schema: + type: string + description: Filter by contact ids + - name: filter[deals] + in: query + schema: + type: string + description: Filter by deals ids + - name: filter[companies] + in: query + schema: + type: string + description: Filter by companies ids + - name: dateFrom + in: query + schema: + type: integer + description: dateFrom to date range filter type (timestamp in milliseconds) + - name: dateTo + in: query + schema: + type: integer + description: dateTo to date range filter type (timestamp in milliseconds) + - name: offset + in: query + schema: + type: integer + format: int64 + description: Index of the first document of the page + - name: limit + in: query + schema: + type: integer + default: 50 + format: int64 + description: Number of documents per page + - name: sort + in: query + schema: + type: string + enum: + - asc + - desc + description: Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed + - name: sortBy + in: query + schema: + type: string + description: The field used to sort field names. + example: name + responses: + 200: + description: Returns task list with filters + content: + application/json: + schema: + $ref: '#/components/schemas/TaskList' + 400: + description: Returned when query params are invalid + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Not valid data." + post: + tags: + - Tasks + summary: Create a task + requestBody: + required: true + description: Task name. + content: + application/json: + schema: + required: + - name + - taskTypeId + - date + properties: + name: + type: string + description: Name of task + example: "Task: Connect with client" + duration: + type: integer + description: Duration of task in milliseconds [1 minute = 60000 ms] + example: 600000 + format: int64 + minimum: 0 + taskTypeId: + type: string + description: Id for type of task e.g Call / Email / Meeting etc. + example: "61a5cd07ca1347c82306ad09" + date: + type: string + format: date-time + example: "2021-11-01T17:44:54.668Z" + description: Task due date and time + notes: + type: string + description: Notes added to a task + example: "In communication with client for resolution of queries." + done: + type: boolean + description: Task marked as done + example: false + assignToId: + type: string + description: To assign a task to a user you can use either the account email or ID. + example: "5faab4b7f195bb3c4c31e62a" + contactsIds: + items: + type: integer + type: array + description: Contact ids for contacts linked to this task + example: [ 1, 2, 3] + dealsIds: + items: + type: string + type: array + description: Deal ids for deals a task is linked to + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + companiesIds: + items: + type: string + type: array + description: Companies ids for companies a task is linked to + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + reminder: + $ref: '#/components/schemas/TaskReminder' + type: object + responses: + 201: + description: Created new task + content: + application/json: + schema: + required: + - id + type: object + description: Task Details + properties: + id: + type: string + description: Unique task id + example: "61a5cd07ca1347c82306ad06" + 400: + description: Returned when invalid data posted + /crm/tasks/{id}: + get: + tags: + - Tasks + summary: Get a task + parameters: + - name: id + in: path + required: true + schema: + type: string + responses: + 200: + description: Returns the Task by id + content: + application/json: + schema: + $ref: '#/components/schemas/Task' + 400: + description: Returned when task id is invalid + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Route attribute id is not valid." + 404: + description: Returned when item not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Document not found" + delete: + tags: + - Tasks + summary: Delete a task + parameters: + - name: id + in: path + required: true + schema: + type: string + responses: + 204: + description: Returned when item deleted + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Route attribute id is not valid." + 404: + description: Returned when task id is not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Document not found" + patch: + tags: + - Tasks + summary: Update a task + parameters: + - name: id + in: path + required: true + schema: + type: string + requestBody: + required: true + description: Updated task details. + content: + application/json: + schema: + properties: + name: + type: string + description: Name of task + example: "Task: Connect with client" + duration: + type: integer + description: Duration of task in milliseconds [1 minute = 60000 ms] + format: int64 + example: 600000 + taskTypeId: + type: string + description: Id for type of task e.g Call / Email / Meeting etc. + example: "61a5cd07ca1347c82306ad09" + date: + type: string + format: date-time + example: "2021-11-01T17:44:54.668Z" + description: Task date/time + notes: + type: string + description: Notes added to a task + example: "In communication with client for resolution of queries." + done: + type: boolean + description: Task marked as done + example: false + assignToId: + type: string + description: To assign a task to a user you can use either the account email or ID. + example: "5faab4b7f195bb3c4c31e62a" + contactsIds: + items: + type: integer + type: array + description: Contact ids for contacts linked to this task + example: [ 1, 2, 3] + dealsIds: + items: + type: string + type: array + description: Deal ids for deals a task is linked to + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + companiesIds: + items: + type: string + type: array + description: Companies ids for companies a task is linked to + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + reminder: + $ref: "#/components/schemas/TaskReminder" + type: object + responses: + 204: + description: Task updated succussfully + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Route attribute id is not valid." + 404: + description: Returned when task id is not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Document not found" + /crm/notes: + get: + tags: + - Notes + summary: Get all notes + parameters: + - name: entity + in: query + schema: + type: string + enum: + - companies + - deals + - contacts + description: Filter by note entity type + - name: entityIds + in: query + schema: + type: string + description: Filter by note entity IDs + - name: dateFrom + in: query + schema: + type: integer + description: dateFrom to date range filter type (timestamp in milliseconds) + - name: dateTo + in: query + schema: + type: integer + description: dateTo to date range filter type (timestamp in milliseconds) + - name: offset + in: query + schema: + type: integer + format: int64 + description: Index of the first document of the page + - name: limit + in: query + schema: + type: integer + default: 50 + format: int64 + description: Number of documents per page + - name: sort + in: query + schema: + type: string + enum: + - asc + - desc + description: Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed + responses: + 200: + description: Returns notes list with filters + content: + application/json: + schema: + $ref: '#/components/schemas/NoteList' + 400: + description: Returned when query params are invalid + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Not valid data." + post: + tags: + - Notes + summary: Create a note + requestBody: + required: true + description: Note data to create a note. + content: + application/json: + schema: + $ref: "#/components/schemas/NoteData" + responses: + 200: + description: Created new note + content: + application/json: + schema: + $ref: '#/components/schemas/NoteId' + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Not valid data." + 415: + description: Format is not supported + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "The format not supported for deserialization." + /crm/notes/{id}: + get: + tags: + - Notes + summary: Get a note + parameters: + - name: id + in: path + required: true + schema: + type: string + description: Note ID to get + responses: + 200: + description: Returns the Note by id + content: + application/json: + schema: + $ref: '#/components/schemas/Note' + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Route attribute id is not valid." + 404: + description: Returned when item not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Document not found" + patch: + tags: + - Notes + summary: Update a note + parameters: + - name: id + in: path + required: true + schema: + type: string + description: Note ID to update + requestBody: + required: true + description: Note data to update a note. + content: + application/json: + schema: + $ref: "#/components/schemas/NoteData" + responses: + 204: + description: Note updated successfully + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Not valid data." + 404: + description: Returned when item not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Document not found" + 415: + description: Format is not supported + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "The format not supported for deserialization." + delete: + tags: + - Notes + summary: Delete a note + parameters: + - name: id + in: path + required: true + schema: + type: string + description: Note ID to delete + responses: + 204: + description: Returned when item deleted + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Route attribute id is not valid." + 404: + description: Returned when item not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Document not found" + /crm/files: + get: + tags: + - Files + summary: Get all files + parameters: + - name: entity + in: query + schema: + type: string + enum: + - companies + - deals + - contacts + description: Filter by file entity type + required: false + - name: entityIds + in: query + schema: + type: string + description: Filter by file entity IDs + required: false + - name: dateFrom + in: query + schema: + type: integer + description: dateFrom to date range filter type (timestamp in milliseconds) + required: false + - name: dateTo + in: query + schema: + type: integer + description: dateTo to date range filter type (timestamp in milliseconds) + required: false + - name: offset + in: query + schema: + type: integer + format: int64 + description: Index of the first document of the page + required: false + - name: limit + in: query + schema: + type: integer + format: int64 + default: 50 + description: Number of documents per page + required: false + - name: sort + in: query + schema: + type: string + enum: + - asc + - desc + description: Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed + required: false + responses: + 200: + description: Returns files list with filters + content: + application/json: + schema: + $ref: '#/components/schemas/FileList' + 400: + description: Returned when query params are invalid + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Not valid data." + post: + tags: + - Files + summary: Upload a file + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary + description: File data to create a file. + dealId: + type: string + contactId: + type: integer + format: int64 + companyId: + type: string + required: + - file + responses: + 201: + description: Returns the created File with additional details + content: + application/json: + schema: + $ref: '#/components/schemas/FileData' + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Invalid deals ids format." + /crm/files/{id}: + get: + tags: + - Files + summary: Download a file + parameters: + - in: path + name: id + required: true + schema: + type: string + description: File id to download. + responses: + 200: + description: Returns downloadable file link. Valid for next 5 minutes only. + content: + application/json: + schema: + $ref: '#/components/schemas/FileDownloadableLink' + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Route attribute id is not valid" + 404: + description: Returned when item not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Document not found" + delete: + tags: + - Files + summary: Delete a file + parameters: + - in: path + name: id + required: true + schema: + type: string + description: File id to delete. + responses: + 204: + description: Returned when file is deleted. + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Route attribute id is not valid" + 404: + description: Returned when item not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Document not found" + /crm/files/{id}/data: + get: + tags: + - Files + summary: Get file details + parameters: + - in: path + name: id + required: true + schema: + type: string + description: File id to get file data. + responses: + 200: + description: Returned when file is found. + content: + application/json: + schema: + $ref: '#/components/schemas/FileData' + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Route attribute id is not valid" + 404: + description: Returned when item not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + examples: + response: + value: + "message": "Document not found" + /conversations/messages: + post: + tags: + - Conversations + summary: Send a message as an agent + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - visitorId + - text + properties: + visitorId: + description: visitor’s ID received from a webhook or generated by you to bind existing user account to Conversations + text: + description: message text + agentId: + description: agent ID. It can be found on agent’s page or received from a webhook. Alternatively, you can use `agentEmail` + `agentName` + `receivedFrom` instead (all 3 fields required). + receivedFrom: + description: mark your messages to distinguish messages created by you from the others. + agentEmail: + description: agent email. When sending messages from a standalone system, it’s hard to maintain a 1-to-1 relationship between the users of both systems. In this case, an agent can be specified by their email address. + agentName: + description: agent name + examples: + Basic use: + value: + visitorId: kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg + text: Hello! How can I help you? + agentId: d9nKoegKSjmCtyK78 + receivedFrom: + description: When you receive a webhook, you might want to distinguish messages created by you from the others. Use receivedFrom property to mark your messages + value: + visitorId: kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg + text: Hello! How can I help you? + agentId: d9nKoegKSjmCtyK78 + receivedFrom: SuperAwesomeHelpdesk + agentEmail + agentName + receivedFrom: + description: When sending messages from a standalone system, it’s hard to maintain a 1-to-1 relationship between the users of both systems. In this case, an agent can be specified by their email address. If there’s no agent with the specified email address in your Brevo organization, a dummy agent will be created automatically. + value: + visitorId: kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg + text: Hello! How can I help you? + agentEmail: liz@getwear.com + agentName: Liz + receivedFrom: SuperAwesomeHelpdesk + responses: + 200: + description: Newly created message is returned as a response + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationsMessage' + examples: + response: + value: + id: eYBEm3gq3zc5ayE2g + type: agent + text: Hello! How can I help you? + visitorId: kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg + agentId: d9nKoegKSjmCtyK78 + createdAt: 1482512803740 + receivedFrom: SuperAwesomeHelpdesk + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /conversations/messages/{id}: + get: + tags: + - Conversations + summary: Get a message + parameters: + - in: path + name: id + schema: + type: string + required: true + description: ID of the message + responses: + 200: + description: Requested message is returned as a response + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationsMessage' + examples: + requested message: + value: + id: eYBEm3gq3zc5ayE2g + type: agent + text: Hello! How can I help you? + visitorId: kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg + agentId: d9nKoegKSjmCtyK78 + createdAt: 1482512803740 + receivedFrom: SuperAwesomeHelpdesk + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Returned when item not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + put: + tags: + - Conversations + summary: Update a message sent by an agent + description: Only agents’ messages can be edited. + parameters: + - in: path + name: id + schema: + type: string + required: true + description: ID of the message + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - text + properties: + text: + type: string + description: edited message text + examples: + edition: + value: + text: Good morning! How can I help you? + responses: + 200: + description: Updated message is returned as a response + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationsMessage' + examples: + edited message: + value: + id: eYBEm3gq3zc5ayE2g + type: agent + text: Hello! How can I help you? + visitorId: kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg + agentId: d9nKoegKSjmCtyK78 + createdAt: 1482512803740 + receivedFrom: SuperAwesomeHelpdesk + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Returned when item not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + delete: + tags: + - Conversations + summary: Delete a message sent by an agent + description: Only agents’ messages can be deleted. + parameters: + - in: path + name: id + schema: + type: string + required: true + description: ID of the message + responses: + 204: + description: The message was deleted from the conversation + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Returned when item not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /conversations/pushedMessages: + post: + tags: + - Conversations + summary: Send an automated message to a visitor + description: "Example of automated messages: order status, announce new features in your web app, etc." + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - visitorId + - text + properties: + visitorId: + description: visitor’s ID received from a webhook or generated by you to bind existing user account to Conversations + text: + description: message text + agentId: + description: agent ID. It can be found on agent’s page or received from a webhook. + groupId: + description: group ID. It can be found on group’s page. + examples: + Random agent: + value: + visitorId: kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg + text: "Your order has shipped! Here’s your tracking number: 9114 5847 3325 9667 4328 88" + Agent group: + description: "Send a message on behalf of a random agent from one of your agent groups" + value: + visitorId: kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg + text: "Your order has shipped! Here’s your tracking number: 9114 5847 3325 9667 4328 88" + groupId: PjRBMhWGen6aRHjif + Specific agent: + description: Send a message on behalf of a specific agent + value: + visitorId: kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg + text: "Your order has shipped! Here’s your tracking number: 9114 5847 3325 9667 4328 88" + agentId: d9nKoegKSjmCtyK78 + responses: + 200: + description: Newly created message is returned as a response + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationsMessage' + examples: + response: + value: + id: AXCR3k9bpSY7bpuh7 + type: agent + text: "Your order has shipped! Here’s your tracking number: 9114 5847 3325 9667 4328 88" + visitorId: kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg + agentId: d9nKoegKSjmCtyK78 + createdAt: 1470222622433 + isPushed: true + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /conversations/pushedMessages/{id}: + get: + tags: + - Conversations + summary: Get an automated message + parameters: + - in: path + name: id + schema: + type: string + required: true + description: ID of the message sent previously + responses: + 200: + description: Requested message is returned as a response + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationsMessage' + examples: + requested message: + value: + id: AXCR3k9bpSY7bpuh7 + type: agent + text: "Your order has shipped! Here’s your tracking number: 9114 5847 3325 9667 4328 88" + visitorId: kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg + agentId: d9nKoegKSjmCtyK78 + createdAt: 1470222622433 + isPushed: true + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Returned when item not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + put: + tags: + - Conversations + summary: Update an automated message + parameters: + - in: path + name: id + schema: + type: string + required: true + description: ID of the message + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - text + properties: + text: + type: string + description: edited message text + examples: + edition: + value: + text: "Your order has shipped! Here’s your tracking number: 9114 5847 4668 7775 9233 54" + responses: + 200: + description: Updated message is returned as a response + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationsMessage' + examples: + updated message: + value: + id: AXCR3k9bpSY7bpuh7 + type: agent + text: "Your order has shipped! Here’s your tracking number: 9114 5847 4668 7775 9233 54" + visitorId: kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg + agentId: d9nKoegKSjmCtyK78 + createdAt: 1470222622433 + isPushed: true + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Returned when item not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + delete: + tags: + - Conversations + summary: Delete an automated message + parameters: + - in: path + name: id + schema: + type: string + required: true + description: ID of the message + responses: + 204: + description: The message was deleted from the conversation + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Returned when item not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /conversations/agentOnlinePing: + post: + tags: + - Conversations + summary: Sets agent’s status to online for 2-3 minutes + description: We recommend pinging this endpoint every minute for as long as the agent has to be considered online. + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + agentId: + description: agent ID. It can be found on agent’s page or received from a webhook. Alternatively, you can use `agentEmail` + `agentName` + `receivedFrom` instead (all 3 fields required). + receivedFrom: + description: mark your messages to distinguish messages created by you from the others. + agentEmail: + description: agent email. When sending online pings from a standalone system, it’s hard to maintain a 1-to-1 relationship between the users of both systems. In this case, an agent can be specified by their email address. If there’s no agent with the specified email address in your Brevo organization, a dummy agent will be created automatically. + agentName: + description: agent name + examples: + Basic use: + value: + agentId: d9nKoegKSjmCtyK78 + agentEmail + agentName + receivedFrom: + value: + agentEmail: liz@getwear.com + agentName: Liz + receivedFrom: SuperAwesomeHelpdesk + responses: + 201: + description: Status of the agent was set successfully. Response body will be empty. + 400: + description: Returned when invalid data posted + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /ecommerce/activate: + post: + tags: + - Ecommerce + summary: "Activate the eCommerce app" + description: "Getting access to Brevo eCommerce." + responses: + 200: + description: 'eCommerce activation is in process, please wait for 5 minutes.' + 401: + description: unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: api-key not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /ecommerce/config/displayCurrency: + post: + tags: + - Ecommerce + summary: Set the ISO 4217 compliant display currency code for your Brevo account + operationId: setConfigDisplayCurrency + requestBody: + description: set ISO 4217 compliant display currency code payload + content: + application/json: + schema: + type: object + required: + - code + properties: + code: + description: ISO 4217 compliant display currency code + type: string + example: "EUR" + responses: + 200: + description: OK + content: + application/json: + schema: + type: object + required: + - code + properties: + code: + description: ISO 4217 compliant display currency code + type: string + example: "EUR" + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 401: + description: unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 403: + description: Permission denied. eCommerce is not activated. + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 422: + description: Invalid ISO 4217 currency code. + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + get: + tags: + - Ecommerce + summary: Get the ISO 4217 compliant display currency code for your Brevo account + responses: + 200: + description: OK + content: + application/json: + schema: + type: object + required: + - code + properties: + code: + description: ISO 4217 compliant display currency code + type: string + example: "EUR" + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 401: + description: unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 403: + description: Permission denied. eCommerce is not activated. + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /ecommerce/attribution/metrics: + get: + tags: + - Ecommerce + summary: Get attribution metrics for one or more Brevo campaigns + parameters: + - in: query + name: periodFrom + description: When getting metrics for a specific period, define the starting datetime in RFC3339 format + schema: + type: string + format: date-time + example: "2022-01-02T00:00:00Z" + - in: query + name: periodTo + description: When getting metrics for a specific period, define the end datetime in RFC3339 format + schema: + type: string + format: date-time + example: "2022-01-03T00:00:00Z" + - in: query + name: emailCampaignId[] + description: The email campaign id(s) to get metrics for + schema: + type: array + items: + type: number + format: integer + example: 1 + responses: + 200: + description: OK + content: + application/json: + schema: + type: object + required: + - results + - totals + properties: + results: + description: List of conversion attribution metrics + type: array + example: [ + {"id":2, "conversionSource": "email_campaign", "ordersCount":300, "revenue":900, "averageBasket":3.00}, + {"id":1, "conversionSource": "email_campaign", "ordersCount":200, "revenue":800, "averageBasket":4.00} + ] + items: + type: object + $ref: "#/components/schemas/ConversionSourceMetrics" + totals: + description: Attribution list aggregated totals + type: object + example: { + "ordersCount": 500, + "revenue": 1700.00, + "averageBasket": 3.40 + } + required: + - ordersCount + - revenue + - averageBasket + properties: + ordersCount: + type: number + format: integer + revenue: + type: number + format: float + averageBasket: + type: number + format: float + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + + /ecommerce/attribution/metrics/{conversionSource}/{conversionSourceId}: + get: + tags: + - Ecommerce + summary: Get detailed attribution metrics for a single Brevo campaign + parameters: + - in: path + name: conversionSource + description: The Brevo campaign type for which data will be retrieved + required: true + schema: + type: string + enum: + - email_campaign + - in: path + name: conversionSourceId + description: The Brevo campaign id for which data will be retrieved + required: true + schema: + type: number + format: integer + example: 1 + responses: + 200: + description: OK + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/ConversionSourceMetrics" + - type: object + required: + - newCustomersCount + properties: + newCustomersCount: + type: number + format: integer + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /ecommerce/attribution/products/{conversionSource}/{conversionSourceId}: + get: + tags: + - Ecommerce + summary: Get attributed product sales for a single Brevo campaign + parameters: + - in: path + name: conversionSource + description: The Brevo campaign type for which data will be retrieved + required: true + schema: + type: string + enum: + - email_campaign + - in: path + name: conversionSourceId + description: The Brevo campaign id for which data will be retrieved + required: true + schema: + type: number + format: integer + example: 1 + responses: + 200: + description: OK + content: + application/json: + schema: + type: object + required: + - products + properties: + products: + description: List of attributed products + type: array + items: + type: object + $ref: "#/components/schemas/ConversionSourceProduct" + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /orders: + get: + tags: + - Ecommerce + summary: Get order details + description: Get all the orders + operationId: getOrders + parameters: + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 100 + type: integer + format: int64 + default: 50 + - name: offset + in: query + description: Index of the first document in the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + - name: modifiedSince + in: query + description: | + Filter (urlencoded) the orders 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.** + schema: + type: string + - name: createdSince + in: query + description: | + Filter (urlencoded) the orders created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** + schema: + type: string + responses: + 200: + description: orders fetched successfully + content: + application/json: + examples: + response: + value: + orders: + - id: order1803 + createdAt: 2021-12-31T11:42:35.638Z + updatedAt: 2022-03-03T14:48:31.867Z + contact_id: 2 + status: complete + amount: 2000 + storeId: "123" + identifiers: + loyalty_subscription_id: "1234" + ext_id: "ab12" + billing: + address: Sec 62, Noida + city: Noida + countryCode: IN + phone: 9238283982 + postCode: 110001 + paymentMethod: Net banking + region: North India + products: + - productId: 21 + quantity: 2 + variantId: P100 + price: 100 + - productId: 21 + quantity: 2 + variantId: P15756 + price: 100 + email: testvisitor@sendinblue.com + coupons: [ + "flat50", + "flat40" + ] + count: 1 + + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + + /orders/status: + post: + tags: + - Ecommerce + summary: Managing the status of the order + description: Manages the transactional status of the order + operationId: createOrder + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/order' + responses: + 204: + description: Order Event posted + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /orders/status/batch: + post: + tags: + - Ecommerce + summary: Create orders in batch + description: Create multiple orders at one time instead of one order at a time + operationId: createBatchOrder + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/orderBatch' + responses: + 202: + $ref: '#/components/responses/createdBatchId' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /events: + post: + tags: + - Event + summary: Create an event + description: Create an event to track a contact's interaction. + operationId: createEvent + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/event' + responses: + 204: + description: An event posted + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 401: + description: unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /categories: + get: + tags: + - Ecommerce + summary: Return all your categories + operationId: getCategories + parameters: + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 100 + type: integer + format: int64 + default: 50 + - name: offset + in: query + description: Index of the first document in the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + - name: ids + in: query + schema: + type: array + items: + type: string + description: Filter by category ids + - name: name + in: query + schema: + type: string + description: Filter by category name + - name: modifiedSince + in: query + description: | + Filter (urlencoded) the categories 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.** + schema: + type: string + - name: createdSince + in: query + description: | + Filter (urlencoded) the categories created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** + schema: + type: string + + responses: + 200: + description: All categories listed + content: + application/json: + schema: + $ref: '#/components/schemas/getCategories' + examples: + response: + value: + categories: + - id: 19 + name: Food + url: http://mydomain.com/category/food + modifiedAt: 2022-03-03T14:48:31.867Z + createdAt: 2021-12-31T11:42:35.638Z + - id: 20 + name: clothing + url: http://mydomain.com/category/clothing + modifiedAt: 2022-03-03T14:48:31.867Z + createdAt: 2021-12-31T11:42:35.638Z + isDeleted: true + count: 2 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + post: + tags: + - Ecommerce + summary: Create/Update a category + operationId: createUpdateCategory + requestBody: + description: Values to create/update a category + content: + application/json: + schema: + $ref: '#/components/schemas/createUpdateCategory' + required: true + responses: + 201: + description: Category created + content: + application/json: + schema: + $ref: '#/components/schemas/createCategoryModel' + examples: + response: + value: + id: 21 + 204: + description: Category updated + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /categories/{id}: + get: + tags: + - Ecommerce + summary: Get a category details + operationId: getCategoryInfo + parameters: + - name: id + in: path + description: Category ID + required: true + schema: + type: string + responses: + 200: + description: Category informations + content: + application/json: + schema: + $ref: '#/components/schemas/getCategoryDetails' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Category id not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /categories/batch: + post: + tags: + - Ecommerce + summary: Create categories in batch + operationId: createUpdateBatchCategory + requestBody: + description: Values to create a batch of categories + content: + application/json: + schema: + $ref: '#/components/schemas/createUpdateBatchCategory' + required: true + responses: + 201: + description: Category created and updated + content: + application/json: + schema: + $ref: '#/components/schemas/createUpdateBatchCategoryModel' + examples: + response: + value: + createdCount: 2 + updatedCount: 7 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /products: + get: + tags: + - Ecommerce + summary: Return all your products + operationId: getProducts + parameters: + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 1000 + type: integer + format: int64 + default: 50 + - name: offset + in: query + description: Index of the first document in the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + - name: ids + in: query + schema: + type: array + items: + type: string + description: Filter by product ids + - name: name + in: query + schema: + type: string + description: Filter by product name, minimum 3 characters should be present for search + - name: price[lte] + in: query + schema: + type: number + description: Price filter for products less than and equals to particular amount + - name: price[gte] + in: query + schema: + type: number + description: Price filter for products greater than and equals to particular amount + - name: price[lt] + in: query + schema: + type: number + description: Price filter for products less than particular amount + - name: price[gt] + in: query + schema: + type: number + description: Price filter for products greater than particular amount + - name: price[eq] + in: query + schema: + type: number + description: Price filter for products equals to particular amount + - name: price[ne] + in: query + schema: + type: number + description: Price filter for products not equals to particular amount + - name: categories + in: query + schema: + type: array + items: + type: string + description: Filter by product categories + - name: modifiedSince + in: query + description: | + Filter (urlencoded) the orders 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.** + schema: + type: string + - name: createdSince + in: query + description: | + Filter (urlencoded) the orders created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** + schema: + type: string + responses: + 200: + description: All products listed + content: + application/json: + schema: + $ref: '#/components/schemas/getProducts' + examples: + response: + value: + products: + - id: 7498033266862 + name: Alpina Panoma Classic + url: https://mydomain.com/products/alpina-panoma-classic + sku: 186622-9 + imageUrl: http://mydomain.com/product-absoulte-url/img.jpeg + categories: [ + "279638835374", + "279502848174", + ] + price: 49.95 + modifiedAt: 2022-06-30T10:29:16.078Z + createdAt: 2022-06-30T10:29:16.078Z + s3Original: https://img-ecom.mailinblue.com/path-to-original/img.jpg + s3ThumbAnalytics: https://img-ecom.mailinblue.com/path-to-analytics/img.jpg + s3ThumbEditor: https://img-ecom.mailinblue.com/path-to-editor/img.jpg + - id: 7498033266862 + name: Alpina Panoma Classic2 + url: https://mydomain.com/products/alpina-panoma-classic2 + sku: 186622-9 + imageUrl: http://mydomain.com/product-absoulte-url/img.jpeg + categories: [ + "2d79638835374", + "27d9502848174", + ] + price: 49.95 + metaInfo: { + description: "Shoes for sports", + brand: "addidas", + } + modifiedAt: 2022-06-30T10:29:16.078Z + createdAt: 2022-06-30T10:29:16.078Z + s3Original: https://img-ecom.mailinblue.com/path-to-original/img.jpg + s3ThumbAnalytics: https://img-ecom.mailinblue.com/path-to-analytics/img.jpg + s3ThumbEditor: https://img-ecom.mailinblue.com/path-to-editor/img.jpg + isDeleted: true + count: 2 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + post: + tags: + - Ecommerce + summary: Create/Update a product + operationId: createUpdateProduct + requestBody: + description: Values to create/update a product + content: + application/json: + schema: + $ref: '#/components/schemas/createUpdateProduct' + required: true + responses: + 201: + description: Product created + content: + application/json: + schema: + $ref: '#/components/schemas/createProductModel' + examples: + response: + value: + id: 21 + 204: + description: Product updated + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /products/{id}: + get: + tags: + - Ecommerce + summary: Get a product's details + operationId: getProductInfo + parameters: + - name: id + in: path + description: Product ID + required: true + schema: + type: string + responses: + 200: + description: Product informations + content: + application/json: + schema: + $ref: '#/components/schemas/getProductDetails' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Product's id not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /products/batch: + post: + tags: + - Ecommerce + summary: Create products in batch + operationId: createUpdateBatchProducts + requestBody: + description: Values to create a batch of products + content: + application/json: + schema: + $ref: '#/components/schemas/createUpdateBatchProducts' + required: true + responses: + 201: + description: Products created and updated + content: + application/json: + schema: + $ref: '#/components/schemas/createUpdateBatchProductsModel' + examples: + response: + value: + createdCount: 2 + updatedCount: 7 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + + /couponCollections: + get: + tags: + - Coupons + summary: Get all your coupon collections + operationId: getCouponCollections + parameters: + - name: limit + in: query + description: Number of documents returned per page + schema: + type: integer + format: int64 + default: 50 + minimum: 0 + maximum: 100 + - name: offset + in: query + description: Index of the first document on the page + schema: + type: integer + format: int64 + default: 0 + minimum: 0 + - name: sort + in: query + description: Sort the results by creation time in ascending/descending order + schema: + type: string + enum: + - asc + - desc + default: desc + - name: sortBy + in: query + description: The field used to sort coupon collections + required: false + schema: + type: string + enum: + - createdAt + - remainingCoupons + - expirationDate + default: createdAt + responses: + 200: + description: Coupon collections + content: + application/json: + schema: + $ref: '#/components/schemas/getCouponCollection' + examples: + response: + value: + collections: + - id: 23befbae-1505-47a8-bd27-e30ef739f32c + name: Summer + defaultCoupon: 10 OFF + createdAt: 2017-03-12T12:30:00Z + totalCoupons: 10000 + remainingCoupons: 5000 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 401: + description: unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + post: + tags: + - Coupons + summary: Create а coupon collection + operationId: createCouponCollection + requestBody: + description: Values to create a coupon collection + required: true + content: + application/json: + schema: + required: + - name + - defaultCoupon + type: object + properties: + name: + description: Name of the coupons collection + type: string + example: "10%OFF" + defaultCoupon: + description: Default coupons collection name + type: string + example: "Winter" + expirationDate: + description: Specify an expiration date for the coupon collection in RFC3339 format. Use null to remove the expiration date. + type: string + format: date-time + example: "2022-01-02T00:00:00Z" + remainingDaysAlert: + description: Send a notification alert (email) when the remaining days until the expiration date are equal or fall bellow this number. Use null to disable alerts. + type: integer + example: 5 + remainingCouponsAlert: + description: Send a notification alert (email) when the remaining coupons count is equal or fall bellow this number. Use null to disable alerts. + type: integer + example: 5 + responses: + 201: + description: Coupon collection created + content: + application/json: + schema: + required: + - id + type: object + properties: + id: + type: string + description: The id of the created collection + format: uuidv4 + example: 23befbae-1505-47a8-bd27-e30ef739f32c + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 401: + description: unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /couponCollections/{id}: + get: + tags: + - Coupons + summary: Get a coupon collection by id + operationId: getCouponCollection + parameters: + - name: id + in: path + description: Id of the collection to return + required: true + schema: + type: string + format: uuidv4 + responses: + 200: + description: Coupon collection + content: + application/json: + schema: + $ref: '#/components/schemas/getCouponCollection' + examples: + response: + value: + - id: 23befbae-1505-47a8-bd27-e30ef739f32c + name: Summer + defaultCoupon: 10 OFF + createdAt: 2017-03-12T12:30:00Z + totalCoupons: 10000 + remainingCoupons: 5000 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 401: + description: unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Coupon collection not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + patch: + tags: + - Coupons + summary: Update a coupon collection by id + operationId: updateCouponCollection + parameters: + - name: id + in: path + description: Id of the collection to update + required: true + schema: + type: string + format: uuidv4 + requestBody: + description: Values to update the coupon collection + content: + application/json: + schema: + type: object + properties: + defaultCoupon: + type: string + description: A default coupon to be used in case there are no coupons left + example: 10 OFF + expirationDate: + description: Specify an expiration date for the coupon collection in RFC3339 format. Use null to remove the expiration date. + type: string + format: date-time + example: "2024-01-01T00:00:00Z" + remainingDaysAlert: + description: Send a notification alert (email) when the remaining days until the expiration date are equal or fall bellow this number. Use null to disable alerts. + type: integer + example: 5 + remainingCouponsAlert: + description: Send a notification alert (email) when the remaining coupons count is equal or fall bellow this number. Use null to disable alerts. + type: integer + example: 5 + responses: + 200: + description: Coupon collection updated + content: + application/json: + schema: + required: + - id + - name + - defaultCoupon + type: object + properties: + id: + type: string + description: The id of the collection + format: uuidv4 + example: 23befbae-1505-47a8-bd27-e30ef739f32c + name: + type: string + description: The name of the collection + format: uuidv4 + example: SummerPromotions + defaultCoupon: + type: string + description: The default coupon of the collection + example: 10 OFF + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 401: + description: unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /coupons: + post: + tags: + - Coupons + summary: Create coupons for a coupon collection + operationId: createCoupons + requestBody: + description: Values to create coupons + required: true + content: + application/json: + schema: + required: + - collectionId + - coupons + type: object + properties: + collectionId: + type: string + description: The id of the coupon collection for which the coupons will be created + format: uuidv4 + example: 23befbae-1505-47a8-bd27-e30ef739f32c + coupons: + type: array + minItems: 1 + maxItems: 1000 + uniqueItems: true + items: + type: string + description: Name of the coupon + example: Uf12AF + responses: + 204: + description: Coupons creation in progress + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 401: + description: unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Coupon collection not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + + /whatsapp/sendMessage: + post: + tags: + - Transactional WhatsApp + summary: Send a WhatsApp message + description: This endpoint is used to send a WhatsApp message.
(**The first message you send using the API must contain a Template ID. You must create a template on WhatsApp on the Brevo platform to fetch the Template ID.**) + operationId: sendWhatsappMessage + requestBody: + description: Values to send WhatsApp message + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/sendWhatsappMessageTemplate' + - $ref: '#/components/schemas/sendWhatsappMessageText' + required: true + responses: + 201: + description: successfully created + content: + application/json: + schema: + required: + - messageId + type: object + properties: + messageId: + type: string + description: messageId of sent message + format: uuidv4 + example: "23befbae-1505-47a8-bd27-e30ef739f32c" + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /whatsapp/statistics/events: + get: + tags: + - Transactional WhatsApp + summary: Get all your WhatsApp activity (unaggregated events) + description: This endpoint will show the unaggregated statistics for WhatsApp activity (30 days by default if `startDate` and `endDate` or `days` is not passed. The date range can not exceed 90 days) + operationId: getWhatsappEventReport + parameters: + - name: limit + in: query + description: Number limitation for the result returned + schema: + maximum: 5000 + type: integer + format: int64 + default: 2500 + minimum: 0 + - name: offset + in: query + description: Beginning point in the list to retrieve from + schema: + type: integer + format: int64 + default: 0 + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate + schema: + type: string + - name: days + in: query + description: | + Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ + schema: + type: integer + format: int64 + - name: contactNumber + in: query + description: Filter results for specific contact (WhatsApp Number with country code. Example, 85264318721) + schema: + type: string + format: mobile + - name: event + in: query + description: Filter the report for a specific event type + schema: + type: string + enum: + - sent + - delivered + - read + - error + - unsubscribe + - reply + - soft-bounce + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + responses: + 200: + description: WhatsApp events report + content: + application/json: + schema: + $ref: '#/components/schemas/getWhatsappEventReport' + examples: + response: + value: + events: + - contactNumber: 919876543211 + date: 2017-03-12T12:30:00Z + messageId: 23befbae-1505-47a8-bd27-e30ef739f32c + event: sent + senderNumber: 919876543210 + - contactNumber: 919876543211 + date: 2017-03-12T12:30:00Z + messageId: 23befbae-1505-47a8-bd27-e30ef739f32c + event: "error" + reason: "error reason" + senderNumber: 919876543210 + - contactNumber: 919876543211 + date: 2017-03-12T12:30:00Z + messageId: 23befbae-1505-47a8-bd27-e30ef739f32c + event: "soft-bounce" + reason: "invalid whatsapp contact" + senderNumber: 919876543210 + - contactNumber: 919876543211 + date: 2017-03-12T12:30:00Z + messageId: 23befbae-1505-47a8-bd27-e30ef739f32c + event: "reply" + body: "body only in case of text reply & url will be empty" + mediaUrl: "media url only in case media reply & body will be empty" + senderNumber: 919876543210 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + + + /feeds: + get: + tags: + - External Feeds + summary: Fetch all external feeds + description: This endpoint can fetch all created external feeds. + operationId: getAllExternalFeeds + parameters: + - name: search + description: Can be used to filter records by search keyword on feed name + in: query + example: 'search' + required: false + schema: + type: string + - name: startDate + description: Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older than current date. + in: query + example: '2022-09-04' + required: false + schema: + type: string + format: date + - name: endDate + description: Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. + in: query + example: '2022-10-01' + required: false + schema: + type: string + format: date + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + - name: authType + in: query + description: Filter the records by `authType` of the feed. + required: false + schema: + type: string + enum: + - basic + - token + - noAuth + - name: limit + description: Number of documents returned per page. + in: query + required: false + example: 100 + schema: + type: integer + format: int64 + default: 50 + maximum: 500 + minimum: 0 + - name: offset + description: Index of the first document on the page. + in: query + required: false + example: 0 + schema: + type: integer + format : int64 + default: 0 + responses: + 200: + description: External feeds + content: + application/json: + schema: + $ref: '#/components/schemas/getAllExternalFeeds' + example: + { + "count": 3, + "feeds": [ + { + "id": "d955aaa4-f4d6-4557-aa14-24286542ed8d", + "name": "api feed token", + "url": "https://abc.com/", + "authType": "token", + "token": "jfhdkjdfhjkfdhjkdfhjkdfhkj", + "headers": [ + { + "name": "key", + "value": "val" + } + ], + "maxRetries": 4, + "cache": true, + "createdAt": "2022-10-06T05:03:47.053000000Z", + "modifiedAt": "2022-10-06T05:03:47.053000000Z" + }, + { + "id": "311a71ac-bebc-42cf-963d-d8666dfe53e9", + "name": "api feed basic", + "url": "https://abc.com/", + "authType": "basic", + "username": "user", + "password": "pass", + "headers": null, + "maxRetries": 2, + "cache": false, + "createdAt": "2022-10-06T04:48:19.767000000Z", + "modifiedAt": "2022-10-06T04:48:19.767000000Z" + } + ] + } + 400: + description: Invalid parameters passed + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Record not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + post: + tags: + - External Feeds + summary: Create an external feed + description: This endpoint will create an external feed. + operationId: createExternalFeed + requestBody: + description: Values to create a feed + content: + application/json: + schema: + $ref: '#/components/schemas/createExternalFeed' + required: true + responses: + 201: + description: successfully created + content: + application/json: + schema: + required: + - id + type: object + properties: + id: + type: string + description: ID of the object created + format: uuidv4 + example: "23befbae-1505-47a8-bd27-e30ef739f32c" + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + /feeds/{uuid}: + get: + tags: + - External Feeds + summary: Get an external feed by UUID + description: This endpoint will update an external feed. + operationId: getExternalFeedByUUID + parameters: + - name: uuid + description: UUID of the feed to fetch + example: 38f351fb-6e77-4b38-979a-a2465260449e + in: path + required: true + schema: + type: string + responses: + 200: + description: External feed + content: + application/json: + schema: + $ref: '#/components/schemas/getExternalFeedByUUID' + example: + { + "id": "d955aaa4-f4d6-4557-aa14-24286542ed8d", + "name": "api feed token", + "url": "https://abc.com/", + "authType": "token", + "token": "jfhdkjdfhjkfdhjkdfhjkdfhkj", + "headers": [ + { + "name": "key", + "value": "val" + } + ], + "maxRetries": 4, + "cache": true, + "createdAt": "2022-10-06T05:03:47.053000000Z", + "modifiedAt": "2022-10-06T05:03:47.053000000Z" + } + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Feed not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + put: + tags: + - External Feeds + summary: Update an external feed + description: This endpoint will update an external feed. + operationId: updateExternalFeed + parameters: + - name: uuid + description: UUID of the feed to update + example: 38f351fb-6e77-4b38-979a-a2465260449e + in: path + required: true + schema: + type: string + requestBody: + description: Values to update a feed + content: + application/json: + schema: + $ref: '#/components/schemas/updateExternalFeed' + required: true + responses: + 204: + description: Feed updated + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Feed not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + delete: + tags: + - External Feeds + summary: Delete an external feed + description: This endpoint will delete an external feed. + operationId: deleteExternalFeed + parameters: + - name: uuid + description: UUID of the feed to delete + example: 38f351fb-6e77-4b38-979a-a2465260449e + in: path + required: true + schema: + type: string + responses: + 204: + description: Feed deleted + content: {} + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + 404: + description: Feed not found + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + + /payments/requests: + post: + tags: + - Payments + summary: Create a payment request + operationId: createPaymentRequest + requestBody: + description: | + Create a payment request + content: + application/json: + schema: + $ref: '#/components/schemas/createPaymentRequest' + required: true + responses: + '201': + description: Payment request created. + content: + application/json: + schema: + $ref: '#/components/schemas/createPaymentResponse' + examples: + response: + value: + id: 6d4ec0b2b48ef803df4103ve + url: https://pay.brevo.com/payment/6d4ec0b2b48ef803df4103ve + '400': + description: Bad request. + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + '401': + description: Unauthorized. + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + '403': + description: Permission denied. Either you don't have access to Brevo Payments or your Brevo Payments account is not validated. + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + + /payments/requests/{id}: + get: + tags: + - Payments + summary: Get payment request details + operationId: getPaymentRequest + parameters: + - name: id + in: path + description: Id of the payment Request + required: true + schema: + type: string + example: '050db7b0-9bb7-4c1e-9c68-5a8dace8c1dc' + responses: + '200': + description: Payment request details + content: + application/json: + schema: + $ref: '#/components/schemas/getPaymentRequest' + example: + reference: "Invoice #INV0001\n" + status: "paid" + configuration: + customSuccessUrl: "https://my-company.com/payment-success" + contactId: 43 + numberOfRemindersSent: 5 + cart: + currency: EUR + specificAmount: 1200 + notification: + channel: "email" + text: "Please pay for your yoga class." + '400': + description: Bad request. + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + '401': + description: Unauthorized. + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + '403': + description: Permission denied. Either you don't have access to Brevo Payments or your Brevo Payments account is not validated. + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + '404': + description: Payment request not found. + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + + delete: + tags: + - Payments + summary: Delete a payment request. + operationId: deletePaymentRequest + parameters: + - name: id + in: path + description: ID of the payment request. + required: true + schema: + type: string + format: uuid + example: 9ae7d68a-565c-4695-9381-d8fb3e3a14cc + responses: + '204': + description: Payment request deleted successfully. + '401': + description: Unauthorized. + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + '403': + description: Permission denied. Either you don't have access to Brevo Payments or your Brevo Payments account is not validated. + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + '404': + description: Payment request not found. + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + +components: + schemas: + getAccount: + allOf: + - $ref: '#/components/schemas/getExtendedClient' + - required: + - plan + - relay + type: object + properties: + plan: + type: array + description: Information about your plans and credits + items: + required: + - credits + - creditsType + - type + type: object + properties: + type: + type: string + description: Displays the plan type of the user + example: subscription + enum: + - payAsYouGo + - free + - subscription + - sms + creditsType: + type: string + description: 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. + example: sendLimit + enum: + - sendLimit + credits: + type: number + description: Remaining credits of the user + format: float + example: 8755.0 + startDate: + type: string + description: Date of the period from which the plan will start (only + available for "subscription" plan type) + format: date + example: 2016-12-31 + endDate: + type: string + description: Date of the period from which the plan will end (only + available for "subscription" plan type) + format: date + example: 2017-01-31 + relay: + required: + - data + - enabled + type: object + properties: + enabled: + type: boolean + description: Status of your transactional email Account (true=Enabled, + false=Disabled) + example: true + data: + required: + - port + - relay + - userName + type: object + properties: + userName: + type: string + description: Email to use as login on transactional platform + format: email + example: john.smith@example.com + relay: + type: string + description: URL of the SMTP Relay + example: relay.domain.com + port: + type: integer + description: Port used for SMTP Relay + example: 125 + description: Data regarding the transactional email account + description: Information about your transactional email account + marketingAutomation: + required: + - enabled + type: object + properties: + key: + type: string + description: Marketing Automation Tracker ID + example: iso05aopqych87ysy0jymf + enabled: + type: boolean + description: Status of Marketing Automation Plateform activation for + your account (true=enabled, false=disabled) + example: false + getAccountActivity: + type: object + properties: + logs: + type: array + description: Get user activity logs + items: + required: + - action + - date + - user_email + - user_ip + - user_agent + type: object + properties: + action: + type: string + description: Type of activity in the account. + example: login-success + date: + type: string + description: Time of the activity. + example: '2023-03-27T16:30:00Z' + user_email: + type: string + description: Email address of the user who performed activity in the account. + example: 'test@mycompany.com' + user_ip: + type: string + description: IP address of the user who performed activity in the account. + example: "192.158.1.38" + user_agent: + type: string + description: Browser details of the user who performed the activity. + example: "Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us)" + getInvitedUsersList: + type: object + properties: + users: + type: array + description: Get invited users list + items: + required: + - email + - is_owner + - status + - feature_access + type: object + properties: + email: + type: string + description: Email address of the user. + example: 'pendingInvitedUser@company.com' + is_owner: + type: string + description: Flag for indicating is user owner of the organization. + example: true + status: + type: string + description: Status of the invited user. + example: 'active' + feature_access: + description: Feature accessiblity given to the user. + type: object + properties: + marketing: + description: Marketing features accessiblity. + type: string + example: 'custom' + conversations: + description: Conversations features accessiblity. + type: string + example: 'none' + crm: + description: CRM features accessiblity. + type: string + example: 'full' + getCorporateInvitedUsersList: + type: object + properties: + users: + type: array + description: Get invited users list + items: + required: + - email + - is_owner + - status + - feature_access + type: object + properties: + groups: + description: Admin user groups list + type: object + properties: + id: + description: group id + type: string + example: a5c4f22c08d9ed37ef1ca342 + name: + description: group name + type: string + example: My group + email: + type: string + description: Email address of the user. + example: 'pendingInvitedUser@company.com' + is_owner: + type: string + description: Flag for indicating is user owner of the organization. + example: false + status: + type: string + description: Status of the invited user. + example: 'active' + feature_access: + description: Feature accessiblity given to the user. (Required only if status is active) + type: object + properties: + user_management: + description : User management accessiblity. + type: array + items: + type: string + example: 'all / none' + api_keys: + description : Api keys accessiblity. + type: array + items: + type: string + example: 'all / none' + my_plan: + description : My plan accessiblity. + type: array + items: + type: string + example: 'all / none' + apps_management: + description : Apps management accessiblity | Not available in ENTv2 + type: array + items: + type: string + example: 'all / none' + sub_organization_groups: + description : Group creation, modification or deletion accessibility + type: array + items: + type: string + example: ["create", "edit_delete"] + create_sub_organizations: + description : Authorization to create sub-organization in the admin account. If the user creating the sub-organization, belongs to a group, the user must choose a group at the sub-organization creation. + type: array + items: + type: string + example: 'all / none' + manage_sub_organizations: + description : Authorization to manage and access sub-organizations in the admin account. + type: array + items: + type: string + example: 'all / none' + analytics: + description : Analytics dashboard accessibility + type: array + items: + type: string + example: ["download_data", "create_alerts", "my_looks", "explore_create"] + security: + description : Security page accessibility + type: array + items: + type: string + example: 'all / none' + getCorporateUserPermission: + type: object + description: Check admin user permissions + required: + - email + - status + - groups + - feature_access + properties: + email: + type: string + description: Email address of the user. + example: invitedUser@company.com + status: + type: string + description: Status of the invited user. + example: 'active / pending' + groups: + type: array + items: + type: object + description: Groups details + properties: + id: + type: string + description: group identifier + example: 6cbcxxxxxxxxxxxxxxxx457a + name: + type: string + description: Group name + example: Staff + feature_access: + description: Granular feature permissions given to the user. + type: object + properties: + api_keys: + type: array + description: Permission on api keys + items: + type: string + description: Permission details + example: all + my_plan: + type: array + description: Permission on my plan + items: + type: string + description: Permission details + example: all + user_management: + type: array + description: Permission on user management + items: + type: string + description: Permission details + example: none + apps_management: + type: array + description: Permission on apps management + items: + type: string + description: Permission details + example: all + sub_organization_groups: + type: array + description: Permission on groups + items: + type: string + description: Permission details + example: [create, edit_delete] + create_sub_organizations: + type: array + description: Permission on create sub-accounts + items: + type: string + description: Permission details + example: all + manage_sub_organizations: + type: array + description: Permission on manage sub-accounts + items: + type: string + description: Permission details + example: all + analytics: + type: array + description: Permission on analytics + items: + type: string + description: Permission details + example: [create_alerts, download_data, my_looks, explore_create] + security: + type: array + description: Permission on security + items: + type: string + description: Permission details + example: all + getUserPermission: + type: object + description: Check user permission + required: + - email + - status + - privileges + properties: + email: + type: string + description: Email address of the user. + example: invitedUser@company.com + status: + type: string + description: Status of the invited user. + example: 'active' + privileges: + description: Granular feature permissions given to the user. + type: array + items: + required: + - feature + - permissions + type: object + properties: + feature: + type: string + example: 'Email campaign' + permissions: + type: array + items: + type: string + example: 'Create / edit / delete' + + putRevokeUserPermission: + type: object + description: Revoke user permission + required: + - email + properties: + email: + type: string + description: Email address of the user. + example: invitedUser@company.com + + putRevokeUserPermissionResponse: + required: + - status + type: object + properties: + status: + type: string + description: Status of the API operation. + example: "OK" + credit_notes: + description: Credit note + type: array + items: + type: string + example: "TEST-123" + + putresendcancelinvitation: + type: object + description: Revoke user permission + required: + - email + properties: + email: + type: string + description: Email address of the user. + example: invitedUser@company.com + + putresendcancelinvitationResponse: + required: + - status + type: object + properties: + status: + type: string + description: Status of the API operation. + example: "OK" + credit_notes: + description: Credit note + type: array + items: + type: string + example: "TEST-123" + + inviteAdminUser: + type: object + required: + - email + - all_features_access + - privileges + properties: + email: + description: Email address for the organization + type: string + format: email + example: inviteuser@example.com + all_features_access: + description: All access to the features + type: boolean + example: true + enum: + - true + - false + groupIds: + description: Ids of Group + type: array + items: + type: string + description: Group Id + example: ["2baxxxxxxxxxxxxxxxxxxxxxcaa", "65axxxxxxxxxxxxxxxxxxxxxc5a"] + privileges: + type: array + items: + type: object + description: Privileges given to the user + properties: + feature: + description: Feature name + type: string + enum: + - 'my_plan' + - 'api' + - 'user_management' + - 'app_management' + - 'sub_organization_groups' + - 'create_sub_organizations' + - 'manage_sub_organizations' + - 'analytics' + - 'security' + example: 'user_management' + permissions: + description: Permissions for a given feature + type: array + items: + type: string + enum: + - 'all' + - 'none' + - 'create' + - 'edit_delete' + - 'download_data' + - 'create_alerts' + example: "'all', 'none', 'create', 'edit_delete', 'download_data', 'create_alerts'" + example: [{"feature": "my_plan", "permissions": ["all"]}, {"feature": "api", "permissions": ["none"]}, {"feature": "user_management", "permissions": ["all"]}, {"feature": "app_management", "permissions": ["all"]}, {"feature": "sub_organization_groups", "permissions": ["create", "edit_delete"]}, {"feature": "create_sub_organizations", "permissions": ["all"]}, {"feature": "manage_sub_organizations", "permissions": ["all"]}, {"feature": "analytics", "permissions": ["download_data", "create_alerts", "my_looks", "explore_create"]}, {"feature": "security", "permissions": ["all"]}] + inviteuser: + type: object + required: + - email + - all_features_access + - privileges + properties: + email: + description: Email address for the organization + type: string + format: email + example: inviteuser@example.com + all_features_access: + description: All access to the features + type: boolean + example: true + enum: + - true + - false + privileges: + type: array + items: + type: object + description: Privileges given to the user + properties: + feature: + description: Feature name + type: string + enum: + - 'email_campaigns' + - 'sms_campaigns' + - 'contacts' + - 'templates' + - 'workflows' + - 'facebook_ads' + - 'landing_pages' + - 'transactional_emails' + - 'smtp_api' + - 'user_management' + - 'sales_platform' + - 'phone' + - 'conversations' + - 'senders_domains_dedicated_ips' + - 'push_notifications' + - 'companies' + example: 'email_campaigns' + permissions: + description: Permissions for a given feature + type: array + items: + type: string + enum: + - 'create_edit_delete' + - 'send_schedule_suspend' + - 'view' + - 'import' + - 'export' + - 'list_and_attributes' + - 'forms' + - 'activate_deactivate' + - 'activate_deactivate_pause' + - 'settings' + - 'schedule_pause' + - 'all' + - 'logs' + - 'access' + - 'assign' + - 'configure' + - 'create_edit_deals' + - "delete_owned_deals" + - 'manage_others_deals_tasks' + - 'manage_owned_companies' + - 'manage_others_companies' + - 'reports' + - 'senders_management' + - 'domains_management' + - 'dedicated_ips_management' + - 'send' + - 'smtp' + - 'api_keys' + - 'authorized_ips' + - 'none' + example: "'create_edit_delete', 'send_schedule_suspend'" + example: [{"feature": "email_campaigns", "permissions": ["create_edit_delete", "send_schedule_suspend"]},{"feature": "sms_campaigns", "permissions": ["create_edit_delete","send_schedule_suspend"]},{"feature": "facebook_ads","permissions": ["create_edit_delete", "schedule_pause"]}] + + inviteuserResponse: + required: + - status + type: object + properties: + status: + type: string + description: Status of the API operation. + example: "OK" + invoice_id: + description: Invoice id + type: string + items: + type: string + example: "TEST-ID" + + updateUserResponse: + required: + - status + type: object + properties: + status: + type: string + description: Status of the API operation. + example: "OK" + credit_notes: + description: Credit note + type: array + items: + type: string + example: "TEST-123" + invoice_id: + description: Invoice id + type: string + items: + type: string + example: "TEST-ID" + + getSsoToken: + required: + - token + type: object + properties: + token: + type: string + description: Session token, it will remain valid for 15 days. + example: ede520dxxxxxxxxxxxx76d631fba2 + createApiKeyResponse: + required: + - status + - key + type: object + properties: + status: + type: string + description: Status of the API operation. + example: success + key: + type: string + description: API key + example: xkeysib-21881axxxxxcc92e04-mIrexxxx7z + getClient: + required: + - companyName + - email + - firstName + - lastName + type: object + properties: + email: + type: string + description: Login Email + format: email + example: john.smith@example.com + firstName: + type: string + description: First Name + example: John + lastName: + type: string + description: Last Name + example: Smith + companyName: + type: string + description: Name of the company + example: MyCompany + getExtendedClient: + allOf: + - $ref: '#/components/schemas/getClient' + - required: + - address + type: object + properties: + address: + required: + - city + - country + - street + - zipCode + type: object + properties: + street: + type: string + description: Street information + example: 47 Harbour Street + city: + type: string + description: City information + example: New-York + zipCode: + type: string + description: Zip Code information + example: "9867" + country: + type: string + description: Country information + example: United States of America + description: Address informations + getSendersList: + type: object + properties: + senders: + type: array + description: List of the senders available in your account + items: + required: + - active + - email + - id + - name + type: object + properties: + id: + type: integer + description: Id of the sender + format: int64 + example: 0 + name: + type: string + description: From Name associated to the sender + example: Marketing + email: + type: string + description: From Email associated to the sender + example: marketing@mycompany.com + active: + type: boolean + description: Status of sender (true=activated, false=deactivated) + example: false + ips: + type: array + description: List of dedicated IP(s) available in the account. This + data is displayed only for dedicated IPs + items: + required: + - domain + - ip + - weight + type: object + properties: + ip: + type: string + description: Dedicated IP available in your account + example: 123.98.689.7 + domain: + type: string + description: Domain of the IP + example: mycompany.com + weight: + type: integer + description: Weight of the IP for this sender + format: int64 + example: 50 + getDomainsList: + type: object + properties: + domains: + type: array + description: List of the domains available in your account + items: + required: + - id + - domain_name + - authenticated + - verified + type: object + properties: + id: + type: integer + description: Id of the domain + format: int64 + example: 1 + domain_name: + type: string + description: Domain name + example: mycompany.com + authenticated: + type: boolean + description: Status of domain authentication (true=authenticated, false=non authenticated) + example: true + verified: + type: boolean + description: Status of domain verification (true=verified, false=non verified) + example: false + ip: + type: string + description: Dedicated IP associated with domain + example: 123.98.689.7 + createSender: + required: + - email + - name + type: object + properties: + name: + type: string + description: From Name to use for the sender + example: Newsletter + email: + type: string + description: From email to use for the sender. A verification email will + be sent to this address. + format: email + example: newsletter@mycompany.com + ips: + type: array + description: | + **Mandatory in case of dedicated IP**. IPs to associate to the sender + items: + required: + - domain + - ip + type: object + properties: + ip: + type: string + description: Dedicated IP available in your account + example: 123.98.689.7 + domain: + type: string + description: Domain of the IP + example: mycompany.com + weight: + maximum: 1E+2 + minimum: 1 + type: integer + description: 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. + format: int64 + example: 50 + updateSender: + type: object + properties: + name: + type: string + description: From Name to update the sender + example: Newsletter + email: + type: string + description: From Email to update the sender + format: email + example: newsletter@mycompany.com + ips: + type: array + description: | + **Only in case of dedicated IP**. IPs to associate to the sender. If passed, will replace all the existing IPs. + items: + required: + - domain + - ip + type: object + properties: + ip: + type: string + description: Dedicated IP available in your account + example: 123.98.689.7 + domain: + type: string + description: Domain of the IP + example: mycompany.com + weight: + maximum: 1E+2 + minimum: 1 + type: integer + description: 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. + format: int64 + example: 50 + otp: + required: + - otp + type: object + properties: + otp: + type: integer + description: 6 digit OTP received on email + example: 123456 + createDomain: + required: + - name + type: object + properties: + name: + type: string + description: Domain name + example: mycompany.com + errorModel: + required: + - code + - message + type: object + properties: + code: + type: string + description: Error code displayed in case of a failure + example: method_not_allowed + enum: + - invalid_parameter + - missing_parameter + - out_of_range + - campaign_processing + - campaign_sent + - document_not_found + - not_enough_credits + - permission_denied + - duplicate_parameter + - duplicate_request + - method_not_allowed + - unauthorized + - account_under_validation + - not_acceptable + - bad_request + - unprocessable_entity + message: + type: string + description: Readable message associated to the failure + example: POST Method is not allowed on this path + contactErrorModel: + required: + - code + - message + properties: + code: + type: string + enum: + - invalid_parameter + - missing_parameter + - document_not_found + - account_in_process + - duplicate_parameter + - method_not_allowed + - out_of_range + description: Error code displayed in case of a failure + example: 'duplicate_parameter' + message: + type: string + description: Readable message associated to the failure + example: 'email is already associated with another Contact' + metadata: + type: object + description: Additional information about the error + example: { duplicate_identifiers: [ 'email' ] } + getProcesses: + type: object + properties: + processes: + type: array + description: List of processes available on your account + items: + $ref: '#/components/schemas/getProcess' + count: + type: integer + description: Number of processes available on your account + format: int64 + example: 5 + getProcess: + required: + - id + - name + - status + type: object + properties: + id: + type: integer + description: Id of the process + format: int64 + example: 145 + status: + type: string + description: Status of the process + example: queued + enum: + - queued + - in_process + - completed + name: + type: string + description: Process name + example: IMPORTUSER + export_url: + type: string + description: URL on which send export the of contacts once the process is + completed + example: http://requestb.in/16ua3aj1 + getEmailCampaigns: + type: object + properties: + campaigns: + type: array + items: + type: object + allOf: + - $ref: '#/components/schemas/getExtendedCampaignOverview' + - required: + - recipients + - statistics + type: object + properties: + recipients: + type: object + allOf: + - $ref: '#/components/schemas/getCampaignRecipients' + statistics: + type: object + allOf: + - $ref: '#/components/schemas/getExtendedCampaignStats' + shareLink: + type: string + description: Link to share the campaign on social medias + format: url + example: http://dhh.brevo.com/fhsgccc.html?t=9865448900 + count: + type: integer + description: Number of Email campaigns retrieved + format: int64 + example: 24 + getSmsCampaigns: + type: object + properties: + campaigns: + type: array + items: + type: object + allOf: + - $ref: '#/components/schemas/getSmsCampaignOverview' + - required: + - recipients + - statistics + type: object + properties: + recipients: + type: object + allOf: + - $ref: '#/components/schemas/getCampaignRecipients' + statistics: + type: object + allOf: + - $ref: '#/components/schemas/getSmsCampaignStats' + count: + type: integer + description: Number of SMS campaigns retrieved + format: int64 + example: 12 + getSmsCampaign: + allOf: + - $ref: '#/components/schemas/getSmsCampaignOverview' + - required: + - recipients + - statistics + type: object + properties: + recipients: + type: object + allOf: + - $ref: '#/components/schemas/getCampaignRecipients' + statistics: + type: object + allOf: + - $ref: '#/components/schemas/getSmsCampaignStats' + getEmailCampaign: + allOf: + - $ref: '#/components/schemas/getExtendedCampaignOverview' + - required: + - recipients + - statistics + type: object + properties: + recipients: + type: object + allOf: + - $ref: '#/components/schemas/getCampaignRecipients' + statistics: + type: object + allOf: + - $ref: '#/components/schemas/getExtendedCampaignStats' + getCampaignOverview: + required: + - id + - name + - status + - type + type: object + properties: + id: + type: integer + description: ID of the campaign + format: int64 + example: 12 + name: + type: string + description: Name of the campaign + example: EN - Sales Summer 2017 + subject: + type: string + description: Subject of the campaign. Only available if `abTesting` flag + of the campaign is `false` + example: 20% OFF for 2017 Summer Sales + previewText: + type: string + description : Preview text or preheader of the email campaign + example: Thanks for your order! + type: + type: string + description: Type of campaign + example: classic + enum: + - classic + - trigger + status: + type: string + description: Status of the campaign + example: sent + enum: + - draft + - sent + - archive + - queued + - suspended + - in_process + scheduledAt: + type: string + description: UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-06-01T12:30:00Z + abTesting: + type: boolean + description: Status of A/B Test for the campaign. abTesting = false means + it is disabled, & abTesting = true means it is enabled. + example: true + subjectA: + type: string + description: Subject A of the ab-test campaign. Only available if `abTesting` + flag of the campaign is `true` + example: Discover the New Collection! + subjectB: + type: string + description: Subject B of the ab-test campaign. Only available if `abTesting` + flag of the campaign is `true` + example: Want to discover the New Collection? + splitRule: + type: integer + description: The size of your ab-test groups. Only available if `abTesting` + flag of the campaign is `true` + example: 25 + winnerCriteria: + type: string + description: Criteria for the winning version. Only available if `abTesting` + flag of the campaign is `true` + example: open + winnerDelay: + type: integer + description: The duration of the test in hours at the end of which the winning + version will be sent. Only available if `abTesting` flag of the campaign + is `true` + example: 50 + sendAtBestTime: + type: boolean + description: It is true if you have chosen to send your campaign at best + time, otherwise it is false + example: true + getExtendedCampaignOverview: + allOf: + - $ref: '#/components/schemas/getCampaignOverview' + - required: + - createdAt + - footer + - header + - htmlContent + - modifiedAt + - replyTo + - sender + - testSent + type: object + properties: + utmCampaignValue: + type: string + description: utm parameter associated with campaign + example: myutm + utmSource: + type: string + example: Brevo + utmMedium: + type: string + example: EMAIL + utmIDActive: + type: boolean + description: utm id activate + example: true + testSent: + type: boolean + description: Retrieved the status of test email sending. (true=Test email + has been sent false=Test email has not been sent) + example: true + header: + type: string + description: Header of the campaign + example: '[DEFAULT_HEADER]' + footer: + type: string + description: Footer of the campaign + example: '[DEFAULT_FOOTER]' + sender: + type: object + properties: + name: + type: string + description: Sender name of the campaign + example: Marketing + email: + type: string + description: Sender email of the campaign + format: email + example: marketing@mycompany.com + id: + type: integer + format : int64 + description: Sender id of the campaign + example: 43 + replyTo: + type: string + description: Email defined as the "Reply to" of the campaign + format: email + example: replyto@domain.com + toField: + type: string + description: Customisation of the "to" field of the campaign + example: '{FNAME} {LNAME}' + htmlContent: + type: string + description: HTML content of the campaign + example: This is my HTML Content + shareLink: + type: string + description: Link to share the campaign on social medias + format: url + example: http://dhh.brevo.com/fhsgccc.html?t=9865448900 + tag: + type: string + description: Tag of the campaign + example: Newsletter + createdAt: + type: string + description: Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-05-01T12:30:00Z + modifiedAt: + type: string + description: UTC date-time of last modification of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-05-01T12:30:00Z + inlineImageActivation: + type: boolean + description: Status of inline image. inlineImageActivation = false means + image can’t be embedded, & inlineImageActivation = true means image + can be embedded, in the email. + example: true + mirrorActive: + type: boolean + description: Status of mirror links in campaign. mirrorActive = false + means mirror links are deactivated, & mirrorActive = true means mirror + links are activated, in the campaign + example: true + recurring: + type: boolean + description: 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 + example: true + sentDate: + type: string + description: Sent UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ). + Only available if 'status' of the campaign is 'sent' + example: 2018-12-01T16:30:00Z + returnBounce: + type: integer + description: Total number of non-delivered campaigns for a particular + campaign id. + format: int64 + example: 5 + getCampaignRecipients: + required: + - exclusionLists + - lists + type: object + properties: + lists: + type: array + items: + type: integer + description: List IDs included in the campaign + format: int64 + example: 21 + exclusionLists: + type: array + items: + type: integer + description: List IDs excluded of the campaign + format: int64 + example: 13 + getExtendedCampaignStats: + required: + - campaignStats + - globalStats + - linksStats + - mirrorClick + - remaining + - statsByBrowser + - statsByDevice + - statsByDomain + type: object + properties: + globalStats: + type: object + description: Overall statistics of the campaign + allOf: + - $ref: '#/components/schemas/getCampaignStats' + campaignStats: + type: array + description: List-wise statistics of the campaign. + items: + type: object + allOf: + - $ref: '#/components/schemas/getCampaignStats' + mirrorClick: + type: integer + description: Number of clicks on mirror link + format: int64 + example: 120 + remaining: + type: integer + description: Number of remaning emails to send + format: int64 + example: 1000 + linksStats: + type: object + properties: {} + description: Statistics about the number of clicks for the links + example: + example.abc.com: 7 + example.domain.com: 10 + statsByDomain: + $ref: '#/components/schemas/getStatsByDomain' + statsByDevice: + $ref: '#/components/schemas/getStatsByDevice' + statsByBrowser: + $ref: '#/components/schemas/getStatsByBrowser' + getStatsByDomain: + type: object + additionalProperties: + $ref: '#/components/schemas/getCampaignStats' + getStatsByDevice: + type: object + properties: + desktop: + type: object + additionalProperties: + $ref: '#/components/schemas/getDeviceBrowserStats' + description: Statistics of the campaign on the basis of desktop devices + mobile: + type: object + additionalProperties: + $ref: '#/components/schemas/getDeviceBrowserStats' + description: Statistics of the campaign on the basis of mobile devices + tablet: + type: object + additionalProperties: + $ref: '#/components/schemas/getDeviceBrowserStats' + description: Statistics of the campaign on the basis of tablet devices + unknown: + type: object + additionalProperties: + $ref: '#/components/schemas/getDeviceBrowserStats' + description: Statistics of the campaign on the basis of unknown devices + getStatsByBrowser: + type: object + additionalProperties: + $ref: '#/components/schemas/getDeviceBrowserStats' + addContactToListByEmails: + type: object + properties: + emails: + maxItems: 150 + minItems: 1 + type: array + description: | + Emails to add to a list. You can pass a **maximum of 150 emails** for addition in one request. **_If you need to add the emails in bulk, please prefer /contacts/import api._** + items: + type: string + description: Email to add to a list + format: email + example: john.smith@contact.com + addContactToListByIDs: + type: object + properties: + ids: + maxItems: 150 + minItems: 1 + type: array + description: | + IDs to add to a list. You can pass a **maximum of 150 IDs** for addition in one request. **_If you need to add the emails in bulk, please prefer /contacts/import api._** + items: + type: integer + description: ID to add to a list + format: int64 + example: 10 + addContactToListByExtIDs: + type: object + properties: + extIds: + maxItems: 150 + minItems: 1 + type: array + description: | + EXT_ID attributes to add to a list. You can pass a **maximum of 150 EXT_ID attributes** for addition in one request. **_If you need to add the emails in bulk, please prefer /contacts/import api._** + items: + type: string + description: EXT_ID to add to a list + example: ext132 + removeContactFromListByEmails: + type: object + properties: + emails: + maxItems: 150 + minItems: 1 + type: array + description: | + **Required if 'all' is false and 'ids', 'extIds' are empty.** Emails to remove from a list. You can pass a **maximum of 150 emails** for removal in one request. + items: + type: string + description: Email to remove from a list + format: email + example: john.smith@contact.com + + removeContactFromListByIDs: + type: object + properties: + ids: + maxItems: 150 + minItems: 1 + type: array + description: | + **Required if 'all' is false and 'emails', 'extIds' are empty.** IDs to remove from a list. You can pass a **maximum of 150 IDs** for removal in one request. + items: + type: integer + description: ID to remove from a list + format: int64 + example: 10 + + removeContactFromListByAll: + type: object + properties: + all: + type: boolean + description: | + **Required if 'emails', 'extIds' and 'ids' are empty.** Remove all existing contacts from a list. A process will be created in this scenario. You can fetch the process details to know about the progress + example: true + + removeContactFromListByExtIDs: + type: object + properties: + extIds: + maxItems: 150 + minItems: 1 + type: array + description: | + **Required if 'all' is false, 'ids' and 'emails' are empty.** EXT_ID attributes to remove from a list. You can pass a **maximum of 150 EXT_ID attributes** for removal in one request. + items: + type: string + description: EXT_ID to add to a list + example: ext132 + + getSmsCampaignOverview: + required: + - content + - createdAt + - id + - modifiedAt + - name + - sender + - status + type: object + properties: + id: + type: integer + description: ID of the SMS Campaign + format: int64 + example: 2 + name: + type: string + description: Name of the SMS Campaign + example: PROMO CODE + status: + type: string + description: Status of the SMS Campaign + example: draft + enum: + - draft + - sent + - archive + - queued + - suspended + - inProcess + content: + type: string + description: Content of the SMS Campaign + example: Visit our Store and get some discount ! + scheduledAt: + type: string + description: UTC date-time on which SMS campaign is scheduled. Should be + in YYYY-MM-DDTHH:mm:ss.SSSZ format + example: 2017-06-01T12:30:00Z + sender: + type: string + description: Sender of the SMS Campaign + example: MyCompany + createdAt: + type: string + description: Creation UTC date-time of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-06-01T12:30:00Z + modifiedAt: + type: string + description: UTC date-time of last modification of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-05-01T12:30:00Z + getWhatsappCampaignOverview: + required: + - id + - campaignName + - campaignStatus + - senderNumber + - recipients + - createdAt + - template + - modifiedAt + type: object + properties: + id: + type: integer + description: ID of the WhatsApp Campaign + format: int64 + example: 1672035851100690 + campaignName: + type: string + description: Name of the WhatsApp Campaign + example: Test Campaign + campaignStatus: + type: string + description: Status of the WhatsApp Campaign + example: draft + enum: + - draft + - scheduled + - pending + - approved + - running + - suspended + - rejected + - sent + scheduledAt: + type: string + description: UTC date-time on which WhatsApp campaign is scheduled. Should be + in YYYY-MM-DDTHH:mm:ss.SSSZ format + example: 2017-06-01T12:30:00Z + senderNumber: + type: string + description: Sender of the WhatsApp Campaign + example: 9368207029 + stats : + $ref: '#/components/schemas/WhatsappCampStats' + template : + $ref: '#/components/schemas/WhatsappCampTemplate' + createdAt: + type: string + description: Creation UTC date-time of the WhatsApp campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-06-01T12:30:00Z + modifiedAt: + type: string + description: UTC date-time of last modification of the WhatsApp campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-05-01T12:30:00Z + WhatsappCampStats: + type: object + required: + - sent + - delivered + - read + - unsubscribe + - notSent + properties: + sent: + type: integer + example: 3 + delivered: + type: integer + example : 3 + read: + type: integer + example: 2 + unsubscribe: + type: integer + example: 0 + notSent: + type: integer + example: 4 + WhatsappCampTemplate: + type: object + properties: + name: + type : string + example: wta107 + description : name of the template + category: + type : string + example : Marketing + description : description of the template + language: + type : string + example : en_GB + description : language of the template + contains_button: + type : boolean + example : false + display_header: + type : boolean + example : true + header_type: + type : string + example : text + description : type of header + components: + type : array + description : array of component item objects + items: + $ref: '#/components/schemas/componentItems' + header_variables : + type : array + description : array of variables item object + items: + $ref: '#/components/schemas/variablesItems' + body_variables: + type : array + description: array of variables item variables + items: + $ref: '#/components/schemas/variablesItems' + button_type: + type: string + example : QUICK_REPLIES + hide_footer: + type: boolean + example : true + componentItems : + type : object + properties: + type : + type : string + example : BODY + text : + type : string + example : Life is a long lesson in humility + variablesItems : + type : object + properties : + name : + type: string + example : FIRSTNAME + default : + type : string + example : INVALID_HEADER + datatype : + type : string + example : text + bodyVariablesItems : + type : object + getWhatsappTemplates : + type: object + properties: + templates: + type: array + items: + type: object + required : + - id + - name + - status + - type + - language + - category + - createdAt + - modifiedAt + properties: + id: + type: integer + description: ID of the WhatsApp template + format: int64 + example: 235 + name: + type: string + description: Name of the WhatsApp template + example: Test template + status: + type: string + description: Status of the WhatsApp template + example: approved + language: + type: string + description: Language in which template exists + example: en + category: + type: string + description: category of the template + example: MARKETING + errorReason: + type: string + description: Error reason in the template creation + example: NONE + createdAt: + type: string + description: Creation UTC date-time of the WhatsApp template (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-06-01T12:30:00Z + modifiedAt: + type: string + description: UTC date-time of last modification of the WhatsApp template (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-05-01T12:30:00Z + count: + type: integer + description: Number of WhatsApp templates retrieved + format: int64 + example: 24 + getWhatsappCampaigns : + type: object + properties: + campaigns: + type : array + items : + type : object + required: + - id + - campaignName + - campaignStatus + - templateId + - scheduledAt + - createdAt + - modifiedAt + properties: + id: + type: integer + description: ID of the WhatsApp Campaign + format: int64 + example: 1672035851100690 + campaignName: + type: string + description: Name of the WhatsApp Campaign + example: Test Campaign + templateId: + type : string + description : Id of the WhatsApp template + example : 637660278078655 + campaignStatus: + type: string + description: Status of the WhatsApp Campaign + example: draft + enum: + - draft + - scheduled + - pending + - approved + - running + - suspended + - rejected + - sent + scheduledAt: + type: string + description: UTC date-time on which WhatsApp campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format + example: 2017-06-01T12:30:00Z + errorReason: + type: string + description : Error Reason associated with the WhatsApp campaign sending + invalidatedContacts : + type : integer + description : Count of invalidated contacts + format : int64 + example : 0 + readPercentage : + type : number + description : Read percentage of the the WhatsApp campaign created + format : float + example : 28.57 + stats : + $ref: '#/components/schemas/WhatsappCampStats' + createdAt: + type: string + description: Creation UTC date-time of the WhatsApp template (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-06-01T12:30:00Z + modifiedAt: + type: string + description: UTC date-time of last modification of the WhatsApp template (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-05-01T12:30:00Z + count: + type: integer + description : Number of WhatsApp campaigns retrieved + format: int64 + example: 40 + createWhatsAppCampaign : + type : object + required: + - name + - templateId + - scheduledAt + - recipients + properties : + name : + type : string + description : Name of the WhatsApp campaign creation + example : Test Campaign + templateId : + type : integer + description : Id of the WhatsApp template in **approved** state + example : 19 + scheduledAt : + type: string + description: | + Sending UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.For example: **2017-06-01T12:30:00+02:00** + example: 2017-06-01T12:30:00+02:00 + recipients: + type: object + properties: + excludedListIds : + type: array + description: List ids to exclude from the campaign + items: + type: integer + format: int64 + example: 8 + listIds: + type: array + description: | + **Mandatory if scheduledAt is not empty**. List Ids to send the campaign to + items: + type: integer + format: int64 + example: 32 + segments: + description: | + **Mandatory if listIds are not used**. Segment ids to send the campaign to. + type: array + items: + type: integer + format: int64 + example: 23 + description: Segment ids and List ids to include/exclude from campaign + getWhatsAppConfig : + type : object + properties : + whatsappBusinessAccountId : + type : string + description : Id of the WhatsApp business account + example : 105569359072383 + sendingLimit : + type : string + description : Sending limit Information of the WhatsApp API account + example : TIER_1K + phoneNumberQuality : + type : string + description : Quality status of phone number associated with WhatsApp account. There are three quality ratings. example - **High (GREEN) , Medium (YELLOW) and Low(RED)** + example : GREEN + enum : + - GREEN + - YELLOW + - RED + whatsappBusinessAccountStatus : + type : string + description : Status information related to WhatsApp API account + example : APPROVED + enum : + - APPROVED + - PENDING + - REJECTED + businessStatus : + type : string + description : Verification status information of the Business account + example : verified + phoneNumberNameStatus : + type : string + description : Status of the name associated with WhatsApp Phone number + example : APPROVED + enum : + - APPROVED + - PENDING + - REJECTED + createWhatsAppTemplate : + type : object + required : + - name + - language + - category + - bodyText + properties : + name: + type : string + description : Name of the template + example : Test template + language : + type : string + description : | + Language of the template. For Example : + **en** for English + example : en + category : + type : string + description : Category of the template + example : MARKETING + enum : + - MARKETING + - UTILITY + mediaUrl: + type : string + description : | + Absolute url of the media file **(no local file)** for the header. **Use this field in you want to add media in Template header and headerText is empty**. + Allowed extensions for media files are: + #### jpeg | png | mp4 | pdf + example : https://attachment.domain.com + bodyText : + type : string + description : Body of the template. **Maximum allowed characters are 1024** + example : making it look like readable English + headerText : + type : string + description : | + Text content of the header in the template. **Maximum allowed characters are 45** + **Use this field to add text content in template header and if mediaUrl is empty** + example : Test WhatsApp campaign + source : + type : string + description : source of the template + enum : + - Automation + - Conversations + updateWhatsAppCampaign : + type: object + properties : + campaignName: + type: string + description : Name of the campaign + example : Test WhatsApp + campaignStatus : + type : string + description : Status of the campaign + example : scheduled + enum: + - scheduled + - suspended + default : scheduled + rescheduleFor : + type : string + description : | + Reschedule the sending UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of campaign. **Prefer to pass your timezone in date-time format for accurate result.For example: **2017-06-01T12:30:00+02:00** + Use this field to update the scheduledAt of any existing draft or scheduled WhatsApp campaign. + example: 2017-06-01T12:30:00+02:00 + recipients: + type: object + properties: + excludedListIds : + type: array + description: List ids to exclude from the campaign + items: + type: integer + format: int64 + example: 8 + listIds: + type: array + description: | + **Mandatory if scheduledAt is not empty**. List Ids to send the campaign to + items: + type: integer + format: int64 + example: 32 + segments: + description: | + **Mandatory if listIds are not used**. Segment ids to send the campaign to. + type: array + items: + type: integer + format: int64 + example: 23 + description: Segment ids and List ids to include/exclude from campaign + loyaltyProgramPage: + type: object + properties: + items: + type: array + description: Loyalty Program list + items: + $ref: '#/components/schemas/loyaltyProgram' + createLoyaltyProgramPayload: + type: object + required: + - name + properties: + name: + type: string + description: Loyalty Program name + description: + type: string + description: Loyalty Program description + meta: + type: object + description: Loyalty Program meta data + loyaltyProgram: + type: object + properties: + id: + type: string + format: uuid + description: Loyalty Program ID + name: + type: string + description: Loyalty Program name + description: + type: string + description: Loyalty Program description + meta: + type: object + description: Loyalty Program meta data + createdAt: + type: string + format: date-time + description: Loyalty Program creation date + updatedAt: + type: string + format: date-time + description: Loyalty Program last modification date + state: + type: string + description: Loyalty Program state + enum: + - inactive + - active + createSubscriptionPayload: + type: object + properties: + contactId: + description: Contact ID + type: integer + loyaltySubscriptionId: + description: Loyalty Subscription ID + type: string + required: + - contactId + createSubscriptionResponse: + type: object + properties: + organizationId: + description: Organization ID + type: integer + loyaltyProgramId: + description: Loyalty Program ID + type: string + format: uuid + versionId: + description: Version ID + type: integer + contactId: + description: Contact ID + type: integer + loyaltySubscriptionId: + description: Loyalty Subscription ID + type: string + createdAt: + description: Subscription creation date + type: string + format: date-time + updatedAt: + description: Subscription last modification date + type: string + format: date-time + updateLoyaltyProgramPayload: + type: object + properties: + name: + type: string + description: Loyalty Program name + description: + type: string + description: Loyalty Program description + meta: + type: object + description: Loyalty Program meta data + required: + - name + validationErrors: + type: array + items: + type: object + $ref: '#/components/schemas/loyaltyProgramValidationError' + loyaltyProgramValidationError: + type: object + properties: + path: + type: string + description: Path of data that failed validation + rule: + type: string + description: Rule that failed validation + error: + type: string + description: Validation error message + + patchLoyaltyProgramPayload: + type: object + properties: + name: + type: string + description: Loyalty Program name + description: + type: string + description: Loyalty Program description + meta: + type: object + description: Loyalty Program meta data + createSubscriptionMemberPayload: + type: object + properties: + contactId: + type: integer + description: One of contact id or loyalty subscription id is required + loyaltySubscriptionId: + type: string + description: Client Reference + memberContactIds: + type: array + items: + type: integer + description: Member Contact Ids + required: + - memberContactIds + createSubscriptionMemberResponse: + type: object + properties: + organizationId: + type: integer + description: Organization Id + ownerContactId: + type: integer + description: Owner Contact Id + memberContactIds: + type: array + items: + type: integer + description: Member Contact Ids + createdAt: + type: string + format: date-time + description: Subscription creation date + updatedAt: + type: string + format: date-time + description: Subscription last modification date + deleteSubscriptionMemberPayload: + type: object + properties: + contactId: + description: Contact Id + type: integer + default: 1 + memberContactIds: + description: Member Contact Ids + type: array + items: + type: integer + default: 2 + required: + - memberContactIds + - contactId + getSubscriptionMemberResponse: + type: object + properties: + organizationId: + type: integer + description: Organization Id + loyaltyProgramId: + type: string + format: uuid + description: Loyalty Program Id + versionId: + type: integer + description: Version Id + memberContactId: + type: array + items: + type: object + properties: + memberContactId: + type: array + items: + type: string + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + loyaltySubscriptionId: + type: string + description: Client Reference + createdAt: + type: string + format: date-time + description: Subscription creation date + updatedAt: + type: string + format: date-time + description: Subscription last modification date + + getVersionInfoResponse: + type: object + properties: + active: + type: array + description: Active Version Information + items: + $ref: '#/components/schemas/versionInfo' + draft: + type: array + description: Draft Version Information + items: + $ref: '#/components/schemas/versionInfo' + inactive: + type: array + description: Inactive Version Information + items: + $ref: '#/components/schemas/versionInfo' + versionInfo: + type: object + properties: + name: + type: string + description: Version Name + loyaltyProgramId: + type: string + format: uuid + description: Loyalty Program Id + loyaltyVersionId: + type: integer + description: Loyalty Version Id + parentVersionId: + type: integer + description: Parent Version Id + state: + type: string + description: Version State + publishedAt: + type: string + format: date-time + description: Version Publish date + createdAt: + type: string + format: date-time + description: Version creation date + updatedAt: + type: string + format: date-time + description: Version last modification date + badRequestPayload: + type: object + properties: + error: + type: string + description: Readable message associated to the failure + + getSubscriptionInfoResponse: + type: object + properties: + balance: + description: Balance Information + type: object + properties: + loyaltyProgramId: + description: Loyalty Program Id + type: string + format: uuid + contactId: + description: one of contact id or loyalty subscription id is required + type: integer + balances: + description: Balances + type: array + items: + type: object + properties: + balanceDefinitionId: + description: Balance Definition Id + type: string + format: uuid + value: + description: Value + type: integer + tier: + description: Tier Information + type: array + items: + type: object + properties: + tierId: + description: Tier Id + type: string + format: uuid + loyaltyProgramId: + description: Loyalty Program Id + type: string + format: uuid + contactId: + description: Contact Id + type: integer + groupId: + description: Group Id + type: string + format: uuid + createdAt: + description: Tier creation date + type: string + format: date-time + updatedAt: + description: Tier last modification date + type: string + format: date-time + members: + description: Subscription Member Information + type: array + items: + type: object + properties: + memberContactId: + description: Member Contact Id + type: integer + createdAt: + description: Member creation date + type: string + format: date-time + updatedAt: + description: Member last modification date + type: string + format: date-time + reward: + description: Reward Information + type: array + items: + type: object + properties: + id: + description: Reward Id + type: string + format: uuid + rewardId: + description: Reward Id + type: string + format: uuid + loyaltyProgramId: + description: Loyalty Program Id + type: string + format: uuid + contactId: + description: Contact Id + type: integer + code: + description: Reward Code + type: string + expirationDate: + description: Reward expiration date + type: string + format: date-time + contactIdInvalidResponse: + type: object + properties: + error: + description: Readable message associated to the failure + type: string + rewardAttributionResponse: + type: object + properties: + id: + description: Attributed reward Id + type: string + format: uuid + rewardId: + description: Reward id which ias attributed + type: string + format: uuid + loyaltyProgramId: + description: Loyalty program id + type: string + format: uuid + contactId: + description: Contact to which reward is attributed + type: number + code: + type: string + description: code associated to the attributed reward + expirationDate: + type: string + format: date-time + consumedAt: + type: string + format: date-time + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + subscriptionNotFoundErrorResponse: + type: object + properties: + error: + type: string + default: subscription not found + attributeRewardPayload: + type: object + properties: + rewardId: + description: Reward id + type: string + format: uuid + contactId: + description: Contact to attribute the reward + type: number + loyaltySubscriptionId: + description: One of contactId or loyaltySubscriptionId is required + type: string + required: + - rewardId + attributedRewardFailedConditionErrorResponse: + type: object + properties: + error: + type: string + example: + - reward attribution not valid + - reward disabled + - invalid reward attribution period + - invalid reward attribution case + - day limit exceeded + - week limit exceeded + - month limit exceeded + - year limit exceeded + - attribute limit per customer exceeded + - total attribution count exceeded + validateRewardPayload: + type: object + properties: + contactId: + description: Contact to attribute the reward + type: number + loyaltySubscriptionId: + description: One of contactId or loyaltySubscriptionId is required + type: string + code: + description: Code to validate + type: string + attributedRewardId: + description: One of code or attributed reward id is required + type: string + format: uuid + validatedRewardResponse: + type: object + properties: + authorize: + description: Validated reward respone + type: boolean + redeemRewardPayload: + type: object + properties: + code: + type: string + description: Code to validate + attributedRewardId: + type: string + format: uuid + description: One of code or attributed reward id is required + posId: + type: string + format: uuid + description: Point of sale reward id + contactId: + type: number + description: Contact to attribute the reward + loyaltySubscriptionId: + type: string + description: One of contactId or loyaltySubscriptionId is required + rewardRedeemResponse: + type: object + properties: + id: + description: Attributed reward Id + type: string + format: uuid + rewardId: + description: Reward id which ias attributed + type: string + format: uuid + loyaltyProgramId: + description: Loyalty program id + type: string + format: uuid + contactId: + description: Contact to which reward is attributed + type: number + code: + type: string + description: code associated to the attributed reward + consumedAt: + type: string + format: date-time + expirationDate: + type: string + format: date-time + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + redeemedRewardFailedConditionErrorResponse: + type: object + properties: + error: + type: string + example: + - code is invalid + - code is already consumed + - code is expired + - code is deleted + - reward limit for redeem reached + - reward total redeem limit reached + - reward per consumer redeem limit reached + - redeem reward rejected + offersListResponse: + type: object + properties: + totalCount: + type: integer + example: 1 + description: Total count of offers + items: + type: array + description: List of offers + items: + $ref: '#/components/schemas/offer' + offerList: + type: object + properties: + items: + type: array + description: List of offers + items: + type: object + $ref: '#/components/schemas/offer' + offer: + type: object + properties: + id: + type: string + format: uuid + description: Offer id + loyaltyProgramId: + type: string + format: uuid + description: Loyalty program id + name: + type: string + description: Offer name + state: + type: string + description: Offer state + enum: [active, pending, disabled, expired] + publicImageUrl: + type: string + description: Offer image url + createdAt: + type: string + format: date-time + description: Offer creation date + updatedAt: + type: string + format: date-time + description: Offer update date + + balanceDefinitionPage: + type: object + properties: + items: + type: array + description: Balance definition list + items: + $ref: '#/components/schemas/balanceDefinition' + + balanceDefinition: + type: object + properties: + id: + type: string + format: uuid + description: Unique identifier for the balance definition. + name: + type: string + description: Name for the balance definition + description: + type: string + description: Description for the balance definition + meta: + type: object + description: Additional metadata related to the balance definition. + unit: + type: string + description: The unit for this balance definition + minAmount: + type: number + description: Minimum possible amount for balance + maxAmount: + type: number + description: Maximum possible amount for balance + maximumCreditAmountLimit: + type: number + description: Maximum credit amount limit per operation + maximumDebitAmountLimit: + type: number + description: Maximum debit amount limit per operation + balanceOptionAmountOvertakingStrategy: + type: string + description: Partial enables partial credit of balance if maximum balance limit is reaching. Strict enables rejection of transaction if it will breach the max credit amount limit. + balanceOptionCreditRounding: + type: string + balanceOptionDebitRounding: + type: string + balanceAvailabilityDurationValue: + type: number + description: Number of days/weeks/month/year for balance expiry + balanceAvailabilityDurationUnit: + type: string + description: Unit of time for the balance's availability (e.g., day/week/month/year). + balanceAvailabilityDurationModifier: + type: string + enum: [startOfPeriod, endOfPeriod, noModification] + description: startOfPeriod depicts the balancy expiry on start of day/week/month/year. endOfPeriod depicts the balancy expiry on end of day/week/month/year + balanceExpirationDate: + type: string + format: date-time + description: Date when the balance expires and can no longer be used, in dd/mm format. The balance will be expired when this date appears next in the calendar and only one of balanceExpirationDate or balance availability fields can be used. + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + createBalanceDefinitionPayload: + type: object + required: + - name + - unit + properties: + name: + type: string + description: Name for the balance + description: + type: string + description: Description for the balance + meta: + type: object + description: Additional metadata related to the balance definition. + unit: + type: string + enum: + - points + - EUR + - USD + - MXN + - GBP + - INR + - CAD + - SGD + - RON + - JPY + - MYR + - CLP + - PEN + - MAD + - AUD + - CHF + - BRL + description: The unit for this balance definition. + minAmount: + type: number + description: Minimum possible amount for balance + maxAmount: + type: number + description: Maximum possible amount for balance + maxCreditAmountLimit: + type: number + description: Maximum credit amount limit per operation + maxDebitAmountLimit: + type: number + description: Maximum debit amount limit per operation + balanceOptionAmountOvertakingStrategy: + type: string + description: Select partial to enable partial credit of balance if maximum balance limit is reaching. Select strict to reject the transaction if it will breach the max credit amount limit. + default: strict + enum: + - strict + - partial + balanceOptionCreditRounding: + type: string + description: Select natural to round to nearest integer. Select upper to round up . Select lower to round down + default: natural + enum: + - natural + - upper + - lower + balanceOptionDebitRounding: + type: string + description: Select natural to round to nearest integer. Select upper to round up . Select lower to round down + default: natural + enum: + - natural + - upper + - lower + balanceAvailabilityDurationValue: + type: number + description: Number of days/weeks/month/year for balance expiry + balanceAvailabilityDurationUnit: + type: string + description: Unit for balance expiry (e.g., day/week/month/year). + default: day + enum: + - day + - week + - month + - year + balanceAvailabilityDurationModifier: + type: string + description: Select startOfPeriod to configure balance expiry on start of day/week/month/year. Select endOfPeriod to configure balance expiry on end of day/week/month/year, else select noModification + default: noModification + enum: + - startOfPeriod + - endOfPeriod + - noModification + balanceExpirationDate: + type: string + description: Date when the balance expires and can no longer be used, in dd/mm format. The balance will be expired when this date appears next in the calendar and only one of balanceExpirationDate or balance availability fields can be used. + example: 02/01 + + updateBalanceDefinitionPayload: + type: object + required: + - name + - unit + properties: + name: + type: string + description: Name for the balance definition + description: + type: string + description: Description for the balance definition + meta: + type: object + description: Additional metadata related to the balance definition. + unit: + type: string + enum: + - points + - EUR + - USD + - MXN + - GBP + - INR + - CAD + - SGD + - RON + - JPY + - MYR + - CLP + - PEN + - MAD + - AUD + - CHF + - BRL + description: The unit for this balance definition. + minAmount: + type: number + description: Minimum possible amount for balance + maxAmount: + type: number + description: Maximum possible amount for balance + maxCreditAmountLimit: + type: number + description: Maximum credit amount limit per operation + maxDebitAmountLimit: + type: number + description: Maximum debit amount limit per operation + balanceOptionAmountOvertakingStrategy: + type: string + description: Select partial to enable partial credit of balance if maximum balance limit is reaching. Select strict to reject the transaction if it will breach the max credit amount limit. + default: strict + enum: + - strict + - partial + balanceOptionCreditRounding: + type: string + description: Select natural to round to nearest integer. Select upper to round up . Select lower to round down + default: natural + enum: + - natural + - upper + - lower + balanceOptionDebitRounding: + type: string + description: Select natural to round to nearest integer. Select upper to round up . Select lower to round down + default: natural + enum: + - natural + - upper + - lower + balanceAvailabilityDurationValue: + type: number + description: Number of days/weeks/month/year for balance expiry + balanceAvailabilityDurationUnit: + type: string + description: Unit of time for the balance's availability (e.g., day/week/month/year). + default: day + enum: + - day + - week + - month + - year + balanceAvailabilityDurationModifier: + type: string + description: Select startOfPeriod to configure balance expiry on start of day/week/month/year. Select endOfPeriod to configure balance expiry on end of day/week/month/year, else select noModification + default: noModification + enum: + - startOfPeriod + - endOfPeriod + - noModification + balanceExpirationDate: + type: string + description: Date when the balance expires and can no longer be used, in dd/mm format. The balance will be expired when this date appears next in the calendar and only one of balanceExpirationDate or balance availability fields can be used. + example: 02/01 + + balanceLimit: + type: object + description: Balance definition limit + properties: + constraintType: + type: string + description: Select amount to define constraints on amount and transaction to define constraints on transaction + default: amount + enum: + - amount + - transaction + transactionType: + type: string + description: Select debit to configure limit for debit transaction type. Select credit to configure limit for credit transaction type + default: debit + enum: + - debit + - credit + durationValue: + type: integer + description: Number of days/weeks/month/year for balance limit + durationUnit: + type: string + description: Unit for the balance's availability + default: day + enum: + - day + - week + - month + - year + value: + type: number + description: The value or amount associated with the balance limit. + + balanceLimitPayload: + type: object + description: Balance definition limit payload + properties: + id: + type: string + format: uuid + description: Unique identifier for the balance limit in UUID format. + transactionType: + type: string + enum: + - debit + - credit + durationValue: + type: integer + description: Number of days/weeks/month/year for balance expiry + durationUnit: + type: string + description: Unit of time for the balance's availability (e.g., day/week/month/year). + enum: + - day + - week + - month + - year + value: + type: number + description: The value or amount associated with the balance limit. + constraintType: + type: string + description: Defines the type of constraint imposed by the balance limit. + enum: + - amount + - transaction + balancePage: + type: object + properties: + balance: + $ref: '#/components/schemas/balance' + + balance: + type: object + properties: + loyaltyProgramId: + description: Loyalty program Id + type: string + format: uuid + contactId: + description: Contact Id associated with the balance + type: integer + balances: + type: array + description: List of balances + items: + type: object + properties: + balanceDefinitionId: + description: Balance definition Id + type: string + format: uuid + value: + description: The monetary value corresponding to the current balance + type: number + + createTransactionPayload: + type: object + properties: + amount: + description: Enter positive value for credit transaction and negative value for debit transaction + type: number + balanceDefinitionId: + description: Balance definition id for which the transaction is made + type: string + format: uuid + contactId: + description: Contact id + type: number + meta: + description: Additional metadata related to the transaction. + type: object + example: { "key": "value" } + ttl: + description: Time to live for the transaction in seconds. This defines how long the transaction remains valid before it expires. + type: integer + default: 300 + required: + - amount + - balanceDefinitionId + - contactId + + transaction: + type: object + properties: + id: + description: Unique identifier for the transaction. + type: string + format: uuid + status: + description: Current status of the transaction, indicating its state (draft/complete/cancelled/rejected/expired) + enum: + - draft + - complete + - cancelled + - rejected + - expired + amount: + description: The monetary value of the transaction. + type: number + meta: + description: Additional metadata related to the transaction. + type: object + rejectedAt: + description: Timestamp indicating when the transaction was rejected + type: string + format: date-time + example: "" + rejectReason: + description: Reason for rejecting the transaction + type: string + example: "" + expirationDate: + description: Date when the transaction expires if not completed. + type: string + format: date-time + example: "" + completedAt: + type: string + format: date-time + example: "" + cancelledAt: + type: string + format: date-time + example: "" + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + + validationError: + type: object + properties: + error: + description: Validation error message + type: string + completeTransactionPayload: + type: object + properties: + balanceExpiryInMinutes: + description: Adds expiry in minutes to the balance on completion of transaction + type: number + default: 0 + completedTransaction: + type: object + properties: + id: + description: Unique identifier for the transaction. + type: string + format: uuid + status: + description: Current status of the transaction, indicating its state (draft/complete/cancelled/rejected/expired) + enum: + - completed + - rejected + - cancelled + - draft + - expired + amount: + description: The monetary value of the transaction. + type: number + meta: + description: Additional metadata related to the transaction + type: object + rejectedAt: + description: Timestamp indicating when the transaction was rejected + type: string + format: date-time + example: "" + rejectReason: + description: Reason for rejecting the transaction + type: string + example: "" + expirationDate: + description: Date when the transaction expires if not completed. + type: string + format: date-time + example: "" + completedAt: + type: string + format: date-time + cancelledAt: + type: string + format: date-time + example: "" + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + + cancelledTransaction: + type: object + properties: + id: + description: Unique identifier for the transaction. + type: string + format: uuid + status: + description: Current status of the transaction, indicating its state (draft/complete/cancelled/rejected/expired) + enum: + - cancelled + - completed + - rejected + - draft + - expired + amount: + description: The monetary value of the transaction. + type: number + meta: + description: Additional metadata related to the transaction + type: object + rejectedAt: + description: Timestamp indicating when the transaction was rejected + type: string + format: date-time + example: "" + rejectReason: + description: Reason for rejecting the transaction + type: string + example: "" + expirationDate: + description: Date when the transaction expires if not completed. + type: string + format: date-time + example: "" + completedAt: + type: string + format: date-time + example: "" + cancelledAt: + type: string + format: date-time + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + + balanceDefinitionIdDoesNotExist: + type: object + properties: + error: + description: Provided balance definition id does not exist + type: string + example: provided balance definition id does not exist + contactBalances: + type: object + properties: + loyaltyProgramId: + description: Unique identifier for the loyalty program. + type: string + format: uuid + balanceDefinitionId: + description: Unique identifier for the balance definition. + type: string + format: uuid + count: + description: Total count of balances. + type: integer + example: 2 + balances: + type: array + items: + type: object + properties: + contactId: + description: Unique identifier for the contact. + type: integer + example: 2 + value: + description: Total balance value associated with the contact. + type: integer + example: 10 + updatedAt: + description: Timestamp of the last update to the contact's balance record. + type: string + format: date-time + example: "2024-10-14T12:54:30+05:30" + loyaltySubscriptionId: + description: Identifier for the contact's loyalty subscription. + type: string + example: "5f609755-6fe8-4213-883a-6098af0f3692" + required: + - contactId + - value + - updatedAt + - loyaltySubscriptionId + required: + - loyaltyProgramId + - balanceDefinitionId + - count + - balances + + createOrderPayload: + type: object + properties: + amount: + description: Amount of the order + type: number + dueAt: + description: Date and time at which the order needs to be processed + type: string + example: "2021-01-01T00:00:00Z" + expiresAt: + description: Add expiration to the balance credited by the order + type: string + meta: + description: Additional metadata related to the order. + type: object + example: {"key": "value"} + contactId: + description: Contact id + type: number + balanceDefinitionId: + description: Balance definition id + type: string + format: uuid + required: + - amount + - balanceDefinitionId + - contactId + - dueAt + + + # Tier + createTierGroupRequest: + type: object + properties: + name: + type: string + description: Name of the tier group + upgradeStrategy: + type: string + description: Select real_time to upgrade tier on real time balance updates. Select anniversary to upgrade tier on subscription anniversary. + enum: + - real_time + - anniversary + default: real_time + downgradeStrategy: + type: string + description: Select real_time to downgrade tier on real time balance updates. Select anniversary to downgrade tier on subscription anniversary. + enum: + - real_time + - anniversary + default: real_time + + updateTierGroupRequest: + type: object + properties: + name: + type: string + description: Name of the tier group + tierOrder: + type: string + format: uuid + description: Order of the tiers in the group in ascending order + upgradeStrategy: + type: string + description: Select real_time to upgrade tier on real time balance updates. Select anniversary to upgrade tier on subscription anniversary. + enum: + - real_time + - anniversary + default: real_time + downgradeStrategy: + type: string + description: Select real_time to downgrade tier on real time balance updates. Select anniversary to downgrade tier on subscription anniversary. + enum: + - real_time + - anniversary + default: real_time + + tierGroup: + type: object + properties: + id: + type: string + format: uuid + description: Tier group unique identifier + name: + type: string + description: Tier group name + tierOrder: + type: array + items: + type: string + format: uuid + example: [] + description: Order of the tiers in the group in ascending order + loyaltyProgramId: + type: string + format: uuid + description: Associated loyalty program Id + upgradeStrategy: + type: string + description: Select real_time to upgrade tier on real time balance updates. Select anniversary to upgrade tier on subscription anniversary. + enum: + - real_time + - anniversary + default: real_time + downgradeStrategy: + type: string + description: Select real_time to downgrade tier on real time balance updates. Select anniversary to downgrade tier on subscription anniversary. + enum: + - real_time + - anniversary + default: real_time + createdAt: + type: string + format: date-time + description: Timestamp when the tier group was created + updatedAt: + type: string + format: date-time + description: Timestamp when the tier group was last updated + + tierGroupPage: + type: object + properties: + items: + type: array + items: + $ref: '#/components/schemas/tierGroup' + + errorResponse: + type: object + properties: + error: + type: string + description: Error message indicating what went wrong + + unauthorizedResponse: + type: object + properties: + error: + type: string + description: Request Authentication Failed + + loyaltyTierPage: + type: object + properties: + items: + type: array + items: + $ref: '#/components/schemas/tier' + + tier: + type: object + properties: + tierId: + type: string + format: uuid + description: Tier id + name: + type: string + description: Tier name + imageRef: + type: string + description: Tier image reference + loyaltyProgramId: + type: string + format: uuid + description: Associated loyalty program Id + groupId: + type: string + format: uuid + description: Associated group Id + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + accessConditions: + type: array + description: Conditions required to access this tier + items: + type: object + properties: + balanceDefinitionId: + type: string + format: uuid + description: Balance definition identifier + minimumValue: + type: integer + description: Minimum value required to access this tier + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + tierRewards: + type: array + description: Rewards associated with this tier + items: + type: object + properties: + rewardId: + type: string + format: uuid + description: Reward to be attributed on tier assignment + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + + tierRequest: + type: object + required: + - name + - accessConditions + properties: + name: + type: string + description: Name of the tier to be created + accessConditions: + type: array + items: + type: object + properties: + balanceDefinitionId: + type: string + format: uuid + description: Balance definition identifier for accessing the tier + minimumValue: + type: integer + description: Minimum value required to access the tier + tierRewards: + type: array + items: + type: object + properties: + rewardId: + type: string + format: uuid + description: Reward unique identifier + + tierForContact: + type: object + properties: + tierId: + type: string + format: uuid + description: Unique identifier for the assigned tier + loyaltyProgramId: + type: string + format: uuid + description: Associated loyalty program Id + groupId: + type: string + format: uuid + description: Group Id to which the tier is associated + contactId: + type: integer + description: Contact to which the tier is assigned + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + + createModel: + required: + - id + type: object + properties: + id: + type: integer + description: ID of the object created + format: int64 + example: 5 + + createPaymentResponse: + type: object + required: + - id + properties: + id: + type: integer + format: int64 + description: ID of the object created + example: 122 + url: + type: string + description: URL of the payment request created + example: https://pay.brevo.com/payment/6d4ec0b2b48ef803df4103ve + + createUpdateContactModel: + type: object + properties: + id: + type: integer + description: ID of the contact when a new contact is created + format: int64 + example: 122 + updateBatchContactsModel: + type: object + properties: + successIds: + type: array + items: + type: integer + description: IDs which are successfully updated + format: int64 + example: 1,2 + failureIds: + type: array + items: + type: integer + description: IDs which are not updated + format: int64 + example: 3,4 + createSenderModel: + required: + - id + type: object + properties: + id: + type: integer + description: ID of the Sender created + format: int64 + example: 5 + spfError: + type: boolean + description: Status of SPF configuration for the sender (true = SPF not + well configured, false = SPF well configured) + example: true + dkimError: + type: boolean + description: Status of DKIM configuration for the sender (true = DKIM not + well configured, false = DKIM well configured) + example: false + createDomainModel: + required: + - id + type: object + properties: + id: + type: integer + description: ID of the Domain created + format: int64 + example: 5 + domain_name: + type: string + description: Domain + example: example.com + domain_provider: + type: string + description: Domain Provider + example: GoDaddy + message: + type: string + description: Success message + example: Domain added successfully. To authenticate it, add following DNS records + dns_records: + type: object + properties: + dkim_record: + type: object + properties: + type: + type: string + value: + type: string + host_name: + type: string + status: + type: boolean + brevo_code: + type: object + properties: + type: + type: string + value: + type: string + host_name: + type: string + status: + type: boolean + dmarc_record: + type: object + properties: + type: + type: string + value: + type: string + host_name: + type: string + status: + type: boolean + authenticateDomainModel: + required: + - domain_name + - message + type: object + properties: + domain_name: + type: string + description: Domain + example: myexample.com + message: + type: string + description: Success message + example: Domain has been authenticated successfully. + getDomainConfigurationModel: + required: + - domain + - verified + - authenticated + - dns_records + type: object + properties: + domain: + type: string + description: Domain + example: myexample.com + verified: + type: boolean + description: Status of domain verification (true=verified, false=non verified) + example: true + authenticated: + type: boolean + description: Status of domain authentication (true=authenticated, false=non authenticated) + example: false + dns_records: + type: object + properties: + dkim_record: + type: object + properties: + type: + type: string + value: + type: string + host_name: + type: string + status: + type: boolean + brevo_code: + type: object + properties: + type: + type: string + value: + type: string + host_name: + type: string + status: + type: boolean + dmarc_record: + type: object + properties: + type: + type: string + value: + type: string + host_name: + type: string + status: + type: boolean + createSmtpEmail: + type: object + properties: + messageId: + type: string + description: Message ID of the transactional email sent + example: <201798300811.5787683@relay.domain.com> + messageIds: + type: array + items: + type: string + description: version wise message ID's of the transactional emails sent + example: ['<201798300811.5787683@relay.domain.com>','<201798300811.5787683@relay.domain.com>'] + uploadImageModel: + type: object + properties: + url: + type: string + description: URL of the image uploaded + example: 'https://img.mailinblue.com/100000/images/rnb/original/62casdase8wewq9df1c2f27c.jpeg' + scheduleSmtpEmail: + type: object + properties: + messageId: + type: string + description: Message ID of the transactional email scheduled + example: <201798300811.5787683@relay.domain.com> + messageIds: + type: array + items: + type: string + description: version wise message ID's of the transactional emails scheduled + batchId: + type: string + description: Batch ID of the batch transactional email scheduled + example: 5c6cfa04-eed9-42c2-8b5c-6d470d978e9d + sendSms: + required: + - messageId + - reference + type: object + properties: + reference: + type: string + example: ab1cde2fgh3i4jklmno + messageId: + type: integer + format: int64 + example: 1511882900176220 + smsCount: + type: integer + description: Count of SMS's to send multiple text messages + format: int64 + example: 2 + usedCredits: + type: number + description: SMS credits used per text message + format: float + example: 0.7 + remainingCredits: + type: number + description: Remaining SMS credits of the user + format: float + example: 82.85 + createdProcessId: + required: + - processId + type: object + properties: + processId: + type: integer + description: Id of the process created + format: int64 + example: 78 + createUpdateFolder: + type: object + properties: + name: + type: string + description: Name of the folder + example: Wordpress Contacts + postSendFailed: + required: + - code + - message + type: object + properties: + code: + type: string + description: Response code + example: invalid_parameter + message: + type: string + description: Response message + example: The email could not be sent to all recipients + unexistingEmails: + type: array + items: + type: string + description: Email addresses you tried to sent an email to, but not existing + in your contacts + format: email + example: matthew.dow@example.com, elisa.carrely@example.com + withoutListEmails: + type: array + items: + type: string + description: Email addresses you sent an email to, without a contact list + format: email + example: jeff.dean@example.com, jim.sue@example.com + blackListedEmails: + type: array + items: + type: string + description: Email addresses which are blacklisted. ONLY FOR email-campign's + sendTest OR smtp-template's sendTest api's. + format: email + example: jeff.dean@example.com, jim.sue@example.com + postSendSmsTestFailed: + required: + - code + - message + type: object + properties: + code: + type: string + description: Response code + example: invalid_parameter + message: + type: string + description: Response message + example: The SMS could not be sent to all recipients + unexistingSms: + type: array + items: + type: string + description: Email addresses you tried to sent a SMS to, but not existing + in your contacts + format: email + example: 337699086644@mailin.com, 41778899954@mailin.com + withoutListSms: + type: array + items: + type: string + description: Email addresses you sent a SMS to, without a contact list + format: email + example: 3542388988@mailin.com, 10976444477@mailin.com + postContactInfo: + required: + - contacts + type: object + properties: + contacts: + type: object + properties: + success: + oneOf: + - type: array + items: + type: string + description: Email addresses which are successfully imported/removed + format: email + example: jeff32@example.com, jim56@example.com + - type: array + items: + type: integer + description: IDs which are successfully imported/removed + format: int64 + example: 1, 2 + failure: + oneOf: + - type: array + items: + type: string + description: Email addresses which can not be imported/removed, could be already in/out list and/or doesn't exist + format: email + example: jeff32@example.com, jim56@example.com + - type: array + items: + type: integer + description: IDs which can not be imported/removed, could be already in/out list and/or doesn't exist + format: int64 + example: 5, 6 + total: + type: integer + description: Displays the count of total number of contacts removed + from list when user opts for "all" option. + format: int64 + example: 27 + processId: + type: integer + description: Id of the process created to remove contacts from list + when user opts for "all" option. + format: int64 + example: 78 + getAggregatedReport: + type: object + properties: + range: + type: string + description: Time frame of the report + example: 2016-09-08|2017-04-06 + requests: + type: integer + description: Number of requests for the timeframe + format: int64 + example: 263 + delivered: + type: integer + description: Number of delivered emails for the timeframe + format: int64 + example: 249 + hardBounces: + type: integer + description: Number of hardbounces for the timeframe + format: int64 + example: 1 + softBounces: + type: integer + description: Number of softbounces for the timeframe + format: int64 + example: 4 + clicks: + type: integer + description: Number of clicks for the timeframe + format: int64 + example: 12 + uniqueClicks: + type: integer + description: Number of unique clicks for the timeframe + format: int64 + example: 8 + opens: + type: integer + description: Number of openings for the timeframe + format: int64 + example: 47 + uniqueOpens: + type: integer + description: Number of unique openings for the timeframe + format: int64 + example: 37 + spamReports: + type: integer + description: Number of complaint (spam report) for the timeframe + format: int64 + example: 0 + blocked: + type: integer + description: Number of blocked contact emails for the timeframe + format: int64 + example: 2 + invalid: + type: integer + description: Number of invalid emails for the timeframe + format: int64 + example: 0 + unsubscribed: + type: integer + description: Number of unsubscribed emails for the timeframe + format: int64 + example: 0 + getTransacBlockedContacts: + type: object + properties: + count: + type: integer + description: Count of blocked or unsubscribed contact + format: int64 + example: 1 + contacts: + type: array + items: + required: + - blockedAt + - email + - reason + - senderEmail + type: object + properties: + email: + type: string + description: Email address of the blocked or unsubscribed contact + format: email + example: john.smith@example.com + senderEmail: + type: string + description: Sender email address of the blocked or unsubscribed contact + format: email + example: john.smith@example.com + reason: + type: object + properties: + code: + type: string + description: Reason code for blocking / unsubscribing (This code + is safe for comparison) + example: AdminBlocked + enum: + - unsubscribedViaMA + - unsubscribedViaEmail + - adminBlocked + - unsubscribedViaApi + - hardBounce + - contactFlaggedAsSpam + message: + type: string + description: Reason for blocking / unsubscribing (This string + is not safe for comparison) + example: Admin blocked + description: Reason for blocking / unsubscribing + example: Admin blocked + blockedAt: + type: string + description: Date when the contact was blocked or unsubscribed on + example: 2017-05-01T12:30:00Z + getReports: + type: object + properties: + reports: + type: array + items: + required: + - blocked + - clicks + - date + - delivered + - hardBounces + - invalid + - opens + - requests + - softBounces + - spamReports + - uniqueClicks + - uniqueOpens + - unsubscribed + type: object + properties: + date: + type: string + description: Date of the statistics + format: date + example: 2017-04-06 + requests: + type: integer + description: Number of requests for the date + format: int64 + example: 65 + delivered: + type: integer + description: Number of delivered emails for the date + format: int64 + example: 63 + hardBounces: + type: integer + description: Number of hardbounces for the date + format: int64 + example: 1 + softBounces: + type: integer + description: Number of softbounces for the date + format: int64 + example: 1 + clicks: + type: integer + description: Number of clicks for the date + format: int64 + example: 6 + uniqueClicks: + type: integer + description: Number of unique clicks for the date + format: int64 + example: 5 + opens: + type: integer + description: Number of openings for the date + format: int64 + example: 58 + uniqueOpens: + type: integer + description: Number of unique openings for the date + format: int64 + example: 52 + spamReports: + type: integer + description: Number of complaints (spam reports) for the date + format: int64 + example: 0 + blocked: + type: integer + description: Number of blocked emails for the date + format: int64 + example: 0 + invalid: + type: integer + description: Number of invalid emails for the date + format: int64 + example: 0 + unsubscribed: + type: integer + description: Number of unsubscribed emails for the date + format: int64 + example: 0 + getEmailEventReport: + type: object + properties: + events: + type: array + items: + required: + - date + - email + - event + - messageId + type: object + properties: + email: + type: string + description: Email address which generates the event + format: email + example: john.smith@example.com + date: + type: string + description: UTC date-time on which the event has been generated + example: 2017-03-12T12:30:00Z + subject: + type: string + description: Subject of the event + example: Sib client test + messageId: + type: string + description: Message ID which generated the event + example: <201798300811.5787683@relay.domain.com> + event: + type: string + description: Event which occurred + example: delivered + enum: + - bounces + - hardBounces + - softBounces + - delivered + - spam + - requests + - opened + - clicks + - invalid + - deferred + - blocked + - unsubscribed + - error + - loadedByProxy + reason: + type: string + description: Reason of bounce (only available if the event is hardbounce + or softbounce) + example: Error connection timeout + tag: + type: string + description: Tag of the email which generated the event + example: OrderConfirmation + ip: + type: string + description: IP from which the user has opened the email or clicked + on the link (only available if the event is opened or clicks) + example: 165.87.3.15 + link: + type: string + description: The link which is sent to the user (only available if + the event is requests or opened or clicks) + example: https://www.someexamplelink.com + from: + type: string + description: Sender email from which the emails are sent + format: email + example: john@example.com + templateId: + type: integer + description: ID of the template (only available if the email is template based) + format: int64 + example: 4 + getSmsEventReport: + type: object + properties: + events: + type: array + items: + type: object + properties: + phoneNumber: + type: string + description: Phone number which has generated the event + example: "00189001094" + date: + type: string + description: UTC date-time on which the event has been generated + example: 2017-03-12T12:30:00Z + messageId: + type: string + description: Message ID which generated the event + example: "1472640582425378" + event: + type: string + description: Event which occurred + example: accepted + enum: + - bounces + - hardBounces + - softBounces + - delivered + - sent + - accepted + - unsubscription + - replies + - blocked + - rejected + - skipped + reason: + type: string + description: Reason of bounce (only available if the event is hardbounce + or softbounce) + example: Message is undeliverable due to an incorrect / invalid / + blacklisted / permanently barred MSISDN for this operator + reply: + type: string + tag: + type: string + description: Tag of the SMS which generated the event + example: CabWaiting + getSmtpTemplateOverview: + required: + - createdAt + - htmlContent + - id + - isActive + - modifiedAt + - name + - replyTo + - sender + - subject + - tag + - testSent + - toField + type: object + properties: + id: + type: integer + description: ID of the template + format: int64 + example: 4 + name: + type: string + description: Name of the template + example: Order Confirmation - EN + subject: + type: string + description: Subject of the template + example: Thanks for your order ! + isActive: + type: boolean + description: Status of template (true=active, false=inactive) + example: true + testSent: + type: boolean + description: Status of test sending for the template (true=test email has + been sent, false=test email has not been sent) + example: true + sender: + type: object + properties: + name: + type: string + description: From email for the template + example: Mary form MyShop + email: + type: string + description: From email for the template + format: email + example: contact@myshop.fr + id: + type: string + description: Sender id of the template + example: "43" + replyTo: + type: string + description: Email defined as the "Reply to" for the template + format: email + example: replyto@domain.com + toField: + type: string + description: Customisation of the "to" field for the template + example: '{FIRSTNAME} {LASTNAME}' + tag: + type: string + description: Tag of the template + example: sports + htmlContent: + type: string + description: HTML content of the template + example: Your order n°xxxxx has been confirmed. Thanks for your purchase. + createdAt: + type: string + description: Creation UTC date-time of the template (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-05-01T12:30:00Z + modifiedAt: + type: string + description: Last modification UTC date-time of the template (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-05-12T12:30:00Z + doiTemplate: + type: boolean + description: It is true if template is a valid Double opt-in (DOI) template, + otherwise it is false. This field will be available only in case of single + template detail call. + example: false + getSmtpTemplates: + type: object + properties: + count: + type: integer + description: Count of transactional email templates + format: int64 + example: 1 + templates: + type: array + items: + $ref: '#/components/schemas/getSmtpTemplateOverview' + getWebhook: + required: + - createdAt + - description + - events + - id + - modifiedAt + - type + - url + type: object + properties: + url: + type: string + description: URL of the webhook + format: url + example: http://requestb.in/173lyyx1 + id: + type: integer + description: ID of the webhook + format: int64 + example: 654 + description: + type: string + description: Description of the webhook + example: Webhook triggered on campaign openings + events: + type: array + items: + type: string + description: Events which will trigger the webhook when they occure + example: opens,clicks + type: + type: string + description: Type of webhook (marketing or transactional) + example: marketing + enum: + - marketing + - transactional + createdAt: + type: string + description: Creation UTC date-time of the webhook (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2016-12-01T12:50:00Z + modifiedAt: + type: string + description: Last modification UTC date-time of the webhook (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-05-12T13:15:00Z + batched: + type: boolean + description: Batching configuration of the webhook, we send batched webhooks if its true + example: true + auth: + type: object + description: Authentication header to be send with the webhook requests + example: + type: bearer + token: test-auth-token1234 + headers: + type: array + items: + type: object + description: Headers send with the requests to the webhook + example: + key: cf-secret + value: test-header-value + getWebhooks: + required: + - webhooks + type: object + properties: + webhooks: + type: array + items: + type: object + allOf: + - $ref: '#/components/schemas/getWebhook' + getContactDetails: + required: + - attributes + - createdAt + - emailBlacklisted + - id + - listIds + - modifiedAt + - smsBlacklisted + type: object + properties: + email: + type: string + description: Email address of the contact for which you requested the details + format: email + example: john.smith@example.com + id: + type: integer + description: ID of the contact for which you requested the details + format: int64 + example: 32 + emailBlacklisted: + type: boolean + description: Blacklist status for email campaigns (true=blacklisted, false=not + blacklisted) + example: false + smsBlacklisted: + type: boolean + description: Blacklist status for SMS campaigns (true=blacklisted, false=not + blacklisted) + example: true + createdAt: + type: string + description: Creation UTC date-time of the contact (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-05-12T12:30:00Z + modifiedAt: + type: string + description: Last modification UTC date-time of the contact (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-05-12T12:30:00Z + listIds: + type: array + items: + type: integer + description: List(s) in which the contact is included + format: int64 + listUnsubscribed: + type: array + items: + type: integer + description: List(s) in which the contact is included (only available + if unsubscription per list is activated for the account) + format: int64 + attributes: + type: object + properties: {} + description: Set of attributes of the contact + example: + name: Joe + email: joe@example.com + getExtendedContactDetails: + allOf: + - $ref: '#/components/schemas/getContactDetails' + - required: + - statistics + type: object + properties: + statistics: + type: object + properties: + messagesSent: + type: array + description: Listing of the sent campaign for the contact + items: + required: + - campaignId + - eventTime + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + hardBounces: + type: array + description: Listing of the hardbounes generated by the contact + items: + required: + - campaignId + - eventTime + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + softBounces: + type: array + description: Listing of the softbounes generated by the contact + items: + required: + - campaignId + - eventTime + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + complaints: + type: array + description: Listing of the complaints generated by the contact + items: + required: + - campaignId + - eventTime + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + unsubscriptions: + required: + - adminUnsubscription + - userUnsubscription + type: object + properties: + userUnsubscription: + type: array + description: Contact unsubscribe via unsubscription link in a + campaign + items: + required: + - campaignId + - eventTime + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + ip: + type: string + description: IP from which the user has unsubscribed + example: 165.87.3.15 + adminUnsubscription: + type: array + description: Contact has been unsubscribed from the administrator + items: + required: + - eventTime + type: object + properties: + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + ip: + type: string + description: IP from which the user has been unsubscribed + example: 165.87.3.15 + description: Listing of the unsubscription for the contact + opened: + type: array + description: Listing of the openings generated by the contact + items: + required: + - campaignId + - count + - eventTime + - ip + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + count: + type: integer + description: Number of openings for the campaign + format: int64 + example: 1 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + ip: + type: string + description: IP from which the user has opened the email + example: 165.87.3.15 + clicked: + type: array + description: Listing of the clicks generated by the contact + items: + required: + - campaignId + - links + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + links: + type: array + description: Listing of the clicked links for the campaign + items: + required: + - count + - eventTime + - ip + - url + type: object + properties: + count: + type: integer + description: Number of clicks on this link for the campaign + format: int64 + example: 1 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + ip: + type: string + description: IP from which the user has clicked on the + link + example: 165.87.3.15 + url: + type: string + description: URL of the clicked link + example: www.myshop.com + transacAttributes: + type: array + description: Listing of the transactional attributes for the contact + items: + type: object + properties: {} + delivered: + type: array + description: Listing of the delivered campaign for the contact + items: + required: + - campaignId + - eventTime + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + description: Campaign statistics of the contact + getContactCampaignStats: + type: object + properties: + messagesSent: + type: array + items: + required: + - campaignId + - eventTime + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + hardBounces: + type: array + items: + required: + - campaignId + - eventTime + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + softBounces: + type: array + items: + required: + - campaignId + - eventTime + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + complaints: + type: array + items: + required: + - campaignId + - eventTime + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + unsubscriptions: + required: + - adminUnsubscription + - userUnsubscription + type: object + properties: + userUnsubscription: + type: array + description: Contact has unsubscribed via the unsubscription link in + the email + items: + required: + - campaignId + - eventTime + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + ip: + type: string + description: IP from which the user has unsubscribed + example: 165.87.3.15 + adminUnsubscription: + type: array + description: Contact has been unsubscribed from the administrator + items: + required: + - eventTime + type: object + properties: + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + ip: + type: string + description: IP from which the user has been unsubscribed + example: 165.87.3.15 + opened: + type: array + items: + required: + - campaignId + - count + - eventTime + - ip + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + count: + type: integer + description: Number of openings of the campaign + format: int64 + example: 3 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + ip: + type: string + description: IP from which the user has opened the campaign + example: 165.87.3.15 + clicked: + type: array + items: + required: + - campaignId + - links + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + links: + type: array + items: + required: + - count + - eventTime + - ip + - url + type: object + properties: + count: + type: integer + description: Number of clicks on this link for the campaign + format: int64 + example: 1 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + ip: + type: string + description: IP from which the user has clicked on the link + example: 165.87.3.15 + url: + type: string + description: URL of the clicked link + example: www.myshop.com + transacAttributes: + type: array + items: + required: + - orderDate + - orderId + - orderPrice + type: object + properties: + orderDate: + type: string + description: Date of the order + format: date + example: 2017-03-12 + orderPrice: + type: number + description: Price of the order + format: float + example: 24.99 + orderId: + type: integer + description: ID of the order + format: int64 + example: 248 + delivered: + type: array + items: + required: + - campaignId + - eventTime + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + description: Campaign Statistics for the contact + getContacts: + required: + - contacts + - count + type: object + properties: + contacts: + type: array + items: + type: object + allOf: + - $ref: '#/components/schemas/getContactDetails' + count: + type: integer + description: Number of contacts + format: int64 + example: 17655 + getAttributes: + required: + - attributes + type: object + properties: + attributes: + type: array + description: Listing of available contact attributes in your account + items: + required: + - category + - name + type: object + properties: + name: + type: string + description: Name of the attribute + example: LASTNAME + category: + type: string + description: Category of the attribute + example: category + enum: + - normal + - transactional + - category + - calculated + - global + type: + type: string + description: Type of the attribute + example: text + enum: + - text + - date + - float + - id + - boolean + enumeration: + type: array + description: Parameter only available for "category" type attributes. + items: + required: + - label + - value + type: object + properties: + value: + type: integer + description: ID of Value of the "category" type attribute + format: int64 + example: 1 + label: + type: string + description: Label of the "category" type attribute + example: Women + calculatedValue: + type: string + description: Calculated value formula + example: COUNT[ORDER_ID,ORDER_DATE,==,NOW(-1)] + getFolders: + type: object + properties: + folders: + type: array + items: + type: object + allOf: + - $ref: '#/components/schemas/getFolder' + count: + type: integer + description: Number of folders available in your account + format: int64 + example: 10 + getFolder: + required: + - id + - name + - totalBlacklisted + - totalSubscribers + - uniqueSubscribers + type: object + properties: + id: + type: integer + description: ID of the folder + format: int64 + example: 2 + name: + type: string + description: Name of the folder + example: Magento Customers + totalBlacklisted: + type: integer + description: Number of blacklisted contacts in the folder + format: int64 + example: 32 + totalSubscribers: + type: integer + description: Number of contacts in the folder + format: int64 + example: 19777 + uniqueSubscribers: + type: integer + description: Number of unique contacts in the folder + format: int64 + example: 16222 + getFolderLists: + type: object + properties: + lists: + type: array + items: + type: object + allOf: + - $ref: '#/components/schemas/getList' + count: + type: integer + description: Number of lists in the folder + format: int64 + example: 6 + getLists: + type: object + properties: + lists: + type: array + description: Listing of all the lists available in your account + items: + type: object + allOf: + - $ref: '#/components/schemas/getList' + - required: + - folderId + type: object + properties: + folderId: + type: integer + description: ID of the folder + format: int64 + example: 2 + count: + type: integer + description: Number of lists in your account + format: int64 + example: 150 + getSegments: + type: object + properties: + segments: + type: array + description: Listing of all the segments available in your account + items: + type: object + required: + - id + - name + - segmentName + - categoryName + properties: + id: + type: integer + description: ID of the list + format: int64 + example: 23 + segmentName: + type: string + description: Name of the Segment + example: My Segment + categoryName: + type: string + description: Name of the Segment Category + format: string + example: New Category + updatedAt: + type: string + description: Updation UTC date-time of the segment (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: '2017-03-13T17:05:09Z' + count: + type: integer + description: Number of Segments in your account + format: int64 + example: 10 + getList: + required: + - id + - name + - totalBlacklisted + - totalSubscribers + - uniqueSubscribers + type: object + properties: + id: + type: integer + description: ID of the list + format: int64 + example: 23 + name: + type: string + description: Name of the list + example: Magento Customers - EN + totalBlacklisted: + type: integer + description: Number of blacklisted contacts in the list + format: int64 + example: 13 + totalSubscribers: + type: integer + description: Number of contacts in the list + format: int64 + example: 1776 + uniqueSubscribers: + type: integer + description: Number of unique contacts in the list + format: int64 + example: 1789 + getExtendedList: + allOf: + - $ref: '#/components/schemas/getList' + - required: + - createdAt + - folderId + type: object + properties: + folderId: + type: integer + description: ID of the folder + format: int64 + example: 2 + createdAt: + type: string + description: Creation UTC date-time of the list (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-03-13T17:05:09Z + campaignStats: + type: array + items: + required: + - campaignId + - stats + type: object + properties: + campaignId: + type: integer + description: ID of the campaign + format: int64 + example: 143 + stats: + $ref: '#/components/schemas/getCampaignStats' + dynamicList: + type: boolean + description: Status telling if the list is dynamic or not (true=dynamic, + false=not dynamic) + example: false + getSmsCampaignStats: + required: + - answered + - delivered + - hardBounces + - processing + - sent + - softBounces + - unsubscriptions + type: object + properties: + delivered: + type: integer + description: Number of delivered SMS + format: int64 + example: 2987 + sent: + type: integer + description: Number of sent SMS + format: int64 + example: 3000 + processing: + type: integer + description: Number of processing SMS + format: int64 + example: 0 + softBounces: + type: integer + description: Number of softbounced SMS + format: int64 + example: 3 + hardBounces: + type: integer + description: Number of hardbounced SMS + format: int64 + example: 1 + unsubscriptions: + type: integer + description: Number of unsubscription SMS + format: int64 + example: 3 + answered: + type: integer + description: Number of replies to the SMS + format: int64 + example: 2 + getDeviceBrowserStats: + required: + - clickers + - uniqueClicks + - uniqueViews + - viewed + type: object + properties: + clickers: + type: integer + description: Number of total clicks for the campaign using the particular + browser + format: int64 + example: 2665 + uniqueClicks: + type: integer + description: Number of unique clicks for the campaign using the particular + browser + format: int64 + example: 2300 + viewed: + type: integer + description: Number of openings for the campaign using the particular browser + format: int64 + example: 8999 + uniqueViews: + type: integer + description: Number of unique openings for the campaign using the particular + browser + format: int64 + example: 7779 + getCampaignStats: + required: + - clickers + - complaints + - delivered + - hardBounces + - sent + - softBounces + - uniqueClicks + - uniqueViews + - unsubscriptions + - viewed + - trackableViews + type: object + properties: + listId: + type: integer + description: List Id of email campaign (only in case of get email campaign(s)(not + for global stats)) + format: int64 + example: 2 + uniqueClicks: + type: integer + description: Number of unique clicks for the campaign + format: int64 + example: 2300 + clickers: + type: integer + description: Number of total clicks for the campaign + format: int64 + example: 2665 + complaints: + type: integer + description: Number of complaints (Spam reports) for the campaign + format: int64 + example: 1 + delivered: + type: integer + description: Number of delivered emails for the campaign + format: int64 + example: 19765 + sent: + type: integer + description: Number of sent emails for the campaign + format: int64 + example: 19887 + softBounces: + type: integer + description: Number of softbounce for the campaign + format: int64 + example: 100 + hardBounces: + type: integer + description: Number of harbounce for the campaign + format: int64 + example: 87 + uniqueViews: + type: integer + description: Number of unique openings for the campaign + format: int64 + example: 7779 + trackableViews: + type: integer + description: Recipients without any privacy protection option enabled in their email client + format: int64 + example: 5661 + trackableViewsRate: + type: number + description: Rate of recipients without any privacy protection option enabled in their email client + format: float + example: 23.45 + estimatedViews: + type: integer + description: Rate of recipients without any privacy protection option enabled in their email client, applied to all delivered emails + format: int64 + example: 560 + unsubscriptions: + type: integer + description: Number of unsubscription for the campaign + format: int64 + example: 2 + viewed: + type: integer + description: Number of openings for the campaign + format: int64 + example: 8999 + deferred: + type: integer + description: Number of deferred emails for the campaign + format: int64 + example: 30 + returnBounce: + type: integer + description: Total number of non-delivered campaigns for a particular campaign + id. + format: int64 + example: 5 + updateSmtpTemplate: + type: object + properties: + tag: + type: string + description: Tag of the template + example: OrderConfirmation + sender: + type: object + properties: + name: + type: string + description: Name of the sender + example: Mary from MyShop + email: + type: string + description: Email of the sender + format: email + example: contact@myshop.com + id: + type: integer + description: | + Select the sender for the template on the basis of sender id. + _In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email)_. + format: int64 + example: 3 + description: | + Sender details including id or email and name (_optional_). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example: + **{"name":"xyz", "email":"example@abc.com"}** + **{"name":"xyz", "id":123}** + templateName: + type: string + description: Name of the template + example: Order Confirmation - EN + htmlContent: + type: string + description: | + **Required if htmlUrl is empty**. If the template is designed using Drag & Drop editor via HTML content, then the design page will not have Drag & Drop editor access for that template. Body of the message (HTML must have more than 10 characters) + example: The order n°xxxxx has been confirmed. Thanks for your purchase + htmlUrl: + type: string + description: | + **Required if htmlContent is empty**. URL to the body of the email (HTML) + format: url + example: https://html.domain.com + subject: + type: string + description: Subject of the email + example: Thanks for your purchase ! + replyTo: + type: string + description: Email on which campaign recipients will be able to reply to + format: email + example: support@myshop.com + toField: + type: string + description: | + To personalize the **To** Field. If you want to include the first name and last name of your recipient, add **{FNAME} {LNAME}**. These contact attributes must already exist in your Brevo account. If input parameter **params** used please use **{{contact.FNAME}} {{contact.LNAME}}** for personalization + example: '{FNAME} {LNAME}' + attachmentUrl: + type: string + description: | + Absolute url of the attachment (**no local file**). Extensions 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 + format: url + example: https://attachment.domain.com + isActive: + type: boolean + description: Status of the template. isActive = false means template is + inactive, isActive = true means template is active + example: true + updateCampaignStatus: + type: object + properties: + status: + type: string + description: | + Note:- **replicateTemplate** status will be available **only for template type campaigns.** + enum: + - suspended + - archive + - darchive + - sent + - queued + - replicate + - replicateTemplate + - draft + description: Status of the campaign + example: draft + createSmtpTemplate: + required: + - sender + - subject + - templateName + type: object + properties: + tag: + type: string + description: Tag of the template + example: OrderConfirmation + sender: + type: object + properties: + name: + type: string + description: | + Name of the sender. **If not passed, will be set to default** + example: Mary from MyShop + email: + type: string + description: Email of the sender + format: email + example: contact@myshop.com + id: + type: integer + description: | + Select the sender for the template on the basis of sender id. + _In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email)_. + format: int64 + example: 3 + description: | + Sender details including id or email and name (_optional_). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example: + **{"name":"xyz", "email":"example@abc.com"}** + **{"name":"xyz", "id":123}** + templateName: + type: string + description: Name of the template + example: Order Confirmation - EN + htmlContent: + type: string + description: | + Body of the message (HTML version). The field must have more than 10 characters. **REQUIRED if htmlUrl is empty** + example: The order n°xxxxx has been confirmed. Thanks for your purchase + htmlUrl: + type: string + description: Url which contents the body of the email message. REQUIRED + if htmlContent is empty + format: url + example: https://html.domain.com + subject: + type: string + description: Subject of the template + example: Thanks for your purchase ! + replyTo: + type: string + description: Email on which campaign recipients will be able to reply to + format: email + example: support@myshop.com + toField: + type: string + description: | + To personalize the **To** Field. If you want to include the first name and last name of your recipient, add **{FNAME} {LNAME}**. These contact attributes must already exist in your Brevo account. If input parameter **params** used please use **{{contact.FNAME}} {{contact.LNAME}}** for personalization + example: '{FNAME} {LNAME}' + attachmentUrl: + type: string + description: | + 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' + format: url + example: https://attachment.domain.com + isActive: + type: boolean + description: Status of template. isActive = true means template is active + and isActive = false means template is inactive + example: true + createEmailCampaign: + required: + - name + - sender + type: object + properties: + tag: + type: string + description: Tag of the campaign + example: Newsletter + sender: + type: object + properties: + name: + type: string + description: Sender Name + example: Mary from MyShop + email: + type: string + description: Sender email + format: email + example: newsletter@myshop.com + id: + type: integer + description: | + Select the sender for the campaign on the basis of sender id. + _In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email)_. + format: int64 + example: 3 + description: | + Sender details including id or email and name (_optional_). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example: + **{"name":"xyz", "email":"example@abc.com"}** + **{"name":"xyz", "id":123}** + name: + type: string + description: Name of the campaign + example: Newsletter - May 2017 + htmlContent: + type: string + description: | + Mandatory if htmlUrl and templateId are empty. Body of the message (HTML). + example: '

Confirm you email

Please confirm your email address by clicking on the link below

' + htmlUrl: + type: string + description: | + **Mandatory if htmlContent and templateId are empty**. Url to the message (HTML). For example: + **https://html.domain.com** + format: url + example: https://html.domain.com + templateId: + type: integer + description: | + **Mandatory if htmlContent and htmlUrl are empty**. Id of the transactional + email template with status _active_. Used to copy only its content fetched + from htmlContent/htmlUrl to an email campaign for RSS feature. + format: int64 + scheduledAt: + type: string + description: | + Sending UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result**. + If sendAtBestTime is set to true, your campaign will be sent according to the date passed (ignoring the time part). For example: + **2017-06-01T12:30:00+02:00** + example: 2017-06-01T12:30:00+02:00 + subject: + type: string + description: | + Subject of the campaign. **Mandatory if abTesting is false**. + Ignored if abTesting is true. + example: Discover the New Collection ! + previewText: + type: string + description : Preview text or preheader of the email campaign + example: Thanks for your order! + replyTo: + type: string + description: Email on which the campaign recipients will be able to reply + to + format: email + example: support@myshop.com + toField: + type: string + description: | + To personalize the **To** Field. If you want to include the first name and last name of your recipient, add **{FNAME} {LNAME}**. These contact attributes must already exist in your Brevo account. If input parameter **params** used please use **{{contact.FNAME}} {{contact.LNAME}}** for personalization + example: '{FNAME} {LNAME}' + recipients: + type: object + properties: + exclusionListIds: + type: array + description: List ids to exclude from the campaign + items: + type: integer + format: int64 + example: 8 + listIds: + type: array + description: | + **Mandatory if scheduledAt is not empty**. List Ids to send the campaign to + items: + type: integer + format: int64 + example: 32 + segmentIds: + description: | + **Mandatory if listIds are not used**. Segment ids to send the campaign to. + type: array + items: + type: integer + format: int64 + example: 23 + description: Segment ids and List ids to include/exclude from campaign + attachmentUrl: + type: string + description: | + 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 + format: url + example: https://attachment.domain.com + inlineImageActivation: + type: boolean + description: | + 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_ + example: true + default: false + mirrorActive: + type: boolean + description: Use true to enable the mirror link + example: true + footer: + type: string + description: Footer of the email campaign + example: '[DEFAULT_FOOTER]' + header: + type: string + description: Header of the email campaign + example: '[DEFAULT_HEADER]' + utmCampaign: + type: string + description: Customize the utm_campaign value. If this field is empty, the + campaign name will be used. Only alphanumeric characters and spaces are + allowed + example: NL_05_2017 + params: + type: object + additionalProperties: {} + description: | + Pass the set of attributes to customize the type classic campaign. For example: **{"FNAME":"Joe", "LNAME":"Doe"}**. Only available if **type** is **classic**. It's considered only if campaign is in _New Template Language format_. The New Template Language is dependent on the values of **subject, htmlContent/htmlUrl, sender.name & toField** + example: + FNAME: Joe + LNAME: Doe + sendAtBestTime: + type: boolean + description: Set this to true if you want to send your campaign at best time. + example: true + default: false + abTesting: + type: boolean + description: | + Status of A/B Test. abTesting = false means it is disabled & abTesting = true means it is enabled. **subjectA, subjectB, splitRule, winnerCriteria & winnerDelay** will be considered when abTesting is set to true. + subjectA & subjectB are mandatory together & subject if passed is ignored. **Can be set to true only if sendAtBestTime is false**. + You will be able to set up two subject lines for your campaign and send them to a random sample of your total recipients. Half of the test group will receive version A, and the other half will receive version B + example: true + default: false + subjectA: + type: string + description: | + Subject A of the campaign. **Mandatory if abTesting = true**. + subjectA & subjectB should have unique value + example: Discover the New Collection! + subjectB: + type: string + description: | + Subject B of the campaign. **Mandatory if abTesting = true**. + subjectA & subjectB should have unique value + example: Want to discover the New Collection? + splitRule: + maximum: 5E+1 + minimum: 1 + type: integer + description: | + Add the size of your test groups. **Mandatory if abTesting = true & 'recipients' is passed**. We'll send version A and B to a random sample of recipients, and then the winning version to everyone else + format: int64 + example: 50 + winnerCriteria: + type: string + description: | + Choose the metrics that will determinate the winning version. **Mandatory if _splitRule_ >= 1 and < 50**. If splitRule = 50, `winnerCriteria` is ignored if passed + example: open + enum: + - open + - click + winnerDelay: + maximum: 168 + minimum: 1 + type: integer + description: | + Choose the duration of the test in hours. Maximum is 7 days, pass 24*7 = 168 hours. The winning version will be sent at the end of the test. **Mandatory if _splitRule_ >= 1 and < 50**. If splitRule = 50, `winnerDelay` is ignored if passed + format: int64 + example: 50 + ipWarmupEnable: + type: boolean + description: | + **Available for dedicated ip clients**. Set this to true if you wish to warm up your ip. + example: true + default: false + initialQuota: + type: integer + description: | + **Mandatory if ipWarmupEnable is set to true**. Set an initial quota greater than 1 for warming up your ip. We recommend you set a value of 3000. + format: int64 + example: 3000 + increaseRate: + maximum: 1E+2 + minimum: 0 + type: integer + description: | + **Mandatory if ipWarmupEnable is set to true**. Set a percentage increase rate for warming up your ip. We recommend you set the increase rate to 30% per day. If you want to send the same number of emails every day, set the daily increase value to 0%. + format: int64 + example: 70 + unsubscriptionPageId: + description: | + Enter an unsubscription page id. The page id is a 24 digit alphanumeric id that can be found in the URL when editing the page. If not entered, then the default unsubscription page will be used. + type: string + example: "62cbb7fabbe85021021aac52" + updateFormId: + description: | + **Mandatory if templateId is used containing the {{ update_profile }} tag**. Enter an update profile form id. The form id is a 24 digit alphanumeric id that can be found in the URL when editing the form. If not entered, then the default update profile form will be used. + type: string + example: "6313436b9ad40e23b371d095" + emailExpirationDate: + type: object + description: To reduce your carbon footprint, set an expiration date for your email. If supported, it will be automatically deleted from the recipient’s inbox, saving storage space and energy. Learn more about setting an email expiration date. + For reference , ``https://help.brevo.com/hc/en-us/articles/4413566705298-Create-an-email-campaign`` + properties: + duration: + type: integer + format: int64 + description: Duration of the email expiry. maximum duration can be 3600 days or 480 weeks or 120 months. + example: 30 + minimum: 1 + maximum: 3600 + unit: + type: string + description: unit of the duration + example: weeks + enum: + - days + - weeks + - months + + updateEmailCampaign: + type: object + properties: + tag: + type: string + description: Tag of the campaign + example: Newsletter + sender: + type: object + properties: + name: + type: string + description: Sender Name from which the campaign emails are sent + example: Mary from MyShop + email: + type: string + description: Sender email from which the campaign emails are sent + format: email + example: newsletter@myshop.com + id: + type: integer + description: | + Select the sender for the campaign on the basis of sender id. **In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email)**. + format: int64 + example: 3 + description: | + Sender details including id or email and name (optional). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example: + **{"name":"xyz", "email":"example@abc.com"}** + **{"name":"xyz", "id":123}** + name: + type: string + description: Name of the campaign + example: Newsletter - May 2017 + htmlContent: + type: string + description: | + Body of the message (HTML version). If the campaign is designed using Drag & Drop editor via HTML content, then the design page will not have Drag & Drop editor access for that campaign. **REQUIRED if htmlUrl is empty** + example: '

Confirm you email

Please confirm your email address by clicking on the link below

' + htmlUrl: + type: string + description: | + Url which contents the body of the email message. **REQUIRED if htmlContent is empty** + format: url + example: https://html.domain.com + scheduledAt: + type: string + description: | + 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.** + If sendAtBestTime is set to true, your campaign will be sent according + to the date passed (ignoring the time part). + example: 2017-06-01T12:30:00+02:00 + subject: + type: string + description: Subject of the campaign + example: Discover the New Collection ! + previewText: + type: string + description : Preview text or preheader of the email campaign + example: Thanks for your order! + replyTo: + type: string + description: Email on which campaign recipients will be able to reply to + format: email + example: support@myshop.com + toField: + type: string + description: | + To personalize the **To** Field. If you want to include the first + name and last name of your recipient, add **{FNAME} {LNAME}**. These contact + attributes must already exist in your Brevo account. If input parameter + **params** used please use **{{contact.FNAME}} {{contact.LNAME}}** for personalization + example: '{FNAME} {LNAME}' + recipients: + type: object + properties: + exclusionListIds: + type: array + description: List ids which have to be excluded from a campaign + items: + type: integer + format: int64 + example: 8 + listIds: + type: array + description: | + Lists Ids to send the campaign to. **Campaign should only be updated with listIds if listIds were used to create it. REQUIRED if already not present in campaign and scheduledAt is not empty** + items: + type: integer + format: int64 + example: 32 + segmentIds: + description: | + **Mandatory if listIds are not used. Campaign should only be updated with segmentIds if segmentIds were used to create it.** Segment ids to send the campaign to. + type: array + items: + type: integer + format: int64 + example: 23 + description: Segment ids and List ids to include/exclude from campaign + attachmentUrl: + type: string + description: | + 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' + format: url + example: https://attachment.domain.com + inlineImageActivation: + type: boolean + description: | + 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_. + example: true + default: false + mirrorActive: + type: boolean + description: Status of mirror links in campaign. mirrorActive = false means + mirror links are deactivated, & mirrorActive = true means mirror links + are activated, in the campaign + example: true + recurring: + type: boolean + description: | + **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 + example: false + default: false + footer: + type: string + description: Footer of the email campaign + example: '[DEFAULT_FOOTER]' + header: + type: string + description: Header of the email campaign + example: '[DEFAULT_HEADER]' + utmCampaign: + type: string + description: Customize the utm_campaign value. If this field is empty, the + campaign name will be used. Only alphanumeric characters and spaces are + allowed + example: NL_05_2017 + params: + type: object + additionalProperties: {} + description: | + Pass the set of attributes to customize the type classic campaign. For example: **{"FNAME":"Joe", "LNAME":"Doe"}**. Only available if **type** is **classic**. It's considered only if campaign is in _New Template Language format_. The New Template Language is dependent on the values of **subject, htmlContent/htmlUrl, sender.name & toField** + example: + FNAME: Joe + LNAME: Doe + sendAtBestTime: + type: boolean + description: | + Set this to true if you want to send your campaign at best time. + Note:- **if true, warmup ip will be disabled.** + example: true + abTesting: + type: boolean + description: | + Status of A/B Test. abTesting = false means it is disabled & abTesting = true means it is enabled. **subjectA, subjectB, splitRule, winnerCriteria & winnerDelay** will be considered when abTesting is set to true. + subjectA & subjectB are mandatory together & subject if passed is ignored. **Can be set to true only if sendAtBestTime is false**. + You will be able to set up two subject lines for your campaign and send them to a random sample of your total recipients. Half of the test group will receive version A, and the other half will receive version B + example: true + default: false + subjectA: + type: string + description: | + Subject A of the campaign. **Mandatory if abTesting = true**. + subjectA & subjectB should have unique value + example: Discover the New Collection! + subjectB: + type: string + description: | + Subject B of the campaign. **Mandatory if abTesting = true**. + subjectA & subjectB should have unique value + example: Want to discover the New Collection? + splitRule: + maximum: 5E+1 + minimum: 1 + type: integer + description: | + Add the size of your test groups. **Mandatory if abTesting = true & 'recipients' is passed**. We'll send version A and B to a random sample of recipients, and then the winning version to everyone else + format: int64 + example: 50 + winnerCriteria: + type: string + description: | + Choose the metrics that will determinate the winning version. **Mandatory if _splitRule_ >= 1 and < 50**. If splitRule = 50, `winnerCriteria` is ignored if passed + example: open + enum: + - open + - click + winnerDelay: + maximum: 168 + minimum: 1 + type: integer + description: | + Choose the duration of the test in hours. Maximum is 7 days, pass 24*7 = 168 hours. The winning version will be sent at the end of the test. **Mandatory if _splitRule_ >= 1 and < 50**. If splitRule = 50, `winnerDelay` is ignored if passed + format: int64 + example: 50 + ipWarmupEnable: + type: boolean + description: | + **Available for dedicated ip clients**. Set this to true if you wish to warm up your ip. + example: true + default: false + initialQuota: + type: integer + description: | + Set an initial quota greater than 1 for warming up your ip. We recommend you set a value of 3000. + format: int64 + example: 3000 + increaseRate: + maximum: 1E+2 + minimum: 0 + type: integer + description: | + Set a percentage increase rate for warming up your ip. We recommend you set the increase rate to 30% per day. If you want to send the same number of emails every day, set the daily increase value to 0%. + format: int64 + example: 70 + unsubscriptionPageId: + description: | + Enter an unsubscription page id. The page id is a 24 digit alphanumeric id that can be found in the URL when editing the page. + type: string + example: "62cbb7fabbe85021021aac52" + updateFormId: + description: | + **Mandatory if templateId is used containing the {{ update_profile }} tag**. Enter an update profile form id. The form id is a 24 digit alphanumeric id that can be found in the URL when editing the form. + type: string + example: "6313436b9ad40e23b371d095" + emailExpirationDate: + type: object + description: To reduce your carbon footprint, set an expiration date for your email. If supported, it will be automatically deleted from the recipient’s inbox, saving storage space and energy. + properties: + duration: + type: integer + format: int64 + description: Duration of the email expiry. maximum duration can be 3600 days or 480 weeks or 120 months. + example: 30 + minimum: 1 + maximum: 3600 + unit: + type: string + description: unit of the duration + example: weeks + enum: + - days + - weeks + - months + getSharedTemplateUrl: + required: + - sharedUrl + type: object + properties: + sharedUrl: + type: string + description: A unique URL for the email campaign or transactional template. + This URL can be shared with other Brevo users. + format: url + example: https://my.brevo.com/pt2YU7R5W_guXlowgumy_VX4pFsKu._zd0Gjj96x1_GMmzc1Qps5ZIpj6nx- + abTestCampaignResult: + type: object + properties: + winningVersion: + type: string + description: Winning Campaign Info. pending = Campaign has been picked for + sending and winning version is yet to be decided, tie = A tie happened + between both the versions, notAvailable = Campaign has not yet been picked + for sending. + example: A + enum: + - notAvailable + - pending + - tie + - A + - B + winningCriteria: + type: string + description: Criteria choosen for winning version (Open/Click) + example: Open + enum: + - Open + - Click + winningSubjectLine: + type: string + description: Subject Line of current winning version + example: Subject Line A + openRate: + type: string + description: Open rate for current winning version + example: 70% + clickRate: + type: string + description: Click rate for current winning version + example: 70% + winningVersionRate: + type: string + description: Open/Click rate for the winner version + example: 70% + statistics: + required: + - clicks + - complaints + - hardBounces + - openers + - softBounces + - unsubscribed + type: object + properties: + openers: + $ref: '#/components/schemas/abTestVersionStats' + clicks: + $ref: '#/components/schemas/abTestVersionStats' + unsubscribed: + $ref: '#/components/schemas/abTestVersionStats' + hardBounces: + $ref: '#/components/schemas/abTestVersionStats' + softBounces: + $ref: '#/components/schemas/abTestVersionStats' + complaints: + $ref: '#/components/schemas/abTestVersionStats' + clickedLinks: + required: + - Version A + - Version B + type: object + properties: + Version A: + $ref: '#/components/schemas/abTestVersionClicks' + Version B: + $ref: '#/components/schemas/abTestVersionClicks' + emailExportRecipients: + required: + - recipientsType + type: object + properties: + notifyURL: + type: string + description: Webhook called once the export process is finished. For reference, + https://help.brevo.com/hc/en-us/articles/360007666479 + format: url + example: http://requestb.in/173lyyx1 + recipientsType: + type: string + description: Type of recipients to export for a campaign + example: openers + enum: + - all + - nonClickers + - nonOpeners + - clickers + - openers + - softBounces + - hardBounces + - unsubscribed + requestSmsRecipientExport: + required: + - recipientsType + type: object + properties: + notifyURL: + type: string + description: URL that will be called once the export process is finished. + For reference, https://help.brevo.com/hc/en-us/articles/360007666479 + format: url + example: http://requestb.in/173lyyx1 + recipientsType: + type: string + description: Filter the recipients based on how they interacted with the + campaign + example: answered + enum: + - all + - delivered + - answered + - softBounces + - hardBounces + - unsubscribed + sendReport: + required: + - email + type: object + properties: + language: + type: string + description: Language of email content for campaign report sending. + example: en + default: fr + enum: + - fr + - es + - pt + - it + - de + - en + email: + required: + - body + - to + type: object + properties: + to: + type: array + description: Email addresses of the recipients + items: + type: string + description: Email address of the recipient + format: email + example: jim.suehan@example.com + body: + type: string + description: Custom text message to be presented in the report email. + example: Please find attached the report of our last email campaign. + description: Custom attributes for the report email. + uploadImageToGallery: + required: + - imageUrl + type: object + properties: + imageUrl: + type: string + description: | + The absolute url of the image (**no local file**). Maximum allowed size for image is **2MB**. + Allowed extensions for images are: + #### jpeg, jpg, png, bmp, gif. + example: https://somedomain.com/image1.jpg + name: + type: string + description: Name of the image. + example: nature.jpg + sendSmtpEmail: + type: object + properties: + sender: + description: | + **Mandatory if `templateId` is not passed**. Pass name (_optional_) and email or id of sender from which emails will be sent. **`name` will be ignored if passed along with sender `id`**. For example, + **{"name":"Mary from MyShop", "email":"no-reply@myshop.com"}** + **{"id":2}** + type: object + properties: + name: + type: string + description: | + description: Name of the sender from which the emails will be sent. **Maximum allowed characters are 70**. Applicable only when email is passed. + example: Mary from MyShop + email: + type: string + description: Email of the sender from which the emails will be sent. Mandatory if sender id is not passed. + format: email + example: no-reply@myshop.com + id: + type: integer + description: Id of the sender from which the emails will be sent. In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email). Mandatory if email is not passed. + format: int64 + example: 2 + to: + type: array + description: | + **Mandatory if messageVersions are not passed, ignored if messageVersions are passed** + List of email addresses and names (_optional_) of the recipients. For example, + **[{"name":"Jimmy", "email":"jimmy98@example.com"}, {"name":"Joe", "email":"joe@example.com"}]** + items: + required: + - email + type: object + properties: + email: + type: string + description: Email address of the recipient + format: email + example: jimmy98@example.com + name: + type: string + description: | + Name of the recipient. **Maximum allowed characters are 70**. + example: Jimmy + bcc: + type: array + description: | + List of email addresses and names (_optional_) of the recipients in bcc + items: + required: + - email + type: object + properties: + email: + type: string + description: Email address of the recipient in bcc + format: email + example: helen9766@example.com + name: + type: string + description: | + Name of the recipient in bcc. **Maximum allowed characters are 70**. + example: Helen + cc: + type: array + description: | + List of email addresses and names (_optional_) of the recipients in cc + items: + required: + - email + type: object + properties: + email: + type: string + description: Email address of the recipient in cc + format: email + example: ann6533@example.com + name: + type: string + description: | + Name of the recipient in cc. **Maximum allowed characters are 70**. + example: Ann + htmlContent: + type: string + description: | + HTML body of the message. **Mandatory if 'templateId' is not passed, ignored if 'templateId' is passed** + example:

Confirm you email

Please + confirm your email address by clicking on the link below

+ textContent: + type: string + description: | + Plain Text body of the message. **Ignored if 'templateId' is passed** + example: Please confirm your email address by clicking on the link https://text.domain.com + subject: + type: string + description: | + Subject of the message. **Mandatory if 'templateId' is not passed** + example: Login Email confirmation + replyTo: + required: + - email + type: object + properties: + email: + type: string + description: Email address in reply to + format: email + example: ann6533@example.com + name: + type: string + description: | + Name in reply to. **Maximum allowed characters are 70**. + example: Ann + 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"}** + attachment: + type: array + description: | + 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":"myAttachmentFromUrl.jpg"}, {"content":"base64 example content", "name":"myAttachmentFromBase64.jpg"}]**. + 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, eps, odt, mp3, m4a, m4v, wma, ogg, flac, wav, aif, aifc, aiff, mp4, mov, avi, mkv, mpeg, mpg, wmv, pkpass and xlsm. + If `templateId` is passed and is in New Template Language format then both attachment url and content are accepted. If template is in Old template Language format, then `attachment` is ignored + items: + type: object + properties: + url: + type: string + description: | + Absolute url of the attachment (**no local file**). + format: url + example: https://attachment.domain.com/myAttachmentFromUrl.jpg + content: + pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$ + type: string + description: Base64 encoded chunk data of the attachment generated + on the fly + format: byte + example: b3JkZXIucGRm + name: + type: string + description: | + **Required if content is passed**. Name of the attachment + example: myAttachment.png + headers: + type: object + additionalProperties: {} + description: | + Pass the set of custom headers (_not the standard headers_) that shall be sent along the mail headers in the original email. **'sender.ip'** header can be set (**only for dedicated ip users**) to mention the IP to be used for sending transactional emails. Headers are allowed in `This-Case-Only` (i.e. words separated by hyphen with first letter of each word in capital letter), they will be converted to such case styling if not in this format in the request payload. For example, + **{"sender.ip":"1.2.3.4", "X-Mailin-custom":"some_custom_header", "idempotencyKey":"abc-123"}**. + example: + sender.ip: 1.2.3.4 + X-Mailin-custom: some_custom_header + idempotencyKey: abc-123 + templateId: + type: integer + description: Id of the template. + format: int64 + example: 2 + params: + type: object + additionalProperties: {} + description: | + Pass the set of attributes to customize the template. For example, **{"FNAME":"Joe", "LNAME":"Doe"}**. It's **considered only if template is in New Template Language format**. + example: + FNAME: Joe + LNAME: Doe + messageVersions: + type: array + description: | + You can customize and send out multiple versions of a mail. **templateId** can be customized only if global parameter contains templateId. **htmlContent and textContent** can be customized only if any of the two, htmlContent or textContent, is present in global parameters. Some global parameters such as **to(mandatory), bcc, cc, replyTo, subject** can also be customized specific to each version. + Total number of recipients in one API request must not exceed 2000. However, you can still pass upto 99 recipients maximum in one message version. + The size of individual params in all the messageVersions shall not exceed **100 KB** limit and that of cumulative params shall not exceed **1000 KB**. + You can follow this **step-by-step guide** on how to use **messageVersions** to batch send emails - **https://developers.brevo.com/docs/batch-send-transactional-emails** + items: + type: object + required: + - to + properties: + to: + type: array + description: | + List of email addresses and names (_optional_) of the recipients. For example, + **[{"name":"Jimmy", "email":"jimmy98@example.com"}, {"name":"Joe", "email":"joe@example.com"}]** + items: + required: + - email + type: object + properties: + email: + type: string + description: Email address of the recipient + format: email + example: jimmy98@example.com + name: + type: string + description: | + Name of the recipient. **Maximum allowed characters are 70**. + example: Jimmy + params: + type: object + additionalProperties: {} + description: | + Pass the set of attributes to customize the template. For example, **{"FNAME":"Joe", "LNAME":"Doe"}**. It's **considered only if template is in New Template Language format**. + example: + FNAME: Joe + LNAME: Doe + bcc: + type: array + description: | + List of email addresses and names (_optional_) of the recipients in bcc + items: + required: + - email + type: object + properties: + email: + type: string + description: Email address of the recipient in bcc + format: email + example: helen9766@example.com + name: + type: string + description: | + Name of the recipient in bcc. **Maximum allowed characters are 70**. + example: Helen + cc: + type: array + description: | + List of email addresses and names (_optional_) of the recipients in cc + items: + required: + - email + type: object + properties: + email: + type: string + description: Email address of the recipient in cc + format: email + example: ann6533@example.com + name: + type: string + description: | + Name of the recipient in cc. **Maximum allowed characters are 70**. + example: Ann + replyTo: + required: + - email + type: object + properties: + email: + type: string + description: Email address in reply to + format: email + example: ann6533@example.com + name: + type: string + description: | + Name in reply to. **Maximum allowed characters are 70**. + example: Ann + 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"}** + subject: + type: string + description: | + Custom subject specific to message version + example: Login Email confirmation + htmlContent: + type: string + description: | + HTML body of the message. **Mandatory if 'templateId' is not passed, ignored if 'templateId' is passed** + example:

Confirm you email

Please + confirm your email address by clicking on the link below

+ textContent: + type: string + description: | + Plain Text body of the message. **Ignored if 'templateId' is passed** + example: Please confirm your email address by clicking on the link https://text.domain.com + tags: + type: array + description: Tag your emails to find them more easily + items: + type: string + example: tag1 + scheduledAt: + type: string + description: UTC date-time on which the email has to schedule (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for scheduling. There can be an expected delay of +5 minutes in scheduled email delivery. + format: date-time + example: '2022-04-05T12:30:00+02:00' + batchId: + type: string + description: Valid UUIDv4 batch id to identify the scheduled batches transactional email. If not passed we will create a valid UUIDv4 batch id at our end. + example: '5c6cfa04-eed9-42c2-8b5c-6d470d978e9d' + deleteHardbounces: + type: object + properties: + startDate: + type: string + description: 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 + example: 2016-12-31 + endDate: + type: string + description: 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 + example: 2017-01-31 + contactEmail: + type: string + description: Target a specific email address + format: email + example: alex76@example.com + blockDomain: + type: object + required: + - domain + properties: + domain: + type: string + description: name of the domain to be blocked + example: "example.com" + createWebhook: + required: + - events + - url + type: object + properties: + url: + type: string + description: URL of the webhook + format: url + example: http://requestb.in/173lyyx1 + description: + type: string + description: Description of the webhook + example: Webhook triggered on unsubscription + events: + type: array + description: | + - Events triggering the webhook. Possible values for **Transactional** type webhook: + #### `sent` OR `request`, `delivered`, `hardBounce`, `softBounce`, `blocked`, `spam`, `invalid`, `deferred`, `click`, `opened`, `uniqueOpened` and `unsubscribed` + - Possible values for **Marketing** type webhook: + #### `spam`, `opened`, `click`, `hardBounce`, `softBounce`, `unsubscribed`, `listAddition` & `delivered` + - Possible values for **Inbound** type webhook: + #### `inboundEmailProcessed` + items: + type: string + example: unsubscribed + enum: + - sent + - hardBounce + - softBounce + - blocked + - spam + - delivered + - request + - click + - invalid + - deferred + - opened + - uniqueOpened + - unsubscribed + - listAddition + - contactUpdated + - contactDeleted + - inboundEmailProcessed + type: + type: string + description: Type of the webhook + example: marketing + default: transactional + enum: + - transactional + - marketing + - inbound + domain: + type: string + description: Inbound domain of webhook, required in case of event type `inbound` + example: example.com + batched: + type: boolean + description: Batching configuration of the webhook, we send batched webhooks if its true + example: true + auth: + type: object + description: Authentication header to be send with the webhook requests + example: + type: bearer + token: test-auth-token1234 + headers: + type: array + items: + type: object + description: Headers send with the requests to the webhook + example: + key: cf-secret + value: test-header-value + updateWebhook: + type: object + properties: + url: + type: string + description: URL of the webhook + format: url + example: http://requestb.in/173lyyx1 + description: + type: string + description: Description of the webhook + example: Webhook triggered on contact hardbounce + events: + type: array + description: | + - Events triggering the webhook. Possible values for **Transactional** type webhook: + #### `sent` OR `request`, `delivered`, `hardBounce`, `softBounce`, `blocked`, `spam`, `invalid`, `deferred`, `click`, `opened`, `uniqueOpened` and `unsubscribed` + - Possible values for **Marketing** type webhook: + #### `spam`, `opened`, `click`, `hardBounce`, `softBounce`, `unsubscribed`, `listAddition` & `delivered` + - Possible values for **Inbound** type webhook: + #### `inboundEmailProcessed` + items: + type: string + example: hardBounce + enum: + - sent + - hardBounce + - softBounce + - blocked + - spam + - delivered + - request + - click + - invalid + - deferred + - opened + - uniqueOpened + - unsubscribed + - listAddition + - contactUpdated + - contactDeleted + - inboundEmailProcessed + domain: + type: string + description: Inbound domain of webhook, used in case of event type `inbound` + example: example.com + batched: + type: boolean + description: Batching configuration of the webhook, we send batched webhooks if its true + example: true + auth: + type: object + description: Authentication header to be send with the webhook requests + example: + type: bearer + token: test-auth-token1234 + headers: + type: array + items: + type: object + description: Headers send with the requests to the webhook + example: + key: cf-secret + value: test-header-value + createDoiContact: + required: + - email + - includeListIds + - redirectionUrl + - templateId + type: object + properties: + email: + type: string + description: Email address where the confirmation email will be sent. This + email address will be the identifier for all other contact attributes. + format: email + example: elly@example.com + attributes: + type: object + additionalProperties: + oneOf: + - type: number + - type: string + - type: boolean + - type: array + items: + type: string + description: | + Pass the set of attributes and their values. **These attributes must be present in your Brevo account**. For eg. **{'FNAME':'Elly', 'LNAME':'Roger', 'COUNTRIES':['India','China']}** + example: + FNAME: Elly + LNAME: Roger + COUNTRIES: [India,China] + includeListIds: + type: array + description: Lists under user account where contact should be added + items: + type: integer + description: Id of the list + format: int64 + example: 36 + excludeListIds: + type: array + description: Lists under user account where contact should not be added + items: + type: integer + description: Id of the list + format: int64 + example: 36 + templateId: + type: integer + description: Id of the Double opt-in (DOI) template + format: int64 + example: 2 + redirectionUrl: + type: string + description: | + URL of the web page that user will be redirected to after clicking on the double opt in URL. When editing your DOI template you can reference this URL by using the tag **{{ params.DOIurl }}**. + format: url + example: http://requestb.in/173lyyx1 + createContact: + type: object + properties: + email: + type: string + description: | + Email address of the user. **Mandatory if "ext_id" & "SMS" field is not passed.** + format: email + example: elly@example.com + ext_id: + description: Pass your own Id to create a contact. + type: string + example: 'externalId' + attributes: + type: object + additionalProperties: + oneOf: + - type: number + - type: string + - type: boolean + - type: array + items: + type: string + description: | + Pass the set of attributes and their values. The attribute's parameter should be passed in capital letter while creating a contact. Values that don't match the attribute type (e.g. text or string in a date attribute) will be ignored. **These attributes must be present in your Brevo account.**. For eg: + **{"FNAME":"Elly", "LNAME":"Roger", "COUNTRIES":["India","China"]}** + example: + FNAME: Elly + LNAME: Roger + COUNTRIES: [India,China] + emailBlacklisted: + type: boolean + description: Set this field to blacklist the contact for emails (emailBlacklisted + = true) + example: false + smsBlacklisted: + type: boolean + description: Set this field to blacklist the contact for SMS (smsBlacklisted + = true) + example: false + listIds: + type: array + description: Ids of the lists to add the contact to + items: + type: integer + description: Id of the list to add the contact to + format: int64 + example: 36 + updateEnabled: + type: boolean + description: Facilitate to update the existing contact in the same request + (updateEnabled = true) + example: false + default: false + smtpBlacklistSender: + type: array + description: transactional email forbidden sender for contact. Use only + for email Contact ( only available if updateEnabled = true ) + items: + type: string + format: email + updateContact: + type: object + properties: + attributes: + type: object + additionalProperties: + oneOf: + - type: number + - type: string + - type: boolean + - type: array + items: + type: string + description: | + Pass the set of attributes to be updated. **These attributes must be present in your account**. To update existing email address of a contact with the new one please pass EMAIL in attributes. For example, **{ "EMAIL":"newemail@domain.com", "FNAME":"Ellie", "LNAME":"Roger", "COUNTRIES":["India","China"]}**. + The attribute's parameter should be passed in capital letter while updating a contact. Values that don't match the attribute type (e.g. text or string in a date attribute) will be ignored. Keep in mind transactional attributes can be updated the same way as normal attributes. Mobile Number in **SMS** field should be passed with proper country code. For example: **{"SMS":"+91xxxxxxxxxx"} or {"SMS":"0091xxxxxxxxxx"}** + example: + EMAIL: newemail@domain.com + FNAME: Ellie + LNAME: Roger + COUNTRIES: [India,China] + ext_id: + description: Pass your own Id to update ext_id of a contact. + type: string + example: 'updateExternalId' + emailBlacklisted: + type: boolean + description: Set/unset this field to blacklist/allow the contact for emails + (emailBlacklisted = true) + example: false + smsBlacklisted: + type: boolean + description: Set/unset this field to blacklist/allow the contact for SMS + (smsBlacklisted = true) + example: true + listIds: + type: array + description: Ids of the lists to add the contact to + items: + type: integer + description: Id of the list to add the contact to + format: int64 + example: 65 + unlinkListIds: + type: array + description: Ids of the lists to remove the contact from + items: + type: integer + description: Id of the list to remove the contact from + format: int64 + example: 36 + smtpBlacklistSender: + type: array + description: transactional email forbidden sender for contact. Use only + for email Contact + items: + type: string + format: email + updateBatchContacts: + type: object + properties: + contacts: + type: array + description: List of contacts to be updated + items: + type: object + properties: + email: + type: string + description: Email address of the user to be updated (For each operation only pass one of the supported contact identifiers. Email, id or sms) + format: email + example: elly@example.com + id: + type: integer + description: id of the user to be updated (For each operation only pass one of the supported contact identifiers. Email, id or sms) + format: int64 + example: 31 + sms: + type: string + description: SMS of the user to be updated (For each operation only pass one of the supported contact identifiers. Email, id or sms) + example: +91xxxxxxxxxx + ext_id: + description: Pass your own Id to update ext_id of a contact. + type: string + example: 'UpdateExternalId' + attributes: + type: object + additionalProperties: {} + description: | + Pass the set of attributes to be updated. **These attributes must be present in your account**. To update existing email address of a contact with the new one please pass EMAIL in attribtes. For example, **{ "EMAIL":"newemail@domain.com", "FNAME":"Ellie", "LNAME":"Roger"}**. + Keep in mind transactional attributes can be updated the same way as normal attributes. Mobile Number in **SMS** field should be passed with proper country code. For example: **{"SMS":"+91xxxxxxxxxx"} or {"SMS":"0091xxxxxxxxxx"}** + example: + EMAIL: newemail@domain.com + FNAME: Ellie + LNAME: Roger + emailBlacklisted: + type: boolean + description: Set/unset this field to blacklist/allow the contact for emails + (emailBlacklisted = true) + example: false + smsBlacklisted: + type: boolean + description: Set/unset this field to blacklist/allow the contact for SMS + (smsBlacklisted = true) + example: true + listIds: + type: array + description: Ids of the lists to add the contact to + items: + type: integer + description: Id of the list to add the contact to + format: int64 + example: 65 + unlinkListIds: + type: array + description: Ids of the lists to remove the contact from + items: + type: integer + description: Id of the list to remove the contact from + format: int64 + example: 36 + smtpBlacklistSender: + type: array + description: transactional email forbidden sender for contact. Use only + for email Contact + items: + type: string + format: email + createAttribute: + type: object + properties: + value: + type: string + description: | + Value of the attribute. **Use only if the attribute's category is 'calculated' or 'global'** + example: COUNT[BLACKLISTED,BLACKLISTED,<,NOW()] + isRecurring: + type: boolean + description: | + Type of the attribute. **Use only if the attribute's category is 'calculated' or 'global'** + example: true + enumeration: + type: array + description: | + 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"}]** + items: + required: + - label + - value + type: object + properties: + value: + type: integer + description: Id of the value + example: 1 + label: + type: string + description: Label of the value + example: Women + multiCategoryOptions: + type: array + description: | + List of options you want to add for multiple-choice attribute. **Use only if the attribute's category is "normal" and attribute's type is "multiple-choice".** For example: + **["USA","INDIA"]** + items: + type: string + type: + type: string + description: | + Type of the attribute. **Use only if the attribute's category is 'normal', 'category' or 'transactional'** + Type **boolean and multiple-choice** is only available if the category is **normal** attribute + Type **id** is only available if the category is **transactional** attribute + Type **category** is only available if the category is **category** attribute + example: text + enum: + - text + - date + - float + - boolean + - id + - category + - multiple-choice + updateAttribute: + type: object + properties: + value: + type: string + description: | + Value of the attribute to update. **Use only if the attribute's category is 'calculated' or 'global'** + example: COUNT[BLACKLISTED,BLACKLISTED,<,NOW()] + enumeration: + type: array + description: | + 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"}]** + items: + required: + - label + - value + type: object + properties: + value: + type: integer + description: Id of the value + example: 1 + label: + type: string + description: Label of the value + example: Men + multiCategoryOptions: + type: array + description: | + Use this option to add multiple-choice attributes options only if the attribute's category is "normal". **This option is specifically designed for updating multiple-choice attributes**. For example: + **["USA","INDIA"]** + items: + type: string + createList: + required: + - folderId + - name + type: object + properties: + name: + type: string + description: Name of the list + example: Magento Customer - ES + folderId: + type: integer + description: Id of the parent folder in which this list is to be created + format: int64 + example: 2 + updateList: + type: object + properties: + name: + type: string + description: Name of the list. Either of the two parameters (name, folderId) + can be updated at a time. + example: Magento Customer - ES + folderId: + type: integer + description: 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. + format: int64 + example: 2 + requestContactExport: + type: object + required: + - customContactFilter + properties: + exportAttributes: + type: array + description: | + List of all the attributes that you want to export. **These attributes must be present in your contact database.** For example: + **['fname', 'lname', 'email']** + items: + type: string + example: NAME + customContactFilter: + type: object + properties: + actionForContacts: + type: string + description: | + **Mandatory if neither actionForEmailCampaigns nor actionForSmsCampaigns is passed.** This will export the contacts on the basis of provided action applied on contacts as per the list id. + * **allContacts** - Fetch the list of all contacts for a particular list. + * **subscribed & unsubscribed** - Fetch the list of subscribed / unsubscribed (blacklisted via any means) contacts for a particular list. + * **unsubscribedPerList** - Fetch the list of contacts that are unsubscribed from a particular list only. + enum: + - allContacts + - subscribed + - unsubscribed + - unsubscribedPerList + actionForEmailCampaigns: + type: string + description: | + **Mandatory if neither actionForContacts nor actionForSmsCampaigns is passed.** This will export the contacts on the basis of provided action applied on email campaigns. + * **openers & nonOpeners** - emailCampaignId is mandatory. Fetch the list of readers / non-readers for a particular email campaign. + * **clickers & nonClickers** - emailCampaignId is mandatory. Fetch the list of clickers / non-clickers for a particular email campaign. + * **unsubscribed** - emailCampaignId is mandatory. Fetch the list of all unsubscribed (blacklisted via any means) contacts for a particular email campaign. + * **hardBounces & softBounces** - emailCampaignId is optional. Fetch the list of hard bounces / soft bounces for a particular / all email campaign(s). + enum: + - openers + - nonOpeners + - clickers + - nonClickers + - unsubscribed + - hardBounces + - softBounces + actionForSmsCampaigns: + type: string + description: | + **Mandatory if neither actionForContacts nor actionForEmailCampaigns is passed.** This will export the contacts on the basis of provided action applied on sms campaigns. + * **unsubscribed** - Fetch the list of all unsubscribed (blacklisted via any means) contacts for all / particular sms campaigns. + * **hardBounces & softBounces** - Fetch the list of hard bounces / soft bounces for all / particular sms campaigns. + enum: + - hardBounces + - softBounces + - unsubscribed + listId: + type: integer + description: | + **Mandatory if actionForContacts is passed, ignored otherwise.** Id of the list for which the corresponding action shall be applied in the filter. + format: int64 + example: 2 + emailCampaignId: + type: integer + description: | + Considered only if **actionForEmailCampaigns** is passed, ignored otherwise. **Mandatory if action is one of the following - openers, nonOpeners, clickers, nonClickers, unsubscribed.** + The id of the email campaign for which the corresponding action shall be applied in the filter. + format: int64 + example: 12 + smsCampaignId: + type: integer + description: | + Considered only if **actionForSmsCampaigns** is passed, ignored otherwise. The id of sms campaign for which the corresponding action shall be applied in the filter. + format: int64 + example: 12 + description: | + Set the filter for the contacts to be exported. + notifyUrl: + type: string + description: Webhook that will be called once the export process is finished. + For reference, https://help.brevo.com/hc/en-us/articles/360007666479 + format: url + example: http://requestb.in/173lyyx1 + requestContactImport: + type: object + properties: + fileUrl: + type: string + description: | + **Mandatory if fileBody and jsonBody is not defined.** URL of the file to be imported (**no local file**). Possible file formats: + #### .txt, .csv, .json + format: url + example: https://importfile.domain.com + fileBody: + type: string + description: | + **Mandatory if fileUrl and jsonBody is not defined.** CSV content to be imported. Use semicolon to separate multiple attributes. **Maximum allowed file body size is 10MB** . However we recommend a safe limit of around 8 MB to avoid the issues caused due to increase of file body size while parsing. Please use fileUrl instead to import bigger files. + example: "NAME;SURNAME;EMAIL\nSmith;John;john.smith@example.com\nRoger;Ellie;ellie36@example.com" + jsonBody: + type: array + description: | + **Mandatory if fileUrl and fileBody is not defined.** JSON content to be imported. **Maximum allowed json body size is 10MB** . However we recommend a safe limit of around 8 MB to avoid the issues caused due to increase of json body size while parsing. Please use fileUrl instead to import bigger files. + items: + type: object + properties: + email: + type: string + attributes: + type: object + additionalProperties: true + description: List of attributes to be imported + example: {"email":"ndicky0@ocn.ne.jp","attributes":{"LNAME":"Noemi","FNAME":"Dicky","COUNTRY": "DE","BIRTHDAY": "11/02/1989","PREFERED_COLOR": "BLACK","WHATSAPP": "33689965433","LANDLINE_NUMBER": "33689965433", "SMS": "33689965433"}} + listIds: + type: array + description: | + **Mandatory if newList is not defined.** Ids of the lists in which the contacts shall be imported. For example, **[2, 4, 7]**. + items: + type: integer + description: List Id in which the contacts shall be imported + format: int64 + example: 76 + notifyUrl: + type: string + description: URL that will be called once the import process is finished. + For reference, https://help.brevo.com/hc/en-us/articles/360007666479 + format: url + example: http://requestb.in/173lyyx1 + newList: + type: object + properties: + listName: + type: string + description: | + List with listName will be created first and users will be imported in it. **Mandatory if listIds is empty**. + example: ContactImport - 2017-05 + folderId: + type: integer + description: | + Id of the folder where this new list shall be created. **Mandatory if listName is not empty** + format: int64 + example: 2 + description: To create a new list and import the contacts into it, pass + the listName and an optional folderId. + emailBlacklist: + type: boolean + description: To blacklist all the contacts for email + example: false + default: false + disableNotification: + type: boolean + description: To disable email notification + example: false + default: false + smsBlacklist: + type: boolean + description: To blacklist all the contacts for sms + example: false + default: false + updateExistingContacts: + type: boolean + description: To facilitate the choice to update the existing contacts + example: true + default: true + emptyContactsAttributes: + type: boolean + description: | + To facilitate the choice to erase any attribute of the existing contacts with empty value. emptyContactsAttributes = true means the empty fields in your import will erase any attribute that currently contain data in Brevo, & emptyContactsAttributes = false means the empty fields will not affect your existing data ( **only available if `updateExistingContacts` set to true **) + example: true + default: false + createSmsCampaign: + required: + - content + - name + - sender + type: object + properties: + name: + type: string + description: Name of the campaign + example: Spring Promo Code + sender: + maxLength: 15 + type: string + description: | + Name of the sender. **The number of characters is limited to 11 for alphanumeric characters and 15 for numeric characters** + example: MyShop + content: + type: string + description: | + 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 + example: 'Get a discount by visiting our NY store and saying : Happy Spring!' + recipients: + required: + - listIds + type: object + properties: + listIds: + type: array + description: | + Lists Ids to send the campaign to. **REQUIRED if scheduledAt is not empty** + items: + type: integer + description: List Id to send the campaign to + format: int64 + example: 54 + exclusionListIds: + type: array + description: List ids which have to be excluded from a campaign + items: + type: integer + description: List Id to exclude from the campaign + format: int64 + example: 15 + scheduledAt: + type: string + description: | + 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.** + example: 2017-05-05T12:30:00+02:00 + unicodeEnabled: + type: boolean + description: | + Format of the message. It indicates whether the content should be treated as unicode or not. + example: true + default: false + organisationPrefix: + description : A recognizable prefix will ensure your audience knows who you are. Recommended by U.S. carriers. This will be added as your Brand Name before the message content. **Prefer verifying maximum length of 160 characters including this prefix in message content to avoid multiple sending of same sms.** + type: string + example: MyCompany + unsubscribeInstruction: + description : Instructions to unsubscribe from future communications. Recommended by U.S. carriers. Must include **STOP** keyword. This will be added as instructions after the end of message content. **Prefer verifying maximum length of 160 characters including this instructions in message content to avoid multiple sending of same sms.** + type : string + example : send Stop if you want to unsubscribe. + updateSmsCampaign: + type: object + properties: + name: + type: string + description: Name of the campaign + example: Spring Promo Code + sender: + maxLength: 15 + type: string + description: | + Name of the sender. **The number of characters is limited to 11 for alphanumeric characters and 15 for numeric characters** + example: MyShop + content: + type: string + description: | + 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 + example: 'Get a discount by visiting our NY store and saying : Happy Spring!' + recipients: + required: + - listIds + type: object + properties: + listIds: + type: array + description: | + Lists Ids to send the campaign to. **REQUIRED if scheduledAt is not empty** + items: + type: integer + description: List Id to send the campaign to + format: int64 + example: 54 + exclusionListIds: + type: array + description: List ids which have to be excluded from a campaign + items: + type: integer + description: List Id to exclude from the campaign + format: int64 + example: 15 + scheduledAt: + type: string + description: | + 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.** + example: 2017-05-05T12:30:00+02:00 + unicodeEnabled: + type: boolean + description: | + Format of the message. It indicates whether the content should be treated as unicode or not. + example: true + default: false + organisationPrefix: + description : A recognizable prefix will ensure your audience knows who you are. Recommended by U.S. carriers. This will be added as your Brand Name before the message content. **Prefer verifying maximum length of 160 characters including this prefix in message content to avoid multiple sending of same sms.** + type: string + example: MyCompany + unsubscribeInstruction: + description : Instructions to unsubscribe from future communications. Recommended by U.S. carriers. Must include **STOP** keyword. This will be added as instructions after the end of message content. **Prefer verifying maximum length of 160 characters including this instructions in message content to avoid multiple sending of same sms.** + type : string + example : send Stop if you want to unsubscribe. + sendTransacSms: + required: + - content + - recipient + - sender + type: object + properties: + sender: + maxLength: 15 + type: string + description: | + Name of the sender. **The number of characters is limited to 11 for alphanumeric characters and 15 for numeric characters** + example: MyShop + recipient: + type: string + description: Mobile number to send SMS with the country code + example: "33689965433" + content: + type: string + description: | + Content of the message. If more than **160 characters** long, will be sent as multiple text messages + example: Enter this code:CCJJG8 to validate your account + type: + type: string + description: Type of the SMS. Marketing SMS messages are those sent typically + with marketing content. Transactional SMS messages are sent to individuals + and are triggered in response to some action, such as a sign-up, purchase, + etc. + example: marketing + default: transactional + enum: + - transactional + - marketing + tag: + type: string + description: Tag of the message + example: accountValidation + webUrl: + type: string + description: Webhook to call for each event triggered by the message (delivered + etc.) + format: url + example: http://requestb.in/173lyyx1 + unicodeEnabled: + type: boolean + description: | + Format of the message. It indicates whether the content should be treated as unicode or not. + example: true + default: false + organisationPrefix: + type: string + description: A recognizable prefix will ensure your audience knows who you are. Recommended by U.S. carriers. This will be added as your Brand Name before the message content. **Prefer verifying maximum length of 160 characters including this prefix in message content to avoid multiple sending of same sms.** + example: MyCompany + sendTestEmail: + type: object + properties: + emailTo: + type: array + description: | + 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. You can not send more than 50 test emails per day_. + items: + type: string + description: Email addres of the recipient + format: email + example: helen.jurger@example.com + sendTestSms: + type: object + properties: + phoneNumber: + type: string + description: | + Mobile number of the recipient with the country code. This number **must belong to one of your contacts in Brevo account and must not be blacklisted** + example: "33689965433" + getTransacAggregatedSmsReport: + type: object + properties: + range: + type: string + description: Time frame of the report + example: 2016-09-08|2017-04-06 + requests: + type: integer + description: Number of requests for the timeframe + format: int64 + example: 263 + delivered: + type: integer + description: Number of delivered SMS for the timeframe + format: int64 + example: 249 + hardBounces: + type: integer + description: Number of hardbounces for the timeframe + format: int64 + example: 1 + softBounces: + type: integer + description: Number of softbounces for the timeframe + format: int64 + example: 4 + blocked: + type: integer + description: Number of blocked contact for the timeframe + format: int64 + example: 2 + unsubscribed: + type: integer + description: Number of unsubscription for the timeframe + format: int64 + example: 6 + replied: + type: integer + description: Number of answered SMS for the timeframe + format: int64 + example: 12 + accepted: + type: integer + description: Number of accepted SMS for the timeframe + format: int64 + example: 252 + rejected: + type: integer + description: Number of rejected SMS for the timeframe + format: int64 + example: 8 + skipped: + type: integer + description: Number of skipped SMS for the timeframe + format: int64 + example: 8 + getTransacSmsReport: + type: object + properties: + reports: + type: array + items: + type: object + properties: + date: + type: string + description: Date for which statistics are retrieved + format: date + example: 2017-03-17 + requests: + type: integer + description: Number of requests for the date + format: int64 + example: 87 + delivered: + type: integer + description: Number of delivered SMS for the date + format: int64 + example: 85 + hardBounces: + type: integer + description: Number of hardbounces for the date + format: int64 + example: 1 + softBounces: + type: integer + description: Number of softbounces for the date + format: int64 + example: 1 + blocked: + type: integer + description: Number of blocked contact for the date + format: int64 + example: 0 + unsubscribed: + type: integer + description: Number of unsubscription for the date + format: int64 + example: 1 + replied: + type: integer + description: Number of answered SMS for the date + format: int64 + example: 2 + accepted: + type: integer + description: Number of accepted SMS for the date + format: int64 + example: 85 + rejected: + type: integer + description: Number of rejected SMS for the date + format: int64 + example: 1 + skipped: + type: integer + description: Number of skipped SMS for the date + format: int64 + example: 1 + getIp: + required: + - active + - domain + - id + - ip + type: object + properties: + id: + type: integer + description: ID of the dedicated IP + format: int64 + example: 3 + ip: + type: string + description: Dedicated IP + example: 123.65.8.22 + active: + type: boolean + description: Status of the IP (true=active, false=inactive) + example: true + domain: + type: string + description: Domain associated to the IP + example: mailing.myshop.com + getIpsFromSender: + required: + - ips + type: object + properties: + ips: + type: array + description: Dedicated IP(s) linked to a sender + items: + $ref: '#/components/schemas/getIpFromSender' + getIps: + required: + - ips + type: object + properties: + ips: + type: array + description: Dedicated IP(s) available on your account + items: + $ref: '#/components/schemas/getIp' + getIpFromSender: + required: + - domain + - id + - ip + - weight + type: object + properties: + id: + type: integer + description: ID of the dedicated IP + format: int64 + example: 3 + ip: + type: string + description: Dedicated IP + example: 123.65.8.22 + domain: + type: string + description: Domain associated to the IP + example: mailing.myshop.dom + weight: + type: integer + description: Weight of the IP + format: int64 + example: 75 + getTransacEmailContent: + required: + - attachmentCount + - body + - date + - email + - events + - subject + type: object + properties: + email: + type: string + description: Email address to which transactional email has been sent + format: email + example: abc@example.com + subject: + type: string + description: Subject of the sent email + example: Summer Camp + templateId: + type: integer + description: Id of the template + format: int64 + example: 2 + date: + type: string + description: Date on which transactional email was sent + example: 2017-03-12T12:30:00Z + events: + type: array + description: Series of events which occurred on the transactional email + items: + required: + - name + - time + type: object + properties: + name: + type: string + description: Name of the event that occurred on the sent email + example: delivered + time: + type: string + description: Time at which the event occurred + example: 2017-03-12T12:30:00Z + body: + type: string + description: Actual content of the transactional email that has been sent + example:

Greetings from the team

+

This is the actual html content sent

+ attachmentCount: + type: integer + description: Count of the attachments that were sent in the email + format: int64 + example: 2 + getTransacEmailsList: + type: object + properties: + count: + type: integer + description: Total number of transactional emails available on your account according to the passed filter + format: int64 + example: 5 + transactionalEmails: + type: array + items: + required: + - date + - email + - messageId + - subject + - uuid + type: object + properties: + email: + type: string + description: Email address to which transactional email has been sent + format: email + example: john.smith@example.com + subject: + type: string + description: Subject of the sent email + example: Summer Camp + templateId: + type: integer + description: Id of the template + format: int64 + example: 2 + messageId: + type: string + description: Message Id of the sent email + example: <201798300811.5700093@relay.domain.com> + uuid: + type: string + description: Unique id of the email sent to a particular contact + example: 5a78c-209ok98262910-s99a341 + date: + type: string + description: Date on which transactional email was sent + example: 2017-03-12T12:30:00Z + from: + type: string + description: Email address of the sender from which the email was + sent + format: email + example: diana.doe@example.com + tags: + type: array + description: Tags used for your email + items: + type: string + example: tag1 + getBlockedDomains: + type: object + required: + - domains + properties: + domains: + description: List of all blocked domains + type: array + items: + type: string + description: name of blocked domain + example: "contact.com" + abTestVersionStats: + required: + - Version A + - Version B + type: object + properties: + Version A: + type: string + description: percentage of an event for version A + example: 50% + Version B: + type: string + description: percentage of an event for version B + example: 50% + description: Percentage of a particular event for both versions + abTestVersionClicks: + type: array + description: Information on clicked links for a particular version + items: + required: + - clickRate + - clicksCount + - link + type: object + properties: + link: + type: string + description: URL of the link + example: https://facbook.com/versionA + clicksCount: + type: integer + description: Number of times a link is clicked + format: int64 + example: 3.0 + clickRate: + type: string + description: Percentage of clicks of link with respect to total clicks + example: 40% + getInboundEmailEvents: + type: object + properties: + events: + type: array + items: + type: object + required: + - uuid + - sender + - date + - recipient + properties: + uuid: + description: 'UUID that can be used to fetch additional data' + type: string + format: uuid + date: + description: 'Date when email was received on SMTP relay' + type: string + format: date-time + sender: + description: 'Sender’s email address' + type: string + format: email + recipient: + description: 'Recipient’s email address' + type: string + format: email + getInboundEmailEventsByUuid: + type: object + properties: + receivedAt: + description: 'Date when email was received on SMTP relay' + type: string + format: date-time + example: "2019-05-25T11:53:26Z" + deliveredAt: + description: 'Date when email was delivered successfully to client’s webhook' + type: string + nullable: true + format: date-time + recipient: + description: 'Recipient’s email address' + type: string + format: email + sender: + description: 'Sender’s email address' + type: string + format: email + messageId: + description: 'Value of the Message-ID header. This will be present only after the processing is done.' + type: string + subject: + description: 'Value of the Subject header. This will be present only after the processing is done. ' + type: string + attachments: + description: 'List of attachments of the email. This will be present only after the processing is done.' + type: array + items: + type: object + properties: + name: + description: 'filename specified in the Content-Disposition header of the attachment' + type: string + contentType: + description: 'value of the Content-Type header of the attachment' + type: string + contentId: + description: 'value of the Content-ID header of the attachment.' + type: string + contentLength: + description: 'size of the attachment in bytes' + type: integer + logs: + description: 'List of events/logs that describe the lifecycle of the email on SIB platform' + type: array + items: + type: object + properties: + date: + description: 'Date of the event' + type: string + format: date-time + type: + description: 'Type of the event' + type: string + enum: + - received + - processed + - webhookFailed + - webhookDelivered + getScheduledEmailByBatchId: + type: object + properties: + count: + type: integer + description: 'Total number of batches' + batches: + type: array + items: + type: object + required: + - scheduledAt + - createdAt + - status + properties: + scheduledAt: + description: 'Datetime for which the batch was scheduled' + type: string + format: date-time + createdAt: + description: 'Datetime on which the batch was scheduled' + type: string + format: date-time + status: + description: 'Current status of the scheduled batch' + type: string + enum: + - inProgress + - queued + - processed + - error + getScheduledEmailByMessageId: + type: object + required: + - scheduledAt + - createdAt + - status + properties: + scheduledAt: + description: 'Datetime for which the email was scheduled' + type: string + format: date-time + createdAt: + description: 'Datetime on which the email was scheduled' + type: string + format: date-time + status: + description: 'Current status of the scheduled email' + type: string + enum: + - inProgress + - queued + - processed + - error + subAccountsResponse: + type: object + properties: + count: + type: integer + description: 'Total number of subaccounts' + subAccounts: + type: array + items: + type: object + required: + - id + - companyName + - active + - createdAt + - groups + properties: + id: + description: 'id of the sub-account' + type: integer + format: int64 + companyName: + description: 'Name of the sub-account company' + type: string + active: + description: 'Whether the sub-account is active or not' + type: boolean + createdAt: + description: 'Timestamp when the sub-account was created' + type: integer + format: int64 + groups: + description: Group details + type: array + items: + type: object + properties: + id: + type: string + description: Group identifier + name: + type: string + description: Name of the group + createSubAccount: + type: object + required: + - companyName + - email + properties: + companyName: + description: 'Set the name of the sub-account company' + type: string + email: + description: 'Email address for the organization' + type: string + language: + description: 'Set the language of the sub-account' + type: string + enum: + - en + - fr + - it + - es + - pt + - de + timezone: + description: 'Set the timezone of the sub-account' + type: string + groupIds: + description: 'Set the group(s) for the sub-account' + type: array + items: + type: string + example: + companyName: 'Test Sub-account' + email: test-sub@example.com + timezone: Europe/Paris + language: en + groupIds: ["5f8f8c3b5f56a02d4433b3a7", "5f8f8c3b5f56a02d4433b3a8"] + createSubAccountResponse: + required: + - id + type: object + properties: + id: + type: integer + description: ID of the sub-account created + format: int64 + example: 5 + corporateGroupDetailsResponse: + type: object + properties: + group: + type: object + properties: + id: + type: string + description: Group id + groupName: + type: string + description: Name of the group + createdAt: + type: string + description: Group creation date + sub-accounts: + type: array + items: + type: object + properties: + id: + type: integer + format: int64 + description: Id of the sub-account organzation + companyName: + type: string + description: Name of the sub-account organzation + createdAt: + type: string + description: Creation date of the sub-account organzation + users: + type: array + items: + type: object + properties: + email: + type: string + description: Email address of the user + lastName: + type: string + description: Last name of the user + firstName: + type: string + description: First name of the user + masterDetailsResponse: + type: object + properties: + email: + type: string + description: Email id of master account + companyName: + type: string + description: Company name of master account organization + id: + type: integer + format: int64 + description: Unique identifier of the master account organization + currencyCode: + type: string + description: Currency code of the master account organization + timezone: + type: string + description: Timezone of the master account organization + billingInfo: + type: object + description: Billing details of the master account organization + properties: + email: + type: string + description: Billing email id of master account + companyName: + type: string + description: Company name of master account + name: + type: object + description: Billing name of master account holder + properties: + givenName: + type: string + description: First name for billing + familyName: + type: string + description: Last name for billing + address: + type: object + description: Billing address of master account + properties: + streetAddress: + type: string + description: Street address + locality: + type: string + description: Locality + postalCode: + type: string + description: Postal code + stateCode: + type: string + description: State code + countryCode: + type: string + description: Country code + planInfo: + type: object + description: Plan details + properties: + currencyCode: + type: string + description: Plan currency + nextBillingAt: + type: integer + format: int64 + description: Timestamp of next billing date + price: + type: number + description: Plan amount + planPeriod: + type: string + description: Plan period type + enum: + - month + - year + subAccounts: + type: integer + description: Number of sub-accounts + features: + type: array + description: List of provided features in the plan + items: + type: object + properties: + name: + type: string + description: Name of the feature + unitValue: + type: string + description: Unit value of the feature + quantity: + type: integer + format: int64 + description: Quantity provided in the plan + quantityWithOverages: + type: integer + format: int64 + description: Quantity with overages provided in the plan (only applicable on ENTv2) + used: + type: integer + format: int64 + description: Quantity consumed by master + usedOverages: + type: integer + format: int64 + description: Quantity consumed by sub-organizations over the admin plan limit (only applicable on ENTv2) + remaining: + type: integer + format: int64 + description: Quantity remaining in the plan + subAccountDetailsResponse: + type: object + properties: + name: + type: string + description: Name of the sub-account user + email: + type: string + description: Email id of the sub-account organization + companyName: + type: string + description: Sub-account company name + groups: + type: array + items: + type: object + properties: + id: + type: string + description: Group id + name: + type: string + description: Name of the group + planInfo: + type: object + description: Sub-account plan details + properties: + credits: + type: object + description: Credits quota and remaining credits on the sub-account + properties: + emails: + type: object + description: Email credits remaining on the sub-account + properties: + quantity: + type: integer + format: int64 + description: Quantity of email messaging limits provided + remaining: + type: integer + format: int64 + description: Available email messaging limits for use + sms: + type: object + description: SMS credits remaining on the sub-account + properties: + quantity: + type: integer + format: int64 + description: Quantity of SMS messaging limits provided + remaining: + type: integer + format: int64 + description: Available SMS messaging limits for use + wpSubscribers: + type: object + description: Push credits remaining on the sub-account + properties: + quantity: + type: integer + format: int64 + description: Quantity of Push sending limits provided + remaining: + type: integer + format: int64 + description: Available Push sending limits for use + whatsapp: + type: object + description: Whatsapp credits remaining on the sub-account + properties: + quantity: + type: integer + format: int64 + description: Quantity of whatsapp messaging limits provided + remaining: + type: integer + format: int64 + description: Available whatsapp messaging limits for use + externalFeeds: + type: object + description: externalFeeds credits remaining on the sub-account + properties: + quantity: + type: integer + format: int64 + description: Quantity of externalFeeds messaging limits provided + remaining: + type: integer + format: int64 + description: Available externalFeeds messaging limits for use + features: + type: object + description: Features available on the sub-account + properties: + inbox: + type: object + description: Inbox details / Not available on ENTv2 + properties: + quantity: + type: integer + format: int64 + description: Quantity of inbox provided + remaining: + type: integer + format: int64 + description: Available inboxes for use + landingPage: + type: object + description: Landing page details / Not available on ENTv2 + properties: + quantity: + type: integer + format: int64 + description: Quantity of landing pages provided + remaining: + type: integer + format: int64 + description: Available landing pages for use + users: + type: object + description: Multi-account details + properties: + quantity: + type: integer + format: int64 + description: Quantity of multi-account's provided + remaining: + type: integer + format: int64 + description: Available multi-accounts for use + planType: + type: string + description: type of the plan + subAccountUpdatePlanRequest: + type: object + description: Details of the plan to be changed + properties: + credits: + type: object + description: Credit details to update + properties: + email: + type: integer + format: int64 + description: Number of email credits | Pass the value -1 for unlimited emails in ENTv2 only + sms: + type: number + format: float + description: Number of SMS credits | Pass the value -1 for unlimited SMS in ENTv2 only + wpSubscribers: + type: integer + format: int64 + description: Number of Push credits, possible value is 0 and -1 | available in ENT-v2 only + externalFeeds: + type: number + format: int64 + description: Number of externalFeeds credits, possible values are 0 or 1 |available in ENTv2 only + whatsapp: + type: number + format: float + description: Number of whatsapp credits | Pass the value -1 for unlimited whatsapp in ENTv2 only + features: + type: object + description: Features details to update + properties: + users: + type: integer + format: int64 + description: Number of multi-users + landingPage: + type: integer + format: int64 + description: Number of landing pages + inbox: + type: integer + format: int64 + description: Number of inboxes / Not required on ENTv2 + example: + credits: + email: 5000 + sms: 2000 + wpSubscribers: -1 + externalFeeds: 1 + whatsapp: 100 + features: + users: 15 + landingPage: 20 + inbox: 10 + + subAccountAppsToggleRequest: + type: object + description: List of enable/disable applications on the sub-account + properties: + inbox: + type: boolean + description: Set this field to enable or disable Inbox on the sub-account / Not applicable on ENTv2 + whatsapp: + type: boolean + description: Set this field to enable or disable Whatsapp campaigns on the sub-account + automation: + type: boolean + description: Set this field to enable or disable Automation on the sub-account + email-campaigns: + type: boolean + description: Set this field to enable or disable Email Campaigns on the sub-account + sms-campaigns: + type: boolean + description: Set this field to enable or disable SMS Marketing on the sub-account + landing-pages: + type: boolean + description: Set this field to enable or disable Landing pages on the sub-account + transactional-emails: + type: boolean + description: Set this field to enable or disable Transactional Email on the sub-account + transactional-sms: + type: boolean + description: Set this field to enable or disable Transactional SMS on the sub-account + facebook-ads: + type: boolean + description: Set this field to enable or disable Facebook ads on the sub-account + web-push: + type: boolean + description: Set this field to enable or disable Web Push on the sub-account + meetings: + type: boolean + description: Set this field to enable or disable Meetings on the sub-account + conversations: + type: boolean + description: Set this field to enable or disable Conversations on the sub-account + crm: + type: boolean + description: Set this field to enable or disable Sales CRM on the sub-account + example: + landing-pages: true + sms-campaigns: false + whatsapp: true + meetings: true + web-push: false + + TaskTypes: + type: object + description: Task types details + properties: + id: + type: string + description: Id of task type + example: "61a88a2eb7a574180261234" + title: + type: string + description: Title of task type + example: "Email" + Task: + required: + - taskTypeId + - name + - date + type: object + description: Task Details + properties: + id: + type: string + description: Unique task id + example: "61a5cd07ca1347c82306ad06" + taskTypeId: + type: string + description: Id for type of task e.g Call / Email / Meeting etc. + example: "61a5cd07ca1347c82306ad09" + name: + type: string + description: Name of task + example: "Task: Connect with client" + contactsIds: + items: + type: integer + type: array + description: Contact ids for contacts linked to this task + example: [ 1, 2, 3] + dealsIds: + items: + type: string + type: array + description: Deal ids for deals a task is linked to + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + companiesIds: + items: + type: string + type: array + description: Companies ids for companies a task is linked to + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + TaskReminder: + required: + - value + - unit + - types + type: object + description: Task reminder date/time for a task + properties: + value: + type: integer + example: 10 + description: Value of time unit before reminder is to be sent + unit: + type: string + enum: + - minutes + - hours + - weeks + - days + description: Unit of time before reminder is to be sent + types: + items: + type: string + enum: + - email + - push + description: Type of task reminder e.g email, push + type: array + example: [ + "email" + ] + FileList: + type: array + description: List of files + items: + $ref: '#/components/schemas/FileData' + FileDownloadableLink: + type: object + description: Downloadable file link + properties: + fileUrl: + type: string + description: A unique link to download the requested file. + example: 'https://storage.googleapis.com/brevo-app-crm.......-sample.pdf' + FileData: + type: object + description: File data that is uploaded + properties: + name: + type: string + description: Name of uploaded file + example: "example.png" + authorId: + type: string + description: Account id of user which created the file + example: "61a5ce58y5d4795761045991" + contactId: + type: integer + format: int64 + description: Contact id of contact on which file is uploaded + example: 1 + dealId: + type: string + description: Deal id linked to a file + example: "61a5ce58c5d4795761045991" + companyId: + type: string + description: Company id linked to a file + example: "61a5ce58c5d4795761045991" + size: + type: integer + format: int64 + description: Size of file in bytes + example: 10 + createdAt: + type: string + format: date-time + example: "2017-05-01T17:05:03.000Z" + description: File created date/time + NoteData: + required: + - text + type: object + description: Note data to be saved + properties: + text: + type: string + maxLength: 3000 + minLength: 1 + example: "In communication with client for resolution of queries." + description: Text content of a note + contactIds: + items: + type: integer + description: Contact Ids linked to a note + type: array + example: [ + 247, 1, 2 + ] + dealIds: + items: + type: string + description: Deal Ids linked to a note + type: array + example: [ + "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" + ] + companyIds: + items: + type: string + description: Company Ids linked to a note + type: array + example: [ + "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" + ] + Note: + required: + - text + type: object + description: Note Details + properties: + id: + type: string + description: Unique note Id + example: "61a5cd07ca1347c82306ad09" + text: + type: string + maxLength: 3000 + minLength: 1 + example: "In communication with client for resolution of queries." + description: Text content of a note + contactIds: + items: + type: integer + description: Contact ids linked to a note + type: array + example: [ + 247, 1, 2 + ] + dealIds: + items: + type: string + description: Deal ids linked to a note + type: array + example: [ + "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" + ] + authorId: + type: object + description: Account details of user which created the note + example: { + id: "61a5ce58y5d4795761045991", + email: "johndoe@example.com", + locale: "en_GB", + timezone: "Asia/Kolkata", + name: { + fullName: "John Doe" + } + } + createdAt: + type: string + format: date-time + example: "2017-05-01T17:05:03.000Z" + description: Note created date/time + updatedAt: + type: string + format: date-time + example: "2017-05-01T17:05:03.000Z" + description: Note updated date/time + NoteId: + type: object + description: Updated Note ID + properties: + id: + type: string + description: Unique note Id + example: "61a5cd07ca1347c82306ad09" + NoteList: + type: array + description: List of notes + items: + $ref: '#/components/schemas/Note' + TaskList: + type: object + description: List of tasks + properties: + items: + type: array + description: List of tasks + items: + $ref: '#/components/schemas/Task' + Pipelines: + type: array + description: List of pipeline + items: + $ref: '#/components/schemas/Pipeline' + PipelineStage: + type: object + description: List of stages + properties: + id: + type: string + description: Stage id + example: "9e577ff7-8e42-4ab3-be26-2b5e01b42518" + name: + type: string + description: Stage name + example: "New" + Pipeline: + type: object + description: List of stages + properties: + pipeline_name: + type: string + description: Pipeline name + example: Sales Pipeline + pipeline: + type: string + description: Pipeline id + example: "5ea675e3da0dd085acaea610" + stages: + type: array + description: List of stages + items: + $ref: '#/components/schemas/PipelineStage' + DealAttributes: + type: array + description: List of deal attributes + items: + type: object + description: List of attributes + properties: + internalName: + type: string + example : "deal_name" + label: + type: string + example : "Deal Name" + attributeTypeName: + type: string + example : "text" + attributeOptions: + type: array + items: + type: object + example : { + key: "custom key", + value: "custom label" + } + isRequired: + type: boolean + example : true + DealsList: + type: object + description: List of Deals + properties: + items: + type: array + description: List of deals + items: + $ref: '#/components/schemas/Deal' + Deal: + type: object + description: Deal Details + properties: + id: + type: string + description: Unique deal id + example: "629475917295261d9b1f4403" + attributes: + type: object + description: Deal attributes with values + example : { + deal_name: "testname", + deal_owner: "6093d2425a9b436e9519d034", + amount: 12, + pipeline: "6093d296ad1e9c5cf2140a58", + deal_stage: "9e577ff7-8e42-4ab3-be26-2b5e01b42518", + stage_updated_at: "2022-05-30T07:42:05.671Z", + created_at: "2022-05-30T07:42:05.671Z", + number_of_contacts: 1, + last_updated_date: "2022-06-06T08:38:36.761Z", + last_activity_date: "2022-06-06T08:38:36.000Z", + next_activity_date: null, + number_of_activities: 0 + } + linkedContactsIds: + items: + type: integer + type: array + description: Contact ids for contacts linked to this deal + example: [ 1, 2, 3] + linkedCompaniesIds: + items: + type: string + type: array + description: Companies ids for companies linked to this deal + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + CompaniesList: + type: object + description: List of companies + properties: + items: + type: array + description: List of compaies + items: + $ref: '#/components/schemas/Company' + Company: + type: object + description: Company Details + properties: + id: + type: string + description: Unique comoany id + example: "629475917295261d9b1f4403" + attributes: + type: object + description: Company attributes with values + example : { + "created_at": "2022-01-13T19:04:24.376+05:30", + "domain": "xyz", + "last_updated_at": "2022-04-01T18:47:48.283+05:30", + "name": "text", + "number_of_contacts": 0, + "owner": "62260474111b1101704a9d85", + "owner_assign_date": "2022-04-01T18:21:13.379+05:30", + "phone_number": 8171844192, + "revenue": 10 + } + linkedContactsIds: + items: + type: integer + type: array + format: in64 + description: Contact ids for contacts linked to this company + example: [ 1, 2, 3] + linkedDealsIds: + items: + type: string + type: array + format: objectID + description: Deals ids for companies linked to this company + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + CompanyAttributes: + type: array + description: List of company attributes + items: + type: object + description: List of attributes + properties: + internalName: + type: string + example : "name" + label: + type: string + example : "Company Name" + attributeTypeName: + type: string + example : "text" + attributeOptions: + type: array + items: + type: object + example : { + key: "custom key", + value: "custom label" + } + isRequired: + type: boolean + example : true + ConversationsMessage: + type: object + description: a Conversations message + properties: + id: + type: string + description: Message ID. It can be used for further manipulations with the message. + example: eYBEm3gq3zc5ayE2g + type: + type: string + enum: ["agent", "visitor"] + description: '`"agent"` for agents’ messages, `"visitor"` for visitors’ messages.' + example: agent + text: + type: string + description: Message text or name of the attached file + example: Good morning! How can I help you? + visitorId: + type: string + description: visitor’s ID + example: kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg + agentId: + type: string + description: ID of the agent on whose behalf the message was sent (only in messages sent by an agent). + example: d9nKoegKSjmCtyK78 + agentName: + type: string + description: Agent’s name as displayed to the visitor. Only in the messages sent by an agent. + example: Liz + createdAt: + type: integer + format: int64 + minimum: 0 + description: Timestamp in milliseconds. + example: 1470222622433 + isPushed: + type: boolean + description: '`true` for pushed messages' + example: true + receivedFrom: + type: string + description: In two-way integrations, messages sent via REST API can be marked with receivedFrom property and then filtered out when received in a webhook to avoid infinite loop. + example: SuperAwesomeHelpdesk + file: + type: object + properties: + filename: + type: string + description: Name of the file + example: conversations.png + size: + type: integer + format: int64 + minimum: 0 + description: Size in bytes + example: 15538 + isImage: + type: boolean + description: Whether the file is an image + example: true + url: + type: string + format: url + description: URL of the file + example: https://ucarecdn.com/cee5c10c-8302-45c1-b1fb-43860ca941a9/ + imageInfo: + type: object + description: image info is passed in case the file is an image + properties: + width: + type: integer + format: int64 + minimum: 0 + description: Width of the image + example: 1129 + height: + type: integer + format: int64 + minimum: 0 + description: height of the image + example: 525 + previewUrl: + type: string + format: url + description: URL of the preview + example: https://ucarecdn.com/03cd56cd-1de9-4f65-996d-08afdf27fa1b/-/preview/800x800/-/quality/lighter/ + + event: + type: object + required: + - event_name + - identifiers + properties: + event_name: + description: 'The name of the event that occurred. This is how you will find your event in Brevo. Limited to 255 characters, alphanumerical characters and - _ only.' + type: string + example: "video_played" + event_date: + description: 'Timestamp of when the event occurred (e.g. "2024-01-24T17:39:57+01:00"). If no value is passed, the timestamp of the event creation is used.' + type: string + example: "2024-02-06T20:59:23.383Z" + identifiers: + description: 'Identifies the contact associated with the event. At least one identifier is required.' + type: object + minProperties: 1 + properties: + email_id: + type: string + description: 'Email Id associated with the event' + example: "jane.doe@example.com" + phone_id: + type: string + description: 'SMS associated with the event' + example: "+91xxxxxxxxxx" + whatsapp_id: + type: string + description: 'whatsapp associated with the event' + example: "+91xxxxxxxxxx" + landline_number_id: + type: string + description: 'landline_number associated with the event' + example: "+91xxxxxxxxxx" + ext_id: + type: string + description: 'ext_id associated with the event' + example: "abc123" + contact_properties: + description: 'Properties defining the state of the contact associated to this event. Useful to update contact attributes defined in your contacts database while passing the event. For example: **"FIRSTNAME": "Jane" , "AGE": 37**' + type: object + additionalProperties: + anyOf: + - type: string + - type: integer + example: { + "AGE": 32, + "GENDER": "FEMALE" + } + event_properties: + description: 'Properties of the event. Top level properties and nested properties can be used to better segment contacts and personalise workflow conditions. The following field type are supported: string, number, boolean (true/false), date (Timestamp e.g. "2024-01-24T17:39:57+01:00"). Keys are limited to 255 characters, alphanumerical characters and - _ only. Size is limited to 50Kb.' + type: object + additionalProperties: + anyOf: + - type: string + - type: integer + - type: object + - type: array + example: { + "video_title": "Brevo — The most approachable CRM suite", + "vide_description": "Create your free account today!", + "duration": 142, + "autoplayed": false, + "upload_date": "2023-11-24T12:09:10+01:00" + } + ConversionSourceMetrics: + type: object + required: + - id + - conversionSource + - ordersCount + - revenue + - averageBasket + properties: + id: + type: number + format: integer + conversionSource: + type: string + enum: + - email_campaign + ordersCount: + type: number + format: integer + revenue: + type: number + format: float + averageBasket: + type: number + format: float + ConversionSourceProduct: + type: object + required: + - id + properties: + id: + type: string + example: "1" + name: + type: string + example: "Milky Way Galaxy" + sku: + type: string + example: "sku-1" + price: + type: number + format: float + example: 1000.0 + url: + type: string + example: "https://mydomain.com/products/alpina-panoma-classic" + imageUrl: + type: string + example: "http://mydomain.com/product-absoulte-url/img.jpeg" + ordersCount: + type: integer + example: 200 + revenue: + type: number + format: float + example: 999.99 + + order: + type: object + required: + - id + - createdAt + - updatedAt + - status + - amount + - products + properties: + id: + description: 'Unique ID of the order.' + type: string + example: "14" + createdAt: + description: 'Event occurrence UTC date-time (YYYY-MM-DDTHH:mm:ssZ), when order is actually created.' + type: string + example: "2021-07-29T20:59:23.383Z" + updatedAt: + description: 'Event updated UTC date-time (YYYY-MM-DDTHH:mm:ssZ), when the status of the order is actually changed/updated.' + type: string + example: "2021-07-30T10:59:23.383Z" + status: + description: 'State of the order.' + type: string + example: "completed" + amount: + description: 'Total amount of the order, including all shipping expenses, tax and the price of items.' + type: number + example: 308.42 + storeId: + description: 'ID of store where the order is placed' + type: string + example: "ST-21" + identifiers: + description: 'Identifies the contact associated with the order.' + type: object + properties: + ext_id: + type: string + description: 'ext_id associated with the order' + example: "ext_id_1" + loyalty_subscription_id: + type: string + description: 'loyalty_subscription_id associated with the order' + example: "loyalty_id_1" + phone_id: + type: string + description: 'Phone number of the contact associated with the order' + example: "01559 032133" + email_id: + type: string + description: 'Email of the contact associated with the order' + example: "example@brevo.com" + products: + type: array + items: + type: object + required: + - productId + - quantity + - price + description: 'Details for the Products in an order.' + properties: + productId: + type: string + description: 'ID of the product.' + example: "P1" + quantity: + type: number + description: 'How many pieces of the product the visitor has added to the cart.' + example: 10 + variantId: + type: string + description: 'Product ID of the red color shirts.' + example: "P100" + price: + type: number + description: 'The price of a unit of product' + example: 99.99 + billing: + description: 'Billing details of an order.' + type: object + properties: + address: + type: string + description: 'Full billing address.' + example: "15 Somewhere Road, Brynmenyn" + city: + type: string + description: 'Exact city of the address.' + example: "Basel" + countryCode: + type: string + description: 'Billing country 2-letter ISO code.' + example: "CA" + country: + type: string + description: 'Billing country name.' + example: "Canada" + phone: + type: string + description: 'Billing phone number.' + example: "01559 032133" + postCode: + type: string + description: 'Postcode for delivery and billing.' + example: "4052" + paymentMethod: + type: string + description: 'How the visitor will pay for the item(s), e.g. paypal, check, etc.' + example: "PayPal" + region: + type: string + description: 'Exact region (state/province) for delivery and billing.' + example: "Northwestern Switzerland" + coupons: + description: 'Coupons applied to the order. Stored case insensitive.' + type: array + example: + - "EASTER15OFF" + items: + type: string + orderBatch: + type: object + required: + - orders + properties: + orders: + description: "array of order objects" + type: array + items: + $ref: '#/components/schemas/order' + notifyUrl: + description: 'Notify Url provided by client to get the status of batch request' + type: string + example: "https://en.wikipedia.org/wiki/Webhook" + historical: + description: 'Defines wether you want your orders to be considered as live data or as historical data (import of past data, synchronising data). True: orders will not trigger any automation workflows. False: orders will trigger workflows as usual.' + type: boolean + default: true + example: true + createdBatchId: + type: object + required: + - batchId + properties: + batchId: + type: number + description: 'Batch ID of the request' + example: '1' + count: + type: integer + description: Number of orders + format: int64 + example: 17655 + getCategories: + required: + - categories + - count + type: object + properties: + categories: + type: array + items: + type: object + allOf: + - $ref: '#/components/schemas/getCategoryDetails' + count: + type: integer + description: Number of categories + format: int64 + example: 17655 + getCategoryDetails: + required: + - id + - name + - createdAt + - modifiedAt + type: object + properties: + id: + type: string + description: Category ID for which you requested the details + format: string + example: C11 + name: + type: string + description: Name of the category for which you requested the details + format: string + example: Electronics + createdAt: + type: string + description: Creation UTC date-time of the category (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-05-12T12:30:00Z + modifiedAt: + type: string + description: Last modification UTC date-time of the category (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-05-12T12:30:00Z + url: + type: string + description: URL to the category + format: string + example: http://mydomain.com/category/clothing + isDeleted: + type: boolean + description: category deleted from the shop's database + format: string + example: true + createUpdateCategory: + type: object + required: + - id + properties: + id: + type: string + description: | + Unique Category ID as saved in the shop + format: email + example: CAT123 + name: + type: string + description: | + **Mandatory in case of creation**. Name of the Category, as displayed in the shop + example: Electronics + url: + type: string + description: URL to the category + example: http://mydomain.com/category/electronics + updateEnabled: + type: boolean + description: Facilitate to update the existing category in the same request + (updateEnabled = true) + example: false + default: false + deletedAt: + type: string + description: UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the category deleted from the shop's database + example: 2017-05-12T12:30:00Z + isDeleted: + type: boolean + description: category deleted from the shop's database + example: true + createUpdateCategories: + type: object + required: + - id + properties: + id: + type: string + description: | + Unique Category ID as saved in the shop + format: email + example: CAT123 + name: + type: string + description: | + **Mandatory in case of creation**. Name of the Category, as displayed in the shop + example: Electronics + url: + type: string + description: URL to the category + example: http://mydomain.com/category/electronics + deletedAt: + type: string + description: UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the category deleted from the shop's database + example: 2017-05-12T12:30:00Z + isDeleted: + type: boolean + description: category deleted from the shop's database + example: true + createUpdateBatchCategory: + type: object + required: + - categories + properties: + categories: + description: "array of categories objects" + type: array + items: + $ref: '#/components/schemas/createUpdateCategories' + updateEnabled: + type: boolean + description: Facilitate to update the existing categories in the same request + (updateEnabled = true) + createCategoryModel: + type: object + properties: + id: + type: integer + description: ID of the category when a new category is created + format: int64 + example: 122 + createUpdateBatchCategoryModel: + type: object + properties: + createdCount: + type: integer + description: Number of the new created categories + format: int64 + example: 7 + updatedCount: + type: integer + description: Number of the existing categories updated + format: int64 + example: 5 + getProducts: + required: + - products + - count + type: object + properties: + products: + type: array + items: + type: object + allOf: + - $ref: '#/components/schemas/getProductDetails' + count: + type: integer + description: Number of products + format: int64 + example: 17655 + getProductDetails: + required: + - id + - name + - createdAt + - modifiedAt + - s3ThumbAnalytics + - s3ThumbEditor + type: object + properties: + id: + type: string + description: Product ID for which you requested the details + format: string + example: P11 + name: + type: string + description: Name of the product for which you requested the details + format: string + example: Iphone 11 + createdAt: + type: string + description: Creation UTC date-time of the product (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-05-12T12:30:00Z + modifiedAt: + type: string + description: Last modification UTC date-time of the product (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-05-12T12:30:00Z + url: + type: string + description: URL to the product + format: string + example: http://mydomain.com/product/electronics/product1 + imageUrl: + type: string + description: Absolute URL to the cover image of the product + format: string + example: http://mydomain.com/product-absoulte-url/img.jpeg + sku: + type: string + description: Product identifier from the shop + format: string + price: + type: number + description: Price of the product + format: float + categories: + type: array + items: + type: string + description: Category ID-s of the product + parentId: + type: string + description: Parent product id of the product + format: string + s3Original: + type: string + description: S3 url of original image + format: string + s3ThumbAnalytics: + type: string + description: S3 thumbnail url of original image in 120x120 dimension for analytics section + format: string + s3ThumbEditor: + type: string + description: S3 thumbnail url of original image in 600x400 dimension for editor section + format: string + metaInfo: + type: object + description: Meta data of product such as description, vendor, producer, stock level, etc. + example: { + "description" : "Shoes for sports", + "brand": "addidas" + } + isDeleted: + type: boolean + description: product deleted from the shop's database + example: true + createUpdateProduct: + type: object + required: + - id + - name + properties: + id: + type: string + description: Product ID for which you requested the details + format: string + example: P11 + name: + type: string + description: Mandatory in case of creation**. Name of the product for which you requested the details + format: string + example: Iphone 11 + url: + type: string + description: URL to the product + format: string + example: http://mydomain.com/product/electronics/product1 + imageUrl: + type: string + description: Absolute URL to the cover image of the product + format: string + example: http://mydomain.com/product-absoulte-url/img.jpeg + sku: + type: string + description: Product identifier from the shop + format: string + price: + type: number + description: Price of the product + format: float + categories: + type: array + items: + type: string + description: Category ID-s of the product + parentId: + type: string + description: Parent product id of the product + format: string + metaInfo: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + description: Meta data of product such as description, vendor, producer, stock level. The size of cumulative metaInfo shall not exceed **1000 KB**. Maximum length of metaInfo object can be 10. + example: { + "description" : "Shoes for sports", + "brand": "addidas" + } + updateEnabled: + type: boolean + description: Facilitate to update the existing category in the same request + (updateEnabled = true) + example: false + default: false + deletedAt: + type: string + description: UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the product deleted from the shop's database + isDeleted: + type: boolean + description: product deleted from the shop's database + example: true + + createUpdateBatchProducts: + type: object + required: + - products + properties: + products: + description: "array of products objects" + type: array + items: + $ref: '#/components/schemas/createUpdateProducts' + updateEnabled: + type: boolean + description: Facilitate to update the existing categories in the same request + (updateEnabled = true) + createUpdateProducts: + type: object + required: + - id + - name + properties: + id: + type: string + description: Product ID for which you requested the details + format: string + example: P11 + name: + type: string + description: Mandatory in case of creation**. Name of the product for which you requested the details + format: string + example: Iphone 11 + url: + type: string + description: URL to the product + format: string + example: http://mydomain.com/product/electronics/product1 + imageUrl: + type: string + description: Absolute URL to the cover image of the product + format: string + example: http://mydomain.com/product-absoulte-url/img.jpeg + sku: + type: string + description: Product identifier from the shop + format: string + price: + type: number + description: Price of the product + format: float + categories: + type: array + items: + type: string + description: Category ID-s of the product + parentId: + type: string + description: Parent product id of the product + format: string + metaInfo: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + description: Meta data of product such as description, vendor, producer, stock level. The size of cumulative metaInfo shall not exceed **1000 KB**. Maximum length of metaInfo object can be 10. + example: { + "description" : "Shoes for sports", + "brand": "addidas" + } + deletedAt: + type: string + description: UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the product deleted from the shop's database + isDeleted: + type: boolean + description: product deleted from the shop's database + example: true + createProductModel: + type: object + properties: + id: + type: integer + description: ID of the Product when a new product is created + format: int64 + example: 122 + createUpdateBatchProductsModel: + type: object + properties: + createdCount: + type: integer + description: Number of the new created products + format: int64 + example: 7 + updatedCount: + type: integer + description: Number of the existing products updated + format: int64 + example: 5 + getCouponCollection: + required: + - id + - name + - defaultCoupon + - createdAt + - totalCoupons + - remainingCoupons + type: object + properties: + id: + description: The id of the collection. + type: string + format: uuidv4 + example: "23befbae-1505-47a8-bd27-e30ef739f32c" + name: + description: The name of the collection. + type: string + format: uuidv4 + example: "SummerPromotions" + defaultCoupon: + description: The default coupon of the collection. + type: string + example: 10 OFF + createdAt: + description: Datetime on which the collection was created. + type: string + format: date-time + example: 2023-01-06T05:03:47.053000000Z + totalCoupons: + description: Total number of coupons in the collection. + type: integer + format: int64 + example: 10000 + remainingCoupons: + description: Number of coupons that have not been sent yet. + type: integer + format: int64 + example: 5000 + expirationDate: + description: Expiration date for the coupon collection in RFC3339 format. + type: string + format: date-time + example: "2024-01-01T00:00:00Z" + remainingDaysAlert: + description: If present, an email notification is going to be sent the defined amount of days before to the expiration date. + type: integer + example: 5 + remainingCouponsAlert: + description: If present, an email notification is going to be sent when the total number of available coupons falls below the defined threshold. + type: integer + example: 5 + sendWhatsappMessageTemplate: + required: + - senderNumber + - templateId + - contactNumbers + type: object + properties: + templateId: + type: integer + description: ID of the template to send + example: 123 + senderNumber: + type: string + format: mobile + description: WhatsApp Number with country code. Example, 85264318721 + example: 919876543210 + # mediaUrl: + # type: string + # description: URL of the media to be sent + # format: url + # example: https://example.com/image.png + params: + type: object + description: Pass the set of attributes to customize the template. For example, {"FNAME":"Joe", "LNAME":"Doe"}. + example: {"FNAME":"Joe", "LNAME":"Doe"} + contactNumbers: + type: array + description: List of phone numbers of the contacts + items: + type: string + description: WhatsApp Number with country code. Example, 85264318721 + format: mobile + example: 919876543210 + sendWhatsappMessageText: + required: + - senderNumber + - contactNumbers + - authType + - text + type: object + properties: + senderNumber: + type: string + format: mobile + description: WhatsApp Number with country code. Example, 85264318721 + example: 919876543210 + text: + type: string + description: Text to be sent as message body (will be overridden if templateId is passed in the same request) + example: Hi! There i am a message + contactNumbers: + type: array + description: List of phone numbers of the contacts + items: + type: string + description: WhatsApp Number with country code. Example, 85264318721 + format: mobile + example: 919876543210 + getWhatsappEventReport: + type: object + properties: + events: + type: array + items: + required: + - contactNumber + - date + - messageId + - event + - senderNumber + type: object + properties: + contactNumber: + type: string + format: mobile + description: WhatsApp Number with country code. Example, 85264318721 + example: 919876543210 + date: + type: string + description: UTC date-time on which the event has been generated + example: 2017-03-12T12:30:00Z + messageId: + type: string + description: Message ID which generated the event + example: 23befbae-1505-47a8-bd27-e30ef739f32c + event: + type: string + description: Event which occurred + example: delivered + enum: + - sent + - delivered + - read + - error + - unsubscribe + - reply + - soft-bounce + reason: + type: string + description: Reason for the event (will be there in case of `error` and `soft-bounce` events) + example: 23befbae-1505-47a8-bd27-e30ef739f32c + body: + type: string + description: Text of the reply (will be there only in case of `reply` event with text) + example: "Hi! I am a reply" + mediaUrl: + type: string + format: url + description: Url of the media reply (will be there only in case of `reply` event with media) + example: "https://example.com/media.png" + senderNumber: + type: string + format: mobile + description: WhatsApp Number with country code. Example, 85264318721 + example: 919876543210 + getExternalFeedByUUID: + type: object + required: + - id + - name + - url + - authType + - headers + - maxRetries + - cache + - createdAt + - modifiedAt + properties: + id: + description: 'ID of the feed' + type: string + format: uuidv4 + example: 54377442-20a2-4c20-b761-d636c72de7b7 + name: + description: 'Name of the feed' + type: string + example: New feed + url: + description: 'URL of the feed' + type: string + format: url + example: http://requestb.in/173lyyx1 + authType: + type: string + enum: [basic, token, noAuth] + description: > + Auth type of the feed: + * `basic` + * `token` + * `noAuth` + username: + type: string + description: Username for authType `basic` + example: user + password: + type: string + description: Password for authType `basic` + example: password + token: + type: string + description: Token for authType `token` + example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c + headers: + type: array + description: Custom headers for the feed + items: + type: object + properties: + name: + type: string + description: Name of the header + example: userId + value: + type: string + description: Value of the header + example: 'user12345' + maxRetries: + type: integer + description: Maximum number of retries on the feed url + example: 5 + minimum: 0 + maximum: 5 + default: 5 + cache: + type: boolean + description: Toggle caching of feed url response + example: true + createdAt: + description: 'Datetime on which the feed was created' + type: string + format: date-time + example: '2022-10-06T05:03:47.053000000Z' + modifiedAt: + description: 'Datetime on which the feed was modified' + type: string + format: date-time + example: '2022-10-06T05:03:47.053000000Z' + getAllExternalFeeds: + type: object + properties: + count: + type: integer + description: 'Total number of batches' + feeds: + type: array + items: + type: object + required: + - id + - name + - url + - authType + - headers + - maxRetries + - cache + - createdAt + - modifiedAt + properties: + id: + description: 'ID of the feed' + type: string + format: uuidv4 + example: 54377442-20a2-4c20-b761-d636c72de7b7 + name: + description: 'Name of the feed' + type: string + example: New feed + url: + description: 'URL of the feed' + type: string + format: url + example: http://requestb.in/173lyyx1 + authType: + type: string + enum: [basic, token, noAuth] + description: > + Auth type of the feed: + * `basic` + * `token` + * `noAuth` + username: + type: string + description: Username for authType `basic` + example: user + password: + type: string + description: Password for authType `basic` + example: password + token: + type: string + description: Token for authType `token` + example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c + headers: + type: array + description: Custom headers for the feed + items: + type: object + properties: + name: + type: string + description: Name of the header + example: userId + value: + type: string + description: Value of the header + example: 'user12345' + maxRetries: + type: integer + description: Maximum number of retries on the feed url + example: 5 + minimum: 0 + maximum: 5 + default: 5 + cache: + type: boolean + description: Toggle caching of feed url response + example: true + createdAt: + description: 'Datetime on which the feed was created' + type: string + format: date-time + example: '2022-10-06T05:03:47.053000000Z' + modifiedAt: + description: 'Datetime on which the feed was modified' + type: string + format: date-time + example: '2022-10-06T05:03:47.053000000Z' + createExternalFeed: + required: + - name + - url + type: object + properties: + name: + type: string + description: Name of the feed + example: New feed + url: + type: string + description: URL of the feed + format: url + example: http://requestb.in/173lyyx1 + authType: + type: string + enum: [basic, token, noAuth] + default: noAuth + description: > + Auth type of the feed: + * `basic` + * `token` + * `noAuth` + username: + type: string + description: Username for authType `basic` + example: user + password: + type: string + description: Password for authType `basic` + example: password + token: + type: string + description: Token for authType `token` + example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c + headers: + type: array + description: Custom headers for the feed + items: + type: object + properties: + name: + type: string + description: Name of the header + example: userId + value: + type: string + description: Value of the header + example: 'user12345' + example: + - name: header1 + value: value1 + - name: header2 + value: value2 + maxRetries: + type: integer + description: Maximum number of retries on the feed url + example: 5 + minimum: 0 + maximum: 5 + default: 5 + cache: + type: boolean + description: Toggle caching of feed url response + example: true + default: false + updateExternalFeed: + type: object + properties: + name: + type: string + description: Name of the feed + example: New feed + url: + type: string + description: URL of the feed + format: url + example: http://requestb.in/173lyyx1 + authType: + type: string + enum: [basic, token, noAuth] + description: > + Auth type of the feed: + * `basic` + * `token` + * `noAuth` + username: + type: string + description: Username for authType `basic` + example: user + password: + type: string + description: Password for authType `basic` + example: password + token: + type: string + description: Token for authType `token` + example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c + headers: + type: array + description: Custom headers for the feed + items: + type: object + properties: + name: + type: string + description: Name of the header + example: userId + value: + type: string + description: Value of the header + example: 'user12345' + example: + - name: header1 + value: value1 + - name: header2 + value: value2 + maxRetries: + type: integer + description: Maximum number of retries on the feed url + example: 5 + minimum: 0 + maximum: 5 + default: 5 + cache: + type: boolean + description: Toggle caching of feed url response + example: true + default: false + exportWebhooksHistory: + required: + - event + - notifyURL + - type + type: object + properties: + days: + type: integer + description: Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ + example: 7 + startDate: + type: string + description: Mandatory if endDate is used. Starting date of the history (YYYY-MM-DD). Must be lower than equal to endDate + example: 2023-02-13 + endDate: + type: string + description: Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate + example: 2023-02-17 + sort: + type: string + description: Sorting order of records (asc or desc) + example: desc + type: + type: string + description: Filter the history based on webhook type + example: transactional + enum: + - transactional + - marketing + event: + type: string + description: Filter the history for a specific event type + example: request + enum: + - invalid_parameter + - missing_parameter + - hardBounce + - softBounce + - delivered + - spam + - request + - opened + - click + - invalid + - deferred + - blocked + - unsubscribed + - error + - uniqueOpened + - loadedByProxy + - allEvents + notifyURL: + type: string + description: Webhook URL to receive CSV file link + example: https://brevo.com + webhookId: + type: integer + description: Filter the history for a specific webhook id + example: 2345 + email: + type: string + description: Filter the history for a specific email + example: example@brevo.com + messageId: + type: integer + description: Filter the history for a specific message id. Applicable only for transactional webhooks. + example: <23befbae-1505-47a8-bd27-e30ef739f32c@fr.sib> + + createPaymentRequest: + required: + - reference + - contactId + - cart + type: object + properties: + reference: + type: string + description: | + Reference of the payment request, it will appear on the payment page. + example: 'Invoice #INV0001' + cart: + $ref: '#/components/schemas/cart' + contactId: + type: integer + description: | + Brevo ID of the contact requested to pay. + format: int64 + example: 43 + description: + type: string + description: | + description of payment request + example: Shipping Cost for sending bottles to NYC + notification: + $ref: '#/components/schemas/notification' + configuration: + $ref: '#/components/schemas/configuration' + + configuration: + description: | + Optional. Redirect contact to a custom success page once payment is successful. If empty the default Brevo page will be displayed once a payment is validated + required: + - customSuccessUrl + properties: + customSuccessUrl: + type: string + format: url + description: | + Absolute URL of the custom success page. + example: https://my-company.com/payment-success + + + cart: + type: object + description: | + Specify the payment currency and amount. + required: + - currency + - specificAmount + properties: + currency: + type: string + description: | + Currency code for the payment amount. + example: EUR + enum: + - EUR + specificAmount: + type: integer + description: | + Payment amount, in cents. + e.g. if you want to request €12.00, then the amount in cents is 1200. + format: int64 + example: 1200 + + notification: + description: | + Optional. Use this object if you want to let Brevo send an email to the contact, with the payment request URL. If empty, no notifications (message and reminders) will be sent. + required: + - channel + - text + type: object + properties: + channel: + type: string + description: | + Channel used to send the notifications. + example: email + enum: + - email + text: + type: string + description: | + Use this field if you want to give more context to your contact about the payment request. + example: Please pay for your yoga class. + + getPaymentRequest: + type: object + properties: + reference: + type: string + description: | + Reference of the payment request, it will appear on the payment page. + example: | + Invoice #INV0001 + status: + type: string + description: Status of the payment request. + enum: + - created + - sent + - reminderSent + - paid + example: paid + configuration: + $ref: '#/components/schemas/configuration' + contactId: + type: integer + description: | + Brevo ID of the contact requested to pay. + format: int64 + example: 43 + numberOfRemindersSent: + type: integer + description: | + number of reminders sent. + format: int64 + example: 5 + cart: + $ref: '#/components/schemas/cart' + notification: + $ref: '#/components/schemas/notification' + + required: + - reference + - status + - cart + - notification + + responses: + createModel: + description: successfully created + content: + application/json: + schema: + $ref: '#/components/schemas/createModel' + createdProcessId: + description: process id created + content: + application/json: + schema: + $ref: '#/components/schemas/createdProcessId' + createdBatchId: + description: batch id created + content: + application/json: + schema: + $ref: '#/components/schemas/createdBatchId' + securitySchemes: + api-key: + type: apiKey + description: The API key should be passed in the request headers as `api-key` + for authentication. + name: api-key + in: header +x-samples-languages: +- curl From f7ab5846b19017945421fdd878fd3bed1ca50a22 Mon Sep 17 00:00:00 2001 From: Damien TUPINIER Date: Sun, 24 Nov 2024 19:44:20 +0100 Subject: [PATCH 4/8] Add partner-key security schema and format YAML structure --- swagger_definition_v3.yml | 10897 ++++++++++++++++++------------------ 1 file changed, 5452 insertions(+), 5445 deletions(-) diff --git a/swagger_definition_v3.yml b/swagger_definition_v3.yml index 36cbea4..ed31103 100644 --- a/swagger_definition_v3.yml +++ b/swagger_definition_v3.yml @@ -34,94 +34,95 @@ info: url: http://opensource.org/licenses/MIT version: 3.0.0 servers: -- url: https://api.brevo.com/v3 + - url: https://api.brevo.com/v3 security: -- api-key: [] + - api-key: [ ] + - partner-key: [ ] paths: /emailCampaigns: get: tags: - - Email Campaigns + - Email Campaigns summary: Return all your created email campaigns operationId: getEmailCampaigns parameters: - - name: type - in: query - description: Filter on the type of the campaigns - schema: - type: string - enum: - - classic - - trigger - - name: status - in: query - description: Filter on the status of the campaign - schema: - type: string - enum: - - suspended - - archive - - sent - - queued - - draft - - inProcess - - name : statistics - in : query - description : Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response.This option only returns data for events occurred in the last 6 months.For older campaigns, it’s advisable to use the **Get Campaign Report** endpoint. - schema: - type: string - enum: - - globalStats - - linksStats - - statsByDomain - - name: startDate - in: query - description: | - **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. - **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) - schema: - type: string - - name: endDate - in: query - description: | - **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. - **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) - schema: - type: string - - name: limit - in: query - description: Number of documents per page - schema: - maximum: 100 - minimum: 0 - type: integer - format: int64 - default: 50 - - name: offset - in: query - description: Index of the first document in the page - schema: - type: integer - format: int64 - default: 0 - - name: sort - in: query - description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc - - name: excludeHtmlContent - in : query - description: Use this flag to exclude htmlContent from the response body. If set to **true**, htmlContent field will be returned as empty string in the response body - schema : - type : boolean - enum : - - true - - false + - name: type + in: query + description: Filter on the type of the campaigns + schema: + type: string + enum: + - classic + - trigger + - name: status + in: query + description: Filter on the status of the campaign + schema: + type: string + enum: + - suspended + - archive + - sent + - queued + - draft + - inProcess + - name: statistics + in: query + description: Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response.This option only returns data for events occurred in the last 6 months.For older campaigns, it’s advisable to use the **Get Campaign Report** endpoint. + schema: + type: string + enum: + - globalStats + - linksStats + - statsByDomain + - name: startDate + in: query + description: | + **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. + **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. + **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) + schema: + type: string + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 100 + minimum: 0 + type: integer + format: int64 + default: 50 + - name: offset + in: query + description: Index of the first document in the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + - name: excludeHtmlContent + in: query + description: Use this flag to exclude htmlContent from the response body. If set to **true**, htmlContent field will be returned as empty string in the response body + schema: + type: boolean + enum: + - true + - false responses: 200: description: Email campaigns informations @@ -160,9 +161,9 @@ paths: recurring: false recipients: lists: - - 5 + - 5 exclusionLists: - - 13 + - 13 statistics: globalStats: uniqueClicks: 2300 @@ -179,19 +180,19 @@ paths: unsubscriptions: 2 viewed: 8999 campaignStats: - - listId: 5 - uniqueClicks: 2300 - clickers: 2665 - complaints: 1 - delivered: 19765 - sent: 19887 - softBounces: 100 - hardBounces: 87 - uniqueViews: 7779 - trackableViews: 5661 - unsubscriptions: 2 - viewed: 8999 - deferred: 30 + - listId: 5 + uniqueClicks: 2300 + clickers: 2665 + complaints: 1 + delivered: 19765 + sent: 19887 + softBounces: 100 + hardBounces: 87 + uniqueViews: 7779 + trackableViews: 5661 + unsubscriptions: 2 + viewed: 8999 + deferred: 30 mirrorClick: 120 remaining: 1000 linksStats: @@ -245,9 +246,9 @@ paths: recurring: false recipients: lists: - - 10 + - 10 exclusionLists: - - 45 + - 45 statistics: globalStats: uniqueClicks: 2300 @@ -264,19 +265,19 @@ paths: unsubscriptions: 2 viewed: 8999 campaignStats: - - listId: 10 - uniqueClicks: 2300 - clickers: 2665 - complaints: 1 - delivered: 19765 - sent: 19887 - softBounces: 100 - hardBounces: 87 - uniqueViews: 7779 - trackableViews: 5661 - unsubscriptions: 2 - viewed: 8999 - deferred: 30 + - listId: 10 + uniqueClicks: 2300 + clickers: 2665 + complaints: 1 + delivered: 19765 + sent: 19887 + softBounces: 100 + hardBounces: 87 + uniqueViews: 7779 + trackableViews: 5661 + unsubscriptions: 2 + viewed: 8999 + deferred: 30 mirrorClick: 120 remaining: 1000 linksStats: @@ -319,7 +320,7 @@ paths: $ref: '#/components/schemas/errorModel' post: tags: - - Email Campaigns + - Email Campaigns summary: Create an email campaign operationId: createEmailCampaign requestBody: @@ -341,29 +342,29 @@ paths: /emailCampaigns/{campaignId}: get: tags: - - Email Campaigns + - Email Campaigns summary: Get an email campaign report operationId: getEmailCampaign parameters: - - name: campaignId - in: path - description: Id of the campaign - required: true - schema: - type: integer - format: int64 - - name : statistics - in : query - description : Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. - required: false - schema: - type: string - enum: - - globalStats - - linksStats - - statsByDomain - - statsByDevice - - statsByBrowser + - name: campaignId + in: path + description: Id of the campaign + required: true + schema: + type: integer + format: int64 + - name: statistics + in: query + description: Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. + required: false + schema: + type: string + enum: + - globalStats + - linksStats + - statsByDomain + - statsByDevice + - statsByBrowser responses: 200: description: Email campaign informations @@ -400,9 +401,9 @@ paths: recurring: false recipients: lists: - - 22 + - 22 exclusionLists: - - 45 + - 45 statistics: globalStats: uniqueClicks: 2300 @@ -419,19 +420,19 @@ paths: unsubscriptions: 2 viewed: 8999 campaignStats: - - listId: 22 - uniqueClicks: 2300 - clickers: 2665 - complaints: 1 - delivered: 19765 - sent: 19887 - softBounces: 100 - hardBounces: 87 - uniqueViews: 7779 - trackableViews: 5661 - unsubscriptions: 2 - viewed: 8999 - deferred: 30 + - listId: 22 + uniqueClicks: 2300 + clickers: 2665 + complaints: 1 + delivered: 19765 + sent: 19887 + softBounces: 100 + hardBounces: 87 + uniqueViews: 7779 + trackableViews: 5661 + unsubscriptions: 2 + viewed: 8999 + deferred: 30 mirrorClick: 120 remaining: 1000 linksStats: @@ -502,17 +503,17 @@ paths: $ref: '#/components/schemas/errorModel' put: tags: - - Email Campaigns + - Email Campaigns summary: Update an email campaign operationId: updateEmailCampaign parameters: - - name: campaignId - in: path - description: Id of the campaign - required: true - schema: - type: integer - format: int64 + - name: campaignId + in: path + description: Id of the campaign + required: true + schema: + type: integer + format: int64 requestBody: description: Values to update a campaign content: @@ -523,7 +524,7 @@ paths: responses: 204: description: Email campaign updated - content: {} + content: { } 400: description: bad request content: @@ -538,21 +539,21 @@ paths: $ref: '#/components/schemas/errorModel' delete: tags: - - Email Campaigns + - Email Campaigns summary: Delete an email campaign operationId: deleteEmailCampaign parameters: - - name: campaignId - in: path - description: id of the campaign - required: true - schema: - type: integer - format: int64 + - name: campaignId + in: path + description: id of the campaign + required: true + schema: + type: integer + format: int64 responses: 204: description: Email campaign has been deleted - content: {} + content: { } 400: description: bad request content: @@ -568,21 +569,21 @@ paths: /emailCampaigns/{campaignId}/sendNow: post: tags: - - Email Campaigns + - Email Campaigns summary: Send an email campaign immediately, based on campaignId operationId: sendEmailCampaignNow parameters: - - name: campaignId - in: path - description: Id of the campaign - required: true - schema: - type: integer - format: int64 + - name: campaignId + in: path + description: Id of the campaign + required: true + schema: + type: integer + format: int64 responses: 204: description: Email campaign has been scheduled - content: {} + content: { } 400: description: Campaign could not be sent content: @@ -604,17 +605,17 @@ paths: /emailCampaigns/{campaignId}/sendTest: post: tags: - - Email Campaigns + - Email Campaigns summary: Send an email campaign to your test list operationId: sendTestEmail parameters: - - name: campaignId - in: path - description: Id of the campaign - required: true - schema: - type: integer - format: int64 + - name: campaignId + in: path + description: Id of the campaign + required: true + schema: + type: integer + format: int64 requestBody: content: application/json: @@ -624,7 +625,7 @@ paths: responses: 204: description: Test email has been sent successfully to all recipients - content: {} + content: { } 400: description: Test email could not be sent to the following email addresses content: @@ -640,17 +641,17 @@ paths: /emailCampaigns/{campaignId}/status: put: tags: - - Email Campaigns + - Email Campaigns summary: Update an email campaign status operationId: updateCampaignStatus parameters: - - name: campaignId - in: path - description: Id of the campaign - required: true - schema: - type: integer - format: int64 + - name: campaignId + in: path + description: Id of the campaign + required: true + schema: + type: integer + format: int64 requestBody: description: Status of the campaign content: @@ -661,7 +662,7 @@ paths: responses: 204: description: The campaign status has been updated successfully - content: {} + content: { } 400: description: bad request content: @@ -677,18 +678,18 @@ paths: /emailCampaigns/{campaignId}/sendReport: post: tags: - - Email Campaigns + - Email Campaigns summary: Send the report of a campaign description: A PDF will be sent to the specified email addresses operationId: sendReport parameters: - - name: campaignId - in: path - description: Id of the campaign - required: true - schema: - type: integer - format: int64 + - name: campaignId + in: path + description: Id of the campaign + required: true + schema: + type: integer + format: int64 requestBody: description: Values for send a report content: @@ -699,7 +700,7 @@ paths: responses: 204: description: Report has been successfully sent to the defined recipients - content: {} + content: { } 400: description: bad request content: @@ -715,18 +716,18 @@ paths: /emailCampaigns/{campaignId}/abTestCampaignResult: get: tags: - - Email Campaigns + - Email Campaigns summary: Get an A/B test email campaign results description: Obtain winning version of an A/B test email campaign operationId: getAbTestCampaignResult parameters: - - name: campaignId - in: path - description: Id of the A/B test campaign - required: true - schema: - type: integer - format: int64 + - name: campaignId + in: path + description: Id of the A/B test campaign + required: true + schema: + type: integer + format: int64 responses: 200: description: A/B test email campaign Result @@ -763,19 +764,19 @@ paths: Version B: 0% clickedLinks: Version A: - - link: https://google.com - clicksCount: 0 - clickRate: 0% - - link: https://youtube.com - clicksCount: 0 - clickRate: 0% + - link: https://google.com + clicksCount: 0 + clickRate: 0% + - link: https://youtube.com + clicksCount: 0 + clickRate: 0% Version B: - - link: http://www.github.com - clicksCount: 2 - clickRate: 40% - - link: http://www.stackoverflow.com - clicksCount: 3 - clickRate: 60% + - link: http://www.github.com + clicksCount: 2 + clickRate: 40% + - link: http://www.stackoverflow.com + clicksCount: 3 + clickRate: 60% 400: description: bad request content: @@ -791,19 +792,19 @@ paths: /emailCampaigns/{campaignId}/sharedUrl: get: tags: - - Email Campaigns + - Email Campaigns summary: Get a shared template url description: Get a unique URL to share & import an email template from one Brevo account to another. operationId: getSharedTemplateUrl parameters: - - name: campaignId - in: path - description: Id of the campaign or template - required: true - schema: - type: integer - format: int64 + - name: campaignId + in: path + description: Id of the campaign or template + required: true + schema: + type: integer + format: int64 responses: 200: description: Shared template URL information @@ -836,17 +837,17 @@ paths: /emailCampaigns/{campaignId}/exportRecipients: post: tags: - - Email Campaigns + - Email Campaigns summary: Export the recipients of an email campaign operationId: emailExportRecipients parameters: - - name: campaignId - in: path - description: Id of the campaign - required: true - schema: - type: integer - format: int64 + - name: campaignId + in: path + description: Id of the campaign + required: true + schema: + type: integer + format: int64 requestBody: description: Values to send for a recipient export request content: @@ -872,7 +873,7 @@ paths: /emailCampaigns/images: post: tags: - - Email Campaigns + - Email Campaigns summary: Upload an image to your account's image gallery operationId: uploadImageToGallery requestBody: @@ -902,7 +903,7 @@ paths: /smtp/email: post: tags: - - Transactional emails + - Transactional emails summary: Send a transactional email operationId: sendTransacEmail requestBody: @@ -942,94 +943,94 @@ paths: /smtp/emails: get: tags: - - Transactional emails + - Transactional emails summary: Get the list of transactional emails on the basis of allowed filters description: This endpoint will show the list of emails for past 30 days by default. To retrieve emails before that time, please pass startDate and endDate in query filters. operationId: getTransacEmailsList parameters: - - name: email - in: query - description: | - **Mandatory if templateId and messageId are not passed in query filters.** Email address to which transactional email has been sent. - schema: - type: string - - name: templateId - in: query - description: | - **Mandatory if email and messageId are not passed in query filters.** Id of the template that was used to compose transactional email. - schema: - type: integer - format: int64 - - name: messageId - in: query - description: | - **Mandatory if templateId and email are not passed in query filters.** Message ID of the transactional email sent. - schema: - type: string - - name: startDate - in: query - description: | - **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the list. **Maximum time period that can be selected is one month**. - schema: - type: string - - name: endDate - in: query - description: | - **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the list. **Maximum time period that can be selected is one month.** - schema: - type: string - - name: sort - in: query - description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc - - name: limit - in: query - description: Number of documents returned per page - schema: - maximum: 1000 - minimum: 0 - type: integer - format: int64 - default: 500 - - name: offset - in: query - description: Index of the first document in the page - schema: - type: integer - format: int64 - default: 0 - responses: - 200: - description: List of transactional emails - content: - application/json: - schema: + - name: email + in: query + description: | + **Mandatory if templateId and messageId are not passed in query filters.** Email address to which transactional email has been sent. + schema: + type: string + - name: templateId + in: query + description: | + **Mandatory if email and messageId are not passed in query filters.** Id of the template that was used to compose transactional email. + schema: + type: integer + format: int64 + - name: messageId + in: query + description: | + **Mandatory if templateId and email are not passed in query filters.** Message ID of the transactional email sent. + schema: + type: string + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the list. **Maximum time period that can be selected is one month**. + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the list. **Maximum time period that can be selected is one month.** + schema: + type: string + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + - name: limit + in: query + description: Number of documents returned per page + schema: + maximum: 1000 + minimum: 0 + type: integer + format: int64 + default: 500 + - name: offset + in: query + description: Index of the first document in the page + schema: + type: integer + format: int64 + default: 0 + responses: + 200: + description: List of transactional emails + content: + application/json: + schema: $ref: '#/components/schemas/getTransacEmailsList' examples: response: value: count: 120 transactionalEmails: - - email: abc@xyz.com - subject: summer camp - templateId: 15 - messageId: <201798300811.5787683@relay.domain.com> - uuid: 5a78c-209ok98262910-std2341 - date: 2019-05-25T11:53:26Z - - email: test@test.com - subject: details verification - templateId: 15 - messageId: <201798300811.5700093@relay.domain.com> - uuid: 5a78c-209ok98262910-s99a341 - date: 2019-05-25T07:28:11Z + - email: abc@xyz.com + subject: summer camp + templateId: 15 + messageId: <201798300811.5787683@relay.domain.com> + uuid: 5a78c-209ok98262910-std2341 + date: 2019-05-25T11:53:26Z + - email: test@test.com + subject: details verification + templateId: 15 + messageId: <201798300811.5700093@relay.domain.com> + uuid: 5a78c-209ok98262910-s99a341 + date: 2019-05-25T07:28:11Z 400: description: bad request content: @@ -1039,17 +1040,17 @@ paths: /smtp/emails/{uuid}: get: tags: - - Transactional emails + - Transactional emails summary: Get the personalized content of a sent transactional email operationId: getTransacEmailContent parameters: - - name: uuid - in: path - description: Unique id of the transactional email that has been sent to a - particular contact - required: true - schema: - type: string + - name: uuid + in: path + description: Unique id of the transactional email that has been sent to a + particular contact + required: true + schema: + type: string responses: 200: description: Transactional email content @@ -1065,30 +1066,30 @@ paths: templateId: 12 date: 2016-02-25T11:53:26Z events: - - name: sent - time: 2016-02-25T11:53:26Z - - name: delivered - time: 2016-02-25T11:55:26Z - - name: opened - time: 2016-02-26T09:53:26Z + - name: sent + time: 2016-02-25T11:53:26Z + - name: delivered + time: 2016-02-25T11:55:26Z + - name: opened + time: 2016-02-26T09:53:26Z body:

Greetings from the team

This is the actual html content sent

/smtp/log/{identifier}: delete: tags: - - Transactional emails + - Transactional emails summary: Delete an SMTP transactional log parameters: - - name: identifier - in: path - description: MessageId or Email of the transactional log(s) to delete - required: true - schema: - type: string + - name: identifier + in: path + description: MessageId or Email of the transactional log(s) to delete + required: true + schema: + type: string responses: 204: description: Transactional Logs deleted - content: {} + content: { } 400: description: bad request content: @@ -1104,42 +1105,42 @@ paths: /smtp/templates: get: tags: - - Transactional emails + - Transactional emails summary: Get the list of email templates operationId: getSmtpTemplates parameters: - - name: templateStatus - in: query - description: Filter on the status of the template. Active = true, inactive - = false - schema: - type: boolean - - name: limit - in: query - description: Number of documents returned per page - schema: - maximum: 1000 - minimum: 0 - type: integer - format: int64 - default: 50 - - name: offset - in: query - description: Index of the first document in the page - schema: - type: integer - format: int64 - default: 0 - - name: sort - in: query - description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc + - name: templateStatus + in: query + description: Filter on the status of the template. Active = true, inactive + = false + schema: + type: boolean + - name: limit + in: query + description: Number of documents returned per page + schema: + maximum: 1000 + minimum: 0 + type: integer + format: int64 + default: 50 + - name: offset + in: query + description: Index of the first document in the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc responses: 200: description: transactional email templates informations @@ -1190,7 +1191,7 @@ paths: $ref: '#/components/schemas/errorModel' post: tags: - - Transactional emails + - Transactional emails summary: Create an email template operationId: createSmtpTemplate requestBody: @@ -1213,17 +1214,17 @@ paths: /smtp/templates/{templateId}: get: tags: - - Transactional emails + - Transactional emails summary: Returns the template information operationId: getSmtpTemplate parameters: - - name: templateId - in: path - description: id of the template - required: true - schema: - type: integer - format: int64 + - name: templateId + in: path + description: id of the template + required: true + schema: + type: integer + format: int64 responses: 200: description: Email template informations @@ -1264,17 +1265,17 @@ paths: $ref: '#/components/schemas/errorModel' put: tags: - - Transactional emails + - Transactional emails summary: Update an email template operationId: updateSmtpTemplate parameters: - - name: templateId - in: path - description: id of the template - required: true - schema: - type: integer - format: int64 + - name: templateId + in: path + description: id of the template + required: true + schema: + type: integer + format: int64 requestBody: description: values to update in transactional email template content: @@ -1285,7 +1286,7 @@ paths: responses: 204: description: transactional email template updated - content: {} + content: { } 400: description: bad request content: @@ -1300,21 +1301,21 @@ paths: $ref: '#/components/schemas/errorModel' delete: tags: - - Transactional emails + - Transactional emails summary: Delete an inactive email template operationId: deleteSmtpTemplate parameters: - - name: templateId - in: path - description: id of the template - required: true - schema: - type: integer - format: int64 + - name: templateId + in: path + description: id of the template + required: true + schema: + type: integer + format: int64 responses: 204: description: Inactive transactional email template has been deleted - content: {} + content: { } 400: description: bad request content: @@ -1330,17 +1331,17 @@ paths: /smtp/templates/{templateId}/sendTest: post: tags: - - Transactional emails + - Transactional emails summary: Send a template to your test list operationId: sendTestTemplate parameters: - - name: templateId - in: path - description: Id of the template - required: true - schema: - type: integer - format: int64 + - name: templateId + in: path + description: Id of the template + required: true + schema: + type: integer + format: int64 requestBody: content: application/json: @@ -1350,7 +1351,7 @@ paths: responses: 204: description: Test email has been sent successfully to all recipients - content: {} + content: { } 400: description: Test email could not be sent to the following email addresses content: @@ -1366,35 +1367,35 @@ paths: /smtp/statistics/aggregatedReport: get: tags: - - Transactional emails + - Transactional emails summary: Get your transactional email activity aggregated over a period of time description: This endpoint will show the aggregated stats for past 90 days by default if `startDate` and `endDate` OR `days` is not passed. The date range can not exceed 90 days operationId: getAggregatedSmtpReport parameters: - - name: startDate - in: query - description: | - **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate - schema: - type: string - - name: endDate - in: query - description: | - **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate - schema: - type: string - - name: days - in: query - description: | - Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ - schema: - type: integer - format: int64 - - name: tag - in: query - description: Tag of the emails - schema: - type: string + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate + schema: + type: string + - name: days + in: query + description: | + Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ + schema: + type: integer + format: int64 + - name: tag + in: query + description: Tag of the emails + schema: + type: string responses: 200: description: Aggregated report informations @@ -1427,60 +1428,60 @@ paths: /smtp/statistics/reports: get: tags: - - Transactional emails + - Transactional emails summary: Get your transactional email activity aggregated per day operationId: getSmtpReport parameters: - - name: limit - in: query - description: Number of documents returned per page - schema: - maximum: 30 - minimum: 0 - type: integer - format: int64 - default: 10 - - name: offset - in: query - description: Index of the first document on the page - schema: - type: integer - format: int64 - default: 0 - - name: startDate - in: query - description: | - **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD) - schema: - type: string - - name: endDate - in: query - description: | - **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD) - schema: - type: string - - name: days - in: query - description: | - Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ - schema: - type: integer - format: int64 - - name: tag - in: query - description: Tag of the emails - schema: - type: string - - name: sort - in: query - description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc + - name: limit + in: query + description: Number of documents returned per page + schema: + maximum: 30 + minimum: 0 + type: integer + format: int64 + default: 10 + - name: offset + in: query + description: Index of the first document on the page + schema: + type: integer + format: int64 + default: 0 + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD) + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD) + schema: + type: string + - name: days + in: query + description: | + Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ + schema: + type: integer + format: int64 + - name: tag + in: query + description: Tag of the emails + schema: + type: string + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc responses: 200: description: Aggregated report informations @@ -1527,104 +1528,104 @@ paths: /smtp/statistics/events: get: tags: - - Transactional emails + - Transactional emails summary: Get all your transactional email activity (unaggregated events) description: This endpoint will show the aggregated stats for past 30 days by default if `startDate` and `endDate` OR `days` is not passed. The date range can not exceed 90 days operationId: getEmailEventReport parameters: - - name: limit - in: query - description: Number limitation for the result returned - schema: - maximum: 5000 - type: integer - format: int64 - default: 2500 - minimum: 0 - - name: offset - in: query - description: Beginning point in the list to retrieve from. - schema: - type: integer - format: int64 - default: 0 - - name: startDate - in: query - description: | - **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate - schema: - type: string - - name: endDate - in: query - description: | - **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate - schema: - type: string - - name: days - in: query - description: | - Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ - schema: - type: integer - format: int64 - - name: email - in: query - description: Filter the report for a specific email addresses - schema: - type: string - format: email - - name: event - in: query - description: Filter the report for a specific event type - schema: - type: string - enum: - - bounces - - hardBounces - - softBounces - - delivered - - spam - - requests - - opened - - clicks - - invalid - - deferred - - blocked - - unsubscribed - - error - - loadedByProxy - - name: tags - in: query - description: Filter the report for tags (serialized and urlencoded array). To pass multiple tags, a format of string separated by commas is used such as **"one, two, three"** - schema: - type: string - - name: messageId - in: query - description: Filter on a specific message id - schema: - type: string - - name: templateId - in: query - description: Filter on a specific template id - schema: - type: integer - format: int64 - - name: sort - in: query - description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc - responses: - 200: - description: Email events report informations - content: - application/json: - schema: + - name: limit + in: query + description: Number limitation for the result returned + schema: + maximum: 5000 + type: integer + format: int64 + default: 2500 + minimum: 0 + - name: offset + in: query + description: Beginning point in the list to retrieve from. + schema: + type: integer + format: int64 + default: 0 + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate + schema: + type: string + - name: days + in: query + description: | + Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ + schema: + type: integer + format: int64 + - name: email + in: query + description: Filter the report for a specific email addresses + schema: + type: string + format: email + - name: event + in: query + description: Filter the report for a specific event type + schema: + type: string + enum: + - bounces + - hardBounces + - softBounces + - delivered + - spam + - requests + - opened + - clicks + - invalid + - deferred + - blocked + - unsubscribed + - error + - loadedByProxy + - name: tags + in: query + description: Filter the report for tags (serialized and urlencoded array). To pass multiple tags, a format of string separated by commas is used such as **"one, two, three"** + schema: + type: string + - name: messageId + in: query + description: Filter on a specific message id + schema: + type: string + - name: templateId + in: query + description: Filter on a specific template id + schema: + type: integer + format: int64 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + responses: + 200: + description: Email events report informations + content: + application/json: + schema: $ref: '#/components/schemas/getEmailEventReport' examples: response: @@ -1654,19 +1655,19 @@ paths: /smtp/blockedContacts/{email}: delete: tags: - - Transactional emails + - Transactional emails summary: Unblock or resubscribe a transactional contact parameters: - - name: email - in: path - description: contact email (urlencoded) to unblock. - required: true - schema: - type: string + - name: email + in: path + description: contact email (urlencoded) to unblock. + required: true + schema: + type: string responses: 204: description: Contact unblocked - content: {} + content: { } 400: description: bad request content: @@ -1682,58 +1683,58 @@ paths: /smtp/blockedContacts: get: tags: - - Transactional emails + - Transactional emails summary: Get the list of blocked or unsubscribed transactional contacts operationId: getTransacBlockedContacts parameters: - - name: startDate - in: query - description: | - **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the blocked or unsubscribed contacts - schema: - type: string - - name: endDate - in: query - description: | - **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the blocked or unsubscribed contacts - schema: - type: string - - name: limit - in: query - description: Number of documents returned per page - schema: - maximum: 100 - type: integer - format: int64 - default: 50 - minimum: 0 - - name: offset - in: query - description: Index of the first document on the page - schema: - type: integer - format: int64 - default: 0 - - name: senders - in: query - description: Comma separated list of emails of the senders from which contacts - are blocked or unsubscribed - style: form - explode: false - schema: - type: array - items: + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the blocked or unsubscribed contacts + schema: type: string - - name: sort - in: query - description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the blocked or unsubscribed contacts + schema: + type: string + - name: limit + in: query + description: Number of documents returned per page + schema: + maximum: 100 + type: integer + format: int64 + default: 50 + minimum: 0 + - name: offset + in: query + description: Index of the first document on the page + schema: + type: integer + format: int64 + default: 0 + - name: senders + in: query + description: Comma separated list of emails of the senders from which contacts + are blocked or unsubscribed + style: form + explode: false + schema: + type: array + items: + type: string + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc responses: 200: description: List of blocked or unsubscribed transactional contacts @@ -1794,7 +1795,7 @@ paths: responses: 201: description: Domain is successfully blocked - content: {} + content: { } 400: description: bad request content: @@ -1818,7 +1819,7 @@ paths: responses: 204: description: Domain is successfully deleted from the list of blocked domains - content: {} + content: { } 404: description: Domain not found content: @@ -1834,7 +1835,7 @@ paths: /smtp/deleteHardbounces: post: tags: - - Transactional emails + - Transactional emails summary: Delete hardbounces description: Delete hardbounces. To use carefully (e.g. in case of temporary ISP failures) @@ -1849,7 +1850,7 @@ paths: responses: 204: description: Hardbounces deleted - content: {} + content: { } 400: description: bad request content: @@ -1859,7 +1860,7 @@ paths: /smtp/emailStatus/{identifier}: get: tags: - - Transactional emails + - Transactional emails summary: Fetch scheduled emails by batchId or messageId description: Fetch scheduled batch of emails by batchId or single scheduled email by messageId (Can retrieve data upto 30 days old) operationId: getScheduledEmailById @@ -1931,7 +1932,7 @@ paths: example: 0 schema: type: integer - format : int64 + format: int64 default: 0 responses: 200: @@ -1948,29 +1949,29 @@ paths: { "count": 3, "batches": [ - { - "scheduledAt": "2022-02-28T11:36:43.576000000Z", - "createdAt": "2022-02-26T11:36:43.576000000Z", - "status": "queued" - }, - { - "scheduledAt": "2022-02-25T11:36:43.576000000Z", - "createdAt": "2022-02-24T11:36:43.576000000Z", - "status": "processed" - }, - { - "scheduledAt": "2022-02-26T11:36:43.576000000Z", - "createdAt": "2022-02-25T11:36:43.576000000Z", - "status": "inProgress" - } + { + "scheduledAt": "2022-02-28T11:36:43.576000000Z", + "createdAt": "2022-02-26T11:36:43.576000000Z", + "status": "queued" + }, + { + "scheduledAt": "2022-02-25T11:36:43.576000000Z", + "createdAt": "2022-02-24T11:36:43.576000000Z", + "status": "processed" + }, + { + "scheduledAt": "2022-02-26T11:36:43.576000000Z", + "createdAt": "2022-02-25T11:36:43.576000000Z", + "status": "inProgress" + } ] } messageId: value: { - "scheduledAt": "2022-02-28T11:36:43.576000000Z", - "createdAt": "2022-02-26T11:36:43.576000000Z", - "status": "queued" + "scheduledAt": "2022-02-28T11:36:43.576000000Z", + "createdAt": "2022-02-26T11:36:43.576000000Z", + "status": "queued" } 400: description: Invalid parameters passed @@ -1987,7 +1988,7 @@ paths: /smtp/email/{identifier}: delete: tags: - - Transactional emails + - Transactional emails summary: Delete scheduled emails by batchId or messageId description: Delete scheduled batch of emails by batchId or single scheduled email by messageId operationId: deleteScheduledEmailById @@ -2008,7 +2009,7 @@ paths: responses: 204: description: Scheduled email(s) deleted - content: {} + content: { } 400: description: Invalid parameters passed content: @@ -2024,68 +2025,68 @@ paths: /contacts: get: tags: - - Contacts + - Contacts summary: Get all the contacts operationId: getContacts parameters: - - name: limit - in: query - description: Number of documents per page - schema: - maximum: 1000 - minimum: 0 - type: integer - format: int64 - default: 50 - - name: offset - in: query - description: Index of the first document of the page - schema: - type: integer - format: int64 - default: 0 - - name: modifiedSince - in: query - description: | - 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.** - schema: - type: string - - name: createdSince - in: query - description: | - Filter (urlencoded) the contacts created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** - schema: - type: string - - name: sort - in: query - description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc - - name: segmentId - in: query - description: Id of the segment. **Either listIds or segmentId can be passed.** - schema: - type: integer - format: int64 - - name: listIds - in: query - description: Ids of the list. **Either listIds or segmentId can be passed.** - schema: - type: array - items: + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 1000 + minimum: 0 type: integer format: int64 - - name: filter - in: query - description: | - Filter the contacts on the basis of attributes. **Allowed operator: equals. (e.g. filter=equals(FIRSTNAME,"Antoine"), filter=equals(B1, true), filter=equals(DOB, "1989-11-23"))** - schema: - type: string + default: 50 + - name: offset + in: query + description: Index of the first document of the page + schema: + type: integer + format: int64 + default: 0 + - name: modifiedSince + in: query + description: | + 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.** + schema: + type: string + - name: createdSince + in: query + description: | + Filter (urlencoded) the contacts created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** + schema: + type: string + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + - name: segmentId + in: query + description: Id of the segment. **Either listIds or segmentId can be passed.** + schema: + type: integer + format: int64 + - name: listIds + in: query + description: Ids of the list. **Either listIds or segmentId can be passed.** + schema: + type: array + items: + type: integer + format: int64 + - name: filter + in: query + description: | + Filter the contacts on the basis of attributes. **Allowed operator: equals. (e.g. filter=equals(FIRSTNAME,"Antoine"), filter=equals(B1, true), filter=equals(DOB, "1989-11-23"))** + schema: + type: string responses: 200: description: All contacts listed @@ -2096,7 +2097,7 @@ paths: examples: response: value: - contacts: + contacts: - email: contact1@example.com id: 247 emailBlacklisted: true @@ -2104,8 +2105,8 @@ paths: createdAt: 2017-05-01T17:05:03Z modifiedAt: 2017-05-01T17:05:03Z listIds: - - 43 - - 58 + - 43 + - 58 attributes: SMS: "33058407250" IDENTIFICATION: 1-3RHQ-259 @@ -2124,9 +2125,9 @@ paths: createdAt: 2017-05-01T17:05:03Z modifiedAt: 2017-05-01T17:05:03Z listIds: - - 43 - - 61 - - 58 + - 43 + - 61 + - 58 attributes: SMS: "33058407248" IDENTIFICATION: 1-78JS-432 @@ -2138,7 +2139,7 @@ paths: ZIP_CODE: "44119" CITY: Seattle ACTION_CODE: 17HU765 - count: 3 + count: 3 400: description: bad request content: @@ -2153,7 +2154,7 @@ paths: $ref: '#/components/schemas/errorModel' post: tags: - - Contacts + - Contacts summary: Create a contact description: Creates new contacts on Brevo. Contacts can be created by passing either -

1. email address of the contact (email_id),
@@ -2180,7 +2181,7 @@ paths: id: 21 204: description: Contact updated - content: {} + content: { } 400: description: bad request content: @@ -2196,7 +2197,7 @@ paths: /contacts/doubleOptinConfirmation: post: tags: - - Contacts + - Contacts summary: Create Contact via DOI (Double-Opt-In) Flow operationId: createDoiContact requestBody: @@ -2209,10 +2210,10 @@ paths: responses: 201: description: DOI Contact created - content: {} + content: { } 204: description: DOI Contact updated - content: {} + content: { } 400: description: bad request content: @@ -2223,7 +2224,7 @@ paths: /contacts/{identifier}: get: tags: - - Contacts + - Contacts summary: Get a contact's details description: There are 2 ways to get a contact

Option 1- https://api.brevo.com/v3/contacts/{identifier}

@@ -2233,38 +2234,38 @@ paths: Option 2 works for all identifierType, use email_id for EMAIL attribute, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute

Along with the contact details, this endpoint will show the statistics of contact for the recent 90 days by default. To fetch the earlier statistics, please use Get contact campaign stats ``https://developers.brevo.com/reference/contacts-7#getcontactstats`` endpoint with the appropriate date ranges. operationId: getContactInfo parameters: - - name: identifier - in: path - description: Email (urlencoded) OR ID of the contact OR its SMS attribute value OR EXT_ID attribute (urlencoded) - required: true - schema: - oneOf: - - type: string - - type: integer - - name: identifierType - in: query - description: email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute - schema: - type: string - enum: - - email_id - - phone_id - - contact_id - - ext_id - - whatsapp_id - - landline_number_id - - name: startDate - in: query - description: | - **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate - schema: - type: string - - name: endDate - in: query - description: | - **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. - schema: - type: string + - name: identifier + in: path + description: Email (urlencoded) OR ID of the contact OR its SMS attribute value OR EXT_ID attribute (urlencoded) + required: true + schema: + oneOf: + - type: string + - type: integer + - name: identifierType + in: query + description: email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute + schema: + type: string + enum: + - email_id + - phone_id + - contact_id + - ext_id + - whatsapp_id + - landline_number_id + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. + schema: + type: string responses: 200: description: Contact informations @@ -2292,34 +2293,34 @@ paths: CITY: New-York AREA: NY listIds: - - 40 + - 40 statistics: messagesSent: - - campaignId: 21 - eventTime: 2016-05-03T20:15:13Z - - campaignId: 42 - eventTime: 2016-10-17T10:30:01Z + - campaignId: 21 + eventTime: 2016-05-03T20:15:13Z + - campaignId: 42 + eventTime: 2016-10-17T10:30:01Z opened: - - campaignId: 21 - count: 2 - eventTime: 2016-05-03T21:24:56Z - ip: 66.249.93.118 - - campaignId: 68 - count: 1 - eventTime: 2017-01-30T13:56:40Z - ip: 66.249.93.217 - clicked: - - campaignId: 21 - links: - - count: 2 - eventTime: 2016-05-03T21:25:01Z + - campaignId: 21 + count: 2 + eventTime: 2016-05-03T21:24:56Z ip: 66.249.93.118 - url: https://url.domain.com/fbe5387ec717e333628380454f68670010b205ff/1/go?uid={EMAIL}&utm_source=brevo&utm_campaign=test_camp&utm_medium=email + - campaignId: 68 + count: 1 + eventTime: 2017-01-30T13:56:40Z + ip: 66.249.93.217 + clicked: + - campaignId: 21 + links: + - count: 2 + eventTime: 2016-05-03T21:25:01Z + ip: 66.249.93.118 + url: https://url.domain.com/fbe5387ec717e333628380454f68670010b205ff/1/go?uid={EMAIL}&utm_source=brevo&utm_campaign=test_camp&utm_medium=email delivered: - - campaignId: 21 - count: 2 - eventTime: 2016-05-03T21:24:56Z - ip: 66.249.93.118 + - campaignId: 21 + count: 2 + eventTime: 2016-05-03T21:24:56Z + ip: 66.249.93.118 400: description: bad request content: @@ -2334,7 +2335,7 @@ paths: $ref: '#/components/schemas/errorModel' delete: tags: - - Contacts + - Contacts summary: Delete a contact description: There are 2 ways to delete a contact

Option 1- https://api.brevo.com/v3/contacts/{identifier}

@@ -2344,34 +2345,34 @@ paths: Option 2 works for all identifierType, use email_id for EMAIL attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute. operationId: deleteContact parameters: - - name: identifier - in: path - description: Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) - required: true - schema: - oneOf: - - type: string - - type: integer - - name: identifierType - in: query - description: email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute - schema: - type: string - enum: - - email_id - - contact_id - - ext_id - - phone_id - - whatsapp_id - - landline_number_id - responses: - 204: - description: Contact deleted - content: {} - 400: - description: bad request - content: - application/json: + - name: identifier + in: path + description: Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) + required: true + schema: + oneOf: + - type: string + - type: integer + - name: identifierType + in: query + description: email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute + schema: + type: string + enum: + - email_id + - contact_id + - ext_id + - phone_id + - whatsapp_id + - landline_number_id + responses: + 204: + description: Contact deleted + content: { } + 400: + description: bad request + content: + application/json: schema: $ref: '#/components/schemas/errorModel' 404: @@ -2389,7 +2390,7 @@ paths: $ref: '#/components/schemas/errorModel' put: tags: - - Contacts + - Contacts summary: Update a contact description: There are 2 ways to update a contact

Option 1- https://api.brevo.com/v3/contacts/{identifier}

@@ -2399,26 +2400,26 @@ paths: Option 2 works for all identifierType, use email_id for EMAIL attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute operationId: updateContact parameters: - - name: identifier - in: path - description: Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value - required: true - schema: - oneOf: - - type: string - - type: integer - - name: identifierType - in: query - description: email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute - schema: - type: string - enum: - - email_id - - contact_id - - ext_id - - phone_id - - whatsapp_id - - landline_number_id + - name: identifier + in: path + description: Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value + required: true + schema: + oneOf: + - type: string + - type: integer + - name: identifierType + in: query + description: email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute + schema: + type: string + enum: + - email_id + - contact_id + - ext_id + - phone_id + - whatsapp_id + - landline_number_id requestBody: description: Values to update a contact content: @@ -2429,7 +2430,7 @@ paths: responses: 204: description: Contact updated - content: {} + content: { } 400: description: bad request content: @@ -2452,7 +2453,7 @@ paths: /contacts/batch: post: tags: - - Contacts + - Contacts summary: Update multiple contacts operationId: updateBatchContacts requestBody: @@ -2465,7 +2466,7 @@ paths: responses: 204: description: All contacts updated - content: {} + content: { } 400: description: bad request content: @@ -2475,30 +2476,30 @@ paths: /contacts/{identifier}/campaignStats: get: tags: - - Contacts + - Contacts summary: Get email campaigns' statistics for a contact operationId: getContactStats parameters: - - name: identifier - in: path - description: Email (urlencoded) OR ID of the contact - required: true - schema: - oneOf: - - type: string - - type: integer - - name: startDate - in: query - description: | - **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate - schema: - type: string - - name: endDate - in: query - description: | - **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days - schema: - type: string + - name: identifier + in: path + description: Email (urlencoded) OR ID of the contact + required: true + schema: + oneOf: + - type: string + - type: integer + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days + schema: + type: string responses: 200: description: Contact campaign statistics informations @@ -2510,33 +2511,33 @@ paths: response: value: messagesSent: - - campaignId: 21 - eventTime: 2016-05-03T20:15:13Z - - campaignId: 42 - eventTime: 2016-10-17T10:30:01Z - - campaignId: 45 - eventTime: 2016-11-09T11:45:02Z + - campaignId: 21 + eventTime: 2016-05-03T20:15:13Z + - campaignId: 42 + eventTime: 2016-10-17T10:30:01Z + - campaignId: 45 + eventTime: 2016-11-09T11:45:02Z opened: - - campaignId: 21 - count: 2 - eventTime: 2016-05-03T21:24:56Z - ip: 66.249.93.118 - - campaignId: 45 - count: 1 - eventTime: 2017-01-30T13:56:40Z - ip: 66.249.93.217 - clicked: - - campaignId: 21 - links: - - count: 2 - eventTime: 2016-05-03T21:25:01Z + - campaignId: 21 + count: 2 + eventTime: 2016-05-03T21:24:56Z ip: 66.249.93.118 - url: https://url.domain.com/fbe5387ec717e333628380454f68670010b205ff/1/go?uid={EMAIL}&utm_source=brevo&utm_campaign=test_camp&utm_medium=email + - campaignId: 45 + count: 1 + eventTime: 2017-01-30T13:56:40Z + ip: 66.249.93.217 + clicked: + - campaignId: 21 + links: + - count: 2 + eventTime: 2016-05-03T21:25:01Z + ip: 66.249.93.118 + url: https://url.domain.com/fbe5387ec717e333628380454f68670010b205ff/1/go?uid={EMAIL}&utm_source=brevo&utm_campaign=test_camp&utm_medium=email delivered: - - campaignId: 21 - count: 2 - eventTime: 2016-05-03T21:24:56Z - ip: 66.249.93.118 + - campaignId: 21 + count: 2 + eventTime: 2016-05-03T21:24:56Z + ip: 66.249.93.118 400: description: bad request content: @@ -2552,7 +2553,7 @@ paths: /contacts/attributes: get: tags: - - Contacts + - Contacts summary: List all attributes operationId: getAttributes responses: @@ -2566,49 +2567,49 @@ paths: response: value: attributes: - - name: LASTNAME - category: normal - type: text - - name: FIRSTNAME - category: normal - type: text - - name: DOB - category: normal - type: date - - name: GENDER - category: category - type: text - enumeration: - - value: 1 - label: Men - - value: 2 - label: Women - - value: 3 - label: Kid + - name: LASTNAME + category: normal + type: text + - name: FIRSTNAME + category: normal + type: text + - name: DOB + category: normal + type: date + - name: GENDER + category: category + type: text + enumeration: + - value: 1 + label: Men + - value: 2 + label: Women + - value: 3 + label: Kid /contacts/attributes/{attributeCategory}/{attributeName}: put: tags: - - Contacts + - Contacts summary: Update contact attribute operationId: updateAttribute parameters: - - name: attributeCategory - in: path - description: Category of the attribute - required: true - schema: - type: string - enum: - - category - - calculated - - global - - normal - - name: attributeName - in: path - description: Name of the existing attribute - required: true - schema: - type: string + - name: attributeCategory + in: path + description: Category of the attribute + required: true + schema: + type: string + enum: + - category + - calculated + - global + - normal + - name: attributeName + in: path + description: Name of the existing attribute + required: true + schema: + type: string requestBody: description: Values to update an attribute content: @@ -2619,7 +2620,7 @@ paths: responses: 204: description: Attribute updated - content: {} + content: { } 400: description: bad request content: @@ -2635,28 +2636,28 @@ paths: x-codegen-request-body-name: updateAttribute post: tags: - - Contacts + - Contacts summary: Create contact attribute operationId: createAttribute parameters: - - name: attributeCategory - in: path - description: Category of the attribute - required: true - schema: - type: string - enum: - - normal - - transactional - - category - - calculated - - global - - name: attributeName - in: path - description: Name of the attribute - required: true - schema: - type: string + - name: attributeCategory + in: path + description: Category of the attribute + required: true + schema: + type: string + enum: + - normal + - transactional + - category + - calculated + - global + - name: attributeName + in: path + description: Name of the attribute + required: true + schema: + type: string requestBody: description: Values to create an attribute content: @@ -2667,7 +2668,7 @@ paths: responses: 201: description: Attribute created - content: {} + content: { } 400: description: bad request content: @@ -2676,32 +2677,32 @@ paths: $ref: '#/components/schemas/errorModel' delete: tags: - - Contacts + - Contacts summary: Delete an attribute operationId: deleteAttribute parameters: - - name: attributeCategory - in: path - description: Category of the attribute - required: true - schema: - type: string - enum: - - normal - - transactional - - category - - calculated - - global - - name: attributeName - in: path - description: Name of the existing attribute - required: true - schema: - type: string + - name: attributeCategory + in: path + description: Category of the attribute + required: true + schema: + type: string + enum: + - normal + - transactional + - category + - calculated + - global + - name: attributeName + in: path + description: Name of the existing attribute + required: true + schema: + type: string responses: 204: description: Attribute deleted - content: {} + content: { } 400: description: bad request content: @@ -2717,30 +2718,30 @@ paths: /contacts/attributes/{attributeType}/{multipleChoiceAttribute}/{multipleChoiceAttributeOption}: delete: tags: - - Contacts + - Contacts summary: Delete a multiple-choice attribute option operationId: deleteMultiAttributeOptions parameters: - - name: attributeType - in: path - description: Type of the attribute - required: true - schema: - type: string - enum: - - multiple-choice - - name: multipleChoiceAttribute - in: path - description: Name of the existing muliple-choice attribute - required: true - schema: - type: string - - name: multipleChoiceAttributeOption - in: path - description: Name of the existing multiple-choice attribute option that you want to delete - required: true - schema: - type: string + - name: attributeType + in: path + description: Type of the attribute + required: true + schema: + type: string + enum: + - multiple-choice + - name: multipleChoiceAttribute + in: path + description: Name of the existing muliple-choice attribute + required: true + schema: + type: string + - name: multipleChoiceAttributeOption + in: path + description: Name of the existing multiple-choice attribute option that you want to delete + required: true + schema: + type: string responses: 204: description: Multiple-Choice Attribute Option Deleted Successfully. @@ -2759,38 +2760,38 @@ paths: /contacts/folders: get: tags: - - Contacts + - Contacts summary: Get all folders operationId: getFolders parameters: - - name: limit - in: query - description: Number of documents per page - required: false - schema: - maximum: 50 - minimum: 0 - type: integer - format: int64 - default: 10 - - name: offset - in: query - description: Index of the first document of the page - required: false - schema: - type: integer - format: int64 - default: 0 - - name: sort - in: query - description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc + - name: limit + in: query + description: Number of documents per page + required: false + schema: + maximum: 50 + minimum: 0 + type: integer + format: int64 + default: 10 + - name: offset + in: query + description: Index of the first document of the page + required: false + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc responses: 200: description: Folders informations @@ -2802,16 +2803,16 @@ paths: response: value: folders: - - id: 42 - name: Ninja_Form - totalBlacklisted: 98 - totalSubscribers: 4567 - uniqueSubscribers: 4665 - - id: 29 - name: Prestashop - totalBlacklisted: 10 - totalSubscribers: 6543 - uniqueSubscribers: 6553 + - id: 42 + name: Ninja_Form + totalBlacklisted: 98 + totalSubscribers: 4567 + uniqueSubscribers: 4665 + - id: 29 + name: Prestashop + totalBlacklisted: 10 + totalSubscribers: 6543 + uniqueSubscribers: 6553 count: 2 400: description: bad request @@ -2821,7 +2822,7 @@ paths: $ref: '#/components/schemas/errorModel' post: tags: - - Contacts + - Contacts summary: Create a folder operationId: createFolder requestBody: @@ -2845,17 +2846,17 @@ paths: /contacts/folders/{folderId}: get: tags: - - Contacts + - Contacts summary: Returns a folder's details operationId: getFolder parameters: - - name: folderId - in: path - description: id of the folder - required: true - schema: - type: integer - format: int64 + - name: folderId + in: path + description: id of the folder + required: true + schema: + type: integer + format: int64 responses: 200: description: Folder details @@ -2885,17 +2886,17 @@ paths: $ref: '#/components/schemas/errorModel' put: tags: - - Contacts + - Contacts summary: Update a folder operationId: updateFolder parameters: - - name: folderId - in: path - description: Id of the folder - required: true - schema: - type: integer - format: int64 + - name: folderId + in: path + description: Id of the folder + required: true + schema: + type: integer + format: int64 requestBody: description: Name of the folder content: @@ -2906,7 +2907,7 @@ paths: responses: 204: description: Folder updated - content: {} + content: { } 400: description: bad request content: @@ -2922,21 +2923,21 @@ paths: x-codegen-request-body-name: updateFolder delete: tags: - - Contacts + - Contacts summary: Delete a folder (and all its lists) operationId: deleteFolder parameters: - - name: folderId - in: path - description: Id of the folder - required: true - schema: - type: integer - format: int64 + - name: folderId + in: path + description: Id of the folder + required: true + schema: + type: integer + format: int64 responses: 204: description: Folder deleted - content: {} + content: { } 400: description: bad request content: @@ -2952,43 +2953,43 @@ paths: /contacts/folders/{folderId}/lists: get: tags: - - Contacts + - Contacts summary: Get lists in a folder operationId: getFolderLists parameters: - - name: folderId - in: path - description: Id of the folder - required: true - schema: - type: integer - format: int64 - - name: limit - in: query - description: Number of documents per page - schema: - maximum: 50 - minimum: 0 - type: integer - format: int64 - default: 10 - - name: offset - in: query - description: Index of the first document of the page - schema: - type: integer - format: int64 - default: 0 - - name: sort - in: query - description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc + - name: folderId + in: path + description: Id of the folder + required: true + schema: + type: integer + format: int64 + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 50 + minimum: 0 + type: integer + format: int64 + default: 10 + - name: offset + in: query + description: Index of the first document of the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc responses: 200: description: Folder's Lists details @@ -3000,21 +3001,21 @@ paths: response: value: lists: - - id: 46 - name: Reactiv - totalSubscribers: 7655 - totalBlacklisted: 0 - uniqueSubscribers: 7655 - - id: 41 - name: NY_Area - totalSubscribers: 3654 - totalBlacklisted: 23 - uniqueSubscribers: 3677 - - id: 22 - name: VIP_Customer - totalSubscribers: 8753 - totalBlacklisted: 72 - uniqueSubscribers: 8825 + - id: 46 + name: Reactiv + totalSubscribers: 7655 + totalBlacklisted: 0 + uniqueSubscribers: 7655 + - id: 41 + name: NY_Area + totalSubscribers: 3654 + totalBlacklisted: 23 + uniqueSubscribers: 3677 + - id: 22 + name: VIP_Customer + totalSubscribers: 8753 + totalBlacklisted: 72 + uniqueSubscribers: 8825 count: 3 400: description: bad request @@ -3031,59 +3032,59 @@ paths: /contacts/lists: get: tags: - - Contacts + - Contacts summary: Get all the lists operationId: getLists parameters: - - name: limit - in: query - description: Number of documents per page - schema: - maximum: 50 - minimum: 0 - type: integer - format: int64 - default: 10 - - name: offset - in: query - description: Index of the first document of the page - schema: - type: integer - format: int64 - default: 0 - - name: sort - in: query - description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc - responses: - 200: - description: Lists informations - content: - application/json: - schema: - $ref: '#/components/schemas/getLists' - examples: - response: - value: - lists: - - id: 53 - name: Spanish_Speakers - totalSubscribers: 5432 - totalBlacklisted: 65 - uniqueSubscribers: 5497 - folderId: 1 - - id: 50 - name: Other - totalSubscribers: 10976 - totalBlacklisted: 765 - uniqueSubscribers: 11741 - folderId: 2 + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 50 + minimum: 0 + type: integer + format: int64 + default: 10 + - name: offset + in: query + description: Index of the first document of the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + responses: + 200: + description: Lists informations + content: + application/json: + schema: + $ref: '#/components/schemas/getLists' + examples: + response: + value: + lists: + - id: 53 + name: Spanish_Speakers + totalSubscribers: 5432 + totalBlacklisted: 65 + uniqueSubscribers: 5497 + folderId: 1 + - id: 50 + name: Other + totalSubscribers: 10976 + totalBlacklisted: 765 + uniqueSubscribers: 11741 + folderId: 2 count: 2 400: description: bad request @@ -3093,7 +3094,7 @@ paths: $ref: '#/components/schemas/errorModel' post: tags: - - Contacts + - Contacts summary: Create a list operationId: createList requestBody: @@ -3116,31 +3117,31 @@ paths: /contacts/lists/{listId}: get: tags: - - Contacts + - Contacts summary: Get a list's details operationId: getList parameters: - - name: listId - in: path - description: Id of the list - required: true - schema: - type: integer - format: int64 - - name: startDate - in: query - description: | - **Mandatory if endDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. - **Prefer to pass your timezone in date-time format for accurate result** - schema: - type: string - - name: endDate - in: query - description: | - **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. - **Prefer to pass your timezone in date-time format for accurate result** - schema: - type: string + - name: listId + in: path + description: Id of the list + required: true + schema: + type: integer + format: int64 + - name: startDate + in: query + description: | + **Mandatory if endDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. + **Prefer to pass your timezone in date-time format for accurate result** + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. + **Prefer to pass your timezone in date-time format for accurate result** + schema: + type: string responses: 200: description: List informations @@ -3161,32 +3162,32 @@ paths: folderId: 1 createdAt: 2016-02-26T11:56:08Z campaignStats: - - campaignId: 15 - stats: - uniqueClicks: 701 - clickers: 789 - complaints: 0 - delivered: 6632 - sent: 6645 - softBounces: 34 - hardBounces: 4 - uniqueViews: 3442 - unsubscriptions: 4 - viewed: 4322 - deferred: 0 - - campaignId: 45 - stats: - uniqueClicks: 654 - clickers: 788 - complaints: 1 - delivered: 4078 - sent: 4334 - softBounces: 18 - hardBounces: 2 - uniqueViews: 987 - unsubscriptions: 4 - viewed: 1555 - deferred: 0 + - campaignId: 15 + stats: + uniqueClicks: 701 + clickers: 789 + complaints: 0 + delivered: 6632 + sent: 6645 + softBounces: 34 + hardBounces: 4 + uniqueViews: 3442 + unsubscriptions: 4 + viewed: 4322 + deferred: 0 + - campaignId: 45 + stats: + uniqueClicks: 654 + clickers: 788 + complaints: 1 + delivered: 4078 + sent: 4334 + softBounces: 18 + hardBounces: 2 + uniqueViews: 987 + unsubscriptions: 4 + viewed: 1555 + deferred: 0 dynamicList: false 400: description: bad request @@ -3202,17 +3203,17 @@ paths: $ref: '#/components/schemas/errorModel' put: tags: - - Contacts + - Contacts summary: Update a list operationId: updateList parameters: - - name: listId - in: path - description: Id of the list - required: true - schema: - type: integer - format: int64 + - name: listId + in: path + description: Id of the list + required: true + schema: + type: integer + format: int64 requestBody: description: Values to update a list content: @@ -3223,7 +3224,7 @@ paths: responses: 204: description: List updated - content: {} + content: { } 400: description: bad request content: @@ -3238,21 +3239,21 @@ paths: $ref: '#/components/schemas/errorModel' delete: tags: - - Contacts + - Contacts summary: Delete a list operationId: deleteList parameters: - - name: listId - in: path - description: Id of the list - required: true - schema: - type: integer - format: int64 + - name: listId + in: path + description: Id of the list + required: true + schema: + type: integer + format: int64 responses: 204: description: List deleted - content: {} + content: { } 400: description: bad request content: @@ -3268,36 +3269,36 @@ paths: /contacts/segments: get: tags: - - Contacts + - Contacts summary: Get all the segments operationId: getSegments parameters: - - name: limit - in: query - description: Number of documents per page - schema: - maximum: 50 - minimum: 0 - type: integer - format: int64 - default: 10 - - name: offset - in: query - description: Index of the first document of the page - schema: - type: integer - format: int64 - default: 0 - - name: sort - in: query - description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 50 + minimum: 0 + type: integer + format: int64 + default: 10 + - name: offset + in: query + description: Index of the first document of the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc responses: 200: description: Segments informations @@ -3309,14 +3310,14 @@ paths: response: value: segments: - - id: 53 - segmentName: Segment1 - categoryName: Name1 - updatedAt: 2017-03-12T12:30:00Z - - id: 50 - segmentName: Segment2 - categoryName: Name2 - updatedAt: 2017-03-12T12:30:00Z + - id: 53 + segmentName: Segment1 + categoryName: Name1 + updatedAt: 2017-03-12T12:30:00Z + - id: 50 + segmentName: Segment2 + categoryName: Name2 + updatedAt: 2017-03-12T12:30:00Z count: 2 400: description: bad request @@ -3327,49 +3328,49 @@ paths: /contacts/lists/{listId}/contacts: get: tags: - - Contacts + - Contacts summary: Get contacts in a list operationId: getContactsFromList parameters: - - name: listId - in: path - description: Id of the list - required: true - schema: - type: integer - format: int64 - - name: modifiedSince - in: query - description: | - 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.** - schema: - type: string - - name: limit - in: query - description: Number of documents per page - schema: - maximum: 500 - minimum: 0 - type: integer - format: int64 - default: 50 - - name: offset - in: query - description: Index of the first document of the page - schema: - type: integer - format: int64 - default: 0 - - name: sort - in: query - description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc + - name: listId + in: path + description: Id of the list + required: true + schema: + type: integer + format: int64 + - name: modifiedSince + in: query + description: | + 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.** + schema: + type: string + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 500 + minimum: 0 + type: integer + format: int64 + default: 50 + - name: offset + in: query + description: Index of the first document of the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc responses: 200: description: Contact informations @@ -3381,57 +3382,57 @@ paths: response: value: contacts: - - email: alex.pain@example.com - id: 45 - emailBlacklisted: false - smsBlacklisted: true - createdAt: 2017-05-12T12:30:00Z - modifiedAt: 2017-05-12T12:30:00Z - listIds: - - 12 - - 9 - - 20 - listUnsubscribed: - - 1 - - 2 - attributes: - LASTNAME: Pain - FIRSTNAME: Alex - DOB: 2010-12-31 - GENDER: Kid - - email: john.smith@example.com - id: 32 - emailBlacklisted: true - smsBlacklisted: false - createdAt: 2017-05-12T12:30:00Z - modifiedAt: 2017-05-12T12:30:00Z - listIds: - - 12 - listUnsubscribed: - - 1 - attributes: - LASTNAME: Smith - FIRSTNAME: John - DOB: 1986-06-21 - GENDER: Men - - email: helen.rose@example.com - id: 65 - emailBlacklisted: true - smsBlacklisted: false - createdAt: 2017-05-12T12:30:00Z - modifiedAt: 2017-05-12T12:30:00Z - listIds: - - 12 - - 9 - - 20 - listUnsubscribed: - - 1 - attributes: - LASTNAME: Rose - FIRSTNAME: Helen - DOB: 1988-11-02 - GENDER: Women - SMS: "3375599887766" + - email: alex.pain@example.com + id: 45 + emailBlacklisted: false + smsBlacklisted: true + createdAt: 2017-05-12T12:30:00Z + modifiedAt: 2017-05-12T12:30:00Z + listIds: + - 12 + - 9 + - 20 + listUnsubscribed: + - 1 + - 2 + attributes: + LASTNAME: Pain + FIRSTNAME: Alex + DOB: 2010-12-31 + GENDER: Kid + - email: john.smith@example.com + id: 32 + emailBlacklisted: true + smsBlacklisted: false + createdAt: 2017-05-12T12:30:00Z + modifiedAt: 2017-05-12T12:30:00Z + listIds: + - 12 + listUnsubscribed: + - 1 + attributes: + LASTNAME: Smith + FIRSTNAME: John + DOB: 1986-06-21 + GENDER: Men + - email: helen.rose@example.com + id: 65 + emailBlacklisted: true + smsBlacklisted: false + createdAt: 2017-05-12T12:30:00Z + modifiedAt: 2017-05-12T12:30:00Z + listIds: + - 12 + - 9 + - 20 + listUnsubscribed: + - 1 + attributes: + LASTNAME: Rose + FIRSTNAME: Helen + DOB: 1988-11-02 + GENDER: Women + SMS: "3375599887766" count: 17655 400: description: bad request @@ -3448,17 +3449,17 @@ paths: /contacts/lists/{listId}/contacts/add: post: tags: - - Contacts + - Contacts summary: Add existing contacts to a list operationId: addContactToList parameters: - - name: listId - in: path - description: Id of the list - required: true - schema: - type: integer - format: int64 + - name: listId + in: path + description: Id of the list + required: true + schema: + type: integer + format: int64 requestBody: description: Emails addresses OR IDs OR EXT_ID attributes of the contacts content: @@ -3535,17 +3536,17 @@ paths: /contacts/lists/{listId}/contacts/remove: post: tags: - - Contacts + - Contacts summary: Delete a contact from a list operationId: removeContactFromList parameters: - - name: listId - in: path - description: Id of the list - required: true - schema: - type: integer - format: int64 + - name: listId + in: path + description: Id of the list + required: true + schema: + type: integer + format: int64 requestBody: description: Emails adresses OR IDs OR EXT_ID attributes of the contacts OR 'all' true content: @@ -3633,7 +3634,7 @@ paths: /contacts/export: post: tags: - - Contacts + - Contacts summary: Export contacts description: It returns the background process ID which on completion calls the notify URL that you have set in the input. File will be available in csv. @@ -3664,7 +3665,7 @@ paths: /contacts/import: post: tags: - - Contacts + - Contacts summary: Import contacts description: | It returns the background process ID which on completion calls @@ -3694,60 +3695,60 @@ paths: /smsCampaigns: get: tags: - - SMS Campaigns + - SMS Campaigns summary: Returns the information for all your created SMS campaigns operationId: getSmsCampaigns parameters: - - name: status - in: query - description: Status of campaign. - schema: - type: string - enum: - - suspended - - archive - - sent - - queued - - draft - - inProcess - - name: startDate - in: query - description: | - **Mandatory if endDate is used.** Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) - schema: - type: string - - name: endDate - in: query - description: | - **Mandatory if startDate is used.** Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) - schema: - type: string - - name: limit - in: query - description: Number limitation for the result returned - schema: - maximum: 1000 - minimum: 0 - type: integer - format: int64 - default: 500 - - name: offset - in: query - description: Beginning point in the list to retrieve from. - schema: - type: integer - format: int64 - default: 0 - - name: sort - in: query - description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc + - name: status + in: query + description: Status of campaign. + schema: + type: string + enum: + - suspended + - archive + - sent + - queued + - draft + - inProcess + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) + schema: + type: string + - name: limit + in: query + description: Number limitation for the result returned + schema: + maximum: 1000 + minimum: 0 + type: integer + format: int64 + default: 500 + - name: offset + in: query + description: Beginning point in the list to retrieve from. + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc responses: 200: description: SMS campaigns informations @@ -3759,68 +3760,68 @@ paths: response: value: campaigns: - - id: 2 - name: PROMO CODE - status: sent - content: Visit our Store and get some discount ! - scheduledAt: 2017-06-01T12:30:00Z - testSent: true - sender: MyCompany - createdAt: 2017-06-01T12:30:00Z - modifiedAt: 2017-05-01T12:30:00Z - sentDate: 2017-06-01T12:30:00Z - recipients: - lists: - - 21 - exclusionLists: - - 13 - statistics: - delivered: 2987 - sent: 3000 - processing: 0 - softBounces: 3 - hardBounces: 1 - unsubscriptions: 3 - answered: 2 - - id: 10 - name: SUMMER SALE - status: draft - content: Summer Sale is starting tomorrow. Get extra 10% with this - code:SUM17 - scheduledAt: 2017-08-04T12:30:00Z - testSent: false - sender: MyCompany - createdAt: 2017-06-01T12:30:00Z - modifiedAt: 2017-05-01T12:30:00Z - sentDate: 2017-06-01T12:30:00Z - recipients: - lists: - - 21 - exclusionLists: - - 13 - statistics: - delivered: 2987 - sent: 3000 - processing: 0 - softBounces: 3 - hardBounces: 1 - unsubscriptions: 3 - answered: 2 - count: 12 - 400: - description: bad request - content: - application/json: - schema: - $ref: '#/components/schemas/errorModel' - post: - tags: - - SMS Campaigns - summary: Creates an SMS campaign - operationId: createSmsCampaign - requestBody: - description: Values to create an SMS Campaign - content: + - id: 2 + name: PROMO CODE + status: sent + content: Visit our Store and get some discount ! + scheduledAt: 2017-06-01T12:30:00Z + testSent: true + sender: MyCompany + createdAt: 2017-06-01T12:30:00Z + modifiedAt: 2017-05-01T12:30:00Z + sentDate: 2017-06-01T12:30:00Z + recipients: + lists: + - 21 + exclusionLists: + - 13 + statistics: + delivered: 2987 + sent: 3000 + processing: 0 + softBounces: 3 + hardBounces: 1 + unsubscriptions: 3 + answered: 2 + - id: 10 + name: SUMMER SALE + status: draft + content: Summer Sale is starting tomorrow. Get extra 10% with this + code:SUM17 + scheduledAt: 2017-08-04T12:30:00Z + testSent: false + sender: MyCompany + createdAt: 2017-06-01T12:30:00Z + modifiedAt: 2017-05-01T12:30:00Z + sentDate: 2017-06-01T12:30:00Z + recipients: + lists: + - 21 + exclusionLists: + - 13 + statistics: + delivered: 2987 + sent: 3000 + processing: 0 + softBounces: 3 + hardBounces: 1 + unsubscriptions: 3 + answered: 2 + count: 12 + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + post: + tags: + - SMS Campaigns + summary: Creates an SMS campaign + operationId: createSmsCampaign + requestBody: + description: Values to create an SMS Campaign + content: application/json: schema: $ref: '#/components/schemas/createSmsCampaign' @@ -3838,17 +3839,17 @@ paths: /smsCampaigns/{campaignId}: get: tags: - - SMS Campaigns + - SMS Campaigns summary: Get an SMS campaign operationId: getSmsCampaign parameters: - - name: campaignId - in: path - description: id of the SMS campaign - required: true - schema: - type: integer - format: int64 + - name: campaignId + in: path + description: id of the SMS campaign + required: true + schema: + type: integer + format: int64 responses: 200: description: SMS campaign informations @@ -3870,9 +3871,9 @@ paths: modifiedAt: 2017-05-01T12:30:00Z recipients: lists: - - 21 + - 21 exclusionLists: - - 13 + - 13 statistics: delivered: 2987 sent: 3000 @@ -3895,17 +3896,17 @@ paths: $ref: '#/components/schemas/errorModel' put: tags: - - SMS Campaigns + - SMS Campaigns summary: Update an SMS campaign operationId: updateSmsCampaign parameters: - - name: campaignId - in: path - description: id of the SMS campaign - required: true - schema: - type: integer - format: int64 + - name: campaignId + in: path + description: id of the SMS campaign + required: true + schema: + type: integer + format: int64 requestBody: description: Values to update an SMS Campaign content: @@ -3916,7 +3917,7 @@ paths: responses: 204: description: SMS campaign updated - content: {} + content: { } 400: description: bad request content: @@ -3931,21 +3932,21 @@ paths: $ref: '#/components/schemas/errorModel' delete: tags: - - SMS Campaigns + - SMS Campaigns summary: Delete an SMS campaign operationId: deleteSmsCampaign parameters: - - name: campaignId - in: path - description: id of the SMS campaign - required: true - schema: - type: integer - format: int64 + - name: campaignId + in: path + description: id of the SMS campaign + required: true + schema: + type: integer + format: int64 responses: 204: description: SMS campaign has been deleted - content: {} + content: { } 400: description: bad request content: @@ -3961,21 +3962,21 @@ paths: /smsCampaigns/{campaignId}/sendNow: post: tags: - - SMS Campaigns + - SMS Campaigns summary: Send your SMS campaign immediately operationId: sendSmsCampaignNow parameters: - - name: campaignId - in: path - description: id of the campaign - required: true - schema: - type: integer - format: int64 + - name: campaignId + in: path + description: id of the campaign + required: true + schema: + type: integer + format: int64 responses: 204: description: SMS campaign has been scheduled - content: {} + content: { } 400: description: SMS Campaign could not be sent content: @@ -3998,17 +3999,17 @@ paths: /smsCampaigns/{campaignId}/status: put: tags: - - SMS Campaigns + - SMS Campaigns summary: Update a campaign's status operationId: updateSmsCampaignStatus parameters: - - name: campaignId - in: path - description: id of the campaign - required: true - schema: - type: integer - format: int64 + - name: campaignId + in: path + description: id of the campaign + required: true + schema: + type: integer + format: int64 requestBody: description: Status of the campaign. content: @@ -4019,7 +4020,7 @@ paths: responses: 204: description: The campaign status has been updated successfully - content: {} + content: { } 400: description: bad request content: @@ -4036,17 +4037,17 @@ paths: /smsCampaigns/{campaignId}/sendTest: post: tags: - - SMS Campaigns + - SMS Campaigns summary: Send a test SMS campaign operationId: sendTestSms parameters: - - name: campaignId - in: path - description: Id of the SMS campaign - required: true - schema: - type: integer - format: int64 + - name: campaignId + in: path + description: Id of the SMS campaign + required: true + schema: + type: integer + format: int64 requestBody: description: | Mobile number of the recipient with the country code. This number **must belong to one of your contacts in Brevo account and must not be blacklisted** @@ -4058,7 +4059,7 @@ paths: responses: 204: description: Test SMS has been sent successfully to the recipient - content: {} + content: { } 400: description: Test SMS could not be sent to the following email addresses content: @@ -4074,19 +4075,19 @@ paths: /smsCampaigns/{campaignId}/exportRecipients: post: tags: - - SMS Campaigns + - SMS Campaigns summary: Export an SMS campaign's recipients description: It returns the background process ID which on completion calls the notify URL that you have set in the input. operationId: requestSmsRecipientExport parameters: - - name: campaignId - in: path - description: id of the campaign - required: true - schema: - type: integer - format: int64 + - name: campaignId + in: path + description: id of the campaign + required: true + schema: + type: integer + format: int64 requestBody: description: Values to send for a recipient export request content: @@ -4114,19 +4115,19 @@ paths: /smsCampaigns/{campaignId}/sendReport: post: tags: - - SMS Campaigns + - SMS Campaigns summary: Send an SMS campaign's report description: Send report of Sent and Archived campaign, to the specified email addresses, with respective data and a pdf attachment in detail. operationId: sendSmsReport parameters: - - name: campaignId - in: path - description: id of the campaign - required: true - schema: - type: integer - format: int64 + - name: campaignId + in: path + description: id of the campaign + required: true + schema: + type: integer + format: int64 requestBody: description: Values for send a report content: @@ -4137,7 +4138,7 @@ paths: responses: 204: description: Report has been successfully sent to the defined recipients - content: {} + content: { } 400: description: bad request content: @@ -4153,7 +4154,7 @@ paths: /transactionalSMS/sms: post: tags: - - Transactional SMS + - Transactional SMS summary: Send SMS message to a mobile number operationId: sendTransacSms requestBody: @@ -4187,34 +4188,34 @@ paths: /transactionalSMS/statistics/aggregatedReport: get: tags: - - Transactional SMS + - Transactional SMS summary: Get your SMS activity aggregated over a period of time operationId: getTransacAggregatedSmsReport parameters: - - name: startDate - in: query - description: | - **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report - schema: - type: string - - name: endDate - in: query - description: | - **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report - schema: - type: string - - name: days - in: query - description: | - Number of days in the past including today (positive integer). **Not compatible with startDate and endDate** - schema: - type: integer - format: int64 - - name: tag - in: query - description: Filter on a tag - schema: - type: string + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report + schema: + type: string + - name: days + in: query + description: | + Number of days in the past including today (positive integer). **Not compatible with startDate and endDate** + schema: + type: integer + format: int64 + - name: tag + in: query + description: Filter on a tag + schema: + type: string responses: 200: description: Aggregated SMS report informations @@ -4245,44 +4246,44 @@ paths: /transactionalSMS/statistics/reports: get: tags: - - Transactional SMS + - Transactional SMS summary: Get your SMS activity aggregated per day operationId: getTransacSmsReport parameters: - - name: startDate - in: query - description: | - **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report - schema: - type: string - - name: endDate - in: query - description: | - **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report - schema: - type: string - - name: days - in: query - description: | - Number of days in the past including today (positive integer). **Not compatible with 'startDate' and 'endDate'** - schema: - type: integer - format: int64 - - name: tag - in: query - description: Filter on a tag - schema: - type: string - - name: sort - in: query - description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report + schema: + type: string + - name: days + in: query + description: | + Number of days in the past including today (positive integer). **Not compatible with 'startDate' and 'endDate'** + schema: + type: integer + format: int64 + - name: tag + in: query + description: Filter on a tag + schema: + type: string + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc responses: 200: description: Aggregated SMS report informations @@ -4294,39 +4295,39 @@ paths: response: value: reports: - - date: 2017-04-30 - requests: 10756 - delivered: 10103 - hardBounces: 21 - softBounces: 137 - blocked: 1026 - unsubscribed: 720 - replied: 5091 - accepted: 2318 - rejected: 0 - skipped: 0 - - date: 2017-05-01 - requests: 18812 - delivered: 17499 - hardBounces: 34 - softBounces: 254 - blocked: 1514 - unsubscribed: 1090 - replied: 10089 - accepted: 4393 - rejected: 0 - skipped: 0 - - date: 2017-05-02 - requests: 14321 - delivered: 13427 - hardBounces: 16 - softBounces: 176 - blocked: 1646 - unsubscribed: 1170 - replied: 11563 - accepted: 4689 - rejected: 0 - skipped: 1 + - date: 2017-04-30 + requests: 10756 + delivered: 10103 + hardBounces: 21 + softBounces: 137 + blocked: 1026 + unsubscribed: 720 + replied: 5091 + accepted: 2318 + rejected: 0 + skipped: 0 + - date: 2017-05-01 + requests: 18812 + delivered: 17499 + hardBounces: 34 + softBounces: 254 + blocked: 1514 + unsubscribed: 1090 + replied: 10089 + accepted: 4393 + rejected: 0 + skipped: 0 + - date: 2017-05-02 + requests: 14321 + delivered: 13427 + hardBounces: 16 + softBounces: 176 + blocked: 1646 + unsubscribed: 1170 + replied: 11563 + accepted: 4689 + rejected: 0 + skipped: 1 400: description: bad request content: @@ -4336,83 +4337,83 @@ paths: /transactionalSMS/statistics/events: get: tags: - - Transactional SMS + - Transactional SMS summary: Get all your SMS activity (unaggregated events) operationId: getSmsEvents parameters: - - name: limit - in: query - description: Number of documents per page - schema: - maximum: 100 - minimum: 0 - type: integer - format: int64 - default: 50 - - name: startDate - in: query - description: | - **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report - schema: - type: string - - name: endDate - in: query - description: | - **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report - schema: - type: string - - name: offset - in: query - description: Index of the first document of the page - schema: - type: integer - format: int64 - default: 0 - - name: days - in: query - description: | - Number of days in the past including today (positive integer). **Not compatible with 'startDate' and 'endDate'** - schema: - type: integer - format: int64 - - name: phoneNumber - in: query - description: Filter the report for a specific phone number - schema: - type: string - - name: event - in: query - description: Filter the report for specific events - schema: - type: string - enum: - - bounces - - hardBounces - - softBounces - - delivered - - sent - - accepted - - unsubscription - - replies - - blocked - - rejected - - skipped - - name: tags - in: query - description: Filter the report for specific tags passed as a serialized urlencoded - array - schema: - type: string - - name: sort - in: query - description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 100 + minimum: 0 + type: integer + format: int64 + default: 50 + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report + schema: + type: string + - name: offset + in: query + description: Index of the first document of the page + schema: + type: integer + format: int64 + default: 0 + - name: days + in: query + description: | + Number of days in the past including today (positive integer). **Not compatible with 'startDate' and 'endDate'** + schema: + type: integer + format: int64 + - name: phoneNumber + in: query + description: Filter the report for a specific phone number + schema: + type: string + - name: event + in: query + description: Filter the report for specific events + schema: + type: string + enum: + - bounces + - hardBounces + - softBounces + - delivered + - sent + - accepted + - unsubscription + - replies + - blocked + - rejected + - skipped + - name: tags + in: query + description: Filter the report for specific tags passed as a serialized urlencoded + array + schema: + type: string + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc responses: 200: description: Sms events report informations @@ -4424,18 +4425,18 @@ paths: response: value: events: - - phoneNumber: "00911059469013" - date: 2015-05-20T12:30:00Z - messageId: "1473139351170140" - event: sent - reason: Recipient is currently unreachable - tag: cabWaiting - - phoneNumber: "00911059469013" - date: 2015-05-20T16:30:00Z - messageId: "1473139351170140" - event: delivered - reason: Recipient is currently unreachable - tag: cabRequest + - phoneNumber: "00911059469013" + date: 2015-05-20T12:30:00Z + messageId: "1473139351170140" + event: sent + reason: Recipient is currently unreachable + tag: cabWaiting + - phoneNumber: "00911059469013" + date: 2015-05-20T16:30:00Z + messageId: "1473139351170140" + event: delivered + reason: Recipient is currently unreachable + tag: cabRequest 400: description: bad request content: @@ -4445,17 +4446,17 @@ paths: /whatsappCampaigns/{campaignId}: get: tags: - - WhatsApp Campaigns + - WhatsApp Campaigns summary: Get a WhatsApp campaign operationId: getWhatsAppCampaign parameters: - - name: campaignId - in: path - description: Id of the campaign - required: true - schema: - type: integer - format: int64 + - name: campaignId + in: path + description: Id of the campaign + required: true + schema: + type: integer + format: int64 responses: 200: description: Get WhatsApp campaign information on the basis of campaignId @@ -4474,34 +4475,34 @@ paths: recipients: type: list includedLists: - - 22 + - 22 excludedLists: - - 45 - template : - name : "official_campaign8" + - 45 + template: + name: "official_campaign8" category: "MARKETING" language: "en" - contains_button : true - display_header : false - components : - - type : "BODY" - text : "making it look like readable English." + contains_button: true + display_header: false + components: + - type: "BODY" + text: "making it look like readable English." - type: "BUTTONS" - buttons : + buttons: - type: "URL" text: "vLorem Ipsum is simply du" - url : "app.brevo" + url: "app.brevo" - type: "PHONE_NUMBER" text: "Lorem Ipsum is simply dum" phone_number: "+918800613137" - header_variables : - - name: "FIRSTNAME" + header_variables: + - name: "FIRSTNAME" default: "INVALID HEADER" index: 1 datatype: "text" - header_type : "text" - body_variable: [] - button_type : "CALL_TO_ACTION" + header_type: "text" + body_variable: [ ] + button_type: "CALL_TO_ACTION" header_footer: true stats: sent: 3, @@ -4525,21 +4526,21 @@ paths: $ref: '#/components/schemas/errorModel' delete: tags: - - WhatsApp Campaigns + - WhatsApp Campaigns summary: Delete a WhatsApp campaign operationId: deleteWhatsAppCampaign parameters: - - name: campaignId - in: path - description: id of the campaign - required: true - schema: - type: integer - format: int64 + - name: campaignId + in: path + description: id of the campaign + required: true + schema: + type: integer + format: int64 responses: 204: description: WhatsApp campaign has been deleted - content: {} + content: { } 400: description: bad request content: @@ -4554,17 +4555,17 @@ paths: $ref: '#/components/schemas/errorModel' put: tags: - - WhatsApp Campaigns + - WhatsApp Campaigns summary: Update a WhatsApp campaign operationId: updateWhatsAppCampaign parameters: - - name: campaignId - in: path - description: id of the campaign - required: true - schema: - type: integer - format: int64 + - name: campaignId + in: path + description: id of the campaign + required: true + schema: + type: integer + format: int64 requestBody: description: Values to update a WhatsApp Campaign content: @@ -4572,10 +4573,10 @@ paths: schema: $ref: '#/components/schemas/updateWhatsAppCampaign' required: true - responses : + responses: 204: description: WhatsApp campaign has been deleted - content: {} + content: { } 400: description: bad request content: @@ -4585,59 +4586,59 @@ paths: /whatsappCampaigns/template-list: get: tags: - - WhatsApp Campaigns + - WhatsApp Campaigns summary: Return all your created WhatsApp templates operationId: getWhatsAppTemplates parameters: - - name: startDate - in: query - description: | - **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. - **Prefer to pass your timezone in date-time format for accurate result** - schema: - type: string - - name: endDate - in: query - description: | - **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. - **Prefer to pass your timezone in date-time format for accurate result** - schema: - type: string - - name: limit - in: query - description: Number of documents per page - schema: - maximum: 100 - minimum: 0 - type: integer - format: int64 - default: 50 - - name: offset - in: query - description: Index of the first document in the page - schema: - type: integer - format: int64 - default: 0 - - name: sort - in: query - description: Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc - - name: source - in: query - description: source of the template - required: false - schema: - type: string - enum: - - Automation - - Conversations + - name: startDate + in: query + description: | + **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. + **Prefer to pass your timezone in date-time format for accurate result** + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. + **Prefer to pass your timezone in date-time format for accurate result** + schema: + type: string + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 100 + minimum: 0 + type: integer + format: int64 + default: 50 + - name: offset + in: query + description: Index of the first document in the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + - name: source + in: query + description: source of the template + required: false + schema: + type: string + enum: + - Automation + - Conversations responses: 200: description: WhatsApp templates informations @@ -4677,8 +4678,8 @@ paths: /whatsappCampaigns: post: tags: - - WhatsApp Campaigns - summary : Create and Send a WhatsApp campaign + - WhatsApp Campaigns + summary: Create and Send a WhatsApp campaign operationId: createWhatsAppCampaign requestBody: description: Values to create a WhatsApp Campaign @@ -4698,50 +4699,50 @@ paths: $ref: '#/components/schemas/errorModel' get: tags: - - WhatsApp Campaigns + - WhatsApp Campaigns summary: Return all your created WhatsApp campaigns operationId: getWhatsAppCampaigns parameters: - - name: startDate - in: query - description: | - **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the WhatsApp campaigns created. - **Prefer to pass your timezone in date-time format for accurate result** - schema: - type: string - - name: endDate - in: query - description: | - **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the WhatsApp campaigns created. - **Prefer to pass your timezone in date-time format for accurate result** - schema: - type: string - - name: limit - in: query - description: Number of documents per page - schema: - maximum: 100 - minimum: 0 - type: integer - format: int64 - default: 50 - - name: offset - in: query - description: Index of the first document in the page - schema: - type: integer - format: int64 - default: 0 - - name: sort - in: query - description: Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc + - name: startDate + in: query + description: | + **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the WhatsApp campaigns created. + **Prefer to pass your timezone in date-time format for accurate result** + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the WhatsApp campaigns created. + **Prefer to pass your timezone in date-time format for accurate result** + schema: + type: string + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 100 + minimum: 0 + type: integer + format: int64 + default: 50 + - name: offset + in: query + description: Index of the first document in the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc responses: 200: description: WhatsApp campaigns information @@ -4757,17 +4758,17 @@ paths: - id: 1672035851100690 campaignName: campaign_22 campaignStatus: sent - templateId : 637660278078655 + templateId: 637660278078655 scheduledAt: 2022-12-27T09:50:00Z - errorReason : "" - invalidatedContacts : 0 + errorReason: "" + invalidatedContacts: 0 stats: sent: 3 delivered: 3 read: 2 unsubscribe: 0 notSent: 4 - readPercentage : 28.57 + readPercentage: 28.57 createdAt: 2017-05-01T12:30:00Z modifiedAt: 2017-05-01T12:30:00Z 400: @@ -4776,56 +4777,56 @@ paths: application/json: schema: $ref: '#/components/schemas/errorModel' - /whatsappCampaigns/template : - post : + /whatsappCampaigns/template: + post: tags: - - WhatsApp Campaigns - summary : Create a WhatsApp template - operationId : createWhatsAppTemplate + - WhatsApp Campaigns + summary: Create a WhatsApp template + operationId: createWhatsAppTemplate requestBody: - description : Values to create a WhatsApp template + description: Values to create a WhatsApp template content: application/json: schema: - $ref : '#/components/schemas/createWhatsAppTemplate' - required : true + $ref: '#/components/schemas/createWhatsAppTemplate' + required: true responses: 201: - $ref : '#/components/responses/createModel' + $ref: '#/components/responses/createModel' 400: description: bad request content: application/json: schema: $ref: '#/components/schemas/errorModel' - /whatsappCampaigns/template/approval/{templateId} : + /whatsappCampaigns/template/approval/{templateId}: post: - tags : - - WhatsApp Campaigns - summary : Send your WhatsApp template for approval - operationId : sendWhatsAppTemplateApproval - parameters : - - name : templateId - in : path - description : id of the template - required: true - schema : - type : integer - format : int64 - responses : + tags: + - WhatsApp Campaigns + summary: Send your WhatsApp template for approval + operationId: sendWhatsAppTemplateApproval + parameters: + - name: templateId + in: path + description: id of the template + required: true + schema: + type: integer + format: int64 + responses: 200: description: WhatsApp template sent for approval - content: {} + content: { } 400: description: bad request content: application/json: schema: $ref: '#/components/schemas/errorModel' - /whatsappCampaigns/config : + /whatsappCampaigns/config: get: tags: - - WhatsApp Campaigns + - WhatsApp Campaigns summary: Get your WhatsApp API account information operationId: getWhatsAppConfig responses: @@ -4838,12 +4839,12 @@ paths: examples: response: value: - whatsappBusinessAccountID : 105569359072383 - sendingLimit : TIER_1K - phoneNumberQuality : GREEN - whatsappBusinessAccountStatus : APPROVED - businessStatus : verified - phoneNumberNameStatus : APPROVED + whatsappBusinessAccountID: 105569359072383 + sendingLimit: TIER_1K + phoneNumberQuality: GREEN + whatsappBusinessAccountStatus: APPROVED + businessStatus: verified + phoneNumberNameStatus: APPROVED 400: description: bad request content: @@ -4932,9 +4933,9 @@ paths: value: error: "sortField must be one of [name created_at updated_at]" invalidOrganisationId: - summary: Parsing error - value: - error: "Parsing error: organization id" + summary: Parsing error + value: + error: "Parsing error: organization id" post: tags: - Program @@ -5309,7 +5310,7 @@ paths: /loyalty/config/programs/{loyaltyProgramId}/publish: post: tags: - - Program + - Program summary: Publish loyalty program description: Publishes loyalty program operationId: publishLoyaltyProgram @@ -5423,45 +5424,45 @@ paths: '404': description: Invalid contact ID content: - application/json: - schema: - $ref: '#/components/schemas/contactIdInvalidResponse' - examples: - contactIdFound: - summary: Contact id not found - value: - error: "Invalid contact id" + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + contactIdFound: + summary: Contact id not found + value: + error: "Invalid contact id" '422': description: Loyalty Program is inactive or loyalty subscription ID is already assigned to a contact content: - application/json: - schema: - $ref: '#/components/schemas/contactIdInvalidResponse' - examples: - invalidLoyaltyProgramId: - summary: Invalid loyalty program Id - value: - error: "Invalid loyalty program id" - failedToGetDeDetails: - summary: Failed to get de details - value: - error: "failed to get de details" - contactIdIsRequired: - summary: Contact id is required field - value: - error: "contact Id is a required field" - programIsInactive: - summary: Loyalty program is inactive - value: - error: "Loyalty program is inactive" - contactExists: - summary: Contact already exists - value: - error: "Subscription for this contact already exists" - cannotCreateSubscription: - summary: Cannot create subscription - value: - error: "Cannot create Subscription" + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + failedToGetDeDetails: + summary: Failed to get de details + value: + error: "failed to get de details" + contactIdIsRequired: + summary: Contact id is required field + value: + error: "contact Id is a required field" + programIsInactive: + summary: Loyalty program is inactive + value: + error: "Loyalty program is inactive" + contactExists: + summary: Contact already exists + value: + error: "Subscription for this contact already exists" + cannotCreateSubscription: + summary: Cannot create subscription + value: + error: "Cannot create Subscription" /loyalty/config/programs/{loyaltyProgramId}/subscriptions-members: post: tags: @@ -5491,16 +5492,16 @@ paths: schema: $ref: '#/components/schemas/createSubscriptionMemberResponse' '400': - description: Bad request error - content: - application/json: - schema: - $ref: '#/components/schemas/contactIdInvalidResponse' - examples: - ownerContactAsMember: - summary: Owner contact as member - value: - error: "Failed to decode request payload" + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + ownerContactAsMember: + summary: Owner contact as member + value: + error: "Failed to decode request payload" '401': description: Cannot authenticate request content: @@ -5549,22 +5550,22 @@ paths: '422': description: Loyalty Program is inactive or loyalty subscription ID is already assigned to a contact content: - application/json: - schema: - $ref: '#/components/schemas/contactIdInvalidResponse' - examples: - invalidLoyaltyProgramId: - summary: Invalid loyalty program Id - value: - error: "Invalid loyalty program id" - failedToGetDeDetails: - summary: Failed to get de details - value: - error: "failed to get de details" - memberContactIdsRequired: - summary: Member contact ids is required field - value: - error: "memberContactIds is required field" + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + failedToGetDeDetails: + summary: Failed to get de details + value: + error: "failed to get de details" + memberContactIdsRequired: + summary: Member contact ids is required field + value: + error: "memberContactIds is required field" delete: tags: - Program @@ -5595,16 +5596,16 @@ paths: '204': description: Successful operation '400': - description: Bad request error - content: - application/json: - schema: - $ref: '#/components/schemas/contactIdInvalidResponse' - examples: - failedToDecode: - summary: Failed to decode request payload - value: - error: "Failed to decode request payload" + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + failedToDecode: + summary: Failed to decode request payload + value: + error: "Failed to decode request payload" '401': description: Cannot authenticate request content: @@ -5634,22 +5635,22 @@ paths: '422': description: Loyalty Program is inactive or loyalty subscription ID is already assigned to a contact content: - application/json: - schema: - $ref: '#/components/schemas/contactIdInvalidResponse' - examples: - invalidLoyaltyProgramId: - summary: Invalid loyalty program Id - value: - error: "Invalid loyalty program id" - failedToGetDeDetails: - summary: Failed to get de details - value: - error: "failed to get de details" - memberContactIdRequired: - summary: Member contact id is required - value: - error: "memberContactIds is required" + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + failedToGetDeDetails: + summary: Failed to get de details + value: + error: "failed to get de details" + memberContactIdRequired: + summary: Member contact id is required + value: + error: "memberContactIds is required" /loyalty/config/programs/{loyaltyProgramId}/contact/{contactId}: delete: tags: @@ -5676,16 +5677,16 @@ paths: '204': description: Successful operation '400': - description: Bad request error - content: - application/json: - schema: - $ref: '#/components/schemas/contactIdInvalidResponse' - examples: - contactIdInvalid: - summary: Invalid contact id - value: - error: "Invalid contact id: invalid format" + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + contactIdInvalid: + summary: Invalid contact id + value: + error: "Invalid contact id: invalid format" '401': description: Cannot authenticate request content: @@ -5715,22 +5716,22 @@ paths: '422': description: Loyalty Program is inactive or loyalty subscription ID is already assigned to a contact content: - application/json: - schema: - $ref: '#/components/schemas/contactIdInvalidResponse' - examples: - invalidLoyaltyProgramId: - summary: Invalid loyalty program Id - value: - error: "Invalid loyalty program id" - failedToGetDeDetails: - summary: Failed to get de details - value: - error: "failed to get de details" - cannotDeleteSubscription: - summary: Cannot delete subscription - value: - error: Cannot delete Subscription" + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + failedToGetDeDetails: + summary: Failed to get de details + value: + error: "failed to get de details" + cannotDeleteSubscription: + summary: Cannot delete subscription + value: + error: Cannot delete Subscription" get: tags: - Program @@ -5756,20 +5757,20 @@ paths: '200': description: Successful operation content: - application/json: - schema: - $ref: '#/components/schemas/getSubscriptionMemberResponse' + application/json: + schema: + $ref: '#/components/schemas/getSubscriptionMemberResponse' '400': - description: Bad request error - content: - application/json: - schema: - $ref: '#/components/schemas/contactIdInvalidResponse' - examples: - InvalidContactId: - summary: Invalid contact id - value: - error: "invalid contact id: missing" + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + InvalidContactId: + summary: Invalid contact id + value: + error: "invalid contact id: missing" '401': description: Cannot authenticate request content: @@ -5788,130 +5789,130 @@ paths: '422': description: Loyalty Program is inactive or loyalty subscription ID is already assigned to a contact content: - application/json: - schema: - $ref: '#/components/schemas/contactIdInvalidResponse' - examples: - invalidLoyaltyProgramId: - summary: Invalid loyalty program Id - value: - error: "Invalid loyalty program id" - failedToGetDeDetails: - summary: Failed to get de details - value: - error: "failed to get de details" + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + failedToGetDeDetails: + summary: Failed to get de details + value: + error: "failed to get de details" /loyalty/config/programs/{loyaltyProgramId}/account-info: get: - tags: - - Program - summary: Get Subscription Data - description: Get Information of balances, tiers, rewards and subscription members for a subscription - operationId: getParameterSubscriptionInfo - parameters: - - name: loyaltyProgramId - in: path - required: true - schema: - type: string - format: uuid - description: Loyalty Program Id - - name: contactId - in: query - description: One of contact id or loyalty subscription id is required - required: true - schema: - type: integer - - name: loyaltySubscriptionId - in: query - description: Loyalty Subscription Id - required: false - schema: + tags: + - Program + summary: Get Subscription Data + description: Get Information of balances, tiers, rewards and subscription members for a subscription + operationId: getParameterSubscriptionInfo + parameters: + - name: loyaltyProgramId + in: path + required: true + schema: + type: string + format: uuid + description: Loyalty Program Id + - name: contactId + in: query + description: One of contact id or loyalty subscription id is required + required: true + schema: + type: integer + - name: loyaltySubscriptionId + in: query + description: Loyalty Subscription Id + required: false + schema: + type: string + - name: params + in: query + description: Add query params (balance, tier, reward, or member) + required: false + schema: + type: array + items: type: string - - name: params - in: query - description: Add query params (balance, tier, reward, or member) - required: false - schema: - type: array - items: - type: string - enum: - - balance - - tier - - reward - - member - uniqueItems: true - style: form - explode: false - responses: - '200': - description: Successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/getSubscriptionInfoResponse' - '400': - description: Bad request error - content: - application/json: - schema: - $ref: '#/components/schemas/contactIdInvalidResponse' - examples: - contactIdIsInvalid: - summary: Contact id is valid - value: - error: "invalid contact id: invalid format" - contactIdOrLoyaltySubscriptionIdNotProvided: - summary: Contact id or loyalty subscription id not provided - value: - error: "either contact id or loyalty subscription id is invalid" - invalidComponent: - summary: Invalid component - value: - error: "invalid component: " - '401': - description: Cannot authenticate request - content: - application/json: - schema: - $ref: '#/components/schemas/badRequestPayload' - examples: - authenticationFailed: - summary: Request authentication failed - value: - error: "Request authentication failed" - programNotValid: - summary: Loyalty program is not valid for the client - value: - error: "Loyalty program is not valid for the client" - '422': - description: Contact Id is invalid - content: - application/json: - schema: - $ref: '#/components/schemas/contactIdInvalidResponse' - examples: - invalidContactId: - summary: Invalid contact id - value: - error: "invalid contact id" - subscriptionIdNotFound: - summary: Subscription id not found - value: - error: "subscription id not found" - invalidLoyaltySubscriptionId: - summary: Invalid loyalty subscription id - value: - error: "invalid loyalty subscription id" - invalidLoyaltyProgramId: - summary: Invalid loyalty program Id - value: - error: "Invalid loyalty program id" - failedToGetDeDetails: - summary: Failed to get de details - value: - error: "failed to get de details" - + enum: + - balance + - tier + - reward + - member + uniqueItems: true + style: form + explode: false + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/getSubscriptionInfoResponse' + '400': + description: Bad request error + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + contactIdIsInvalid: + summary: Contact id is valid + value: + error: "invalid contact id: invalid format" + contactIdOrLoyaltySubscriptionIdNotProvided: + summary: Contact id or loyalty subscription id not provided + value: + error: "either contact id or loyalty subscription id is invalid" + invalidComponent: + summary: Invalid component + value: + error: "invalid component: " + '401': + description: Cannot authenticate request + content: + application/json: + schema: + $ref: '#/components/schemas/badRequestPayload' + examples: + authenticationFailed: + summary: Request authentication failed + value: + error: "Request authentication failed" + programNotValid: + summary: Loyalty program is not valid for the client + value: + error: "Loyalty program is not valid for the client" + '422': + description: Contact Id is invalid + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidContactId: + summary: Invalid contact id + value: + error: "invalid contact id" + subscriptionIdNotFound: + summary: Subscription id not found + value: + error: "subscription id not found" + invalidLoyaltySubscriptionId: + summary: Invalid loyalty subscription id + value: + error: "invalid loyalty subscription id" + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + failedToGetDeDetails: + summary: Failed to get de details + value: + error: "failed to get de details" + # Offer /loyalty/offer/programs/{loyaltyProgramId}/rewards/attribute: post: @@ -6011,24 +6012,24 @@ paths: value: error: "Total attribution count exceeded" '422': - description: Unprocessable Content - content: - application/json: - schema: - $ref: '#/components/schemas/contactIdInvalidResponse' - examples: - invalidLoyaltyProgramId: - summary: Invalid loyalty program Id - value: - error: "Invalid loyalty program id" - failedToGetDeDetails: - summary: Failed to get de details - value: - error: "failed to get de details" - rewardIdRequired: - summary: RewardId is required field - value: - error: "rewardId is a required field" + description: Unprocessable Content + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + failedToGetDeDetails: + summary: Failed to get de details + value: + error: "failed to get de details" + rewardIdRequired: + summary: RewardId is required field + value: + error: "rewardId is a required field" '424': description: Invalid subcomponent content: @@ -6041,7 +6042,7 @@ paths: value: error: "Pool not found" /loyalty/offer/programs/{loyaltyProgramId}/rewards/validate: - post: + post: tags: - Rewards summary: Validates a voucher @@ -6109,42 +6110,42 @@ paths: schema: $ref: '#/components/schemas/subscriptionNotFoundErrorResponse' examples: - subscriptionNotFound: - summary: Subscription not found - value: - error: "Subscription not found" - pointOfSellNotFound: - summary: Point of sell id not found - value: - error: "Point of sell id not found" + subscriptionNotFound: + summary: Subscription not found + value: + error: "Subscription not found" + pointOfSellNotFound: + summary: Point of sell id not found + value: + error: "Point of sell id not found" '422': - description: Unprocessable Content - content: - application/json: - schema: - $ref: '#/components/schemas/contactIdInvalidResponse' - examples: - invalidLoyaltyProgramId: - summary: Invalid loyalty program Id - value: - error: "Invalid loyalty program id" - oneOfContactIdSubscriptionIdRequired: - summary: Either contact id or loyalty subscription id is required. - value: - error: "Either contact id or loyalty subscription id must be provided" + description: Unprocessable Content + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + oneOfContactIdSubscriptionIdRequired: + summary: Either contact id or loyalty subscription id is required. + value: + error: "Either contact id or loyalty subscription id must be provided" '424': - description: Invalid subcomponent - content: - application/json: - schema: - $ref: '#/components/schemas/contactIdInvalidResponse' - examples: - invalidServiceOrActionRule: - summary: Invalid service or action of rule - value: - error: "Invalid service or action of rule" + description: Invalid subcomponent + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidServiceOrActionRule: + summary: Invalid service or action of rule + value: + error: "Invalid service or action of rule" /loyalty/offer/programs/{loyaltyProgramId}/rewards/redeem: - post: + post: tags: - Rewards summary: Redeem reward @@ -6220,14 +6221,14 @@ paths: schema: $ref: '#/components/schemas/subscriptionNotFoundErrorResponse' examples: - pointOfSellNotFound: - summary: Point of sell id not found - value: - error: "Point of sell id not found" - subscriptionNotFound: - summary: Subscription not found - value: - error: "Subscription not found" + pointOfSellNotFound: + summary: Point of sell id not found + value: + error: "Point of sell id not found" + subscriptionNotFound: + summary: Subscription not found + value: + error: "Subscription not found" '412': description: Attributed reward errors, precondition failed content: @@ -6264,20 +6265,20 @@ paths: value: error: "Reward per consumer redeem limit reached" '422': - description: Unprocessable Content - content: - application/json: - schema: - $ref: '#/components/schemas/contactIdInvalidResponse' - examples: - invalidLoyaltyProgramId: - summary: Invalid loyalty program Id - value: - error: "Invalid loyalty program id" - oneOfContactIdSubscriptionIdRequired: - summary: Either contact id or loyalty subscription id is required. - value: - error: "Either contact id or loyalty subscription id must be provided" + description: Unprocessable Content + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + oneOfContactIdSubscriptionIdRequired: + summary: Either contact id or loyalty subscription id is required. + value: + error: "Either contact id or loyalty subscription id must be provided" /loyalty/offer/programs/{loyaltyProgramId}/offers: get: tags: @@ -6310,17 +6311,17 @@ paths: in: query schema: type: string - enum: [all, active, pending, disabled, expired] + enum: [ all, active, pending, disabled, expired ] default: all description: State of the reward - name: rewardVersion in: query schema: type: string - enum: [active, draft] + enum: [ active, draft ] default: draft description: Select 'active' to retrieve list of all rewards which are live for clients. - Select draft to retrieve list of all non deleted rewards. + Select draft to retrieve list of all non deleted rewards. responses: '200': description: Successful operation @@ -6362,20 +6363,20 @@ paths: value: error: "Loyalty program is not valid for the client" '422': - description: Unprocessable Content - content: - application/json: - schema: - $ref: '#/components/schemas/contactIdInvalidResponse' - examples: - invalidLoyaltyProgramId: - summary: Invalid loyalty program Id - value: - error: "Invalid loyalty program id" - invalidOffsetMin: - summary: Invalid offset minimum - value: - error: "Offset must be 0 or greater" + description: Unprocessable Content + content: + application/json: + schema: + $ref: '#/components/schemas/contactIdInvalidResponse' + examples: + invalidLoyaltyProgramId: + summary: Invalid loyalty program Id + value: + error: "Invalid loyalty program id" + invalidOffsetMin: + summary: Invalid offset minimum + value: + error: "Offset must be 0 or greater" /loyalty/offer/programs/{loyaltyProgramId}/rewards/revoke: delete: tags: @@ -6457,21 +6458,21 @@ paths: in: query schema: type: string - enum: [name, createdAt, updatedAt] + enum: [ name, createdAt, updatedAt ] default: name description: Sort documents by field - name: sort in: query schema: type: string - enum: [asc, desc] + enum: [ asc, desc ] default: desc description: Sort the documents in the ascending or descending order - name: version in: query schema: type: string - enum: [active, draft] + enum: [ active, draft ] default: draft description: Select 'active' to retrieve list of all balances which are live for clients. Select draft to retrieve list of all non deleted balances. responses: @@ -6484,8 +6485,8 @@ paths: '400': description: Bad request error content: - application/json: - schema: + application/json: + schema: $ref: '#/components/schemas/badRequestPayload' examples: invalidLoyaltyProgramId: @@ -6681,7 +6682,7 @@ paths: in: query required: false schema: - enum: + enum: - active - draft default: draft @@ -6740,7 +6741,7 @@ paths: tags: - Balance summary: Update balance definition - description: Updates Balance definition + description: Updates Balance definition parameters: - name: loyaltyProgramId description: Loyalty Program Id @@ -6806,10 +6807,10 @@ paths: content: application/json: examples: - missingNameField: - summary: Not found - value: - error: "not found" + missingNameField: + summary: Not found + value: + error: "not found" '422': description: Validation errors content: @@ -6899,7 +6900,7 @@ paths: format: uuid responses: '204': - description: Successful operation + description: Successful operation '400': description: Bad request error content: @@ -7047,7 +7048,7 @@ paths: in: query required: false schema: - enum: + enum: - active - draft default: draft @@ -7453,7 +7454,7 @@ paths: summary: Balance definition ID is a required field value: error: "balanceDefinitionId is a required field" - + /loyalty/balance/programs/{loyaltyProgramId}/transactions: post: tags: @@ -7880,8 +7881,8 @@ paths: summary: Invalid expiration time value: error: "expiresAt must be ahead of due order time" - - #Tier + + #Tier /loyalty/tier/programs/{loyaltyProgramId}/tier-groups: post: tags: @@ -7988,10 +7989,10 @@ paths: in: query schema: type: string - enum: [active, draft] + enum: [ active, draft ] default: draft description: Select 'active' to retrieve list of all tier groups which are live for clients. - Select draft to retrieve list of all non deleted tier groups. + Select draft to retrieve list of all non deleted tier groups. responses: '200': description: Tier group page @@ -8218,7 +8219,7 @@ paths: summary: Tier group not found value: message: "Tier group not found" - + get: tags: - Tier @@ -8244,7 +8245,7 @@ paths: in: query schema: type: string - enum: [active, draft] + enum: [ active, draft ] default: draft description: Select active to retrieve active version of tier group. Select draft to retrieve latest changes in tier group. responses: @@ -8300,7 +8301,7 @@ paths: summary: Version invalid value: message: "version must be one of [active draft]" - + /loyalty/tier/programs/{loyaltyProgramId}/tiers: get: tags: @@ -8320,10 +8321,10 @@ paths: in: query schema: type: string - enum: [active, draft] + enum: [ active, draft ] default: draft description: Select 'active' to retrieve list of all tiers which are live for clients. - Select draft to retrieve list of all non deleted tiers. + Select draft to retrieve list of all non deleted tiers. responses: '200': description: Loyalty program tier page @@ -8353,7 +8354,7 @@ paths: summary: Version must be one of [active draft] value: message: "Version must be one of [active draft]" - + /loyalty/tier/programs/{loyaltyProgramId}/tier-groups/{tierGroupId}/tiers: post: tags: @@ -8439,7 +8440,7 @@ paths: summary: Minimum value is required value: message: "minimumValue is a required field" - + /loyalty/tier/programs/{loyaltyProgramId}/tiers/{tierId}: delete: tags: @@ -8488,7 +8489,7 @@ paths: summary: Tier not found value: message: "Tier not found" - + put: tags: - Tier @@ -8570,7 +8571,7 @@ paths: summary: Parsing error value: message: "Parsing error: unmarshal json" - + /loyalty/tier/programs/{loyaltyProgramId}/contacts/{contactId}/tiers/{tierId}: post: tags: @@ -8665,21 +8666,21 @@ paths: /senders: get: tags: - - Senders + - Senders summary: Get the list of all your senders operationId: getSenders parameters: - - name: ip - in: query - description: | - Filter your senders for a specific ip. **Available for dedicated IP usage only** - schema: - type: string - - name: domain - in: query - description: Filter your senders for a specific domain - schema: - type: string + - name: ip + in: query + description: | + Filter your senders for a specific ip. **Available for dedicated IP usage only** + schema: + type: string + - name: domain + in: query + description: Filter your senders for a specific domain + schema: + type: string responses: 200: description: list of senders @@ -8691,25 +8692,25 @@ paths: response: value: senders: - - id: 1 - name: Marketing - email: marketing@mycompany.com - active: true - ips: - - ip: 123.98.689.7 - domain: mycompany.com - weight: 100 - - id: 2 - name: Newsletter - email: newsletter@mycompany.com - active: false - ips: - - ip: 123.98.689.7 - domain: mycompany.com - weight: 50 - - ip: 123.98.643.2 - domain: news.mycompany.com - weight: 50 + - id: 1 + name: Marketing + email: marketing@mycompany.com + active: true + ips: + - ip: 123.98.689.7 + domain: mycompany.com + weight: 100 + - id: 2 + name: Newsletter + email: newsletter@mycompany.com + active: false + ips: + - ip: 123.98.689.7 + domain: mycompany.com + weight: 50 + - ip: 123.98.643.2 + domain: news.mycompany.com + weight: 50 400: description: bad request content: @@ -8718,7 +8719,7 @@ paths: $ref: '#/components/schemas/errorModel' post: tags: - - Senders + - Senders summary: Create a new sender operationId: createSender requestBody: @@ -8745,17 +8746,17 @@ paths: /senders/{senderId}: put: tags: - - Senders + - Senders summary: Update a sender operationId: updateSender parameters: - - name: senderId - in: path - description: Id of the sender - required: true - schema: - type: integer - format: int64 + - name: senderId + in: path + description: Id of the sender + required: true + schema: + type: integer + format: int64 requestBody: description: sender's name content: @@ -8766,7 +8767,7 @@ paths: responses: 204: description: sender updated - content: {} + content: { } 400: description: bad request content: @@ -8782,21 +8783,21 @@ paths: x-codegen-request-body-name: sender delete: tags: - - Senders + - Senders summary: Delete a sender operationId: deleteSender parameters: - - name: senderId - in: path - description: Id of the sender - required: true - schema: - type: integer - format: int64 + - name: senderId + in: path + description: Id of the sender + required: true + schema: + type: integer + format: int64 responses: 204: description: sender deleted - content: {} + content: { } 400: description: bad request content: @@ -8812,17 +8813,17 @@ paths: /senders/{senderId}/validate: put: tags: - - Senders + - Senders summary: Validate Sender using OTP operationId: validateSenderByOTP parameters: - - name: senderId - in: path - description: Id of the sender - required: true - schema: - type: integer - format: int64 + - name: senderId + in: path + description: Id of the sender + required: true + schema: + type: integer + format: int64 requestBody: description: otp content: @@ -8833,7 +8834,7 @@ paths: responses: 204: description: Sender verified - content: {} + content: { } 400: description: bad request content: @@ -8850,17 +8851,17 @@ paths: /senders/{senderId}/ips: get: tags: - - Senders + - Senders summary: Get all the dedicated IPs for a sender operationId: getIpsFromSender parameters: - - name: senderId - in: path - description: Id of the sender - required: true - schema: - type: integer - format: int64 + - name: senderId + in: path + description: Id of the sender + required: true + schema: + type: integer + format: int64 responses: 200: description: list of dedicated IPs @@ -8872,14 +8873,14 @@ paths: response: value: ips: - - id: 3 - ip: 123.65.8.22 - domain: mailing.myshop.dom - weight: 40 - - id: 5 - ip: 123.43.21.3 - domain: newsletter.myshop.dom - weight: 60 + - id: 3 + ip: 123.65.8.22 + domain: mailing.myshop.dom + weight: 40 + - id: 5 + ip: 123.43.21.3 + domain: newsletter.myshop.dom + weight: 60 400: description: bad request content: @@ -8895,7 +8896,7 @@ paths: /senders/ips: get: tags: - - Senders + - Senders summary: Get all the dedicated IPs for your account operationId: getIps responses: @@ -8909,22 +8910,22 @@ paths: response: value: ips: - - id: 3 - ip: 67.145.89.3 - active: true - domain: mailing.myshop.com - - id: 5 - ip: 76.76.125.9 - active: true - domain: newsletter.myshop.com - - id: 6 - ip: 123.65.8.22 - active: false - domain: notifications.myshop.com + - id: 3 + ip: 67.145.89.3 + active: true + domain: mailing.myshop.com + - id: 5 + ip: 76.76.125.9 + active: true + domain: newsletter.myshop.com + - id: 6 + ip: 123.65.8.22 + active: false + domain: notifications.myshop.com /senders/domains: get: tags: - - Domains + - Domains summary: Get the list of all your domains operationId: getDomains responses: @@ -8938,16 +8939,16 @@ paths: response: value: domains: - - id: 1 - domain_name: mycompany.com - authenticated: true - verified: true - ip: 123.98.689.7 - - id: 2 - domain_name: myexample.com - authenticated: false - verified: true - ip: null + - id: 1 + domain_name: mycompany.com + authenticated: true + verified: true + ip: 123.98.689.7 + - id: 2 + domain_name: myexample.com + authenticated: false + verified: true + ip: null 400: description: bad request content: @@ -8955,48 +8956,48 @@ paths: schema: $ref: '#/components/schemas/errorModel' post: - tags: + tags: - Domains - summary: Create a new domain - operationId: createDomain - requestBody: - description: domain's name + summary: Create a new domain + operationId: createDomain + requestBody: + description: domain's name + content: + application/json: + schema: + $ref: '#/components/schemas/createDomain' + required: false + responses: + 200: + description: domain created content: application/json: schema: - $ref: '#/components/schemas/createDomain' - required: false - responses: - 200: - description: domain created - content: - application/json: - schema: - $ref: '#/components/schemas/createDomainModel' - 400: - description: bad request - content: - application/json: - schema: - $ref: '#/components/schemas/errorModel' - x-codegen-request-body-name: domain + $ref: '#/components/schemas/createDomainModel' + 400: + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' + x-codegen-request-body-name: domain /senders/domains/{domainName}: delete: tags: - - Domains + - Domains summary: Delete a domain operationId: deleteDomain parameters: - - name: domainName - in: path - description: Domain name - required: true - schema: - type: string + - name: domainName + in: path + description: Domain name + required: true + schema: + type: string responses: 200: description: domain deleted - content: {} + content: { } 400: description: bad request content: @@ -9011,16 +9012,16 @@ paths: $ref: '#/components/schemas/errorModel' get: tags: - - Domains + - Domains summary: Validate domain configuration operationId: getDomainConfiguration parameters: - - name: domainName - in: path - description: Domain name - required: true - schema: - type: string + - name: domainName + in: path + description: Domain name + required: true + schema: + type: string responses: 200: description: domain configuration @@ -9043,16 +9044,16 @@ paths: /senders/domains/{domainName}/authenticate: put: tags: - - Domains + - Domains summary: Authenticate a domain operationId: authenticateDomain parameters: - - name: domainName - in: path - description: Domain name - required: true - schema: - type: string + - name: domainName + in: path + description: Domain name + required: true + schema: + type: string responses: 200: description: domain authenticated @@ -9076,30 +9077,30 @@ paths: /webhooks: get: tags: - - Webhooks + - Webhooks summary: Get all webhooks operationId: getWebhooks parameters: - - name: type - in: query - description: Filter on webhook type - schema: - type: string - default: transactional - enum: - - marketing - - transactional - - inbound - - name: sort - in: query - description: Sort the results in the ascending/descending order of webhook creation - required: false - schema: - type: string - enum: - - asc - - desc - default: desc + - name: type + in: query + description: Filter on webhook type + schema: + type: string + default: transactional + enum: + - marketing + - transactional + - inbound + - name: sort + in: query + description: Sort the results in the ascending/descending order of webhook creation + required: false + schema: + type: string + enum: + - asc + - desc + default: desc responses: 200: description: Webhooks informations @@ -9111,29 +9112,29 @@ paths: response: value: webhooks: - - url: https://example.domain.com/webhook/events/kzfxxxxxxxx0uyo1 - id: 9864 - description: Webhook triggered on campaign openings - events: - - opened - type: transac - createdAt: 2016-07-18T12:30:09Z - modifiedAt: 2016-07-18T16:00:50Z - batched: true - auth: - type: bearer - token: test-auth-token1234 - headers: - - key: cf-secret - value: test-header-value - - url: http://exmaple.domain.com/15kxxxxxn1 - id: 22770 - description: Webhook triggered on campaign hard bounces - events: - - hardBounces - type: marketing - createdAt: 2017-02-20T14:30:00Z - modifiedAt: 2017-02-20T19:00:00Z + - url: https://example.domain.com/webhook/events/kzfxxxxxxxx0uyo1 + id: 9864 + description: Webhook triggered on campaign openings + events: + - opened + type: transac + createdAt: 2016-07-18T12:30:09Z + modifiedAt: 2016-07-18T16:00:50Z + batched: true + auth: + type: bearer + token: test-auth-token1234 + headers: + - key: cf-secret + value: test-header-value + - url: http://exmaple.domain.com/15kxxxxxn1 + id: 22770 + description: Webhook triggered on campaign hard bounces + events: + - hardBounces + type: marketing + createdAt: 2017-02-20T14:30:00Z + modifiedAt: 2017-02-20T19:00:00Z 400: description: bad request content: @@ -9142,7 +9143,7 @@ paths: $ref: '#/components/schemas/errorModel' post: tags: - - Webhooks + - Webhooks summary: Create a webhook operationId: createWebhook requestBody: @@ -9165,17 +9166,17 @@ paths: /webhooks/{webhookId}: get: tags: - - Webhooks + - Webhooks summary: Get a webhook details operationId: getWebhook parameters: - - name: webhookId - in: path - description: Id of the webhook - required: true - schema: - type: integer - format: int64 + - name: webhookId + in: path + description: Id of the webhook + required: true + schema: + type: integer + format: int64 responses: 200: description: Webhook informations @@ -9191,8 +9192,8 @@ paths: description: Webhook triggered on campaign openings and addition of lists events: - - listAdditions - - opened + - listAdditions + - opened type: marketing createdAt: 2016-06-07T09:10:10Z modifiedAt: 2016-06-08T11:30:00Z @@ -9217,17 +9218,17 @@ paths: $ref: '#/components/schemas/errorModel' put: tags: - - Webhooks + - Webhooks summary: Update a webhook operationId: updateWebhook parameters: - - name: webhookId - in: path - description: Id of the webhook - required: true - schema: - type: integer - format: int64 + - name: webhookId + in: path + description: Id of the webhook + required: true + schema: + type: integer + format: int64 requestBody: description: Values to update a webhook content: @@ -9238,7 +9239,7 @@ paths: responses: 204: description: Webhook updated - content: {} + content: { } 400: description: bad request content: @@ -9254,21 +9255,21 @@ paths: x-codegen-request-body-name: updateWebhook delete: tags: - - Webhooks + - Webhooks summary: Delete a webhook operationId: deleteWebhook parameters: - - name: webhookId - in: path - description: Id of the webhook - required: true - schema: - type: integer - format: int64 + - name: webhookId + in: path + description: Id of the webhook + required: true + schema: + type: integer + format: int64 responses: 204: description: Webhook deleted - content: {} + content: { } 400: description: bad request content: @@ -9294,7 +9295,7 @@ paths: application/json: schema: oneOf: - - $ref: '#/components/schemas/exportWebhooksHistory' + - $ref: '#/components/schemas/exportWebhooksHistory' required: true responses: 202: @@ -9312,7 +9313,7 @@ paths: /account: get: tags: - - Account + - Account summary: Get your account information, plan and credits details operationId: getAccount responses: @@ -9326,17 +9327,17 @@ paths: response: value: plan: - - type: payAsYouGo - credits: 5000 - creditsType: sendLimit - - type: subscription - credits: 39983 - creditsType: sendLimit - startDate: 2017-03-11 - endDate: 2017-04-11 - - type: sms - credits: 999.5360000000001 - creditsType: sendLimit + - type: payAsYouGo + credits: 5000 + creditsType: sendLimit + - type: subscription + credits: 39983 + creditsType: sendLimit + startDate: 2017-03-11 + endDate: 2017-04-11 + - type: sms + credits: 999.5360000000001 + creditsType: sendLimit relay: enabled: true data: @@ -9358,8 +9359,8 @@ paths: /organization/activities: get: tags: - - Account - - Master account + - Account + - Master account summary: Get user activity logs operationId: getAccountActivity parameters: @@ -9392,7 +9393,7 @@ paths: schema: type: integer format: int64 - default : 0 + default: 0 responses: 200: description: list of user activity logs @@ -9403,18 +9404,18 @@ paths: examples: response: value: - logs: - - action: login-success - date: 2023-03-16T16:49:23+05:30 - user_email: test@mycompany.com - user_ip: 192.158.1.34 - user_agent: Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) - - action: update-profile - date: 2023-03-15T16:49:23+05:30 - user_email: test@myexample.com - user_ip: 192.158.1.38 - user_agent: Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) - count: 2 + logs: + - action: login-success + date: 2023-03-16T16:49:23+05:30 + user_email: test@mycompany.com + user_ip: 192.158.1.34 + user_agent: Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) + - action: update-profile + date: 2023-03-15T16:49:23+05:30 + user_email: test@myexample.com + user_ip: 192.158.1.38 + user_agent: Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) + count: 2 400: description: bad request content: @@ -9424,7 +9425,7 @@ paths: /organization/invited/users: get: tags: - - User + - User summary: Get the list of all your users operationId: getInvitedUsersList responses: @@ -9437,28 +9438,28 @@ paths: examples: response: value: - users: - - email: owner@company.com - is_owner: true - status: active - feature_access: - marketing: owner - conversations: owner - crm: owner - - email: pendingInvitedUser@company.com - is_owner: false - status: pending - feature_access: - marketing: custom - conversations: none - crm: full - - email: connectedInvitedUser@company.com - is_owner: false - status: active - feature_access: - marketing: none - conversations: full - crm: none + users: + - email: owner@company.com + is_owner: true + status: active + feature_access: + marketing: owner + conversations: owner + crm: owner + - email: pendingInvitedUser@company.com + is_owner: false + status: pending + feature_access: + marketing: custom + conversations: none + crm: full + - email: connectedInvitedUser@company.com + is_owner: false + status: active + feature_access: + marketing: none + conversations: full + crm: none 400: description: bad request content: @@ -9468,7 +9469,7 @@ paths: /organization/user/{email}/permissions: get: tags: - - User + - User summary: Check user permission operationId: getUserPermission parameters: @@ -9488,68 +9489,68 @@ paths: examples: response: value: - email: invitedUser@company.com - status: active - privileges: - - feature: Email campaign - permissions: - - Create / edit / delete - - Send / schedule / suspend - - feature: Templates - permissions: - - Create / edit / delete - - Activate / deactivate - - feature: SMS campaign - permissions: - - Create / edit / delete - - Send / schedule / suspend - - feature: Facebook Ads - permissions: - - Schedule / pause - - feature: Landing pages - permissions: - - All - - feature: Workflows - permissions: - - Create / edit / delete - - Activate / deactivate / Pause - - feature: Contacts - permissions: - - View - - Contact forms - - feature: SMTP & API - permissions: - - SMTP - - API Keys - - Authorized IPs - - feature: User management - permissions: - - None - - feature: Sales Platform - permissions: - - Create / edit / delete owned deals and tasks - - Manage deals and tasks from other users - - Reports - - Settings - - feature: Conversations - permissions: - - None - - feature: Senders, Domains & Dedicated IPs - permissions: - - Senders management - - Domains management - - Dedicated IPs management - - feature: Push - permissions: - - View - - Create / edit / delete - - Send - - Settings - - feature: Companies - permissions: - - Create / edit / delete owned companies - - Manage companies from other users - - Settings + email: invitedUser@company.com + status: active + privileges: + - feature: Email campaign + permissions: + - Create / edit / delete + - Send / schedule / suspend + - feature: Templates + permissions: + - Create / edit / delete + - Activate / deactivate + - feature: SMS campaign + permissions: + - Create / edit / delete + - Send / schedule / suspend + - feature: Facebook Ads + permissions: + - Schedule / pause + - feature: Landing pages + permissions: + - All + - feature: Workflows + permissions: + - Create / edit / delete + - Activate / deactivate / Pause + - feature: Contacts + permissions: + - View + - Contact forms + - feature: SMTP & API + permissions: + - SMTP + - API Keys + - Authorized IPs + - feature: User management + permissions: + - None + - feature: Sales Platform + permissions: + - Create / edit / delete owned deals and tasks + - Manage deals and tasks from other users + - Reports + - Settings + - feature: Conversations + permissions: + - None + - feature: Senders, Domains & Dedicated IPs + permissions: + - Senders management + - Domains management + - Dedicated IPs management + - feature: Push + permissions: + - View + - Create / edit / delete + - Send + - Settings + - feature: Companies + permissions: + - Create / edit / delete owned companies + - Manage companies from other users + - Settings 400: description: bad request content: @@ -9560,7 +9561,7 @@ paths: /organization/user/invitation/revoke/{email}: put: tags: - - User + - User summary: Revoke user permission operationId: putRevokeUserPermission parameters: @@ -9586,7 +9587,7 @@ paths: /organization/user/invitation/{action}/{email}: put: tags: - - User + - User summary: Resend / Cancel invitation operationId: putresendcancelinvitation parameters: @@ -9597,8 +9598,8 @@ paths: schema: type: string enum: - - resend - - cancel + - resend + - cancel - name: email description: Email of the invited user. in: path @@ -9610,18 +9611,18 @@ paths: description: Success content: application/json: - schema: + schema: $ref: '#/components/schemas/putresendcancelinvitationResponse' 403: description: Unauthorized access content: application/json: - schema: - $ref: '#/components/schemas/errorModel' + schema: + $ref: '#/components/schemas/errorModel' /organization/user/invitation/send: post: tags: - - User + - User summary: Send invitation to user description: | `Feature` - A Feature represents a specific functionality like Email campaign, Deals, Calls, Automations, etc. on Brevo. While inviting a user, determine which feature you want to manage access to. You must specify the feature accurately to avoid errors. @@ -9706,7 +9707,7 @@ paths: description: Success content: application/json: - schema: + schema: $ref: '#/components/schemas/inviteuserResponse' 400: description: Bad request @@ -9717,7 +9718,7 @@ paths: /organization/user/update/permissions: post: tags: - - User + - User summary: Update permission for a user description: | `Feature` - A Feature represents a specific functionality like Email campaign, Deals, Calls, Automations, etc. on Brevo. While inviting a user, determine which feature you want to manage access to. You must specify the feature accurately to avoid errors. @@ -9802,7 +9803,7 @@ paths: description: Success content: application/json: - schema: + schema: $ref: '#/components/schemas/updateUserResponse' 400: description: Bad request @@ -9814,36 +9815,36 @@ paths: /processes: get: tags: - - Process + - Process summary: Return all the processes for your account operationId: getProcesses parameters: - - name: limit - in: query - description: Number limitation for the result returned - schema: - maximum: 50 - minimum: 0 - type: integer - format: int64 - default: 10 - - name: offset - in: query - description: Beginning point in the list to retrieve from. - schema: - type: integer - format: int64 - default: 0 - - name: sort - in: query - description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc + - name: limit + in: query + description: Number limitation for the result returned + schema: + maximum: 50 + minimum: 0 + type: integer + format: int64 + default: 10 + - name: offset + in: query + description: Beginning point in the list to retrieve from. + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc responses: 200: description: processes informations @@ -9855,17 +9856,17 @@ paths: response: value: processes: - - id: 40 - status: completed - name: TRANS-CALC - - id: 43 - status: queued - name: TRANS-GLOBAL-CALC - - id: 194 - status: completed - name: SEARCH_EXPORT_USERS - export_url: filename.csv + - id: 40 + status: completed + name: TRANS-CALC + - id: 43 + status: queued + name: TRANS-GLOBAL-CALC + - id: 194 + status: completed + name: SEARCH_EXPORT_USERS + export_url: filename.csv count: 3 400: description: bad request @@ -9876,17 +9877,17 @@ paths: /processes/{processId}: get: tags: - - Process + - Process summary: Return the informations for a process operationId: getProcess parameters: - - name: processId - in: path - description: Id of the process - required: true - schema: - type: integer - format: int64 + - name: processId + in: path + description: Id of the process + required: true + schema: + type: integer + format: int64 responses: 200: description: process informations @@ -9925,54 +9926,54 @@ paths: description: This endpoint will show the list of all the events for the received emails. operationId: getInboundEmailEvents parameters: - - name: sender - description: Email address of the sender. - in: query - required: false - schema: - type: string - - name: startDate - description: Mandatory if endDate is used. Starting date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) from which you want to fetch the list. Maximum time period that can be selected is one month. - in: query - required: false - schema: - type: string - format: datetime - - name: endDate - description: Mandatory if startDate is used. Ending date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) till which you want to fetch the list. Maximum time period that can be selected is one month. - in: query - required: false - schema: - type: string - format: datetime - - name: limit - description: Number of documents returned per page - in: query - required: false - schema: - type: integer - format: int64 - default: 100 - maximum: 500 - minimum: 0 - - name: offset - description: Index of the first document on the page - in: query - required: false - schema: - type: integer - format : int64 - default: 0 - - name: sort - in: query - description: Sort the results in the ascending/descending order of record creation - required: false - schema: - type: string - enum: - - asc - - desc - default: desc + - name: sender + description: Email address of the sender. + in: query + required: false + schema: + type: string + - name: startDate + description: Mandatory if endDate is used. Starting date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) from which you want to fetch the list. Maximum time period that can be selected is one month. + in: query + required: false + schema: + type: string + format: datetime + - name: endDate + description: Mandatory if startDate is used. Ending date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) till which you want to fetch the list. Maximum time period that can be selected is one month. + in: query + required: false + schema: + type: string + format: datetime + - name: limit + description: Number of documents returned per page + in: query + required: false + schema: + type: integer + format: int64 + default: 100 + maximum: 500 + minimum: 0 + - name: offset + description: Index of the first document on the page + in: query + required: false + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation + required: false + schema: + type: string + enum: + - asc + - desc + default: desc responses: 200: description: List of events for received emails. @@ -9984,14 +9985,14 @@ paths: response: value: events: - - uuid: "1a825d56-029b-4a41-b8e4-1a825d56" - date: "2017-03-11T12:30:00.000Z" - sender: "john@example.com" - recipient: "alexa@example.com" - - uuid: "1a825d56-029b-4a41-b8e4-61670463431b" - date: "2017-03-12T12:30:00.000Z" - sender: "alice@example.com" - recipient: "bob@example.com" + - uuid: "1a825d56-029b-4a41-b8e4-1a825d56" + date: "2017-03-11T12:30:00.000Z" + sender: "john@example.com" + recipient: "alexa@example.com" + - uuid: "1a825d56-029b-4a41-b8e4-61670463431b" + date: "2017-03-12T12:30:00.000Z" + sender: "alice@example.com" + recipient: "bob@example.com" 400: description: bad request content: @@ -10006,12 +10007,12 @@ paths: description: This endpoint will show the list of all events history for one particular received email. operationId: getInboundEmailEventsByUuid parameters: - - name: uuid - description: 'UUID to fetch events specific to recieved email' - in: path - required: true - schema: - type: string + - name: uuid + description: 'UUID to fetch events specific to recieved email' + in: path + required: true + schema: + type: string responses: 200: description: Email campaign informations @@ -10055,12 +10056,12 @@ paths: description: This endpoint will retrieve inbound attachment with download token. operationId: getInboundEmailAttachment parameters: - - name: downloadToken - description: 'Token to fetch a particular attachment' - in: path - required: true - schema: - type: string + - name: downloadToken + description: 'Token to fetch a particular attachment' + in: path + required: true + schema: + type: string responses: 200: description: Attachment information @@ -10102,18 +10103,18 @@ paths: summary: Get the list of all the sub-accounts of the master account. description: This endpoint will provide the list all the sub-accounts of the master account. parameters: - - name: offset - description: 'Index of the first sub-account in the page' - in: query - required: true - schema: - type: integer - - name: limit - description: 'Number of sub-accounts to be displayed on each page' - in: query - required: true - schema: - type: integer + - name: offset + description: 'Index of the first sub-account in the page' + in: query + required: true + schema: + type: integer + - name: limit + description: 'Number of sub-accounts to be displayed on each page' + in: query + required: true + schema: + type: integer responses: 200: description: Sub-accounts list @@ -10139,12 +10140,12 @@ paths: companyName: "Company2" active: true createdAt: 1629439311 - groups: [] + groups: [ ] - id: 3524191 companyName: "Company3" active: true createdAt: 1614713641 - groups: [] + groups: [ ] 400: description: bad request @@ -10218,30 +10219,30 @@ paths: planInfo: credits: emails: - quantity: 2000 - remaining: 1955 + quantity: 2000 + remaining: 1955 sms: - quantity: 2000 - remaining: 1955 + quantity: 2000 + remaining: 1955 wpSubscribers: - quantity: 2000 - remaining: 1955 + quantity: 2000 + remaining: 1955 whatsapp: - quantity: 100 - remaining: 50 + quantity: 100 + remaining: 50 externalFeeds: - quantity: 1 - remaining: 1 + quantity: 1 + remaining: 1 features: - inbox: - quantity: 20 - remaining: 12 - landingPage: - quantity: 25 - remaining: 14 - users: - quantity: 30 - remaining: 14 + inbox: + quantity: 20 + remaining: 12 + landingPage: + quantity: 25 + remaining: 14 + users: + quantity: 30 + remaining: 14 planType: paid 400: description: bad request @@ -10289,15 +10290,15 @@ paths: summary: Update sub-account plan description: This endpoint will update the sub-account plan. On the Corporate solution new version v2, you can set an unlimited number of credits in your sub-organization. Please pass the value “-1" to set the consumable in unlimited mode. parameters: - - name: id - in: path - description: Id of the sub-account organization - required: true - schema: - type: integer - format: int64 + - name: id + in: path + description: Id of the sub-account organization + required: true + schema: + type: integer + format: int64 requestBody: - description: Values to update a sub-account plan + description: Values to update a sub-account plan content: application/json: schema: @@ -10306,7 +10307,7 @@ paths: responses: 204: description: Sub account plan updated - content: {} + content: { } 400: description: bad request content: @@ -10327,7 +10328,7 @@ paths: /corporate/ssoToken: post: tags: - - Master account + - Master account summary: Generate SSO token to access admin account description: This endpoint generates an SSO token to authenticate and access the admin account using the endpoint https://account-app.brevo.com/account/login/corporate/sso/[token], where [token] will be replaced by the actual token. requestBody: @@ -10335,7 +10336,7 @@ paths: application/json: schema: required: - - email + - email type: object properties: email: @@ -10360,8 +10361,8 @@ paths: schema: $ref: '#/components/schemas/errorModel' example: - code: "invalid_parameter" - message: "Invalid email address" + code: "invalid_parameter" + message: "Invalid email address" 403: description: Current account is not an admin account content: @@ -10376,7 +10377,7 @@ paths: /corporate/subAccount/ssoToken: post: tags: - - Master account + - Master account summary: Generate SSO token to access sub-account description: This endpoint generates an sso token to authenticate and access a sub-account of the master using the account endpoint https://account-app.brevo.com/account/login/sub-account/sso/[token], where [token] will be replaced by the actual token. requestBody: @@ -10384,7 +10385,7 @@ paths: application/json: schema: required: - - id + - id type: object properties: id: @@ -10440,8 +10441,8 @@ paths: schema: $ref: '#/components/schemas/errorModel' example: - code: "invalid_parameter" - message: "Invalid sub-account id." + code: "invalid_parameter" + message: "Invalid sub-account id." 403: description: Current account is not a master account content: @@ -10574,15 +10575,15 @@ paths: summary: Enable/disable sub-account application(s) description: API endpoints for the Corporate owner to enable/disable applications on the sub-account parameters: - - name: id - in: path - description: Id of the sub-account organization (mandatory) - required: true - schema: - type: integer - format: int64 + - name: id + in: path + description: Id of the sub-account organization (mandatory) + required: true + schema: + type: integer + format: int64 requestBody: - description: List of applications to activate or deactivate on a sub-account + description: List of applications to activate or deactivate on a sub-account content: application/json: schema: @@ -10591,7 +10592,7 @@ paths: responses: 204: description: Sub-account application(s) enabled/disabled - content: {} + content: { } 400: description: bad request content: @@ -10633,7 +10634,7 @@ paths: format: int64 type: array description: Pass the list of sub-account Ids to be included in the group - example: [234322, 325553, 893432] + example: [ 234322, 325553, 893432 ] responses: 201: @@ -10661,7 +10662,7 @@ paths: /corporate/ip: get: tags: - - Master account + - Master account summary: List of all IPs description: This endpoint allows you to retrieve the list of active IPs on your Admin account responses: @@ -10672,24 +10673,24 @@ paths: schema: type: array items: - type: object - properties: - ip: - type: string - domain: - type: string - transactional: - type: boolean + type: object + properties: + ip: + type: string + domain: + type: string + transactional: + type: boolean examples: response: value: - - ip: "192.168.1.1" - domain: "example.com" - transactional: true - - ip: "192.168.1.2" - domain: "example.com" - transactional: false - + - ip: "192.168.1.1" + domain: "example.com" + transactional: true + - ip: "192.168.1.2" + domain: "example.com" + transactional: false + /corporate/subAccount/ip/associate: post: tags: @@ -10715,7 +10716,7 @@ paths: format: int64 type: array description: Pass the list of sub-account Ids to be associated with the IP address - example: [234322, 325553, 893432] + example: [ 234322, 325553, 893432 ] responses: 201: @@ -10727,7 +10728,7 @@ paths: examples: response: value: - [] + [ ] 400: description: Bad request content: @@ -10762,12 +10763,12 @@ paths: format: int64 type: array description: Pass the list of sub-account Ids to be dissociated from the IP address - example: [234322, 325553, 893432] + example: [ 234322, 325553, 893432 ] responses: 204: description: IP has been dissociated from sub-accounts successfully - content: {} + content: { } 400: description: Bad request content: @@ -10784,12 +10785,12 @@ paths: summary: GET a group details description: This endpoint allows you to retrieve a specific group’s information such as the list of sub-organizations and the user associated with the group. parameters: - - name: id - in: path - description: Id of the group of sub-organization - required: true - schema: - type: string + - name: id + in: path + description: Id of the group of sub-organization + required: true + schema: + type: string responses: 200: description: Group details @@ -10820,14 +10821,14 @@ paths: summary: Update a group of sub-accounts description: This endpoint allows to update a group of sub-accounts parameters: - - name: id - in: path - description: Id of the group - required: true - schema: - type: string + - name: id + in: path + description: Id of the group + required: true + schema: + type: string requestBody: - description: Group details to be updated. + description: Group details to be updated. content: application/json: schema: @@ -10843,12 +10844,12 @@ paths: format: int64 type: array description: Pass the list of sub-account Ids to be included in the group - example: [234322, 325553, 893432] + example: [ 234322, 325553, 893432 ] required: true responses: 204: description: Group details updated - content: {} + content: { } 400: description: bad request content: @@ -10889,11 +10890,11 @@ paths: summary: Delete sub-account from group description: This endpoint allows you to remove a sub-organization from a group. parameters: - - name: groupId - in: path - description: Group id - required: true - schema: + - name: groupId + in: path + description: Group id + required: true + schema: type: string requestBody: required: true @@ -10902,7 +10903,7 @@ paths: application/json: schema: required: - - subAccountIds + - subAccountIds type: object properties: subAccountIds: @@ -10911,11 +10912,11 @@ paths: items: type: integer format: int64 - example: [423432, 234323, 87678] + example: [ 423432, 234323, 87678 ] responses: 204: description: SubAccounts removed from the group - content: {} + content: { } 400: description: bad request content: @@ -10928,7 +10929,7 @@ paths: /corporate/user/invitation/send: post: tags: - - Master account + - Master account summary: Send invitation to an admin user description: | `This endpoint allows you to invite a member to manage the Admin account @@ -10998,21 +10999,21 @@ paths: - Resend an admin user invitation - Cancel an admin user invitation parameters: - - name: action - in: path - description: Action to be performed (cancel / resend) - required: true - schema: + - name: action + in: path + description: Action to be performed (cancel / resend) + required: true + schema: type: string enum: - - resend - - cancel - - name: email - in: path - description: Email address of the recipient - required: true - schema: - type: string + - resend + - cancel + - name: email + in: path + description: Email address of the recipient + required: true + schema: + type: string responses: 200: description: Response of the action performed @@ -11063,7 +11064,7 @@ paths: /corporate/invited/users: get: tags: - - Master account + - Master account summary: Get the list of all admin users description: This endpoint allows you to list all Admin users of your Admin account operationId: getCorporateInvitedUsersList @@ -11077,43 +11078,43 @@ paths: examples: response: value: - users: - - groups: - - id: 65b1f22c09d6ed67ef1cd123, - name: Test Group1 - - id: 43b1f16c09db4d67af1cd342, - name: Test Group2 - email: master-user2@company.com - is_owner: false - status: active - feature_access: - user_management: ["none"] - api_keys: ["all"] - my_plan: ["all"] - apps_management: ["none"] - sub_organization_groups: ["create", "edit_delete"] - create_sub_organizations: ["all"] - manage_sub_organizations: ["all"] - analytics: ["download_data", "create_alerts","my_looks","explore_create"] - security: ["all"] - - groups: [] - email: master-user3@company.com - is_owner: false - status: active - feature_access: - user_management: ["all"] - api_keys: ["none"] - my_plan: ["none"] - apps_management: ["all"] - sub_organization_groups: ["edit_delete"] - create_sub_organizations: ["all"] - manage_sub_organizations: ["all"] - analytics: ["create_alerts"] - security: ["none"] + users: + - groups: + - id: 65b1f22c09d6ed67ef1cd123, + name: Test Group1 + - id: 43b1f16c09db4d67af1cd342, + name: Test Group2 + email: master-user2@company.com + is_owner: false + status: active + feature_access: + user_management: [ "none" ] + api_keys: [ "all" ] + my_plan: [ "all" ] + apps_management: [ "none" ] + sub_organization_groups: [ "create", "edit_delete" ] + create_sub_organizations: [ "all" ] + manage_sub_organizations: [ "all" ] + analytics: [ "download_data", "create_alerts","my_looks","explore_create" ] + security: [ "all" ] + - groups: [ ] + email: master-user3@company.com + is_owner: false + status: active + feature_access: + user_management: [ "all" ] + api_keys: [ "none" ] + my_plan: [ "none" ] + apps_management: [ "all" ] + sub_organization_groups: [ "edit_delete" ] + create_sub_organizations: [ "all" ] + manage_sub_organizations: [ "all" ] + analytics: [ "create_alerts" ] + security: [ "none" ] /corporate/user/{email}/permissions: get: tags: - - Master account + - Master account summary: Check admin user permissions description: This endpoint will provide the list of admin user permissions operationId: getCorporateUserPermission @@ -11134,23 +11135,23 @@ paths: examples: response: value: - email: invitedUser@company.com - status: active - groups: - - id: 6543ab3667ffbb00142e4486 - name: Support - - id: 174bab366732bbce142e4412 - name: Technical - feature_access: - api_keys: ["all"] - my_plan: ["all"] - user_management: ["none"] - apps_management: ["all"] - sub_organization_groups: ["create", "edit_delete"] - create_sub_organizations: ["all"] - manage_sub_organizations: ["all"] - analytics: ["download_data", "create_alerts","my_looks","explore_create"] - security: ["all"] + email: invitedUser@company.com + status: active + groups: + - id: 6543ab3667ffbb00142e4486 + name: Support + - id: 174bab366732bbce142e4412 + name: Technical + feature_access: + api_keys: [ "all" ] + my_plan: [ "all" ] + user_management: [ "none" ] + apps_management: [ "all" ] + sub_organization_groups: [ "create", "edit_delete" ] + create_sub_organizations: [ "all" ] + manage_sub_organizations: [ "all" ] + analytics: [ "download_data", "create_alerts","my_looks","explore_create" ] + security: [ "all" ] 400: description: bad request content: @@ -11163,12 +11164,12 @@ paths: summary: Change admin user permissions description: This endpoint will allow you to change the permissions of Admin users of your Admin account parameters: - - name: email - in: path - description: Email address of Admin user - required: true - schema: - type: string + - name: email + in: path + description: Email address of Admin user + required: true + schema: + type: string requestBody: required: true description: Values to update an admin user permissions @@ -11178,27 +11179,27 @@ paths: all_features_access: false privileges: - feature: user_management - permissions: ["all"] + permissions: [ "all" ] - feature: api - permissions: ["all"] + permissions: [ "all" ] - feature: my_plan - permissions: ["none"] + permissions: [ "none" ] - feature: apps_management - permissions: ["all"] + permissions: [ "all" ] - feature: create_sub_organizations - permissions: ["all"] + permissions: [ "all" ] - feature: sub_organization_groups - permissions: ["create","edit_delete"] + permissions: [ "create","edit_delete" ] - feature: manage_sub_organizations - permissions: ["all"] + permissions: [ "all" ] - feature: security - permissions: ["none"] + permissions: [ "none" ] - feature: analytics - permissions: ["create_alerts","download_data","my_looks","explore_create"] + permissions: [ "create_alerts","download_data","my_looks","explore_create" ] schema: required: - - all_features_access - - privileges + - all_features_access + - privileges type: object properties: all_features_access: @@ -11242,11 +11243,11 @@ paths: - download_data - my_looks - explore_create - example: ["all"] + example: [ "all" ] responses: 204: description: User permissions has been modified - content: {} + content: { } 400: description: bad request content: @@ -11259,7 +11260,7 @@ paths: /corporate/groups: get: tags: - - Master account + - Master account summary: Get the list of groups description: This endpoint allows you to list all groups created on your Admin account. operationId: getSubAccountGroups @@ -11293,48 +11294,48 @@ paths: - Companies summary: Get all Companies parameters: - - name: filters - in: query - schema: - type: string - description: Filter by attrbutes. If you have filter for owner on your side please send it as {"attributes.owner":"6299dcf3874a14eacbc65c46"} - - name: linkedContactsIds - in: query - schema: - type: integer - format: int64 - description: Filter by linked contacts ids - - name: linkedDealsIds - in: query - schema: - type: string - format: objectID - description: Filter by linked Deals ids - - name: page - in: query - schema: - type: integer - format: int64 - description: Index of the first document of the page - - name: limit - in: query - schema: - type: integer - format: int64 - description: Number of documents per page - - name: sort - in: query - schema: - type: string - enum: - - asc - - desc - description: Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed - - name: sortBy - in: query - schema: - type: string - description: The field used to sort field names. + - name: filters + in: query + schema: + type: string + description: Filter by attrbutes. If you have filter for owner on your side please send it as {"attributes.owner":"6299dcf3874a14eacbc65c46"} + - name: linkedContactsIds + in: query + schema: + type: integer + format: int64 + description: Filter by linked contacts ids + - name: linkedDealsIds + in: query + schema: + type: string + format: objectID + description: Filter by linked Deals ids + - name: page + in: query + schema: + type: integer + format: int64 + description: Index of the first document of the page + - name: limit + in: query + schema: + type: integer + format: int64 + description: Number of documents per page + - name: sort + in: query + schema: + type: string + enum: + - asc + - desc + description: Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed + - name: sortBy + in: query + schema: + type: string + description: The field used to sort field names. responses: 200: description: Returns companies list with filters @@ -11363,7 +11364,7 @@ paths: application/json: schema: required: - - name + - name properties: name: type: string @@ -11373,9 +11374,9 @@ paths: type: object description: Attributes for company creation example: { - "domain": "https://example.com", - "industry": "Fabric", - "owner": "60e68d60582a3b006f524197" + "domain": "https://example.com", + "industry": "Fabric", + "owner": "60e68d60582a3b006f524197" } countryCode: type: integer @@ -11388,14 +11389,14 @@ paths: format: int64 type: array description: Contact ids to be linked with company - example: [ 1, 2, 3] + example: [ 1, 2, 3 ] linkedDealsIds: items: type: string format: objectID type: array description: Deal ids to be linked with company - example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992" ] type: object responses: 200: @@ -11404,7 +11405,7 @@ paths: application/json: schema: required: - - id + - id type: object description: Created company id properties: @@ -11427,13 +11428,13 @@ paths: tags: - Companies summary: Get a company - parameters: - - name: id - in: path - required: true - schema: - type: string - description: Get Company Details + parameters: + - name: id + in: path + required: true + schema: + type: string + description: Get Company Details responses: 200: description: Returns the Company @@ -11466,12 +11467,12 @@ paths: - Companies summary: Delete a company parameters: - - name: id - in: path - required: true - schema: - type: string - description: Company ID to delete + - name: id + in: path + required: true + schema: + type: string + description: Company ID to delete responses: 204: description: When company deleted @@ -11500,11 +11501,11 @@ paths: - Companies summary: Update a company parameters: - - name: id - in: path - required: true - schema: - type: string + - name: id + in: path + required: true + schema: + type: string requestBody: required: true description: Updated company details. @@ -11520,15 +11521,15 @@ paths: type: object description: Attributes for company update example: { - "category": "label_2", - "domain": "xyz", - "date": "2022-05-04T00:00:00+05:30", - "industry": "flipkart", - "number_of_contacts": 1, - "number_of_employees": 100, - "owner": "5b1a17d914b73d35a76ca0c7", - "phone_number": "81718441912", - "revenue": 10000.34222 + "category": "label_2", + "domain": "xyz", + "date": "2022-05-04T00:00:00+05:30", + "industry": "flipkart", + "number_of_contacts": 1, + "number_of_employees": 100, + "owner": "5b1a17d914b73d35a76ca0c7", + "phone_number": "81718441912", + "revenue": 10000.34222 } countryCode: type: integer @@ -11581,11 +11582,11 @@ paths: - Companies summary: Link and Unlink company with contact and deal parameters: - - name: id - in: path - required: true - schema: - type: string + - name: id + in: path + required: true + schema: + type: string requestBody: required: true description: Linked / Unlinked contacts and deals ids. @@ -11599,26 +11600,26 @@ paths: format: int64 type: array description: Contact ids for contacts to be linked with company - example: [ 1, 2, 3] + example: [ 1, 2, 3 ] unlinkContactIds: items: type: integer format: int64 type: array description: Contact ids for contacts to be unlinked from company - example: [ 4, 5, 6] + example: [ 4, 5, 6 ] linkDealsIds: items: type: string type: array description: Deal ids for deals to be linked with company - example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992" ] unlinkDealsIds: items: type: string type: array description: Deal ids for deals to be unlinked from company - example: [ "61a5ce58c5d4795761045994", "61a5ce58c5d479576104595" , "61a5ce58c5d4795761045996"] + example: [ "61a5ce58c5d4795761045994", "61a5ce58c5d479576104595" , "61a5ce58c5d4795761045996" ] type: object responses: 204: @@ -11660,15 +11661,15 @@ paths: mapping: type: object description: | - The mapping options in JSON format. Here is an example of the JSON structure: - ```json - { - "link_entities": true, // Determines whether to link related entities during the import process - "unlink_entities": false, // Determines whether to unlink related entities during the import process - "update_existing_records": true, // Determines whether to update based on company ID or treat every row as create - "unset_empty_attributes": false // Determines whether to unset a specific attribute during update if the values input is blank - } - ``` + The mapping options in JSON format. Here is an example of the JSON structure: + ```json + { + "link_entities": true, // Determines whether to link related entities during the import process + "unlink_entities": false, // Determines whether to unlink related entities during the import process + "update_existing_records": true, // Determines whether to update based on company ID or treat every row as create + "unset_empty_attributes": false // Determines whether to unset a specific attribute during update if the values input is blank + } + ``` responses: '200': description: Successfully imported deals @@ -11711,11 +11712,11 @@ paths: - Deals summary: Get a pipeline parameters: - - name: pipelineID - in: path - required: true - schema: - type: string + - name: pipelineID + in: path + required: true + schema: + type: string responses: 200: description: Returns pipeline and its details @@ -11773,41 +11774,41 @@ paths: - Deals summary: Get all deals parameters: - - name: filters[attributes.deal_name] - in: query - schema: - type: string - description: Filter by attributes. If you have a filter for the owner on your end, please send it as filters[attributes.deal_owner] and utilize the account email for the filtering. - - name: filters[linkedCompaniesIds] - in: query - schema: - type: string - description: Filter by linked companies ids - - name: filters[linkedContactsIds] - in: query - schema: - type: string - description: Filter by linked companies ids - - name: offset - in: query - schema: - type: integer - format: int64 - description: Index of the first document of the page - - name: limit - in: query - schema: - type: integer - format: int64 - description: Number of documents per page - - name: sort - in: query - schema: - type: string - enum: - - asc - - desc - description: Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed + - name: filters[attributes.deal_name] + in: query + schema: + type: string + description: Filter by attributes. If you have a filter for the owner on your end, please send it as filters[attributes.deal_owner] and utilize the account email for the filtering. + - name: filters[linkedCompaniesIds] + in: query + schema: + type: string + description: Filter by linked companies ids + - name: filters[linkedContactsIds] + in: query + schema: + type: string + description: Filter by linked companies ids + - name: offset + in: query + schema: + type: integer + format: int64 + description: Index of the first document of the page + - name: limit + in: query + schema: + type: integer + format: int64 + description: Number of documents per page + - name: sort + in: query + schema: + type: string + enum: + - asc + - desc + description: Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed responses: 200: description: Returns deals list with filters @@ -11836,7 +11837,7 @@ paths: application/json: schema: required: - - name + - name properties: name: type: string @@ -11862,14 +11863,14 @@ paths: format: int64 type: array description: Contact ids to be linked with deal - example: [ 1, 2, 3] + example: [ 1, 2, 3 ] linkedCompaniesIds: items: type: string format: objectID type: array description: Company ids to be linked with deal - example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992" ] type: object responses: 201: @@ -11878,7 +11879,7 @@ paths: application/json: schema: required: - - id + - id type: object description: Created deal id properties: @@ -11894,11 +11895,11 @@ paths: - Deals summary: Get a deal parameters: - - name: id - in: path - required: true - schema: - type: string + - name: id + in: path + required: true + schema: + type: string responses: 200: description: Returns the deal by id @@ -11931,11 +11932,11 @@ paths: - Deals summary: Delete a deal parameters: - - name: id - in: path - required: true - schema: - type: string + - name: id + in: path + required: true + schema: + type: string responses: 204: description: Returned when item deleted @@ -11964,11 +11965,11 @@ paths: - Deals summary: Update a deal parameters: - - name: id - in: path - required: true - schema: - type: string + - name: id + in: path + required: true + schema: + type: string requestBody: required: true description: Updated deal details. @@ -11976,20 +11977,20 @@ paths: application/json: schema: properties: - name: + name: type: string description: Name of deal example: "Deal: Connect with client" - attributes: + attributes: type: object description: | - Attributes for deal update - - To assign owner of a Deal you can send attributes.deal_owner and utilize the account email or ID. - - If you wish to update the pipeline of a deal you need to provide the `pipeline` and the `deal_stage` - - Pipeline and deal_stage are ids you can fetch using this endpoint `/crm/pipeline/details/{pipelineID}` + Attributes for deal update + + To assign owner of a Deal you can send attributes.deal_owner and utilize the account email or ID. + + If you wish to update the pipeline of a deal you need to provide the `pipeline` and the `deal_stage` + + Pipeline and deal_stage are ids you can fetch using this endpoint `/crm/pipeline/details/{pipelineID}` example: { deal_owner: "6093d2425a9b436e9519d034", amount: 12 @@ -12024,11 +12025,11 @@ paths: - Deals summary: Link and Unlink a deal with contacts and companies parameters: - - name: id - in: path - required: true - schema: - type: string + - name: id + in: path + required: true + schema: + type: string requestBody: required: true description: Linked / Unlinked contacts and companies ids. @@ -12042,26 +12043,26 @@ paths: format: int64 type: array description: Contact ids for contacts to be linked with deal - example: [ 1, 2, 3] + example: [ 1, 2, 3 ] unlinkContactIds: items: type: integer format: int64 type: array description: Contact ids for contacts to be unlinked from deal - example: [ 4, 5, 6] + example: [ 4, 5, 6 ] linkCompanyIds: items: type: string type: array description: Company ids to be linked with deal - example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992" ] unlinkCompanyIds: items: type: string type: array description: Company ids to be unlinked from deal - example: [ "61a5ce58c5d4795761045994", "61a5ce58c5d479576104595" , "61a5ce58c5d4795761045996"] + example: [ "61a5ce58c5d4795761045994", "61a5ce58c5d479576104595" , "61a5ce58c5d4795761045996" ] type: object responses: 204: @@ -12103,15 +12104,15 @@ paths: mapping: type: object description: | - The mapping options in JSON format. Here is an example of the JSON structure: - ```json - { - "link_entities": true, // Determines whether to link related entities during the import process - "unlink_entities": false, // Determines whether to unlink related entities during the import process - "update_existing_records": true, // Determines whether to update based on company ID or treat every row as create - "unset_empty_attributes": false // Determines whether to unset a specific attribute during update if the values input is blank - } - ``` + The mapping options in JSON format. Here is an example of the JSON structure: + ```json + { + "link_entities": true, // Determines whether to link related entities during the import process + "unlink_entities": false, // Determines whether to unlink related entities during the import process + "update_existing_records": true, // Determines whether to update based on company ID or treat every row as create + "unset_empty_attributes": false // Determines whether to unset a specific attribute during update if the values input is blank + } + ``` responses: '200': description: Successfully imported deals @@ -12152,87 +12153,87 @@ paths: - Tasks summary: Get all tasks parameters: - - name: filter[type] - in: query - schema: - type: string - description: Filter by task type (ID) - - name: filter[status] - in: query - schema: - type: string - enum: - - done - - undone - description: Filter by task status - - name: filter[date] - in: query - schema: - type: string - enum: - - overdue - - today - - tomorrow - - week - - range - description: Filter by date - - name: filter[assignTo] - in: query - schema: - type: string - description: Filter by the "assignTo" ID. You can utilize account emails for the "assignTo" attribute. - - name: filter[contacts] - in: query - schema: - type: string - description: Filter by contact ids - - name: filter[deals] - in: query - schema: - type: string - description: Filter by deals ids - - name: filter[companies] - in: query - schema: - type: string - description: Filter by companies ids - - name: dateFrom - in: query - schema: - type: integer - description: dateFrom to date range filter type (timestamp in milliseconds) - - name: dateTo - in: query - schema: - type: integer - description: dateTo to date range filter type (timestamp in milliseconds) - - name: offset - in: query - schema: - type: integer - format: int64 - description: Index of the first document of the page - - name: limit - in: query - schema: - type: integer - default: 50 - format: int64 - description: Number of documents per page - - name: sort - in: query - schema: - type: string - enum: - - asc - - desc - description: Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed - - name: sortBy - in: query - schema: - type: string - description: The field used to sort field names. - example: name + - name: filter[type] + in: query + schema: + type: string + description: Filter by task type (ID) + - name: filter[status] + in: query + schema: + type: string + enum: + - done + - undone + description: Filter by task status + - name: filter[date] + in: query + schema: + type: string + enum: + - overdue + - today + - tomorrow + - week + - range + description: Filter by date + - name: filter[assignTo] + in: query + schema: + type: string + description: Filter by the "assignTo" ID. You can utilize account emails for the "assignTo" attribute. + - name: filter[contacts] + in: query + schema: + type: string + description: Filter by contact ids + - name: filter[deals] + in: query + schema: + type: string + description: Filter by deals ids + - name: filter[companies] + in: query + schema: + type: string + description: Filter by companies ids + - name: dateFrom + in: query + schema: + type: integer + description: dateFrom to date range filter type (timestamp in milliseconds) + - name: dateTo + in: query + schema: + type: integer + description: dateTo to date range filter type (timestamp in milliseconds) + - name: offset + in: query + schema: + type: integer + format: int64 + description: Index of the first document of the page + - name: limit + in: query + schema: + type: integer + default: 50 + format: int64 + description: Number of documents per page + - name: sort + in: query + schema: + type: string + enum: + - asc + - desc + description: Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed + - name: sortBy + in: query + schema: + type: string + description: The field used to sort field names. + example: name responses: 200: description: Returns task list with filters @@ -12261,9 +12262,9 @@ paths: application/json: schema: required: - - name - - taskTypeId - - date + - name + - taskTypeId + - date properties: name: type: string @@ -12301,19 +12302,19 @@ paths: type: integer type: array description: Contact ids for contacts linked to this task - example: [ 1, 2, 3] + example: [ 1, 2, 3 ] dealsIds: items: type: string type: array description: Deal ids for deals a task is linked to - example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992" ] companiesIds: items: type: string type: array description: Companies ids for companies a task is linked to - example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992" ] reminder: $ref: '#/components/schemas/TaskReminder' type: object @@ -12324,7 +12325,7 @@ paths: application/json: schema: required: - - id + - id type: object description: Task Details properties: @@ -12340,11 +12341,11 @@ paths: - Tasks summary: Get a task parameters: - - name: id - in: path - required: true - schema: - type: string + - name: id + in: path + required: true + schema: + type: string responses: 200: description: Returns the Task by id @@ -12377,11 +12378,11 @@ paths: - Tasks summary: Delete a task parameters: - - name: id - in: path - required: true - schema: - type: string + - name: id + in: path + required: true + schema: + type: string responses: 204: description: Returned when item deleted @@ -12410,11 +12411,11 @@ paths: - Tasks summary: Update a task parameters: - - name: id - in: path - required: true - schema: - type: string + - name: id + in: path + required: true + schema: + type: string requestBody: required: true description: Updated task details. @@ -12457,19 +12458,19 @@ paths: type: integer type: array description: Contact ids for contacts linked to this task - example: [ 1, 2, 3] + example: [ 1, 2, 3 ] dealsIds: items: type: string type: array description: Deal ids for deals a task is linked to - example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992" ] companiesIds: items: type: string type: array description: Companies ids for companies a task is linked to - example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992" ] reminder: $ref: "#/components/schemas/TaskReminder" type: object @@ -12502,51 +12503,51 @@ paths: - Notes summary: Get all notes parameters: - - name: entity - in: query - schema: - type: string - enum: - - companies - - deals - - contacts - description: Filter by note entity type - - name: entityIds - in: query - schema: - type: string - description: Filter by note entity IDs - - name: dateFrom - in: query - schema: - type: integer - description: dateFrom to date range filter type (timestamp in milliseconds) - - name: dateTo - in: query - schema: - type: integer - description: dateTo to date range filter type (timestamp in milliseconds) - - name: offset - in: query - schema: - type: integer - format: int64 - description: Index of the first document of the page - - name: limit - in: query - schema: - type: integer - default: 50 - format: int64 - description: Number of documents per page - - name: sort - in: query - schema: - type: string - enum: - - asc - - desc - description: Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed + - name: entity + in: query + schema: + type: string + enum: + - companies + - deals + - contacts + description: Filter by note entity type + - name: entityIds + in: query + schema: + type: string + description: Filter by note entity IDs + - name: dateFrom + in: query + schema: + type: integer + description: dateFrom to date range filter type (timestamp in milliseconds) + - name: dateTo + in: query + schema: + type: integer + description: dateTo to date range filter type (timestamp in milliseconds) + - name: offset + in: query + schema: + type: integer + format: int64 + description: Index of the first document of the page + - name: limit + in: query + schema: + type: integer + default: 50 + format: int64 + description: Number of documents per page + - name: sort + in: query + schema: + type: string + enum: + - asc + - desc + description: Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed responses: 200: description: Returns notes list with filters @@ -12608,12 +12609,12 @@ paths: - Notes summary: Get a note parameters: - - name: id - in: path - required: true - schema: - type: string - description: Note ID to get + - name: id + in: path + required: true + schema: + type: string + description: Note ID to get responses: 200: description: Returns the Note by id @@ -12646,12 +12647,12 @@ paths: - Notes summary: Update a note parameters: - - name: id - in: path - required: true - schema: - type: string - description: Note ID to update + - name: id + in: path + required: true + schema: + type: string + description: Note ID to update requestBody: required: true description: Note data to update a note. @@ -12697,12 +12698,12 @@ paths: - Notes summary: Delete a note parameters: - - name: id - in: path - required: true - schema: - type: string - description: Note ID to delete + - name: id + in: path + required: true + schema: + type: string + description: Note ID to delete responses: 204: description: Returned when item deleted @@ -12732,58 +12733,58 @@ paths: - Files summary: Get all files parameters: - - name: entity - in: query - schema: - type: string - enum: - - companies - - deals - - contacts - description: Filter by file entity type - required: false - - name: entityIds - in: query - schema: - type: string - description: Filter by file entity IDs - required: false - - name: dateFrom - in: query - schema: - type: integer - description: dateFrom to date range filter type (timestamp in milliseconds) - required: false - - name: dateTo - in: query - schema: - type: integer - description: dateTo to date range filter type (timestamp in milliseconds) - required: false - - name: offset - in: query - schema: - type: integer - format: int64 - description: Index of the first document of the page - required: false - - name: limit - in: query - schema: - type: integer - format: int64 - default: 50 - description: Number of documents per page - required: false - - name: sort - in: query - schema: - type: string - enum: - - asc - - desc - description: Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed - required: false + - name: entity + in: query + schema: + type: string + enum: + - companies + - deals + - contacts + description: Filter by file entity type + required: false + - name: entityIds + in: query + schema: + type: string + description: Filter by file entity IDs + required: false + - name: dateFrom + in: query + schema: + type: integer + description: dateFrom to date range filter type (timestamp in milliseconds) + required: false + - name: dateTo + in: query + schema: + type: integer + description: dateTo to date range filter type (timestamp in milliseconds) + required: false + - name: offset + in: query + schema: + type: integer + format: int64 + description: Index of the first document of the page + required: false + - name: limit + in: query + schema: + type: integer + format: int64 + default: 50 + description: Number of documents per page + required: false + - name: sort + in: query + schema: + type: string + enum: + - asc + - desc + description: Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed + required: false responses: 200: description: Returns files list with filters @@ -12841,19 +12842,19 @@ paths: examples: response: value: - "message": "Invalid deals ids format." + "message": "Invalid deals ids format." /crm/files/{id}: get: tags: - Files summary: Download a file parameters: - - in: path - name: id - required: true - schema: - type: string - description: File id to download. + - in: path + name: id + required: true + schema: + type: string + description: File id to download. responses: 200: description: Returns downloadable file link. Valid for next 5 minutes only. @@ -12868,9 +12869,9 @@ paths: schema: $ref: '#/components/schemas/errorModel' examples: - response: - value: - "message": "Route attribute id is not valid" + response: + value: + "message": "Route attribute id is not valid" 404: description: Returned when item not found content: @@ -12879,19 +12880,19 @@ paths: $ref: '#/components/schemas/errorModel' examples: response: - value: - "message": "Document not found" + value: + "message": "Document not found" delete: tags: - Files summary: Delete a file parameters: - - in: path - name: id - required: true - schema: - type: string - description: File id to delete. + - in: path + name: id + required: true + schema: + type: string + description: File id to delete. responses: 204: description: Returned when file is deleted. @@ -12903,8 +12904,8 @@ paths: $ref: '#/components/schemas/errorModel' examples: response: - value: - "message": "Route attribute id is not valid" + value: + "message": "Route attribute id is not valid" 404: description: Returned when item not found content: @@ -12912,21 +12913,21 @@ paths: schema: $ref: '#/components/schemas/errorModel' examples: - response: - value: - "message": "Document not found" + response: + value: + "message": "Document not found" /crm/files/{id}/data: get: tags: - Files summary: Get file details parameters: - - in: path - name: id - required: true - schema: - type: string - description: File id to get file data. + - in: path + name: id + required: true + schema: + type: string + description: File id to get file data. responses: 200: description: Returned when file is found. @@ -12942,8 +12943,8 @@ paths: $ref: '#/components/schemas/errorModel' examples: response: - value: - "message": "Route attribute id is not valid" + value: + "message": "Route attribute id is not valid" 404: description: Returned when item not found content: @@ -12952,8 +12953,8 @@ paths: $ref: '#/components/schemas/errorModel' examples: response: - value: - "message": "Document not found" + value: + "message": "Document not found" /conversations/messages: post: tags: @@ -13534,8 +13535,8 @@ paths: description: List of conversion attribution metrics type: array example: [ - {"id":2, "conversionSource": "email_campaign", "ordersCount":300, "revenue":900, "averageBasket":3.00}, - {"id":1, "conversionSource": "email_campaign", "ordersCount":200, "revenue":800, "averageBasket":4.00} + { "id": 2, "conversionSource": "email_campaign", "ordersCount": 300, "revenue": 900, "averageBasket": 3.00 }, + { "id": 1, "conversionSource": "email_campaign", "ordersCount": 200, "revenue": 800, "averageBasket": 4.00 } ] items: type: object @@ -13598,14 +13599,14 @@ paths: application/json: schema: allOf: - - $ref: "#/components/schemas/ConversionSourceMetrics" - - type: object - required: - - newCustomersCount - properties: - newCustomersCount: - type: number - format: integer + - $ref: "#/components/schemas/ConversionSourceMetrics" + - type: object + required: + - newCustomersCount + properties: + newCustomersCount: + type: number + format: integer 400: description: bad request content: @@ -13664,43 +13665,43 @@ paths: description: Get all the orders operationId: getOrders parameters: - - name: limit - in: query - description: Number of documents per page - schema: - maximum: 100 - type: integer - format: int64 - default: 50 - - name: offset - in: query - description: Index of the first document in the page - schema: - type: integer - format: int64 - default: 0 - - name: sort - in: query - description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc - - name: modifiedSince - in: query - description: | - Filter (urlencoded) the orders 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.** - schema: - type: string - - name: createdSince - in: query - description: | - Filter (urlencoded) the orders created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** - schema: - type: string + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 100 + type: integer + format: int64 + default: 50 + - name: offset + in: query + description: Index of the first document in the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + - name: modifiedSince + in: query + description: | + Filter (urlencoded) the orders 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.** + schema: + type: string + - name: createdSince + in: query + description: | + Filter (urlencoded) the orders created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** + schema: + type: string responses: 200: description: orders fetched successfully @@ -13709,7 +13710,7 @@ paths: examples: response: value: - orders: + orders: - id: order1803 createdAt: 2021-12-31T11:42:35.638Z updatedAt: 2022-03-03T14:48:31.867Z @@ -13742,14 +13743,14 @@ paths: "flat50", "flat40" ] - count: 1 + count: 1 400: - description: bad request - content: - application/json: - schema: - $ref: '#/components/schemas/errorModel' + description: bad request + content: + application/json: + schema: + $ref: '#/components/schemas/errorModel' /orders/status: post: @@ -13767,7 +13768,7 @@ paths: responses: 204: description: Order Event posted - content: {} + content: { } 400: description: bad request content: @@ -13775,27 +13776,27 @@ paths: schema: $ref: '#/components/schemas/errorModel' /orders/status/batch: - post: - tags: + post: + tags: - Ecommerce - summary: Create orders in batch - description: Create multiple orders at one time instead of one order at a time - operationId: createBatchOrder - requestBody: - required: true + summary: Create orders in batch + description: Create multiple orders at one time instead of one order at a time + operationId: createBatchOrder + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/orderBatch' + responses: + 202: + $ref: '#/components/responses/createdBatchId' + 400: + description: bad request content: application/json: schema: - $ref: '#/components/schemas/orderBatch' - responses: - 202: - $ref: '#/components/responses/createdBatchId' - 400: - description: bad request - content: - application/json: - schema: - $ref: '#/components/schemas/errorModel' + $ref: '#/components/schemas/errorModel' /events: post: tags: @@ -13812,7 +13813,7 @@ paths: responses: 204: description: An event posted - content: {} + content: { } 400: description: bad request content: @@ -13828,59 +13829,59 @@ paths: /categories: get: tags: - - Ecommerce + - Ecommerce summary: Return all your categories operationId: getCategories parameters: - - name: limit - in: query - description: Number of documents per page - schema: - maximum: 100 - type: integer - format: int64 - default: 50 - - name: offset - in: query - description: Index of the first document in the page - schema: - type: integer - format: int64 - default: 0 - - name: sort - in: query - description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc - - name: ids - in: query - schema: - type: array - items: + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 100 + type: integer + format: int64 + default: 50 + - name: offset + in: query + description: Index of the first document in the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc + - name: ids + in: query + schema: + type: array + items: + type: string + description: Filter by category ids + - name: name + in: query + schema: + type: string + description: Filter by category name + - name: modifiedSince + in: query + description: | + Filter (urlencoded) the categories 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.** + schema: + type: string + - name: createdSince + in: query + description: | + Filter (urlencoded) the categories created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** + schema: type: string - description: Filter by category ids - - name: name - in: query - schema: - type: string - description: Filter by category name - - name: modifiedSince - in: query - description: | - Filter (urlencoded) the categories 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.** - schema: - type: string - - name: createdSince - in: query - description: | - Filter (urlencoded) the categories created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** - schema: - type: string responses: 200: @@ -13892,7 +13893,7 @@ paths: examples: response: value: - categories: + categories: - id: 19 name: Food url: http://mydomain.com/category/food @@ -13904,7 +13905,7 @@ paths: modifiedAt: 2022-03-03T14:48:31.867Z createdAt: 2021-12-31T11:42:35.638Z isDeleted: true - count: 2 + count: 2 400: description: bad request content: @@ -13913,7 +13914,7 @@ paths: $ref: '#/components/schemas/errorModel' post: tags: - - Ecommerce + - Ecommerce summary: Create/Update a category operationId: createUpdateCategory requestBody: @@ -13936,7 +13937,7 @@ paths: id: 21 204: description: Category updated - content: {} + content: { } 400: description: bad request content: @@ -13946,16 +13947,16 @@ paths: /categories/{id}: get: tags: - - Ecommerce + - Ecommerce summary: Get a category details operationId: getCategoryInfo parameters: - - name: id - in: path - description: Category ID - required: true - schema: - type: string + - name: id + in: path + description: Category ID + required: true + schema: + type: string responses: 200: description: Category informations @@ -13978,7 +13979,7 @@ paths: /categories/batch: post: tags: - - Ecommerce + - Ecommerce summary: Create categories in batch operationId: createUpdateBatchCategory requestBody: @@ -14009,96 +14010,96 @@ paths: /products: get: tags: - - Ecommerce + - Ecommerce summary: Return all your products operationId: getProducts parameters: - - name: limit - in: query - description: Number of documents per page - schema: - maximum: 1000 - type: integer - format: int64 - default: 50 - - name: offset - in: query - description: Index of the first document in the page - schema: - type: integer - format: int64 - default: 0 - - name: sort - in: query - description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc - - name: ids - in: query - schema: - type: array - items: + - name: limit + in: query + description: Number of documents per page + schema: + maximum: 1000 + type: integer + format: int64 + default: 50 + - name: offset + in: query + description: Index of the first document in the page + schema: + type: integer + format: int64 + default: 0 + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: type: string - description: Filter by product ids - - name: name - in: query - schema: - type: string - description: Filter by product name, minimum 3 characters should be present for search - - name: price[lte] - in: query - schema: - type: number - description: Price filter for products less than and equals to particular amount - - name: price[gte] - in: query - schema: - type: number - description: Price filter for products greater than and equals to particular amount - - name: price[lt] - in: query - schema: - type: number - description: Price filter for products less than particular amount - - name: price[gt] - in: query - schema: - type: number - description: Price filter for products greater than particular amount - - name: price[eq] - in: query - schema: - type: number - description: Price filter for products equals to particular amount - - name: price[ne] - in: query - schema: - type: number - description: Price filter for products not equals to particular amount - - name: categories - in: query - schema: - type: array - items: + default: desc + enum: + - asc + - desc + - name: ids + in: query + schema: + type: array + items: + type: string + description: Filter by product ids + - name: name + in: query + schema: + type: string + description: Filter by product name, minimum 3 characters should be present for search + - name: price[lte] + in: query + schema: + type: number + description: Price filter for products less than and equals to particular amount + - name: price[gte] + in: query + schema: + type: number + description: Price filter for products greater than and equals to particular amount + - name: price[lt] + in: query + schema: + type: number + description: Price filter for products less than particular amount + - name: price[gt] + in: query + schema: + type: number + description: Price filter for products greater than particular amount + - name: price[eq] + in: query + schema: + type: number + description: Price filter for products equals to particular amount + - name: price[ne] + in: query + schema: + type: number + description: Price filter for products not equals to particular amount + - name: categories + in: query + schema: + type: array + items: + type: string + description: Filter by product categories + - name: modifiedSince + in: query + description: | + Filter (urlencoded) the orders 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.** + schema: + type: string + - name: createdSince + in: query + description: | + Filter (urlencoded) the orders created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** + schema: type: string - description: Filter by product categories - - name: modifiedSince - in: query - description: | - Filter (urlencoded) the orders 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.** - schema: - type: string - - name: createdSince - in: query - description: | - Filter (urlencoded) the orders created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** - schema: - type: string responses: 200: description: All products listed @@ -14109,7 +14110,7 @@ paths: examples: response: value: - products: + products: - id: 7498033266862 name: Alpina Panoma Classic url: https://mydomain.com/products/alpina-panoma-classic @@ -14145,7 +14146,7 @@ paths: s3ThumbAnalytics: https://img-ecom.mailinblue.com/path-to-analytics/img.jpg s3ThumbEditor: https://img-ecom.mailinblue.com/path-to-editor/img.jpg isDeleted: true - count: 2 + count: 2 400: description: bad request content: @@ -14154,7 +14155,7 @@ paths: $ref: '#/components/schemas/errorModel' post: tags: - - Ecommerce + - Ecommerce summary: Create/Update a product operationId: createUpdateProduct requestBody: @@ -14186,16 +14187,16 @@ paths: /products/{id}: get: tags: - - Ecommerce + - Ecommerce summary: Get a product's details operationId: getProductInfo parameters: - - name: id - in: path - description: Product ID - required: true - schema: - type: string + - name: id + in: path + description: Product ID + required: true + schema: + type: string responses: 200: description: Product informations @@ -14218,7 +14219,7 @@ paths: /products/batch: post: tags: - - Ecommerce + - Ecommerce summary: Create products in batch operationId: createUpdateBatchProducts requestBody: @@ -14250,47 +14251,47 @@ paths: /couponCollections: get: tags: - - Coupons + - Coupons summary: Get all your coupon collections operationId: getCouponCollections parameters: - - name: limit - in: query - description: Number of documents returned per page - schema: - type: integer - format: int64 - default: 50 - minimum: 0 - maximum: 100 - - name: offset - in: query - description: Index of the first document on the page - schema: - type: integer - format: int64 - default: 0 - minimum: 0 - - name: sort - in: query - description: Sort the results by creation time in ascending/descending order - schema: - type: string - enum: - - asc - - desc - default: desc - - name: sortBy - in: query - description: The field used to sort coupon collections - required: false - schema: - type: string - enum: - - createdAt - - remainingCoupons - - expirationDate - default: createdAt + - name: limit + in: query + description: Number of documents returned per page + schema: + type: integer + format: int64 + default: 50 + minimum: 0 + maximum: 100 + - name: offset + in: query + description: Index of the first document on the page + schema: + type: integer + format: int64 + default: 0 + minimum: 0 + - name: sort + in: query + description: Sort the results by creation time in ascending/descending order + schema: + type: string + enum: + - asc + - desc + default: desc + - name: sortBy + in: query + description: The field used to sort coupon collections + required: false + schema: + type: string + enum: + - createdAt + - remainingCoupons + - expirationDate + default: createdAt responses: 200: description: Coupon collections @@ -14322,7 +14323,7 @@ paths: $ref: '#/components/schemas/errorModel' post: tags: - - Coupons + - Coupons summary: Create а coupon collection operationId: createCouponCollection requestBody: @@ -14332,8 +14333,8 @@ paths: application/json: schema: required: - - name - - defaultCoupon + - name + - defaultCoupon type: object properties: name: @@ -14364,7 +14365,7 @@ paths: application/json: schema: required: - - id + - id type: object properties: id: @@ -14387,17 +14388,17 @@ paths: /couponCollections/{id}: get: tags: - - Coupons + - Coupons summary: Get a coupon collection by id operationId: getCouponCollection parameters: - - name: id - in: path - description: Id of the collection to return - required: true - schema: - type: string - format: uuidv4 + - name: id + in: path + description: Id of the collection to return + required: true + schema: + type: string + format: uuidv4 responses: 200: description: Coupon collection @@ -14434,7 +14435,7 @@ paths: $ref: '#/components/schemas/errorModel' patch: tags: - - Coupons + - Coupons summary: Update a coupon collection by id operationId: updateCouponCollection parameters: @@ -14476,9 +14477,9 @@ paths: application/json: schema: required: - - id - - name - - defaultCoupon + - id + - name + - defaultCoupon type: object properties: id: @@ -14510,7 +14511,7 @@ paths: /coupons: post: tags: - - Coupons + - Coupons summary: Create coupons for a coupon collection operationId: createCoupons requestBody: @@ -14520,8 +14521,8 @@ paths: application/json: schema: required: - - collectionId - - coupons + - collectionId + - coupons type: object properties: collectionId: @@ -14541,7 +14542,7 @@ paths: responses: 204: description: Coupons creation in progress - content: {} + content: { } 400: description: bad request content: @@ -14574,8 +14575,8 @@ paths: application/json: schema: oneOf: - - $ref: '#/components/schemas/sendWhatsappMessageTemplate' - - $ref: '#/components/schemas/sendWhatsappMessageText' + - $ref: '#/components/schemas/sendWhatsappMessageTemplate' + - $ref: '#/components/schemas/sendWhatsappMessageText' required: true responses: 201: @@ -14584,7 +14585,7 @@ paths: application/json: schema: required: - - messageId + - messageId type: object properties: messageId: @@ -14601,75 +14602,75 @@ paths: /whatsapp/statistics/events: get: tags: - - Transactional WhatsApp + - Transactional WhatsApp summary: Get all your WhatsApp activity (unaggregated events) description: This endpoint will show the unaggregated statistics for WhatsApp activity (30 days by default if `startDate` and `endDate` or `days` is not passed. The date range can not exceed 90 days) operationId: getWhatsappEventReport parameters: - - name: limit - in: query - description: Number limitation for the result returned - schema: - maximum: 5000 - type: integer - format: int64 - default: 2500 - minimum: 0 - - name: offset - in: query - description: Beginning point in the list to retrieve from - schema: - type: integer - format: int64 - default: 0 - - name: startDate - in: query - description: | - **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate - schema: - type: string - - name: endDate - in: query - description: | - **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate - schema: - type: string - - name: days - in: query - description: | - Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ - schema: - type: integer - format: int64 - - name: contactNumber - in: query - description: Filter results for specific contact (WhatsApp Number with country code. Example, 85264318721) - schema: - type: string - format: mobile - - name: event - in: query - description: Filter the report for a specific event type - schema: - type: string - enum: - - sent - - delivered - - read - - error - - unsubscribe - - reply - - soft-bounce - - name: sort - in: query - description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - required: false - schema: - type: string - default: desc - enum: - - asc - - desc + - name: limit + in: query + description: Number limitation for the result returned + schema: + maximum: 5000 + type: integer + format: int64 + default: 2500 + minimum: 0 + - name: offset + in: query + description: Beginning point in the list to retrieve from + schema: + type: integer + format: int64 + default: 0 + - name: startDate + in: query + description: | + **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate + schema: + type: string + - name: endDate + in: query + description: | + **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate + schema: + type: string + - name: days + in: query + description: | + Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ + schema: + type: integer + format: int64 + - name: contactNumber + in: query + description: Filter results for specific contact (WhatsApp Number with country code. Example, 85264318721) + schema: + type: string + format: mobile + - name: event + in: query + description: Filter the report for a specific event type + schema: + type: string + enum: + - sent + - delivered + - read + - error + - unsubscribe + - reply + - soft-bounce + - name: sort + in: query + description: Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed + required: false + schema: + type: string + default: desc + enum: + - asc + - desc responses: 200: description: WhatsApp events report @@ -14716,7 +14717,7 @@ paths: /feeds: get: tags: - - External Feeds + - External Feeds summary: Fetch all external feeds description: This endpoint can fetch all created external feeds. operationId: getAllExternalFeeds @@ -14782,7 +14783,7 @@ paths: example: 0 schema: type: integer - format : int64 + format: int64 default: 0 responses: 200: @@ -14796,34 +14797,34 @@ paths: "count": 3, "feeds": [ { - "id": "d955aaa4-f4d6-4557-aa14-24286542ed8d", - "name": "api feed token", - "url": "https://abc.com/", - "authType": "token", - "token": "jfhdkjdfhjkfdhjkdfhjkdfhkj", - "headers": [ - { - "name": "key", - "value": "val" - } - ], - "maxRetries": 4, - "cache": true, - "createdAt": "2022-10-06T05:03:47.053000000Z", - "modifiedAt": "2022-10-06T05:03:47.053000000Z" + "id": "d955aaa4-f4d6-4557-aa14-24286542ed8d", + "name": "api feed token", + "url": "https://abc.com/", + "authType": "token", + "token": "jfhdkjdfhjkfdhjkdfhjkdfhkj", + "headers": [ + { + "name": "key", + "value": "val" + } + ], + "maxRetries": 4, + "cache": true, + "createdAt": "2022-10-06T05:03:47.053000000Z", + "modifiedAt": "2022-10-06T05:03:47.053000000Z" }, { - "id": "311a71ac-bebc-42cf-963d-d8666dfe53e9", - "name": "api feed basic", - "url": "https://abc.com/", - "authType": "basic", - "username": "user", - "password": "pass", - "headers": null, - "maxRetries": 2, - "cache": false, - "createdAt": "2022-10-06T04:48:19.767000000Z", - "modifiedAt": "2022-10-06T04:48:19.767000000Z" + "id": "311a71ac-bebc-42cf-963d-d8666dfe53e9", + "name": "api feed basic", + "url": "https://abc.com/", + "authType": "basic", + "username": "user", + "password": "pass", + "headers": null, + "maxRetries": 2, + "cache": false, + "createdAt": "2022-10-06T04:48:19.767000000Z", + "modifiedAt": "2022-10-06T04:48:19.767000000Z" } ] } @@ -14859,7 +14860,7 @@ paths: application/json: schema: required: - - id + - id type: object properties: id: @@ -14881,13 +14882,13 @@ paths: description: This endpoint will update an external feed. operationId: getExternalFeedByUUID parameters: - - name: uuid - description: UUID of the feed to fetch - example: 38f351fb-6e77-4b38-979a-a2465260449e - in: path - required: true - schema: - type: string + - name: uuid + description: UUID of the feed to fetch + example: 38f351fb-6e77-4b38-979a-a2465260449e + in: path + required: true + schema: + type: string responses: 200: description: External feed @@ -14897,21 +14898,21 @@ paths: $ref: '#/components/schemas/getExternalFeedByUUID' example: { - "id": "d955aaa4-f4d6-4557-aa14-24286542ed8d", - "name": "api feed token", - "url": "https://abc.com/", - "authType": "token", - "token": "jfhdkjdfhjkfdhjkdfhjkdfhkj", - "headers": [ - { - "name": "key", - "value": "val" - } - ], - "maxRetries": 4, - "cache": true, - "createdAt": "2022-10-06T05:03:47.053000000Z", - "modifiedAt": "2022-10-06T05:03:47.053000000Z" + "id": "d955aaa4-f4d6-4557-aa14-24286542ed8d", + "name": "api feed token", + "url": "https://abc.com/", + "authType": "token", + "token": "jfhdkjdfhjkfdhjkdfhjkdfhkj", + "headers": [ + { + "name": "key", + "value": "val" + } + ], + "maxRetries": 4, + "cache": true, + "createdAt": "2022-10-06T05:03:47.053000000Z", + "modifiedAt": "2022-10-06T05:03:47.053000000Z" } 400: description: bad request @@ -14932,13 +14933,13 @@ paths: description: This endpoint will update an external feed. operationId: updateExternalFeed parameters: - - name: uuid - description: UUID of the feed to update - example: 38f351fb-6e77-4b38-979a-a2465260449e - in: path - required: true - schema: - type: string + - name: uuid + description: UUID of the feed to update + example: 38f351fb-6e77-4b38-979a-a2465260449e + in: path + required: true + schema: + type: string requestBody: description: Values to update a feed content: @@ -14949,7 +14950,7 @@ paths: responses: 204: description: Feed updated - content: {} + content: { } 400: description: bad request content: @@ -14969,17 +14970,17 @@ paths: description: This endpoint will delete an external feed. operationId: deleteExternalFeed parameters: - - name: uuid - description: UUID of the feed to delete - example: 38f351fb-6e77-4b38-979a-a2465260449e - in: path - required: true - schema: - type: string + - name: uuid + description: UUID of the feed to delete + example: 38f351fb-6e77-4b38-979a-a2465260449e + in: path + required: true + schema: + type: string responses: 204: description: Feed deleted - content: {} + content: { } 400: description: bad request content: @@ -15137,104 +15138,104 @@ components: schemas: getAccount: allOf: - - $ref: '#/components/schemas/getExtendedClient' - - required: - - plan - - relay - type: object - properties: - plan: - type: array - description: Information about your plans and credits - items: + - $ref: '#/components/schemas/getExtendedClient' + - required: + - plan + - relay + type: object + properties: + plan: + type: array + description: Information about your plans and credits + items: + required: + - credits + - creditsType + - type + type: object + properties: + type: + type: string + description: Displays the plan type of the user + example: subscription + enum: + - payAsYouGo + - free + - subscription + - sms + creditsType: + type: string + description: 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. + example: sendLimit + enum: + - sendLimit + credits: + type: number + description: Remaining credits of the user + format: float + example: 8755.0 + startDate: + type: string + description: Date of the period from which the plan will start (only + available for "subscription" plan type) + format: date + example: 2016-12-31 + endDate: + type: string + description: Date of the period from which the plan will end (only + available for "subscription" plan type) + format: date + example: 2017-01-31 + relay: + required: + - data + - enabled + type: object + properties: + enabled: + type: boolean + description: Status of your transactional email Account (true=Enabled, + false=Disabled) + example: true + data: + required: + - port + - relay + - userName + type: object + properties: + userName: + type: string + description: Email to use as login on transactional platform + format: email + example: john.smith@example.com + relay: + type: string + description: URL of the SMTP Relay + example: relay.domain.com + port: + type: integer + description: Port used for SMTP Relay + example: 125 + description: Data regarding the transactional email account + description: Information about your transactional email account + marketingAutomation: required: - - credits - - creditsType - - type + - enabled type: object properties: - type: - type: string - description: Displays the plan type of the user - example: subscription - enum: - - payAsYouGo - - free - - subscription - - sms - creditsType: - type: string - description: 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. - example: sendLimit - enum: - - sendLimit - credits: - type: number - description: Remaining credits of the user - format: float - example: 8755.0 - startDate: - type: string - description: Date of the period from which the plan will start (only - available for "subscription" plan type) - format: date - example: 2016-12-31 - endDate: + key: type: string - description: Date of the period from which the plan will end (only - available for "subscription" plan type) - format: date - example: 2017-01-31 - relay: - required: - - data - - enabled - type: object - properties: - enabled: - type: boolean - description: Status of your transactional email Account (true=Enabled, - false=Disabled) - example: true - data: - required: - - port - - relay - - userName - type: object - properties: - userName: - type: string - description: Email to use as login on transactional platform - format: email - example: john.smith@example.com - relay: - type: string - description: URL of the SMTP Relay - example: relay.domain.com - port: - type: integer - description: Port used for SMTP Relay - example: 125 - description: Data regarding the transactional email account - description: Information about your transactional email account - marketingAutomation: - required: - - enabled - type: object - properties: - key: - type: string - description: Marketing Automation Tracker ID - example: iso05aopqych87ysy0jymf - enabled: - type: boolean - description: Status of Marketing Automation Plateform activation for - your account (true=enabled, false=disabled) - example: false + description: Marketing Automation Tracker ID + example: iso05aopqych87ysy0jymf + enabled: + type: boolean + description: Status of Marketing Automation Plateform activation for + your account (true=enabled, false=disabled) + example: false getAccountActivity: type: object properties: @@ -15355,55 +15356,55 @@ components: type: object properties: user_management: - description : User management accessiblity. + description: User management accessiblity. type: array items: type: string example: 'all / none' api_keys: - description : Api keys accessiblity. + description: Api keys accessiblity. type: array items: type: string example: 'all / none' my_plan: - description : My plan accessiblity. + description: My plan accessiblity. type: array items: type: string example: 'all / none' apps_management: - description : Apps management accessiblity | Not available in ENTv2 + description: Apps management accessiblity | Not available in ENTv2 type: array items: type: string example: 'all / none' sub_organization_groups: - description : Group creation, modification or deletion accessibility + description: Group creation, modification or deletion accessibility type: array items: type: string - example: ["create", "edit_delete"] + example: [ "create", "edit_delete" ] create_sub_organizations: - description : Authorization to create sub-organization in the admin account. If the user creating the sub-organization, belongs to a group, the user must choose a group at the sub-organization creation. + description: Authorization to create sub-organization in the admin account. If the user creating the sub-organization, belongs to a group, the user must choose a group at the sub-organization creation. type: array items: type: string example: 'all / none' manage_sub_organizations: - description : Authorization to manage and access sub-organizations in the admin account. + description: Authorization to manage and access sub-organizations in the admin account. type: array items: type: string example: 'all / none' analytics: - description : Analytics dashboard accessibility + description: Analytics dashboard accessibility type: array items: type: string - example: ["download_data", "create_alerts", "my_looks", "explore_create"] + example: [ "download_data", "create_alerts", "my_looks", "explore_create" ] security: - description : Security page accessibility + description: Security page accessibility type: array items: type: string @@ -15477,7 +15478,7 @@ components: items: type: string description: Permission details - example: [create, edit_delete] + example: [ create, edit_delete ] create_sub_organizations: type: array description: Permission on create sub-accounts @@ -15498,7 +15499,7 @@ components: items: type: string description: Permission details - example: [create_alerts, download_data, my_looks, explore_create] + example: [ create_alerts, download_data, my_looks, explore_create ] security: type: array description: Permission on security @@ -15619,7 +15620,7 @@ components: items: type: string description: Group Id - example: ["2baxxxxxxxxxxxxxxxxxxxxxcaa", "65axxxxxxxxxxxxxxxxxxxxxc5a"] + example: [ "2baxxxxxxxxxxxxxxxxxxxxxcaa", "65axxxxxxxxxxxxxxxxxxxxxc5a" ] privileges: type: array items: @@ -15653,7 +15654,7 @@ components: - 'download_data' - 'create_alerts' example: "'all', 'none', 'create', 'edit_delete', 'download_data', 'create_alerts'" - example: [{"feature": "my_plan", "permissions": ["all"]}, {"feature": "api", "permissions": ["none"]}, {"feature": "user_management", "permissions": ["all"]}, {"feature": "app_management", "permissions": ["all"]}, {"feature": "sub_organization_groups", "permissions": ["create", "edit_delete"]}, {"feature": "create_sub_organizations", "permissions": ["all"]}, {"feature": "manage_sub_organizations", "permissions": ["all"]}, {"feature": "analytics", "permissions": ["download_data", "create_alerts", "my_looks", "explore_create"]}, {"feature": "security", "permissions": ["all"]}] + example: [ { "feature": "my_plan", "permissions": [ "all" ] }, { "feature": "api", "permissions": [ "none" ] }, { "feature": "user_management", "permissions": [ "all" ] }, { "feature": "app_management", "permissions": [ "all" ] }, { "feature": "sub_organization_groups", "permissions": [ "create", "edit_delete" ] }, { "feature": "create_sub_organizations", "permissions": [ "all" ] }, { "feature": "manage_sub_organizations", "permissions": [ "all" ] }, { "feature": "analytics", "permissions": [ "download_data", "create_alerts", "my_looks", "explore_create" ] }, { "feature": "security", "permissions": [ "all" ] } ] inviteuser: type: object required: @@ -15737,7 +15738,7 @@ components: - 'authorized_ips' - 'none' example: "'create_edit_delete', 'send_schedule_suspend'" - example: [{"feature": "email_campaigns", "permissions": ["create_edit_delete", "send_schedule_suspend"]},{"feature": "sms_campaigns", "permissions": ["create_edit_delete","send_schedule_suspend"]},{"feature": "facebook_ads","permissions": ["create_edit_delete", "schedule_pause"]}] + example: [ { "feature": "email_campaigns", "permissions": [ "create_edit_delete", "send_schedule_suspend" ] },{ "feature": "sms_campaigns", "permissions": [ "create_edit_delete","send_schedule_suspend" ] },{ "feature": "facebook_ads","permissions": [ "create_edit_delete", "schedule_pause" ] } ] inviteuserResponse: required: @@ -15779,7 +15780,7 @@ components: getSsoToken: required: - - token + - token type: object properties: token: @@ -15802,10 +15803,10 @@ components: example: xkeysib-21881axxxxxcc92e04-mIrexxxx7z getClient: required: - - companyName - - email - - firstName - - lastName + - companyName + - email + - firstName + - lastName type: object properties: email: @@ -15827,36 +15828,36 @@ components: example: MyCompany getExtendedClient: allOf: - - $ref: '#/components/schemas/getClient' - - required: - - address - type: object - properties: - address: - required: - - city - - country - - street - - zipCode - type: object - properties: - street: - type: string - description: Street information - example: 47 Harbour Street - city: - type: string - description: City information - example: New-York - zipCode: - type: string - description: Zip Code information - example: "9867" - country: - type: string - description: Country information - example: United States of America - description: Address informations + - $ref: '#/components/schemas/getClient' + - required: + - address + type: object + properties: + address: + required: + - city + - country + - street + - zipCode + type: object + properties: + street: + type: string + description: Street information + example: 47 Harbour Street + city: + type: string + description: City information + example: New-York + zipCode: + type: string + description: Zip Code information + example: "9867" + country: + type: string + description: Country information + example: United States of America + description: Address informations getSendersList: type: object properties: @@ -15865,10 +15866,10 @@ components: description: List of the senders available in your account items: required: - - active - - email - - id - - name + - active + - email + - id + - name type: object properties: id: @@ -15894,9 +15895,9 @@ components: data is displayed only for dedicated IPs items: required: - - domain - - ip - - weight + - domain + - ip + - weight type: object properties: ip: @@ -15920,10 +15921,10 @@ components: description: List of the domains available in your account items: required: - - id - - domain_name - - authenticated - - verified + - id + - domain_name + - authenticated + - verified type: object properties: id: @@ -15949,8 +15950,8 @@ components: example: 123.98.689.7 createSender: required: - - email - - name + - email + - name type: object properties: name: @@ -15969,8 +15970,8 @@ components: **Mandatory in case of dedicated IP**. IPs to associate to the sender items: required: - - domain - - ip + - domain + - ip type: object properties: ip: @@ -16008,8 +16009,8 @@ components: **Only in case of dedicated IP**. IPs to associate to the sender. If passed, will replace all the existing IPs. items: required: - - domain - - ip + - domain + - ip type: object properties: ip: @@ -16031,7 +16032,7 @@ components: example: 50 otp: required: - - otp + - otp type: object properties: otp: @@ -16040,7 +16041,7 @@ components: example: 123456 createDomain: required: - - name + - name type: object properties: name: @@ -16049,8 +16050,8 @@ components: example: mycompany.com errorModel: required: - - code - - message + - code + - message type: object properties: code: @@ -16058,41 +16059,41 @@ components: description: Error code displayed in case of a failure example: method_not_allowed enum: - - invalid_parameter - - missing_parameter - - out_of_range - - campaign_processing - - campaign_sent - - document_not_found - - not_enough_credits - - permission_denied - - duplicate_parameter - - duplicate_request - - method_not_allowed - - unauthorized - - account_under_validation - - not_acceptable - - bad_request - - unprocessable_entity + - invalid_parameter + - missing_parameter + - out_of_range + - campaign_processing + - campaign_sent + - document_not_found + - not_enough_credits + - permission_denied + - duplicate_parameter + - duplicate_request + - method_not_allowed + - unauthorized + - account_under_validation + - not_acceptable + - bad_request + - unprocessable_entity message: type: string description: Readable message associated to the failure example: POST Method is not allowed on this path contactErrorModel: required: - - code - - message + - code + - message properties: code: type: string enum: - - invalid_parameter - - missing_parameter - - document_not_found - - account_in_process - - duplicate_parameter - - method_not_allowed - - out_of_range + - invalid_parameter + - missing_parameter + - document_not_found + - account_in_process + - duplicate_parameter + - method_not_allowed + - out_of_range description: Error code displayed in case of a failure example: 'duplicate_parameter' message: @@ -16118,9 +16119,9 @@ components: example: 5 getProcess: required: - - id - - name - - status + - id + - name + - status type: object properties: id: @@ -16133,9 +16134,9 @@ components: description: Status of the process example: queued enum: - - queued - - in_process - - completed + - queued + - in_process + - completed name: type: string description: Process name @@ -16153,25 +16154,25 @@ components: items: type: object allOf: - - $ref: '#/components/schemas/getExtendedCampaignOverview' - - required: - - recipients - - statistics - type: object - properties: - recipients: - type: object - allOf: - - $ref: '#/components/schemas/getCampaignRecipients' - statistics: - type: object - allOf: - - $ref: '#/components/schemas/getExtendedCampaignStats' - shareLink: - type: string - description: Link to share the campaign on social medias - format: url - example: http://dhh.brevo.com/fhsgccc.html?t=9865448900 + - $ref: '#/components/schemas/getExtendedCampaignOverview' + - required: + - recipients + - statistics + type: object + properties: + recipients: + type: object + allOf: + - $ref: '#/components/schemas/getCampaignRecipients' + statistics: + type: object + allOf: + - $ref: '#/components/schemas/getExtendedCampaignStats' + shareLink: + type: string + description: Link to share the campaign on social medias + format: url + example: http://dhh.brevo.com/fhsgccc.html?t=9865448900 count: type: integer description: Number of Email campaigns retrieved @@ -16185,20 +16186,20 @@ components: items: type: object allOf: - - $ref: '#/components/schemas/getSmsCampaignOverview' - - required: - - recipients - - statistics - type: object - properties: - recipients: - type: object - allOf: - - $ref: '#/components/schemas/getCampaignRecipients' - statistics: - type: object - allOf: - - $ref: '#/components/schemas/getSmsCampaignStats' + - $ref: '#/components/schemas/getSmsCampaignOverview' + - required: + - recipients + - statistics + type: object + properties: + recipients: + type: object + allOf: + - $ref: '#/components/schemas/getCampaignRecipients' + statistics: + type: object + allOf: + - $ref: '#/components/schemas/getSmsCampaignStats' count: type: integer description: Number of SMS campaigns retrieved @@ -16206,42 +16207,42 @@ components: example: 12 getSmsCampaign: allOf: - - $ref: '#/components/schemas/getSmsCampaignOverview' - - required: - - recipients - - statistics - type: object - properties: - recipients: - type: object - allOf: - - $ref: '#/components/schemas/getCampaignRecipients' - statistics: - type: object - allOf: - - $ref: '#/components/schemas/getSmsCampaignStats' + - $ref: '#/components/schemas/getSmsCampaignOverview' + - required: + - recipients + - statistics + type: object + properties: + recipients: + type: object + allOf: + - $ref: '#/components/schemas/getCampaignRecipients' + statistics: + type: object + allOf: + - $ref: '#/components/schemas/getSmsCampaignStats' getEmailCampaign: allOf: - - $ref: '#/components/schemas/getExtendedCampaignOverview' - - required: - - recipients - - statistics - type: object - properties: - recipients: - type: object - allOf: - - $ref: '#/components/schemas/getCampaignRecipients' - statistics: - type: object - allOf: - - $ref: '#/components/schemas/getExtendedCampaignStats' + - $ref: '#/components/schemas/getExtendedCampaignOverview' + - required: + - recipients + - statistics + type: object + properties: + recipients: + type: object + allOf: + - $ref: '#/components/schemas/getCampaignRecipients' + statistics: + type: object + allOf: + - $ref: '#/components/schemas/getExtendedCampaignStats' getCampaignOverview: required: - - id - - name - - status - - type + - id + - name + - status + - type type: object properties: id: @@ -16260,26 +16261,26 @@ components: example: 20% OFF for 2017 Summer Sales previewText: type: string - description : Preview text or preheader of the email campaign + description: Preview text or preheader of the email campaign example: Thanks for your order! type: type: string description: Type of campaign example: classic enum: - - classic - - trigger + - classic + - trigger status: type: string description: Status of the campaign example: sent enum: - - draft - - sent - - archive - - queued - - suspended - - in_process + - draft + - sent + - archive + - queued + - suspended + - in_process scheduledAt: type: string description: UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) @@ -16322,125 +16323,125 @@ components: example: true getExtendedCampaignOverview: allOf: - - $ref: '#/components/schemas/getCampaignOverview' - - required: - - createdAt - - footer - - header - - htmlContent - - modifiedAt - - replyTo - - sender - - testSent - type: object - properties: - utmCampaignValue: - type: string - description: utm parameter associated with campaign - example: myutm - utmSource: - type: string - example: Brevo - utmMedium: - type: string - example: EMAIL - utmIDActive: - type: boolean - description: utm id activate - example: true - testSent: - type: boolean - description: Retrieved the status of test email sending. (true=Test email - has been sent false=Test email has not been sent) - example: true - header: - type: string - description: Header of the campaign - example: '[DEFAULT_HEADER]' - footer: - type: string - description: Footer of the campaign - example: '[DEFAULT_FOOTER]' - sender: - type: object - properties: - name: - type: string - description: Sender name of the campaign - example: Marketing - email: - type: string - description: Sender email of the campaign - format: email - example: marketing@mycompany.com - id: - type: integer - format : int64 - description: Sender id of the campaign - example: 43 - replyTo: - type: string - description: Email defined as the "Reply to" of the campaign - format: email - example: replyto@domain.com - toField: - type: string - description: Customisation of the "to" field of the campaign - example: '{FNAME} {LNAME}' - htmlContent: - type: string - description: HTML content of the campaign - example: This is my HTML Content - shareLink: - type: string - description: Link to share the campaign on social medias - format: url - example: http://dhh.brevo.com/fhsgccc.html?t=9865448900 - tag: - type: string - description: Tag of the campaign - example: Newsletter - createdAt: - type: string - description: Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) - example: 2017-05-01T12:30:00Z - modifiedAt: - type: string - description: UTC date-time of last modification of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) - example: 2017-05-01T12:30:00Z - inlineImageActivation: - type: boolean - description: Status of inline image. inlineImageActivation = false means - image can’t be embedded, & inlineImageActivation = true means image - can be embedded, in the email. - example: true - mirrorActive: - type: boolean - description: Status of mirror links in campaign. mirrorActive = false - means mirror links are deactivated, & mirrorActive = true means mirror - links are activated, in the campaign - example: true - recurring: - type: boolean - description: 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 - example: true - sentDate: - type: string - description: Sent UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ). - Only available if 'status' of the campaign is 'sent' - example: 2018-12-01T16:30:00Z - returnBounce: - type: integer - description: Total number of non-delivered campaigns for a particular - campaign id. - format: int64 - example: 5 + - $ref: '#/components/schemas/getCampaignOverview' + - required: + - createdAt + - footer + - header + - htmlContent + - modifiedAt + - replyTo + - sender + - testSent + type: object + properties: + utmCampaignValue: + type: string + description: utm parameter associated with campaign + example: myutm + utmSource: + type: string + example: Brevo + utmMedium: + type: string + example: EMAIL + utmIDActive: + type: boolean + description: utm id activate + example: true + testSent: + type: boolean + description: Retrieved the status of test email sending. (true=Test email + has been sent false=Test email has not been sent) + example: true + header: + type: string + description: Header of the campaign + example: '[DEFAULT_HEADER]' + footer: + type: string + description: Footer of the campaign + example: '[DEFAULT_FOOTER]' + sender: + type: object + properties: + name: + type: string + description: Sender name of the campaign + example: Marketing + email: + type: string + description: Sender email of the campaign + format: email + example: marketing@mycompany.com + id: + type: integer + format: int64 + description: Sender id of the campaign + example: 43 + replyTo: + type: string + description: Email defined as the "Reply to" of the campaign + format: email + example: replyto@domain.com + toField: + type: string + description: Customisation of the "to" field of the campaign + example: '{FNAME} {LNAME}' + htmlContent: + type: string + description: HTML content of the campaign + example: This is my HTML Content + shareLink: + type: string + description: Link to share the campaign on social medias + format: url + example: http://dhh.brevo.com/fhsgccc.html?t=9865448900 + tag: + type: string + description: Tag of the campaign + example: Newsletter + createdAt: + type: string + description: Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-05-01T12:30:00Z + modifiedAt: + type: string + description: UTC date-time of last modification of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-05-01T12:30:00Z + inlineImageActivation: + type: boolean + description: Status of inline image. inlineImageActivation = false means + image can’t be embedded, & inlineImageActivation = true means image + can be embedded, in the email. + example: true + mirrorActive: + type: boolean + description: Status of mirror links in campaign. mirrorActive = false + means mirror links are deactivated, & mirrorActive = true means mirror + links are activated, in the campaign + example: true + recurring: + type: boolean + description: 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 + example: true + sentDate: + type: string + description: Sent UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ). + Only available if 'status' of the campaign is 'sent' + example: 2018-12-01T16:30:00Z + returnBounce: + type: integer + description: Total number of non-delivered campaigns for a particular + campaign id. + format: int64 + example: 5 getCampaignRecipients: required: - - exclusionLists - - lists + - exclusionLists + - lists type: object properties: lists: @@ -16459,28 +16460,28 @@ components: example: 13 getExtendedCampaignStats: required: - - campaignStats - - globalStats - - linksStats - - mirrorClick - - remaining - - statsByBrowser - - statsByDevice - - statsByDomain + - campaignStats + - globalStats + - linksStats + - mirrorClick + - remaining + - statsByBrowser + - statsByDevice + - statsByDomain type: object properties: globalStats: type: object description: Overall statistics of the campaign allOf: - - $ref: '#/components/schemas/getCampaignStats' + - $ref: '#/components/schemas/getCampaignStats' campaignStats: type: array description: List-wise statistics of the campaign. items: type: object allOf: - - $ref: '#/components/schemas/getCampaignStats' + - $ref: '#/components/schemas/getCampaignStats' mirrorClick: type: integer description: Number of clicks on mirror link @@ -16493,7 +16494,7 @@ components: example: 1000 linksStats: type: object - properties: {} + properties: { } description: Statistics about the number of clicks for the links example: example.abc.com: 7 @@ -16631,13 +16632,13 @@ components: getSmsCampaignOverview: required: - - content - - createdAt - - id - - modifiedAt - - name - - sender - - status + - content + - createdAt + - id + - modifiedAt + - name + - sender + - status type: object properties: id: @@ -16654,12 +16655,12 @@ components: description: Status of the SMS Campaign example: draft enum: - - draft - - sent - - archive - - queued - - suspended - - inProcess + - draft + - sent + - archive + - queued + - suspended + - inProcess content: type: string description: Content of the SMS Campaign @@ -16683,14 +16684,14 @@ components: example: 2017-05-01T12:30:00Z getWhatsappCampaignOverview: required: - - id - - campaignName - - campaignStatus - - senderNumber - - recipients - - createdAt - - template - - modifiedAt + - id + - campaignName + - campaignStatus + - senderNumber + - recipients + - createdAt + - template + - modifiedAt type: object properties: id: @@ -16707,14 +16708,14 @@ components: description: Status of the WhatsApp Campaign example: draft enum: - - draft - - scheduled - - pending - - approved - - running - - suspended - - rejected - - sent + - draft + - scheduled + - pending + - approved + - running + - suspended + - rejected + - sent scheduledAt: type: string description: UTC date-time on which WhatsApp campaign is scheduled. Should be @@ -16724,9 +16725,9 @@ components: type: string description: Sender of the WhatsApp Campaign example: 9368207029 - stats : + stats: $ref: '#/components/schemas/WhatsappCampStats' - template : + template: $ref: '#/components/schemas/WhatsappCampTemplate' createdAt: type: string @@ -16734,117 +16735,117 @@ components: example: 2017-06-01T12:30:00Z modifiedAt: type: string - description: UTC date-time of last modification of the WhatsApp campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) - example: 2017-05-01T12:30:00Z - WhatsappCampStats: + description: UTC date-time of last modification of the WhatsApp campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-05-01T12:30:00Z + WhatsappCampStats: + type: object + required: + - sent + - delivered + - read + - unsubscribe + - notSent + properties: + sent: + type: integer + example: 3 + delivered: + type: integer + example: 3 + read: + type: integer + example: 2 + unsubscribe: + type: integer + example: 0 + notSent: + type: integer + example: 4 + WhatsappCampTemplate: + type: object + properties: + name: + type: string + example: wta107 + description: name of the template + category: + type: string + example: Marketing + description: description of the template + language: + type: string + example: en_GB + description: language of the template + contains_button: + type: boolean + example: false + display_header: + type: boolean + example: true + header_type: + type: string + example: text + description: type of header + components: + type: array + description: array of component item objects + items: + $ref: '#/components/schemas/componentItems' + header_variables: + type: array + description: array of variables item object + items: + $ref: '#/components/schemas/variablesItems' + body_variables: + type: array + description: array of variables item variables + items: + $ref: '#/components/schemas/variablesItems' + button_type: + type: string + example: QUICK_REPLIES + hide_footer: + type: boolean + example: true + componentItems: type: object - required: - - sent - - delivered - - read - - unsubscribe - - notSent properties: - sent: - type: integer - example: 3 - delivered: - type: integer - example : 3 - read: - type: integer - example: 2 - unsubscribe: - type: integer - example: 0 - notSent: - type: integer - example: 4 - WhatsappCampTemplate: + type: + type: string + example: BODY + text: + type: string + example: Life is a long lesson in humility + variablesItems: type: object properties: - name: - type : string - example: wta107 - description : name of the template - category: - type : string - example : Marketing - description : description of the template - language: - type : string - example : en_GB - description : language of the template - contains_button: - type : boolean - example : false - display_header: - type : boolean - example : true - header_type: - type : string - example : text - description : type of header - components: - type : array - description : array of component item objects - items: - $ref: '#/components/schemas/componentItems' - header_variables : - type : array - description : array of variables item object - items: - $ref: '#/components/schemas/variablesItems' - body_variables: - type : array - description: array of variables item variables - items: - $ref: '#/components/schemas/variablesItems' - button_type: - type: string - example : QUICK_REPLIES - hide_footer: - type: boolean - example : true - componentItems : - type : object - properties: - type : - type : string - example : BODY - text : - type : string - example : Life is a long lesson in humility - variablesItems : - type : object - properties : - name : - type: string - example : FIRSTNAME - default : - type : string - example : INVALID_HEADER - datatype : - type : string - example : text - bodyVariablesItems : - type : object - getWhatsappTemplates : + name: + type: string + example: FIRSTNAME + default: + type: string + example: INVALID_HEADER + datatype: + type: string + example: text + bodyVariablesItems: + type: object + getWhatsappTemplates: type: object properties: templates: type: array items: type: object - required : - - id - - name - - status - - type - - language - - category - - createdAt - - modifiedAt + required: + - id + - name + - status + - type + - language + - category + - createdAt + - modifiedAt properties: id: type: integer @@ -16884,21 +16885,21 @@ components: description: Number of WhatsApp templates retrieved format: int64 example: 24 - getWhatsappCampaigns : + getWhatsappCampaigns: type: object properties: campaigns: - type : array - items : - type : object + type: array + items: + type: object required: - - id - - campaignName - - campaignStatus - - templateId - - scheduledAt - - createdAt - - modifiedAt + - id + - campaignName + - campaignStatus + - templateId + - scheduledAt + - createdAt + - modifiedAt properties: id: type: integer @@ -16910,40 +16911,40 @@ components: description: Name of the WhatsApp Campaign example: Test Campaign templateId: - type : string - description : Id of the WhatsApp template - example : 637660278078655 + type: string + description: Id of the WhatsApp template + example: 637660278078655 campaignStatus: type: string description: Status of the WhatsApp Campaign example: draft enum: - - draft - - scheduled - - pending - - approved - - running - - suspended - - rejected - - sent + - draft + - scheduled + - pending + - approved + - running + - suspended + - rejected + - sent scheduledAt: type: string description: UTC date-time on which WhatsApp campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format example: 2017-06-01T12:30:00Z errorReason: type: string - description : Error Reason associated with the WhatsApp campaign sending - invalidatedContacts : - type : integer - description : Count of invalidated contacts - format : int64 - example : 0 - readPercentage : - type : number - description : Read percentage of the the WhatsApp campaign created - format : float - example : 28.57 - stats : + description: Error Reason associated with the WhatsApp campaign sending + invalidatedContacts: + type: integer + description: Count of invalidated contacts + format: int64 + example: 0 + readPercentage: + type: number + description: Read percentage of the the WhatsApp campaign created + format: float + example: 28.57 + stats: $ref: '#/components/schemas/WhatsappCampStats' createdAt: type: string @@ -16955,34 +16956,34 @@ components: example: 2017-05-01T12:30:00Z count: type: integer - description : Number of WhatsApp campaigns retrieved + description: Number of WhatsApp campaigns retrieved format: int64 example: 40 - createWhatsAppCampaign : - type : object - required: - - name - - templateId - - scheduledAt - - recipients - properties : - name : - type : string - description : Name of the WhatsApp campaign creation - example : Test Campaign - templateId : - type : integer - description : Id of the WhatsApp template in **approved** state - example : 19 - scheduledAt : - type: string - description: | + createWhatsAppCampaign: + type: object + required: + - name + - templateId + - scheduledAt + - recipients + properties: + name: + type: string + description: Name of the WhatsApp campaign creation + example: Test Campaign + templateId: + type: integer + description: Id of the WhatsApp template in **approved** state + example: 19 + scheduledAt: + type: string + description: | Sending UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.For example: **2017-06-01T12:30:00+02:00** - example: 2017-06-01T12:30:00+02:00 - recipients: + example: 2017-06-01T12:30:00+02:00 + recipients: type: object properties: - excludedListIds : + excludedListIds: type: array description: List ids to exclude from the campaign items: @@ -17006,118 +17007,118 @@ components: format: int64 example: 23 description: Segment ids and List ids to include/exclude from campaign - getWhatsAppConfig : - type : object - properties : - whatsappBusinessAccountId : - type : string - description : Id of the WhatsApp business account - example : 105569359072383 - sendingLimit : - type : string - description : Sending limit Information of the WhatsApp API account - example : TIER_1K - phoneNumberQuality : - type : string - description : Quality status of phone number associated with WhatsApp account. There are three quality ratings. example - **High (GREEN) , Medium (YELLOW) and Low(RED)** - example : GREEN - enum : - - GREEN - - YELLOW - - RED - whatsappBusinessAccountStatus : - type : string - description : Status information related to WhatsApp API account - example : APPROVED - enum : - - APPROVED - - PENDING - - REJECTED - businessStatus : - type : string - description : Verification status information of the Business account - example : verified - phoneNumberNameStatus : - type : string - description : Status of the name associated with WhatsApp Phone number - example : APPROVED - enum : - - APPROVED - - PENDING - - REJECTED - createWhatsAppTemplate : - type : object - required : - - name - - language - - category - - bodyText - properties : + getWhatsAppConfig: + type: object + properties: + whatsappBusinessAccountId: + type: string + description: Id of the WhatsApp business account + example: 105569359072383 + sendingLimit: + type: string + description: Sending limit Information of the WhatsApp API account + example: TIER_1K + phoneNumberQuality: + type: string + description: Quality status of phone number associated with WhatsApp account. There are three quality ratings. example - **High (GREEN) , Medium (YELLOW) and Low(RED)** + example: GREEN + enum: + - GREEN + - YELLOW + - RED + whatsappBusinessAccountStatus: + type: string + description: Status information related to WhatsApp API account + example: APPROVED + enum: + - APPROVED + - PENDING + - REJECTED + businessStatus: + type: string + description: Verification status information of the Business account + example: verified + phoneNumberNameStatus: + type: string + description: Status of the name associated with WhatsApp Phone number + example: APPROVED + enum: + - APPROVED + - PENDING + - REJECTED + createWhatsAppTemplate: + type: object + required: + - name + - language + - category + - bodyText + properties: name: - type : string - description : Name of the template - example : Test template - language : - type : string - description : | - Language of the template. For Example : - **en** for English - example : en - category : - type : string - description : Category of the template - example : MARKETING - enum : - - MARKETING - - UTILITY + type: string + description: Name of the template + example: Test template + language: + type: string + description: | + Language of the template. For Example : + **en** for English + example: en + category: + type: string + description: Category of the template + example: MARKETING + enum: + - MARKETING + - UTILITY mediaUrl: - type : string - description : | - Absolute url of the media file **(no local file)** for the header. **Use this field in you want to add media in Template header and headerText is empty**. - Allowed extensions for media files are: - #### jpeg | png | mp4 | pdf - example : https://attachment.domain.com - bodyText : - type : string - description : Body of the template. **Maximum allowed characters are 1024** - example : making it look like readable English - headerText : - type : string - description : | - Text content of the header in the template. **Maximum allowed characters are 45** - **Use this field to add text content in template header and if mediaUrl is empty** - example : Test WhatsApp campaign - source : - type : string - description : source of the template - enum : - - Automation - - Conversations - updateWhatsAppCampaign : + type: string + description: | + Absolute url of the media file **(no local file)** for the header. **Use this field in you want to add media in Template header and headerText is empty**. + Allowed extensions for media files are: + #### jpeg | png | mp4 | pdf + example: https://attachment.domain.com + bodyText: + type: string + description: Body of the template. **Maximum allowed characters are 1024** + example: making it look like readable English + headerText: + type: string + description: | + Text content of the header in the template. **Maximum allowed characters are 45** + **Use this field to add text content in template header and if mediaUrl is empty** + example: Test WhatsApp campaign + source: + type: string + description: source of the template + enum: + - Automation + - Conversations + updateWhatsAppCampaign: type: object - properties : + properties: campaignName: type: string - description : Name of the campaign - example : Test WhatsApp - campaignStatus : - type : string - description : Status of the campaign - example : scheduled + description: Name of the campaign + example: Test WhatsApp + campaignStatus: + type: string + description: Status of the campaign + example: scheduled enum: - - scheduled - - suspended - default : scheduled - rescheduleFor : - type : string - description : | + - scheduled + - suspended + default: scheduled + rescheduleFor: + type: string + description: | Reschedule the sending UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of campaign. **Prefer to pass your timezone in date-time format for accurate result.For example: **2017-06-01T12:30:00+02:00** Use this field to update the scheduledAt of any existing draft or scheduled WhatsApp campaign. example: 2017-06-01T12:30:00+02:00 recipients: type: object properties: - excludedListIds : + excludedListIds: type: array description: List ids to exclude from the campaign items: @@ -17191,8 +17192,8 @@ components: type: string description: Loyalty Program state enum: - - inactive - - active + - inactive + - active createSubscriptionPayload: type: object properties: @@ -17715,32 +17716,32 @@ components: offer: type: object properties: - id: - type: string - format: uuid - description: Offer id - loyaltyProgramId: - type: string - format: uuid - description: Loyalty program id - name: - type: string - description: Offer name - state: - type: string - description: Offer state - enum: [active, pending, disabled, expired] - publicImageUrl: - type: string - description: Offer image url - createdAt: - type: string - format: date-time - description: Offer creation date - updatedAt: - type: string - format: date-time - description: Offer update date + id: + type: string + format: uuid + description: Offer id + loyaltyProgramId: + type: string + format: uuid + description: Loyalty program id + name: + type: string + description: Offer name + state: + type: string + description: Offer state + enum: [ active, pending, disabled, expired ] + publicImageUrl: + type: string + description: Offer image url + createdAt: + type: string + format: date-time + description: Offer creation date + updatedAt: + type: string + format: date-time + description: Offer update date balanceDefinitionPage: type: object @@ -17797,12 +17798,12 @@ components: description: Unit of time for the balance's availability (e.g., day/week/month/year). balanceAvailabilityDurationModifier: type: string - enum: [startOfPeriod, endOfPeriod, noModification] + enum: [ startOfPeriod, endOfPeriod, noModification ] description: startOfPeriod depicts the balancy expiry on start of day/week/month/year. endOfPeriod depicts the balancy expiry on end of day/week/month/year balanceExpirationDate: type: string format: date-time - description: Date when the balance expires and can no longer be used, in dd/mm format. The balance will be expired when this date appears next in the calendar and only one of balanceExpirationDate or balance availability fields can be used. + description: Date when the balance expires and can no longer be used, in dd/mm format. The balance will be expired when this date appears next in the calendar and only one of balanceExpirationDate or balance availability fields can be used. createdAt: type: string format: date-time @@ -17902,7 +17903,7 @@ components: - noModification balanceExpirationDate: type: string - description: Date when the balance expires and can no longer be used, in dd/mm format. The balance will be expired when this date appears next in the calendar and only one of balanceExpirationDate or balance availability fields can be used. + description: Date when the balance expires and can no longer be used, in dd/mm format. The balance will be expired when this date appears next in the calendar and only one of balanceExpirationDate or balance availability fields can be used. example: 02/01 updateBalanceDefinitionPayload: @@ -17998,16 +17999,16 @@ components: - noModification balanceExpirationDate: type: string - description: Date when the balance expires and can no longer be used, in dd/mm format. The balance will be expired when this date appears next in the calendar and only one of balanceExpirationDate or balance availability fields can be used. + description: Date when the balance expires and can no longer be used, in dd/mm format. The balance will be expired when this date appears next in the calendar and only one of balanceExpirationDate or balance availability fields can be used. example: 02/01 - + balanceLimit: type: object description: Balance definition limit properties: constraintType: type: string - description: Select amount to define constraints on amount and transaction to define constraints on transaction + description: Select amount to define constraints on amount and transaction to define constraints on transaction default: amount enum: - amount @@ -18073,7 +18074,7 @@ components: properties: balance: $ref: '#/components/schemas/balance' - + balance: type: object properties: @@ -18339,7 +18340,7 @@ components: - balanceDefinitionId - count - balances - + createOrderPayload: type: object properties: @@ -18356,7 +18357,7 @@ components: meta: description: Additional metadata related to the order. type: object - example: {"key": "value"} + example: { "key": "value" } contactId: description: Contact id type: number @@ -18371,7 +18372,7 @@ components: - dueAt - # Tier + # Tier createTierGroupRequest: type: object properties: @@ -18433,7 +18434,7 @@ components: items: type: string format: uuid - example: [] + example: [ ] description: Order of the tiers in the group in ascending order loyaltyProgramId: type: string @@ -18613,7 +18614,7 @@ components: createModel: required: - - id + - id type: object properties: id: @@ -18664,7 +18665,7 @@ components: example: 3,4 createSenderModel: required: - - id + - id type: object properties: id: @@ -18684,7 +18685,7 @@ components: example: false createDomainModel: required: - - id + - id type: object properties: id: @@ -18742,8 +18743,8 @@ components: type: boolean authenticateDomainModel: required: - - domain_name - - message + - domain_name + - message type: object properties: domain_name: @@ -18756,10 +18757,10 @@ components: example: Domain has been authenticated successfully. getDomainConfigurationModel: required: - - domain - - verified - - authenticated - - dns_records + - domain + - verified + - authenticated + - dns_records type: object properties: domain: @@ -18822,7 +18823,7 @@ components: items: type: string description: version wise message ID's of the transactional emails sent - example: ['<201798300811.5787683@relay.domain.com>','<201798300811.5787683@relay.domain.com>'] + example: [ '<201798300811.5787683@relay.domain.com>','<201798300811.5787683@relay.domain.com>' ] uploadImageModel: type: object properties: @@ -18848,8 +18849,8 @@ components: example: 5c6cfa04-eed9-42c2-8b5c-6d470d978e9d sendSms: required: - - messageId - - reference + - messageId + - reference type: object properties: reference: @@ -18876,7 +18877,7 @@ components: example: 82.85 createdProcessId: required: - - processId + - processId type: object properties: processId: @@ -18893,8 +18894,8 @@ components: example: Wordpress Contacts postSendFailed: required: - - code - - message + - code + - message type: object properties: code: @@ -18930,8 +18931,8 @@ components: example: jeff.dean@example.com, jim.sue@example.com postSendSmsTestFailed: required: - - code - - message + - code + - message type: object properties: code: @@ -18959,7 +18960,7 @@ components: example: 3542388988@mailin.com, 10976444477@mailin.com postContactInfo: required: - - contacts + - contacts type: object properties: contacts: @@ -19084,10 +19085,10 @@ components: type: array items: required: - - blockedAt - - email - - reason - - senderEmail + - blockedAt + - email + - reason + - senderEmail type: object properties: email: @@ -19109,12 +19110,12 @@ components: is safe for comparison) example: AdminBlocked enum: - - unsubscribedViaMA - - unsubscribedViaEmail - - adminBlocked - - unsubscribedViaApi - - hardBounce - - contactFlaggedAsSpam + - unsubscribedViaMA + - unsubscribedViaEmail + - adminBlocked + - unsubscribedViaApi + - hardBounce + - contactFlaggedAsSpam message: type: string description: Reason for blocking / unsubscribing (This string @@ -19133,19 +19134,19 @@ components: type: array items: required: - - blocked - - clicks - - date - - delivered - - hardBounces - - invalid - - opens - - requests - - softBounces - - spamReports - - uniqueClicks - - uniqueOpens - - unsubscribed + - blocked + - clicks + - date + - delivered + - hardBounces + - invalid + - opens + - requests + - softBounces + - spamReports + - uniqueClicks + - uniqueOpens + - unsubscribed type: object properties: date: @@ -19220,10 +19221,10 @@ components: type: array items: required: - - date - - email - - event - - messageId + - date + - email + - event + - messageId type: object properties: email: @@ -19248,20 +19249,20 @@ components: description: Event which occurred example: delivered enum: - - bounces - - hardBounces - - softBounces - - delivered - - spam - - requests - - opened - - clicks - - invalid - - deferred - - blocked - - unsubscribed - - error - - loadedByProxy + - bounces + - hardBounces + - softBounces + - delivered + - spam + - requests + - opened + - clicks + - invalid + - deferred + - blocked + - unsubscribed + - error + - loadedByProxy reason: type: string description: Reason of bounce (only available if the event is hardbounce @@ -19316,17 +19317,17 @@ components: description: Event which occurred example: accepted enum: - - bounces - - hardBounces - - softBounces - - delivered - - sent - - accepted - - unsubscription - - replies - - blocked - - rejected - - skipped + - bounces + - hardBounces + - softBounces + - delivered + - sent + - accepted + - unsubscription + - replies + - blocked + - rejected + - skipped reason: type: string description: Reason of bounce (only available if the event is hardbounce @@ -19341,18 +19342,18 @@ components: example: CabWaiting getSmtpTemplateOverview: required: - - createdAt - - htmlContent - - id - - isActive - - modifiedAt - - name - - replyTo - - sender - - subject - - tag - - testSent - - toField + - createdAt + - htmlContent + - id + - isActive + - modifiedAt + - name + - replyTo + - sender + - subject + - tag + - testSent + - toField type: object properties: id: @@ -19438,13 +19439,13 @@ components: $ref: '#/components/schemas/getSmtpTemplateOverview' getWebhook: required: - - createdAt - - description - - events - - id - - modifiedAt - - type - - url + - createdAt + - description + - events + - id + - modifiedAt + - type + - url type: object properties: url: @@ -19472,8 +19473,8 @@ components: description: Type of webhook (marketing or transactional) example: marketing enum: - - marketing - - transactional + - marketing + - transactional createdAt: type: string description: Creation UTC date-time of the webhook (YYYY-MM-DDTHH:mm:ss.SSSZ) @@ -19502,7 +19503,7 @@ components: value: test-header-value getWebhooks: required: - - webhooks + - webhooks type: object properties: webhooks: @@ -19510,16 +19511,16 @@ components: items: type: object allOf: - - $ref: '#/components/schemas/getWebhook' + - $ref: '#/components/schemas/getWebhook' getContactDetails: required: - - attributes - - createdAt - - emailBlacklisted - - id - - listIds - - modifiedAt - - smsBlacklisted + - attributes + - createdAt + - emailBlacklisted + - id + - listIds + - modifiedAt + - smsBlacklisted type: object properties: email: @@ -19565,236 +19566,236 @@ components: format: int64 attributes: type: object - properties: {} + properties: { } description: Set of attributes of the contact example: name: Joe email: joe@example.com getExtendedContactDetails: - allOf: - - $ref: '#/components/schemas/getContactDetails' - - required: - - statistics - type: object - properties: - statistics: - type: object - properties: - messagesSent: - type: array - description: Listing of the sent campaign for the contact - items: - required: - - campaignId - - eventTime - type: object - properties: - campaignId: - type: integer - description: ID of the campaign which generated the event - format: int64 - example: 3 - eventTime: - type: string - description: UTC date-time of the event - example: 2017-03-12T20:15:13Z - hardBounces: - type: array - description: Listing of the hardbounes generated by the contact - items: - required: - - campaignId - - eventTime - type: object - properties: - campaignId: - type: integer - description: ID of the campaign which generated the event - format: int64 - example: 3 - eventTime: - type: string - description: UTC date-time of the event - example: 2017-03-12T20:15:13Z - softBounces: - type: array - description: Listing of the softbounes generated by the contact - items: - required: - - campaignId - - eventTime - type: object - properties: - campaignId: - type: integer - description: ID of the campaign which generated the event - format: int64 - example: 3 - eventTime: - type: string - description: UTC date-time of the event - example: 2017-03-12T20:15:13Z - complaints: - type: array - description: Listing of the complaints generated by the contact - items: - required: - - campaignId - - eventTime - type: object - properties: - campaignId: - type: integer - description: ID of the campaign which generated the event - format: int64 - example: 3 - eventTime: - type: string - description: UTC date-time of the event - example: 2017-03-12T20:15:13Z - unsubscriptions: - required: - - adminUnsubscription - - userUnsubscription - type: object - properties: - userUnsubscription: - type: array - description: Contact unsubscribe via unsubscription link in a - campaign - items: - required: + allOf: + - $ref: '#/components/schemas/getContactDetails' + - required: + - statistics + type: object + properties: + statistics: + type: object + properties: + messagesSent: + type: array + description: Listing of the sent campaign for the contact + items: + required: - campaignId - eventTime - type: object - properties: - campaignId: - type: integer - description: ID of the campaign which generated the event - format: int64 - example: 3 - eventTime: - type: string - description: UTC date-time of the event - example: 2017-03-12T20:15:13Z - ip: - type: string - description: IP from which the user has unsubscribed - example: 165.87.3.15 - adminUnsubscription: - type: array - description: Contact has been unsubscribed from the administrator - items: - required: + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + hardBounces: + type: array + description: Listing of the hardbounes generated by the contact + items: + required: + - campaignId - eventTime - type: object - properties: - eventTime: - type: string - description: UTC date-time of the event - example: 2017-03-12T20:15:13Z - ip: - type: string - description: IP from which the user has been unsubscribed - example: 165.87.3.15 - description: Listing of the unsubscription for the contact - opened: - type: array - description: Listing of the openings generated by the contact - items: - required: - - campaignId - - count - - eventTime - - ip - type: object - properties: - campaignId: - type: integer - description: ID of the campaign which generated the event - format: int64 - example: 3 - count: - type: integer - description: Number of openings for the campaign - format: int64 - example: 1 - eventTime: - type: string - description: UTC date-time of the event - example: 2017-03-12T20:15:13Z - ip: - type: string - description: IP from which the user has opened the email - example: 165.87.3.15 - clicked: - type: array - description: Listing of the clicks generated by the contact - items: + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + softBounces: + type: array + description: Listing of the softbounes generated by the contact + items: + required: + - campaignId + - eventTime + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + complaints: + type: array + description: Listing of the complaints generated by the contact + items: + required: + - campaignId + - eventTime + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + unsubscriptions: required: - - campaignId - - links + - adminUnsubscription + - userUnsubscription type: object properties: - campaignId: - type: integer - description: ID of the campaign which generated the event - format: int64 - example: 3 - links: + userUnsubscription: type: array - description: Listing of the clicked links for the campaign + description: Contact unsubscribe via unsubscription link in a + campaign items: required: - - count - - eventTime - - ip - - url + - campaignId + - eventTime type: object properties: - count: + campaignId: type: integer - description: Number of clicks on this link for the campaign + description: ID of the campaign which generated the event format: int64 - example: 1 + example: 3 eventTime: type: string description: UTC date-time of the event example: 2017-03-12T20:15:13Z ip: type: string - description: IP from which the user has clicked on the - link + description: IP from which the user has unsubscribed example: 165.87.3.15 - url: + adminUnsubscription: + type: array + description: Contact has been unsubscribed from the administrator + items: + required: + - eventTime + type: object + properties: + eventTime: type: string - description: URL of the clicked link - example: www.myshop.com - transacAttributes: - type: array - description: Listing of the transactional attributes for the contact - items: - type: object - properties: {} - delivered: - type: array - description: Listing of the delivered campaign for the contact - items: - required: - - campaignId - - eventTime - type: object - properties: - campaignId: - type: integer - description: ID of the campaign which generated the event - format: int64 - example: 3 - eventTime: - type: string - description: UTC date-time of the event - example: 2017-03-12T20:15:13Z - description: Campaign statistics of the contact + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + ip: + type: string + description: IP from which the user has been unsubscribed + example: 165.87.3.15 + description: Listing of the unsubscription for the contact + opened: + type: array + description: Listing of the openings generated by the contact + items: + required: + - campaignId + - count + - eventTime + - ip + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + count: + type: integer + description: Number of openings for the campaign + format: int64 + example: 1 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + ip: + type: string + description: IP from which the user has opened the email + example: 165.87.3.15 + clicked: + type: array + description: Listing of the clicks generated by the contact + items: + required: + - campaignId + - links + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + links: + type: array + description: Listing of the clicked links for the campaign + items: + required: + - count + - eventTime + - ip + - url + type: object + properties: + count: + type: integer + description: Number of clicks on this link for the campaign + format: int64 + example: 1 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + ip: + type: string + description: IP from which the user has clicked on the + link + example: 165.87.3.15 + url: + type: string + description: URL of the clicked link + example: www.myshop.com + transacAttributes: + type: array + description: Listing of the transactional attributes for the contact + items: + type: object + properties: { } + delivered: + type: array + description: Listing of the delivered campaign for the contact + items: + required: + - campaignId + - eventTime + type: object + properties: + campaignId: + type: integer + description: ID of the campaign which generated the event + format: int64 + example: 3 + eventTime: + type: string + description: UTC date-time of the event + example: 2017-03-12T20:15:13Z + description: Campaign statistics of the contact getContactCampaignStats: type: object properties: @@ -19802,8 +19803,8 @@ components: type: array items: required: - - campaignId - - eventTime + - campaignId + - eventTime type: object properties: campaignId: @@ -19819,8 +19820,8 @@ components: type: array items: required: - - campaignId - - eventTime + - campaignId + - eventTime type: object properties: campaignId: @@ -19836,8 +19837,8 @@ components: type: array items: required: - - campaignId - - eventTime + - campaignId + - eventTime type: object properties: campaignId: @@ -19853,8 +19854,8 @@ components: type: array items: required: - - campaignId - - eventTime + - campaignId + - eventTime type: object properties: campaignId: @@ -19868,8 +19869,8 @@ components: example: 2017-03-12T20:15:13Z unsubscriptions: required: - - adminUnsubscription - - userUnsubscription + - adminUnsubscription + - userUnsubscription type: object properties: userUnsubscription: @@ -19878,8 +19879,8 @@ components: the email items: required: - - campaignId - - eventTime + - campaignId + - eventTime type: object properties: campaignId: @@ -19900,7 +19901,7 @@ components: description: Contact has been unsubscribed from the administrator items: required: - - eventTime + - eventTime type: object properties: eventTime: @@ -19915,10 +19916,10 @@ components: type: array items: required: - - campaignId - - count - - eventTime - - ip + - campaignId + - count + - eventTime + - ip type: object properties: campaignId: @@ -19943,8 +19944,8 @@ components: type: array items: required: - - campaignId - - links + - campaignId + - links type: object properties: campaignId: @@ -19956,10 +19957,10 @@ components: type: array items: required: - - count - - eventTime - - ip - - url + - count + - eventTime + - ip + - url type: object properties: count: @@ -19983,9 +19984,9 @@ components: type: array items: required: - - orderDate - - orderId - - orderPrice + - orderDate + - orderId + - orderPrice type: object properties: orderDate: @@ -20007,8 +20008,8 @@ components: type: array items: required: - - campaignId - - eventTime + - campaignId + - eventTime type: object properties: campaignId: @@ -20023,8 +20024,8 @@ components: description: Campaign Statistics for the contact getContacts: required: - - contacts - - count + - contacts + - count type: object properties: contacts: @@ -20032,7 +20033,7 @@ components: items: type: object allOf: - - $ref: '#/components/schemas/getContactDetails' + - $ref: '#/components/schemas/getContactDetails' count: type: integer description: Number of contacts @@ -20040,7 +20041,7 @@ components: example: 17655 getAttributes: required: - - attributes + - attributes type: object properties: attributes: @@ -20048,8 +20049,8 @@ components: description: Listing of available contact attributes in your account items: required: - - category - - name + - category + - name type: object properties: name: @@ -20061,28 +20062,28 @@ components: description: Category of the attribute example: category enum: - - normal - - transactional - - category - - calculated - - global + - normal + - transactional + - category + - calculated + - global type: type: string description: Type of the attribute example: text enum: - - text - - date - - float - - id - - boolean + - text + - date + - float + - id + - boolean enumeration: type: array description: Parameter only available for "category" type attributes. items: required: - - label - - value + - label + - value type: object properties: value: @@ -20106,7 +20107,7 @@ components: items: type: object allOf: - - $ref: '#/components/schemas/getFolder' + - $ref: '#/components/schemas/getFolder' count: type: integer description: Number of folders available in your account @@ -20114,11 +20115,11 @@ components: example: 10 getFolder: required: - - id - - name - - totalBlacklisted - - totalSubscribers - - uniqueSubscribers + - id + - name + - totalBlacklisted + - totalSubscribers + - uniqueSubscribers type: object properties: id: @@ -20153,7 +20154,7 @@ components: items: type: object allOf: - - $ref: '#/components/schemas/getList' + - $ref: '#/components/schemas/getList' count: type: integer description: Number of lists in the folder @@ -20168,16 +20169,16 @@ components: items: type: object allOf: - - $ref: '#/components/schemas/getList' - - required: - - folderId - type: object - properties: - folderId: - type: integer - description: ID of the folder - format: int64 - example: 2 + - $ref: '#/components/schemas/getList' + - required: + - folderId + type: object + properties: + folderId: + type: integer + description: ID of the folder + format: int64 + example: 2 count: type: integer description: Number of lists in your account @@ -20192,10 +20193,10 @@ components: items: type: object required: - - id - - name - - segmentName - - categoryName + - id + - name + - segmentName + - categoryName properties: id: type: integer @@ -20222,11 +20223,11 @@ components: example: 10 getList: required: - - id - - name - - totalBlacklisted - - totalSubscribers - - uniqueSubscribers + - id + - name + - totalBlacklisted + - totalSubscribers + - uniqueSubscribers type: object properties: id: @@ -20255,50 +20256,50 @@ components: example: 1789 getExtendedList: allOf: - - $ref: '#/components/schemas/getList' - - required: - - createdAt - - folderId - type: object - properties: - folderId: - type: integer - description: ID of the folder - format: int64 - example: 2 - createdAt: - type: string - description: Creation UTC date-time of the list (YYYY-MM-DDTHH:mm:ss.SSSZ) - example: 2017-03-13T17:05:09Z - campaignStats: - type: array - items: - required: - - campaignId - - stats - type: object - properties: - campaignId: - type: integer - description: ID of the campaign - format: int64 - example: 143 - stats: - $ref: '#/components/schemas/getCampaignStats' - dynamicList: - type: boolean - description: Status telling if the list is dynamic or not (true=dynamic, - false=not dynamic) - example: false + - $ref: '#/components/schemas/getList' + - required: + - createdAt + - folderId + type: object + properties: + folderId: + type: integer + description: ID of the folder + format: int64 + example: 2 + createdAt: + type: string + description: Creation UTC date-time of the list (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: 2017-03-13T17:05:09Z + campaignStats: + type: array + items: + required: + - campaignId + - stats + type: object + properties: + campaignId: + type: integer + description: ID of the campaign + format: int64 + example: 143 + stats: + $ref: '#/components/schemas/getCampaignStats' + dynamicList: + type: boolean + description: Status telling if the list is dynamic or not (true=dynamic, + false=not dynamic) + example: false getSmsCampaignStats: required: - - answered - - delivered - - hardBounces - - processing - - sent - - softBounces - - unsubscriptions + - answered + - delivered + - hardBounces + - processing + - sent + - softBounces + - unsubscriptions type: object properties: delivered: @@ -20338,10 +20339,10 @@ components: example: 2 getDeviceBrowserStats: required: - - clickers - - uniqueClicks - - uniqueViews - - viewed + - clickers + - uniqueClicks + - uniqueViews + - viewed type: object properties: clickers: @@ -20369,17 +20370,17 @@ components: example: 7779 getCampaignStats: required: - - clickers - - complaints - - delivered - - hardBounces - - sent - - softBounces - - uniqueClicks - - uniqueViews - - unsubscriptions - - viewed - - trackableViews + - clickers + - complaints + - delivered + - hardBounces + - sent + - softBounces + - uniqueClicks + - uniqueViews + - unsubscriptions + - viewed + - trackableViews type: object properties: listId: @@ -20543,21 +20544,21 @@ components: description: | Note:- **replicateTemplate** status will be available **only for template type campaigns.** enum: - - suspended - - archive - - darchive - - sent - - queued - - replicate - - replicateTemplate - - draft + - suspended + - archive + - darchive + - sent + - queued + - replicate + - replicateTemplate + - draft description: Status of the campaign example: draft createSmtpTemplate: required: - - sender - - subject - - templateName + - sender + - subject + - templateName type: object properties: tag: @@ -20631,8 +20632,8 @@ components: example: true createEmailCampaign: required: - - name - - sender + - name + - sender type: object properties: tag: @@ -20700,7 +20701,7 @@ components: example: Discover the New Collection ! previewText: type: string - description : Preview text or preheader of the email campaign + description: Preview text or preheader of the email campaign example: Thanks for your order! replyTo: type: string @@ -20776,7 +20777,7 @@ components: example: NL_05_2017 params: type: object - additionalProperties: {} + additionalProperties: { } description: | Pass the set of attributes to customize the type classic campaign. For example: **{"FNAME":"Joe", "LNAME":"Doe"}**. Only available if **type** is **classic**. It's considered only if campaign is in _New Template Language format_. The New Template Language is dependent on the values of **subject, htmlContent/htmlUrl, sender.name & toField** example: @@ -20821,8 +20822,8 @@ components: Choose the metrics that will determinate the winning version. **Mandatory if _splitRule_ >= 1 and < 50**. If splitRule = 50, `winnerCriteria` is ignored if passed example: open enum: - - open - - click + - open + - click winnerDelay: maximum: 168 minimum: 1 @@ -20940,7 +20941,7 @@ components: example: Discover the New Collection ! previewText: type: string - description : Preview text or preheader of the email campaign + description: Preview text or preheader of the email campaign example: Thanks for your order! replyTo: type: string @@ -21025,7 +21026,7 @@ components: example: NL_05_2017 params: type: object - additionalProperties: {} + additionalProperties: { } description: | Pass the set of attributes to customize the type classic campaign. For example: **{"FNAME":"Joe", "LNAME":"Doe"}**. Only available if **type** is **classic**. It's considered only if campaign is in _New Template Language format_. The New Template Language is dependent on the values of **subject, htmlContent/htmlUrl, sender.name & toField** example: @@ -21071,8 +21072,8 @@ components: Choose the metrics that will determinate the winning version. **Mandatory if _splitRule_ >= 1 and < 50**. If splitRule = 50, `winnerCriteria` is ignored if passed example: open enum: - - open - - click + - open + - click winnerDelay: maximum: 168 minimum: 1 @@ -21132,7 +21133,7 @@ components: - months getSharedTemplateUrl: required: - - sharedUrl + - sharedUrl type: object properties: sharedUrl: @@ -21152,18 +21153,18 @@ components: for sending. example: A enum: - - notAvailable - - pending - - tie - - A - - B + - notAvailable + - pending + - tie + - A + - B winningCriteria: type: string description: Criteria choosen for winning version (Open/Click) example: Open enum: - - Open - - Click + - Open + - Click winningSubjectLine: type: string description: Subject Line of current winning version @@ -21182,12 +21183,12 @@ components: example: 70% statistics: required: - - clicks - - complaints - - hardBounces - - openers - - softBounces - - unsubscribed + - clicks + - complaints + - hardBounces + - openers + - softBounces + - unsubscribed type: object properties: openers: @@ -21204,8 +21205,8 @@ components: $ref: '#/components/schemas/abTestVersionStats' clickedLinks: required: - - Version A - - Version B + - Version A + - Version B type: object properties: Version A: @@ -21214,7 +21215,7 @@ components: $ref: '#/components/schemas/abTestVersionClicks' emailExportRecipients: required: - - recipientsType + - recipientsType type: object properties: notifyURL: @@ -21228,17 +21229,17 @@ components: description: Type of recipients to export for a campaign example: openers enum: - - all - - nonClickers - - nonOpeners - - clickers - - openers - - softBounces - - hardBounces - - unsubscribed + - all + - nonClickers + - nonOpeners + - clickers + - openers + - softBounces + - hardBounces + - unsubscribed requestSmsRecipientExport: required: - - recipientsType + - recipientsType type: object properties: notifyURL: @@ -21253,15 +21254,15 @@ components: campaign example: answered enum: - - all - - delivered - - answered - - softBounces - - hardBounces - - unsubscribed + - all + - delivered + - answered + - softBounces + - hardBounces + - unsubscribed sendReport: required: - - email + - email type: object properties: language: @@ -21270,16 +21271,16 @@ components: example: en default: fr enum: - - fr - - es - - pt - - it - - de - - en + - fr + - es + - pt + - it + - de + - en email: required: - - body - - to + - body + - to type: object properties: to: @@ -21297,7 +21298,7 @@ components: description: Custom attributes for the report email. uploadImageToGallery: required: - - imageUrl + - imageUrl type: object properties: imageUrl: @@ -21344,7 +21345,7 @@ components: **[{"name":"Jimmy", "email":"jimmy98@example.com"}, {"name":"Joe", "email":"joe@example.com"}]** items: required: - - email + - email type: object properties: email: @@ -21363,7 +21364,7 @@ components: List of email addresses and names (_optional_) of the recipients in bcc items: required: - - email + - email type: object properties: email: @@ -21382,7 +21383,7 @@ components: List of email addresses and names (_optional_) of the recipients in cc items: required: - - email + - email type: object properties: email: @@ -21413,7 +21414,7 @@ components: example: Login Email confirmation replyTo: required: - - email + - email type: object properties: email: @@ -21460,7 +21461,7 @@ components: example: myAttachment.png headers: type: object - additionalProperties: {} + additionalProperties: { } description: | Pass the set of custom headers (_not the standard headers_) that shall be sent along the mail headers in the original email. **'sender.ip'** header can be set (**only for dedicated ip users**) to mention the IP to be used for sending transactional emails. Headers are allowed in `This-Case-Only` (i.e. words separated by hyphen with first letter of each word in capital letter), they will be converted to such case styling if not in this format in the request payload. For example, **{"sender.ip":"1.2.3.4", "X-Mailin-custom":"some_custom_header", "idempotencyKey":"abc-123"}**. @@ -21475,7 +21476,7 @@ components: example: 2 params: type: object - additionalProperties: {} + additionalProperties: { } description: | Pass the set of attributes to customize the template. For example, **{"FNAME":"Joe", "LNAME":"Doe"}**. It's **considered only if template is in New Template Language format**. example: @@ -21489,110 +21490,110 @@ components: The size of individual params in all the messageVersions shall not exceed **100 KB** limit and that of cumulative params shall not exceed **1000 KB**. You can follow this **step-by-step guide** on how to use **messageVersions** to batch send emails - **https://developers.brevo.com/docs/batch-send-transactional-emails** items: - type: object - required: + type: object + required: - to - properties: - to: - type: array - description: | - List of email addresses and names (_optional_) of the recipients. For example, - **[{"name":"Jimmy", "email":"jimmy98@example.com"}, {"name":"Joe", "email":"joe@example.com"}]** - items: - required: + properties: + to: + type: array + description: | + List of email addresses and names (_optional_) of the recipients. For example, + **[{"name":"Jimmy", "email":"jimmy98@example.com"}, {"name":"Joe", "email":"joe@example.com"}]** + items: + required: - email - type: object - properties: - email: - type: string - description: Email address of the recipient - format: email - example: jimmy98@example.com - name: - type: string - description: | - Name of the recipient. **Maximum allowed characters are 70**. - example: Jimmy - params: type: object - additionalProperties: {} - description: | - Pass the set of attributes to customize the template. For example, **{"FNAME":"Joe", "LNAME":"Doe"}**. It's **considered only if template is in New Template Language format**. - example: - FNAME: Joe - LNAME: Doe - bcc: - type: array - description: | - List of email addresses and names (_optional_) of the recipients in bcc - items: - required: - - email - type: object - properties: - email: - type: string - description: Email address of the recipient in bcc - format: email - example: helen9766@example.com - name: - type: string - description: | - Name of the recipient in bcc. **Maximum allowed characters are 70**. - example: Helen - cc: - type: array - description: | - List of email addresses and names (_optional_) of the recipients in cc - items: - required: + properties: + email: + type: string + description: Email address of the recipient + format: email + example: jimmy98@example.com + name: + type: string + description: | + Name of the recipient. **Maximum allowed characters are 70**. + example: Jimmy + params: + type: object + additionalProperties: { } + description: | + Pass the set of attributes to customize the template. For example, **{"FNAME":"Joe", "LNAME":"Doe"}**. It's **considered only if template is in New Template Language format**. + example: + FNAME: Joe + LNAME: Doe + bcc: + type: array + description: | + List of email addresses and names (_optional_) of the recipients in bcc + items: + required: - email - type: object - properties: - email: - type: string - description: Email address of the recipient in cc - format: email - example: ann6533@example.com - name: - type: string - description: | - Name of the recipient in cc. **Maximum allowed characters are 70**. - example: Ann - replyTo: + type: object + properties: + email: + type: string + description: Email address of the recipient in bcc + format: email + example: helen9766@example.com + name: + type: string + description: | + Name of the recipient in bcc. **Maximum allowed characters are 70**. + example: Helen + cc: + type: array + description: | + List of email addresses and names (_optional_) of the recipients in cc + items: required: - - email + - email type: object properties: email: type: string - description: Email address in reply to + description: Email address of the recipient in cc format: email example: ann6533@example.com name: type: string description: | - Name in reply to. **Maximum allowed characters are 70**. + Name of the recipient in cc. **Maximum allowed characters are 70**. example: Ann - 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"}** - subject: - type: string - description: | - Custom subject specific to message version - example: Login Email confirmation - htmlContent: - type: string - description: | - HTML body of the message. **Mandatory if 'templateId' is not passed, ignored if 'templateId' is passed** - example:

Confirm you email

Please - confirm your email address by clicking on the link below

- textContent: - type: string - description: | - Plain Text body of the message. **Ignored if 'templateId' is passed** - example: Please confirm your email address by clicking on the link https://text.domain.com + replyTo: + required: + - email + type: object + properties: + email: + type: string + description: Email address in reply to + format: email + example: ann6533@example.com + name: + type: string + description: | + Name in reply to. **Maximum allowed characters are 70**. + example: Ann + 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"}** + subject: + type: string + description: | + Custom subject specific to message version + example: Login Email confirmation + htmlContent: + type: string + description: | + HTML body of the message. **Mandatory if 'templateId' is not passed, ignored if 'templateId' is passed** + example:

Confirm you email

Please + confirm your email address by clicking on the link below

+ textContent: + type: string + description: | + Plain Text body of the message. **Ignored if 'templateId' is passed** + example: Please confirm your email address by clicking on the link https://text.domain.com tags: type: array description: Tag your emails to find them more easily @@ -21639,8 +21640,8 @@ components: example: "example.com" createWebhook: required: - - events - - url + - events + - url type: object properties: url: @@ -21665,32 +21666,32 @@ components: type: string example: unsubscribed enum: - - sent - - hardBounce - - softBounce - - blocked - - spam - - delivered - - request - - click - - invalid - - deferred - - opened - - uniqueOpened - - unsubscribed - - listAddition - - contactUpdated - - contactDeleted - - inboundEmailProcessed + - sent + - hardBounce + - softBounce + - blocked + - spam + - delivered + - request + - click + - invalid + - deferred + - opened + - uniqueOpened + - unsubscribed + - listAddition + - contactUpdated + - contactDeleted + - inboundEmailProcessed type: type: string description: Type of the webhook example: marketing default: transactional enum: - - transactional - - marketing - - inbound + - transactional + - marketing + - inbound domain: type: string description: Inbound domain of webhook, required in case of event type `inbound` @@ -21738,27 +21739,27 @@ components: type: string example: hardBounce enum: - - sent - - hardBounce - - softBounce - - blocked - - spam - - delivered - - request - - click - - invalid - - deferred - - opened - - uniqueOpened - - unsubscribed - - listAddition - - contactUpdated - - contactDeleted - - inboundEmailProcessed + - sent + - hardBounce + - softBounce + - blocked + - spam + - delivered + - request + - click + - invalid + - deferred + - opened + - uniqueOpened + - unsubscribed + - listAddition + - contactUpdated + - contactDeleted + - inboundEmailProcessed domain: - type: string - description: Inbound domain of webhook, used in case of event type `inbound` - example: example.com + type: string + description: Inbound domain of webhook, used in case of event type `inbound` + example: example.com batched: type: boolean description: Batching configuration of the webhook, we send batched webhooks if its true @@ -21779,10 +21780,10 @@ components: value: test-header-value createDoiContact: required: - - email - - includeListIds - - redirectionUrl - - templateId + - email + - includeListIds + - redirectionUrl + - templateId type: object properties: email: @@ -21806,7 +21807,7 @@ components: example: FNAME: Elly LNAME: Roger - COUNTRIES: [India,China] + COUNTRIES: [ India,China ] includeListIds: type: array description: Lists under user account where contact should be added @@ -21863,7 +21864,7 @@ components: example: FNAME: Elly LNAME: Roger - COUNTRIES: [India,China] + COUNTRIES: [ India,China ] emailBlacklisted: type: boolean description: Set this field to blacklist the contact for emails (emailBlacklisted @@ -21915,7 +21916,7 @@ components: EMAIL: newemail@domain.com FNAME: Ellie LNAME: Roger - COUNTRIES: [India,China] + COUNTRIES: [ India,China ] ext_id: description: Pass your own Id to update ext_id of a contact. type: string @@ -21982,7 +21983,7 @@ components: example: 'UpdateExternalId' attributes: type: object - additionalProperties: {} + additionalProperties: { } description: | Pass the set of attributes to be updated. **These attributes must be present in your account**. To update existing email address of a contact with the new one please pass EMAIL in attribtes. For example, **{ "EMAIL":"newemail@domain.com", "FNAME":"Ellie", "LNAME":"Roger"}**. Keep in mind transactional attributes can be updated the same way as normal attributes. Mobile Number in **SMS** field should be passed with proper country code. For example: **{"SMS":"+91xxxxxxxxxx"} or {"SMS":"0091xxxxxxxxxx"}** @@ -22043,8 +22044,8 @@ components: **[{"value":1, "label":"male"}, {"value":2, "label":"female"}]** items: required: - - label - - value + - label + - value type: object properties: value: @@ -22056,12 +22057,12 @@ components: description: Label of the value example: Women multiCategoryOptions: - type: array - description: | - List of options you want to add for multiple-choice attribute. **Use only if the attribute's category is "normal" and attribute's type is "multiple-choice".** For example: - **["USA","INDIA"]** - items: - type: string + type: array + description: | + List of options you want to add for multiple-choice attribute. **Use only if the attribute's category is "normal" and attribute's type is "multiple-choice".** For example: + **["USA","INDIA"]** + items: + type: string type: type: string description: | @@ -22071,13 +22072,13 @@ components: Type **category** is only available if the category is **category** attribute example: text enum: - - text - - date - - float - - boolean - - id - - category - - multiple-choice + - text + - date + - float + - boolean + - id + - category + - multiple-choice updateAttribute: type: object properties: @@ -22093,8 +22094,8 @@ components: **[{"value":1, "label":"male"}, {"value":2, "label":"female"}]** items: required: - - label - - value + - label + - value type: object properties: value: @@ -22114,8 +22115,8 @@ components: type: string createList: required: - - folderId - - name + - folderId + - name type: object properties: name: @@ -22144,7 +22145,7 @@ components: requestContactExport: type: object required: - - customContactFilter + - customContactFilter properties: exportAttributes: type: array @@ -22165,10 +22166,10 @@ components: * **subscribed & unsubscribed** - Fetch the list of subscribed / unsubscribed (blacklisted via any means) contacts for a particular list. * **unsubscribedPerList** - Fetch the list of contacts that are unsubscribed from a particular list only. enum: - - allContacts - - subscribed - - unsubscribed - - unsubscribedPerList + - allContacts + - subscribed + - unsubscribed + - unsubscribedPerList actionForEmailCampaigns: type: string description: | @@ -22178,13 +22179,13 @@ components: * **unsubscribed** - emailCampaignId is mandatory. Fetch the list of all unsubscribed (blacklisted via any means) contacts for a particular email campaign. * **hardBounces & softBounces** - emailCampaignId is optional. Fetch the list of hard bounces / soft bounces for a particular / all email campaign(s). enum: - - openers - - nonOpeners - - clickers - - nonClickers - - unsubscribed - - hardBounces - - softBounces + - openers + - nonOpeners + - clickers + - nonClickers + - unsubscribed + - hardBounces + - softBounces actionForSmsCampaigns: type: string description: | @@ -22192,9 +22193,9 @@ components: * **unsubscribed** - Fetch the list of all unsubscribed (blacklisted via any means) contacts for all / particular sms campaigns. * **hardBounces & softBounces** - Fetch the list of hard bounces / soft bounces for all / particular sms campaigns. enum: - - hardBounces - - softBounces - - unsubscribed + - hardBounces + - softBounces + - unsubscribed listId: type: integer description: | @@ -22244,13 +22245,13 @@ components: items: type: object properties: - email: - type: string - attributes: - type: object - additionalProperties: true - description: List of attributes to be imported - example: {"email":"ndicky0@ocn.ne.jp","attributes":{"LNAME":"Noemi","FNAME":"Dicky","COUNTRY": "DE","BIRTHDAY": "11/02/1989","PREFERED_COLOR": "BLACK","WHATSAPP": "33689965433","LANDLINE_NUMBER": "33689965433", "SMS": "33689965433"}} + email: + type: string + attributes: + type: object + additionalProperties: true + description: List of attributes to be imported + example: { "email": "ndicky0@ocn.ne.jp","attributes": { "LNAME": "Noemi","FNAME": "Dicky","COUNTRY": "DE","BIRTHDAY": "11/02/1989","PREFERED_COLOR": "BLACK","WHATSAPP": "33689965433","LANDLINE_NUMBER": "33689965433", "SMS": "33689965433" } } listIds: type: array description: | @@ -22310,9 +22311,9 @@ components: default: false createSmsCampaign: required: - - content - - name - - sender + - content + - name + - sender type: object properties: name: @@ -22332,7 +22333,7 @@ components: example: 'Get a discount by visiting our NY store and saying : Happy Spring!' recipients: required: - - listIds + - listIds type: object properties: listIds: @@ -22364,13 +22365,13 @@ components: example: true default: false organisationPrefix: - description : A recognizable prefix will ensure your audience knows who you are. Recommended by U.S. carriers. This will be added as your Brand Name before the message content. **Prefer verifying maximum length of 160 characters including this prefix in message content to avoid multiple sending of same sms.** + description: A recognizable prefix will ensure your audience knows who you are. Recommended by U.S. carriers. This will be added as your Brand Name before the message content. **Prefer verifying maximum length of 160 characters including this prefix in message content to avoid multiple sending of same sms.** type: string example: MyCompany unsubscribeInstruction: - description : Instructions to unsubscribe from future communications. Recommended by U.S. carriers. Must include **STOP** keyword. This will be added as instructions after the end of message content. **Prefer verifying maximum length of 160 characters including this instructions in message content to avoid multiple sending of same sms.** - type : string - example : send Stop if you want to unsubscribe. + description: Instructions to unsubscribe from future communications. Recommended by U.S. carriers. Must include **STOP** keyword. This will be added as instructions after the end of message content. **Prefer verifying maximum length of 160 characters including this instructions in message content to avoid multiple sending of same sms.** + type: string + example: send Stop if you want to unsubscribe. updateSmsCampaign: type: object properties: @@ -22391,7 +22392,7 @@ components: example: 'Get a discount by visiting our NY store and saying : Happy Spring!' recipients: required: - - listIds + - listIds type: object properties: listIds: @@ -22423,18 +22424,18 @@ components: example: true default: false organisationPrefix: - description : A recognizable prefix will ensure your audience knows who you are. Recommended by U.S. carriers. This will be added as your Brand Name before the message content. **Prefer verifying maximum length of 160 characters including this prefix in message content to avoid multiple sending of same sms.** + description: A recognizable prefix will ensure your audience knows who you are. Recommended by U.S. carriers. This will be added as your Brand Name before the message content. **Prefer verifying maximum length of 160 characters including this prefix in message content to avoid multiple sending of same sms.** type: string example: MyCompany unsubscribeInstruction: - description : Instructions to unsubscribe from future communications. Recommended by U.S. carriers. Must include **STOP** keyword. This will be added as instructions after the end of message content. **Prefer verifying maximum length of 160 characters including this instructions in message content to avoid multiple sending of same sms.** - type : string - example : send Stop if you want to unsubscribe. + description: Instructions to unsubscribe from future communications. Recommended by U.S. carriers. Must include **STOP** keyword. This will be added as instructions after the end of message content. **Prefer verifying maximum length of 160 characters including this instructions in message content to avoid multiple sending of same sms.** + type: string + example: send Stop if you want to unsubscribe. sendTransacSms: required: - - content - - recipient - - sender + - content + - recipient + - sender type: object properties: sender: @@ -22461,8 +22462,8 @@ components: example: marketing default: transactional enum: - - transactional - - marketing + - transactional + - marketing tag: type: string description: Tag of the message @@ -22626,10 +22627,10 @@ components: example: 1 getIp: required: - - active - - domain - - id - - ip + - active + - domain + - id + - ip type: object properties: id: @@ -22651,7 +22652,7 @@ components: example: mailing.myshop.com getIpsFromSender: required: - - ips + - ips type: object properties: ips: @@ -22661,7 +22662,7 @@ components: $ref: '#/components/schemas/getIpFromSender' getIps: required: - - ips + - ips type: object properties: ips: @@ -22671,10 +22672,10 @@ components: $ref: '#/components/schemas/getIp' getIpFromSender: required: - - domain - - id - - ip - - weight + - domain + - id + - ip + - weight type: object properties: id: @@ -22697,12 +22698,12 @@ components: example: 75 getTransacEmailContent: required: - - attachmentCount - - body - - date - - email - - events - - subject + - attachmentCount + - body + - date + - email + - events + - subject type: object properties: email: @@ -22728,8 +22729,8 @@ components: description: Series of events which occurred on the transactional email items: required: - - name - - time + - name + - time type: object properties: name: @@ -22762,11 +22763,11 @@ components: type: array items: required: - - date - - email - - messageId - - subject - - uuid + - date + - email + - messageId + - subject + - uuid type: object properties: email: @@ -22821,8 +22822,8 @@ components: example: "contact.com" abTestVersionStats: required: - - Version A - - Version B + - Version A + - Version B type: object properties: Version A: @@ -22839,9 +22840,9 @@ components: description: Information on clicked links for a particular version items: required: - - clickRate - - clicksCount - - link + - clickRate + - clicksCount + - link type: object properties: link: @@ -22976,10 +22977,10 @@ components: description: 'Current status of the scheduled batch' type: string enum: - - inProgress - - queued - - processed - - error + - inProgress + - queued + - processed + - error getScheduledEmailByMessageId: type: object required: @@ -22999,10 +23000,10 @@ components: description: 'Current status of the scheduled email' type: string enum: - - inProgress - - queued - - processed - - error + - inProgress + - queued + - processed + - error subAccountsResponse: type: object properties: @@ -23081,10 +23082,10 @@ components: email: test-sub@example.com timezone: Europe/Paris language: en - groupIds: ["5f8f8c3b5f56a02d4433b3a7", "5f8f8c3b5f56a02d4433b3a8"] + groupIds: [ "5f8f8c3b5f56a02d4433b3a7", "5f8f8c3b5f56a02d4433b3a8" ] createSubAccountResponse: required: - - id + - id type: object properties: id: @@ -23190,7 +23191,7 @@ components: description: Postal code stateCode: type: string - description: State code + description: State code countryCode: type: string description: Country code @@ -23483,11 +23484,11 @@ components: type: boolean description: Set this field to enable or disable Sales CRM on the sub-account example: - landing-pages: true - sms-campaigns: false - whatsapp: true - meetings: true - web-push: false + landing-pages: true + sms-campaigns: false + whatsapp: true + meetings: true + web-push: false TaskTypes: type: object @@ -23503,9 +23504,9 @@ components: example: "Email" Task: required: - - taskTypeId - - name - - date + - taskTypeId + - name + - date type: object description: Task Details properties: @@ -23526,24 +23527,24 @@ components: type: integer type: array description: Contact ids for contacts linked to this task - example: [ 1, 2, 3] + example: [ 1, 2, 3 ] dealsIds: items: type: string type: array description: Deal ids for deals a task is linked to - example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992" ] companiesIds: items: type: string type: array description: Companies ids for companies a task is linked to - example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992" ] TaskReminder: required: - - value - - unit - - types + - value + - unit + - types type: object description: Task reminder date/time for a task properties: @@ -23569,7 +23570,7 @@ components: type: array example: [ "email" - ] + ] FileList: type: array description: List of files @@ -23620,7 +23621,7 @@ components: description: File created date/time NoteData: required: - - text + - text type: object description: Note data to be saved properties: @@ -23637,7 +23638,7 @@ components: type: array example: [ 247, 1, 2 - ] + ] dealIds: items: type: string @@ -23645,7 +23646,7 @@ components: type: array example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" - ] + ] companyIds: items: type: string @@ -23653,10 +23654,10 @@ components: type: array example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" - ] + ] Note: required: - - text + - text type: object description: Note Details properties: @@ -23677,7 +23678,7 @@ components: type: array example: [ 247, 1, 2 - ] + ] dealIds: items: type: string @@ -23685,7 +23686,7 @@ components: type: array example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" - ] + ] authorId: type: object description: Account details of user which created the note @@ -23695,9 +23696,9 @@ components: locale: "en_GB", timezone: "Asia/Kolkata", name: { - fullName: "John Doe" - } + fullName: "John Doe" } + } createdAt: type: string format: date-time @@ -23736,61 +23737,61 @@ components: items: $ref: '#/components/schemas/Pipeline' PipelineStage: - type: object - description: List of stages - properties: - id: - type: string - description: Stage id - example: "9e577ff7-8e42-4ab3-be26-2b5e01b42518" - name: - type: string - description: Stage name - example: "New" + type: object + description: List of stages + properties: + id: + type: string + description: Stage id + example: "9e577ff7-8e42-4ab3-be26-2b5e01b42518" + name: + type: string + description: Stage name + example: "New" Pipeline: + type: object + description: List of stages + properties: + pipeline_name: + type: string + description: Pipeline name + example: Sales Pipeline + pipeline: + type: string + description: Pipeline id + example: "5ea675e3da0dd085acaea610" + stages: + type: array + description: List of stages + items: + $ref: '#/components/schemas/PipelineStage' + DealAttributes: + type: array + description: List of deal attributes + items: type: object - description: List of stages + description: List of attributes properties: - pipeline_name: + internalName: type: string - description: Pipeline name - example: Sales Pipeline - pipeline: + example: "deal_name" + label: type: string - description: Pipeline id - example: "5ea675e3da0dd085acaea610" - stages: + example: "Deal Name" + attributeTypeName: + type: string + example: "text" + attributeOptions: type: array - description: List of stages items: - $ref: '#/components/schemas/PipelineStage' - DealAttributes: - type: array - description: List of deal attributes - items: - type: object - description: List of attributes - properties: - internalName: - type: string - example : "deal_name" - label: - type: string - example : "Deal Name" - attributeTypeName: - type: string - example : "text" - attributeOptions: - type: array - items: - type: object - example : { - key: "custom key", - value: "custom label" - } - isRequired: - type: boolean - example : true + type: object + example: { + key: "custom key", + value: "custom label" + } + isRequired: + type: boolean + example: true DealsList: type: object description: List of Deals @@ -23811,7 +23812,7 @@ components: attributes: type: object description: Deal attributes with values - example : { + example: { deal_name: "testname", deal_owner: "6093d2425a9b436e9519d034", amount: 12, @@ -23830,13 +23831,13 @@ components: type: integer type: array description: Contact ids for contacts linked to this deal - example: [ 1, 2, 3] + example: [ 1, 2, 3 ] linkedCompaniesIds: items: type: string type: array description: Companies ids for companies linked to this deal - example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992" ] CompaniesList: type: object description: List of companies @@ -23857,16 +23858,16 @@ components: attributes: type: object description: Company attributes with values - example : { - "created_at": "2022-01-13T19:04:24.376+05:30", - "domain": "xyz", - "last_updated_at": "2022-04-01T18:47:48.283+05:30", - "name": "text", - "number_of_contacts": 0, - "owner": "62260474111b1101704a9d85", - "owner_assign_date": "2022-04-01T18:21:13.379+05:30", - "phone_number": 8171844192, - "revenue": 10 + example: { + "created_at": "2022-01-13T19:04:24.376+05:30", + "domain": "xyz", + "last_updated_at": "2022-04-01T18:47:48.283+05:30", + "name": "text", + "number_of_contacts": 0, + "owner": "62260474111b1101704a9d85", + "owner_assign_date": "2022-04-01T18:21:13.379+05:30", + "phone_number": 8171844192, + "revenue": 10 } linkedContactsIds: items: @@ -23874,41 +23875,41 @@ components: type: array format: in64 description: Contact ids for contacts linked to this company - example: [ 1, 2, 3] + example: [ 1, 2, 3 ] linkedDealsIds: items: type: string type: array format: objectID description: Deals ids for companies linked to this company - example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992"] + example: [ "61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991" , "61a5ce58c5d4795761045992" ] CompanyAttributes: - type: array - description: List of company attributes - items: - type: object - description: List of attributes - properties: - internalName: - type: string - example : "name" - label: - type: string - example : "Company Name" - attributeTypeName: - type: string - example : "text" - attributeOptions: - type: array - items: - type: object - example : { - key: "custom key", - value: "custom label" - } - isRequired: - type: boolean - example : true + type: array + description: List of company attributes + items: + type: object + description: List of attributes + properties: + internalName: + type: string + example: "name" + label: + type: string + example: "Company Name" + attributeTypeName: + type: string + example: "text" + attributeOptions: + type: array + items: + type: object + example: { + key: "custom key", + value: "custom label" + } + isRequired: + type: boolean + example: true ConversationsMessage: type: object description: a Conversations message @@ -23919,7 +23920,7 @@ components: example: eYBEm3gq3zc5ayE2g type: type: string - enum: ["agent", "visitor"] + enum: [ "agent", "visitor" ] description: '`"agent"` for agents’ messages, `"visitor"` for visitors’ messages.' example: agent text: @@ -23999,8 +24000,8 @@ components: event: type: object required: - - event_name - - identifiers + - event_name + - identifiers properties: event_name: description: 'The name of the event that occurred. This is how you will find your event in Brevo. Limited to 255 characters, alphanumerical characters and - _ only.' @@ -24077,7 +24078,7 @@ components: conversionSource: type: string enum: - - email_campaign + - email_campaign ordersCount: type: number format: integer @@ -24122,12 +24123,12 @@ components: order: type: object required: - - id - - createdAt - - updatedAt - - status - - amount - - products + - id + - createdAt + - updatedAt + - status + - amount + - products properties: id: description: 'Unique ID of the order.' @@ -24178,9 +24179,9 @@ components: items: type: object required: - - productId - - quantity - - price + - productId + - quantity + - price description: 'Details for the Products in an order.' properties: productId: @@ -24241,11 +24242,11 @@ components: example: - "EASTER15OFF" items: - type: string + type: string orderBatch: type: object required: - - orders + - orders properties: orders: description: "array of order objects" @@ -24277,8 +24278,8 @@ components: example: 17655 getCategories: required: - - categories - - count + - categories + - count type: object properties: categories: @@ -24286,7 +24287,7 @@ components: items: type: object allOf: - - $ref: '#/components/schemas/getCategoryDetails' + - $ref: '#/components/schemas/getCategoryDetails' count: type: integer description: Number of categories @@ -24294,10 +24295,10 @@ components: example: 17655 getCategoryDetails: required: - - id - - name - - createdAt - - modifiedAt + - id + - name + - createdAt + - modifiedAt type: object properties: id: @@ -24331,7 +24332,7 @@ components: createUpdateCategory: type: object required: - - id + - id properties: id: type: string @@ -24365,7 +24366,7 @@ components: createUpdateCategories: type: object required: - - id + - id properties: id: type: string @@ -24393,7 +24394,7 @@ components: createUpdateBatchCategory: type: object required: - - categories + - categories properties: categories: description: "array of categories objects" @@ -24427,8 +24428,8 @@ components: example: 5 getProducts: required: - - products - - count + - products + - count type: object properties: products: @@ -24436,7 +24437,7 @@ components: items: type: object allOf: - - $ref: '#/components/schemas/getProductDetails' + - $ref: '#/components/schemas/getProductDetails' count: type: integer description: Number of products @@ -24444,12 +24445,12 @@ components: example: 17655 getProductDetails: required: - - id - - name - - createdAt - - modifiedAt - - s3ThumbAnalytics - - s3ThumbEditor + - id + - name + - createdAt + - modifiedAt + - s3ThumbAnalytics + - s3ThumbEditor type: object properties: id: @@ -24513,7 +24514,7 @@ components: type: object description: Meta data of product such as description, vendor, producer, stock level, etc. example: { - "description" : "Shoes for sports", + "description": "Shoes for sports", "brand": "addidas" } isDeleted: @@ -24523,8 +24524,8 @@ components: createUpdateProduct: type: object required: - - id - - name + - id + - name properties: id: type: string @@ -24571,7 +24572,7 @@ components: - type: integer description: Meta data of product such as description, vendor, producer, stock level. The size of cumulative metaInfo shall not exceed **1000 KB**. Maximum length of metaInfo object can be 10. example: { - "description" : "Shoes for sports", + "description": "Shoes for sports", "brand": "addidas" } updateEnabled: @@ -24591,7 +24592,7 @@ components: createUpdateBatchProducts: type: object required: - - products + - products properties: products: description: "array of products objects" @@ -24605,8 +24606,8 @@ components: createUpdateProducts: type: object required: - - id - - name + - id + - name properties: id: type: string @@ -24653,7 +24654,7 @@ components: - type: integer description: Meta data of product such as description, vendor, producer, stock level. The size of cumulative metaInfo shall not exceed **1000 KB**. Maximum length of metaInfo object can be 10. example: { - "description" : "Shoes for sports", + "description": "Shoes for sports", "brand": "addidas" } deletedAt: @@ -24686,12 +24687,12 @@ components: example: 5 getCouponCollection: required: - - id - - name - - defaultCoupon - - createdAt - - totalCoupons - - remainingCoupons + - id + - name + - defaultCoupon + - createdAt + - totalCoupons + - remainingCoupons type: object properties: id: @@ -24738,9 +24739,9 @@ components: example: 5 sendWhatsappMessageTemplate: required: - - senderNumber - - templateId - - contactNumbers + - senderNumber + - templateId + - contactNumbers type: object properties: templateId: @@ -24760,7 +24761,7 @@ components: params: type: object description: Pass the set of attributes to customize the template. For example, {"FNAME":"Joe", "LNAME":"Doe"}. - example: {"FNAME":"Joe", "LNAME":"Doe"} + example: { "FNAME": "Joe", "LNAME": "Doe" } contactNumbers: type: array description: List of phone numbers of the contacts @@ -24771,10 +24772,10 @@ components: example: 919876543210 sendWhatsappMessageText: required: - - senderNumber - - contactNumbers - - authType - - text + - senderNumber + - contactNumbers + - authType + - text type: object properties: senderNumber: @@ -24801,11 +24802,11 @@ components: type: array items: required: - - contactNumber - - date - - messageId - - event - - senderNumber + - contactNumber + - date + - messageId + - event + - senderNumber type: object properties: contactNumber: @@ -24826,13 +24827,13 @@ components: description: Event which occurred example: delivered enum: - - sent - - delivered - - read - - error - - unsubscribe - - reply - - soft-bounce + - sent + - delivered + - read + - error + - unsubscribe + - reply + - soft-bounce reason: type: string description: Reason for the event (will be there in case of `error` and `soft-bounce` events) @@ -24880,7 +24881,7 @@ components: example: http://requestb.in/173lyyx1 authType: type: string - enum: [basic, token, noAuth] + enum: [ basic, token, noAuth ] description: > Auth type of the feed: * `basic` @@ -24970,7 +24971,7 @@ components: example: http://requestb.in/173lyyx1 authType: type: string - enum: [basic, token, noAuth] + enum: [ basic, token, noAuth ] description: > Auth type of the feed: * `basic` @@ -25025,8 +25026,8 @@ components: example: '2022-10-06T05:03:47.053000000Z' createExternalFeed: required: - - name - - url + - name + - url type: object properties: name: @@ -25040,7 +25041,7 @@ components: example: http://requestb.in/173lyyx1 authType: type: string - enum: [basic, token, noAuth] + enum: [ basic, token, noAuth ] default: noAuth description: > Auth type of the feed: @@ -25104,7 +25105,7 @@ components: example: http://requestb.in/173lyyx1 authType: type: string - enum: [basic, token, noAuth] + enum: [ basic, token, noAuth ] description: > Auth type of the feed: * `basic` @@ -25155,9 +25156,9 @@ components: default: false exportWebhooksHistory: required: - - event - - notifyURL - - type + - event + - notifyURL + - type type: object properties: days: @@ -25181,30 +25182,30 @@ components: description: Filter the history based on webhook type example: transactional enum: - - transactional - - marketing + - transactional + - marketing event: type: string description: Filter the history for a specific event type example: request enum: - - invalid_parameter - - missing_parameter - - hardBounce - - softBounce - - delivered - - spam - - request - - opened - - click - - invalid - - deferred - - blocked - - unsubscribed - - error - - uniqueOpened - - loadedByProxy - - allEvents + - invalid_parameter + - missing_parameter + - hardBounce + - softBounce + - delivered + - spam + - request + - opened + - click + - invalid + - deferred + - blocked + - unsubscribed + - error + - uniqueOpened + - loadedByProxy + - allEvents notifyURL: type: string description: Webhook URL to receive CSV file link @@ -25277,15 +25278,15 @@ components: currency: type: string description: | - Currency code for the payment amount. + Currency code for the payment amount. example: EUR enum: - EUR specificAmount: type: integer description: | - Payment amount, in cents. - e.g. if you want to request €12.00, then the amount in cents is 1200. + Payment amount, in cents. + e.g. if you want to request €12.00, then the amount in cents is 1200. format: int64 example: 1200 @@ -25300,14 +25301,14 @@ components: channel: type: string description: | - Channel used to send the notifications. + Channel used to send the notifications. example: email enum: - email text: type: string description: | - Use this field if you want to give more context to your contact about the payment request. + Use this field if you want to give more context to your contact about the payment request. example: Please pay for your yoga class. getPaymentRequest: @@ -25359,7 +25360,7 @@ components: content: application/json: schema: - $ref: '#/components/schemas/createModel' + $ref: '#/components/schemas/createModel' createdProcessId: description: process id created content: @@ -25379,5 +25380,11 @@ components: for authentication. name: api-key in: header + partner-key: + type: apiKey + description: The API key should be passed in the request headers as `partner-key` + for authentication. + name: partner-key + in: header x-samples-languages: -- curl + - curl From d9ffeba95e9ce147864468464e104b4b8f3a459f Mon Sep 17 00:00:00 2001 From: Damien TUPINIER Date: Sun, 24 Nov 2024 19:44:52 +0100 Subject: [PATCH 5/8] Update inputSpec path in openapi generator config Changed the inputSpec path from a URL to a local file reference in config-openapi-generator.yml. --- config-openapi-generator.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config-openapi-generator.yml b/config-openapi-generator.yml index 8fc98ef..e6896c7 100644 --- a/config-openapi-generator.yml +++ b/config-openapi-generator.yml @@ -1,7 +1,7 @@ # config-openapi-generator.yml generatorName: php-nextgen outputDir: . -inputSpec: https://api.brevo.com/v3/swagger_definition_v3.yml +inputSpec: swagger_definition_v3.yml gitHost: github.com gitUserId: getbrevo gitRepoId: brevo-php From c795929468ec9892a5c6c90764c5ffd68a8523f0 Mon Sep 17 00:00:00 2001 From: Damien TUPINIER Date: Mon, 25 Nov 2024 08:50:04 +0100 Subject: [PATCH 6/8] Update schema types and refactor 'Segment' component Changed schema types from 'string' to 'integer' for pagination parameters to ensure correct data handling. Refactored the 'Segment' component for cleaner structure and proper reference within 'getSegments'. These adjustments improve overall data consistency and maintainability. --- swagger_definition_v3.yml | 56 +++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/swagger_definition_v3.yml b/swagger_definition_v3.yml index ed31103..358e2ed 100644 --- a/swagger_definition_v3.yml +++ b/swagger_definition_v3.yml @@ -7337,7 +7337,7 @@ paths: description: Number of documents per page required: false schema: - type: string + type: integer format: integer default: 100 minimum: 1 @@ -7347,7 +7347,7 @@ paths: description: Index of the first document in the page required: false schema: - type: string + type: integer format: integer default: 0 - name: balanceDefinitionId @@ -20184,6 +20184,32 @@ components: description: Number of lists in your account format: int64 example: 150 + Segment: + type: object + required: + - id + - name + - segmentName + - categoryName + properties: + id: + type: integer + description: ID of the list + format: int64 + example: 23 + segmentName: + type: string + description: Name of the Segment + example: My Segment + categoryName: + type: string + description: Name of the Segment Category + format: string + example: New Category + updatedAt: + type: string + description: Updation UTC date-time of the segment (YYYY-MM-DDTHH:mm:ss.SSSZ) + example: '2017-03-13T17:05:09Z' getSegments: type: object properties: @@ -20192,30 +20218,8 @@ components: description: Listing of all the segments available in your account items: type: object - required: - - id - - name - - segmentName - - categoryName - properties: - id: - type: integer - description: ID of the list - format: int64 - example: 23 - segmentName: - type: string - description: Name of the Segment - example: My Segment - categoryName: - type: string - description: Name of the Segment Category - format: string - example: New Category - updatedAt: - type: string - description: Updation UTC date-time of the segment (YYYY-MM-DDTHH:mm:ss.SSSZ) - example: '2017-03-13T17:05:09Z' + allOf: + - $ref: '#/components/schemas/Segment' count: type: integer description: Number of Segments in your account From d1b5cf2d0eaa4dbd2c78a4b5f4184c68073ce52b Mon Sep 17 00:00:00 2001 From: Damien TUPINIER Date: Mon, 25 Nov 2024 08:50:27 +0100 Subject: [PATCH 7/8] Add ApiException doc comment for a method in api.mustache --- template/php-nextgen/api.mustache | 1 + 1 file changed, 1 insertion(+) diff --git a/template/php-nextgen/api.mustache b/template/php-nextgen/api.mustache index 006cbbc..091197a 100644 --- a/template/php-nextgen/api.mustache +++ b/template/php-nextgen/api.mustache @@ -515,6 +515,7 @@ use {{invokerPackage}}\ObjectSerializer; {{/servers}} * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation * + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException * @return PromiseInterface {{#isDeprecated}} From d5c26e8a01506fa9015327e851304c48725324ee Mon Sep 17 00:00:00 2001 From: Damien TUPINIER Date: Mon, 25 Nov 2024 08:58:12 +0100 Subject: [PATCH 8/8] Generating with Open API Generator for the new Brevo OpenAPI 3.0 file and PHP 8.1 version --- .openapi-generator/FILES | 960 ++ .openapi-generator/VERSION | 1 + .php-cs-fixer.dist.php | 29 + .phplint.yml | 11 + .travis.yml | 13 +- README.md | 1063 ++- composer.json | 44 +- composer.lock | 4924 ++++++++-- docs/Api/AccountApi.md | 72 +- docs/Api/AttributesApi.md | 243 - docs/Api/BalanceApi.md | 1089 +++ docs/Api/CRMApi.md | 678 -- docs/Api/CompaniesApi.md | 332 +- docs/Api/ContactsApi.md | 1086 ++- docs/Api/ConversationsApi.md | 307 +- docs/Api/CouponsApi.md | 183 +- docs/Api/DealsApi.md | 408 +- docs/Api/DomainsApi.md | 160 +- docs/Api/EcommerceApi.md | 805 +- docs/Api/EmailCampaignsApi.md | 481 +- docs/Api/{EventsApi.md => EventApi.md} | 43 +- docs/Api/ExternalFeedsApi.md | 189 +- docs/Api/FilesApi.md | 193 +- docs/Api/FoldersApi.md | 366 - docs/Api/InboundParsingApi.md | 119 +- docs/Api/ListsApi.md | 552 -- docs/Api/MasterAccountApi.md | 1301 ++- docs/Api/NotesApi.md | 189 +- docs/Api/PaymentsApi.md | 204 + docs/Api/ProcessApi.md | 75 +- docs/Api/ProgramApi.md | 915 ++ docs/Api/ResellerApi.md | 952 -- docs/Api/RewardsApi.md | 362 + docs/Api/SMSCampaignsApi.md | 353 +- docs/Api/SendersApi.md | 234 +- docs/Api/TasksApi.md | 238 +- docs/Api/TierApi.md | 715 ++ docs/Api/TransactionalEmailsApi.md | 878 +- docs/Api/TransactionalSMSApi.md | 191 +- docs/Api/TransactionalWhatsAppApi.md | 97 +- docs/Api/UserApi.md | 204 +- docs/Api/WebhooksApi.md | 205 +- docs/Api/WhatsAppCampaignsApi.md | 320 +- docs/Model/AbTestCampaignResult.md | 23 +- .../Model/AbTestCampaignResultClickedLinks.md | 11 +- docs/Model/AbTestCampaignResultStatistics.md | 21 +- docs/Model/AbTestVersionClicks.md | 9 - docs/Model/AbTestVersionClicksInner.md | 13 +- docs/Model/AbTestVersionStats.md | 11 +- docs/Model/AddChildDomain.md | 10 - docs/Model/AddContactToList.md | 11 - docs/Model/AddContactToListByEmails.md | 9 + docs/Model/AddContactToListByExtIDs.md | 9 + docs/Model/AddContactToListByIDs.md | 9 + docs/Model/AddContactToListRequest.md | 11 + docs/Model/AddCredits.md | 11 - docs/Model/AttributeRewardPayload.md | 11 + ...butedRewardFailedConditionErrorResponse.md | 9 + docs/Model/AuthenticateDomainModel.md | 11 +- docs/Model/BadRequestPayload.md | 9 + docs/Model/Balance.md | 11 + docs/Model/BalanceBalancesInner.md | 10 + docs/Model/BalanceDefinition.md | 26 + docs/Model/BalanceDefinitionIdDoesNotExist.md | 9 + docs/Model/BalanceDefinitionPage.md | 9 + docs/Model/BalanceLimit.md | 13 + docs/Model/BalanceLimitPayload.md | 14 + docs/Model/BalancePage.md | 9 + docs/Model/BlockDomain.md | 9 +- docs/Model/Body10.md | 15 - docs/Model/Body11.md | 10 - docs/Model/Body12.md | 13 - docs/Model/Body13.md | 10 - docs/Model/Body14.md | 13 - docs/Model/Body2.md | 12 - docs/Model/Body3.md | 12 - docs/Model/Body4.md | 13 - docs/Model/Body5.md | 11 - docs/Model/Body6.md | 11 - docs/Model/Body8.md | 20 - docs/Model/Body9.md | 19 - docs/Model/BodyVariablesItems.md | 9 - docs/Model/CancelledTransaction.md | 19 + docs/Model/Cart.md | 10 + docs/Model/CompaniesIdPatchRequest.md | 11 + docs/Model/CompaniesImportPost200Response.md | 9 + docs/Model/CompaniesImportPost400Response.md | 9 + .../CompaniesLinkUnlinkIdPatchRequest.md | 12 + docs/Model/CompaniesList.md | 9 +- docs/Model/CompaniesPost200Response.md | 9 + docs/Model/CompaniesPostRequest.md | 13 + docs/Model/Company.md | 15 +- docs/Model/CompanyAttributes.md | 9 - docs/Model/CompanyAttributesInner.md | 17 +- docs/Model/CompleteTransactionPayload.md | 9 + docs/Model/CompletedTransaction.md | 19 + docs/Model/ComponentItems.md | 11 +- docs/Model/Configuration.md | 9 + docs/Model/Contact.md | 17 - docs/Model/ContactBalances.md | 12 + docs/Model/ContactBalancesBalancesInner.md | 12 + docs/Model/ContactErrorModel.md | 11 + docs/Model/ContactIdInvalidResponse.md | 9 + ...ConversationsAgentOnlinePingPostRequest.md | 12 + ...ionsmessage.md => ConversationsMessage.md} | 27 +- docs/Model/ConversationsMessageFile.md | 17 +- .../ConversationsMessagesIdPutRequest.md | 9 + .../Model/ConversationsMessagesPostRequest.md | 14 + .../ConversationsPushedMessagesPostRequest.md | 12 + .../ConversationsmessageFileImageInfo.md | 13 +- docs/Model/ConversionSourceMetrics.md | 13 + docs/Model/ConversionSourceProduct.md | 16 + docs/Model/CorporateGroupDetailsResponse.md | 11 + .../CorporateGroupDetailsResponseGroup.md | 11 + ...ateGroupDetailsResponseSubAccountsInner.md | 11 + ...CorporateGroupDetailsResponseUsersInner.md | 11 + ...{Body.md => CorporateGroupIdPutRequest.md} | 11 +- docs/Model/CorporateGroupPost201Response.md | 9 + ...{Body1.md => CorporateGroupPostRequest.md} | 11 +- ...GroupUnlinkGroupIdSubAccountsPutRequest.md | 9 + docs/Model/CorporateIpGet200ResponseInner.md | 11 + docs/Model/CorporateSsoTokenPostRequest.md | 9 + ...rporateSubAccountIpAssociatePostRequest.md | 10 + ...rporateSubAccountIpDissociatePutRequest.md | 10 + .../CorporateSubAccountKeyPostRequest.md | 10 + .../CorporateSubAccountSsoTokenPostRequest.md | 12 + ...CorporateUserEmailPermissionsPutRequest.md | 10 + ...ailPermissionsPutRequestPrivilegesInner.md | 10 + ...UserInvitationActionEmailPut200Response.md | 9 + docs/Model/CreateApiKeyRequest.md | 11 - docs/Model/CreateApiKeyResponse.md | 11 +- docs/Model/CreateAttribute.md | 16 +- docs/Model/CreateAttributeEnumeration.md | 11 - docs/Model/CreateAttributeEnumerationInner.md | 10 + docs/Model/CreateBalanceDefinitionPayload.md | 23 + docs/Model/CreateCategoryModel.md | 9 +- docs/Model/CreateChild.md | 15 - docs/Model/CreateContact.md | 21 +- docs/Model/CreateCouponCollection.md | 11 - .../CreateCouponCollection201Response.md | 9 + docs/Model/CreateCouponCollectionRequest.md | 13 + docs/Model/CreateCoupons.md | 11 - docs/Model/CreateCouponsRequest.md | 10 + docs/Model/CreateDoiContact.md | 21 +- docs/Model/CreateDoiContactAttributesValue.md | 8 + docs/Model/CreateDomain.md | 9 +- docs/Model/CreateDomainModel.md | 16 +- docs/Model/CreateDomainModelDnsRecords.md | 12 +- .../CreateDomainModelDnsRecordsDkimRecord.md | 15 +- docs/Model/CreateEmailCampaign.md | 68 +- .../CreateEmailCampaignEmailExpirationDate.md | 10 + docs/Model/CreateEmailCampaignRecipients.md | 13 +- docs/Model/CreateEmailCampaignSender.md | 13 +- docs/Model/CreateExternalFeed.md | 23 +- docs/Model/CreateExternalFeed201Response.md | 9 + docs/Model/CreateList.md | 11 +- docs/Model/CreateLoyaltyProgramPayload.md | 11 + docs/Model/CreateModel.md | 9 +- docs/Model/CreateOrderPayload.md | 14 + docs/Model/CreatePaymentRequest.md | 14 + docs/Model/CreatePaymentResponse.md | 10 + docs/Model/CreateProductModel.md | 9 +- docs/Model/CreateReseller.md | 11 - docs/Model/CreateSender.md | 13 +- docs/Model/CreateSenderIps.md | 12 - docs/Model/CreateSenderIpsInner.md | 11 + docs/Model/CreateSenderModel.md | 13 +- docs/Model/CreateSmsCampaign.md | 21 +- docs/Model/CreateSmsCampaignRecipients.md | 11 +- docs/Model/CreateSmtpEmail.md | 11 +- docs/Model/CreateSmtpTemplate.md | 27 +- docs/Model/CreateSmtpTemplateSender.md | 13 +- docs/Model/CreateSubAccount.md | 16 +- docs/Model/CreateSubAccountResponse.md | 9 +- docs/Model/CreateSubscriptionMemberPayload.md | 11 + .../Model/CreateSubscriptionMemberResponse.md | 13 + docs/Model/CreateSubscriptionPayload.md | 10 + docs/Model/CreateSubscriptionResponse.md | 15 + docs/Model/CreateTierGroupRequest.md | 11 + docs/Model/CreateTransactionPayload.md | 13 + docs/Model/CreateUpdateBatchCategory.md | 11 +- docs/Model/CreateUpdateBatchCategoryModel.md | 11 +- docs/Model/CreateUpdateBatchProducts.md | 11 +- docs/Model/CreateUpdateBatchProductsModel.md | 11 +- docs/Model/CreateUpdateCategories.md | 16 +- docs/Model/CreateUpdateCategory.md | 16 +- docs/Model/CreateUpdateContactModel.md | 9 +- docs/Model/CreateUpdateFolder.md | 9 +- docs/Model/CreateUpdateProducts.md | 28 +- docs/Model/CreateUpdateproduct.md | 28 +- docs/Model/CreateWebhook.md | 21 +- docs/Model/CreateWhatsAppCampaign.md | 15 +- .../Model/CreateWhatsAppCampaignRecipients.md | 13 +- docs/Model/CreateWhatsAppTemplate.md | 23 +- docs/Model/CreatedBatchId.md | 10 +- docs/Model/CreatedProcessId.md | 9 +- docs/Model/CrmDealsIdPatchRequest.md | 10 + ...md => CrmDealsLinkUnlinkIdPatchRequest.md} | 15 +- docs/Model/CrmDealsPost201Response.md | 9 + docs/Model/CrmDealsPostRequest.md | 12 + docs/Model/CrmTasksIdPatchRequest.md | 19 + docs/Model/CrmTasksPost201Response.md | 9 + docs/Model/CrmTasksPostRequest.md | 19 + docs/Model/Deal.md | 15 +- docs/Model/DealAttributes.md | 9 - docs/Model/DealAttributesInner.md | 17 +- docs/Model/DealsList.md | 9 +- docs/Model/DeleteHardbounces.md | 13 +- docs/Model/DeleteSubscriptionMemberPayload.md | 10 + ...nSourceConversionSourceIdGet200Response.md | 14 + ...ommerceAttributionMetricsGet200Response.md | 10 + ...eAttributionMetricsGet200ResponseTotals.md | 11 + ...nSourceConversionSourceIdGet200Response.md | 9 + ...erceConfigDisplayCurrencyGet200Response.md | 9 + docs/Model/EmailExportRecipients.md | 11 +- docs/Model/ErrorModel.md | 11 +- docs/Model/ErrorResponse.md | 9 + docs/Model/Event.md | 17 +- docs/Model/EventContactPropertiesValue.md | 8 + docs/Model/EventEventPropertiesValue.md | 8 + docs/Model/EventIdentifiers.md | 17 +- docs/Model/ExportWebhooksHistory.md | 27 +- docs/Model/ExportWebhooksHistoryRequest.md | 18 + docs/Model/FileData.md | 26 +- docs/Model/FileDownloadableLink.md | 9 +- docs/Model/FileList.md | 9 - docs/Model/GetAccount.md | 18 +- docs/Model/GetAccountActivity.md | 9 +- docs/Model/GetAccountActivityLogs.md | 14 - docs/Model/GetAccountActivityLogsInner.md | 13 + ... => GetAccountAllOfMarketingAutomation.md} | 11 +- docs/Model/GetAccountAllOfPlan.md | 13 + docs/Model/GetAccountAllOfRelay.md | 10 + docs/Model/GetAccountAllOfRelayData.md | 11 + docs/Model/GetAccountPlan.md | 15 - docs/Model/GetAccountRelay.md | 11 - docs/Model/GetAccountRelayData.md | 12 - docs/Model/GetAggregatedReport.md | 33 +- docs/Model/GetAllExternalFeeds.md | 11 +- docs/Model/GetAllExternalFeedsFeeds.md | 21 - docs/Model/GetAllExternalFeedsFeedsInner.md | 20 + docs/Model/GetAttributes.md | 9 +- docs/Model/GetAttributesAttributes.md | 14 - docs/Model/GetAttributesAttributesInner.md | 13 + ...tributesAttributesInnerEnumerationInner.md | 10 + docs/Model/GetAttributesEnumeration.md | 11 - docs/Model/GetBlockedDomains.md | 9 +- docs/Model/GetCampaignOverview.md | 35 +- docs/Model/GetCampaignRecipients.md | 11 +- docs/Model/GetCampaignStats.md | 39 +- docs/Model/GetCategories.md | 11 +- docs/Model/GetCategoryDetails.md | 21 +- docs/Model/GetChildAccountCreationStatus.md | 10 - docs/Model/GetChildDomain.md | 11 - docs/Model/GetChildDomains.md | 9 - docs/Model/GetChildInfo.md | 14 - docs/Model/GetChildInfoApiKeys.md | 11 - docs/Model/GetChildInfoApiKeysV2.md | 11 - docs/Model/GetChildInfoApiKeysV3.md | 11 - docs/Model/GetChildInfoCredits.md | 11 - docs/Model/GetChildInfoStatistics.md | 12 - docs/Model/GetChildrenList.md | 11 - docs/Model/GetClient.md | 15 +- docs/Model/GetContactCampaignStats.md | 25 +- docs/Model/GetContactCampaignStatsClicked.md | 11 - .../GetContactCampaignStatsClickedInner.md | 10 + docs/Model/GetContactCampaignStatsOpened.md | 13 - .../GetContactCampaignStatsOpenedInner.md | 12 + ...etContactCampaignStatsTransacAttributes.md | 12 - ...tactCampaignStatsTransacAttributesInner.md | 11 + .../GetContactCampaignStatsUnsubscriptions.md | 11 +- docs/Model/GetContactDetails.md | 25 +- .../GetContactInfoIdentifierParameter.md | 8 + docs/Model/GetContacts.md | 11 +- docs/Model/GetCorporateInvitedUsersList.md | 9 +- ...tCorporateInvitedUsersListFeatureAccess.md | 13 - .../GetCorporateInvitedUsersListGroups.md | 11 - .../GetCorporateInvitedUsersListUsers.md | 14 - .../GetCorporateInvitedUsersListUsersInner.md | 13 + ...InvitedUsersListUsersInnerFeatureAccess.md | 17 + ...rporateInvitedUsersListUsersInnerGroups.md | 10 + docs/Model/GetCorporateUserPermission.md | 12 + ...GetCorporateUserPermissionFeatureAccess.md | 17 + .../GetCorporateUserPermissionGroupsInner.md | 10 + docs/Model/GetCouponCollection.md | 22 +- docs/Model/GetDeviceBrowserStats.md | 15 +- docs/Model/GetDomainConfigurationModel.md | 15 +- docs/Model/GetDomainsList.md | 9 +- docs/Model/GetDomainsListDomains.md | 14 - docs/Model/GetDomainsListDomainsInner.md | 13 + docs/Model/GetEmailCampaign.md | 74 +- docs/Model/GetEmailCampaigns.md | 11 +- docs/Model/GetEmailCampaignsCampaignsInner.md | 44 + docs/Model/GetEmailEventReport.md | 9 +- ...s.md => GetEmailEventReportEventsInner.md} | 29 +- docs/Model/GetExtendedCampaignOverview.md | 69 +- .../GetExtendedCampaignOverviewAllOfSender.md | 11 + .../GetExtendedCampaignOverviewSender.md | 12 - docs/Model/GetExtendedCampaignStats.md | 23 +- .../GetExtendedCampaignStatsGlobalStats.md | 9 - docs/Model/GetExtendedClient.md | 13 +- docs/Model/GetExtendedClientAddress.md | 13 - docs/Model/GetExtendedClientAllOfAddress.md | 12 + docs/Model/GetExtendedContactDetails.md | 25 +- ...etExtendedContactDetailsAllOfStatistics.md | 17 + ...dedContactDetailsAllOfStatisticsClicked.md | 10 + ...endedContactDetailsAllOfStatisticsLinks.md | 12 + ...ntactDetailsAllOfStatisticsMessagesSent.md | 10 + ...ndedContactDetailsAllOfStatisticsOpened.md | 12 + ...ctDetailsAllOfStatisticsUnsubscriptions.md | 10 + ...sticsUnsubscriptionsAdminUnsubscription.md | 10 + ...isticsUnsubscriptionsUserUnsubscription.md | 11 + .../GetExtendedContactDetailsStatistics.md | 18 - ...ExtendedContactDetailsStatisticsClicked.md | 11 - ...tendedContactDetailsStatisticsDelivered.md | 11 - ...etExtendedContactDetailsStatisticsLinks.md | 13 - ...dedContactDetailsStatisticsMessagesSent.md | 11 - ...tExtendedContactDetailsStatisticsOpened.md | 13 - ...ContactDetailsStatisticsUnsubscriptions.md | 11 - ...sticsUnsubscriptionsAdminUnsubscription.md | 11 - ...isticsUnsubscriptionsUserUnsubscription.md | 12 - docs/Model/GetExtendedList.md | 20 +- .../GetExtendedListAllOfCampaignStats.md | 10 + docs/Model/GetExtendedListCampaignStats.md | 11 - docs/Model/GetExternalFeedByUUID.md | 31 +- docs/Model/GetExternalFeedByUUIDHeaders.md | 11 - .../GetExternalFeedByUUIDHeadersInner.md | 10 + docs/Model/GetFolder.md | 17 +- docs/Model/GetFolderLists.md | 11 +- docs/Model/GetFolders.md | 11 +- docs/Model/GetInboundEmailEvents.md | 9 +- docs/Model/GetInboundEmailEventsByUuid.md | 23 +- ...boundEmailEventsByUuidAttachmentsInner.md} | 15 +- docs/Model/GetInboundEmailEventsByUuidLogs.md | 11 - .../GetInboundEmailEventsByUuidLogsInner.md | 10 + docs/Model/GetInboundEmailEventsEvents.md | 13 - .../Model/GetInboundEmailEventsEventsInner.md | 12 + docs/Model/GetInvitedUsersList.md | 9 +- .../Model/GetInvitedUsersListFeatureAccess.md | 12 - docs/Model/GetInvitedUsersListUsers.md | 13 - docs/Model/GetInvitedUsersListUsersInner.md | 12 + ...InvitedUsersListUsersInnerFeatureAccess.md | 11 + docs/Model/GetIp.md | 15 +- docs/Model/GetIpFromSender.md | 15 +- docs/Model/GetIps.md | 9 +- docs/Model/GetIpsFromSender.md | 9 +- docs/Model/GetList.md | 17 +- docs/Model/GetLists.md | 11 +- docs/Model/GetListsListsInner.md | 14 + docs/Model/GetOrders.md | 11 - docs/Model/GetPaymentRequest.md | 15 + docs/Model/GetProcess.md | 15 +- docs/Model/GetProcesses.md | 11 +- docs/Model/GetProductDetails.md | 37 +- docs/Model/GetProducts.md | 11 +- docs/Model/GetReports.md | 9 +- docs/Model/GetReportsReports.md | 22 - docs/Model/GetReportsReportsInner.md | 21 + docs/Model/GetScheduledEmailByBatchId.md | 10 +- .../GetScheduledEmailByBatchIdBatches.md | 11 - .../GetScheduledEmailByBatchIdBatchesInner.md | 11 + .../Model/GetScheduledEmailById200Response.md | 13 + docs/Model/GetScheduledEmailByMessageId.md | 12 +- docs/Model/GetSegments.md | 11 +- docs/Model/GetSegmentsSegments.md | 13 - docs/Model/GetSendersList.md | 9 +- docs/Model/GetSendersListIps.md | 12 - docs/Model/GetSendersListSenders.md | 14 - docs/Model/GetSendersListSendersInner.md | 13 + .../GetSendersListSendersInnerIpsInner.md | 11 + docs/Model/GetSharedTemplateUrl.md | 9 +- docs/Model/GetSmsCampaign.md | 25 +- docs/Model/GetSmsCampaignOverview.md | 23 +- docs/Model/GetSmsCampaignRecipients.md | 9 - docs/Model/GetSmsCampaignStats.md | 23 +- docs/Model/GetSmsCampaigns.md | 11 +- docs/Model/GetSmsCampaignsCampaignsInner.md | 18 + docs/Model/GetSmsEventReport.md | 9 +- ...nts.md => GetSmsEventReportEventsInner.md} | 23 +- docs/Model/GetSmtpTemplateOverview.md | 33 +- docs/Model/GetSmtpTemplateOverviewSender.md | 13 +- docs/Model/GetSmtpTemplates.md | 11 +- docs/Model/GetSsoToken.md | 9 +- docs/Model/GetStatsByBrowser.md | 9 - docs/Model/GetStatsByDevice.md | 15 +- docs/Model/GetStatsByDomain.md | 9 - .../GetSubAccountGroups200ResponseInner.md | 10 + docs/Model/GetSubscriptionInfoResponse.md | 12 + .../GetSubscriptionInfoResponseBalance.md | 11 + ...riptionInfoResponseBalanceBalancesInner.md | 10 + ...GetSubscriptionInfoResponseMembersInner.md | 11 + .../GetSubscriptionInfoResponseRewardInner.md | 14 + .../GetSubscriptionInfoResponseTierInner.md | 14 + docs/Model/GetSubscriptionMemberResponse.md | 15 + ...ptionMemberResponseMemberContactIdInner.md | 11 + docs/Model/GetTransacAggregatedSmsReport.md | 28 +- docs/Model/GetTransacBlockedContacts.md | 11 +- .../GetTransacBlockedContactsContacts.md | 13 - .../GetTransacBlockedContactsContactsInner.md | 12 + ...ansacBlockedContactsContactsInnerReason.md | 10 + docs/Model/GetTransacBlockedContactsReason.md | 11 - docs/Model/GetTransacEmailContent.md | 23 +- docs/Model/GetTransacEmailContentEvents.md | 11 - .../GetTransacEmailContentEventsInner.md | 10 + docs/Model/GetTransacEmailsList.md | 11 +- ...GetTransacEmailsListTransactionalEmails.md | 17 - ...ansacEmailsListTransactionalEmailsInner.md | 16 + docs/Model/GetTransacSmsReport.md | 9 +- ....md => GetTransacSmsReportReportsInner.md} | 28 +- docs/Model/GetUserPermission.md | 13 +- docs/Model/GetUserPermissionPrivileges.md | 11 - .../Model/GetUserPermissionPrivilegesInner.md | 10 + docs/Model/GetVersionInfoResponse.md | 11 + docs/Model/GetWATemplates.md | 11 - docs/Model/GetWATemplatesTemplates.md | 17 - docs/Model/GetWebhook.md | 27 +- docs/Model/GetWebhookAuth.md | 11 - docs/Model/GetWebhookHeaders.md | 11 - docs/Model/GetWebhooks.md | 9 +- docs/Model/GetWhatsAppConfig.md | 21 +- docs/Model/GetWhatsappCampaignOverview.md | 25 +- docs/Model/GetWhatsappCampaigns.md | 11 +- docs/Model/GetWhatsappCampaignsCampaigns.md | 20 - .../GetWhatsappCampaignsCampaignsInner.md | 19 + docs/Model/GetWhatsappEventReport.md | 9 +- ...d => GetWhatsappEventReportEventsInner.md} | 23 +- docs/Model/GetWhatsappTemplates.md | 10 + .../GetWhatsappTemplatesTemplatesInner.md | 16 + docs/Model/InlineResponse200.md | 11 - docs/Model/InlineResponse2001.md | 10 - docs/Model/InlineResponse2002.md | 12 - docs/Model/InlineResponse201.md | 10 - docs/Model/InlineResponse2011.md | 10 - docs/Model/InlineResponse2012.md | 10 - docs/Model/InlineResponse2013.md | 10 - docs/Model/InlineResponse2014.md | 10 - docs/Model/InlineResponse2015.md | 10 - docs/Model/InviteAdminUser.md | 15 +- docs/Model/InviteAdminUserPrivileges.md | 11 - docs/Model/InviteAdminUserPrivilegesInner.md | 10 + docs/Model/Inviteuser.md | 13 +- docs/Model/InviteuserPrivileges.md | 11 - docs/Model/InviteuserPrivilegesInner.md | 10 + docs/Model/InviteuserResponse.md | 10 + docs/Model/LoyaltyProgram.md | 15 + docs/Model/LoyaltyProgramPage.md | 9 + docs/Model/LoyaltyProgramValidationError.md | 11 + docs/Model/LoyaltyTierPage.md | 9 + docs/Model/ManageIp.md | 10 - docs/Model/MasterDetailsResponse.md | 23 +- .../Model/MasterDetailsResponseBillingInfo.md | 15 +- ...MasterDetailsResponseBillingInfoAddress.md | 17 +- .../MasterDetailsResponseBillingInfoName.md | 11 +- docs/Model/MasterDetailsResponsePlanInfo.md | 21 +- ...erDetailsResponsePlanInfoFeaturesInner.md} | 23 +- docs/Model/Note.md | 23 +- docs/Model/NoteData.md | 15 +- docs/Model/NoteId.md | 9 +- docs/Model/NoteList.md | 9 - docs/Model/Notification.md | 10 + docs/Model/Offer.md | 15 + docs/Model/OfferList.md | 9 + docs/Model/OffersListResponse.md | 10 + docs/Model/Order.md | 26 +- docs/Model/OrderBatch.md | 11 +- docs/Model/OrderBilling.md | 22 +- docs/Model/OrderIdentifiers.md | 12 + docs/Model/OrderProducts.md | 13 - docs/Model/OrderProductsInner.md | 12 + docs/Model/Otp.md | 9 +- docs/Model/PatchLoyaltyProgramPayload.md | 11 + docs/Model/Pipeline.md | 13 +- docs/Model/PipelineStage.md | 11 +- docs/Model/Pipelines.md | 9 - docs/Model/PostContactInfo.md | 9 +- docs/Model/PostContactInfoContacts.md | 15 +- docs/Model/PostContactInfoContactsFailure.md | 8 + docs/Model/PostContactInfoContactsSuccess.md | 8 + docs/Model/PostSendFailed.md | 17 +- docs/Model/PostSendSmsTestFailed.md | 15 +- docs/Model/PutRevokeUserPermission.md | 9 +- docs/Model/PutRevokeUserPermissionResponse.md | 10 + docs/Model/Putresendcancelinvitation.md | 9 +- .../PutresendcancelinvitationResponse.md | 10 + docs/Model/RedeemRewardPayload.md | 13 + ...eemedRewardFailedConditionErrorResponse.md | 9 + docs/Model/RemainingCreditModel.md | 11 - docs/Model/RemainingCreditModelChild.md | 11 - docs/Model/RemainingCreditModelReseller.md | 11 - docs/Model/RemoveContactFromList.md | 12 - docs/Model/RemoveContactFromListByAll.md | 9 + docs/Model/RemoveContactFromListByEmails.md | 9 + docs/Model/RemoveContactFromListByExtIDs.md | 9 + docs/Model/RemoveContactFromListByIDs.md | 9 + docs/Model/RemoveContactFromListRequest.md | 12 + docs/Model/RemoveCredits.md | 11 - docs/Model/RequestContactExport.md | 13 +- ...RequestContactExportCustomContactFilter.md | 21 +- docs/Model/RequestContactImport.md | 21 +- docs/Model/RequestContactImportJsonBody.md | 11 - .../RequestContactImportJsonBodyInner.md | 10 + docs/Model/RequestContactImportNewList.md | 11 +- docs/Model/RequestSmsRecipientExport.md | 11 +- docs/Model/RewardAttributionResponse.md | 17 + docs/Model/RewardRedeemResponse.md | 17 + docs/Model/ScheduleSmtpEmail.md | 13 +- docs/Model/Segment.md | 12 + docs/Model/SendReport.md | 9 +- docs/Model/SendReportEmail.md | 11 +- docs/Model/SendSms.md | 17 +- docs/Model/SendSmtpEmail.md | 39 +- docs/Model/SendSmtpEmailAttachment.md | 12 - docs/Model/SendSmtpEmailAttachmentInner.md | 11 + docs/Model/SendSmtpEmailBcc.md | 11 - docs/Model/SendSmtpEmailBccInner.md | 10 + docs/Model/SendSmtpEmailCc.md | 11 - docs/Model/SendSmtpEmailCcInner.md | 10 + docs/Model/SendSmtpEmailMessageVersions.md | 15 - .../SendSmtpEmailMessageVersionsInner.md | 16 + docs/Model/SendSmtpEmailReplyTo.md | 11 +- docs/Model/SendSmtpEmailReplyTo1.md | 11 - docs/Model/SendSmtpEmailSender.md | 13 +- docs/Model/SendSmtpEmailTo.md | 11 - docs/Model/SendSmtpEmailTo1.md | 11 - docs/Model/SendSmtpEmailToInner.md | 10 + docs/Model/SendTestEmail.md | 9 +- docs/Model/SendTestSms.md | 9 +- docs/Model/SendTransacSms.md | 19 +- docs/Model/SendWhatsappMessage201Response.md | 9 + ...ssage.md => SendWhatsappMessageRequest.md} | 17 +- docs/Model/SendWhatsappMessageTemplate.md | 12 + docs/Model/SendWhatsappMessageText.md | 11 + docs/Model/SsoTokenRequest.md | 13 - docs/Model/SubAccountAppsToggleRequest.md | 33 +- docs/Model/SubAccountDetailsResponse.md | 16 +- .../SubAccountDetailsResponseGroupsInner.md | 10 + .../SubAccountDetailsResponsePlanInfo.md | 13 +- ...ubAccountDetailsResponsePlanInfoCredits.md | 14 +- ...untDetailsResponsePlanInfoCreditsEmails.md | 11 +- ...ilsResponsePlanInfoCreditsExternalFeeds.md | 10 + ...ccountDetailsResponsePlanInfoCreditsSms.md | 10 + ...tDetailsResponsePlanInfoCreditsWhatsapp.md | 10 + ...ilsResponsePlanInfoCreditsWpSubscribers.md | 10 + ...bAccountDetailsResponsePlanInfoFeatures.md | 13 +- ...untDetailsResponsePlanInfoFeaturesInbox.md | 11 +- ...ailsResponsePlanInfoFeaturesLandingPage.md | 11 +- ...untDetailsResponsePlanInfoFeaturesUsers.md | 11 +- docs/Model/SubAccountUpdatePlanRequest.md | 11 +- .../SubAccountUpdatePlanRequestCredits.md | 13 +- .../SubAccountUpdatePlanRequestFeatures.md | 13 +- docs/Model/SubAccountsResponse.md | 11 +- docs/Model/SubAccountsResponseSubAccounts.md | 13 - .../SubAccountsResponseSubAccountsInner.md | 13 + ...untsResponseSubAccountsInnerGroupsInner.md | 10 + .../SubscriptionNotFoundErrorResponse.md | 9 + docs/Model/Task.md | 21 +- docs/Model/TaskList.md | 9 +- docs/Model/TaskReminder.md | 13 +- docs/Model/TaskTypes.md | 11 +- docs/Model/Tier.md | 17 + docs/Model/TierAccessConditionsInner.md | 12 + docs/Model/TierForContact.md | 14 + docs/Model/TierGroup.md | 16 + docs/Model/TierGroupPage.md | 9 + docs/Model/TierRequest.md | 11 + .../Model/TierRequestAccessConditionsInner.md | 10 + docs/Model/TierRequestTierRewardsInner.md | 9 + docs/Model/TierTierRewardsInner.md | 11 + docs/Model/Transaction.md | 19 + docs/Model/UnauthorizedResponse.md | 9 + docs/Model/UpdateAttribute.md | 12 +- docs/Model/UpdateAttributeEnumeration.md | 11 - docs/Model/UpdateAttributeEnumerationInner.md | 10 + docs/Model/UpdateBalanceDefinitionPayload.md | 23 + docs/Model/UpdateBatchContacts.md | 9 +- ...md => UpdateBatchContactsContactsInner.md} | 27 +- docs/Model/UpdateBatchContactsModel.md | 11 +- docs/Model/UpdateCampaignStatus.md | 9 +- docs/Model/UpdateChild.md | 14 - docs/Model/UpdateChildAccountStatus.md | 13 - docs/Model/UpdateChildDomain.md | 10 - docs/Model/UpdateContact.md | 23 +- docs/Model/UpdateCouponCollection.md | 10 - .../UpdateCouponCollection200Response.md | 11 + docs/Model/UpdateCouponCollectionRequest.md | 12 + docs/Model/UpdateEmailCampaign.md | 70 +- .../UpdateEmailCampaignEmailExpirationDate.md | 10 + docs/Model/UpdateEmailCampaignRecipients.md | 13 +- docs/Model/UpdateEmailCampaignSender.md | 13 +- docs/Model/UpdateExternalFeed.md | 23 +- docs/Model/UpdateList.md | 11 +- docs/Model/UpdateLoyaltyProgramPayload.md | 11 + docs/Model/UpdateSender.md | 13 +- docs/Model/UpdateSmsCampaign.md | 21 +- docs/Model/UpdateSmtpTemplate.md | 27 +- docs/Model/UpdateSmtpTemplateSender.md | 13 +- docs/Model/UpdateTierGroup404Response.md | 9 + docs/Model/UpdateTierGroupRequest.md | 12 + docs/Model/UpdateUserResponse.md | 11 + docs/Model/UpdateWebhook.md | 23 +- docs/Model/UpdateWhatsAppCampaign.md | 13 +- docs/Model/UploadImageModel.md | 9 +- docs/Model/UploadImageToGallery.md | 11 +- docs/Model/ValidateRewardPayload.md | 12 + docs/Model/ValidatedRewardResponse.md | 9 + docs/Model/ValidationError.md | 9 + docs/Model/VariablesItems.md | 13 +- docs/Model/VersionInfo.md | 16 + docs/Model/WhatsappCampStats.md | 17 +- docs/Model/WhatsappCampTemplate.md | 29 +- git_push.sh | 57 + lib/Api/AccountApi.php | 619 +- lib/Api/AttributesApi.php | 1219 --- lib/Api/BalanceApi.php | 6579 ++++++++++++++ lib/Api/CRMApi.php | 3306 ------- lib/Api/CompaniesApi.php | 2291 +++-- lib/Api/ContactsApi.php | 7919 +++++++++++------ lib/Api/ConversationsApi.php | 2195 +++-- lib/Api/CouponsApi.php | 1509 +++- lib/Api/DealsApi.php | 2795 ++++-- lib/Api/DomainsApi.php | 1243 ++- lib/Api/EcommerceApi.php | 5844 +++++++++--- lib/Api/EmailCampaignsApi.php | 3286 ++++--- lib/Api/{EventsApi.php => EventApi.php} | 251 +- lib/Api/ExternalFeedsApi.php | 1384 ++- lib/Api/FilesApi.php | 1491 +++- lib/Api/FoldersApi.php | 1852 ---- lib/Api/InboundParsingApi.php | 972 +- lib/Api/ListsApi.php | 2793 ------ lib/Api/MasterAccountApi.php | 7682 ++++++++++++---- lib/Api/NotesApi.php | 1395 ++- lib/Api/PaymentsApi.php | 1329 +++ lib/Api/ProcessApi.php | 662 +- lib/Api/ProgramApi.php | 5684 ++++++++++++ lib/Api/ResellerApi.php | 4765 ---------- lib/Api/RewardsApi.php | 2699 ++++++ lib/Api/SMSCampaignsApi.php | 2330 +++-- lib/Api/SendersApi.php | 1595 ++-- lib/Api/TasksApi.php | 1699 ++-- lib/Api/TierApi.php | 4549 ++++++++++ lib/Api/TransactionalEmailsApi.php | 6052 ++++++++----- lib/Api/TransactionalSMSApi.php | 1538 +++- lib/Api/TransactionalWhatsAppApi.php | 786 +- lib/Api/UserApi.php | 1547 ++-- lib/Api/WebhooksApi.php | 1476 +-- lib/Api/WhatsAppCampaignsApi.php | 2369 +++-- lib/ApiException.php | 66 +- lib/Configuration.php | 229 +- lib/HeaderSelector.php | 230 +- lib/Models/AbTestCampaignResult.php | 352 +- .../AbTestCampaignResultClickedLinks.php | 238 +- lib/Models/AbTestCampaignResultStatistics.php | 266 +- lib/Models/AbTestVersionClicks.php | 281 - lib/Models/AbTestVersionClicksInner.php | 236 +- lib/Models/AbTestVersionStats.php | 226 +- lib/Models/AbstractModel.php | 255 + lib/Models/AddChildDomain.php | 305 - lib/Models/AddContactToList.php | 335 - lib/Models/AddContactToListByEmails.php | 222 + lib/Models/AddContactToListByExtIDs.php | 222 + lib/Models/AddContactToListByIDs.php | 222 + lib/Models/AddContactToListRequest.php | 320 + lib/Models/AddCredits.php | 335 - lib/Models/AttributeRewardPayload.php | 278 + ...utedRewardFailedConditionErrorResponse.php | 207 + lib/Models/AuthenticateDomainModel.php | 226 +- lib/Models/BadRequestPayload.php | 207 + lib/Models/Balance.php | 275 + lib/Models/BalanceBalancesInner.php | 241 + lib/Models/BalanceDefinition.php | 821 ++ .../BalanceDefinitionIdDoesNotExist.php | 207 + lib/Models/BalanceDefinitionPage.php | 207 + lib/Models/BalanceLimit.php | 450 + lib/Models/BalanceLimitPayload.php | 484 + lib/Models/BalancePage.php | 207 + lib/Models/BlockDomain.php | 216 +- lib/Models/Body.php | 338 - lib/Models/Body1.php | 338 - lib/Models/Body10.php | 461 - lib/Models/Body11.php | 308 - lib/Models/Body12.php | 401 - lib/Models/Body13.php | 308 - lib/Models/Body14.php | 395 - lib/Models/Body2.php | 368 - lib/Models/Body3.php | 365 - lib/Models/Body4.php | 395 - lib/Models/Body5.php | 338 - lib/Models/Body6.php | 335 - lib/Models/Body7.php | 395 - lib/Models/Body9.php | 575 -- lib/Models/BodyVariablesItems.php | 280 - lib/Models/CancelledTransaction.php | 587 ++ lib/Models/Cart.php | 280 + lib/Models/CompaniesIdPatchRequest.php | 275 + lib/Models/CompaniesImportPost200Response.php | 207 + lib/Models/CompaniesImportPost400Response.php | 207 + .../CompaniesLinkUnlinkIdPatchRequest.php | 309 + lib/Models/CompaniesList.php | 220 +- lib/Models/CompaniesPost200Response.php | 211 + lib/Models/CompaniesPostRequest.php | 346 + lib/Models/Company.php | 262 +- lib/Models/CompanyAttributes.php | 281 - lib/Models/CompanyAttributesInner.php | 276 +- lib/Models/CompleteTransactionPayload.php | 207 + lib/Models/CompletedTransaction.php | 587 ++ lib/Models/ComponentItems.php | 234 +- lib/Models/Configuration.php | 211 + lib/Models/Contact.php | 518 -- lib/Models/ContactBalances.php | 321 + lib/Models/ContactBalancesBalancesInner.php | 321 + lib/Models/ContactErrorModel.php | 325 + lib/Models/ContactIdInvalidResponse.php | 207 + ...onversationsAgentOnlinePingPostRequest.php | 337 + lib/Models/ConversationsMessage.php | 364 +- lib/Models/ConversationsMessageFile.php | 280 +- .../ConversationsMessageFileImageInfo.php | 256 +- .../ConversationsMessagesIdPutRequest.php | 210 + .../ConversationsMessagesPostRequest.php | 425 + ...ConversationsPushedMessagesPostRequest.php | 343 + lib/Models/ConversionSourceMetrics.php | 390 + lib/Models/ConversionSourceProduct.php | 448 + lib/Models/CorporateGroupDetailsResponse.php | 275 + .../CorporateGroupDetailsResponseGroup.php | 275 + ...teGroupDetailsResponseSubAccountsInner.php | 275 + ...orporateGroupDetailsResponseUsersInner.php | 275 + lib/Models/CorporateGroupIdPutRequest.php | 241 + lib/Models/CorporateGroupPost201Response.php | 207 + lib/Models/CorporateGroupPostRequest.php | 244 + ...roupUnlinkGroupIdSubAccountsPutRequest.php | 210 + lib/Models/CorporateIpGet200ResponseInner.php | 275 + lib/Models/CorporateSsoTokenPostRequest.php | 210 + ...porateSubAccountIpAssociatePostRequest.php | 247 + ...porateSubAccountIpDissociatePutRequest.php | 247 + .../CorporateSubAccountKeyPostRequest.php | 247 + ...CorporateSubAccountSsoTokenPostRequest.php | 358 + ...orporateUserEmailPermissionsPutRequest.php | 247 + ...ilPermissionsPutRequestPrivilegesInner.php | 326 + ...serInvitationActionEmailPut200Response.php | 207 + lib/Models/CreateApiKeyRequest.php | 338 - lib/Models/CreateApiKeyResponse.php | 234 +- lib/Models/CreateAttribute.php | 306 +- lib/Models/CreateAttributeEnumeration.php | 341 - .../CreateAttributeEnumerationInner.php | 247 + lib/Models/CreateBalanceDefinitionPayload.php | 933 ++ lib/Models/CreateCategoryModel.php | 220 +- lib/Models/CreateChild.php | 510 -- lib/Models/CreateContact.php | 320 +- lib/Models/CreateCouponCollection.php | 341 - .../CreateCouponCollection201Response.php | 210 + lib/Models/CreateCouponCollectionRequest.php | 349 + lib/Models/CreateCoupons.php | 341 - lib/Models/CreateCouponsRequest.php | 262 + lib/Models/CreateDoiContact.php | 330 +- .../CreateDoiContactAttributesValue.php | 179 + lib/Models/CreateDomain.php | 216 +- lib/Models/CreateDomainModel.php | 278 +- lib/Models/CreateDomainModelDnsRecords.php | 248 +- .../CreateDomainModelDnsRecordsDkimRecord.php | 262 +- lib/Models/CreateEmailCampaign.php | 728 +- ...CreateEmailCampaignEmailExpirationDate.php | 294 + lib/Models/CreateEmailCampaignRecipients.php | 248 +- lib/Models/CreateEmailCampaignSender.php | 253 +- lib/Models/CreateExternalFeed.php | 350 +- lib/Models/CreateExternalFeed201Response.php | 210 + lib/Models/CreateList.php | 226 +- lib/Models/CreateLoyaltyProgramPayload.php | 278 + lib/Models/CreateModel.php | 216 +- lib/Models/CreateOrderPayload.php | 389 + lib/Models/CreatePaymentRequest.php | 386 + lib/Models/CreatePaymentResponse.php | 244 + lib/Models/CreateProductModel.php | 220 +- lib/Models/CreateReseller.php | 338 - lib/Models/CreateSender.php | 242 +- lib/Models/CreateSenderIps.php | 387 - lib/Models/CreateSenderIpsInner.php | 297 + lib/Models/CreateSenderModel.php | 244 +- lib/Models/CreateSmsCampaign.php | 310 +- lib/Models/CreateSmsCampaignRecipients.php | 232 +- lib/Models/CreateSmtpEmail.php | 234 +- lib/Models/CreateSmtpTemplate.php | 412 +- lib/Models/CreateSmtpTemplateSender.php | 250 +- lib/Models/CreateSubAccount.php | 290 +- lib/Models/CreateSubAccountResponse.php | 216 +- .../CreateSubscriptionMemberPayload.php | 278 + .../CreateSubscriptionMemberResponse.php | 343 + lib/Models/CreateSubscriptionPayload.php | 244 + lib/Models/CreateSubscriptionResponse.php | 411 + lib/Models/CreateTierGroupRequest.php | 343 + lib/Models/CreateTransactionPayload.php | 352 + lib/Models/CreateUpdateBatchCategory.php | 230 +- lib/Models/CreateUpdateBatchCategoryModel.php | 234 +- lib/Models/CreateUpdateBatchProducts.php | 230 +- lib/Models/CreateUpdateBatchProductsModel.php | 234 +- lib/Models/CreateUpdateCategories.php | 272 +- lib/Models/CreateUpdateCategory.php | 286 +- lib/Models/CreateUpdateContactModel.php | 220 +- lib/Models/CreateUpdateFolder.php | 220 +- lib/Models/CreateUpdateProduct.php | 368 +- lib/Models/CreateUpdateProducts.php | 354 +- lib/Models/CreateWebhook.php | 410 +- lib/Models/CreateWhatsAppCampaign.php | 246 +- .../CreateWhatsAppCampaignRecipients.php | 248 +- lib/Models/CreateWhatsAppTemplate.php | 342 +- lib/Models/CreatedBatchId.php | 230 +- lib/Models/CreatedProcessId.php | 216 +- lib/Models/CrmDealsIdPatchRequest.php | 241 + .../CrmDealsLinkUnlinkIdPatchRequest.php | 309 + lib/Models/CrmDealsPost201Response.php | 211 + lib/Models/CrmDealsPostRequest.php | 312 + lib/Models/CrmTasksIdPatchRequest.php | 547 ++ lib/Models/CrmTasksPost201Response.php | 211 + .../{Body8.php => CrmTasksPostRequest.php} | 410 +- lib/Models/Deal.php | 262 +- lib/Models/DealAttributes.php | 281 - lib/Models/DealAttributesInner.php | 276 +- lib/Models/DealsList.php | 220 +- lib/Models/DeleteHardbounces.php | 248 +- .../DeleteSubscriptionMemberPayload.php | 247 + ...SourceConversionSourceIdGet200Response.php | 427 + ...mmerceAttributionMetricsGet200Response.php | 247 + ...AttributionMetricsGet200ResponseTotals.php | 285 + ...SourceConversionSourceIdGet200Response.php | 210 + ...rceConfigDisplayCurrencyGet200Response.php | 210 + lib/Models/EmailExportRecipients.php | 284 +- lib/Models/ErrorModel.php | 268 +- lib/Models/ErrorResponse.php | 207 + lib/Models/Event.php | 300 +- lib/Models/EventContactPropertiesValue.php | 179 + lib/Models/EventEventPropertiesValue.php | 179 + lib/Models/EventIdentifiers.php | 274 +- lib/Models/ExportWebhooksHistory.php | 506 +- lib/Models/ExportWebhooksHistoryRequest.php | 620 ++ lib/Models/FileData.php | 410 +- lib/Models/FileDownloadableLink.php | 226 +- lib/Models/FileList.php | 281 - lib/Models/GetAccount.php | 387 +- lib/Models/GetAccountActivity.php | 222 +- ...gs.php => GetAccountActivityLogsInner.php} | 260 +- .../GetAccountAllOfMarketingAutomation.php | 244 + ...ccountPlan.php => GetAccountAllOfPlan.php} | 338 +- lib/Models/GetAccountAllOfRelay.php | 248 + lib/Models/GetAccountAllOfRelayData.php | 285 + lib/Models/GetAccountMarketingAutomation.php | 338 - lib/Models/GetAccountRelay.php | 342 - lib/Models/GetAccountRelayData.php | 375 - lib/Models/GetAggregatedReport.php | 388 +- lib/Models/GetAllExternalFeeds.php | 236 +- ....php => GetAllExternalFeedsFeedsInner.php} | 458 +- lib/Models/GetAttributes.php | 222 +- ...s.php => GetAttributesAttributesInner.php} | 314 +- ...ributesAttributesInnerEnumerationInner.php | 247 + lib/Models/GetAttributesEnumeration.php | 341 - lib/Models/GetBlockedDomains.php | 217 +- lib/Models/GetCampaignOverview.php | 498 +- lib/Models/GetCampaignRecipients.php | 226 +- lib/Models/GetCampaignStats.php | 480 +- lib/Models/GetCategories.php | 232 +- lib/Models/GetCategoryDetails.php | 274 +- lib/Models/GetChildAccountCreationStatus.php | 308 - lib/Models/GetChildDomain.php | 335 - lib/Models/GetChildDomains.php | 280 - lib/Models/GetChildInfo.php | 422 - lib/Models/GetChildInfoApiKeys.php | 339 - lib/Models/GetChildInfoApiKeysV2.php | 341 - lib/Models/GetChildInfoApiKeysV3.php | 341 - lib/Models/GetChildInfoCredits.php | 336 - lib/Models/GetChildInfoStatistics.php | 366 - lib/Models/GetChildrenList.php | 335 - lib/Models/GetClient.php | 246 +- lib/Models/GetContactCampaignStats.php | 348 +- lib/Models/GetContactCampaignStatsClicked.php | 341 - .../GetContactCampaignStatsClickedInner.php | 247 + ...=> GetContactCampaignStatsOpenedInner.php} | 250 +- ...tContactCampaignStatsTransacAttributes.php | 374 - ...actCampaignStatsTransacAttributesInner.php | 284 + ...GetContactCampaignStatsUnsubscriptions.php | 238 +- lib/Models/GetContactDetails.php | 361 +- .../GetContactInfoIdentifierParameter.php | 179 + lib/Models/GetContacts.php | 232 +- lib/Models/GetCorporateInvitedUsersList.php | 222 +- ...CorporateInvitedUsersListFeatureAccess.php | 396 - .../GetCorporateInvitedUsersListGroups.php | 336 - .../GetCorporateInvitedUsersListUsers.php | 440 - ...GetCorporateInvitedUsersListUsersInner.php | 355 + ...nvitedUsersListUsersInnerFeatureAccess.php | 480 + ...porateInvitedUsersListUsersInnerGroups.php | 242 + lib/Models/GetCorporateUserPermission.php | 322 + ...etCorporateUserPermissionFeatureAccess.php | 480 + .../GetCorporateUserPermissionGroupsInner.php | 242 + lib/Models/GetCouponCollection.php | 322 +- lib/Models/GetDeviceBrowserStats.php | 246 +- lib/Models/GetDomainConfigurationModel.php | 246 +- lib/Models/GetDomainsList.php | 222 +- ...ins.php => GetDomainsListDomainsInner.php} | 264 +- lib/Models/GetEmailCampaign.php | 1117 ++- lib/Models/GetEmailCampaigns.php | 236 +- .../GetEmailCampaignsCampaignsInner.php | 1515 ++++ lib/Models/GetEmailEventReport.php | 222 +- ...php => GetEmailEventReportEventsInner.php} | 434 +- lib/Models/GetExtendedCampaignOverview.php | 1043 ++- ...GetExtendedCampaignOverviewAllOfSender.php | 275 + .../GetExtendedCampaignOverviewSender.php | 365 - lib/Models/GetExtendedCampaignStats.php | 312 +- .../GetExtendedCampaignStatsGlobalStats.php | 281 - lib/Models/GetExtendedClient.php | 304 +- ....php => GetExtendedClientAllOfAddress.php} | 250 +- lib/Models/GetExtendedContactDetails.php | 376 +- ...tExtendedContactDetailsAllOfStatistics.php | 480 + ...edContactDetailsAllOfStatisticsClicked.php | 247 + ...dedContactDetailsAllOfStatisticsLinks.php} | 250 +- ...tactDetailsAllOfStatisticsMessagesSent.php | 247 + ...edContactDetailsAllOfStatisticsOpened.php} | 250 +- ...tDetailsAllOfStatisticsUnsubscriptions.php | 248 + ...ticsUnsubscriptionsAdminUnsubscription.php | 244 + ...sticsUnsubscriptionsUserUnsubscription.php | 281 + .../GetExtendedContactDetailsStatistics.php | 546 -- ...xtendedContactDetailsStatisticsClicked.php | 341 - ...endedContactDetailsStatisticsDelivered.php | 337 - ...edContactDetailsStatisticsMessagesSent.php | 341 - ...ontactDetailsStatisticsUnsubscriptions.php | 342 - ...ticsUnsubscriptionsAdminUnsubscription.php | 338 - ...sticsUnsubscriptionsUserUnsubscription.php | 371 - lib/Models/GetExtendedList.php | 405 +- .../GetExtendedListAllOfCampaignStats.php | 247 + lib/Models/GetExtendedListCampaignStats.php | 341 - lib/Models/GetExternalFeedByUUID.php | 454 +- lib/Models/GetExternalFeedByUUIDHeaders.php | 335 - .../GetExternalFeedByUUIDHeadersInner.php | 241 + lib/Models/GetFolder.php | 256 +- lib/Models/GetFolderLists.php | 236 +- lib/Models/GetFolders.php | 236 +- lib/Models/GetInboundEmailEvents.php | 222 +- lib/Models/GetInboundEmailEventsByUuid.php | 329 +- ...GetInboundEmailEventsByUuidAttachments.php | 395 - ...boundEmailEventsByUuidAttachmentsInner.php | 309 + .../GetInboundEmailEventsByUuidLogs.php | 371 - .../GetInboundEmailEventsByUuidLogsInner.php | 279 + ...p => GetInboundEmailEventsEventsInner.php} | 250 +- lib/Models/GetInvitedUsersList.php | 222 +- .../GetInvitedUsersListFeatureAccess.php | 366 - ....php => GetInvitedUsersListUsersInner.php} | 256 +- ...nvitedUsersListUsersInnerFeatureAccess.php | 276 + lib/Models/GetIp.php | 246 +- lib/Models/GetIpFromSender.php | 246 +- lib/Models/GetIps.php | 216 +- lib/Models/GetIpsFromSender.php | 216 +- lib/Models/GetList.php | 256 +- lib/Models/GetLists.php | 236 +- lib/Models/GetListsListsInner.php | 395 + lib/Models/GetOrders.php | 335 - lib/Models/GetPaymentRequest.php | 461 + lib/Models/GetProcess.php | 264 +- lib/Models/GetProcesses.php | 234 +- lib/Models/GetProductDetails.php | 498 +- lib/Models/GetProducts.php | 232 +- lib/Models/GetReports.php | 222 +- ...Reports.php => GetReportsReportsInner.php} | 340 +- lib/Models/GetScheduledEmailByBatchId.php | 236 +- ...etScheduledEmailByBatchIdBatchesInner.php} | 256 +- .../GetScheduledEmailById200Response.php | 390 + lib/Models/GetScheduledEmailByMessageId.php | 252 +- lib/Models/GetSegments.php | 236 +- lib/Models/GetSegmentsSegments.php | 395 - lib/Models/GetSendersList.php | 222 +- lib/Models/GetSendersListIps.php | 374 - ...ers.php => GetSendersListSendersInner.php} | 266 +- .../GetSendersListSendersInnerIpsInner.php | 284 + lib/Models/GetSharedTemplateUrl.php | 216 +- lib/Models/GetSmsCampaign.php | 364 +- lib/Models/GetSmsCampaignOverview.php | 340 +- lib/Models/GetSmsCampaignRecipients.php | 280 - lib/Models/GetSmsCampaignStats.php | 276 +- lib/Models/GetSmsCampaigns.php | 236 +- lib/Models/GetSmsCampaignsCampaignsInner.php | 582 ++ lib/Models/GetSmsEventReport.php | 222 +- lib/Models/GetSmsEventReportEvents.php | 533 -- lib/Models/GetSmsEventReportEventsInner.php | 463 + lib/Models/GetSmtpTemplateOverview.php | 340 +- lib/Models/GetSmtpTemplateOverviewSender.php | 248 +- lib/Models/GetSmtpTemplates.php | 234 +- lib/Models/GetSsoToken.php | 216 +- lib/Models/GetStatsByBrowser.php | 280 - lib/Models/GetStatsByDevice.php | 270 +- lib/Models/GetStatsByDomain.php | 280 - .../GetSubAccountGroups200ResponseInner.php | 241 + lib/Models/GetSubscriptionInfoResponse.php | 309 + .../GetSubscriptionInfoResponseBalance.php | 276 + ...iptionInfoResponseBalanceBalancesInner.php | 241 + ...etSubscriptionInfoResponseMembersInner.php | 275 + ...GetSubscriptionInfoResponseRewardInner.php | 377 + .../GetSubscriptionInfoResponseTierInner.php | 377 + lib/Models/GetSubscriptionMemberResponse.php | 411 + ...tionMemberResponseMemberContactIdInner.php | 275 + lib/Models/GetTransacAggregatedSmsReport.php | 360 +- lib/Models/GetTransacBlockedContacts.php | 236 +- ...etTransacBlockedContactsContactsInner.php} | 256 +- ...nsacBlockedContactsContactsInnerReason.php | 284 + .../GetTransacBlockedContactsReason.php | 376 - lib/Models/GetTransacEmailContent.php | 316 +- lib/Models/GetTransacEmailContentEvents.php | 341 - .../GetTransacEmailContentEventsInner.php | 247 + lib/Models/GetTransacEmailsList.php | 236 +- ...sacEmailsListTransactionalEmailsInner.php} | 338 +- lib/Models/GetTransacSmsReport.php | 222 +- lib/Models/GetTransacSmsReportReports.php | 575 -- .../GetTransacSmsReportReportsInner.php | 547 ++ lib/Models/GetUserPermission.php | 242 +- lib/Models/GetUserPermissionPrivileges.php | 341 - .../GetUserPermissionPrivilegesInner.php | 247 + lib/Models/GetVersionInfoResponse.php | 275 + lib/Models/GetWATemplates.php | 341 - lib/Models/GetWebhook.php | 334 +- lib/Models/GetWebhookAuth.php | 336 - lib/Models/GetWebhookHeaders.php | 335 - lib/Models/GetWebhooks.php | 222 +- lib/Models/GetWhatsAppConfig.php | 356 +- lib/Models/GetWhatsappCampaignOverview.php | 382 +- lib/Models/GetWhatsappCampaigns.php | 236 +- ...=> GetWhatsappCampaignsCampaignsInner.php} | 444 +- lib/Models/GetWhatsappEventReport.php | 222 +- ... => GetWhatsappEventReportEventsInner.php} | 378 +- lib/Models/GetWhatsappTemplates.php | 241 + ...=> GetWhatsappTemplatesTemplatesInner.php} | 336 +- lib/Models/InlineResponse200.php | 335 - lib/Models/InlineResponse2001.php | 309 - lib/Models/InlineResponse2002.php | 374 - lib/Models/InlineResponse201.php | 305 - lib/Models/InlineResponse2011.php | 309 - lib/Models/InlineResponse2012.php | 309 - lib/Models/InlineResponse2013.php | 308 - lib/Models/InlineResponse2014.php | 308 - lib/Models/InlineResponse2015.php | 308 - lib/Models/InviteAdminUser.php | 284 +- lib/Models/InviteAdminUserPrivileges.php | 396 - lib/Models/InviteAdminUserPrivilegesInner.php | 322 + lib/Models/Inviteuser.php | 242 +- lib/Models/InviteuserPrivileges.php | 468 - lib/Models/InviteuserPrivilegesInner.php | 384 + lib/Models/InviteuserResponse.php | 244 + lib/Models/LoyaltyProgram.php | 445 + lib/Models/LoyaltyProgramPage.php | 207 + lib/Models/LoyaltyProgramValidationError.php | 275 + lib/Models/LoyaltyTierPage.php | 207 + lib/Models/ManageIp.php | 305 - lib/Models/MasterDetailsResponse.php | 304 +- .../MasterDetailsResponseBillingInfo.php | 262 +- ...asterDetailsResponseBillingInfoAddress.php | 276 +- .../MasterDetailsResponseBillingInfoName.php | 234 +- lib/Models/MasterDetailsResponsePlanInfo.php | 306 +- .../MasterDetailsResponsePlanInfoFeatures.php | 485 - ...erDetailsResponsePlanInfoFeaturesInner.php | 411 + lib/Models/ModelInterface.php | 53 +- lib/Models/Note.php | 340 +- lib/Models/NoteData.php | 262 +- lib/Models/NoteId.php | 220 +- lib/Models/NoteList.php | 281 - lib/Models/Notification.php | 280 + lib/Models/Offer.php | 449 + lib/Models/OfferList.php | 207 + lib/Models/OffersListResponse.php | 241 + lib/Models/Order.php | 352 +- lib/Models/OrderBatch.php | 244 +- lib/Models/OrderBilling.php | 338 +- lib/Models/OrderIdentifiers.php | 310 + lib/Models/OrderProducts.php | 405 - lib/Models/OrderProductsInner.php | 319 + lib/Models/Otp.php | 239 +- lib/Models/PatchLoyaltyProgramPayload.php | 275 + lib/Models/Pipeline.php | 274 +- lib/Models/PipelineStage.php | 234 +- lib/Models/Pipelines.php | 281 - lib/Models/PostContactInfo.php | 216 +- lib/Models/PostContactInfoContacts.php | 270 +- lib/Models/PostContactInfoContactsFailure.php | 179 + lib/Models/PostContactInfoContactsSuccess.php | 179 + lib/Models/PostSendFailed.php | 276 +- lib/Models/PostSendSmsTestFailed.php | 262 +- lib/Models/PutRevokeUserPermission.php | 216 +- .../PutRevokeUserPermissionResponse.php | 244 + lib/Models/Putresendcancelinvitation.php | 216 +- .../PutresendcancelinvitationResponse.php | 244 + lib/Models/RedeemRewardPayload.php | 343 + ...emedRewardFailedConditionErrorResponse.php | 207 + lib/Models/RemainingCreditModel.php | 341 - lib/Models/RemainingCreditModelChild.php | 342 - lib/Models/RemainingCreditModelReseller.php | 341 - lib/Models/RemoveContactFromList.php | 365 - lib/Models/RemoveContactFromListByAll.php | 207 + lib/Models/RemoveContactFromListByEmails.php | 222 + lib/Models/RemoveContactFromListByExtIDs.php | 222 + lib/Models/RemoveContactFromListByIDs.php | 222 + lib/Models/RemoveContactFromListRequest.php | 354 + lib/Models/RemoveCredits.php | 335 - lib/Models/RequestContactExport.php | 272 +- ...equestContactExportCustomContactFilter.php | 348 +- lib/Models/RequestContactImport.php | 362 +- lib/Models/RequestContactImportJsonBody.php | 335 - .../RequestContactImportJsonBodyInner.php | 241 + lib/Models/RequestContactImportNewList.php | 234 +- lib/Models/RequestSmsRecipientExport.php | 280 +- lib/Models/RewardAttributionResponse.php | 479 + lib/Models/RewardRedeemResponse.php | 479 + lib/Models/ScheduleSmtpEmail.php | 248 +- lib/Models/Segment.php | 318 + lib/Models/SendReport.php | 296 +- lib/Models/SendReportEmail.php | 226 +- lib/Models/SendSms.php | 268 +- lib/Models/SendSmtpEmail.php | 444 +- lib/Models/SendSmtpEmailAttachment.php | 374 - lib/Models/SendSmtpEmailAttachmentInner.php | 284 + lib/Models/SendSmtpEmailBcc.php | 338 - lib/Models/SendSmtpEmailBccInner.php | 244 + lib/Models/SendSmtpEmailCc.php | 338 - lib/Models/SendSmtpEmailCcInner.php | 244 + lib/Models/SendSmtpEmailMessageVersions.php | 458 - .../SendSmtpEmailMessageVersionsInner.php | 448 + lib/Models/SendSmtpEmailReplyTo.php | 232 +- lib/Models/SendSmtpEmailReplyTo1.php | 339 - lib/Models/SendSmtpEmailSender.php | 250 +- lib/Models/SendSmtpEmailTo.php | 338 - lib/Models/SendSmtpEmailTo1.php | 338 - lib/Models/SendSmtpEmailToInner.php | 244 + lib/Models/SendTestEmail.php | 220 +- lib/Models/SendTestSms.php | 220 +- lib/Models/SendTransacSms.php | 324 +- lib/Models/SendWhatsappMessage.php | 431 - lib/Models/SendWhatsappMessage201Response.php | 210 + lib/Models/SendWhatsappMessageRequest.php | 355 + lib/Models/SendWhatsappMessageTemplate.php | 318 + lib/Models/SendWhatsappMessageText.php | 284 + lib/Models/SsoTokenRequest.php | 442 - lib/Models/SubAccountAppsToggleRequest.php | 388 +- lib/Models/SubAccountDetailsResponse.php | 274 +- .../SubAccountDetailsResponseGroupsInner.php | 241 + .../SubAccountDetailsResponsePlanInfo.php | 248 +- ...bAccountDetailsResponsePlanInfoCredits.php | 288 +- ...ntDetailsResponsePlanInfoCreditsEmails.php | 234 +- ...lsResponsePlanInfoCreditsExternalFeeds.php | 242 + ...countDetailsResponsePlanInfoCreditsSms.php | 242 + ...DetailsResponsePlanInfoCreditsWhatsapp.php | 242 + ...lsResponsePlanInfoCreditsWpSubscribers.php | 242 + ...AccountDetailsResponsePlanInfoFeatures.php | 248 +- ...ntDetailsResponsePlanInfoFeaturesInbox.php | 234 +- ...ilsResponsePlanInfoFeaturesLandingPage.php | 234 +- ...ntDetailsResponsePlanInfoFeaturesUsers.php | 234 +- lib/Models/SubAccountUpdatePlanRequest.php | 234 +- .../SubAccountUpdatePlanRequestCredits.php | 292 +- .../SubAccountUpdatePlanRequestFeatures.php | 248 +- lib/Models/SubAccountsResponse.php | 236 +- ...> SubAccountsResponseSubAccountsInner.php} | 267 +- ...ntsResponseSubAccountsInnerGroupsInner.php | 241 + .../SubscriptionNotFoundErrorResponse.php | 207 + lib/Models/Task.php | 320 +- lib/Models/TaskList.php | 220 +- lib/Models/TaskReminder.php | 272 +- lib/Models/TaskTypes.php | 234 +- lib/Models/Tier.php | 479 + lib/Models/TierAccessConditionsInner.php | 309 + lib/Models/TierForContact.php | 377 + lib/Models/TierGroup.php | 513 ++ lib/Models/TierGroupPage.php | 207 + lib/Models/TierRequest.php | 281 + .../TierRequestAccessConditionsInner.php | 241 + lib/Models/TierRequestTierRewardsInner.php | 207 + lib/Models/TierTierRewardsInner.php | 275 + lib/Models/Transaction.php | 587 ++ lib/Models/UnauthorizedResponse.php | 207 + lib/Models/UpdateAttribute.php | 248 +- lib/Models/UpdateAttributeEnumeration.php | 341 - .../UpdateAttributeEnumerationInner.php | 247 + lib/Models/UpdateBalanceDefinitionPayload.php | 933 ++ lib/Models/UpdateBatchContacts.php | 222 +- lib/Models/UpdateBatchContactsContacts.php | 575 -- .../UpdateBatchContactsContactsInner.php | 513 ++ lib/Models/UpdateBatchContactsModel.php | 234 +- lib/Models/UpdateCampaignStatus.php | 246 +- lib/Models/UpdateChild.php | 425 - lib/Models/UpdateChildAccountStatus.php | 395 - lib/Models/UpdateChildDomain.php | 305 - lib/Models/UpdateContact.php | 306 +- lib/Models/UpdateCouponCollection.php | 308 - .../UpdateCouponCollection200Response.php | 284 + lib/Models/UpdateCouponCollectionRequest.php | 309 + lib/Models/UpdateEmailCampaign.php | 694 +- ...UpdateEmailCampaignEmailExpirationDate.php | 294 + lib/Models/UpdateEmailCampaignRecipients.php | 248 +- lib/Models/UpdateEmailCampaignSender.php | 250 +- lib/Models/UpdateExternalFeed.php | 358 +- lib/Models/UpdateList.php | 234 +- lib/Models/UpdateLoyaltyProgramPayload.php | 278 + lib/Models/UpdateSender.php | 250 +- lib/Models/UpdateSmsCampaign.php | 322 +- lib/Models/UpdateSmtpTemplate.php | 346 +- lib/Models/UpdateSmtpTemplateSender.php | 250 +- lib/Models/UpdateTierGroup404Response.php | 207 + lib/Models/UpdateTierGroupRequest.php | 377 + lib/Models/UpdateUserResponse.php | 278 + lib/Models/UpdateWebhook.php | 346 +- lib/Models/UpdateWhatsAppCampaign.php | 276 +- lib/Models/UploadImageModel.php | 225 +- lib/Models/UploadImageToGallery.php | 232 +- lib/Models/ValidateRewardPayload.php | 309 + lib/Models/ValidatedRewardResponse.php | 207 + lib/Models/ValidationError.php | 207 + lib/Models/VariablesItems.php | 248 +- lib/Models/VersionInfo.php | 445 + lib/Models/WhatsappCampStats.php | 258 +- lib/Models/WhatsappCampTemplate.php | 360 +- lib/ObjectSerializer.php | 507 +- phpunit.xml.dist | 35 +- test/Api/AttributesApiTest.php | 113 - test/Api/CRMApiTest.php | 183 - test/Api/EcommerceApiTest.php | 193 - test/Api/FoldersApiTest.php | 133 - test/Api/ListsApiTest.php | 163 - test/Api/MasterAccountApiTest.php | 233 - test/Api/ResellerApiTest.php | 233 - test/Model/AbTestVersionClicksTest.php | 78 - test/Model/Body5Test.php | 92 - test/Model/Body6Test.php | 92 - test/Model/BodyVariablesItemsTest.php | 78 - test/Model/CompanyAttributesTest.php | 78 - test/Model/ContactTest.php | 134 - test/Model/CreateCouponCollectionTest.php | 92 - test/Model/DealAttributesTest.php | 78 - test/Model/FIleListTest.php | 78 - test/Model/GetAccountTest.php | 99 - .../GetChildAccountCreationStatusTest.php | 85 - test/Model/GetChildDomainTest.php | 92 - test/Model/GetChildDomainsTest.php | 78 - test/Model/GetChildInfoApiKeysTest.php | 92 - test/Model/GetChildInfoApiKeysV2Test.php | 92 - test/Model/GetChildInfoApiKeysV3Test.php | 92 - test/Model/GetChildInfoCreditsTest.php | 92 - test/Model/GetChildInfoStatisticsTest.php | 99 - test/Model/GetChildInfoTest.php | 113 - test/Model/GetChildrenListTest.php | 92 - ...orateInvitedUsersListFeatureAccessTest.php | 106 - test/Model/GetEmailCampaignTest.php | 92 - .../Model/GetExtendedCampaignOverviewTest.php | 190 - ...etExtendedCampaignStatsGlobalStatsTest.php | 78 - test/Model/GetExtendedClientTest.php | 85 - ...dContactDetailsStatisticsDeliveredTest.php | 92 - ...ntactDetailsStatisticsMessagesSentTest.php | 92 - ...UnsubscriptionsAdminUnsubscriptionTest.php | 92 - test/Model/GetExtendedContactDetailsTest.php | 85 - test/Model/GetExtendedListTest.php | 106 - test/Model/GetOrdersTest.php | 92 - test/Model/GetSmsCampaignRecipientsTest.php | 78 - test/Model/GetSmsCampaignTest.php | 92 - test/Model/GetStatsByBrowserTest.php | 78 - test/Model/GetStatsByDomainTest.php | 78 - test/Model/GetWebhookAuthTest.php | 92 - test/Model/GetWebhookHeadersTest.php | 92 - test/Model/InlineResponse2013Test.php | 85 - test/Model/InlineResponse2015Test.php | 85 - test/Model/InlineResponse201Test.php | 85 - test/Model/ManageIpTest.php | 85 - test/Model/NoteListTest.php | 78 - test/Model/PipelinesTest.php | 78 - test/Model/RemainingCreditModelChildTest.php | 92 - .../RemainingCreditModelResellerTest.php | 92 - test/Model/RemainingCreditModelTest.php | 92 - test/Model/RemoveCreditsTest.php | 92 - test/Model/SendSmtpEmailBccTest.php | 92 - test/Model/SendSmtpEmailCcTest.php | 92 - .../SendSmtpEmailMessageVersionsTest.php | 120 - test/Model/SendSmtpEmailReplyTo1Test.php | 92 - test/Model/SendSmtpEmailTo1Test.php | 92 - test/Model/SendSmtpEmailToTest.php | 92 - ...SubAccountUpdatePlanRequestCreditsTest.php | 85 - test/Model/UpdateChildAccountStatusTest.php | 106 - test/Model/UpdateChildDomainTest.php | 85 - test/Model/UpdateCouponCollectionTest.php | 85 - {test => tests}/Api/AccountApiTest.php | 47 +- tests/Api/BalanceApiTest.php | 252 + {test => tests}/Api/CompaniesApiTest.php | 73 +- {test => tests}/Api/ContactsApiTest.php | 103 +- {test => tests}/Api/ConversationsApiTest.php | 61 +- {test => tests}/Api/CouponsApiTest.php | 53 +- {test => tests}/Api/DealsApiTest.php | 75 +- {test => tests}/Api/DomainsApiTest.php | 53 +- tests/Api/EcommerceApiTest.php | 276 + {test => tests}/Api/EmailCampaignsApiTest.php | 69 +- .../Api/EventApiTest.php | 47 +- {test => tests}/Api/ExternalFeedsApiTest.php | 53 +- {test => tests}/Api/FilesApiTest.php | 53 +- {test => tests}/Api/InboundParsingApiTest.php | 49 +- tests/Api/MasterAccountApiTest.php | 384 + {test => tests}/Api/NotesApiTest.php | 53 +- tests/Api/PaymentsApiTest.php | 108 + {test => tests}/Api/ProcessApiTest.php | 47 +- tests/Api/ProgramApiTest.php | 228 + tests/Api/RewardsApiTest.php | 132 + {test => tests}/Api/SMSCampaignsApiTest.php | 63 +- {test => tests}/Api/SendersApiTest.php | 59 +- {test => tests}/Api/TasksApiTest.php | 55 +- tests/Api/TierApiTest.php | 192 + .../Api/TransactionalEmailsApiTest.php | 101 +- .../Api/TransactionalSMSApiTest.php | 51 +- .../Api/TransactionalWhatsAppApiTest.php | 47 +- {test => tests}/Api/UserApiTest.php | 55 +- {test => tests}/Api/WebhooksApiTest.php | 55 +- .../Api/WhatsAppCampaignsApiTest.php | 62 +- .../AbTestCampaignResultClickedLinksTest.php | 44 +- .../AbTestCampaignResultStatisticsTest.php | 52 +- .../Model/AbTestCampaignResultTest.php | 56 +- .../Model/AbTestVersionClicksInnerTest.php | 46 +- .../Model/AbTestVersionStatsTest.php | 44 +- .../Model/AddContactToListByEmailsTest.php | 66 +- tests/Model/AddContactToListByExtIDsTest.php | 89 + .../Model/AddContactToListByIDsTest.php | 59 +- tests/Model/AddContactToListRequestTest.php | 107 + tests/Model/AttributeRewardPayloadTest.php | 107 + ...RewardFailedConditionErrorResponseTest.php | 89 + .../Model/AuthenticateDomainModelTest.php | 44 +- tests/Model/BadRequestPayloadTest.php | 89 + tests/Model/BalanceBalancesInnerTest.php | 98 + .../BalanceDefinitionIdDoesNotExistTest.php | 89 + tests/Model/BalanceDefinitionPageTest.php | 89 + tests/Model/BalanceDefinitionTest.php | 242 + tests/Model/BalanceLimitPayloadTest.php | 134 + tests/Model/BalanceLimitTest.php | 125 + tests/Model/BalancePageTest.php | 89 + tests/Model/BalanceTest.php | 107 + {test => tests}/Model/BlockDomainTest.php | 42 +- tests/Model/CancelledTransactionTest.php | 179 + tests/Model/CartTest.php | 98 + .../Model/CompaniesIdPatchRequestTest.php | 56 +- .../CompaniesImportPost200ResponseTest.php | 89 + .../CompaniesImportPost400ResponseTest.php | 89 + .../CompaniesLinkUnlinkIdPatchRequestTest.php | 58 +- {test => tests}/Model/CompaniesListTest.php | 42 +- .../Model/CompaniesPost200ResponseTest.php | 50 +- tests/Model/CompaniesPostRequestTest.php | 125 + .../Model/CompanyAttributesInnerTest.php | 50 +- {test => tests}/Model/CompanyTest.php | 48 +- .../Model/CompleteTransactionPayloadTest.php | 89 + tests/Model/CompletedTransactionTest.php | 179 + {test => tests}/Model/ComponentItemsTest.php | 44 +- tests/Model/ConfigurationTest.php | 89 + .../ContactBalancesBalancesInnerTest.php | 116 + tests/Model/ContactBalancesTest.php | 116 + tests/Model/ContactErrorModelTest.php | 107 + tests/Model/ContactIdInvalidResponseTest.php | 89 + ...rsationsAgentOnlinePingPostRequestTest.php | 58 +- .../ConversationsMessageFileImageInfoTest.php | 46 +- .../Model/ConversationsMessageFileTest.php | 50 +- .../Model/ConversationsMessageTest.php | 60 +- .../ConversationsMessagesIdPutRequestTest.php | 89 + .../ConversationsMessagesPostRequestTest.php | 62 +- ...ersationsPushedMessagesPostRequestTest.php | 58 +- tests/Model/ConversionSourceMetricsTest.php | 125 + tests/Model/ConversionSourceProductTest.php | 152 + ...CorporateGroupDetailsResponseGroupTest.php | 107 + ...oupDetailsResponseSubAccountsInnerTest.php | 63 +- .../CorporateGroupDetailsResponseTest.php | 107 + ...rateGroupDetailsResponseUsersInnerTest.php | 74 +- .../Model/CorporateGroupIdPutRequestTest.php | 54 +- .../CorporateGroupPost201ResponseTest.php | 59 +- .../Model/CorporateGroupPostRequestTest.php | 54 +- ...UnlinkGroupIdSubAccountsPutRequestTest.php | 89 + .../CorporateIpGet200ResponseInnerTest.php | 107 + .../CorporateSsoTokenPostRequestTest.php | 59 +- ...teSubAccountIpAssociatePostRequestTest.php | 98 + ...teSubAccountIpDissociatePutRequestTest.php | 98 + .../CorporateSubAccountKeyPostRequestTest.php | 98 + ...orateSubAccountSsoTokenPostRequestTest.php | 116 + ...rmissionsPutRequestPrivilegesInnerTest.php | 98 + ...rateUserEmailPermissionsPutRequestTest.php | 98 + ...nvitationActionEmailPut200ResponseTest.php | 89 + .../Model/CreateApiKeyResponseTest.php | 44 +- .../CreateAttributeEnumerationInnerTest.php | 54 +- {test => tests}/Model/CreateAttributeTest.php | 57 +- .../CreateBalanceDefinitionPayloadTest.php | 215 + .../Model/CreateCategoryModelTest.php | 42 +- {test => tests}/Model/CreateContactTest.php | 56 +- .../CreateCouponCollection201ResponseTest.php | 89 + .../CreateCouponCollectionRequestTest.php | 125 + .../Model/CreateCouponsRequestTest.php | 54 +- .../CreateDoiContactAttributesValueTest.php | 80 + .../Model/CreateDoiContactTest.php | 72 +- ...ateDomainModelDnsRecordsDkimRecordTest.php | 48 +- .../Model/CreateDomainModelDnsRecordsTest.php | 53 +- .../Model/CreateDomainModelTest.php | 57 +- {test => tests}/Model/CreateDomainTest.php | 42 +- ...teEmailCampaignEmailExpirationDateTest.php | 98 + .../CreateEmailCampaignRecipientsTest.php | 46 +- .../Model/CreateEmailCampaignSenderTest.php | 48 +- .../Model/CreateEmailCampaignTest.php | 123 +- .../CreateExternalFeed201ResponseTest.php | 59 +- .../Model/CreateExternalFeedTest.php | 58 +- {test => tests}/Model/CreateListTest.php | 44 +- .../Model/CreateLoyaltyProgramPayloadTest.php | 107 + {test => tests}/Model/CreateModelTest.php | 42 +- tests/Model/CreateOrderPayloadTest.php | 134 + tests/Model/CreatePaymentRequestTest.php | 134 + .../Model/CreatePaymentResponseTest.php | 68 +- .../Model/CreateProductModelTest.php | 42 +- .../Model/CreateSenderIpsInnerTest.php | 56 +- .../Model/CreateSenderModelTest.php | 46 +- {test => tests}/Model/CreateSenderTest.php | 46 +- .../Model/CreateSmsCampaignRecipientsTest.php | 44 +- .../Model/CreateSmsCampaignTest.php | 56 +- {test => tests}/Model/CreateSmtpEmailTest.php | 44 +- .../Model/CreateSmtpTemplateSenderTest.php | 48 +- .../Model/CreateSmtpTemplateTest.php | 84 +- .../Model/CreateSubAccountResponseTest.php | 42 +- .../Model/CreateSubAccountTest.php | 57 +- .../CreateSubscriptionMemberPayloadTest.php | 107 + .../CreateSubscriptionMemberResponseTest.php | 125 + tests/Model/CreateSubscriptionPayloadTest.php | 98 + .../Model/CreateSubscriptionResponseTest.php | 143 + tests/Model/CreateTierGroupRequestTest.php | 107 + tests/Model/CreateTransactionPayloadTest.php | 125 + .../CreateUpdateBatchCategoryModelTest.php | 44 +- .../Model/CreateUpdateBatchCategoryTest.php | 44 +- .../CreateUpdateBatchProductsModelTest.php | 44 +- .../Model/CreateUpdateBatchProductsTest.php | 44 +- .../Model/CreateUpdateCategoriesTest.php | 57 +- .../Model/CreateUpdateCategoryTest.php | 59 +- .../Model/CreateUpdateContactModelTest.php | 42 +- .../Model/CreateUpdateFolderTest.php | 42 +- .../Model/CreateUpdateProductTest.php | 71 +- .../Model/CreateUpdateProductsTest.php | 69 +- {test => tests}/Model/CreateWebhookTest.php | 64 +- .../CreateWhatsAppCampaignRecipientsTest.php | 46 +- .../Model/CreateWhatsAppCampaignTest.php | 48 +- .../Model/CreateWhatsAppTemplateTest.php | 62 +- {test => tests}/Model/CreatedBatchIdTest.php | 51 +- .../Model/CreatedProcessIdTest.php | 42 +- .../Model/CrmDealsIdPatchRequestTest.php | 61 +- .../CrmDealsLinkUnlinkIdPatchRequestTest.php | 58 +- .../Model/CrmDealsPost201ResponseTest.php | 50 +- tests/Model/CrmDealsPostRequestTest.php | 116 + .../Model/CrmTasksIdPatchRequestTest.php | 79 +- .../Model/CrmTasksPost201ResponseTest.php | 50 +- .../Model/CrmTasksPostRequestTest.php | 84 +- .../Model/DealAttributesInnerTest.php | 50 +- {test => tests}/Model/DealTest.php | 48 +- {test => tests}/Model/DealsListTest.php | 42 +- .../Model/DeleteHardbouncesTest.php | 46 +- .../DeleteSubscriptionMemberPayloadTest.php | 98 + ...ceConversionSourceIdGet200ResponseTest.php | 134 + ...ceAttributionMetricsGet200ResponseTest.php | 98 + ...ibutionMetricsGet200ResponseTotalsTest.php | 107 + ...ceConversionSourceIdGet200ResponseTest.php | 89 + ...onfigDisplayCurrencyGet200ResponseTest.php | 89 + .../Model/EmailExportRecipientsTest.php | 52 +- {test => tests}/Model/ErrorModelTest.php | 44 +- tests/Model/ErrorResponseTest.php | 89 + .../Model/EventContactPropertiesValueTest.php | 57 +- .../Model/EventEventPropertiesValueTest.php | 57 +- .../Model/EventIdentifiersTest.php | 48 +- {test => tests}/Model/EventTest.php | 56 +- .../ExportWebhooksHistoryRequestTest.php | 170 + .../Model/ExportWebhooksHistoryTest.php | 88 +- {test => tests}/Model/FileDataTest.php | 75 +- .../Model/FileDownloadableLinkTest.php | 44 +- .../Model/GetAccountActivityLogsInnerTest.php | 60 +- .../Model/GetAccountActivityTest.php | 42 +- ...GetAccountAllOfMarketingAutomationTest.php | 62 +- .../Model/GetAccountAllOfPlanTest.php | 67 +- .../Model/GetAccountAllOfRelayDataTest.php | 54 +- .../Model/GetAccountAllOfRelayTest.php | 52 +- tests/Model/GetAccountTest.php | 152 + .../Model/GetAggregatedReportTest.php | 66 +- .../GetAllExternalFeedsFeedsInnerTest.php | 106 +- .../Model/GetAllExternalFeedsTest.php | 44 +- ...tesAttributesInnerEnumerationInnerTest.php | 54 +- .../GetAttributesAttributesInnerTest.php | 60 +- {test => tests}/Model/GetAttributesTest.php | 42 +- .../Model/GetBlockedDomainsTest.php | 44 +- .../Model/GetCampaignOverviewTest.php | 84 +- .../Model/GetCampaignRecipientsTest.php | 44 +- .../Model/GetCampaignStatsTest.php | 102 +- {test => tests}/Model/GetCategoriesTest.php | 44 +- .../Model/GetCategoryDetailsTest.php | 52 +- {test => tests}/Model/GetClientTest.php | 48 +- ...etContactCampaignStatsClickedInnerTest.php | 54 +- ...GetContactCampaignStatsOpenedInnerTest.php | 58 +- .../Model/GetContactCampaignStatsTest.php | 58 +- ...ampaignStatsTransacAttributesInnerTest.php | 56 +- ...ontactCampaignStatsUnsubscriptionsTest.php | 44 +- .../Model/GetContactDetailsTest.php | 80 +- .../GetContactInfoIdentifierParameterTest.php | 80 + {test => tests}/Model/GetContactsTest.php | 44 +- .../GetCorporateInvitedUsersListTest.php | 42 +- ...edUsersListUsersInnerFeatureAccessTest.php | 161 + ...teInvitedUsersListUsersInnerGroupsTest.php | 52 +- ...orporateInvitedUsersListUsersInnerTest.php | 125 + ...rporateUserPermissionFeatureAccessTest.php | 161 + ...CorporateUserPermissionGroupsInnerTest.php | 98 + .../Model/GetCorporateUserPermissionTest.php | 73 +- .../Model/GetCouponCollectionTest.php | 79 +- .../Model/GetDeviceBrowserStatsTest.php | 48 +- .../Model/GetDomainConfigurationModelTest.php | 48 +- .../Model/GetDomainsListDomainsInnerTest.php | 60 +- {test => tests}/Model/GetDomainsListTest.php | 42 +- tests/Model/GetEmailCampaignTest.php | 404 + .../GetEmailCampaignsCampaignsInnerTest.php | 404 + .../Model/GetEmailCampaignsTest.php | 44 +- .../GetEmailEventReportEventsInnerTest.php | 84 +- .../Model/GetEmailEventReportTest.php | 42 +- ...xtendedCampaignOverviewAllOfSenderTest.php | 107 + .../Model/GetExtendedCampaignOverviewTest.php | 386 + .../Model/GetExtendedCampaignStatsTest.php | 56 +- .../GetExtendedClientAllOfAddressTest.php | 56 +- .../Model/GetExtendedClientTest.php | 71 +- ...ntactDetailsAllOfStatisticsClickedTest.php | 54 +- ...ContactDetailsAllOfStatisticsLinksTest.php | 58 +- ...DetailsAllOfStatisticsMessagesSentTest.php | 61 +- ...ontactDetailsAllOfStatisticsOpenedTest.php | 58 +- ...endedContactDetailsAllOfStatisticsTest.php | 66 +- ...UnsubscriptionsAdminUnsubscriptionTest.php | 98 + ...ailsAllOfStatisticsUnsubscriptionsTest.php | 52 +- ...sUnsubscriptionsUserUnsubscriptionTest.php | 107 + tests/Model/GetExtendedContactDetailsTest.php | 170 + .../GetExtendedListAllOfCampaignStatsTest.php | 54 +- tests/Model/GetExtendedListTest.php | 161 + .../GetExternalFeedByUUIDHeadersInnerTest.php | 54 +- .../Model/GetExternalFeedByUUIDTest.php | 96 +- {test => tests}/Model/GetFolderListsTest.php | 44 +- {test => tests}/Model/GetFolderTest.php | 50 +- {test => tests}/Model/GetFoldersTest.php | 44 +- ...dEmailEventsByUuidAttachmentsInnerTest.php | 58 +- ...tInboundEmailEventsByUuidLogsInnerTest.php | 54 +- .../Model/GetInboundEmailEventsByUuidTest.php | 56 +- .../GetInboundEmailEventsEventsInnerTest.php | 58 +- .../Model/GetInboundEmailEventsTest.php | 42 +- .../Model/GetInvitedUsersListTest.php | 42 +- ...edUsersListUsersInnerFeatureAccessTest.php | 54 +- .../GetInvitedUsersListUsersInnerTest.php | 58 +- {test => tests}/Model/GetIpFromSenderTest.php | 48 +- {test => tests}/Model/GetIpTest.php | 48 +- .../Model/GetIpsFromSenderTest.php | 42 +- {test => tests}/Model/GetIpsTest.php | 42 +- {test => tests}/Model/GetListTest.php | 50 +- tests/Model/GetListsListsInnerTest.php | 134 + {test => tests}/Model/GetListsTest.php | 44 +- tests/Model/GetPaymentRequestTest.php | 143 + {test => tests}/Model/GetProcessTest.php | 48 +- {test => tests}/Model/GetProcessesTest.php | 44 +- .../Model/GetProductDetailsTest.php | 98 +- {test => tests}/Model/GetProductsTest.php | 44 +- .../Model/GetReportsReportsInnerTest.php | 76 +- {test => tests}/Model/GetReportsTest.php | 42 +- ...cheduledEmailByBatchIdBatchesInnerTest.php | 56 +- .../Model/GetScheduledEmailByBatchIdTest.php | 45 +- .../GetScheduledEmailById200ResponseTest.php | 125 + .../GetScheduledEmailByMessageIdTest.php | 47 +- {test => tests}/Model/GetSegmentsTest.php | 44 +- ...GetSendersListSendersInnerIpsInnerTest.php | 56 +- .../Model/GetSendersListSendersInnerTest.php | 60 +- {test => tests}/Model/GetSendersListTest.php | 42 +- .../Model/GetSharedTemplateUrlTest.php | 42 +- .../Model/GetSmsCampaignOverviewTest.php | 70 +- .../Model/GetSmsCampaignStatsTest.php | 54 +- tests/Model/GetSmsCampaignTest.php | 170 + .../GetSmsCampaignsCampaignsInnerTest.php | 170 + {test => tests}/Model/GetSmsCampaignsTest.php | 44 +- .../GetSmsEventReportEventsInnerTest.php | 64 +- .../Model/GetSmsEventReportTest.php | 42 +- .../GetSmtpTemplateOverviewSenderTest.php | 46 +- .../Model/GetSmtpTemplateOverviewTest.php | 66 +- .../Model/GetSmtpTemplatesTest.php | 44 +- {test => tests}/Model/GetSsoTokenTest.php | 42 +- .../Model/GetStatsByDeviceTest.php | 48 +- ...etSubAccountGroups200ResponseInnerTest.php | 54 +- ...onInfoResponseBalanceBalancesInnerTest.php | 98 + ...GetSubscriptionInfoResponseBalanceTest.php | 107 + ...bscriptionInfoResponseMembersInnerTest.php | 107 + ...ubscriptionInfoResponseRewardInnerTest.php | 134 + .../Model/GetSubscriptionInfoResponseTest.php | 116 + ...tSubscriptionInfoResponseTierInnerTest.php | 134 + ...MemberResponseMemberContactIdInnerTest.php | 107 + .../GetSubscriptionMemberResponseTest.php | 143 + .../GetTransacAggregatedSmsReportTest.php | 69 +- ...BlockedContactsContactsInnerReasonTest.php | 52 +- ...ransacBlockedContactsContactsInnerTest.php | 58 +- .../Model/GetTransacBlockedContactsTest.php | 44 +- .../GetTransacEmailContentEventsInnerTest.php | 54 +- .../Model/GetTransacEmailContentTest.php | 68 +- .../Model/GetTransacEmailsListTest.php | 44 +- ...EmailsListTransactionalEmailsInnerTest.php | 80 +- .../GetTransacSmsReportReportsInnerTest.php | 79 +- .../Model/GetTransacSmsReportTest.php | 42 +- .../GetUserPermissionPrivilegesInnerTest.php | 54 +- .../Model/GetUserPermissionTest.php | 46 +- tests/Model/GetVersionInfoResponseTest.php | 107 + {test => tests}/Model/GetWebhookTest.php | 60 +- {test => tests}/Model/GetWebhooksTest.php | 42 +- .../Model/GetWhatsAppConfigTest.php | 52 +- .../Model/GetWhatsappCampaignOverviewTest.php | 82 +- ...GetWhatsappCampaignsCampaignsInnerTest.php | 96 +- .../Model/GetWhatsappCampaignsTest.php | 44 +- .../GetWhatsappEventReportEventsInnerTest.php | 80 +- .../Model/GetWhatsappEventReportTest.php | 42 +- ...GetWhatsappTemplatesTemplatesInnerTest.php | 78 +- .../Model/GetWhatsappTemplatesTest.php | 54 +- .../InviteAdminUserPrivilegesInnerTest.php | 52 +- {test => tests}/Model/InviteAdminUserTest.php | 56 +- .../Model/InviteuserPrivilegesInnerTest.php | 52 +- tests/Model/InviteuserResponseTest.php | 98 + {test => tests}/Model/InviteuserTest.php | 46 +- tests/Model/LoyaltyProgramPageTest.php | 89 + tests/Model/LoyaltyProgramTest.php | 143 + .../LoyaltyProgramValidationErrorTest.php | 107 + tests/Model/LoyaltyTierPageTest.php | 89 + ...rDetailsResponseBillingInfoAddressTest.php | 50 +- ...sterDetailsResponseBillingInfoNameTest.php | 44 +- .../MasterDetailsResponseBillingInfoTest.php | 48 +- ...tailsResponsePlanInfoFeaturesInnerTest.php | 64 +- .../MasterDetailsResponsePlanInfoTest.php | 52 +- .../Model/MasterDetailsResponseTest.php | 54 +- {test => tests}/Model/NoteDataTest.php | 48 +- {test => tests}/Model/NoteIdTest.php | 42 +- {test => tests}/Model/NoteTest.php | 62 +- tests/Model/NotificationTest.php | 98 + tests/Model/OfferListTest.php | 89 + tests/Model/OfferTest.php | 143 + tests/Model/OffersListResponseTest.php | 98 + {test => tests}/Model/OrderBatchTest.php | 46 +- {test => tests}/Model/OrderBillingTest.php | 63 +- tests/Model/OrderIdentifiersTest.php | 116 + .../Model/OrderProductsInnerTest.php | 64 +- {test => tests}/Model/OrderTest.php | 71 +- {test => tests}/Model/OtpTest.php | 46 +- .../Model/PatchLoyaltyProgramPayloadTest.php | 107 + {test => tests}/Model/PipelineStageTest.php | 44 +- {test => tests}/Model/PipelineTest.php | 54 +- .../PostContactInfoContactsFailureTest.php | 57 +- .../PostContactInfoContactsSuccessTest.php | 80 + .../Model/PostContactInfoContactsTest.php | 48 +- {test => tests}/Model/PostContactInfoTest.php | 42 +- {test => tests}/Model/PostSendFailedTest.php | 50 +- .../Model/PostSendSmsTestFailedTest.php | 48 +- .../PutRevokeUserPermissionResponseTest.php | 98 + .../Model/PutRevokeUserPermissionTest.php | 42 +- .../PutresendcancelinvitationResponseTest.php | 98 + .../Model/PutresendcancelinvitationTest.php | 42 +- tests/Model/RedeemRewardPayloadTest.php | 125 + ...RewardFailedConditionErrorResponseTest.php | 89 + .../Model/RemoveContactFromListByAllTest.php | 89 + .../RemoveContactFromListByEmailsTest.php | 59 +- .../RemoveContactFromListByExtIDsTest.php | 89 + .../Model/RemoveContactFromListByIDsTest.php | 89 + .../RemoveContactFromListRequestTest.php | 116 + ...stContactExportCustomContactFilterTest.php | 52 +- .../Model/RequestContactExportTest.php | 54 +- .../RequestContactImportJsonBodyInnerTest.php | 54 +- .../Model/RequestContactImportNewListTest.php | 44 +- .../Model/RequestContactImportTest.php | 62 +- .../Model/RequestSmsRecipientExportTest.php | 52 +- tests/Model/RewardAttributionResponseTest.php | 161 + tests/Model/RewardRedeemResponseTest.php | 161 + .../Model/ScheduleSmtpEmailTest.php | 46 +- .../Model/SegmentTest.php | 58 +- {test => tests}/Model/SendReportEmailTest.php | 44 +- {test => tests}/Model/SendReportTest.php | 52 +- {test => tests}/Model/SendSmsTest.php | 50 +- .../SendSmtpEmailAttachmentInnerTest.php | 56 +- tests/Model/SendSmtpEmailBccInnerTest.php | 98 + .../Model/SendSmtpEmailCcInnerTest.php | 65 +- .../SendSmtpEmailMessageVersionsInnerTest.php | 152 + .../Model/SendSmtpEmailReplyToTest.php | 46 +- .../Model/SendSmtpEmailSenderTest.php | 48 +- {test => tests}/Model/SendSmtpEmailTest.php | 72 +- tests/Model/SendSmtpEmailToInnerTest.php | 98 + {test => tests}/Model/SendTestEmailTest.php | 42 +- {test => tests}/Model/SendTestSmsTest.php | 42 +- {test => tests}/Model/SendTransacSmsTest.php | 56 +- .../SendWhatsappMessage201ResponseTest.php | 52 +- .../Model/SendWhatsappMessageRequestTest.php | 125 + .../Model/SendWhatsappMessageTemplateTest.php | 116 + .../Model/SendWhatsappMessageTextTest.php | 74 +- .../Model/SubAccountAppsToggleRequestTest.php | 66 +- ...bAccountDetailsResponseGroupsInnerTest.php | 98 + ...tailsResponsePlanInfoCreditsEmailsTest.php | 44 +- ...sponsePlanInfoCreditsExternalFeedsTest.php | 98 + ...tDetailsResponsePlanInfoCreditsSmsTest.php | 98 + ...ountDetailsResponsePlanInfoCreditsTest.php | 125 + ...ilsResponsePlanInfoCreditsWhatsappTest.php | 98 + ...sponsePlanInfoCreditsWpSubscribersTest.php | 98 + ...tailsResponsePlanInfoFeaturesInboxTest.php | 44 +- ...esponsePlanInfoFeaturesLandingPageTest.php | 44 +- ...untDetailsResponsePlanInfoFeaturesTest.php | 46 +- ...tailsResponsePlanInfoFeaturesUsersTest.php | 44 +- .../SubAccountDetailsResponsePlanInfoTest.php | 46 +- .../Model/SubAccountDetailsResponseTest.php | 57 +- ...SubAccountUpdatePlanRequestCreditsTest.php | 125 + ...ubAccountUpdatePlanRequestFeaturesTest.php | 46 +- .../Model/SubAccountUpdatePlanRequestTest.php | 44 +- ...esponseSubAccountsInnerGroupsInnerTest.php | 98 + ...ubAccountsResponseSubAccountsInnerTest.php | 125 + .../Model/SubAccountsResponseTest.php | 44 +- .../SubscriptionNotFoundErrorResponseTest.php | 89 + {test => tests}/Model/TaskListTest.php | 42 +- {test => tests}/Model/TaskReminderTest.php | 46 +- {test => tests}/Model/TaskTest.php | 64 +- {test => tests}/Model/TaskTypesTest.php | 44 +- tests/Model/TierAccessConditionsInnerTest.php | 116 + tests/Model/TierForContactTest.php | 134 + tests/Model/TierGroupPageTest.php | 89 + tests/Model/TierGroupTest.php | 152 + .../TierRequestAccessConditionsInnerTest.php | 98 + tests/Model/TierRequestTest.php | 107 + .../Model/TierRequestTierRewardsInnerTest.php | 89 + tests/Model/TierTest.php | 161 + tests/Model/TierTierRewardsInnerTest.php | 107 + tests/Model/TransactionTest.php | 179 + tests/Model/UnauthorizedResponseTest.php | 89 + .../UpdateAttributeEnumerationInnerTest.php | 54 +- {test => tests}/Model/UpdateAttributeTest.php | 53 +- .../UpdateBalanceDefinitionPayloadTest.php | 215 + .../UpdateBatchContactsContactsInnerTest.php | 70 +- .../Model/UpdateBatchContactsModelTest.php | 44 +- .../Model/UpdateBatchContactsTest.php | 42 +- .../Model/UpdateCampaignStatusTest.php | 42 +- {test => tests}/Model/UpdateContactTest.php | 54 +- .../UpdateCouponCollection200ResponseTest.php | 56 +- .../UpdateCouponCollectionRequestTest.php | 116 + ...teEmailCampaignEmailExpirationDateTest.php | 98 + .../UpdateEmailCampaignRecipientsTest.php | 46 +- .../Model/UpdateEmailCampaignSenderTest.php | 48 +- .../Model/UpdateEmailCampaignTest.php | 111 +- .../Model/UpdateExternalFeedTest.php | 58 +- {test => tests}/Model/UpdateListTest.php | 44 +- .../Model/UpdateLoyaltyProgramPayloadTest.php | 107 + {test => tests}/Model/UpdateSenderTest.php | 46 +- .../Model/UpdateSmsCampaignTest.php | 56 +- .../Model/UpdateSmtpTemplateSenderTest.php | 48 +- .../Model/UpdateSmtpTemplateTest.php | 60 +- .../Model/UpdateTierGroup404ResponseTest.php | 89 + tests/Model/UpdateTierGroupRequestTest.php | 116 + tests/Model/UpdateUserResponseTest.php | 107 + {test => tests}/Model/UpdateWebhookTest.php | 54 +- .../Model/UpdateWhatsAppCampaignTest.php | 48 +- .../Model/UploadImageModelTest.php | 42 +- .../Model/UploadImageToGalleryTest.php | 44 +- tests/Model/ValidateRewardPayloadTest.php | 116 + tests/Model/ValidatedRewardResponseTest.php | 89 + tests/Model/ValidationErrorTest.php | 89 + {test => tests}/Model/VariablesItemsTest.php | 46 +- tests/Model/VersionInfoTest.php | 152 + .../Model/WhatsappCampStatsTest.php | 50 +- .../Model/WhatsappCampTemplateTest.php | 62 +- 1747 files changed, 201555 insertions(+), 141691 deletions(-) create mode 100644 .openapi-generator/FILES create mode 100644 .openapi-generator/VERSION create mode 100644 .php-cs-fixer.dist.php create mode 100644 .phplint.yml delete mode 100644 docs/Api/AttributesApi.md create mode 100644 docs/Api/BalanceApi.md delete mode 100644 docs/Api/CRMApi.md rename docs/Api/{EventsApi.md => EventApi.md} (57%) delete mode 100644 docs/Api/FoldersApi.md delete mode 100644 docs/Api/ListsApi.md create mode 100644 docs/Api/PaymentsApi.md create mode 100644 docs/Api/ProgramApi.md delete mode 100644 docs/Api/ResellerApi.md create mode 100644 docs/Api/RewardsApi.md create mode 100644 docs/Api/TierApi.md delete mode 100644 docs/Model/AbTestVersionClicks.md delete mode 100644 docs/Model/AddChildDomain.md delete mode 100644 docs/Model/AddContactToList.md create mode 100644 docs/Model/AddContactToListByEmails.md create mode 100644 docs/Model/AddContactToListByExtIDs.md create mode 100644 docs/Model/AddContactToListByIDs.md create mode 100644 docs/Model/AddContactToListRequest.md delete mode 100644 docs/Model/AddCredits.md create mode 100644 docs/Model/AttributeRewardPayload.md create mode 100644 docs/Model/AttributedRewardFailedConditionErrorResponse.md create mode 100644 docs/Model/BadRequestPayload.md create mode 100644 docs/Model/Balance.md create mode 100644 docs/Model/BalanceBalancesInner.md create mode 100644 docs/Model/BalanceDefinition.md create mode 100644 docs/Model/BalanceDefinitionIdDoesNotExist.md create mode 100644 docs/Model/BalanceDefinitionPage.md create mode 100644 docs/Model/BalanceLimit.md create mode 100644 docs/Model/BalanceLimitPayload.md create mode 100644 docs/Model/BalancePage.md delete mode 100644 docs/Model/Body10.md delete mode 100644 docs/Model/Body11.md delete mode 100644 docs/Model/Body12.md delete mode 100644 docs/Model/Body13.md delete mode 100644 docs/Model/Body14.md delete mode 100644 docs/Model/Body2.md delete mode 100644 docs/Model/Body3.md delete mode 100644 docs/Model/Body4.md delete mode 100644 docs/Model/Body5.md delete mode 100644 docs/Model/Body6.md delete mode 100644 docs/Model/Body8.md delete mode 100644 docs/Model/Body9.md delete mode 100644 docs/Model/BodyVariablesItems.md create mode 100644 docs/Model/CancelledTransaction.md create mode 100644 docs/Model/Cart.md create mode 100644 docs/Model/CompaniesIdPatchRequest.md create mode 100644 docs/Model/CompaniesImportPost200Response.md create mode 100644 docs/Model/CompaniesImportPost400Response.md create mode 100644 docs/Model/CompaniesLinkUnlinkIdPatchRequest.md create mode 100644 docs/Model/CompaniesPost200Response.md create mode 100644 docs/Model/CompaniesPostRequest.md delete mode 100644 docs/Model/CompanyAttributes.md create mode 100644 docs/Model/CompleteTransactionPayload.md create mode 100644 docs/Model/CompletedTransaction.md create mode 100644 docs/Model/Configuration.md delete mode 100644 docs/Model/Contact.md create mode 100644 docs/Model/ContactBalances.md create mode 100644 docs/Model/ContactBalancesBalancesInner.md create mode 100644 docs/Model/ContactErrorModel.md create mode 100644 docs/Model/ContactIdInvalidResponse.md create mode 100644 docs/Model/ConversationsAgentOnlinePingPostRequest.md rename docs/Model/{Conversationsmessage.md => ConversationsMessage.md} (53%) create mode 100644 docs/Model/ConversationsMessagesIdPutRequest.md create mode 100644 docs/Model/ConversationsMessagesPostRequest.md create mode 100644 docs/Model/ConversationsPushedMessagesPostRequest.md create mode 100644 docs/Model/ConversionSourceMetrics.md create mode 100644 docs/Model/ConversionSourceProduct.md create mode 100644 docs/Model/CorporateGroupDetailsResponse.md create mode 100644 docs/Model/CorporateGroupDetailsResponseGroup.md create mode 100644 docs/Model/CorporateGroupDetailsResponseSubAccountsInner.md create mode 100644 docs/Model/CorporateGroupDetailsResponseUsersInner.md rename docs/Model/{Body.md => CorporateGroupIdPutRequest.md} (51%) create mode 100644 docs/Model/CorporateGroupPost201Response.md rename docs/Model/{Body1.md => CorporateGroupPostRequest.md} (51%) create mode 100644 docs/Model/CorporateGroupUnlinkGroupIdSubAccountsPutRequest.md create mode 100644 docs/Model/CorporateIpGet200ResponseInner.md create mode 100644 docs/Model/CorporateSsoTokenPostRequest.md create mode 100644 docs/Model/CorporateSubAccountIpAssociatePostRequest.md create mode 100644 docs/Model/CorporateSubAccountIpDissociatePutRequest.md create mode 100644 docs/Model/CorporateSubAccountKeyPostRequest.md create mode 100644 docs/Model/CorporateSubAccountSsoTokenPostRequest.md create mode 100644 docs/Model/CorporateUserEmailPermissionsPutRequest.md create mode 100644 docs/Model/CorporateUserEmailPermissionsPutRequestPrivilegesInner.md create mode 100644 docs/Model/CorporateUserInvitationActionEmailPut200Response.md delete mode 100644 docs/Model/CreateApiKeyRequest.md delete mode 100644 docs/Model/CreateAttributeEnumeration.md create mode 100644 docs/Model/CreateAttributeEnumerationInner.md create mode 100644 docs/Model/CreateBalanceDefinitionPayload.md delete mode 100644 docs/Model/CreateChild.md delete mode 100644 docs/Model/CreateCouponCollection.md create mode 100644 docs/Model/CreateCouponCollection201Response.md create mode 100644 docs/Model/CreateCouponCollectionRequest.md delete mode 100644 docs/Model/CreateCoupons.md create mode 100644 docs/Model/CreateCouponsRequest.md create mode 100644 docs/Model/CreateDoiContactAttributesValue.md create mode 100644 docs/Model/CreateEmailCampaignEmailExpirationDate.md create mode 100644 docs/Model/CreateExternalFeed201Response.md create mode 100644 docs/Model/CreateLoyaltyProgramPayload.md create mode 100644 docs/Model/CreateOrderPayload.md create mode 100644 docs/Model/CreatePaymentRequest.md create mode 100644 docs/Model/CreatePaymentResponse.md delete mode 100644 docs/Model/CreateReseller.md delete mode 100644 docs/Model/CreateSenderIps.md create mode 100644 docs/Model/CreateSenderIpsInner.md create mode 100644 docs/Model/CreateSubscriptionMemberPayload.md create mode 100644 docs/Model/CreateSubscriptionMemberResponse.md create mode 100644 docs/Model/CreateSubscriptionPayload.md create mode 100644 docs/Model/CreateSubscriptionResponse.md create mode 100644 docs/Model/CreateTierGroupRequest.md create mode 100644 docs/Model/CreateTransactionPayload.md create mode 100644 docs/Model/CrmDealsIdPatchRequest.md rename docs/Model/{Body7.md => CrmDealsLinkUnlinkIdPatchRequest.md} (55%) create mode 100644 docs/Model/CrmDealsPost201Response.md create mode 100644 docs/Model/CrmDealsPostRequest.md create mode 100644 docs/Model/CrmTasksIdPatchRequest.md create mode 100644 docs/Model/CrmTasksPost201Response.md create mode 100644 docs/Model/CrmTasksPostRequest.md delete mode 100644 docs/Model/DealAttributes.md create mode 100644 docs/Model/DeleteSubscriptionMemberPayload.md create mode 100644 docs/Model/EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response.md create mode 100644 docs/Model/EcommerceAttributionMetricsGet200Response.md create mode 100644 docs/Model/EcommerceAttributionMetricsGet200ResponseTotals.md create mode 100644 docs/Model/EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response.md create mode 100644 docs/Model/EcommerceConfigDisplayCurrencyGet200Response.md create mode 100644 docs/Model/ErrorResponse.md create mode 100644 docs/Model/EventContactPropertiesValue.md create mode 100644 docs/Model/EventEventPropertiesValue.md create mode 100644 docs/Model/ExportWebhooksHistoryRequest.md delete mode 100644 docs/Model/FileList.md delete mode 100644 docs/Model/GetAccountActivityLogs.md create mode 100644 docs/Model/GetAccountActivityLogsInner.md rename docs/Model/{GetAccountMarketingAutomation.md => GetAccountAllOfMarketingAutomation.md} (58%) create mode 100644 docs/Model/GetAccountAllOfPlan.md create mode 100644 docs/Model/GetAccountAllOfRelay.md create mode 100644 docs/Model/GetAccountAllOfRelayData.md delete mode 100644 docs/Model/GetAccountPlan.md delete mode 100644 docs/Model/GetAccountRelay.md delete mode 100644 docs/Model/GetAccountRelayData.md delete mode 100644 docs/Model/GetAllExternalFeedsFeeds.md create mode 100644 docs/Model/GetAllExternalFeedsFeedsInner.md delete mode 100644 docs/Model/GetAttributesAttributes.md create mode 100644 docs/Model/GetAttributesAttributesInner.md create mode 100644 docs/Model/GetAttributesAttributesInnerEnumerationInner.md delete mode 100644 docs/Model/GetAttributesEnumeration.md delete mode 100644 docs/Model/GetChildAccountCreationStatus.md delete mode 100644 docs/Model/GetChildDomain.md delete mode 100644 docs/Model/GetChildDomains.md delete mode 100644 docs/Model/GetChildInfo.md delete mode 100644 docs/Model/GetChildInfoApiKeys.md delete mode 100644 docs/Model/GetChildInfoApiKeysV2.md delete mode 100644 docs/Model/GetChildInfoApiKeysV3.md delete mode 100644 docs/Model/GetChildInfoCredits.md delete mode 100644 docs/Model/GetChildInfoStatistics.md delete mode 100644 docs/Model/GetChildrenList.md delete mode 100644 docs/Model/GetContactCampaignStatsClicked.md create mode 100644 docs/Model/GetContactCampaignStatsClickedInner.md delete mode 100644 docs/Model/GetContactCampaignStatsOpened.md create mode 100644 docs/Model/GetContactCampaignStatsOpenedInner.md delete mode 100644 docs/Model/GetContactCampaignStatsTransacAttributes.md create mode 100644 docs/Model/GetContactCampaignStatsTransacAttributesInner.md create mode 100644 docs/Model/GetContactInfoIdentifierParameter.md delete mode 100644 docs/Model/GetCorporateInvitedUsersListFeatureAccess.md delete mode 100644 docs/Model/GetCorporateInvitedUsersListGroups.md delete mode 100644 docs/Model/GetCorporateInvitedUsersListUsers.md create mode 100644 docs/Model/GetCorporateInvitedUsersListUsersInner.md create mode 100644 docs/Model/GetCorporateInvitedUsersListUsersInnerFeatureAccess.md create mode 100644 docs/Model/GetCorporateInvitedUsersListUsersInnerGroups.md create mode 100644 docs/Model/GetCorporateUserPermission.md create mode 100644 docs/Model/GetCorporateUserPermissionFeatureAccess.md create mode 100644 docs/Model/GetCorporateUserPermissionGroupsInner.md delete mode 100644 docs/Model/GetDomainsListDomains.md create mode 100644 docs/Model/GetDomainsListDomainsInner.md create mode 100644 docs/Model/GetEmailCampaignsCampaignsInner.md rename docs/Model/{GetEmailEventReportEvents.md => GetEmailEventReportEventsInner.md} (62%) create mode 100644 docs/Model/GetExtendedCampaignOverviewAllOfSender.md delete mode 100644 docs/Model/GetExtendedCampaignOverviewSender.md delete mode 100644 docs/Model/GetExtendedCampaignStatsGlobalStats.md delete mode 100644 docs/Model/GetExtendedClientAddress.md create mode 100644 docs/Model/GetExtendedClientAllOfAddress.md create mode 100644 docs/Model/GetExtendedContactDetailsAllOfStatistics.md create mode 100644 docs/Model/GetExtendedContactDetailsAllOfStatisticsClicked.md create mode 100644 docs/Model/GetExtendedContactDetailsAllOfStatisticsLinks.md create mode 100644 docs/Model/GetExtendedContactDetailsAllOfStatisticsMessagesSent.md create mode 100644 docs/Model/GetExtendedContactDetailsAllOfStatisticsOpened.md create mode 100644 docs/Model/GetExtendedContactDetailsAllOfStatisticsUnsubscriptions.md create mode 100644 docs/Model/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription.md create mode 100644 docs/Model/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription.md delete mode 100644 docs/Model/GetExtendedContactDetailsStatistics.md delete mode 100644 docs/Model/GetExtendedContactDetailsStatisticsClicked.md delete mode 100644 docs/Model/GetExtendedContactDetailsStatisticsDelivered.md delete mode 100644 docs/Model/GetExtendedContactDetailsStatisticsLinks.md delete mode 100644 docs/Model/GetExtendedContactDetailsStatisticsMessagesSent.md delete mode 100644 docs/Model/GetExtendedContactDetailsStatisticsOpened.md delete mode 100644 docs/Model/GetExtendedContactDetailsStatisticsUnsubscriptions.md delete mode 100644 docs/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.md delete mode 100644 docs/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.md create mode 100644 docs/Model/GetExtendedListAllOfCampaignStats.md delete mode 100644 docs/Model/GetExtendedListCampaignStats.md delete mode 100644 docs/Model/GetExternalFeedByUUIDHeaders.md create mode 100644 docs/Model/GetExternalFeedByUUIDHeadersInner.md rename docs/Model/{GetInboundEmailEventsByUuidAttachments.md => GetInboundEmailEventsByUuidAttachmentsInner.md} (52%) delete mode 100644 docs/Model/GetInboundEmailEventsByUuidLogs.md create mode 100644 docs/Model/GetInboundEmailEventsByUuidLogsInner.md delete mode 100644 docs/Model/GetInboundEmailEventsEvents.md create mode 100644 docs/Model/GetInboundEmailEventsEventsInner.md delete mode 100644 docs/Model/GetInvitedUsersListFeatureAccess.md delete mode 100644 docs/Model/GetInvitedUsersListUsers.md create mode 100644 docs/Model/GetInvitedUsersListUsersInner.md create mode 100644 docs/Model/GetInvitedUsersListUsersInnerFeatureAccess.md create mode 100644 docs/Model/GetListsListsInner.md delete mode 100644 docs/Model/GetOrders.md create mode 100644 docs/Model/GetPaymentRequest.md delete mode 100644 docs/Model/GetReportsReports.md create mode 100644 docs/Model/GetReportsReportsInner.md delete mode 100644 docs/Model/GetScheduledEmailByBatchIdBatches.md create mode 100644 docs/Model/GetScheduledEmailByBatchIdBatchesInner.md create mode 100644 docs/Model/GetScheduledEmailById200Response.md delete mode 100644 docs/Model/GetSegmentsSegments.md delete mode 100644 docs/Model/GetSendersListIps.md delete mode 100644 docs/Model/GetSendersListSenders.md create mode 100644 docs/Model/GetSendersListSendersInner.md create mode 100644 docs/Model/GetSendersListSendersInnerIpsInner.md delete mode 100644 docs/Model/GetSmsCampaignRecipients.md create mode 100644 docs/Model/GetSmsCampaignsCampaignsInner.md rename docs/Model/{GetSmsEventReportEvents.md => GetSmsEventReportEventsInner.md} (50%) delete mode 100644 docs/Model/GetStatsByBrowser.md delete mode 100644 docs/Model/GetStatsByDomain.md create mode 100644 docs/Model/GetSubAccountGroups200ResponseInner.md create mode 100644 docs/Model/GetSubscriptionInfoResponse.md create mode 100644 docs/Model/GetSubscriptionInfoResponseBalance.md create mode 100644 docs/Model/GetSubscriptionInfoResponseBalanceBalancesInner.md create mode 100644 docs/Model/GetSubscriptionInfoResponseMembersInner.md create mode 100644 docs/Model/GetSubscriptionInfoResponseRewardInner.md create mode 100644 docs/Model/GetSubscriptionInfoResponseTierInner.md create mode 100644 docs/Model/GetSubscriptionMemberResponse.md create mode 100644 docs/Model/GetSubscriptionMemberResponseMemberContactIdInner.md delete mode 100644 docs/Model/GetTransacBlockedContactsContacts.md create mode 100644 docs/Model/GetTransacBlockedContactsContactsInner.md create mode 100644 docs/Model/GetTransacBlockedContactsContactsInnerReason.md delete mode 100644 docs/Model/GetTransacBlockedContactsReason.md delete mode 100644 docs/Model/GetTransacEmailContentEvents.md create mode 100644 docs/Model/GetTransacEmailContentEventsInner.md delete mode 100644 docs/Model/GetTransacEmailsListTransactionalEmails.md create mode 100644 docs/Model/GetTransacEmailsListTransactionalEmailsInner.md rename docs/Model/{GetTransacSmsReportReports.md => GetTransacSmsReportReportsInner.md} (50%) delete mode 100644 docs/Model/GetUserPermissionPrivileges.md create mode 100644 docs/Model/GetUserPermissionPrivilegesInner.md create mode 100644 docs/Model/GetVersionInfoResponse.md delete mode 100644 docs/Model/GetWATemplates.md delete mode 100644 docs/Model/GetWATemplatesTemplates.md delete mode 100644 docs/Model/GetWebhookAuth.md delete mode 100644 docs/Model/GetWebhookHeaders.md delete mode 100644 docs/Model/GetWhatsappCampaignsCampaigns.md create mode 100644 docs/Model/GetWhatsappCampaignsCampaignsInner.md rename docs/Model/{GetWhatsappEventReportEvents.md => GetWhatsappEventReportEventsInner.md} (63%) create mode 100644 docs/Model/GetWhatsappTemplates.md create mode 100644 docs/Model/GetWhatsappTemplatesTemplatesInner.md delete mode 100644 docs/Model/InlineResponse200.md delete mode 100644 docs/Model/InlineResponse2001.md delete mode 100644 docs/Model/InlineResponse2002.md delete mode 100644 docs/Model/InlineResponse201.md delete mode 100644 docs/Model/InlineResponse2011.md delete mode 100644 docs/Model/InlineResponse2012.md delete mode 100644 docs/Model/InlineResponse2013.md delete mode 100644 docs/Model/InlineResponse2014.md delete mode 100644 docs/Model/InlineResponse2015.md delete mode 100644 docs/Model/InviteAdminUserPrivileges.md create mode 100644 docs/Model/InviteAdminUserPrivilegesInner.md delete mode 100644 docs/Model/InviteuserPrivileges.md create mode 100644 docs/Model/InviteuserPrivilegesInner.md create mode 100644 docs/Model/InviteuserResponse.md create mode 100644 docs/Model/LoyaltyProgram.md create mode 100644 docs/Model/LoyaltyProgramPage.md create mode 100644 docs/Model/LoyaltyProgramValidationError.md create mode 100644 docs/Model/LoyaltyTierPage.md delete mode 100644 docs/Model/ManageIp.md rename docs/Model/{MasterDetailsResponsePlanInfoFeatures.md => MasterDetailsResponsePlanInfoFeaturesInner.md} (54%) delete mode 100644 docs/Model/NoteList.md create mode 100644 docs/Model/Notification.md create mode 100644 docs/Model/Offer.md create mode 100644 docs/Model/OfferList.md create mode 100644 docs/Model/OffersListResponse.md create mode 100644 docs/Model/OrderIdentifiers.md delete mode 100644 docs/Model/OrderProducts.md create mode 100644 docs/Model/OrderProductsInner.md create mode 100644 docs/Model/PatchLoyaltyProgramPayload.md delete mode 100644 docs/Model/Pipelines.md create mode 100644 docs/Model/PostContactInfoContactsFailure.md create mode 100644 docs/Model/PostContactInfoContactsSuccess.md create mode 100644 docs/Model/PutRevokeUserPermissionResponse.md create mode 100644 docs/Model/PutresendcancelinvitationResponse.md create mode 100644 docs/Model/RedeemRewardPayload.md create mode 100644 docs/Model/RedeemedRewardFailedConditionErrorResponse.md delete mode 100644 docs/Model/RemainingCreditModel.md delete mode 100644 docs/Model/RemainingCreditModelChild.md delete mode 100644 docs/Model/RemainingCreditModelReseller.md delete mode 100644 docs/Model/RemoveContactFromList.md create mode 100644 docs/Model/RemoveContactFromListByAll.md create mode 100644 docs/Model/RemoveContactFromListByEmails.md create mode 100644 docs/Model/RemoveContactFromListByExtIDs.md create mode 100644 docs/Model/RemoveContactFromListByIDs.md create mode 100644 docs/Model/RemoveContactFromListRequest.md delete mode 100644 docs/Model/RemoveCredits.md delete mode 100644 docs/Model/RequestContactImportJsonBody.md create mode 100644 docs/Model/RequestContactImportJsonBodyInner.md create mode 100644 docs/Model/RewardAttributionResponse.md create mode 100644 docs/Model/RewardRedeemResponse.md create mode 100644 docs/Model/Segment.md delete mode 100644 docs/Model/SendSmtpEmailAttachment.md create mode 100644 docs/Model/SendSmtpEmailAttachmentInner.md delete mode 100644 docs/Model/SendSmtpEmailBcc.md create mode 100644 docs/Model/SendSmtpEmailBccInner.md delete mode 100644 docs/Model/SendSmtpEmailCc.md create mode 100644 docs/Model/SendSmtpEmailCcInner.md delete mode 100644 docs/Model/SendSmtpEmailMessageVersions.md create mode 100644 docs/Model/SendSmtpEmailMessageVersionsInner.md delete mode 100644 docs/Model/SendSmtpEmailReplyTo1.md delete mode 100644 docs/Model/SendSmtpEmailTo.md delete mode 100644 docs/Model/SendSmtpEmailTo1.md create mode 100644 docs/Model/SendSmtpEmailToInner.md create mode 100644 docs/Model/SendWhatsappMessage201Response.md rename docs/Model/{SendWhatsappMessage.md => SendWhatsappMessageRequest.md} (50%) create mode 100644 docs/Model/SendWhatsappMessageTemplate.md create mode 100644 docs/Model/SendWhatsappMessageText.md delete mode 100644 docs/Model/SsoTokenRequest.md create mode 100644 docs/Model/SubAccountDetailsResponseGroupsInner.md create mode 100644 docs/Model/SubAccountDetailsResponsePlanInfoCreditsExternalFeeds.md create mode 100644 docs/Model/SubAccountDetailsResponsePlanInfoCreditsSms.md create mode 100644 docs/Model/SubAccountDetailsResponsePlanInfoCreditsWhatsapp.md create mode 100644 docs/Model/SubAccountDetailsResponsePlanInfoCreditsWpSubscribers.md delete mode 100644 docs/Model/SubAccountsResponseSubAccounts.md create mode 100644 docs/Model/SubAccountsResponseSubAccountsInner.md create mode 100644 docs/Model/SubAccountsResponseSubAccountsInnerGroupsInner.md create mode 100644 docs/Model/SubscriptionNotFoundErrorResponse.md create mode 100644 docs/Model/Tier.md create mode 100644 docs/Model/TierAccessConditionsInner.md create mode 100644 docs/Model/TierForContact.md create mode 100644 docs/Model/TierGroup.md create mode 100644 docs/Model/TierGroupPage.md create mode 100644 docs/Model/TierRequest.md create mode 100644 docs/Model/TierRequestAccessConditionsInner.md create mode 100644 docs/Model/TierRequestTierRewardsInner.md create mode 100644 docs/Model/TierTierRewardsInner.md create mode 100644 docs/Model/Transaction.md create mode 100644 docs/Model/UnauthorizedResponse.md delete mode 100644 docs/Model/UpdateAttributeEnumeration.md create mode 100644 docs/Model/UpdateAttributeEnumerationInner.md create mode 100644 docs/Model/UpdateBalanceDefinitionPayload.md rename docs/Model/{UpdateBatchContactsContacts.md => UpdateBatchContactsContactsInner.md} (50%) delete mode 100644 docs/Model/UpdateChild.md delete mode 100644 docs/Model/UpdateChildAccountStatus.md delete mode 100644 docs/Model/UpdateChildDomain.md delete mode 100644 docs/Model/UpdateCouponCollection.md create mode 100644 docs/Model/UpdateCouponCollection200Response.md create mode 100644 docs/Model/UpdateCouponCollectionRequest.md create mode 100644 docs/Model/UpdateEmailCampaignEmailExpirationDate.md create mode 100644 docs/Model/UpdateLoyaltyProgramPayload.md create mode 100644 docs/Model/UpdateTierGroup404Response.md create mode 100644 docs/Model/UpdateTierGroupRequest.md create mode 100644 docs/Model/UpdateUserResponse.md create mode 100644 docs/Model/ValidateRewardPayload.md create mode 100644 docs/Model/ValidatedRewardResponse.md create mode 100644 docs/Model/ValidationError.md create mode 100644 docs/Model/VersionInfo.md create mode 100644 git_push.sh delete mode 100644 lib/Api/AttributesApi.php create mode 100644 lib/Api/BalanceApi.php delete mode 100644 lib/Api/CRMApi.php rename lib/Api/{EventsApi.php => EventApi.php} (52%) delete mode 100644 lib/Api/FoldersApi.php delete mode 100644 lib/Api/ListsApi.php create mode 100644 lib/Api/PaymentsApi.php create mode 100644 lib/Api/ProgramApi.php delete mode 100644 lib/Api/ResellerApi.php create mode 100644 lib/Api/RewardsApi.php create mode 100644 lib/Api/TierApi.php delete mode 100644 lib/Models/AbTestVersionClicks.php create mode 100644 lib/Models/AbstractModel.php delete mode 100644 lib/Models/AddChildDomain.php delete mode 100644 lib/Models/AddContactToList.php create mode 100644 lib/Models/AddContactToListByEmails.php create mode 100644 lib/Models/AddContactToListByExtIDs.php create mode 100644 lib/Models/AddContactToListByIDs.php create mode 100644 lib/Models/AddContactToListRequest.php delete mode 100644 lib/Models/AddCredits.php create mode 100644 lib/Models/AttributeRewardPayload.php create mode 100644 lib/Models/AttributedRewardFailedConditionErrorResponse.php create mode 100644 lib/Models/BadRequestPayload.php create mode 100644 lib/Models/Balance.php create mode 100644 lib/Models/BalanceBalancesInner.php create mode 100644 lib/Models/BalanceDefinition.php create mode 100644 lib/Models/BalanceDefinitionIdDoesNotExist.php create mode 100644 lib/Models/BalanceDefinitionPage.php create mode 100644 lib/Models/BalanceLimit.php create mode 100644 lib/Models/BalanceLimitPayload.php create mode 100644 lib/Models/BalancePage.php delete mode 100644 lib/Models/Body.php delete mode 100644 lib/Models/Body1.php delete mode 100644 lib/Models/Body10.php delete mode 100644 lib/Models/Body11.php delete mode 100644 lib/Models/Body12.php delete mode 100644 lib/Models/Body13.php delete mode 100644 lib/Models/Body14.php delete mode 100644 lib/Models/Body2.php delete mode 100644 lib/Models/Body3.php delete mode 100644 lib/Models/Body4.php delete mode 100644 lib/Models/Body5.php delete mode 100644 lib/Models/Body6.php delete mode 100644 lib/Models/Body7.php delete mode 100644 lib/Models/Body9.php delete mode 100644 lib/Models/BodyVariablesItems.php create mode 100644 lib/Models/CancelledTransaction.php create mode 100644 lib/Models/Cart.php create mode 100644 lib/Models/CompaniesIdPatchRequest.php create mode 100644 lib/Models/CompaniesImportPost200Response.php create mode 100644 lib/Models/CompaniesImportPost400Response.php create mode 100644 lib/Models/CompaniesLinkUnlinkIdPatchRequest.php create mode 100644 lib/Models/CompaniesPost200Response.php create mode 100644 lib/Models/CompaniesPostRequest.php delete mode 100644 lib/Models/CompanyAttributes.php create mode 100644 lib/Models/CompleteTransactionPayload.php create mode 100644 lib/Models/CompletedTransaction.php create mode 100644 lib/Models/Configuration.php delete mode 100644 lib/Models/Contact.php create mode 100644 lib/Models/ContactBalances.php create mode 100644 lib/Models/ContactBalancesBalancesInner.php create mode 100644 lib/Models/ContactErrorModel.php create mode 100644 lib/Models/ContactIdInvalidResponse.php create mode 100644 lib/Models/ConversationsAgentOnlinePingPostRequest.php create mode 100644 lib/Models/ConversationsMessagesIdPutRequest.php create mode 100644 lib/Models/ConversationsMessagesPostRequest.php create mode 100644 lib/Models/ConversationsPushedMessagesPostRequest.php create mode 100644 lib/Models/ConversionSourceMetrics.php create mode 100644 lib/Models/ConversionSourceProduct.php create mode 100644 lib/Models/CorporateGroupDetailsResponse.php create mode 100644 lib/Models/CorporateGroupDetailsResponseGroup.php create mode 100644 lib/Models/CorporateGroupDetailsResponseSubAccountsInner.php create mode 100644 lib/Models/CorporateGroupDetailsResponseUsersInner.php create mode 100644 lib/Models/CorporateGroupIdPutRequest.php create mode 100644 lib/Models/CorporateGroupPost201Response.php create mode 100644 lib/Models/CorporateGroupPostRequest.php create mode 100644 lib/Models/CorporateGroupUnlinkGroupIdSubAccountsPutRequest.php create mode 100644 lib/Models/CorporateIpGet200ResponseInner.php create mode 100644 lib/Models/CorporateSsoTokenPostRequest.php create mode 100644 lib/Models/CorporateSubAccountIpAssociatePostRequest.php create mode 100644 lib/Models/CorporateSubAccountIpDissociatePutRequest.php create mode 100644 lib/Models/CorporateSubAccountKeyPostRequest.php create mode 100644 lib/Models/CorporateSubAccountSsoTokenPostRequest.php create mode 100644 lib/Models/CorporateUserEmailPermissionsPutRequest.php create mode 100644 lib/Models/CorporateUserEmailPermissionsPutRequestPrivilegesInner.php create mode 100644 lib/Models/CorporateUserInvitationActionEmailPut200Response.php delete mode 100644 lib/Models/CreateApiKeyRequest.php delete mode 100644 lib/Models/CreateAttributeEnumeration.php create mode 100644 lib/Models/CreateAttributeEnumerationInner.php create mode 100644 lib/Models/CreateBalanceDefinitionPayload.php delete mode 100644 lib/Models/CreateChild.php delete mode 100644 lib/Models/CreateCouponCollection.php create mode 100644 lib/Models/CreateCouponCollection201Response.php create mode 100644 lib/Models/CreateCouponCollectionRequest.php delete mode 100644 lib/Models/CreateCoupons.php create mode 100644 lib/Models/CreateCouponsRequest.php create mode 100644 lib/Models/CreateDoiContactAttributesValue.php create mode 100644 lib/Models/CreateEmailCampaignEmailExpirationDate.php create mode 100644 lib/Models/CreateExternalFeed201Response.php create mode 100644 lib/Models/CreateLoyaltyProgramPayload.php create mode 100644 lib/Models/CreateOrderPayload.php create mode 100644 lib/Models/CreatePaymentRequest.php create mode 100644 lib/Models/CreatePaymentResponse.php delete mode 100644 lib/Models/CreateReseller.php delete mode 100644 lib/Models/CreateSenderIps.php create mode 100644 lib/Models/CreateSenderIpsInner.php create mode 100644 lib/Models/CreateSubscriptionMemberPayload.php create mode 100644 lib/Models/CreateSubscriptionMemberResponse.php create mode 100644 lib/Models/CreateSubscriptionPayload.php create mode 100644 lib/Models/CreateSubscriptionResponse.php create mode 100644 lib/Models/CreateTierGroupRequest.php create mode 100644 lib/Models/CreateTransactionPayload.php create mode 100644 lib/Models/CrmDealsIdPatchRequest.php create mode 100644 lib/Models/CrmDealsLinkUnlinkIdPatchRequest.php create mode 100644 lib/Models/CrmDealsPost201Response.php create mode 100644 lib/Models/CrmDealsPostRequest.php create mode 100644 lib/Models/CrmTasksIdPatchRequest.php create mode 100644 lib/Models/CrmTasksPost201Response.php rename lib/Models/{Body8.php => CrmTasksPostRequest.php} (54%) delete mode 100644 lib/Models/DealAttributes.php create mode 100644 lib/Models/DeleteSubscriptionMemberPayload.php create mode 100644 lib/Models/EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response.php create mode 100644 lib/Models/EcommerceAttributionMetricsGet200Response.php create mode 100644 lib/Models/EcommerceAttributionMetricsGet200ResponseTotals.php create mode 100644 lib/Models/EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response.php create mode 100644 lib/Models/EcommerceConfigDisplayCurrencyGet200Response.php create mode 100644 lib/Models/ErrorResponse.php create mode 100644 lib/Models/EventContactPropertiesValue.php create mode 100644 lib/Models/EventEventPropertiesValue.php create mode 100644 lib/Models/ExportWebhooksHistoryRequest.php delete mode 100644 lib/Models/FileList.php rename lib/Models/{GetAccountActivityLogs.php => GetAccountActivityLogsInner.php} (53%) create mode 100644 lib/Models/GetAccountAllOfMarketingAutomation.php rename lib/Models/{GetAccountPlan.php => GetAccountAllOfPlan.php} (50%) create mode 100644 lib/Models/GetAccountAllOfRelay.php create mode 100644 lib/Models/GetAccountAllOfRelayData.php delete mode 100644 lib/Models/GetAccountMarketingAutomation.php delete mode 100644 lib/Models/GetAccountRelay.php delete mode 100644 lib/Models/GetAccountRelayData.php rename lib/Models/{GetAllExternalFeedsFeeds.php => GetAllExternalFeedsFeedsInner.php} (58%) rename lib/Models/{GetAttributesAttributes.php => GetAttributesAttributesInner.php} (52%) create mode 100644 lib/Models/GetAttributesAttributesInnerEnumerationInner.php delete mode 100644 lib/Models/GetAttributesEnumeration.php delete mode 100644 lib/Models/GetChildAccountCreationStatus.php delete mode 100644 lib/Models/GetChildDomain.php delete mode 100644 lib/Models/GetChildDomains.php delete mode 100644 lib/Models/GetChildInfo.php delete mode 100644 lib/Models/GetChildInfoApiKeys.php delete mode 100644 lib/Models/GetChildInfoApiKeysV2.php delete mode 100644 lib/Models/GetChildInfoApiKeysV3.php delete mode 100644 lib/Models/GetChildInfoCredits.php delete mode 100644 lib/Models/GetChildInfoStatistics.php delete mode 100644 lib/Models/GetChildrenList.php delete mode 100644 lib/Models/GetContactCampaignStatsClicked.php create mode 100644 lib/Models/GetContactCampaignStatsClickedInner.php rename lib/Models/{GetContactCampaignStatsOpened.php => GetContactCampaignStatsOpenedInner.php} (51%) delete mode 100644 lib/Models/GetContactCampaignStatsTransacAttributes.php create mode 100644 lib/Models/GetContactCampaignStatsTransacAttributesInner.php create mode 100644 lib/Models/GetContactInfoIdentifierParameter.php delete mode 100644 lib/Models/GetCorporateInvitedUsersListFeatureAccess.php delete mode 100644 lib/Models/GetCorporateInvitedUsersListGroups.php delete mode 100644 lib/Models/GetCorporateInvitedUsersListUsers.php create mode 100644 lib/Models/GetCorporateInvitedUsersListUsersInner.php create mode 100644 lib/Models/GetCorporateInvitedUsersListUsersInnerFeatureAccess.php create mode 100644 lib/Models/GetCorporateInvitedUsersListUsersInnerGroups.php create mode 100644 lib/Models/GetCorporateUserPermission.php create mode 100644 lib/Models/GetCorporateUserPermissionFeatureAccess.php create mode 100644 lib/Models/GetCorporateUserPermissionGroupsInner.php rename lib/Models/{GetDomainsListDomains.php => GetDomainsListDomainsInner.php} (52%) create mode 100644 lib/Models/GetEmailCampaignsCampaignsInner.php rename lib/Models/{GetEmailEventReportEvents.php => GetEmailEventReportEventsInner.php} (54%) create mode 100644 lib/Models/GetExtendedCampaignOverviewAllOfSender.php delete mode 100644 lib/Models/GetExtendedCampaignOverviewSender.php delete mode 100644 lib/Models/GetExtendedCampaignStatsGlobalStats.php rename lib/Models/{GetExtendedClientAddress.php => GetExtendedClientAllOfAddress.php} (51%) create mode 100644 lib/Models/GetExtendedContactDetailsAllOfStatistics.php create mode 100644 lib/Models/GetExtendedContactDetailsAllOfStatisticsClicked.php rename lib/Models/{GetExtendedContactDetailsStatisticsLinks.php => GetExtendedContactDetailsAllOfStatisticsLinks.php} (50%) create mode 100644 lib/Models/GetExtendedContactDetailsAllOfStatisticsMessagesSent.php rename lib/Models/{GetExtendedContactDetailsStatisticsOpened.php => GetExtendedContactDetailsAllOfStatisticsOpened.php} (51%) create mode 100644 lib/Models/GetExtendedContactDetailsAllOfStatisticsUnsubscriptions.php create mode 100644 lib/Models/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription.php create mode 100644 lib/Models/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription.php delete mode 100644 lib/Models/GetExtendedContactDetailsStatistics.php delete mode 100644 lib/Models/GetExtendedContactDetailsStatisticsClicked.php delete mode 100644 lib/Models/GetExtendedContactDetailsStatisticsDelivered.php delete mode 100644 lib/Models/GetExtendedContactDetailsStatisticsMessagesSent.php delete mode 100644 lib/Models/GetExtendedContactDetailsStatisticsUnsubscriptions.php delete mode 100644 lib/Models/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.php delete mode 100644 lib/Models/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.php create mode 100644 lib/Models/GetExtendedListAllOfCampaignStats.php delete mode 100644 lib/Models/GetExtendedListCampaignStats.php delete mode 100644 lib/Models/GetExternalFeedByUUIDHeaders.php create mode 100644 lib/Models/GetExternalFeedByUUIDHeadersInner.php delete mode 100644 lib/Models/GetInboundEmailEventsByUuidAttachments.php create mode 100644 lib/Models/GetInboundEmailEventsByUuidAttachmentsInner.php delete mode 100644 lib/Models/GetInboundEmailEventsByUuidLogs.php create mode 100644 lib/Models/GetInboundEmailEventsByUuidLogsInner.php rename lib/Models/{GetInboundEmailEventsEvents.php => GetInboundEmailEventsEventsInner.php} (51%) delete mode 100644 lib/Models/GetInvitedUsersListFeatureAccess.php rename lib/Models/{GetInvitedUsersListUsers.php => GetInvitedUsersListUsersInner.php} (50%) create mode 100644 lib/Models/GetInvitedUsersListUsersInnerFeatureAccess.php create mode 100644 lib/Models/GetListsListsInner.php delete mode 100644 lib/Models/GetOrders.php create mode 100644 lib/Models/GetPaymentRequest.php rename lib/Models/{GetReportsReports.php => GetReportsReportsInner.php} (63%) rename lib/Models/{GetScheduledEmailByBatchIdBatches.php => GetScheduledEmailByBatchIdBatchesInner.php} (51%) create mode 100644 lib/Models/GetScheduledEmailById200Response.php delete mode 100644 lib/Models/GetSegmentsSegments.php delete mode 100644 lib/Models/GetSendersListIps.php rename lib/Models/{GetSendersListSenders.php => GetSendersListSendersInner.php} (50%) create mode 100644 lib/Models/GetSendersListSendersInnerIpsInner.php delete mode 100644 lib/Models/GetSmsCampaignRecipients.php create mode 100644 lib/Models/GetSmsCampaignsCampaignsInner.php delete mode 100644 lib/Models/GetSmsEventReportEvents.php create mode 100644 lib/Models/GetSmsEventReportEventsInner.php delete mode 100644 lib/Models/GetStatsByBrowser.php delete mode 100644 lib/Models/GetStatsByDomain.php create mode 100644 lib/Models/GetSubAccountGroups200ResponseInner.php create mode 100644 lib/Models/GetSubscriptionInfoResponse.php create mode 100644 lib/Models/GetSubscriptionInfoResponseBalance.php create mode 100644 lib/Models/GetSubscriptionInfoResponseBalanceBalancesInner.php create mode 100644 lib/Models/GetSubscriptionInfoResponseMembersInner.php create mode 100644 lib/Models/GetSubscriptionInfoResponseRewardInner.php create mode 100644 lib/Models/GetSubscriptionInfoResponseTierInner.php create mode 100644 lib/Models/GetSubscriptionMemberResponse.php create mode 100644 lib/Models/GetSubscriptionMemberResponseMemberContactIdInner.php rename lib/Models/{GetTransacBlockedContactsContacts.php => GetTransacBlockedContactsContactsInner.php} (50%) create mode 100644 lib/Models/GetTransacBlockedContactsContactsInnerReason.php delete mode 100644 lib/Models/GetTransacBlockedContactsReason.php delete mode 100644 lib/Models/GetTransacEmailContentEvents.php create mode 100644 lib/Models/GetTransacEmailContentEventsInner.php rename lib/Models/{GetTransacEmailsListTransactionalEmails.php => GetTransacEmailsListTransactionalEmailsInner.php} (54%) delete mode 100644 lib/Models/GetTransacSmsReportReports.php create mode 100644 lib/Models/GetTransacSmsReportReportsInner.php delete mode 100644 lib/Models/GetUserPermissionPrivileges.php create mode 100644 lib/Models/GetUserPermissionPrivilegesInner.php create mode 100644 lib/Models/GetVersionInfoResponse.php delete mode 100644 lib/Models/GetWATemplates.php delete mode 100644 lib/Models/GetWebhookAuth.php delete mode 100644 lib/Models/GetWebhookHeaders.php rename lib/Models/{GetWhatsappCampaignsCampaigns.php => GetWhatsappCampaignsCampaignsInner.php} (56%) rename lib/Models/{GetWhatsappEventReportEvents.php => GetWhatsappEventReportEventsInner.php} (53%) create mode 100644 lib/Models/GetWhatsappTemplates.php rename lib/Models/{GetWATemplatesTemplates.php => GetWhatsappTemplatesTemplatesInner.php} (52%) delete mode 100644 lib/Models/InlineResponse200.php delete mode 100644 lib/Models/InlineResponse2001.php delete mode 100644 lib/Models/InlineResponse2002.php delete mode 100644 lib/Models/InlineResponse201.php delete mode 100644 lib/Models/InlineResponse2011.php delete mode 100644 lib/Models/InlineResponse2012.php delete mode 100644 lib/Models/InlineResponse2013.php delete mode 100644 lib/Models/InlineResponse2014.php delete mode 100644 lib/Models/InlineResponse2015.php delete mode 100644 lib/Models/InviteAdminUserPrivileges.php create mode 100644 lib/Models/InviteAdminUserPrivilegesInner.php delete mode 100644 lib/Models/InviteuserPrivileges.php create mode 100644 lib/Models/InviteuserPrivilegesInner.php create mode 100644 lib/Models/InviteuserResponse.php create mode 100644 lib/Models/LoyaltyProgram.php create mode 100644 lib/Models/LoyaltyProgramPage.php create mode 100644 lib/Models/LoyaltyProgramValidationError.php create mode 100644 lib/Models/LoyaltyTierPage.php delete mode 100644 lib/Models/ManageIp.php delete mode 100644 lib/Models/MasterDetailsResponsePlanInfoFeatures.php create mode 100644 lib/Models/MasterDetailsResponsePlanInfoFeaturesInner.php delete mode 100644 lib/Models/NoteList.php create mode 100644 lib/Models/Notification.php create mode 100644 lib/Models/Offer.php create mode 100644 lib/Models/OfferList.php create mode 100644 lib/Models/OffersListResponse.php create mode 100644 lib/Models/OrderIdentifiers.php delete mode 100644 lib/Models/OrderProducts.php create mode 100644 lib/Models/OrderProductsInner.php create mode 100644 lib/Models/PatchLoyaltyProgramPayload.php delete mode 100644 lib/Models/Pipelines.php create mode 100644 lib/Models/PostContactInfoContactsFailure.php create mode 100644 lib/Models/PostContactInfoContactsSuccess.php create mode 100644 lib/Models/PutRevokeUserPermissionResponse.php create mode 100644 lib/Models/PutresendcancelinvitationResponse.php create mode 100644 lib/Models/RedeemRewardPayload.php create mode 100644 lib/Models/RedeemedRewardFailedConditionErrorResponse.php delete mode 100644 lib/Models/RemainingCreditModel.php delete mode 100644 lib/Models/RemainingCreditModelChild.php delete mode 100644 lib/Models/RemainingCreditModelReseller.php delete mode 100644 lib/Models/RemoveContactFromList.php create mode 100644 lib/Models/RemoveContactFromListByAll.php create mode 100644 lib/Models/RemoveContactFromListByEmails.php create mode 100644 lib/Models/RemoveContactFromListByExtIDs.php create mode 100644 lib/Models/RemoveContactFromListByIDs.php create mode 100644 lib/Models/RemoveContactFromListRequest.php delete mode 100644 lib/Models/RemoveCredits.php delete mode 100644 lib/Models/RequestContactImportJsonBody.php create mode 100644 lib/Models/RequestContactImportJsonBodyInner.php create mode 100644 lib/Models/RewardAttributionResponse.php create mode 100644 lib/Models/RewardRedeemResponse.php create mode 100644 lib/Models/Segment.php delete mode 100644 lib/Models/SendSmtpEmailAttachment.php create mode 100644 lib/Models/SendSmtpEmailAttachmentInner.php delete mode 100644 lib/Models/SendSmtpEmailBcc.php create mode 100644 lib/Models/SendSmtpEmailBccInner.php delete mode 100644 lib/Models/SendSmtpEmailCc.php create mode 100644 lib/Models/SendSmtpEmailCcInner.php delete mode 100644 lib/Models/SendSmtpEmailMessageVersions.php create mode 100644 lib/Models/SendSmtpEmailMessageVersionsInner.php delete mode 100644 lib/Models/SendSmtpEmailReplyTo1.php delete mode 100644 lib/Models/SendSmtpEmailTo.php delete mode 100644 lib/Models/SendSmtpEmailTo1.php create mode 100644 lib/Models/SendSmtpEmailToInner.php delete mode 100644 lib/Models/SendWhatsappMessage.php create mode 100644 lib/Models/SendWhatsappMessage201Response.php create mode 100644 lib/Models/SendWhatsappMessageRequest.php create mode 100644 lib/Models/SendWhatsappMessageTemplate.php create mode 100644 lib/Models/SendWhatsappMessageText.php delete mode 100644 lib/Models/SsoTokenRequest.php create mode 100644 lib/Models/SubAccountDetailsResponseGroupsInner.php create mode 100644 lib/Models/SubAccountDetailsResponsePlanInfoCreditsExternalFeeds.php create mode 100644 lib/Models/SubAccountDetailsResponsePlanInfoCreditsSms.php create mode 100644 lib/Models/SubAccountDetailsResponsePlanInfoCreditsWhatsapp.php create mode 100644 lib/Models/SubAccountDetailsResponsePlanInfoCreditsWpSubscribers.php rename lib/Models/{SubAccountsResponseSubAccounts.php => SubAccountsResponseSubAccountsInner.php} (50%) create mode 100644 lib/Models/SubAccountsResponseSubAccountsInnerGroupsInner.php create mode 100644 lib/Models/SubscriptionNotFoundErrorResponse.php create mode 100644 lib/Models/Tier.php create mode 100644 lib/Models/TierAccessConditionsInner.php create mode 100644 lib/Models/TierForContact.php create mode 100644 lib/Models/TierGroup.php create mode 100644 lib/Models/TierGroupPage.php create mode 100644 lib/Models/TierRequest.php create mode 100644 lib/Models/TierRequestAccessConditionsInner.php create mode 100644 lib/Models/TierRequestTierRewardsInner.php create mode 100644 lib/Models/TierTierRewardsInner.php create mode 100644 lib/Models/Transaction.php create mode 100644 lib/Models/UnauthorizedResponse.php delete mode 100644 lib/Models/UpdateAttributeEnumeration.php create mode 100644 lib/Models/UpdateAttributeEnumerationInner.php create mode 100644 lib/Models/UpdateBalanceDefinitionPayload.php delete mode 100644 lib/Models/UpdateBatchContactsContacts.php create mode 100644 lib/Models/UpdateBatchContactsContactsInner.php delete mode 100644 lib/Models/UpdateChild.php delete mode 100644 lib/Models/UpdateChildAccountStatus.php delete mode 100644 lib/Models/UpdateChildDomain.php delete mode 100644 lib/Models/UpdateCouponCollection.php create mode 100644 lib/Models/UpdateCouponCollection200Response.php create mode 100644 lib/Models/UpdateCouponCollectionRequest.php create mode 100644 lib/Models/UpdateEmailCampaignEmailExpirationDate.php create mode 100644 lib/Models/UpdateLoyaltyProgramPayload.php create mode 100644 lib/Models/UpdateTierGroup404Response.php create mode 100644 lib/Models/UpdateTierGroupRequest.php create mode 100644 lib/Models/UpdateUserResponse.php create mode 100644 lib/Models/ValidateRewardPayload.php create mode 100644 lib/Models/ValidatedRewardResponse.php create mode 100644 lib/Models/ValidationError.php create mode 100644 lib/Models/VersionInfo.php delete mode 100644 test/Api/AttributesApiTest.php delete mode 100644 test/Api/CRMApiTest.php delete mode 100644 test/Api/EcommerceApiTest.php delete mode 100644 test/Api/FoldersApiTest.php delete mode 100644 test/Api/ListsApiTest.php delete mode 100644 test/Api/MasterAccountApiTest.php delete mode 100644 test/Api/ResellerApiTest.php delete mode 100644 test/Model/AbTestVersionClicksTest.php delete mode 100644 test/Model/Body5Test.php delete mode 100644 test/Model/Body6Test.php delete mode 100644 test/Model/BodyVariablesItemsTest.php delete mode 100644 test/Model/CompanyAttributesTest.php delete mode 100644 test/Model/ContactTest.php delete mode 100644 test/Model/CreateCouponCollectionTest.php delete mode 100644 test/Model/DealAttributesTest.php delete mode 100644 test/Model/FIleListTest.php delete mode 100644 test/Model/GetAccountTest.php delete mode 100644 test/Model/GetChildAccountCreationStatusTest.php delete mode 100644 test/Model/GetChildDomainTest.php delete mode 100644 test/Model/GetChildDomainsTest.php delete mode 100644 test/Model/GetChildInfoApiKeysTest.php delete mode 100644 test/Model/GetChildInfoApiKeysV2Test.php delete mode 100644 test/Model/GetChildInfoApiKeysV3Test.php delete mode 100644 test/Model/GetChildInfoCreditsTest.php delete mode 100644 test/Model/GetChildInfoStatisticsTest.php delete mode 100644 test/Model/GetChildInfoTest.php delete mode 100644 test/Model/GetChildrenListTest.php delete mode 100644 test/Model/GetCorporateInvitedUsersListFeatureAccessTest.php delete mode 100644 test/Model/GetEmailCampaignTest.php delete mode 100644 test/Model/GetExtendedCampaignOverviewTest.php delete mode 100644 test/Model/GetExtendedCampaignStatsGlobalStatsTest.php delete mode 100644 test/Model/GetExtendedClientTest.php delete mode 100644 test/Model/GetExtendedContactDetailsStatisticsDeliveredTest.php delete mode 100644 test/Model/GetExtendedContactDetailsStatisticsMessagesSentTest.php delete mode 100644 test/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscriptionTest.php delete mode 100644 test/Model/GetExtendedContactDetailsTest.php delete mode 100644 test/Model/GetExtendedListTest.php delete mode 100644 test/Model/GetOrdersTest.php delete mode 100644 test/Model/GetSmsCampaignRecipientsTest.php delete mode 100644 test/Model/GetSmsCampaignTest.php delete mode 100644 test/Model/GetStatsByBrowserTest.php delete mode 100644 test/Model/GetStatsByDomainTest.php delete mode 100644 test/Model/GetWebhookAuthTest.php delete mode 100644 test/Model/GetWebhookHeadersTest.php delete mode 100644 test/Model/InlineResponse2013Test.php delete mode 100644 test/Model/InlineResponse2015Test.php delete mode 100644 test/Model/InlineResponse201Test.php delete mode 100644 test/Model/ManageIpTest.php delete mode 100644 test/Model/NoteListTest.php delete mode 100644 test/Model/PipelinesTest.php delete mode 100644 test/Model/RemainingCreditModelChildTest.php delete mode 100644 test/Model/RemainingCreditModelResellerTest.php delete mode 100644 test/Model/RemainingCreditModelTest.php delete mode 100644 test/Model/RemoveCreditsTest.php delete mode 100644 test/Model/SendSmtpEmailBccTest.php delete mode 100644 test/Model/SendSmtpEmailCcTest.php delete mode 100644 test/Model/SendSmtpEmailMessageVersionsTest.php delete mode 100644 test/Model/SendSmtpEmailReplyTo1Test.php delete mode 100644 test/Model/SendSmtpEmailTo1Test.php delete mode 100644 test/Model/SendSmtpEmailToTest.php delete mode 100644 test/Model/SubAccountUpdatePlanRequestCreditsTest.php delete mode 100644 test/Model/UpdateChildAccountStatusTest.php delete mode 100644 test/Model/UpdateChildDomainTest.php delete mode 100644 test/Model/UpdateCouponCollectionTest.php rename {test => tests}/Api/AccountApiTest.php (60%) create mode 100644 tests/Api/BalanceApiTest.php rename {test => tests}/Api/CompaniesApiTest.php (56%) rename {test => tests}/Api/ContactsApiTest.php (64%) rename {test => tests}/Api/ConversationsApiTest.php (64%) rename {test => tests}/Api/CouponsApiTest.php (62%) rename {test => tests}/Api/DealsApiTest.php (59%) rename {test => tests}/Api/DomainsApiTest.php (61%) create mode 100644 tests/Api/EcommerceApiTest.php rename {test => tests}/Api/EmailCampaignsApiTest.php (64%) rename test/Api/EventsApiTest.php => tests/Api/EventApiTest.php (61%) rename {test => tests}/Api/ExternalFeedsApiTest.php (61%) rename {test => tests}/Api/FilesApiTest.php (60%) rename {test => tests}/Api/InboundParsingApiTest.php (62%) create mode 100644 tests/Api/MasterAccountApiTest.php rename {test => tests}/Api/NotesApiTest.php (60%) create mode 100644 tests/Api/PaymentsApiTest.php rename {test => tests}/Api/ProcessApiTest.php (60%) create mode 100644 tests/Api/ProgramApiTest.php create mode 100644 tests/Api/RewardsApiTest.php rename {test => tests}/Api/SMSCampaignsApiTest.php (63%) rename {test => tests}/Api/SendersApiTest.php (60%) rename {test => tests}/Api/TasksApiTest.php (60%) create mode 100644 tests/Api/TierApiTest.php rename {test => tests}/Api/TransactionalEmailsApiTest.php (64%) rename {test => tests}/Api/TransactionalSMSApiTest.php (62%) rename {test => tests}/Api/TransactionalWhatsAppApiTest.php (61%) rename {test => tests}/Api/UserApiTest.php (62%) rename {test => tests}/Api/WebhooksApiTest.php (61%) rename {test => tests}/Api/WhatsAppCampaignsApiTest.php (64%) rename {test => tests}/Model/AbTestCampaignResultClickedLinksTest.php (61%) rename {test => tests}/Model/AbTestCampaignResultStatisticsTest.php (60%) rename {test => tests}/Model/AbTestCampaignResultTest.php (60%) rename {test => tests}/Model/AbTestVersionClicksInnerTest.php (61%) rename {test => tests}/Model/AbTestVersionStatsTest.php (61%) rename test/Model/RemoveContactFromListTest.php => tests/Model/AddContactToListByEmailsTest.php (53%) create mode 100644 tests/Model/AddContactToListByExtIDsTest.php rename test/Model/AddContactToListTest.php => tests/Model/AddContactToListByIDsTest.php (53%) create mode 100644 tests/Model/AddContactToListRequestTest.php create mode 100644 tests/Model/AttributeRewardPayloadTest.php create mode 100644 tests/Model/AttributedRewardFailedConditionErrorResponseTest.php rename {test => tests}/Model/AuthenticateDomainModelTest.php (61%) create mode 100644 tests/Model/BadRequestPayloadTest.php create mode 100644 tests/Model/BalanceBalancesInnerTest.php create mode 100644 tests/Model/BalanceDefinitionIdDoesNotExistTest.php create mode 100644 tests/Model/BalanceDefinitionPageTest.php create mode 100644 tests/Model/BalanceDefinitionTest.php create mode 100644 tests/Model/BalanceLimitPayloadTest.php create mode 100644 tests/Model/BalanceLimitTest.php create mode 100644 tests/Model/BalancePageTest.php create mode 100644 tests/Model/BalanceTest.php rename {test => tests}/Model/BlockDomainTest.php (60%) create mode 100644 tests/Model/CancelledTransactionTest.php create mode 100644 tests/Model/CartTest.php rename test/Model/Body3Test.php => tests/Model/CompaniesIdPatchRequestTest.php (54%) create mode 100644 tests/Model/CompaniesImportPost200ResponseTest.php create mode 100644 tests/Model/CompaniesImportPost400ResponseTest.php rename test/Model/Body4test.php => tests/Model/CompaniesLinkUnlinkIdPatchRequestTest.php (53%) rename {test => tests}/Model/CompaniesListTest.php (61%) rename test/Model/InlineResponse2001Test.php => tests/Model/CompaniesPost200ResponseTest.php (54%) create mode 100644 tests/Model/CompaniesPostRequestTest.php rename {test => tests}/Model/CompanyAttributesInnerTest.php (60%) rename {test => tests}/Model/CompanyTest.php (60%) create mode 100644 tests/Model/CompleteTransactionPayloadTest.php create mode 100644 tests/Model/CompletedTransactionTest.php rename {test => tests}/Model/ComponentItemsTest.php (60%) create mode 100644 tests/Model/ConfigurationTest.php create mode 100644 tests/Model/ContactBalancesBalancesInnerTest.php create mode 100644 tests/Model/ContactBalancesTest.php create mode 100644 tests/Model/ContactErrorModelTest.php create mode 100644 tests/Model/ContactIdInvalidResponseTest.php rename test/Model/Body14Test.php => tests/Model/ConversationsAgentOnlinePingPostRequestTest.php (52%) rename test/Model/ConversationsMessageFIleImageInfoTest.php => tests/Model/ConversationsMessageFileImageInfoTest.php (61%) rename {test => tests}/Model/ConversationsMessageFileTest.php (60%) rename {test => tests}/Model/ConversationsMessageTest.php (59%) create mode 100644 tests/Model/ConversationsMessagesIdPutRequestTest.php rename test/Model/Body10Test.php => tests/Model/ConversationsMessagesPostRequestTest.php (53%) rename test/Model/Body12Test.php => tests/Model/ConversationsPushedMessagesPostRequestTest.php (52%) create mode 100644 tests/Model/ConversionSourceMetricsTest.php create mode 100644 tests/Model/ConversionSourceProductTest.php create mode 100644 tests/Model/CorporateGroupDetailsResponseGroupTest.php rename test/Model/SubAccountsResponseSubAccountsTest.php => tests/Model/CorporateGroupDetailsResponseSubAccountsInnerTest.php (51%) create mode 100644 tests/Model/CorporateGroupDetailsResponseTest.php rename test/Model/UpdateChildTest.php => tests/Model/CorporateGroupDetailsResponseUsersInnerTest.php (52%) rename test/Model/BodyTest.php => tests/Model/CorporateGroupIdPutRequestTest.php (53%) rename test/Model/CreateApiKeyRequestTest.php => tests/Model/CorporateGroupPost201ResponseTest.php (52%) rename test/Model/Body1Test.php => tests/Model/CorporateGroupPostRequestTest.php (53%) create mode 100644 tests/Model/CorporateGroupUnlinkGroupIdSubAccountsPutRequestTest.php create mode 100644 tests/Model/CorporateIpGet200ResponseInnerTest.php rename test/Model/AddCreditsTest.php => tests/Model/CorporateSsoTokenPostRequestTest.php (53%) create mode 100644 tests/Model/CorporateSubAccountIpAssociatePostRequestTest.php create mode 100644 tests/Model/CorporateSubAccountIpDissociatePutRequestTest.php create mode 100644 tests/Model/CorporateSubAccountKeyPostRequestTest.php create mode 100644 tests/Model/CorporateSubAccountSsoTokenPostRequestTest.php create mode 100644 tests/Model/CorporateUserEmailPermissionsPutRequestPrivilegesInnerTest.php create mode 100644 tests/Model/CorporateUserEmailPermissionsPutRequestTest.php create mode 100644 tests/Model/CorporateUserInvitationActionEmailPut200ResponseTest.php rename {test => tests}/Model/CreateApiKeyResponseTest.php (60%) rename test/Model/CreateAttributeEnumerationTest.php => tests/Model/CreateAttributeEnumerationInnerTest.php (52%) rename {test => tests}/Model/CreateAttributeTest.php (56%) create mode 100644 tests/Model/CreateBalanceDefinitionPayloadTest.php rename {test => tests}/Model/CreateCategoryModelTest.php (61%) rename {test => tests}/Model/CreateContactTest.php (60%) create mode 100644 tests/Model/CreateCouponCollection201ResponseTest.php create mode 100644 tests/Model/CreateCouponCollectionRequestTest.php rename test/Model/CreateCouponsTest.php => tests/Model/CreateCouponsRequestTest.php (54%) create mode 100644 tests/Model/CreateDoiContactAttributesValueTest.php rename {test => tests}/Model/CreateDoiContactTest.php (60%) rename {test => tests}/Model/CreateDomainModelDnsRecordsDkimRecordTest.php (61%) rename {test => tests}/Model/CreateDomainModelDnsRecordsTest.php (57%) rename {test => tests}/Model/CreateDomainModelTest.php (56%) rename {test => tests}/Model/CreateDomainTest.php (60%) create mode 100644 tests/Model/CreateEmailCampaignEmailExpirationDateTest.php rename {test => tests}/Model/CreateEmailCampaignRecipientsTest.php (61%) rename {test => tests}/Model/CreateEmailCampaignSenderTest.php (53%) rename {test => tests}/Model/CreateEmailCampaignTest.php (57%) rename test/Model/CreateResellerTest.php => tests/Model/CreateExternalFeed201ResponseTest.php (52%) rename {test => tests}/Model/CreateExternalFeedTest.php (59%) rename {test => tests}/Model/CreateListTest.php (60%) create mode 100644 tests/Model/CreateLoyaltyProgramPayloadTest.php rename {test => tests}/Model/CreateModelTest.php (60%) create mode 100644 tests/Model/CreateOrderPayloadTest.php create mode 100644 tests/Model/CreatePaymentRequestTest.php rename test/Model/SsoTokenRequestTest.php => tests/Model/CreatePaymentResponseTest.php (53%) rename {test => tests}/Model/CreateProductModelTest.php (61%) rename test/Model/CreateSenderIpsTest.php => tests/Model/CreateSenderIpsInnerTest.php (54%) rename {test => tests}/Model/CreateSenderModelTest.php (60%) rename {test => tests}/Model/CreateSenderTest.php (60%) rename {test => tests}/Model/CreateSmsCampaignRecipientsTest.php (61%) rename {test => tests}/Model/CreateSmsCampaignTest.php (60%) rename {test => tests}/Model/CreateSmtpEmailTest.php (61%) rename {test => tests}/Model/CreateSmtpTemplateSenderTest.php (53%) rename {test => tests}/Model/CreateSmtpTemplateTest.php (59%) rename {test => tests}/Model/CreateSubAccountResponseTest.php (61%) rename {test => tests}/Model/CreateSubAccountTest.php (57%) create mode 100644 tests/Model/CreateSubscriptionMemberPayloadTest.php create mode 100644 tests/Model/CreateSubscriptionMemberResponseTest.php create mode 100644 tests/Model/CreateSubscriptionPayloadTest.php create mode 100644 tests/Model/CreateSubscriptionResponseTest.php create mode 100644 tests/Model/CreateTierGroupRequestTest.php create mode 100644 tests/Model/CreateTransactionPayloadTest.php rename {test => tests}/Model/CreateUpdateBatchCategoryModelTest.php (61%) rename {test => tests}/Model/CreateUpdateBatchCategoryTest.php (61%) rename {test => tests}/Model/CreateUpdateBatchProductsModelTest.php (61%) rename {test => tests}/Model/CreateUpdateBatchProductsTest.php (61%) rename {test => tests}/Model/CreateUpdateCategoriesTest.php (57%) rename {test => tests}/Model/CreateUpdateCategoryTest.php (57%) rename {test => tests}/Model/CreateUpdateContactModelTest.php (61%) rename {test => tests}/Model/CreateUpdateFolderTest.php (61%) rename test/Model/CreateUpdateproductTest.php => tests/Model/CreateUpdateProductTest.php (56%) rename {test => tests}/Model/CreateUpdateProductsTest.php (56%) rename {test => tests}/Model/CreateWebhookTest.php (59%) rename {test => tests}/Model/CreateWhatsAppCampaignRecipientsTest.php (61%) rename {test => tests}/Model/CreateWhatsAppCampaignTest.php (60%) rename {test => tests}/Model/CreateWhatsAppTemplateTest.php (60%) rename {test => tests}/Model/CreatedBatchIdTest.php (57%) rename {test => tests}/Model/CreatedProcessIdTest.php (61%) rename test/Model/Body2Test.php => tests/Model/CrmDealsIdPatchRequestTest.php (54%) rename test/Model/Body7Test.php => tests/Model/CrmDealsLinkUnlinkIdPatchRequestTest.php (54%) rename test/Model/InlineResponse2011Test.php => tests/Model/CrmDealsPost201ResponseTest.php (54%) create mode 100644 tests/Model/CrmDealsPostRequestTest.php rename test/Model/Body9Test.php => tests/Model/CrmTasksIdPatchRequestTest.php (52%) rename test/Model/InlineResponse2012Test.php => tests/Model/CrmTasksPost201ResponseTest.php (54%) rename test/Model/Body8Test.php => tests/Model/CrmTasksPostRequestTest.php (55%) rename {test => tests}/Model/DealAttributesInnerTest.php (60%) rename {test => tests}/Model/DealTest.php (60%) rename {test => tests}/Model/DealsListTest.php (60%) rename {test => tests}/Model/DeleteHardbouncesTest.php (60%) create mode 100644 tests/Model/DeleteSubscriptionMemberPayloadTest.php create mode 100644 tests/Model/EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200ResponseTest.php create mode 100644 tests/Model/EcommerceAttributionMetricsGet200ResponseTest.php create mode 100644 tests/Model/EcommerceAttributionMetricsGet200ResponseTotalsTest.php create mode 100644 tests/Model/EcommerceAttributionProductsConversionSourceConversionSourceIdGet200ResponseTest.php create mode 100644 tests/Model/EcommerceConfigDisplayCurrencyGet200ResponseTest.php rename {test => tests}/Model/EmailExportRecipientsTest.php (61%) rename {test => tests}/Model/ErrorModelTest.php (60%) create mode 100644 tests/Model/ErrorResponseTest.php rename test/Model/Body11Test.php => tests/Model/EventContactPropertiesValueTest.php (53%) rename test/Model/Body13Test.php => tests/Model/EventEventPropertiesValueTest.php (53%) rename {test => tests}/Model/EventIdentifiersTest.php (64%) rename {test => tests}/Model/EventTest.php (63%) create mode 100644 tests/Model/ExportWebhooksHistoryRequestTest.php rename {test => tests}/Model/ExportWebhooksHistoryTest.php (59%) rename {test => tests}/Model/FileDataTest.php (59%) rename {test => tests}/Model/FileDownloadableLinkTest.php (60%) rename test/Model/GetAccountActivityLogsTest.php => tests/Model/GetAccountActivityLogsInnerTest.php (53%) rename {test => tests}/Model/GetAccountActivityTest.php (61%) rename test/Model/GetAccountMarketingAutomationTest.php => tests/Model/GetAccountAllOfMarketingAutomationTest.php (52%) rename test/Model/GetAccountPlanTest.php => tests/Model/GetAccountAllOfPlanTest.php (54%) rename test/Model/GetAccountRelayDataTest.php => tests/Model/GetAccountAllOfRelayDataTest.php (55%) rename test/Model/GetAccountRelayTest.php => tests/Model/GetAccountAllOfRelayTest.php (55%) create mode 100644 tests/Model/GetAccountTest.php rename {test => tests}/Model/GetAggregatedReportTest.php (59%) rename test/Model/GetAllExternalFeedsFeedsTest.php => tests/Model/GetAllExternalFeedsFeedsInnerTest.php (54%) rename {test => tests}/Model/GetAllExternalFeedsTest.php (60%) rename test/Model/UpdateAttributeEnumerationTest.php => tests/Model/GetAttributesAttributesInnerEnumerationInnerTest.php (51%) rename test/Model/GetAttributesAttributesTest.php => tests/Model/GetAttributesAttributesInnerTest.php (53%) rename {test => tests}/Model/GetAttributesTest.php (61%) rename {test => tests}/Model/GetBlockedDomainsTest.php (60%) rename {test => tests}/Model/GetCampaignOverviewTest.php (59%) rename {test => tests}/Model/GetCampaignRecipientsTest.php (61%) rename {test => tests}/Model/GetCampaignStatsTest.php (59%) rename {test => tests}/Model/GetCategoriesTest.php (60%) rename {test => tests}/Model/GetCategoryDetailsTest.php (59%) rename {test => tests}/Model/GetClientTest.php (60%) rename test/Model/GetExtendedContactDetailsStatisticsClickedTest.php => tests/Model/GetContactCampaignStatsClickedInnerTest.php (52%) rename test/Model/GetExtendedContactDetailsStatisticsOpenedTest.php => tests/Model/GetContactCampaignStatsOpenedInnerTest.php (52%) rename {test => tests}/Model/GetContactCampaignStatsTest.php (60%) rename test/Model/GetContactCampaignStatsTransacAttributesTest.php => tests/Model/GetContactCampaignStatsTransacAttributesInnerTest.php (53%) rename {test => tests}/Model/GetContactCampaignStatsUnsubscriptionsTest.php (62%) rename {test => tests}/Model/GetContactDetailsTest.php (60%) create mode 100644 tests/Model/GetContactInfoIdentifierParameterTest.php rename {test => tests}/Model/GetContactsTest.php (62%) rename {test => tests}/Model/GetCorporateInvitedUsersListTest.php (61%) create mode 100644 tests/Model/GetCorporateInvitedUsersListUsersInnerFeatureAccessTest.php rename test/Model/GetCorporateInvitedUsersListGroupsTest.php => tests/Model/GetCorporateInvitedUsersListUsersInnerGroupsTest.php (53%) create mode 100644 tests/Model/GetCorporateInvitedUsersListUsersInnerTest.php create mode 100644 tests/Model/GetCorporateUserPermissionFeatureAccessTest.php create mode 100644 tests/Model/GetCorporateUserPermissionGroupsInnerTest.php rename test/Model/GetCorporateInvitedUsersListUsersTest.php => tests/Model/GetCorporateUserPermissionTest.php (53%) rename {test => tests}/Model/GetCouponCollectionTest.php (51%) rename {test => tests}/Model/GetDeviceBrowserStatsTest.php (60%) rename {test => tests}/Model/GetDomainConfigurationModelTest.php (61%) rename test/Model/GetDomainsListDomainsTest.php => tests/Model/GetDomainsListDomainsInnerTest.php (53%) rename {test => tests}/Model/GetDomainsListTest.php (61%) create mode 100644 tests/Model/GetEmailCampaignTest.php create mode 100644 tests/Model/GetEmailCampaignsCampaignsInnerTest.php rename {test => tests}/Model/GetEmailCampaignsTest.php (60%) rename test/Model/GetEmailEventReportEventsTest.php => tests/Model/GetEmailEventReportEventsInnerTest.php (53%) rename {test => tests}/Model/GetEmailEventReportTest.php (61%) create mode 100644 tests/Model/GetExtendedCampaignOverviewAllOfSenderTest.php create mode 100644 tests/Model/GetExtendedCampaignOverviewTest.php rename {test => tests}/Model/GetExtendedCampaignStatsTest.php (60%) rename test/Model/GetExtendedClientAddressTest.php => tests/Model/GetExtendedClientAllOfAddressTest.php (54%) rename test/Model/CreateChildTest.php => tests/Model/GetExtendedClientTest.php (52%) rename test/Model/GetContactCampaignStatsClickedTest.php => tests/Model/GetExtendedContactDetailsAllOfStatisticsClickedTest.php (51%) rename test/Model/GetExtendedContactDetailsStatisticsLinksTest.php => tests/Model/GetExtendedContactDetailsAllOfStatisticsLinksTest.php (51%) rename test/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscriptionTest.php => tests/Model/GetExtendedContactDetailsAllOfStatisticsMessagesSentTest.php (50%) rename test/Model/GetContactCampaignStatsOpenedTest.php => tests/Model/GetExtendedContactDetailsAllOfStatisticsOpenedTest.php (51%) rename test/Model/GetExtendedContactDetailsStatisticsTest.php => tests/Model/GetExtendedContactDetailsAllOfStatisticsTest.php (55%) create mode 100644 tests/Model/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscriptionTest.php rename test/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsTest.php => tests/Model/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsTest.php (53%) create mode 100644 tests/Model/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscriptionTest.php create mode 100644 tests/Model/GetExtendedContactDetailsTest.php rename test/Model/GetExtendedListCampaignStatsTest.php => tests/Model/GetExtendedListAllOfCampaignStatsTest.php (52%) create mode 100644 tests/Model/GetExtendedListTest.php rename test/Model/GetExternalFeedByUUIDHeadersTest.php => tests/Model/GetExternalFeedByUUIDHeadersInnerTest.php (52%) rename {test => tests}/Model/GetExternalFeedByUUIDTest.php (59%) rename {test => tests}/Model/GetFolderListsTest.php (60%) rename {test => tests}/Model/GetFolderTest.php (60%) rename {test => tests}/Model/GetFoldersTest.php (60%) rename test/Model/GetInboundEmailEventsByUuidAttachmentsTest.php => tests/Model/GetInboundEmailEventsByUuidAttachmentsInnerTest.php (52%) rename test/Model/GetInboundEmailEventsByUuidLogsTest.php => tests/Model/GetInboundEmailEventsByUuidLogsInnerTest.php (52%) rename {test => tests}/Model/GetInboundEmailEventsByUuidTest.php (60%) rename test/Model/GetInboundEmailEventsEventsTest.php => tests/Model/GetInboundEmailEventsEventsInnerTest.php (53%) rename {test => tests}/Model/GetInboundEmailEventsTest.php (61%) rename {test => tests}/Model/GetInvitedUsersListTest.php (61%) rename test/Model/GetInvitedUsersListFeatureAccessTest.php => tests/Model/GetInvitedUsersListUsersInnerFeatureAccessTest.php (53%) rename test/Model/GetInvitedUsersListUsersTest.php => tests/Model/GetInvitedUsersListUsersInnerTest.php (53%) rename {test => tests}/Model/GetIpFromSenderTest.php (60%) rename {test => tests}/Model/GetIpTest.php (59%) rename {test => tests}/Model/GetIpsFromSenderTest.php (61%) rename {test => tests}/Model/GetIpsTest.php (60%) rename {test => tests}/Model/GetListTest.php (60%) create mode 100644 tests/Model/GetListsListsInnerTest.php rename {test => tests}/Model/GetListsTest.php (60%) create mode 100644 tests/Model/GetPaymentRequestTest.php rename {test => tests}/Model/GetProcessTest.php (59%) rename {test => tests}/Model/GetProcessesTest.php (60%) rename {test => tests}/Model/GetProductDetailsTest.php (59%) rename {test => tests}/Model/GetProductsTest.php (60%) rename test/Model/GetReportsReportsTest.php => tests/Model/GetReportsReportsInnerTest.php (55%) rename {test => tests}/Model/GetReportsTest.php (60%) rename test/Model/GetScheduledEmailByBatchIdBatchesTest.php => tests/Model/GetScheduledEmailByBatchIdBatchesInnerTest.php (52%) rename {test => tests}/Model/GetScheduledEmailByBatchIdTest.php (61%) create mode 100644 tests/Model/GetScheduledEmailById200ResponseTest.php rename {test => tests}/Model/GetScheduledEmailByMessageIdTest.php (61%) rename {test => tests}/Model/GetSegmentsTest.php (60%) rename test/Model/GetSendersListIpsTest.php => tests/Model/GetSendersListSendersInnerIpsInnerTest.php (52%) rename test/Model/GetSendersListSendersTest.php => tests/Model/GetSendersListSendersInnerTest.php (53%) rename {test => tests}/Model/GetSendersListTest.php (61%) rename {test => tests}/Model/GetSharedTemplateUrlTest.php (61%) rename {test => tests}/Model/GetSmsCampaignOverviewTest.php (59%) rename {test => tests}/Model/GetSmsCampaignStatsTest.php (60%) create mode 100644 tests/Model/GetSmsCampaignTest.php create mode 100644 tests/Model/GetSmsCampaignsCampaignsInnerTest.php rename {test => tests}/Model/GetSmsCampaignsTest.php (60%) rename test/Model/GetSmsEventReportEventsTest.php => tests/Model/GetSmsEventReportEventsInnerTest.php (53%) rename {test => tests}/Model/GetSmsEventReportTest.php (61%) rename {test => tests}/Model/GetSmtpTemplateOverviewSenderTest.php (60%) rename {test => tests}/Model/GetSmtpTemplateOverviewTest.php (59%) rename {test => tests}/Model/GetSmtpTemplatesTest.php (60%) rename {test => tests}/Model/GetSsoTokenTest.php (60%) rename {test => tests}/Model/GetStatsByDeviceTest.php (60%) rename test/Model/InlineResponse200Test.php => tests/Model/GetSubAccountGroups200ResponseInnerTest.php (52%) create mode 100644 tests/Model/GetSubscriptionInfoResponseBalanceBalancesInnerTest.php create mode 100644 tests/Model/GetSubscriptionInfoResponseBalanceTest.php create mode 100644 tests/Model/GetSubscriptionInfoResponseMembersInnerTest.php create mode 100644 tests/Model/GetSubscriptionInfoResponseRewardInnerTest.php create mode 100644 tests/Model/GetSubscriptionInfoResponseTest.php create mode 100644 tests/Model/GetSubscriptionInfoResponseTierInnerTest.php create mode 100644 tests/Model/GetSubscriptionMemberResponseMemberContactIdInnerTest.php create mode 100644 tests/Model/GetSubscriptionMemberResponseTest.php rename {test => tests}/Model/GetTransacAggregatedSmsReportTest.php (57%) rename test/Model/GetTransacBlockedContactsReasonTest.php => tests/Model/GetTransacBlockedContactsContactsInnerReasonTest.php (53%) rename test/Model/GetTransacBlockedContactsContactsTest.php => tests/Model/GetTransacBlockedContactsContactsInnerTest.php (52%) rename {test => tests}/Model/GetTransacBlockedContactsTest.php (61%) rename test/Model/GetTransacEmailContentEventsTest.php => tests/Model/GetTransacEmailContentEventsInnerTest.php (52%) rename {test => tests}/Model/GetTransacEmailContentTest.php (60%) rename {test => tests}/Model/GetTransacEmailsListTest.php (61%) rename test/Model/GetTransacEmailsListTransactionalEmailsTest.php => tests/Model/GetTransacEmailsListTransactionalEmailsInnerTest.php (52%) rename test/Model/GetTransacSmsReportReportsTest.php => tests/Model/GetTransacSmsReportReportsInnerTest.php (52%) rename {test => tests}/Model/GetTransacSmsReportTest.php (61%) rename test/Model/GetUserPermissionPrivilegesTest.php => tests/Model/GetUserPermissionPrivilegesInnerTest.php (52%) rename {test => tests}/Model/GetUserPermissionTest.php (60%) create mode 100644 tests/Model/GetVersionInfoResponseTest.php rename {test => tests}/Model/GetWebhookTest.php (58%) rename {test => tests}/Model/GetWebhooksTest.php (61%) rename {test => tests}/Model/GetWhatsAppConfigTest.php (61%) rename {test => tests}/Model/GetWhatsappCampaignOverviewTest.php (60%) rename test/Model/GetWhatsappCampaignsCampaignsTest.php => tests/Model/GetWhatsappCampaignsCampaignsInnerTest.php (54%) rename {test => tests}/Model/GetWhatsappCampaignsTest.php (61%) rename test/Model/GetWhatsappEventReportEventsTest.php => tests/Model/GetWhatsappEventReportEventsInnerTest.php (53%) rename {test => tests}/Model/GetWhatsappEventReportTest.php (61%) rename test/Model/GetWATemplatesTemplatesTest.php => tests/Model/GetWhatsappTemplatesTemplatesInnerTest.php (53%) rename test/Model/GetWATemplatesTest.php => tests/Model/GetWhatsappTemplatesTest.php (54%) rename test/Model/InviteuserPrivilegesTest.php => tests/Model/InviteAdminUserPrivilegesInnerTest.php (54%) rename {test => tests}/Model/InviteAdminUserTest.php (60%) rename test/Model/InviteAdminUserPrivilegesTest.php => tests/Model/InviteuserPrivilegesInnerTest.php (55%) create mode 100644 tests/Model/InviteuserResponseTest.php rename {test => tests}/Model/InviteuserTest.php (60%) create mode 100644 tests/Model/LoyaltyProgramPageTest.php create mode 100644 tests/Model/LoyaltyProgramTest.php create mode 100644 tests/Model/LoyaltyProgramValidationErrorTest.php create mode 100644 tests/Model/LoyaltyTierPageTest.php rename {test => tests}/Model/MasterDetailsResponseBillingInfoAddressTest.php (61%) rename {test => tests}/Model/MasterDetailsResponseBillingInfoNameTest.php (62%) rename {test => tests}/Model/MasterDetailsResponseBillingInfoTest.php (61%) rename test/Model/MasterDetailsResponsePlanInfoFeaturesTest.php => tests/Model/MasterDetailsResponsePlanInfoFeaturesInnerTest.php (53%) rename {test => tests}/Model/MasterDetailsResponsePlanInfoTest.php (60%) rename {test => tests}/Model/MasterDetailsResponseTest.php (60%) rename {test => tests}/Model/NoteDataTest.php (60%) rename {test => tests}/Model/NoteIdTest.php (60%) rename {test => tests}/Model/NoteTest.php (59%) create mode 100644 tests/Model/NotificationTest.php create mode 100644 tests/Model/OfferListTest.php create mode 100644 tests/Model/OfferTest.php create mode 100644 tests/Model/OffersListResponseTest.php rename {test => tests}/Model/OrderBatchTest.php (60%) rename {test => tests}/Model/OrderBillingTest.php (57%) create mode 100644 tests/Model/OrderIdentifiersTest.php rename test/Model/OrderProductsTest.php => tests/Model/OrderProductsInnerTest.php (56%) rename {test => tests}/Model/OrderTest.php (54%) rename {test => tests}/Model/OtpTest.php (57%) create mode 100644 tests/Model/PatchLoyaltyProgramPayloadTest.php rename {test => tests}/Model/PipelineStageTest.php (60%) rename {test => tests}/Model/PipelineTest.php (60%) rename test/Model/AddChildDomainTest.php => tests/Model/PostContactInfoContactsFailureTest.php (52%) create mode 100644 tests/Model/PostContactInfoContactsSuccessTest.php rename {test => tests}/Model/PostContactInfoContactsTest.php (60%) rename {test => tests}/Model/PostContactInfoTest.php (61%) rename {test => tests}/Model/PostSendFailedTest.php (60%) rename {test => tests}/Model/PostSendSmsTestFailedTest.php (60%) create mode 100644 tests/Model/PutRevokeUserPermissionResponseTest.php rename {test => tests}/Model/PutRevokeUserPermissionTest.php (61%) create mode 100644 tests/Model/PutresendcancelinvitationResponseTest.php rename {test => tests}/Model/PutresendcancelinvitationTest.php (61%) create mode 100644 tests/Model/RedeemRewardPayloadTest.php create mode 100644 tests/Model/RedeemedRewardFailedConditionErrorResponseTest.php create mode 100644 tests/Model/RemoveContactFromListByAllTest.php rename test/Model/SubAccountDetailsResponsePlanInfoCreditsTest.php => tests/Model/RemoveContactFromListByEmailsTest.php (52%) create mode 100644 tests/Model/RemoveContactFromListByExtIDsTest.php create mode 100644 tests/Model/RemoveContactFromListByIDsTest.php create mode 100644 tests/Model/RemoveContactFromListRequestTest.php rename {test => tests}/Model/RequestContactExportCustomContactFilterTest.php (62%) rename {test => tests}/Model/RequestContactExportTest.php (61%) rename test/Model/RequestContactImportJsonBodyTest.php => tests/Model/RequestContactImportJsonBodyInnerTest.php (52%) rename {test => tests}/Model/RequestContactImportNewListTest.php (62%) rename {test => tests}/Model/RequestContactImportTest.php (60%) rename {test => tests}/Model/RequestSmsRecipientExportTest.php (61%) create mode 100644 tests/Model/RewardAttributionResponseTest.php create mode 100644 tests/Model/RewardRedeemResponseTest.php rename {test => tests}/Model/ScheduleSmtpEmailTest.php (60%) rename test/Model/GetSegmentsSegmentsTest.php => tests/Model/SegmentTest.php (55%) rename {test => tests}/Model/SendReportEmailTest.php (61%) rename {test => tests}/Model/SendReportTest.php (60%) rename {test => tests}/Model/SendSmsTest.php (60%) rename test/Model/SendSmtpEmailAttachmentTest.php => tests/Model/SendSmtpEmailAttachmentInnerTest.php (53%) create mode 100644 tests/Model/SendSmtpEmailBccInnerTest.php rename test/Model/GetExtendedCampaignOverviewSenderTest.php => tests/Model/SendSmtpEmailCcInnerTest.php (54%) create mode 100644 tests/Model/SendSmtpEmailMessageVersionsInnerTest.php rename {test => tests}/Model/SendSmtpEmailReplyToTest.php (55%) rename {test => tests}/Model/SendSmtpEmailSenderTest.php (53%) rename {test => tests}/Model/SendSmtpEmailTest.php (58%) create mode 100644 tests/Model/SendSmtpEmailToInnerTest.php rename {test => tests}/Model/SendTestEmailTest.php (61%) rename {test => tests}/Model/SendTestSmsTest.php (61%) rename {test => tests}/Model/SendTransacSmsTest.php (59%) rename test/Model/InlineResponse2014Test.php => tests/Model/SendWhatsappMessage201ResponseTest.php (52%) create mode 100644 tests/Model/SendWhatsappMessageRequestTest.php create mode 100644 tests/Model/SendWhatsappMessageTemplateTest.php rename test/Model/SendWhatsappMessageTest.php => tests/Model/SendWhatsappMessageTextTest.php (54%) rename {test => tests}/Model/SubAccountAppsToggleRequestTest.php (60%) create mode 100644 tests/Model/SubAccountDetailsResponseGroupsInnerTest.php rename {test => tests}/Model/SubAccountDetailsResponsePlanInfoCreditsEmailsTest.php (64%) create mode 100644 tests/Model/SubAccountDetailsResponsePlanInfoCreditsExternalFeedsTest.php create mode 100644 tests/Model/SubAccountDetailsResponsePlanInfoCreditsSmsTest.php create mode 100644 tests/Model/SubAccountDetailsResponsePlanInfoCreditsTest.php create mode 100644 tests/Model/SubAccountDetailsResponsePlanInfoCreditsWhatsappTest.php create mode 100644 tests/Model/SubAccountDetailsResponsePlanInfoCreditsWpSubscribersTest.php rename {test => tests}/Model/SubAccountDetailsResponsePlanInfoFeaturesInboxTest.php (64%) rename {test => tests}/Model/SubAccountDetailsResponsePlanInfoFeaturesLandingPageTest.php (64%) rename {test => tests}/Model/SubAccountDetailsResponsePlanInfoFeaturesTest.php (61%) rename {test => tests}/Model/SubAccountDetailsResponsePlanInfoFeaturesUsersTest.php (64%) rename {test => tests}/Model/SubAccountDetailsResponsePlanInfoTest.php (61%) rename {test => tests}/Model/SubAccountDetailsResponseTest.php (57%) create mode 100644 tests/Model/SubAccountUpdatePlanRequestCreditsTest.php rename {test => tests}/Model/SubAccountUpdatePlanRequestFeaturesTest.php (61%) rename {test => tests}/Model/SubAccountUpdatePlanRequestTest.php (61%) create mode 100644 tests/Model/SubAccountsResponseSubAccountsInnerGroupsInnerTest.php create mode 100644 tests/Model/SubAccountsResponseSubAccountsInnerTest.php rename {test => tests}/Model/SubAccountsResponseTest.php (61%) create mode 100644 tests/Model/SubscriptionNotFoundErrorResponseTest.php rename {test => tests}/Model/TaskListTest.php (60%) rename {test => tests}/Model/TaskReminderTest.php (60%) rename {test => tests}/Model/TaskTest.php (59%) rename {test => tests}/Model/TaskTypesTest.php (60%) create mode 100644 tests/Model/TierAccessConditionsInnerTest.php create mode 100644 tests/Model/TierForContactTest.php create mode 100644 tests/Model/TierGroupPageTest.php create mode 100644 tests/Model/TierGroupTest.php create mode 100644 tests/Model/TierRequestAccessConditionsInnerTest.php create mode 100644 tests/Model/TierRequestTest.php create mode 100644 tests/Model/TierRequestTierRewardsInnerTest.php create mode 100644 tests/Model/TierTest.php create mode 100644 tests/Model/TierTierRewardsInnerTest.php create mode 100644 tests/Model/TransactionTest.php create mode 100644 tests/Model/UnauthorizedResponseTest.php rename test/Model/GetAttributesEnumerationTest.php => tests/Model/UpdateAttributeEnumerationInnerTest.php (52%) rename {test => tests}/Model/UpdateAttributeTest.php (56%) create mode 100644 tests/Model/UpdateBalanceDefinitionPayloadTest.php rename test/Model/UpdateBatchContactsContactsTest.php => tests/Model/UpdateBatchContactsContactsInnerTest.php (54%) rename {test => tests}/Model/UpdateBatchContactsModelTest.php (61%) rename {test => tests}/Model/UpdateBatchContactsTest.php (61%) rename {test => tests}/Model/UpdateCampaignStatusTest.php (61%) rename {test => tests}/Model/UpdateContactTest.php (60%) rename test/Model/InlineResponse2002Test.php => tests/Model/UpdateCouponCollection200ResponseTest.php (52%) create mode 100644 tests/Model/UpdateCouponCollectionRequestTest.php create mode 100644 tests/Model/UpdateEmailCampaignEmailExpirationDateTest.php rename {test => tests}/Model/UpdateEmailCampaignRecipientsTest.php (61%) rename {test => tests}/Model/UpdateEmailCampaignSenderTest.php (57%) rename {test => tests}/Model/UpdateEmailCampaignTest.php (57%) rename {test => tests}/Model/UpdateExternalFeedTest.php (59%) rename {test => tests}/Model/UpdateListTest.php (60%) create mode 100644 tests/Model/UpdateLoyaltyProgramPayloadTest.php rename {test => tests}/Model/UpdateSenderTest.php (60%) rename {test => tests}/Model/UpdateSmsCampaignTest.php (60%) rename {test => tests}/Model/UpdateSmtpTemplateSenderTest.php (53%) rename {test => tests}/Model/UpdateSmtpTemplateTest.php (59%) create mode 100644 tests/Model/UpdateTierGroup404ResponseTest.php create mode 100644 tests/Model/UpdateTierGroupRequestTest.php create mode 100644 tests/Model/UpdateUserResponseTest.php rename {test => tests}/Model/UpdateWebhookTest.php (59%) rename {test => tests}/Model/UpdateWhatsAppCampaignTest.php (61%) rename {test => tests}/Model/UploadImageModelTest.php (61%) rename {test => tests}/Model/UploadImageToGalleryTest.php (61%) create mode 100644 tests/Model/ValidateRewardPayloadTest.php create mode 100644 tests/Model/ValidatedRewardResponseTest.php create mode 100644 tests/Model/ValidationErrorTest.php rename {test => tests}/Model/VariablesItemsTest.php (60%) create mode 100644 tests/Model/VersionInfoTest.php rename {test => tests}/Model/WhatsappCampStatsTest.php (60%) rename {test => tests}/Model/WhatsappCampTemplateTest.php (60%) diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES new file mode 100644 index 0000000..5ae8dab --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,960 @@ +.php-cs-fixer.dist.php +.phplint.yml +.travis.yml +README.md +composer.json +docs/Api/AccountApi.md +docs/Api/BalanceApi.md +docs/Api/CompaniesApi.md +docs/Api/ContactsApi.md +docs/Api/ConversationsApi.md +docs/Api/CouponsApi.md +docs/Api/DealsApi.md +docs/Api/DomainsApi.md +docs/Api/EcommerceApi.md +docs/Api/EmailCampaignsApi.md +docs/Api/EventApi.md +docs/Api/ExternalFeedsApi.md +docs/Api/FilesApi.md +docs/Api/InboundParsingApi.md +docs/Api/MasterAccountApi.md +docs/Api/NotesApi.md +docs/Api/PaymentsApi.md +docs/Api/ProcessApi.md +docs/Api/ProgramApi.md +docs/Api/RewardsApi.md +docs/Api/SMSCampaignsApi.md +docs/Api/SendersApi.md +docs/Api/TasksApi.md +docs/Api/TierApi.md +docs/Api/TransactionalEmailsApi.md +docs/Api/TransactionalSMSApi.md +docs/Api/TransactionalWhatsAppApi.md +docs/Api/UserApi.md +docs/Api/WebhooksApi.md +docs/Api/WhatsAppCampaignsApi.md +docs/Model/AbTestCampaignResult.md +docs/Model/AbTestCampaignResultClickedLinks.md +docs/Model/AbTestCampaignResultStatistics.md +docs/Model/AbTestVersionClicksInner.md +docs/Model/AbTestVersionStats.md +docs/Model/AddContactToListByEmails.md +docs/Model/AddContactToListByExtIDs.md +docs/Model/AddContactToListByIDs.md +docs/Model/AddContactToListRequest.md +docs/Model/AttributeRewardPayload.md +docs/Model/AttributedRewardFailedConditionErrorResponse.md +docs/Model/AuthenticateDomainModel.md +docs/Model/BadRequestPayload.md +docs/Model/Balance.md +docs/Model/BalanceBalancesInner.md +docs/Model/BalanceDefinition.md +docs/Model/BalanceDefinitionIdDoesNotExist.md +docs/Model/BalanceDefinitionPage.md +docs/Model/BalanceLimit.md +docs/Model/BalanceLimitPayload.md +docs/Model/BalancePage.md +docs/Model/BlockDomain.md +docs/Model/CancelledTransaction.md +docs/Model/Cart.md +docs/Model/CompaniesIdPatchRequest.md +docs/Model/CompaniesImportPost200Response.md +docs/Model/CompaniesImportPost400Response.md +docs/Model/CompaniesLinkUnlinkIdPatchRequest.md +docs/Model/CompaniesList.md +docs/Model/CompaniesPost200Response.md +docs/Model/CompaniesPostRequest.md +docs/Model/Company.md +docs/Model/CompanyAttributesInner.md +docs/Model/CompleteTransactionPayload.md +docs/Model/CompletedTransaction.md +docs/Model/ComponentItems.md +docs/Model/Configuration.md +docs/Model/ContactBalances.md +docs/Model/ContactBalancesBalancesInner.md +docs/Model/ContactErrorModel.md +docs/Model/ContactIdInvalidResponse.md +docs/Model/ConversationsAgentOnlinePingPostRequest.md +docs/Model/ConversationsMessage.md +docs/Model/ConversationsMessageFile.md +docs/Model/ConversationsMessageFileImageInfo.md +docs/Model/ConversationsMessagesIdPutRequest.md +docs/Model/ConversationsMessagesPostRequest.md +docs/Model/ConversationsPushedMessagesPostRequest.md +docs/Model/ConversionSourceMetrics.md +docs/Model/ConversionSourceProduct.md +docs/Model/CorporateGroupDetailsResponse.md +docs/Model/CorporateGroupDetailsResponseGroup.md +docs/Model/CorporateGroupDetailsResponseSubAccountsInner.md +docs/Model/CorporateGroupDetailsResponseUsersInner.md +docs/Model/CorporateGroupIdPutRequest.md +docs/Model/CorporateGroupPost201Response.md +docs/Model/CorporateGroupPostRequest.md +docs/Model/CorporateGroupUnlinkGroupIdSubAccountsPutRequest.md +docs/Model/CorporateIpGet200ResponseInner.md +docs/Model/CorporateSsoTokenPostRequest.md +docs/Model/CorporateSubAccountIpAssociatePostRequest.md +docs/Model/CorporateSubAccountIpDissociatePutRequest.md +docs/Model/CorporateSubAccountKeyPostRequest.md +docs/Model/CorporateSubAccountSsoTokenPostRequest.md +docs/Model/CorporateUserEmailPermissionsPutRequest.md +docs/Model/CorporateUserEmailPermissionsPutRequestPrivilegesInner.md +docs/Model/CorporateUserInvitationActionEmailPut200Response.md +docs/Model/CreateApiKeyResponse.md +docs/Model/CreateAttribute.md +docs/Model/CreateAttributeEnumerationInner.md +docs/Model/CreateBalanceDefinitionPayload.md +docs/Model/CreateCategoryModel.md +docs/Model/CreateContact.md +docs/Model/CreateCouponCollection201Response.md +docs/Model/CreateCouponCollectionRequest.md +docs/Model/CreateCouponsRequest.md +docs/Model/CreateDoiContact.md +docs/Model/CreateDoiContactAttributesValue.md +docs/Model/CreateDomain.md +docs/Model/CreateDomainModel.md +docs/Model/CreateDomainModelDnsRecords.md +docs/Model/CreateDomainModelDnsRecordsDkimRecord.md +docs/Model/CreateEmailCampaign.md +docs/Model/CreateEmailCampaignEmailExpirationDate.md +docs/Model/CreateEmailCampaignRecipients.md +docs/Model/CreateEmailCampaignSender.md +docs/Model/CreateExternalFeed.md +docs/Model/CreateExternalFeed201Response.md +docs/Model/CreateList.md +docs/Model/CreateLoyaltyProgramPayload.md +docs/Model/CreateModel.md +docs/Model/CreateOrderPayload.md +docs/Model/CreatePaymentRequest.md +docs/Model/CreatePaymentResponse.md +docs/Model/CreateProductModel.md +docs/Model/CreateSender.md +docs/Model/CreateSenderIpsInner.md +docs/Model/CreateSenderModel.md +docs/Model/CreateSmsCampaign.md +docs/Model/CreateSmsCampaignRecipients.md +docs/Model/CreateSmtpEmail.md +docs/Model/CreateSmtpTemplate.md +docs/Model/CreateSmtpTemplateSender.md +docs/Model/CreateSubAccount.md +docs/Model/CreateSubAccountResponse.md +docs/Model/CreateSubscriptionMemberPayload.md +docs/Model/CreateSubscriptionMemberResponse.md +docs/Model/CreateSubscriptionPayload.md +docs/Model/CreateSubscriptionResponse.md +docs/Model/CreateTierGroupRequest.md +docs/Model/CreateTransactionPayload.md +docs/Model/CreateUpdateBatchCategory.md +docs/Model/CreateUpdateBatchCategoryModel.md +docs/Model/CreateUpdateBatchProducts.md +docs/Model/CreateUpdateBatchProductsModel.md +docs/Model/CreateUpdateCategories.md +docs/Model/CreateUpdateCategory.md +docs/Model/CreateUpdateContactModel.md +docs/Model/CreateUpdateFolder.md +docs/Model/CreateUpdateProduct.md +docs/Model/CreateUpdateProducts.md +docs/Model/CreateWebhook.md +docs/Model/CreateWhatsAppCampaign.md +docs/Model/CreateWhatsAppCampaignRecipients.md +docs/Model/CreateWhatsAppTemplate.md +docs/Model/CreatedBatchId.md +docs/Model/CreatedProcessId.md +docs/Model/CrmDealsIdPatchRequest.md +docs/Model/CrmDealsLinkUnlinkIdPatchRequest.md +docs/Model/CrmDealsPost201Response.md +docs/Model/CrmDealsPostRequest.md +docs/Model/CrmTasksIdPatchRequest.md +docs/Model/CrmTasksPost201Response.md +docs/Model/CrmTasksPostRequest.md +docs/Model/Deal.md +docs/Model/DealAttributesInner.md +docs/Model/DealsList.md +docs/Model/DeleteHardbounces.md +docs/Model/DeleteSubscriptionMemberPayload.md +docs/Model/EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response.md +docs/Model/EcommerceAttributionMetricsGet200Response.md +docs/Model/EcommerceAttributionMetricsGet200ResponseTotals.md +docs/Model/EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response.md +docs/Model/EcommerceConfigDisplayCurrencyGet200Response.md +docs/Model/EmailExportRecipients.md +docs/Model/ErrorModel.md +docs/Model/ErrorResponse.md +docs/Model/Event.md +docs/Model/EventContactPropertiesValue.md +docs/Model/EventEventPropertiesValue.md +docs/Model/EventIdentifiers.md +docs/Model/ExportWebhooksHistory.md +docs/Model/ExportWebhooksHistoryRequest.md +docs/Model/FileData.md +docs/Model/FileDownloadableLink.md +docs/Model/GetAccount.md +docs/Model/GetAccountActivity.md +docs/Model/GetAccountActivityLogsInner.md +docs/Model/GetAccountAllOfMarketingAutomation.md +docs/Model/GetAccountAllOfPlan.md +docs/Model/GetAccountAllOfRelay.md +docs/Model/GetAccountAllOfRelayData.md +docs/Model/GetAggregatedReport.md +docs/Model/GetAllExternalFeeds.md +docs/Model/GetAllExternalFeedsFeedsInner.md +docs/Model/GetAttributes.md +docs/Model/GetAttributesAttributesInner.md +docs/Model/GetAttributesAttributesInnerEnumerationInner.md +docs/Model/GetBlockedDomains.md +docs/Model/GetCampaignOverview.md +docs/Model/GetCampaignRecipients.md +docs/Model/GetCampaignStats.md +docs/Model/GetCategories.md +docs/Model/GetCategoryDetails.md +docs/Model/GetClient.md +docs/Model/GetContactCampaignStats.md +docs/Model/GetContactCampaignStatsClickedInner.md +docs/Model/GetContactCampaignStatsOpenedInner.md +docs/Model/GetContactCampaignStatsTransacAttributesInner.md +docs/Model/GetContactCampaignStatsUnsubscriptions.md +docs/Model/GetContactDetails.md +docs/Model/GetContactInfoIdentifierParameter.md +docs/Model/GetContacts.md +docs/Model/GetCorporateInvitedUsersList.md +docs/Model/GetCorporateInvitedUsersListUsersInner.md +docs/Model/GetCorporateInvitedUsersListUsersInnerFeatureAccess.md +docs/Model/GetCorporateInvitedUsersListUsersInnerGroups.md +docs/Model/GetCorporateUserPermission.md +docs/Model/GetCorporateUserPermissionFeatureAccess.md +docs/Model/GetCorporateUserPermissionGroupsInner.md +docs/Model/GetCouponCollection.md +docs/Model/GetDeviceBrowserStats.md +docs/Model/GetDomainConfigurationModel.md +docs/Model/GetDomainsList.md +docs/Model/GetDomainsListDomainsInner.md +docs/Model/GetEmailCampaign.md +docs/Model/GetEmailCampaigns.md +docs/Model/GetEmailCampaignsCampaignsInner.md +docs/Model/GetEmailEventReport.md +docs/Model/GetEmailEventReportEventsInner.md +docs/Model/GetExtendedCampaignOverview.md +docs/Model/GetExtendedCampaignOverviewAllOfSender.md +docs/Model/GetExtendedCampaignStats.md +docs/Model/GetExtendedClient.md +docs/Model/GetExtendedClientAllOfAddress.md +docs/Model/GetExtendedContactDetails.md +docs/Model/GetExtendedContactDetailsAllOfStatistics.md +docs/Model/GetExtendedContactDetailsAllOfStatisticsClicked.md +docs/Model/GetExtendedContactDetailsAllOfStatisticsLinks.md +docs/Model/GetExtendedContactDetailsAllOfStatisticsMessagesSent.md +docs/Model/GetExtendedContactDetailsAllOfStatisticsOpened.md +docs/Model/GetExtendedContactDetailsAllOfStatisticsUnsubscriptions.md +docs/Model/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription.md +docs/Model/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription.md +docs/Model/GetExtendedList.md +docs/Model/GetExtendedListAllOfCampaignStats.md +docs/Model/GetExternalFeedByUUID.md +docs/Model/GetExternalFeedByUUIDHeadersInner.md +docs/Model/GetFolder.md +docs/Model/GetFolderLists.md +docs/Model/GetFolders.md +docs/Model/GetInboundEmailEvents.md +docs/Model/GetInboundEmailEventsByUuid.md +docs/Model/GetInboundEmailEventsByUuidAttachmentsInner.md +docs/Model/GetInboundEmailEventsByUuidLogsInner.md +docs/Model/GetInboundEmailEventsEventsInner.md +docs/Model/GetInvitedUsersList.md +docs/Model/GetInvitedUsersListUsersInner.md +docs/Model/GetInvitedUsersListUsersInnerFeatureAccess.md +docs/Model/GetIp.md +docs/Model/GetIpFromSender.md +docs/Model/GetIps.md +docs/Model/GetIpsFromSender.md +docs/Model/GetList.md +docs/Model/GetLists.md +docs/Model/GetListsListsInner.md +docs/Model/GetPaymentRequest.md +docs/Model/GetProcess.md +docs/Model/GetProcesses.md +docs/Model/GetProductDetails.md +docs/Model/GetProducts.md +docs/Model/GetReports.md +docs/Model/GetReportsReportsInner.md +docs/Model/GetScheduledEmailByBatchId.md +docs/Model/GetScheduledEmailByBatchIdBatchesInner.md +docs/Model/GetScheduledEmailById200Response.md +docs/Model/GetScheduledEmailByMessageId.md +docs/Model/GetSegments.md +docs/Model/GetSendersList.md +docs/Model/GetSendersListSendersInner.md +docs/Model/GetSendersListSendersInnerIpsInner.md +docs/Model/GetSharedTemplateUrl.md +docs/Model/GetSmsCampaign.md +docs/Model/GetSmsCampaignOverview.md +docs/Model/GetSmsCampaignStats.md +docs/Model/GetSmsCampaigns.md +docs/Model/GetSmsCampaignsCampaignsInner.md +docs/Model/GetSmsEventReport.md +docs/Model/GetSmsEventReportEventsInner.md +docs/Model/GetSmtpTemplateOverview.md +docs/Model/GetSmtpTemplateOverviewSender.md +docs/Model/GetSmtpTemplates.md +docs/Model/GetSsoToken.md +docs/Model/GetStatsByDevice.md +docs/Model/GetSubAccountGroups200ResponseInner.md +docs/Model/GetSubscriptionInfoResponse.md +docs/Model/GetSubscriptionInfoResponseBalance.md +docs/Model/GetSubscriptionInfoResponseBalanceBalancesInner.md +docs/Model/GetSubscriptionInfoResponseMembersInner.md +docs/Model/GetSubscriptionInfoResponseRewardInner.md +docs/Model/GetSubscriptionInfoResponseTierInner.md +docs/Model/GetSubscriptionMemberResponse.md +docs/Model/GetSubscriptionMemberResponseMemberContactIdInner.md +docs/Model/GetTransacAggregatedSmsReport.md +docs/Model/GetTransacBlockedContacts.md +docs/Model/GetTransacBlockedContactsContactsInner.md +docs/Model/GetTransacBlockedContactsContactsInnerReason.md +docs/Model/GetTransacEmailContent.md +docs/Model/GetTransacEmailContentEventsInner.md +docs/Model/GetTransacEmailsList.md +docs/Model/GetTransacEmailsListTransactionalEmailsInner.md +docs/Model/GetTransacSmsReport.md +docs/Model/GetTransacSmsReportReportsInner.md +docs/Model/GetUserPermission.md +docs/Model/GetUserPermissionPrivilegesInner.md +docs/Model/GetVersionInfoResponse.md +docs/Model/GetWebhook.md +docs/Model/GetWebhooks.md +docs/Model/GetWhatsAppConfig.md +docs/Model/GetWhatsappCampaignOverview.md +docs/Model/GetWhatsappCampaigns.md +docs/Model/GetWhatsappCampaignsCampaignsInner.md +docs/Model/GetWhatsappEventReport.md +docs/Model/GetWhatsappEventReportEventsInner.md +docs/Model/GetWhatsappTemplates.md +docs/Model/GetWhatsappTemplatesTemplatesInner.md +docs/Model/InviteAdminUser.md +docs/Model/InviteAdminUserPrivilegesInner.md +docs/Model/Inviteuser.md +docs/Model/InviteuserPrivilegesInner.md +docs/Model/InviteuserResponse.md +docs/Model/LoyaltyProgram.md +docs/Model/LoyaltyProgramPage.md +docs/Model/LoyaltyProgramValidationError.md +docs/Model/LoyaltyTierPage.md +docs/Model/MasterDetailsResponse.md +docs/Model/MasterDetailsResponseBillingInfo.md +docs/Model/MasterDetailsResponseBillingInfoAddress.md +docs/Model/MasterDetailsResponseBillingInfoName.md +docs/Model/MasterDetailsResponsePlanInfo.md +docs/Model/MasterDetailsResponsePlanInfoFeaturesInner.md +docs/Model/Note.md +docs/Model/NoteData.md +docs/Model/NoteId.md +docs/Model/Notification.md +docs/Model/Offer.md +docs/Model/OfferList.md +docs/Model/OffersListResponse.md +docs/Model/Order.md +docs/Model/OrderBatch.md +docs/Model/OrderBilling.md +docs/Model/OrderIdentifiers.md +docs/Model/OrderProductsInner.md +docs/Model/Otp.md +docs/Model/PatchLoyaltyProgramPayload.md +docs/Model/Pipeline.md +docs/Model/PipelineStage.md +docs/Model/PostContactInfo.md +docs/Model/PostContactInfoContacts.md +docs/Model/PostContactInfoContactsFailure.md +docs/Model/PostContactInfoContactsSuccess.md +docs/Model/PostSendFailed.md +docs/Model/PostSendSmsTestFailed.md +docs/Model/PutRevokeUserPermission.md +docs/Model/PutRevokeUserPermissionResponse.md +docs/Model/Putresendcancelinvitation.md +docs/Model/PutresendcancelinvitationResponse.md +docs/Model/RedeemRewardPayload.md +docs/Model/RedeemedRewardFailedConditionErrorResponse.md +docs/Model/RemoveContactFromListByAll.md +docs/Model/RemoveContactFromListByEmails.md +docs/Model/RemoveContactFromListByExtIDs.md +docs/Model/RemoveContactFromListByIDs.md +docs/Model/RemoveContactFromListRequest.md +docs/Model/RequestContactExport.md +docs/Model/RequestContactExportCustomContactFilter.md +docs/Model/RequestContactImport.md +docs/Model/RequestContactImportJsonBodyInner.md +docs/Model/RequestContactImportNewList.md +docs/Model/RequestSmsRecipientExport.md +docs/Model/RewardAttributionResponse.md +docs/Model/RewardRedeemResponse.md +docs/Model/ScheduleSmtpEmail.md +docs/Model/Segment.md +docs/Model/SendReport.md +docs/Model/SendReportEmail.md +docs/Model/SendSms.md +docs/Model/SendSmtpEmail.md +docs/Model/SendSmtpEmailAttachmentInner.md +docs/Model/SendSmtpEmailBccInner.md +docs/Model/SendSmtpEmailCcInner.md +docs/Model/SendSmtpEmailMessageVersionsInner.md +docs/Model/SendSmtpEmailReplyTo.md +docs/Model/SendSmtpEmailSender.md +docs/Model/SendSmtpEmailToInner.md +docs/Model/SendTestEmail.md +docs/Model/SendTestSms.md +docs/Model/SendTransacSms.md +docs/Model/SendWhatsappMessage201Response.md +docs/Model/SendWhatsappMessageRequest.md +docs/Model/SendWhatsappMessageTemplate.md +docs/Model/SendWhatsappMessageText.md +docs/Model/SubAccountAppsToggleRequest.md +docs/Model/SubAccountDetailsResponse.md +docs/Model/SubAccountDetailsResponseGroupsInner.md +docs/Model/SubAccountDetailsResponsePlanInfo.md +docs/Model/SubAccountDetailsResponsePlanInfoCredits.md +docs/Model/SubAccountDetailsResponsePlanInfoCreditsEmails.md +docs/Model/SubAccountDetailsResponsePlanInfoCreditsExternalFeeds.md +docs/Model/SubAccountDetailsResponsePlanInfoCreditsSms.md +docs/Model/SubAccountDetailsResponsePlanInfoCreditsWhatsapp.md +docs/Model/SubAccountDetailsResponsePlanInfoCreditsWpSubscribers.md +docs/Model/SubAccountDetailsResponsePlanInfoFeatures.md +docs/Model/SubAccountDetailsResponsePlanInfoFeaturesInbox.md +docs/Model/SubAccountDetailsResponsePlanInfoFeaturesLandingPage.md +docs/Model/SubAccountDetailsResponsePlanInfoFeaturesUsers.md +docs/Model/SubAccountUpdatePlanRequest.md +docs/Model/SubAccountUpdatePlanRequestCredits.md +docs/Model/SubAccountUpdatePlanRequestFeatures.md +docs/Model/SubAccountsResponse.md +docs/Model/SubAccountsResponseSubAccountsInner.md +docs/Model/SubAccountsResponseSubAccountsInnerGroupsInner.md +docs/Model/SubscriptionNotFoundErrorResponse.md +docs/Model/Task.md +docs/Model/TaskList.md +docs/Model/TaskReminder.md +docs/Model/TaskTypes.md +docs/Model/Tier.md +docs/Model/TierAccessConditionsInner.md +docs/Model/TierForContact.md +docs/Model/TierGroup.md +docs/Model/TierGroupPage.md +docs/Model/TierRequest.md +docs/Model/TierRequestAccessConditionsInner.md +docs/Model/TierRequestTierRewardsInner.md +docs/Model/TierTierRewardsInner.md +docs/Model/Transaction.md +docs/Model/UnauthorizedResponse.md +docs/Model/UpdateAttribute.md +docs/Model/UpdateAttributeEnumerationInner.md +docs/Model/UpdateBalanceDefinitionPayload.md +docs/Model/UpdateBatchContacts.md +docs/Model/UpdateBatchContactsContactsInner.md +docs/Model/UpdateBatchContactsModel.md +docs/Model/UpdateCampaignStatus.md +docs/Model/UpdateContact.md +docs/Model/UpdateCouponCollection200Response.md +docs/Model/UpdateCouponCollectionRequest.md +docs/Model/UpdateEmailCampaign.md +docs/Model/UpdateEmailCampaignEmailExpirationDate.md +docs/Model/UpdateEmailCampaignRecipients.md +docs/Model/UpdateEmailCampaignSender.md +docs/Model/UpdateExternalFeed.md +docs/Model/UpdateList.md +docs/Model/UpdateLoyaltyProgramPayload.md +docs/Model/UpdateSender.md +docs/Model/UpdateSmsCampaign.md +docs/Model/UpdateSmtpTemplate.md +docs/Model/UpdateSmtpTemplateSender.md +docs/Model/UpdateTierGroup404Response.md +docs/Model/UpdateTierGroupRequest.md +docs/Model/UpdateUserResponse.md +docs/Model/UpdateWebhook.md +docs/Model/UpdateWhatsAppCampaign.md +docs/Model/UploadImageModel.md +docs/Model/UploadImageToGallery.md +docs/Model/ValidateRewardPayload.md +docs/Model/ValidatedRewardResponse.md +docs/Model/ValidationError.md +docs/Model/VariablesItems.md +docs/Model/VersionInfo.md +docs/Model/WhatsappCampStats.md +docs/Model/WhatsappCampTemplate.md +git_push.sh +lib/Api/AccountApi.php +lib/Api/BalanceApi.php +lib/Api/CompaniesApi.php +lib/Api/ContactsApi.php +lib/Api/ConversationsApi.php +lib/Api/CouponsApi.php +lib/Api/DealsApi.php +lib/Api/DomainsApi.php +lib/Api/EcommerceApi.php +lib/Api/EmailCampaignsApi.php +lib/Api/EventApi.php +lib/Api/ExternalFeedsApi.php +lib/Api/FilesApi.php +lib/Api/InboundParsingApi.php +lib/Api/MasterAccountApi.php +lib/Api/NotesApi.php +lib/Api/PaymentsApi.php +lib/Api/ProcessApi.php +lib/Api/ProgramApi.php +lib/Api/RewardsApi.php +lib/Api/SMSCampaignsApi.php +lib/Api/SendersApi.php +lib/Api/TasksApi.php +lib/Api/TierApi.php +lib/Api/TransactionalEmailsApi.php +lib/Api/TransactionalSMSApi.php +lib/Api/TransactionalWhatsAppApi.php +lib/Api/UserApi.php +lib/Api/WebhooksApi.php +lib/Api/WhatsAppCampaignsApi.php +lib/ApiException.php +lib/Configuration.php +lib/HeaderSelector.php +lib/Models/AbTestCampaignResult.php +lib/Models/AbTestCampaignResultClickedLinks.php +lib/Models/AbTestCampaignResultStatistics.php +lib/Models/AbTestVersionClicksInner.php +lib/Models/AbTestVersionStats.php +lib/Models/AbstractModel.php +lib/Models/AddContactToListByEmails.php +lib/Models/AddContactToListByExtIDs.php +lib/Models/AddContactToListByIDs.php +lib/Models/AddContactToListRequest.php +lib/Models/AttributeRewardPayload.php +lib/Models/AttributedRewardFailedConditionErrorResponse.php +lib/Models/AuthenticateDomainModel.php +lib/Models/BadRequestPayload.php +lib/Models/Balance.php +lib/Models/BalanceBalancesInner.php +lib/Models/BalanceDefinition.php +lib/Models/BalanceDefinitionIdDoesNotExist.php +lib/Models/BalanceDefinitionPage.php +lib/Models/BalanceLimit.php +lib/Models/BalanceLimitPayload.php +lib/Models/BalancePage.php +lib/Models/BlockDomain.php +lib/Models/CancelledTransaction.php +lib/Models/Cart.php +lib/Models/CompaniesIdPatchRequest.php +lib/Models/CompaniesImportPost200Response.php +lib/Models/CompaniesImportPost400Response.php +lib/Models/CompaniesLinkUnlinkIdPatchRequest.php +lib/Models/CompaniesList.php +lib/Models/CompaniesPost200Response.php +lib/Models/CompaniesPostRequest.php +lib/Models/Company.php +lib/Models/CompanyAttributesInner.php +lib/Models/CompleteTransactionPayload.php +lib/Models/CompletedTransaction.php +lib/Models/ComponentItems.php +lib/Models/Configuration.php +lib/Models/ContactBalances.php +lib/Models/ContactBalancesBalancesInner.php +lib/Models/ContactErrorModel.php +lib/Models/ContactIdInvalidResponse.php +lib/Models/ConversationsAgentOnlinePingPostRequest.php +lib/Models/ConversationsMessage.php +lib/Models/ConversationsMessageFile.php +lib/Models/ConversationsMessageFileImageInfo.php +lib/Models/ConversationsMessagesIdPutRequest.php +lib/Models/ConversationsMessagesPostRequest.php +lib/Models/ConversationsPushedMessagesPostRequest.php +lib/Models/ConversionSourceMetrics.php +lib/Models/ConversionSourceProduct.php +lib/Models/CorporateGroupDetailsResponse.php +lib/Models/CorporateGroupDetailsResponseGroup.php +lib/Models/CorporateGroupDetailsResponseSubAccountsInner.php +lib/Models/CorporateGroupDetailsResponseUsersInner.php +lib/Models/CorporateGroupIdPutRequest.php +lib/Models/CorporateGroupPost201Response.php +lib/Models/CorporateGroupPostRequest.php +lib/Models/CorporateGroupUnlinkGroupIdSubAccountsPutRequest.php +lib/Models/CorporateIpGet200ResponseInner.php +lib/Models/CorporateSsoTokenPostRequest.php +lib/Models/CorporateSubAccountIpAssociatePostRequest.php +lib/Models/CorporateSubAccountIpDissociatePutRequest.php +lib/Models/CorporateSubAccountKeyPostRequest.php +lib/Models/CorporateSubAccountSsoTokenPostRequest.php +lib/Models/CorporateUserEmailPermissionsPutRequest.php +lib/Models/CorporateUserEmailPermissionsPutRequestPrivilegesInner.php +lib/Models/CorporateUserInvitationActionEmailPut200Response.php +lib/Models/CreateApiKeyResponse.php +lib/Models/CreateAttribute.php +lib/Models/CreateAttributeEnumerationInner.php +lib/Models/CreateBalanceDefinitionPayload.php +lib/Models/CreateCategoryModel.php +lib/Models/CreateContact.php +lib/Models/CreateCouponCollection201Response.php +lib/Models/CreateCouponCollectionRequest.php +lib/Models/CreateCouponsRequest.php +lib/Models/CreateDoiContact.php +lib/Models/CreateDoiContactAttributesValue.php +lib/Models/CreateDomain.php +lib/Models/CreateDomainModel.php +lib/Models/CreateDomainModelDnsRecords.php +lib/Models/CreateDomainModelDnsRecordsDkimRecord.php +lib/Models/CreateEmailCampaign.php +lib/Models/CreateEmailCampaignEmailExpirationDate.php +lib/Models/CreateEmailCampaignRecipients.php +lib/Models/CreateEmailCampaignSender.php +lib/Models/CreateExternalFeed.php +lib/Models/CreateExternalFeed201Response.php +lib/Models/CreateList.php +lib/Models/CreateLoyaltyProgramPayload.php +lib/Models/CreateModel.php +lib/Models/CreateOrderPayload.php +lib/Models/CreatePaymentRequest.php +lib/Models/CreatePaymentResponse.php +lib/Models/CreateProductModel.php +lib/Models/CreateSender.php +lib/Models/CreateSenderIpsInner.php +lib/Models/CreateSenderModel.php +lib/Models/CreateSmsCampaign.php +lib/Models/CreateSmsCampaignRecipients.php +lib/Models/CreateSmtpEmail.php +lib/Models/CreateSmtpTemplate.php +lib/Models/CreateSmtpTemplateSender.php +lib/Models/CreateSubAccount.php +lib/Models/CreateSubAccountResponse.php +lib/Models/CreateSubscriptionMemberPayload.php +lib/Models/CreateSubscriptionMemberResponse.php +lib/Models/CreateSubscriptionPayload.php +lib/Models/CreateSubscriptionResponse.php +lib/Models/CreateTierGroupRequest.php +lib/Models/CreateTransactionPayload.php +lib/Models/CreateUpdateBatchCategory.php +lib/Models/CreateUpdateBatchCategoryModel.php +lib/Models/CreateUpdateBatchProducts.php +lib/Models/CreateUpdateBatchProductsModel.php +lib/Models/CreateUpdateCategories.php +lib/Models/CreateUpdateCategory.php +lib/Models/CreateUpdateContactModel.php +lib/Models/CreateUpdateFolder.php +lib/Models/CreateUpdateProduct.php +lib/Models/CreateUpdateProducts.php +lib/Models/CreateWebhook.php +lib/Models/CreateWhatsAppCampaign.php +lib/Models/CreateWhatsAppCampaignRecipients.php +lib/Models/CreateWhatsAppTemplate.php +lib/Models/CreatedBatchId.php +lib/Models/CreatedProcessId.php +lib/Models/CrmDealsIdPatchRequest.php +lib/Models/CrmDealsLinkUnlinkIdPatchRequest.php +lib/Models/CrmDealsPost201Response.php +lib/Models/CrmDealsPostRequest.php +lib/Models/CrmTasksIdPatchRequest.php +lib/Models/CrmTasksPost201Response.php +lib/Models/CrmTasksPostRequest.php +lib/Models/Deal.php +lib/Models/DealAttributesInner.php +lib/Models/DealsList.php +lib/Models/DeleteHardbounces.php +lib/Models/DeleteSubscriptionMemberPayload.php +lib/Models/EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response.php +lib/Models/EcommerceAttributionMetricsGet200Response.php +lib/Models/EcommerceAttributionMetricsGet200ResponseTotals.php +lib/Models/EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response.php +lib/Models/EcommerceConfigDisplayCurrencyGet200Response.php +lib/Models/EmailExportRecipients.php +lib/Models/ErrorModel.php +lib/Models/ErrorResponse.php +lib/Models/Event.php +lib/Models/EventContactPropertiesValue.php +lib/Models/EventEventPropertiesValue.php +lib/Models/EventIdentifiers.php +lib/Models/ExportWebhooksHistory.php +lib/Models/ExportWebhooksHistoryRequest.php +lib/Models/FileData.php +lib/Models/FileDownloadableLink.php +lib/Models/GetAccount.php +lib/Models/GetAccountActivity.php +lib/Models/GetAccountActivityLogsInner.php +lib/Models/GetAccountAllOfMarketingAutomation.php +lib/Models/GetAccountAllOfPlan.php +lib/Models/GetAccountAllOfRelay.php +lib/Models/GetAccountAllOfRelayData.php +lib/Models/GetAggregatedReport.php +lib/Models/GetAllExternalFeeds.php +lib/Models/GetAllExternalFeedsFeedsInner.php +lib/Models/GetAttributes.php +lib/Models/GetAttributesAttributesInner.php +lib/Models/GetAttributesAttributesInnerEnumerationInner.php +lib/Models/GetBlockedDomains.php +lib/Models/GetCampaignOverview.php +lib/Models/GetCampaignRecipients.php +lib/Models/GetCampaignStats.php +lib/Models/GetCategories.php +lib/Models/GetCategoryDetails.php +lib/Models/GetClient.php +lib/Models/GetContactCampaignStats.php +lib/Models/GetContactCampaignStatsClickedInner.php +lib/Models/GetContactCampaignStatsOpenedInner.php +lib/Models/GetContactCampaignStatsTransacAttributesInner.php +lib/Models/GetContactCampaignStatsUnsubscriptions.php +lib/Models/GetContactDetails.php +lib/Models/GetContactInfoIdentifierParameter.php +lib/Models/GetContacts.php +lib/Models/GetCorporateInvitedUsersList.php +lib/Models/GetCorporateInvitedUsersListUsersInner.php +lib/Models/GetCorporateInvitedUsersListUsersInnerFeatureAccess.php +lib/Models/GetCorporateInvitedUsersListUsersInnerGroups.php +lib/Models/GetCorporateUserPermission.php +lib/Models/GetCorporateUserPermissionFeatureAccess.php +lib/Models/GetCorporateUserPermissionGroupsInner.php +lib/Models/GetCouponCollection.php +lib/Models/GetDeviceBrowserStats.php +lib/Models/GetDomainConfigurationModel.php +lib/Models/GetDomainsList.php +lib/Models/GetDomainsListDomainsInner.php +lib/Models/GetEmailCampaign.php +lib/Models/GetEmailCampaigns.php +lib/Models/GetEmailCampaignsCampaignsInner.php +lib/Models/GetEmailEventReport.php +lib/Models/GetEmailEventReportEventsInner.php +lib/Models/GetExtendedCampaignOverview.php +lib/Models/GetExtendedCampaignOverviewAllOfSender.php +lib/Models/GetExtendedCampaignStats.php +lib/Models/GetExtendedClient.php +lib/Models/GetExtendedClientAllOfAddress.php +lib/Models/GetExtendedContactDetails.php +lib/Models/GetExtendedContactDetailsAllOfStatistics.php +lib/Models/GetExtendedContactDetailsAllOfStatisticsClicked.php +lib/Models/GetExtendedContactDetailsAllOfStatisticsLinks.php +lib/Models/GetExtendedContactDetailsAllOfStatisticsMessagesSent.php +lib/Models/GetExtendedContactDetailsAllOfStatisticsOpened.php +lib/Models/GetExtendedContactDetailsAllOfStatisticsUnsubscriptions.php +lib/Models/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription.php +lib/Models/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription.php +lib/Models/GetExtendedList.php +lib/Models/GetExtendedListAllOfCampaignStats.php +lib/Models/GetExternalFeedByUUID.php +lib/Models/GetExternalFeedByUUIDHeadersInner.php +lib/Models/GetFolder.php +lib/Models/GetFolderLists.php +lib/Models/GetFolders.php +lib/Models/GetInboundEmailEvents.php +lib/Models/GetInboundEmailEventsByUuid.php +lib/Models/GetInboundEmailEventsByUuidAttachmentsInner.php +lib/Models/GetInboundEmailEventsByUuidLogsInner.php +lib/Models/GetInboundEmailEventsEventsInner.php +lib/Models/GetInvitedUsersList.php +lib/Models/GetInvitedUsersListUsersInner.php +lib/Models/GetInvitedUsersListUsersInnerFeatureAccess.php +lib/Models/GetIp.php +lib/Models/GetIpFromSender.php +lib/Models/GetIps.php +lib/Models/GetIpsFromSender.php +lib/Models/GetList.php +lib/Models/GetLists.php +lib/Models/GetListsListsInner.php +lib/Models/GetPaymentRequest.php +lib/Models/GetProcess.php +lib/Models/GetProcesses.php +lib/Models/GetProductDetails.php +lib/Models/GetProducts.php +lib/Models/GetReports.php +lib/Models/GetReportsReportsInner.php +lib/Models/GetScheduledEmailByBatchId.php +lib/Models/GetScheduledEmailByBatchIdBatchesInner.php +lib/Models/GetScheduledEmailById200Response.php +lib/Models/GetScheduledEmailByMessageId.php +lib/Models/GetSegments.php +lib/Models/GetSendersList.php +lib/Models/GetSendersListSendersInner.php +lib/Models/GetSendersListSendersInnerIpsInner.php +lib/Models/GetSharedTemplateUrl.php +lib/Models/GetSmsCampaign.php +lib/Models/GetSmsCampaignOverview.php +lib/Models/GetSmsCampaignStats.php +lib/Models/GetSmsCampaigns.php +lib/Models/GetSmsCampaignsCampaignsInner.php +lib/Models/GetSmsEventReport.php +lib/Models/GetSmsEventReportEventsInner.php +lib/Models/GetSmtpTemplateOverview.php +lib/Models/GetSmtpTemplateOverviewSender.php +lib/Models/GetSmtpTemplates.php +lib/Models/GetSsoToken.php +lib/Models/GetStatsByDevice.php +lib/Models/GetSubAccountGroups200ResponseInner.php +lib/Models/GetSubscriptionInfoResponse.php +lib/Models/GetSubscriptionInfoResponseBalance.php +lib/Models/GetSubscriptionInfoResponseBalanceBalancesInner.php +lib/Models/GetSubscriptionInfoResponseMembersInner.php +lib/Models/GetSubscriptionInfoResponseRewardInner.php +lib/Models/GetSubscriptionInfoResponseTierInner.php +lib/Models/GetSubscriptionMemberResponse.php +lib/Models/GetSubscriptionMemberResponseMemberContactIdInner.php +lib/Models/GetTransacAggregatedSmsReport.php +lib/Models/GetTransacBlockedContacts.php +lib/Models/GetTransacBlockedContactsContactsInner.php +lib/Models/GetTransacBlockedContactsContactsInnerReason.php +lib/Models/GetTransacEmailContent.php +lib/Models/GetTransacEmailContentEventsInner.php +lib/Models/GetTransacEmailsList.php +lib/Models/GetTransacEmailsListTransactionalEmailsInner.php +lib/Models/GetTransacSmsReport.php +lib/Models/GetTransacSmsReportReportsInner.php +lib/Models/GetUserPermission.php +lib/Models/GetUserPermissionPrivilegesInner.php +lib/Models/GetVersionInfoResponse.php +lib/Models/GetWebhook.php +lib/Models/GetWebhooks.php +lib/Models/GetWhatsAppConfig.php +lib/Models/GetWhatsappCampaignOverview.php +lib/Models/GetWhatsappCampaigns.php +lib/Models/GetWhatsappCampaignsCampaignsInner.php +lib/Models/GetWhatsappEventReport.php +lib/Models/GetWhatsappEventReportEventsInner.php +lib/Models/GetWhatsappTemplates.php +lib/Models/GetWhatsappTemplatesTemplatesInner.php +lib/Models/InviteAdminUser.php +lib/Models/InviteAdminUserPrivilegesInner.php +lib/Models/Inviteuser.php +lib/Models/InviteuserPrivilegesInner.php +lib/Models/InviteuserResponse.php +lib/Models/LoyaltyProgram.php +lib/Models/LoyaltyProgramPage.php +lib/Models/LoyaltyProgramValidationError.php +lib/Models/LoyaltyTierPage.php +lib/Models/MasterDetailsResponse.php +lib/Models/MasterDetailsResponseBillingInfo.php +lib/Models/MasterDetailsResponseBillingInfoAddress.php +lib/Models/MasterDetailsResponseBillingInfoName.php +lib/Models/MasterDetailsResponsePlanInfo.php +lib/Models/MasterDetailsResponsePlanInfoFeaturesInner.php +lib/Models/ModelInterface.php +lib/Models/Note.php +lib/Models/NoteData.php +lib/Models/NoteId.php +lib/Models/Notification.php +lib/Models/Offer.php +lib/Models/OfferList.php +lib/Models/OffersListResponse.php +lib/Models/Order.php +lib/Models/OrderBatch.php +lib/Models/OrderBilling.php +lib/Models/OrderIdentifiers.php +lib/Models/OrderProductsInner.php +lib/Models/Otp.php +lib/Models/PatchLoyaltyProgramPayload.php +lib/Models/Pipeline.php +lib/Models/PipelineStage.php +lib/Models/PostContactInfo.php +lib/Models/PostContactInfoContacts.php +lib/Models/PostContactInfoContactsFailure.php +lib/Models/PostContactInfoContactsSuccess.php +lib/Models/PostSendFailed.php +lib/Models/PostSendSmsTestFailed.php +lib/Models/PutRevokeUserPermission.php +lib/Models/PutRevokeUserPermissionResponse.php +lib/Models/Putresendcancelinvitation.php +lib/Models/PutresendcancelinvitationResponse.php +lib/Models/RedeemRewardPayload.php +lib/Models/RedeemedRewardFailedConditionErrorResponse.php +lib/Models/RemoveContactFromListByAll.php +lib/Models/RemoveContactFromListByEmails.php +lib/Models/RemoveContactFromListByExtIDs.php +lib/Models/RemoveContactFromListByIDs.php +lib/Models/RemoveContactFromListRequest.php +lib/Models/RequestContactExport.php +lib/Models/RequestContactExportCustomContactFilter.php +lib/Models/RequestContactImport.php +lib/Models/RequestContactImportJsonBodyInner.php +lib/Models/RequestContactImportNewList.php +lib/Models/RequestSmsRecipientExport.php +lib/Models/RewardAttributionResponse.php +lib/Models/RewardRedeemResponse.php +lib/Models/ScheduleSmtpEmail.php +lib/Models/Segment.php +lib/Models/SendReport.php +lib/Models/SendReportEmail.php +lib/Models/SendSms.php +lib/Models/SendSmtpEmail.php +lib/Models/SendSmtpEmailAttachmentInner.php +lib/Models/SendSmtpEmailBccInner.php +lib/Models/SendSmtpEmailCcInner.php +lib/Models/SendSmtpEmailMessageVersionsInner.php +lib/Models/SendSmtpEmailReplyTo.php +lib/Models/SendSmtpEmailSender.php +lib/Models/SendSmtpEmailToInner.php +lib/Models/SendTestEmail.php +lib/Models/SendTestSms.php +lib/Models/SendTransacSms.php +lib/Models/SendWhatsappMessage201Response.php +lib/Models/SendWhatsappMessageRequest.php +lib/Models/SendWhatsappMessageTemplate.php +lib/Models/SendWhatsappMessageText.php +lib/Models/SubAccountAppsToggleRequest.php +lib/Models/SubAccountDetailsResponse.php +lib/Models/SubAccountDetailsResponseGroupsInner.php +lib/Models/SubAccountDetailsResponsePlanInfo.php +lib/Models/SubAccountDetailsResponsePlanInfoCredits.php +lib/Models/SubAccountDetailsResponsePlanInfoCreditsEmails.php +lib/Models/SubAccountDetailsResponsePlanInfoCreditsExternalFeeds.php +lib/Models/SubAccountDetailsResponsePlanInfoCreditsSms.php +lib/Models/SubAccountDetailsResponsePlanInfoCreditsWhatsapp.php +lib/Models/SubAccountDetailsResponsePlanInfoCreditsWpSubscribers.php +lib/Models/SubAccountDetailsResponsePlanInfoFeatures.php +lib/Models/SubAccountDetailsResponsePlanInfoFeaturesInbox.php +lib/Models/SubAccountDetailsResponsePlanInfoFeaturesLandingPage.php +lib/Models/SubAccountDetailsResponsePlanInfoFeaturesUsers.php +lib/Models/SubAccountUpdatePlanRequest.php +lib/Models/SubAccountUpdatePlanRequestCredits.php +lib/Models/SubAccountUpdatePlanRequestFeatures.php +lib/Models/SubAccountsResponse.php +lib/Models/SubAccountsResponseSubAccountsInner.php +lib/Models/SubAccountsResponseSubAccountsInnerGroupsInner.php +lib/Models/SubscriptionNotFoundErrorResponse.php +lib/Models/Task.php +lib/Models/TaskList.php +lib/Models/TaskReminder.php +lib/Models/TaskTypes.php +lib/Models/Tier.php +lib/Models/TierAccessConditionsInner.php +lib/Models/TierForContact.php +lib/Models/TierGroup.php +lib/Models/TierGroupPage.php +lib/Models/TierRequest.php +lib/Models/TierRequestAccessConditionsInner.php +lib/Models/TierRequestTierRewardsInner.php +lib/Models/TierTierRewardsInner.php +lib/Models/Transaction.php +lib/Models/UnauthorizedResponse.php +lib/Models/UpdateAttribute.php +lib/Models/UpdateAttributeEnumerationInner.php +lib/Models/UpdateBalanceDefinitionPayload.php +lib/Models/UpdateBatchContacts.php +lib/Models/UpdateBatchContactsContactsInner.php +lib/Models/UpdateBatchContactsModel.php +lib/Models/UpdateCampaignStatus.php +lib/Models/UpdateContact.php +lib/Models/UpdateCouponCollection200Response.php +lib/Models/UpdateCouponCollectionRequest.php +lib/Models/UpdateEmailCampaign.php +lib/Models/UpdateEmailCampaignEmailExpirationDate.php +lib/Models/UpdateEmailCampaignRecipients.php +lib/Models/UpdateEmailCampaignSender.php +lib/Models/UpdateExternalFeed.php +lib/Models/UpdateList.php +lib/Models/UpdateLoyaltyProgramPayload.php +lib/Models/UpdateSender.php +lib/Models/UpdateSmsCampaign.php +lib/Models/UpdateSmtpTemplate.php +lib/Models/UpdateSmtpTemplateSender.php +lib/Models/UpdateTierGroup404Response.php +lib/Models/UpdateTierGroupRequest.php +lib/Models/UpdateUserResponse.php +lib/Models/UpdateWebhook.php +lib/Models/UpdateWhatsAppCampaign.php +lib/Models/UploadImageModel.php +lib/Models/UploadImageToGallery.php +lib/Models/ValidateRewardPayload.php +lib/Models/ValidatedRewardResponse.php +lib/Models/ValidationError.php +lib/Models/VariablesItems.php +lib/Models/VersionInfo.php +lib/Models/WhatsappCampStats.php +lib/Models/WhatsappCampTemplate.php +lib/ObjectSerializer.php +phpunit.xml.dist +tests/Model/SegmentTest.php diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..4bc5d61 --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.9.0 diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..af9cf39 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,29 @@ +in(__DIR__) + ->exclude('vendor') + ->exclude('test') + ->exclude('tests') +; + +$config = new PhpCsFixer\Config(); +return $config->setRules([ + '@PSR12' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + 'no_leading_import_slash' => false, + ]) + ->setFinder($finder) +; diff --git a/.phplint.yml b/.phplint.yml new file mode 100644 index 0000000..7cd1307 --- /dev/null +++ b/.phplint.yml @@ -0,0 +1,11 @@ +path: + - ./lib + - ./tests +jobs: 10 +extensions: + - php +exclude: + - vendor +warning: true +memory-limit: -1 +no-cache: true diff --git a/.travis.yml b/.travis.yml index e93086b..707be2a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,12 @@ language: php -sudo: false +# Jammy Jellyfish environment has preinstalled PHP 8.1 +# Focal Fossa doesn't fit since it contains preinstalled PHP 7.4 only +# https://docs.travis-ci.com/user/reference/jammy/#php-support +dist: jammy +os: + - linux php: - - 5.6 - - 7.0 + - 8.1 + - 8.2 before_install: "composer install" -script: "vendor/bin/phpunit" \ No newline at end of file +script: "vendor/bin/phpunit" diff --git a/README.md b/README.md index 5dc8b62..528485c 100644 --- a/README.md +++ b/README.md @@ -1,53 +1,62 @@ -# Brevo's API v3 Php Library - -Brevo's API exposes the entire Brevo features via a standardized programmatic interface. Please refer to the full [documentation](https://developers.brevo.com) to learn more. - -This is the wrapper for the API. It implements all the features of the API v3. +# Brevo's API v3 Php Library + +Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : + - Manage your campaigns and get the statistics + - Manage your contacts + - Send transactional Emails and SMS + - and much more... + +You can download our wrappers at https://github.com/orgs/brevo + +**Possible responses** + | Code | Message | + | :-------------: | ------------- | + | 200 | OK. Successful Request | + | 201 | OK. Successful Creation | + | 202 | OK. Request accepted | + | 204 | OK. Successful Update/Deletion | + | 400 | Error. Bad Request | + | 401 | Error. Authentication Needed | + | 402 | Error. Not enough credit, plan upgrade needed | + | 403 | Error. Permission denied | + | 404 | Error. Object does not exist | + | 405 | Error. Method not allowed | + | 406 | Error. Not Acceptable | + | 422 | Error. Unprocessable Entity | + + +For more information, please visit [https://account.brevo.com/support](https://account.brevo.com/support). Brevo's API matches the [OpenAPI v2 definition](https://www.openapis.org/). The specification can be downloaded [here](https://api.brevo.com/v3/swagger_definition.yml). -This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project and is reviewed and maintained by Brevo: -- API version: 3.0.0 -- Build package: io.swagger.codegen.languages.PhpClientCodegen -For more information, please visit [https://account.brevo.com/support](https://account.brevo.com/support) +## Installation & Usage -## Requirements +### Requirements -PHP 5.6 and later +PHP 8.1 and later. -## Installation & Usage ### Composer -To install the bindings via [Composer](http://getcomposer.org/): - -Create a ```composer.json``` file in any directory & add below code in composer.json file. +To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`: -``` +```json { -"require": { -"getbrevo/brevo-php": "1.x.x" -} + "require": { + "getbrevo/brevo-php": "*" + } } ``` -Then run below commands in the same directory -``` -composer require getbrevo/brevo-php "1.x.x" -``` +Then run `composer install` -Further do: -* run ``composer install`` to get these dependencies added to your vendor directory -* add the autoloader to your application with this line: ``require("vendor/autoload.php")`` +### Manual Installation +Download the files and include `autoload.php`: -## Tests - -To run the unit tests: - -``` -composer install -./vendor/bin/phpunit +```php +setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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. @@ -81,10 +94,9 @@ try { echo 'Exception when calling AccountApi->getAccount: ', $e->getMessage(), PHP_EOL; } -?> ``` -## Documentation for API Endpoints +## API Endpoints All URIs are relative to *https://api.brevo.com/v3* @@ -92,28 +104,29 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *AccountApi* | [**getAccount**](docs/Api/AccountApi.md#getaccount) | **GET** /account | Get your account information, plan and credits details *AccountApi* | [**getAccountActivity**](docs/Api/AccountApi.md#getaccountactivity) | **GET** /organization/activities | Get user activity logs +*BalanceApi* | [**beginTransaction**](docs/Api/BalanceApi.md#begintransaction) | **POST** /loyalty/balance/programs/{loyaltyProgramId}/transactions | Create new transaction +*BalanceApi* | [**cancelTransaction**](docs/Api/BalanceApi.md#canceltransaction) | **POST** /loyalty/balance/programs/{loyaltyProgramId}/transactions/{transactionId}/cancel | Cancel transaction +*BalanceApi* | [**completeTransaction**](docs/Api/BalanceApi.md#completetransaction) | **POST** /loyalty/balance/programs/{loyaltyProgramId}/transactions/{transactionId}/complete | Complete transaction +*BalanceApi* | [**createBalanceOrder**](docs/Api/BalanceApi.md#createbalanceorder) | **POST** /loyalty/balance/programs/{loyaltyProgramId}/create-order | Create balance order +*BalanceApi* | [**getBalanceDefinitionList**](docs/Api/BalanceApi.md#getbalancedefinitionlist) | **GET** /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions | Get balance definition list +*BalanceApi* | [**getContactBalances**](docs/Api/BalanceApi.md#getcontactbalances) | **GET** /loyalty/balance/programs/{loyaltyProgramId}/contact-balances | Get balance list +*BalanceApi* | [**getSubscriptionBalances**](docs/Api/BalanceApi.md#getsubscriptionbalances) | **GET** /loyalty/balance/programs/{loyaltyProgramId}/subscriptions/{contactId}/balances | Get subscription balances +*BalanceApi* | [**loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete**](docs/Api/BalanceApi.md#loyaltybalanceprogramsloyaltyprogramidbalancedefinitionsbalancedefinitioniddelete) | **DELETE** /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId} | Delete balance definition +*BalanceApi* | [**loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet**](docs/Api/BalanceApi.md#loyaltybalanceprogramsloyaltyprogramidbalancedefinitionsbalancedefinitionidget) | **GET** /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId} | Get balance definition +*BalanceApi* | [**loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete**](docs/Api/BalanceApi.md#loyaltybalanceprogramsloyaltyprogramidbalancedefinitionsbalancedefinitionidlimitsbalancelimitiddelete) | **DELETE** /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId}/limits/{balanceLimitId} | Delete balance limit +*BalanceApi* | [**loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet**](docs/Api/BalanceApi.md#loyaltybalanceprogramsloyaltyprogramidbalancedefinitionsbalancedefinitionidlimitsbalancelimitidget) | **GET** /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId}/limits/{balanceLimitId} | Get balance limits +*BalanceApi* | [**loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut**](docs/Api/BalanceApi.md#loyaltybalanceprogramsloyaltyprogramidbalancedefinitionsbalancedefinitionidlimitsbalancelimitidput) | **PUT** /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId}/limits/{balanceLimitId} | Updates balance limit +*BalanceApi* | [**loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost**](docs/Api/BalanceApi.md#loyaltybalanceprogramsloyaltyprogramidbalancedefinitionsbalancedefinitionidlimitspost) | **POST** /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId}/limits | Create balance limits +*BalanceApi* | [**loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut**](docs/Api/BalanceApi.md#loyaltybalanceprogramsloyaltyprogramidbalancedefinitionsbalancedefinitionidput) | **PUT** /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId} | Update balance definition +*BalanceApi* | [**loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost**](docs/Api/BalanceApi.md#loyaltybalanceprogramsloyaltyprogramidbalancedefinitionspost) | **POST** /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions | Create balance definition *CompaniesApi* | [**companiesAttributesGet**](docs/Api/CompaniesApi.md#companiesattributesget) | **GET** /companies/attributes | Get company attributes -*CompaniesApi* | [**companiesGet**](docs/Api/CompaniesApi.md#companiesget) | **GET** /companies | Get all companies +*CompaniesApi* | [**companiesGet**](docs/Api/CompaniesApi.md#companiesget) | **GET** /companies | Get all Companies *CompaniesApi* | [**companiesIdDelete**](docs/Api/CompaniesApi.md#companiesiddelete) | **DELETE** /companies/{id} | Delete a company *CompaniesApi* | [**companiesIdGet**](docs/Api/CompaniesApi.md#companiesidget) | **GET** /companies/{id} | Get a company *CompaniesApi* | [**companiesIdPatch**](docs/Api/CompaniesApi.md#companiesidpatch) | **PATCH** /companies/{id} | Update a company -*CompaniesApi* | [**companiesLinkUnlinkIdPatch**](docs/Api/CompaniesApi.md#companieslinkunlinkidpatch) | **PATCH** /companies/link-unlink/{id} | Link and Unlink company with contacts and deals +*CompaniesApi* | [**companiesImportPost**](docs/Api/CompaniesApi.md#companiesimportpost) | **POST** /companies/import | Import companies(creation and updation) +*CompaniesApi* | [**companiesLinkUnlinkIdPatch**](docs/Api/CompaniesApi.md#companieslinkunlinkidpatch) | **PATCH** /companies/link-unlink/{id} | Link and Unlink company with contact and deal *CompaniesApi* | [**companiesPost**](docs/Api/CompaniesApi.md#companiespost) | **POST** /companies | Create a company -*AttributesApi* | [**createAttribute**](docs/Api/AttributesApi.md#createattribute) | **POST** /contacts/attributes/{attributeCategory}/{attributeName} | Create contact attribute -*AttributesApi* | [**deleteAttribute**](docs/Api/AttributesApi.md#deleteattribute) | **DELETE** /contacts/attributes/{attributeCategory}/{attributeName} | Delete an attribute -*AttributesApi* | [**getAttributes**](docs/Api/AttributesApi.md#getattributes) | **GET** /contacts/attributes | List all attributes -*AttributesApi* | [**updateAttribute**](docs/Api/AttributesApi.md#updateattribute) | **PUT** /contacts/attributes/{attributeCategory}/{attributeName} | Update contact attribute -*CRMApi* | [**crmNotesGet**](docs/Api/CRMApi.md#crmnotesget) | **GET** /crm/notes | Get all notes -*CRMApi* | [**crmNotesIdDelete**](docs/Api/CRMApi.md#crmnotesiddelete) | **DELETE** /crm/notes/{id} | Delete a note -*CRMApi* | [**crmNotesIdGet**](docs/Api/CRMApi.md#crmnotesidget) | **GET** /crm/notes/{id} | Get a note -*CRMApi* | [**crmNotesIdPatch**](docs/Api/CRMApi.md#crmnotesidpatch) | **PATCH** /crm/notes/{id} | Update a note -*CRMApi* | [**crmNotesPost**](docs/Api/CRMApi.md#crmnotespost) | **POST** /crm/notes | Create a note -*CRMApi* | [**crmTasksGet**](docs/Api/CRMApi.md#crmtasksget) | **GET** /crm/tasks | Get all tasks -*CRMApi* | [**crmTasksIdDelete**](docs/Api/CRMApi.md#crmtasksiddelete) | **DELETE** /crm/tasks/{id} | Delete a task -*CRMApi* | [**crmTasksIdGet**](docs/Api/CRMApi.md#crmtasksidget) | **GET** /crm/tasks/{id} | Get a task -*CRMApi* | [**crmTasksIdPatch**](docs/Api/CRMApi.md#crmtasksidpatch) | **PATCH** /crm/tasks/{id} | Update a task -*CRMApi* | [**crmTasksPost**](docs/Api/CRMApi.md#crmtaskspost) | **POST** /crm/tasks | Create a task -*CRMApi* | [**crmTasktypesGet**](docs/Api/CRMApi.md#crmtasktypesget) | **GET** /crm/tasktypes | Get all task types *ContactsApi* | [**addContactToList**](docs/Api/ContactsApi.md#addcontacttolist) | **POST** /contacts/lists/{listId}/contacts/add | Add existing contacts to a list *ContactsApi* | [**createAttribute**](docs/Api/ContactsApi.md#createattribute) | **POST** /contacts/attributes/{attributeCategory}/{attributeName} | Create contact attribute *ContactsApi* | [**createContact**](docs/Api/ContactsApi.md#createcontact) | **POST** /contacts | Create a contact @@ -135,7 +148,7 @@ Class | Method | HTTP request | Description *ContactsApi* | [**getFolders**](docs/Api/ContactsApi.md#getfolders) | **GET** /contacts/folders | Get all folders *ContactsApi* | [**getList**](docs/Api/ContactsApi.md#getlist) | **GET** /contacts/lists/{listId} | Get a list's details *ContactsApi* | [**getLists**](docs/Api/ContactsApi.md#getlists) | **GET** /contacts/lists | Get all the lists -*ContactsApi* | [**getSegments**](docs/Api/ContactsApi.md#getsegments) | **GET** /contacts/segments | Get all the Segments +*ContactsApi* | [**getSegments**](docs/Api/ContactsApi.md#getsegments) | **GET** /contacts/segments | Get all the segments *ContactsApi* | [**importContacts**](docs/Api/ContactsApi.md#importcontacts) | **POST** /contacts/import | Import contacts *ContactsApi* | [**removeContactFromList**](docs/Api/ContactsApi.md#removecontactfromlist) | **POST** /contacts/lists/{listId}/contacts/remove | Delete a contact from a list *ContactsApi* | [**requestContactExport**](docs/Api/ContactsApi.md#requestcontactexport) | **POST** /contacts/export | Export contacts @@ -163,6 +176,7 @@ Class | Method | HTTP request | Description *DealsApi* | [**crmDealsIdDelete**](docs/Api/DealsApi.md#crmdealsiddelete) | **DELETE** /crm/deals/{id} | Delete a deal *DealsApi* | [**crmDealsIdGet**](docs/Api/DealsApi.md#crmdealsidget) | **GET** /crm/deals/{id} | Get a deal *DealsApi* | [**crmDealsIdPatch**](docs/Api/DealsApi.md#crmdealsidpatch) | **PATCH** /crm/deals/{id} | Update a deal +*DealsApi* | [**crmDealsImportPost**](docs/Api/DealsApi.md#crmdealsimportpost) | **POST** /crm/deals/import | Import deals(creation and updation) *DealsApi* | [**crmDealsLinkUnlinkIdPatch**](docs/Api/DealsApi.md#crmdealslinkunlinkidpatch) | **PATCH** /crm/deals/link-unlink/{id} | Link and Unlink a deal with contacts and companies *DealsApi* | [**crmDealsPost**](docs/Api/DealsApi.md#crmdealspost) | **POST** /crm/deals | Create a deal *DealsApi* | [**crmPipelineDetailsAllGet**](docs/Api/DealsApi.md#crmpipelinedetailsallget) | **GET** /crm/pipeline/details/all | Get all pipelines @@ -180,11 +194,16 @@ Class | Method | HTTP request | Description *EcommerceApi* | [**createUpdateCategory**](docs/Api/EcommerceApi.md#createupdatecategory) | **POST** /categories | Create/Update a category *EcommerceApi* | [**createUpdateProduct**](docs/Api/EcommerceApi.md#createupdateproduct) | **POST** /products | Create/Update a product *EcommerceApi* | [**ecommerceActivatePost**](docs/Api/EcommerceApi.md#ecommerceactivatepost) | **POST** /ecommerce/activate | Activate the eCommerce app +*EcommerceApi* | [**ecommerceAttributionMetricsConversionSourceConversionSourceIdGet**](docs/Api/EcommerceApi.md#ecommerceattributionmetricsconversionsourceconversionsourceidget) | **GET** /ecommerce/attribution/metrics/{conversionSource}/{conversionSourceId} | Get detailed attribution metrics for a single Brevo campaign +*EcommerceApi* | [**ecommerceAttributionMetricsGet**](docs/Api/EcommerceApi.md#ecommerceattributionmetricsget) | **GET** /ecommerce/attribution/metrics | Get attribution metrics for one or more Brevo campaigns +*EcommerceApi* | [**ecommerceAttributionProductsConversionSourceConversionSourceIdGet**](docs/Api/EcommerceApi.md#ecommerceattributionproductsconversionsourceconversionsourceidget) | **GET** /ecommerce/attribution/products/{conversionSource}/{conversionSourceId} | Get attributed product sales for a single Brevo campaign +*EcommerceApi* | [**ecommerceConfigDisplayCurrencyGet**](docs/Api/EcommerceApi.md#ecommerceconfigdisplaycurrencyget) | **GET** /ecommerce/config/displayCurrency | Get the ISO 4217 compliant display currency code for your Brevo account *EcommerceApi* | [**getCategories**](docs/Api/EcommerceApi.md#getcategories) | **GET** /categories | Return all your categories *EcommerceApi* | [**getCategoryInfo**](docs/Api/EcommerceApi.md#getcategoryinfo) | **GET** /categories/{id} | Get a category details *EcommerceApi* | [**getOrders**](docs/Api/EcommerceApi.md#getorders) | **GET** /orders | Get order details *EcommerceApi* | [**getProductInfo**](docs/Api/EcommerceApi.md#getproductinfo) | **GET** /products/{id} | Get a product's details *EcommerceApi* | [**getProducts**](docs/Api/EcommerceApi.md#getproducts) | **GET** /products | Return all your products +*EcommerceApi* | [**setConfigDisplayCurrency**](docs/Api/EcommerceApi.md#setconfigdisplaycurrency) | **POST** /ecommerce/config/displayCurrency | Set the ISO 4217 compliant display currency code for your Brevo account *EmailCampaignsApi* | [**createEmailCampaign**](docs/Api/EmailCampaignsApi.md#createemailcampaign) | **POST** /emailCampaigns | Create an email campaign *EmailCampaignsApi* | [**deleteEmailCampaign**](docs/Api/EmailCampaignsApi.md#deleteemailcampaign) | **DELETE** /emailCampaigns/{campaignId} | Delete an email campaign *EmailCampaignsApi* | [**emailExportRecipients**](docs/Api/EmailCampaignsApi.md#emailexportrecipients) | **POST** /emailCampaigns/{campaignId}/exportRecipients | Export the recipients of an email campaign @@ -198,13 +217,7 @@ Class | Method | HTTP request | Description *EmailCampaignsApi* | [**updateCampaignStatus**](docs/Api/EmailCampaignsApi.md#updatecampaignstatus) | **PUT** /emailCampaigns/{campaignId}/status | Update an email campaign status *EmailCampaignsApi* | [**updateEmailCampaign**](docs/Api/EmailCampaignsApi.md#updateemailcampaign) | **PUT** /emailCampaigns/{campaignId} | Update an email campaign *EmailCampaignsApi* | [**uploadImageToGallery**](docs/Api/EmailCampaignsApi.md#uploadimagetogallery) | **POST** /emailCampaigns/images | Upload an image to your account's image gallery -*EventsApi* | [**createEvent**](docs/Api/EventsApi.md#createEvent) | **POST** /events | Create an event -*FoldersApi* | [**createFolder**](docs/Api/FoldersApi.md#createfolder) | **POST** /contacts/folders | Create a folder -*FoldersApi* | [**deleteFolder**](docs/Api/FoldersApi.md#deletefolder) | **DELETE** /contacts/folders/{folderId} | Delete a folder (and all its lists) -*FoldersApi* | [**getFolder**](docs/Api/FoldersApi.md#getfolder) | **GET** /contacts/folders/{folderId} | Returns a folder's details -*FoldersApi* | [**getFolderLists**](docs/Api/FoldersApi.md#getfolderlists) | **GET** /contacts/folders/{folderId}/lists | Get lists in a folder -*FoldersApi* | [**getFolders**](docs/Api/FoldersApi.md#getfolders) | **GET** /contacts/folders | Get all folders -*FoldersApi* | [**updateFolder**](docs/Api/FoldersApi.md#updatefolder) | **PUT** /contacts/folders/{folderId} | Update a folder +*EventApi* | [**createEvent**](docs/Api/EventApi.md#createevent) | **POST** /events | Create an event *ExternalFeedsApi* | [**createExternalFeed**](docs/Api/ExternalFeedsApi.md#createexternalfeed) | **POST** /feeds | Create an external feed *ExternalFeedsApi* | [**deleteExternalFeed**](docs/Api/ExternalFeedsApi.md#deleteexternalfeed) | **DELETE** /feeds/{uuid} | Delete an external feed *ExternalFeedsApi* | [**getAllExternalFeeds**](docs/Api/ExternalFeedsApi.md#getallexternalfeeds) | **GET** /feeds | Fetch all external feeds @@ -218,29 +231,30 @@ Class | Method | HTTP request | Description *InboundParsingApi* | [**getInboundEmailAttachment**](docs/Api/InboundParsingApi.md#getinboundemailattachment) | **GET** /inbound/attachments/{downloadToken} | Retrieve inbound attachment with download token. *InboundParsingApi* | [**getInboundEmailEvents**](docs/Api/InboundParsingApi.md#getinboundemailevents) | **GET** /inbound/events | Get the list of all the events for the received emails. *InboundParsingApi* | [**getInboundEmailEventsByUuid**](docs/Api/InboundParsingApi.md#getinboundemaileventsbyuuid) | **GET** /inbound/events/{uuid} | Fetch all events history for one particular received email. -*ListsApi* | [**addContactToList**](docs/Api/ListsApi.md#addcontacttolist) | **POST** /contacts/lists/{listId}/contacts/add | Add existing contacts to a list -*ListsApi* | [**createList**](docs/Api/ListsApi.md#createlist) | **POST** /contacts/lists | Create a list -*ListsApi* | [**deleteList**](docs/Api/ListsApi.md#deletelist) | **DELETE** /contacts/lists/{listId} | Delete a list -*ListsApi* | [**getContactsFromList**](docs/Api/ListsApi.md#getcontactsfromlist) | **GET** /contacts/lists/{listId}/contacts | Get contacts in a list -*ListsApi* | [**getFolderLists**](docs/Api/ListsApi.md#getfolderlists) | **GET** /contacts/folders/{folderId}/lists | Get lists in a folder -*ListsApi* | [**getList**](docs/Api/ListsApi.md#getlist) | **GET** /contacts/lists/{listId} | Get a list's details -*ListsApi* | [**getLists**](docs/Api/ListsApi.md#getlists) | **GET** /contacts/lists | Get all the lists -*ListsApi* | [**removeContactFromList**](docs/Api/ListsApi.md#removecontactfromlist) | **POST** /contacts/lists/{listId}/contacts/remove | Delete a contact from a list -*ListsApi* | [**updateList**](docs/Api/ListsApi.md#updatelist) | **PUT** /contacts/lists/{listId} | Update a list +*MasterAccountApi* | [**corporateGroupIdDelete**](docs/Api/MasterAccountApi.md#corporategroupiddelete) | **DELETE** /corporate/group/{id} | Delete a group +*MasterAccountApi* | [**corporateGroupIdGet**](docs/Api/MasterAccountApi.md#corporategroupidget) | **GET** /corporate/group/{id} | GET a group details *MasterAccountApi* | [**corporateGroupIdPut**](docs/Api/MasterAccountApi.md#corporategroupidput) | **PUT** /corporate/group/{id} | Update a group of sub-accounts -*MasterAccountApi* | [**corporateGroupPost**](docs/Api/MasterAccountApi.md#corporategrouppost) | **POST** /corporate/group | Create a new group of sub-accounts +*MasterAccountApi* | [**corporateGroupPost**](docs/Api/MasterAccountApi.md#corporategrouppost) | **POST** /corporate/group | Create a group of sub-accounts +*MasterAccountApi* | [**corporateGroupUnlinkGroupIdSubAccountsPut**](docs/Api/MasterAccountApi.md#corporategroupunlinkgroupidsubaccountsput) | **PUT** /corporate/group/unlink/{groupId}/subAccounts | Delete sub-account from group +*MasterAccountApi* | [**corporateIpGet**](docs/Api/MasterAccountApi.md#corporateipget) | **GET** /corporate/ip | List of all IPs *MasterAccountApi* | [**corporateMasterAccountGet**](docs/Api/MasterAccountApi.md#corporatemasteraccountget) | **GET** /corporate/masterAccount | Get the details of requested master account +*MasterAccountApi* | [**corporateSsoTokenPost**](docs/Api/MasterAccountApi.md#corporatessotokenpost) | **POST** /corporate/ssoToken | Generate SSO token to access admin account *MasterAccountApi* | [**corporateSubAccountGet**](docs/Api/MasterAccountApi.md#corporatesubaccountget) | **GET** /corporate/subAccount | Get the list of all the sub-accounts of the master account. *MasterAccountApi* | [**corporateSubAccountIdApplicationsTogglePut**](docs/Api/MasterAccountApi.md#corporatesubaccountidapplicationstoggleput) | **PUT** /corporate/subAccount/{id}/applications/toggle | Enable/disable sub-account application(s) *MasterAccountApi* | [**corporateSubAccountIdDelete**](docs/Api/MasterAccountApi.md#corporatesubaccountiddelete) | **DELETE** /corporate/subAccount/{id} | Delete a sub-account *MasterAccountApi* | [**corporateSubAccountIdGet**](docs/Api/MasterAccountApi.md#corporatesubaccountidget) | **GET** /corporate/subAccount/{id} | Get sub-account details *MasterAccountApi* | [**corporateSubAccountIdPlanPut**](docs/Api/MasterAccountApi.md#corporatesubaccountidplanput) | **PUT** /corporate/subAccount/{id}/plan | Update sub-account plan +*MasterAccountApi* | [**corporateSubAccountIpAssociatePost**](docs/Api/MasterAccountApi.md#corporatesubaccountipassociatepost) | **POST** /corporate/subAccount/ip/associate | Associate an IP to sub-accounts +*MasterAccountApi* | [**corporateSubAccountIpDissociatePut**](docs/Api/MasterAccountApi.md#corporatesubaccountipdissociateput) | **PUT** /corporate/subAccount/ip/dissociate | Dissociate an IP to sub-accounts *MasterAccountApi* | [**corporateSubAccountKeyPost**](docs/Api/MasterAccountApi.md#corporatesubaccountkeypost) | **POST** /corporate/subAccount/key | Create an API key for a sub-account *MasterAccountApi* | [**corporateSubAccountPost**](docs/Api/MasterAccountApi.md#corporatesubaccountpost) | **POST** /corporate/subAccount | Create a new sub-account under a master account. -*MasterAccountApi* | [**corporateSubAccountSsoTokenPost**](docs/Api/MasterAccountApi.md#corporatesubaccountssotokenpost) | **POST** /corporate/subAccount/ssoToken | Generate SSO token to access Brevo +*MasterAccountApi* | [**corporateSubAccountSsoTokenPost**](docs/Api/MasterAccountApi.md#corporatesubaccountssotokenpost) | **POST** /corporate/subAccount/ssoToken | Generate SSO token to access sub-account +*MasterAccountApi* | [**corporateUserEmailPermissionsPut**](docs/Api/MasterAccountApi.md#corporateuseremailpermissionsput) | **PUT** /corporate/user/{email}/permissions | Change admin user permissions +*MasterAccountApi* | [**corporateUserInvitationActionEmailPut**](docs/Api/MasterAccountApi.md#corporateuserinvitationactionemailput) | **PUT** /corporate/user/invitation/{action}/{email} | Resend / cancel admin user invitation *MasterAccountApi* | [**corporateUserRevokeEmailDelete**](docs/Api/MasterAccountApi.md#corporateuserrevokeemaildelete) | **DELETE** /corporate/user/revoke/{email} | Revoke an admin user -*MasterAccountApi* | [**getAccountActivity**](docs/Api/MasterAccountApi.md#getaccountactivity) | **GET** /organization/activities | Get user activity logs +*MasterAccountApi* | [**getAccountActivity_0**](docs/Api/MasterAccountApi.md#getaccountactivity_0) | **GET** /organization/activities | Get user activity logs *MasterAccountApi* | [**getCorporateInvitedUsersList**](docs/Api/MasterAccountApi.md#getcorporateinviteduserslist) | **GET** /corporate/invited/users | Get the list of all admin users +*MasterAccountApi* | [**getCorporateUserPermission**](docs/Api/MasterAccountApi.md#getcorporateuserpermission) | **GET** /corporate/user/{email}/permissions | Check admin user permissions *MasterAccountApi* | [**getSubAccountGroups**](docs/Api/MasterAccountApi.md#getsubaccountgroups) | **GET** /corporate/groups | Get the list of groups *MasterAccountApi* | [**inviteAdminUser**](docs/Api/MasterAccountApi.md#inviteadminuser) | **POST** /corporate/user/invitation/send | Send invitation to an admin user *NotesApi* | [**crmNotesGet**](docs/Api/NotesApi.md#crmnotesget) | **GET** /crm/notes | Get all notes @@ -248,24 +262,29 @@ Class | Method | HTTP request | Description *NotesApi* | [**crmNotesIdGet**](docs/Api/NotesApi.md#crmnotesidget) | **GET** /crm/notes/{id} | Get a note *NotesApi* | [**crmNotesIdPatch**](docs/Api/NotesApi.md#crmnotesidpatch) | **PATCH** /crm/notes/{id} | Update a note *NotesApi* | [**crmNotesPost**](docs/Api/NotesApi.md#crmnotespost) | **POST** /crm/notes | Create a note +*PaymentsApi* | [**createPaymentRequest**](docs/Api/PaymentsApi.md#createpaymentrequest) | **POST** /payments/requests | Create a payment request +*PaymentsApi* | [**deletePaymentRequest**](docs/Api/PaymentsApi.md#deletepaymentrequest) | **DELETE** /payments/requests/{id} | Delete a payment request. +*PaymentsApi* | [**getPaymentRequest**](docs/Api/PaymentsApi.md#getpaymentrequest) | **GET** /payments/requests/{id} | Get payment request details *ProcessApi* | [**getProcess**](docs/Api/ProcessApi.md#getprocess) | **GET** /processes/{processId} | Return the informations for a process *ProcessApi* | [**getProcesses**](docs/Api/ProcessApi.md#getprocesses) | **GET** /processes | Return all the processes for your account -*ResellerApi* | [**addCredits**](docs/Api/ResellerApi.md#addcredits) | **POST** /reseller/children/{childIdentifier}/credits/add | Add Email and/or SMS credits to a specific child account -*ResellerApi* | [**associateIpToChild**](docs/Api/ResellerApi.md#associateiptochild) | **POST** /reseller/children/{childIdentifier}/ips/associate | Associate a dedicated IP to the child -*ResellerApi* | [**createChildDomain**](docs/Api/ResellerApi.md#createchilddomain) | **POST** /reseller/children/{childIdentifier}/domains | Create a domain for a child account -*ResellerApi* | [**createResellerChild**](docs/Api/ResellerApi.md#createresellerchild) | **POST** /reseller/children | Creates a reseller child -*ResellerApi* | [**deleteChildDomain**](docs/Api/ResellerApi.md#deletechilddomain) | **DELETE** /reseller/children/{childIdentifier}/domains/{domainName} | Delete the sender domain of the reseller child based on the childIdentifier and domainName passed -*ResellerApi* | [**deleteResellerChild**](docs/Api/ResellerApi.md#deleteresellerchild) | **DELETE** /reseller/children/{childIdentifier} | Delete a single reseller child based on the child identifier supplied -*ResellerApi* | [**dissociateIpFromChild**](docs/Api/ResellerApi.md#dissociateipfromchild) | **POST** /reseller/children/{childIdentifier}/ips/dissociate | Dissociate a dedicated IP to the child -*ResellerApi* | [**getChildAccountCreationStatus**](docs/Api/ResellerApi.md#getchildaccountcreationstatus) | **GET** /reseller/children/{childIdentifier}/accountCreationStatus | Get the status of a reseller's child account creation, whether it is successfully created (exists) or not based on the identifier supplied -*ResellerApi* | [**getChildDomains**](docs/Api/ResellerApi.md#getchilddomains) | **GET** /reseller/children/{childIdentifier}/domains | Get all sender domains for a specific child account -*ResellerApi* | [**getChildInfo**](docs/Api/ResellerApi.md#getchildinfo) | **GET** /reseller/children/{childIdentifier} | Get a child account's details -*ResellerApi* | [**getResellerChilds**](docs/Api/ResellerApi.md#getresellerchilds) | **GET** /reseller/children | Get the list of all children accounts -*ResellerApi* | [**getSsoToken**](docs/Api/ResellerApi.md#getssotoken) | **GET** /reseller/children/{childIdentifier}/auth | Get session token to access Brevo (SSO) -*ResellerApi* | [**removeCredits**](docs/Api/ResellerApi.md#removecredits) | **POST** /reseller/children/{childIdentifier}/credits/remove | Remove Email and/or SMS credits from a specific child account -*ResellerApi* | [**updateChildAccountStatus**](docs/Api/ResellerApi.md#updatechildaccountstatus) | **PUT** /reseller/children/{childIdentifier}/accountStatus | Update info of reseller's child account status based on the childIdentifier supplied -*ResellerApi* | [**updateChildDomain**](docs/Api/ResellerApi.md#updatechilddomain) | **PUT** /reseller/children/{childIdentifier}/domains/{domainName} | Update the sender domain of reseller's child based on the childIdentifier and domainName passed -*ResellerApi* | [**updateResellerChild**](docs/Api/ResellerApi.md#updateresellerchild) | **PUT** /reseller/children/{childIdentifier} | Update info of reseller's child based on the child identifier supplied +*ProgramApi* | [**createNewLP**](docs/Api/ProgramApi.md#createnewlp) | **POST** /loyalty/config/programs | Create loyalty program +*ProgramApi* | [**deleteContactMembers**](docs/Api/ProgramApi.md#deletecontactmembers) | **DELETE** /loyalty/config/programs/{loyaltyProgramId}/subscriptions-members | Delete subscription member +*ProgramApi* | [**deleteLoyaltyProgram**](docs/Api/ProgramApi.md#deleteloyaltyprogram) | **DELETE** /loyalty/config/programs/{loyaltyProgramId} | Delete Loyalty Program +*ProgramApi* | [**deleteSubscriptionMember**](docs/Api/ProgramApi.md#deletesubscriptionmember) | **DELETE** /loyalty/config/programs/{loyaltyProgramId}/contact/{contactId} | Delete subscription +*ProgramApi* | [**getLPList**](docs/Api/ProgramApi.md#getlplist) | **GET** /loyalty/config/programs | Get loyalty program list +*ProgramApi* | [**getLoyaltyProgramInfo**](docs/Api/ProgramApi.md#getloyaltyprograminfo) | **GET** /loyalty/config/programs/{loyaltyProgramId} | Get loyalty program Info +*ProgramApi* | [**getParameterSubscriptionInfo**](docs/Api/ProgramApi.md#getparametersubscriptioninfo) | **GET** /loyalty/config/programs/{loyaltyProgramId}/account-info | Get Subscription Data +*ProgramApi* | [**getSubscriptionMember**](docs/Api/ProgramApi.md#getsubscriptionmember) | **GET** /loyalty/config/programs/{loyaltyProgramId}/contact/{contactId} | Get subscription info +*ProgramApi* | [**partiallyUpdateLoyaltyProgram**](docs/Api/ProgramApi.md#partiallyupdateloyaltyprogram) | **PATCH** /loyalty/config/programs/{loyaltyProgramId} | Partially update loyalty program +*ProgramApi* | [**publishLoyaltyProgram**](docs/Api/ProgramApi.md#publishloyaltyprogram) | **POST** /loyalty/config/programs/{loyaltyProgramId}/publish | Publish loyalty program +*ProgramApi* | [**subscribeMemberToASubscription**](docs/Api/ProgramApi.md#subscribemembertoasubscription) | **POST** /loyalty/config/programs/{loyaltyProgramId}/subscriptions-members | Create subscription member +*ProgramApi* | [**subscribeToLoyaltyProgram**](docs/Api/ProgramApi.md#subscribetoloyaltyprogram) | **POST** /loyalty/config/programs/{loyaltyProgramId}/subscriptions | Create subscription +*ProgramApi* | [**updateLoyaltyProgram**](docs/Api/ProgramApi.md#updateloyaltyprogram) | **PUT** /loyalty/config/programs/{loyaltyProgramId} | Update loyalty program +*RewardsApi* | [**attributeReward**](docs/Api/RewardsApi.md#attributereward) | **POST** /loyalty/offer/programs/{loyaltyProgramId}/rewards/attribute | Attribute reward to a contact +*RewardsApi* | [**getOffersList**](docs/Api/RewardsApi.md#getofferslist) | **GET** /loyalty/offer/programs/{loyaltyProgramId}/offers | Get Reward list +*RewardsApi* | [**redeemReward**](docs/Api/RewardsApi.md#redeemreward) | **POST** /loyalty/offer/programs/{loyaltyProgramId}/rewards/redeem | Redeem reward +*RewardsApi* | [**revokeReward**](docs/Api/RewardsApi.md#revokereward) | **DELETE** /loyalty/offer/programs/{loyaltyProgramId}/rewards/revoke | Revoke reward +*RewardsApi* | [**validateReward**](docs/Api/RewardsApi.md#validatereward) | **POST** /loyalty/offer/programs/{loyaltyProgramId}/rewards/validate | Validates a voucher *SMSCampaignsApi* | [**createSmsCampaign**](docs/Api/SMSCampaignsApi.md#createsmscampaign) | **POST** /smsCampaigns | Creates an SMS campaign *SMSCampaignsApi* | [**deleteSmsCampaign**](docs/Api/SMSCampaignsApi.md#deletesmscampaign) | **DELETE** /smsCampaigns/{campaignId} | Delete an SMS campaign *SMSCampaignsApi* | [**getSmsCampaign**](docs/Api/SMSCampaignsApi.md#getsmscampaign) | **GET** /smsCampaigns/{campaignId} | Get an SMS campaign @@ -282,13 +301,23 @@ Class | Method | HTTP request | Description *SendersApi* | [**getIpsFromSender**](docs/Api/SendersApi.md#getipsfromsender) | **GET** /senders/{senderId}/ips | Get all the dedicated IPs for a sender *SendersApi* | [**getSenders**](docs/Api/SendersApi.md#getsenders) | **GET** /senders | Get the list of all your senders *SendersApi* | [**updateSender**](docs/Api/SendersApi.md#updatesender) | **PUT** /senders/{senderId} | Update a sender -*SendersApi* | [**validateSenderByOTP**](docs/Api/SendersApi.md#validatesenderbyotp) | **PUT** /senders/{senderId}/validate | Update a sender +*SendersApi* | [**validateSenderByOTP**](docs/Api/SendersApi.md#validatesenderbyotp) | **PUT** /senders/{senderId}/validate | Validate Sender using OTP *TasksApi* | [**crmTasksGet**](docs/Api/TasksApi.md#crmtasksget) | **GET** /crm/tasks | Get all tasks *TasksApi* | [**crmTasksIdDelete**](docs/Api/TasksApi.md#crmtasksiddelete) | **DELETE** /crm/tasks/{id} | Delete a task *TasksApi* | [**crmTasksIdGet**](docs/Api/TasksApi.md#crmtasksidget) | **GET** /crm/tasks/{id} | Get a task *TasksApi* | [**crmTasksIdPatch**](docs/Api/TasksApi.md#crmtasksidpatch) | **PATCH** /crm/tasks/{id} | Update a task *TasksApi* | [**crmTasksPost**](docs/Api/TasksApi.md#crmtaskspost) | **POST** /crm/tasks | Create a task *TasksApi* | [**crmTasktypesGet**](docs/Api/TasksApi.md#crmtasktypesget) | **GET** /crm/tasktypes | Get all task types +*TierApi* | [**createTierForTierGroup**](docs/Api/TierApi.md#createtierfortiergroup) | **POST** /loyalty/tier/programs/{loyaltyProgramId}/tier-groups/{tierGroupId}/tiers | Create new tier +*TierApi* | [**createTierGroup**](docs/Api/TierApi.md#createtiergroup) | **POST** /loyalty/tier/programs/{loyaltyProgramId}/tier-groups | Create tier group +*TierApi* | [**deleteTierGroup**](docs/Api/TierApi.md#deletetiergroup) | **DELETE** /loyalty/tier/programs/{loyaltyProgramId}/tier-groups/{tierGroupId} | Delete tier group +*TierApi* | [**getListOfTierGroups**](docs/Api/TierApi.md#getlistoftiergroups) | **GET** /loyalty/tier/programs/{loyaltyProgramId}/tier-groups | Get tier group page +*TierApi* | [**getLoyaltyProgramTier**](docs/Api/TierApi.md#getloyaltyprogramtier) | **GET** /loyalty/tier/programs/{loyaltyProgramId}/tiers | Get tier page +*TierApi* | [**getTierGroup**](docs/Api/TierApi.md#gettiergroup) | **GET** /loyalty/tier/programs/{loyaltyProgramId}/tier-groups/{tierGroupId} | Get tier group by Id +*TierApi* | [**loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost**](docs/Api/TierApi.md#loyaltytierprogramsloyaltyprogramidcontactscontactidtierstieridpost) | **POST** /loyalty/tier/programs/{loyaltyProgramId}/contacts/{contactId}/tiers/{tierId} | Add subscription to a tier +*TierApi* | [**loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete**](docs/Api/TierApi.md#loyaltytierprogramsloyaltyprogramidtierstieriddelete) | **DELETE** /loyalty/tier/programs/{loyaltyProgramId}/tiers/{tierId} | Delete tier +*TierApi* | [**loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut**](docs/Api/TierApi.md#loyaltytierprogramsloyaltyprogramidtierstieridput) | **PUT** /loyalty/tier/programs/{loyaltyProgramId}/tiers/{tierId} | Update tier +*TierApi* | [**updateTierGroup**](docs/Api/TierApi.md#updatetiergroup) | **PUT** /loyalty/tier/programs/{loyaltyProgramId}/tier-groups/{tierGroupId} | Update tier group *TransactionalEmailsApi* | [**blockNewDomain**](docs/Api/TransactionalEmailsApi.md#blocknewdomain) | **POST** /smtp/blockedDomains | Add a new domain to the list of blocked domains *TransactionalEmailsApi* | [**createSmtpTemplate**](docs/Api/TransactionalEmailsApi.md#createsmtptemplate) | **POST** /smtp/templates | Create an email template *TransactionalEmailsApi* | [**deleteBlockedDomain**](docs/Api/TransactionalEmailsApi.md#deleteblockeddomain) | **DELETE** /smtp/blockedDomains/{domain} | Unblock an existing domain from the list of blocked domains @@ -298,8 +327,7 @@ Class | Method | HTTP request | Description *TransactionalEmailsApi* | [**getAggregatedSmtpReport**](docs/Api/TransactionalEmailsApi.md#getaggregatedsmtpreport) | **GET** /smtp/statistics/aggregatedReport | Get your transactional email activity aggregated over a period of time *TransactionalEmailsApi* | [**getBlockedDomains**](docs/Api/TransactionalEmailsApi.md#getblockeddomains) | **GET** /smtp/blockedDomains | Get the list of blocked domains *TransactionalEmailsApi* | [**getEmailEventReport**](docs/Api/TransactionalEmailsApi.md#getemaileventreport) | **GET** /smtp/statistics/events | Get all your transactional email activity (unaggregated events) -*TransactionalEmailsApi* | [**getScheduledEmailByBatchId**](docs/Api/TransactionalEmailsApi.md#getscheduledemailbybatchid) | **GET** /smtp/emailStatus/{batchId} | Fetch scheduled emails by batchId -*TransactionalEmailsApi* | [**getScheduledEmailByMessageId**](docs/Api/TransactionalEmailsApi.md#getscheduledemailbymessageid) | **GET** /smtp/emailStatus/{messageId} | Fetch scheduled email by messageId +*TransactionalEmailsApi* | [**getScheduledEmailById**](docs/Api/TransactionalEmailsApi.md#getscheduledemailbyid) | **GET** /smtp/emailStatus/{identifier} | Fetch scheduled emails by batchId or messageId *TransactionalEmailsApi* | [**getSmtpReport**](docs/Api/TransactionalEmailsApi.md#getsmtpreport) | **GET** /smtp/statistics/reports | Get your transactional email activity aggregated per day *TransactionalEmailsApi* | [**getSmtpTemplate**](docs/Api/TransactionalEmailsApi.md#getsmtptemplate) | **GET** /smtp/templates/{templateId} | Returns the template information *TransactionalEmailsApi* | [**getSmtpTemplates**](docs/Api/TransactionalEmailsApi.md#getsmtptemplates) | **GET** /smtp/templates | Get the list of email templates @@ -330,7 +358,7 @@ Class | Method | HTTP request | Description *WebhooksApi* | [**getWebhooks**](docs/Api/WebhooksApi.md#getwebhooks) | **GET** /webhooks | Get all webhooks *WebhooksApi* | [**updateWebhook**](docs/Api/WebhooksApi.md#updatewebhook) | **PUT** /webhooks/{webhookId} | Update a webhook *WhatsAppCampaignsApi* | [**createWhatsAppCampaign**](docs/Api/WhatsAppCampaignsApi.md#createwhatsappcampaign) | **POST** /whatsappCampaigns | Create and Send a WhatsApp campaign -*WhatsAppCampaignsApi* | [**createWhatsAppTemplate**](docs/Api/WhatsAppCampaignsApi.md#createwhatsapptemplate) | **POST** /whatsppCampaigns/template | Create a WhatsApp template +*WhatsAppCampaignsApi* | [**createWhatsAppTemplate**](docs/Api/WhatsAppCampaignsApi.md#createwhatsapptemplate) | **POST** /whatsappCampaigns/template | Create a WhatsApp template *WhatsAppCampaignsApi* | [**deleteWhatsAppCampaign**](docs/Api/WhatsAppCampaignsApi.md#deletewhatsappcampaign) | **DELETE** /whatsappCampaigns/{campaignId} | Delete a WhatsApp campaign *WhatsAppCampaignsApi* | [**getWhatsAppCampaign**](docs/Api/WhatsAppCampaignsApi.md#getwhatsappcampaign) | **GET** /whatsappCampaigns/{campaignId} | Get a WhatsApp campaign *WhatsAppCampaignsApi* | [**getWhatsAppCampaigns**](docs/Api/WhatsAppCampaignsApi.md#getwhatsappcampaigns) | **GET** /whatsappCampaigns | Return all your created WhatsApp campaigns @@ -339,379 +367,484 @@ Class | Method | HTTP request | Description *WhatsAppCampaignsApi* | [**sendWhatsAppTemplateApproval**](docs/Api/WhatsAppCampaignsApi.md#sendwhatsapptemplateapproval) | **POST** /whatsappCampaigns/template/approval/{templateId} | Send your WhatsApp template for approval *WhatsAppCampaignsApi* | [**updateWhatsAppCampaign**](docs/Api/WhatsAppCampaignsApi.md#updatewhatsappcampaign) | **PUT** /whatsappCampaigns/{campaignId} | Update a WhatsApp campaign - -## Documentation For Models - - - [AbTestCampaignResult](docs/Model/AbTestCampaignResult.md) - - [AbTestCampaignResultClickedLinks](docs/Model/AbTestCampaignResultClickedLinks.md) - - [AbTestCampaignResultStatistics](docs/Model/AbTestCampaignResultStatistics.md) - - [AbTestVersionClicks](docs/Model/AbTestVersionClicks.md) - - [AbTestVersionClicksInner](docs/Model/AbTestVersionClicksInner.md) - - [AbTestVersionStats](docs/Model/AbTestVersionStats.md) - - [AddChildDomain](docs/Model/AddChildDomain.md) - - [AddContactToList](docs/Model/AddContactToList.md) - - [AddCredits](docs/Model/AddCredits.md) - - [AuthenticateDomainModel](docs/Model/AuthenticateDomainModel.md) - - [BlockDomain](docs/Model/BlockDomain.md) - - [Body](docs/Model/Body.md) - - [Body1](docs/Model/Body1.md) - - [Body10](docs/Model/Body10.md) - - [Body11](docs/Model/Body11.md) - - [Body12](docs/Model/Body12.md) - - [Body13](docs/Model/Body13.md) - - [Body14](docs/Model/Body14.md) - - [Body2](docs/Model/Body2.md) - - [Body3](docs/Model/Body3.md) - - [Body4](docs/Model/Body4.md) - - [Body5](docs/Model/Body5.md) - - [Body6](docs/Model/Body6.md) - - [Body7](docs/Model/Body7.md) - - [Body8](docs/Model/Body8.md) - - [Body9](docs/Model/Body9.md) - - [BodyVariablesItems](docs/Model/BodyVariablesItems.md) - - [CompaniesList](docs/Model/CompaniesList.md) - - [Company](docs/Model/Company.md) - - [CompanyAttributes](docs/Model/CompanyAttributes.md) - - [CompanyAttributesInner](docs/Model/CompanyAttributesInner.md) - - [ComponentItems](docs/Model/ComponentItems.md) - - [ConversationsMessage](docs/Model/ConversationsMessage.md) - - [ConversationsMessageFile](docs/Model/ConversationsMessageFile.md) - - [ConversationsMessageFileImageInfo](docs/Model/ConversationsMessageFileImageInfo.md) - - [CreateApiKeyRequest](docs/Model/CreateApiKeyRequest.md) - - [CreateApiKeyResponse](docs/Model/CreateApiKeyResponse.md) - - [CreateAttribute](docs/Model/CreateAttribute.md) - - [CreateAttributeEnumeration](docs/Model/CreateAttributeEnumeration.md) - - [CreateCategoryModel](docs/Model/CreateCategoryModel.md) - - [CreateChild](docs/Model/CreateChild.md) - - [CreateContact](docs/Model/CreateContact.md) - - [CreateCouponCollection](docs/Model/CreateCouponCollection.md) - - [CreateCoupons](docs/Model/CreateCoupons.md) - - [CreateDoiContact](docs/Model/CreateDoiContact.md) - - [CreateDomain](docs/Model/CreateDomain.md) - - [CreateDomainModel](docs/Model/CreateDomainModel.md) - - [CreateDomainModelDnsRecords](docs/Model/CreateDomainModelDnsRecords.md) - - [CreateDomainModelDnsRecordsDkimRecord](docs/Model/CreateDomainModelDnsRecordsDkimRecord.md) - - [CreateEmailCampaign](docs/Model/CreateEmailCampaign.md) - - [CreateEmailCampaignRecipients](docs/Model/CreateEmailCampaignRecipients.md) - - [CreateEmailCampaignSender](docs/Model/CreateEmailCampaignSender.md) - - [CreateExternalFeed](docs/Model/CreateExternalFeed.md) - - [CreateList](docs/Model/CreateList.md) - - [CreateModel](docs/Model/CreateModel.md) - - [CreateProductModel](docs/Model/CreateProductModel.md) - - [CreateReseller](docs/Model/CreateReseller.md) - - [CreateSender](docs/Model/CreateSender.md) - - [CreateSenderIps](docs/Model/CreateSenderIps.md) - - [CreateSenderModel](docs/Model/CreateSenderModel.md) - - [CreateSmsCampaign](docs/Model/CreateSmsCampaign.md) - - [CreateSmsCampaignRecipients](docs/Model/CreateSmsCampaignRecipients.md) - - [CreateSmtpEmail](docs/Model/CreateSmtpEmail.md) - - [CreateSmtpTemplate](docs/Model/CreateSmtpTemplate.md) - - [CreateSmtpTemplateSender](docs/Model/CreateSmtpTemplateSender.md) - - [CreateSubAccount](docs/Model/CreateSubAccount.md) - - [CreateSubAccountResponse](docs/Model/CreateSubAccountResponse.md) - - [CreateUpdateBatchCategory](docs/Model/CreateUpdateBatchCategory.md) - - [CreateUpdateBatchCategoryModel](docs/Model/CreateUpdateBatchCategoryModel.md) - - [CreateUpdateBatchProducts](docs/Model/CreateUpdateBatchProducts.md) - - [CreateUpdateBatchProductsModel](docs/Model/CreateUpdateBatchProductsModel.md) - - [CreateUpdateCategories](docs/Model/CreateUpdateCategories.md) - - [CreateUpdateCategory](docs/Model/CreateUpdateCategory.md) - - [CreateUpdateContactModel](docs/Model/CreateUpdateContactModel.md) - - [CreateUpdateFolder](docs/Model/CreateUpdateFolder.md) - - [CreateUpdateProduct](docs/Model/CreateUpdateProduct.md) - - [CreateUpdateProducts](docs/Model/CreateUpdateProducts.md) - - [CreateWebhook](docs/Model/CreateWebhook.md) - - [CreateWhatsAppCampaign](docs/Model/CreateWhatsAppCampaign.md) - - [CreateWhatsAppCampaignRecipients](docs/Model/CreateWhatsAppCampaignRecipients.md) - - [CreateWhatsAppTemplate](docs/Model/CreateWhatsAppTemplate.md) - - [CreatedBatchId](docs/Model/CreatedBatchId.md) - - [CreatedProcessId](docs/Model/CreatedProcessId.md) - - [Deal](docs/Model/Deal.md) - - [DealAttributes](docs/Model/DealAttributes.md) - - [DealAttributesInner](docs/Model/DealAttributesInner.md) - - [DealsList](docs/Model/DealsList.md) - - [DeleteHardbounces](docs/Model/DeleteHardbounces.md) - - [EmailExportRecipients](docs/Model/EmailExportRecipients.md) - - [ErrorModel](docs/Model/ErrorModel.md) - - [Event](docs/Model/Event.md) - - [ExportWebhooksHistory](docs/Model/ExportWebhooksHistory.md) - - [FileData](docs/Model/FileData.md) - - [FileDownloadableLink](docs/Model/FileDownloadableLink.md) - - [FileList](docs/Model/FileList.md) - - [GetAccount](docs/Model/GetAccount.md) - - [GetAccountActivity](docs/Model/GetAccountActivity.md) - - [GetAccountActivityLogs](docs/Model/GetAccountActivityLogs.md) - - [GetAccountMarketingAutomation](docs/Model/GetAccountMarketingAutomation.md) - - [GetAccountPlan](docs/Model/GetAccountPlan.md) - - [GetAccountRelay](docs/Model/GetAccountRelay.md) - - [GetAccountRelayData](docs/Model/GetAccountRelayData.md) - - [GetAggregatedReport](docs/Model/GetAggregatedReport.md) - - [GetAllExternalFeeds](docs/Model/GetAllExternalFeeds.md) - - [GetAllExternalFeedsFeeds](docs/Model/GetAllExternalFeedsFeeds.md) - - [GetAttributes](docs/Model/GetAttributes.md) - - [GetAttributesAttributes](docs/Model/GetAttributesAttributes.md) - - [GetAttributesEnumeration](docs/Model/GetAttributesEnumeration.md) - - [GetBlockedDomains](docs/Model/GetBlockedDomains.md) - - [GetCampaignOverview](docs/Model/GetCampaignOverview.md) - - [GetCampaignRecipients](docs/Model/GetCampaignRecipients.md) - - [GetCampaignStats](docs/Model/GetCampaignStats.md) - - [GetCategories](docs/Model/GetCategories.md) - - [GetCategoryDetails](docs/Model/GetCategoryDetails.md) - - [GetChildAccountCreationStatus](docs/Model/GetChildAccountCreationStatus.md) - - [GetChildDomain](docs/Model/GetChildDomain.md) - - [GetChildDomains](docs/Model/GetChildDomains.md) - - [GetChildInfo](docs/Model/GetChildInfo.md) - - [GetChildInfoApiKeys](docs/Model/GetChildInfoApiKeys.md) - - [GetChildInfoApiKeysV2](docs/Model/GetChildInfoApiKeysV2.md) - - [GetChildInfoApiKeysV3](docs/Model/GetChildInfoApiKeysV3.md) - - [GetChildInfoCredits](docs/Model/GetChildInfoCredits.md) - - [GetChildInfoStatistics](docs/Model/GetChildInfoStatistics.md) - - [GetChildrenList](docs/Model/GetChildrenList.md) - - [GetClient](docs/Model/GetClient.md) - - [GetContactCampaignStats](docs/Model/GetContactCampaignStats.md) - - [GetContactCampaignStatsClicked](docs/Model/GetContactCampaignStatsClicked.md) - - [GetContactCampaignStatsOpened](docs/Model/GetContactCampaignStatsOpened.md) - - [GetContactCampaignStatsTransacAttributes](docs/Model/GetContactCampaignStatsTransacAttributes.md) - - [GetContactCampaignStatsUnsubscriptions](docs/Model/GetContactCampaignStatsUnsubscriptions.md) - - [GetContactDetails](docs/Model/GetContactDetails.md) - - [GetContacts](docs/Model/GetContacts.md) - - [GetCorporateInvitedUsersList](docs/Model/GetCorporateInvitedUsersList.md) - - [GetCorporateInvitedUsersListFeatureAccess](docs/Model/GetCorporateInvitedUsersListFeatureAccess.md) - - [GetCorporateInvitedUsersListGroups](docs/Model/GetCorporateInvitedUsersListGroups.md) - - [GetCorporateInvitedUsersListUsers](docs/Model/GetCorporateInvitedUsersListUsers.md) - - [GetCouponCollection](docs/Model/GetCouponCollection.md) - - [GetDeviceBrowserStats](docs/Model/GetDeviceBrowserStats.md) - - [GetDomainConfigurationModel](docs/Model/GetDomainConfigurationModel.md) - - [GetDomainsList](docs/Model/GetDomainsList.md) - - [GetDomainsListDomains](docs/Model/GetDomainsListDomains.md) - - [GetEmailCampaign](docs/Model/GetEmailCampaign.md) - - [GetEmailCampaigns](docs/Model/GetEmailCampaigns.md) - - [GetEmailEventReport](docs/Model/GetEmailEventReport.md) - - [GetEmailEventReportEvents](docs/Model/GetEmailEventReportEvents.md) - - [GetExtendedCampaignOverview](docs/Model/GetExtendedCampaignOverview.md) - - [GetExtendedCampaignOverviewSender](docs/Model/GetExtendedCampaignOverviewSender.md) - - [GetExtendedCampaignStats](docs/Model/GetExtendedCampaignStats.md) - - [GetExtendedCampaignStatsGlobalStats](docs/Model/GetExtendedCampaignStatsGlobalStats.md) - - [GetExtendedClient](docs/Model/GetExtendedClient.md) - - [GetExtendedClientAddress](docs/Model/GetExtendedClientAddress.md) - - [GetExtendedContactDetails](docs/Model/GetExtendedContactDetails.md) - - [GetExtendedContactDetailsStatistics](docs/Model/GetExtendedContactDetailsStatistics.md) - - [GetExtendedContactDetailsStatisticsClicked](docs/Model/GetExtendedContactDetailsStatisticsClicked.md) - - [GetExtendedContactDetailsStatisticsDelivered](docs/Model/GetExtendedContactDetailsStatisticsDelivered.md) - - [GetExtendedContactDetailsStatisticsLinks](docs/Model/GetExtendedContactDetailsStatisticsLinks.md) - - [GetExtendedContactDetailsStatisticsMessagesSent](docs/Model/GetExtendedContactDetailsStatisticsMessagesSent.md) - - [GetExtendedContactDetailsStatisticsOpened](docs/Model/GetExtendedContactDetailsStatisticsOpened.md) - - [GetExtendedContactDetailsStatisticsUnsubscriptions](docs/Model/GetExtendedContactDetailsStatisticsUnsubscriptions.md) - - [GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription](docs/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.md) - - [GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription](docs/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.md) - - [GetExtendedList](docs/Model/GetExtendedList.md) - - [GetExtendedListCampaignStats](docs/Model/GetExtendedListCampaignStats.md) - - [GetExternalFeedByUUID](docs/Model/GetExternalFeedByUUID.md) - - [GetExternalFeedByUUIDHeaders](docs/Model/GetExternalFeedByUUIDHeaders.md) - - [GetFolder](docs/Model/GetFolder.md) - - [GetFolderLists](docs/Model/GetFolderLists.md) - - [GetFolders](docs/Model/GetFolders.md) - - [GetInboundEmailEvents](docs/Model/GetInboundEmailEvents.md) - - [GetInboundEmailEventsByUuid](docs/Model/GetInboundEmailEventsByUuid.md) - - [GetInboundEmailEventsByUuidAttachments](docs/Model/GetInboundEmailEventsByUuidAttachments.md) - - [GetInboundEmailEventsByUuidLogs](docs/Model/GetInboundEmailEventsByUuidLogs.md) - - [GetInboundEmailEventsEvents](docs/Model/GetInboundEmailEventsEvents.md) - - [GetInvitedUsersList](docs/Model/GetInvitedUsersList.md) - - [GetInvitedUsersListFeatureAccess](docs/Model/GetInvitedUsersListFeatureAccess.md) - - [GetInvitedUsersListUsers](docs/Model/GetInvitedUsersListUsers.md) - - [GetIp](docs/Model/GetIp.md) - - [GetIpFromSender](docs/Model/GetIpFromSender.md) - - [GetIps](docs/Model/GetIps.md) - - [GetIpsFromSender](docs/Model/GetIpsFromSender.md) - - [GetList](docs/Model/GetList.md) - - [GetLists](docs/Model/GetLists.md) - - [GetOrders](docs/Model/GetOrders.md) - - [GetProcess](docs/Model/GetProcess.md) - - [GetProcesses](docs/Model/GetProcesses.md) - - [GetProductDetails](docs/Model/GetProductDetails.md) - - [GetProducts](docs/Model/GetProducts.md) - - [GetReports](docs/Model/GetReports.md) - - [GetReportsReports](docs/Model/GetReportsReports.md) - - [GetScheduledEmailByBatchId](docs/Model/GetScheduledEmailByBatchId.md) - - [GetScheduledEmailByBatchIdBatches](docs/Model/GetScheduledEmailByBatchIdBatches.md) - - [GetScheduledEmailByMessageId](docs/Model/GetScheduledEmailByMessageId.md) - - [GetSegments](docs/Model/GetSegments.md) - - [GetSegmentsSegments](docs/Model/GetSegmentsSegments.md) - - [GetSendersList](docs/Model/GetSendersList.md) - - [GetSendersListIps](docs/Model/GetSendersListIps.md) - - [GetSendersListSenders](docs/Model/GetSendersListSenders.md) - - [GetSharedTemplateUrl](docs/Model/GetSharedTemplateUrl.md) - - [GetSmsCampaign](docs/Model/GetSmsCampaign.md) - - [GetSmsCampaignOverview](docs/Model/GetSmsCampaignOverview.md) - - [GetSmsCampaignRecipients](docs/Model/GetSmsCampaignRecipients.md) - - [GetSmsCampaignStats](docs/Model/GetSmsCampaignStats.md) - - [GetSmsCampaigns](docs/Model/GetSmsCampaigns.md) - - [GetSmsEventReport](docs/Model/GetSmsEventReport.md) - - [GetSmsEventReportEvents](docs/Model/GetSmsEventReportEvents.md) - - [GetSmtpTemplateOverview](docs/Model/GetSmtpTemplateOverview.md) - - [GetSmtpTemplateOverviewSender](docs/Model/GetSmtpTemplateOverviewSender.md) - - [GetSmtpTemplates](docs/Model/GetSmtpTemplates.md) - - [GetSsoToken](docs/Model/GetSsoToken.md) - - [GetStatsByBrowser](docs/Model/GetStatsByBrowser.md) - - [GetStatsByDevice](docs/Model/GetStatsByDevice.md) - - [GetStatsByDomain](docs/Model/GetStatsByDomain.md) - - [GetTransacAggregatedSmsReport](docs/Model/GetTransacAggregatedSmsReport.md) - - [GetTransacBlockedContacts](docs/Model/GetTransacBlockedContacts.md) - - [GetTransacBlockedContactsContacts](docs/Model/GetTransacBlockedContactsContacts.md) - - [GetTransacBlockedContactsReason](docs/Model/GetTransacBlockedContactsReason.md) - - [GetTransacEmailContent](docs/Model/GetTransacEmailContent.md) - - [GetTransacEmailContentEvents](docs/Model/GetTransacEmailContentEvents.md) - - [GetTransacEmailsList](docs/Model/GetTransacEmailsList.md) - - [GetTransacEmailsListTransactionalEmails](docs/Model/GetTransacEmailsListTransactionalEmails.md) - - [GetTransacSmsReport](docs/Model/GetTransacSmsReport.md) - - [GetTransacSmsReportReports](docs/Model/GetTransacSmsReportReports.md) - - [GetUserPermission](docs/Model/GetUserPermission.md) - - [GetUserPermissionPrivileges](docs/Model/GetUserPermissionPrivileges.md) - - [GetWATemplates](docs/Model/GetWATemplates.md) - - [GetWATemplatesTemplates](docs/Model/GetWATemplatesTemplates.md) - - [GetWebhook](docs/Model/GetWebhook.md) - - [GetWebhookAuth](docs/Model/GetWebhookAuth.md) - - [GetWebhookHeaders](docs/Model/GetWebhookHeaders.md) - - [GetWebhooks](docs/Model/GetWebhooks.md) - - [GetWhatsAppConfig](docs/Model/GetWhatsAppConfig.md) - - [GetWhatsappCampaignOverview](docs/Model/GetWhatsappCampaignOverview.md) - - [GetWhatsappCampaigns](docs/Model/GetWhatsappCampaigns.md) - - [GetWhatsappCampaignsCampaigns](docs/Model/GetWhatsappCampaignsCampaigns.md) - - [GetWhatsappEventReport](docs/Model/GetWhatsappEventReport.md) - - [GetWhatsappEventReportEvents](docs/Model/GetWhatsappEventReportEvents.md) - - [InlineResponse200](docs/Model/InlineResponse200.md) - - [InlineResponse2001](docs/Model/InlineResponse2001.md) - - [InlineResponse2002](docs/Model/InlineResponse2002.md) - - [InlineResponse201](docs/Model/InlineResponse201.md) - - [InlineResponse2011](docs/Model/InlineResponse2011.md) - - [InlineResponse2012](docs/Model/InlineResponse2012.md) - - [InlineResponse2013](docs/Model/InlineResponse2013.md) - - [InlineResponse2014](docs/Model/InlineResponse2014.md) - - [InlineResponse2015](docs/Model/InlineResponse2015.md) - - [InviteAdminUser](docs/Model/InviteAdminUser.md) - - [InviteAdminUserPrivileges](docs/Model/InviteAdminUserPrivileges.md) - - [Inviteuser](docs/Model/Inviteuser.md) - - [InviteuserPrivileges](docs/Model/InviteuserPrivileges.md) - - [ManageIp](docs/Model/ManageIp.md) - - [MasterDetailsResponse](docs/Model/MasterDetailsResponse.md) - - [MasterDetailsResponseBillingInfo](docs/Model/MasterDetailsResponseBillingInfo.md) - - [MasterDetailsResponseBillingInfoAddress](docs/Model/MasterDetailsResponseBillingInfoAddress.md) - - [MasterDetailsResponseBillingInfoName](docs/Model/MasterDetailsResponseBillingInfoName.md) - - [MasterDetailsResponsePlanInfo](docs/Model/MasterDetailsResponsePlanInfo.md) - - [MasterDetailsResponsePlanInfoFeatures](docs/Model/MasterDetailsResponsePlanInfoFeatures.md) - - [Note](docs/Model/Note.md) - - [NoteData](docs/Model/NoteData.md) - - [NoteId](docs/Model/NoteId.md) - - [NoteList](docs/Model/NoteList.md) - - [Order](docs/Model/Order.md) - - [OrderBatch](docs/Model/OrderBatch.md) - - [OrderBilling](docs/Model/OrderBilling.md) - - [OrderProducts](docs/Model/OrderProducts.md) - - [Otp](docs/Model/Otp.md) - - [Pipeline](docs/Model/Pipeline.md) - - [PipelineStage](docs/Model/PipelineStage.md) - - [Pipelines](docs/Model/Pipelines.md) - - [PostContactInfo](docs/Model/PostContactInfo.md) - - [PostContactInfoContacts](docs/Model/PostContactInfoContacts.md) - - [PostSendFailed](docs/Model/PostSendFailed.md) - - [PostSendSmsTestFailed](docs/Model/PostSendSmsTestFailed.md) - - [PutRevokeUserPermission](docs/Model/PutRevokeUserPermission.md) - - [Putresendcancelinvitation](docs/Model/Putresendcancelinvitation.md) - - [RemainingCreditModel](docs/Model/RemainingCreditModel.md) - - [RemainingCreditModelChild](docs/Model/RemainingCreditModelChild.md) - - [RemainingCreditModelReseller](docs/Model/RemainingCreditModelReseller.md) - - [RemoveContactFromList](docs/Model/RemoveContactFromList.md) - - [RemoveCredits](docs/Model/RemoveCredits.md) - - [RequestContactExport](docs/Model/RequestContactExport.md) - - [RequestContactExportCustomContactFilter](docs/Model/RequestContactExportCustomContactFilter.md) - - [RequestContactImport](docs/Model/RequestContactImport.md) - - [RequestContactImportJsonBody](docs/Model/RequestContactImportJsonBody.md) - - [RequestContactImportNewList](docs/Model/RequestContactImportNewList.md) - - [RequestSmsRecipientExport](docs/Model/RequestSmsRecipientExport.md) - - [ScheduleSmtpEmail](docs/Model/ScheduleSmtpEmail.md) - - [SendReport](docs/Model/SendReport.md) - - [SendReportEmail](docs/Model/SendReportEmail.md) - - [SendSms](docs/Model/SendSms.md) - - [SendSmtpEmail](docs/Model/SendSmtpEmail.md) - - [SendSmtpEmailAttachment](docs/Model/SendSmtpEmailAttachment.md) - - [SendSmtpEmailBcc](docs/Model/SendSmtpEmailBcc.md) - - [SendSmtpEmailCc](docs/Model/SendSmtpEmailCc.md) - - [SendSmtpEmailMessageVersions](docs/Model/SendSmtpEmailMessageVersions.md) - - [SendSmtpEmailReplyTo](docs/Model/SendSmtpEmailReplyTo.md) - - [SendSmtpEmailReplyTo1](docs/Model/SendSmtpEmailReplyTo1.md) - - [SendSmtpEmailSender](docs/Model/SendSmtpEmailSender.md) - - [SendSmtpEmailTo](docs/Model/SendSmtpEmailTo.md) - - [SendSmtpEmailTo1](docs/Model/SendSmtpEmailTo1.md) - - [SendTestEmail](docs/Model/SendTestEmail.md) - - [SendTestSms](docs/Model/SendTestSms.md) - - [SendTransacSms](docs/Model/SendTransacSms.md) - - [SendWhatsappMessage](docs/Model/SendWhatsappMessage.md) - - [SsoTokenRequest](docs/Model/SsoTokenRequest.md) - - [SubAccountAppsToggleRequest](docs/Model/SubAccountAppsToggleRequest.md) - - [SubAccountDetailsResponse](docs/Model/SubAccountDetailsResponse.md) - - [SubAccountDetailsResponsePlanInfo](docs/Model/SubAccountDetailsResponsePlanInfo.md) - - [SubAccountDetailsResponsePlanInfoCredits](docs/Model/SubAccountDetailsResponsePlanInfoCredits.md) - - [SubAccountDetailsResponsePlanInfoCreditsEmails](docs/Model/SubAccountDetailsResponsePlanInfoCreditsEmails.md) - - [SubAccountDetailsResponsePlanInfoFeatures](docs/Model/SubAccountDetailsResponsePlanInfoFeatures.md) - - [SubAccountDetailsResponsePlanInfoFeaturesInbox](docs/Model/SubAccountDetailsResponsePlanInfoFeaturesInbox.md) - - [SubAccountDetailsResponsePlanInfoFeaturesLandingPage](docs/Model/SubAccountDetailsResponsePlanInfoFeaturesLandingPage.md) - - [SubAccountDetailsResponsePlanInfoFeaturesUsers](docs/Model/SubAccountDetailsResponsePlanInfoFeaturesUsers.md) - - [SubAccountUpdatePlanRequest](docs/Model/SubAccountUpdatePlanRequest.md) - - [SubAccountUpdatePlanRequestCredits](docs/Model/SubAccountUpdatePlanRequestCredits.md) - - [SubAccountUpdatePlanRequestFeatures](docs/Model/SubAccountUpdatePlanRequestFeatures.md) - - [SubAccountsResponse](docs/Model/SubAccountsResponse.md) - - [SubAccountsResponseSubAccounts](docs/Model/SubAccountsResponseSubAccounts.md) - - [Task](docs/Model/Task.md) - - [TaskList](docs/Model/TaskList.md) - - [TaskReminder](docs/Model/TaskReminder.md) - - [TaskTypes](docs/Model/TaskTypes.md) - - [UpdateAttribute](docs/Model/UpdateAttribute.md) - - [UpdateAttributeEnumeration](docs/Model/UpdateAttributeEnumeration.md) - - [UpdateBatchContacts](docs/Model/UpdateBatchContacts.md) - - [UpdateBatchContactsContacts](docs/Model/UpdateBatchContactsContacts.md) - - [UpdateBatchContactsModel](docs/Model/UpdateBatchContactsModel.md) - - [UpdateCampaignStatus](docs/Model/UpdateCampaignStatus.md) - - [UpdateChild](docs/Model/UpdateChild.md) - - [UpdateChildAccountStatus](docs/Model/UpdateChildAccountStatus.md) - - [UpdateChildDomain](docs/Model/UpdateChildDomain.md) - - [UpdateContact](docs/Model/UpdateContact.md) - - [UpdateCouponCollection](docs/Model/UpdateCouponCollection.md) - - [UpdateEmailCampaign](docs/Model/UpdateEmailCampaign.md) - - [UpdateEmailCampaignRecipients](docs/Model/UpdateEmailCampaignRecipients.md) - - [UpdateEmailCampaignSender](docs/Model/UpdateEmailCampaignSender.md) - - [UpdateExternalFeed](docs/Model/UpdateExternalFeed.md) - - [UpdateList](docs/Model/UpdateList.md) - - [UpdateSender](docs/Model/UpdateSender.md) - - [UpdateSmsCampaign](docs/Model/UpdateSmsCampaign.md) - - [UpdateSmtpTemplate](docs/Model/UpdateSmtpTemplate.md) - - [UpdateSmtpTemplateSender](docs/Model/UpdateSmtpTemplateSender.md) - - [UpdateWebhook](docs/Model/UpdateWebhook.md) - - [UpdateWhatsAppCampaign](docs/Model/UpdateWhatsAppCampaign.md) - - [UploadImageModel](docs/Model/UploadImageModel.md) - - [UploadImageToGallery](docs/Model/UploadImageToGallery.md) - - [GetChildInfo](docs/Model/GetChildInfo.md) - - [GetExtendedCampaignOverview](docs/Model/GetExtendedCampaignOverview.md) - - [GetExtendedClient](docs/Model/GetExtendedClient.md) - - [GetExtendedContactDetails](docs/Model/GetExtendedContactDetails.md) - - [GetExtendedList](docs/Model/GetExtendedList.md) - - [GetSmsCampaign](docs/Model/GetSmsCampaign.md) - - [GetAccount](docs/Model/GetAccount.md) - - [GetEmailCampaign](docs/Model/GetEmailCampaign.md) - - [VariablesItems](docs/Model/VariablesItems.md) - - [WhatsappCampStats](docs/Model/WhatsappCampStats.md) - - [WhatsappCampTemplate](docs/Model/WhatsappCampTemplate.md) - - -## Documentation For Authorization - - -## api-key - -The API key should be passed in the request headers as `api-key` for authentication. +## Models + +- [AbTestCampaignResult](docs/Model/AbTestCampaignResult.md) +- [AbTestCampaignResultClickedLinks](docs/Model/AbTestCampaignResultClickedLinks.md) +- [AbTestCampaignResultStatistics](docs/Model/AbTestCampaignResultStatistics.md) +- [AbTestVersionClicksInner](docs/Model/AbTestVersionClicksInner.md) +- [AbTestVersionStats](docs/Model/AbTestVersionStats.md) +- [AddContactToListByEmails](docs/Model/AddContactToListByEmails.md) +- [AddContactToListByExtIDs](docs/Model/AddContactToListByExtIDs.md) +- [AddContactToListByIDs](docs/Model/AddContactToListByIDs.md) +- [AddContactToListRequest](docs/Model/AddContactToListRequest.md) +- [AttributeRewardPayload](docs/Model/AttributeRewardPayload.md) +- [AttributedRewardFailedConditionErrorResponse](docs/Model/AttributedRewardFailedConditionErrorResponse.md) +- [AuthenticateDomainModel](docs/Model/AuthenticateDomainModel.md) +- [BadRequestPayload](docs/Model/BadRequestPayload.md) +- [Balance](docs/Model/Balance.md) +- [BalanceBalancesInner](docs/Model/BalanceBalancesInner.md) +- [BalanceDefinition](docs/Model/BalanceDefinition.md) +- [BalanceDefinitionIdDoesNotExist](docs/Model/BalanceDefinitionIdDoesNotExist.md) +- [BalanceDefinitionPage](docs/Model/BalanceDefinitionPage.md) +- [BalanceLimit](docs/Model/BalanceLimit.md) +- [BalanceLimitPayload](docs/Model/BalanceLimitPayload.md) +- [BalancePage](docs/Model/BalancePage.md) +- [BlockDomain](docs/Model/BlockDomain.md) +- [CancelledTransaction](docs/Model/CancelledTransaction.md) +- [Cart](docs/Model/Cart.md) +- [CompaniesIdPatchRequest](docs/Model/CompaniesIdPatchRequest.md) +- [CompaniesImportPost200Response](docs/Model/CompaniesImportPost200Response.md) +- [CompaniesImportPost400Response](docs/Model/CompaniesImportPost400Response.md) +- [CompaniesLinkUnlinkIdPatchRequest](docs/Model/CompaniesLinkUnlinkIdPatchRequest.md) +- [CompaniesList](docs/Model/CompaniesList.md) +- [CompaniesPost200Response](docs/Model/CompaniesPost200Response.md) +- [CompaniesPostRequest](docs/Model/CompaniesPostRequest.md) +- [Company](docs/Model/Company.md) +- [CompanyAttributesInner](docs/Model/CompanyAttributesInner.md) +- [CompleteTransactionPayload](docs/Model/CompleteTransactionPayload.md) +- [CompletedTransaction](docs/Model/CompletedTransaction.md) +- [ComponentItems](docs/Model/ComponentItems.md) +- [Configuration](docs/Model/Configuration.md) +- [ContactBalances](docs/Model/ContactBalances.md) +- [ContactBalancesBalancesInner](docs/Model/ContactBalancesBalancesInner.md) +- [ContactErrorModel](docs/Model/ContactErrorModel.md) +- [ContactIdInvalidResponse](docs/Model/ContactIdInvalidResponse.md) +- [ConversationsAgentOnlinePingPostRequest](docs/Model/ConversationsAgentOnlinePingPostRequest.md) +- [ConversationsMessage](docs/Model/ConversationsMessage.md) +- [ConversationsMessageFile](docs/Model/ConversationsMessageFile.md) +- [ConversationsMessageFileImageInfo](docs/Model/ConversationsMessageFileImageInfo.md) +- [ConversationsMessagesIdPutRequest](docs/Model/ConversationsMessagesIdPutRequest.md) +- [ConversationsMessagesPostRequest](docs/Model/ConversationsMessagesPostRequest.md) +- [ConversationsPushedMessagesPostRequest](docs/Model/ConversationsPushedMessagesPostRequest.md) +- [ConversionSourceMetrics](docs/Model/ConversionSourceMetrics.md) +- [ConversionSourceProduct](docs/Model/ConversionSourceProduct.md) +- [CorporateGroupDetailsResponse](docs/Model/CorporateGroupDetailsResponse.md) +- [CorporateGroupDetailsResponseGroup](docs/Model/CorporateGroupDetailsResponseGroup.md) +- [CorporateGroupDetailsResponseSubAccountsInner](docs/Model/CorporateGroupDetailsResponseSubAccountsInner.md) +- [CorporateGroupDetailsResponseUsersInner](docs/Model/CorporateGroupDetailsResponseUsersInner.md) +- [CorporateGroupIdPutRequest](docs/Model/CorporateGroupIdPutRequest.md) +- [CorporateGroupPost201Response](docs/Model/CorporateGroupPost201Response.md) +- [CorporateGroupPostRequest](docs/Model/CorporateGroupPostRequest.md) +- [CorporateGroupUnlinkGroupIdSubAccountsPutRequest](docs/Model/CorporateGroupUnlinkGroupIdSubAccountsPutRequest.md) +- [CorporateIpGet200ResponseInner](docs/Model/CorporateIpGet200ResponseInner.md) +- [CorporateSsoTokenPostRequest](docs/Model/CorporateSsoTokenPostRequest.md) +- [CorporateSubAccountIpAssociatePostRequest](docs/Model/CorporateSubAccountIpAssociatePostRequest.md) +- [CorporateSubAccountIpDissociatePutRequest](docs/Model/CorporateSubAccountIpDissociatePutRequest.md) +- [CorporateSubAccountKeyPostRequest](docs/Model/CorporateSubAccountKeyPostRequest.md) +- [CorporateSubAccountSsoTokenPostRequest](docs/Model/CorporateSubAccountSsoTokenPostRequest.md) +- [CorporateUserEmailPermissionsPutRequest](docs/Model/CorporateUserEmailPermissionsPutRequest.md) +- [CorporateUserEmailPermissionsPutRequestPrivilegesInner](docs/Model/CorporateUserEmailPermissionsPutRequestPrivilegesInner.md) +- [CorporateUserInvitationActionEmailPut200Response](docs/Model/CorporateUserInvitationActionEmailPut200Response.md) +- [CreateApiKeyResponse](docs/Model/CreateApiKeyResponse.md) +- [CreateAttribute](docs/Model/CreateAttribute.md) +- [CreateAttributeEnumerationInner](docs/Model/CreateAttributeEnumerationInner.md) +- [CreateBalanceDefinitionPayload](docs/Model/CreateBalanceDefinitionPayload.md) +- [CreateCategoryModel](docs/Model/CreateCategoryModel.md) +- [CreateContact](docs/Model/CreateContact.md) +- [CreateCouponCollection201Response](docs/Model/CreateCouponCollection201Response.md) +- [CreateCouponCollectionRequest](docs/Model/CreateCouponCollectionRequest.md) +- [CreateCouponsRequest](docs/Model/CreateCouponsRequest.md) +- [CreateDoiContact](docs/Model/CreateDoiContact.md) +- [CreateDoiContactAttributesValue](docs/Model/CreateDoiContactAttributesValue.md) +- [CreateDomain](docs/Model/CreateDomain.md) +- [CreateDomainModel](docs/Model/CreateDomainModel.md) +- [CreateDomainModelDnsRecords](docs/Model/CreateDomainModelDnsRecords.md) +- [CreateDomainModelDnsRecordsDkimRecord](docs/Model/CreateDomainModelDnsRecordsDkimRecord.md) +- [CreateEmailCampaign](docs/Model/CreateEmailCampaign.md) +- [CreateEmailCampaignEmailExpirationDate](docs/Model/CreateEmailCampaignEmailExpirationDate.md) +- [CreateEmailCampaignRecipients](docs/Model/CreateEmailCampaignRecipients.md) +- [CreateEmailCampaignSender](docs/Model/CreateEmailCampaignSender.md) +- [CreateExternalFeed](docs/Model/CreateExternalFeed.md) +- [CreateExternalFeed201Response](docs/Model/CreateExternalFeed201Response.md) +- [CreateList](docs/Model/CreateList.md) +- [CreateLoyaltyProgramPayload](docs/Model/CreateLoyaltyProgramPayload.md) +- [CreateModel](docs/Model/CreateModel.md) +- [CreateOrderPayload](docs/Model/CreateOrderPayload.md) +- [CreatePaymentRequest](docs/Model/CreatePaymentRequest.md) +- [CreatePaymentResponse](docs/Model/CreatePaymentResponse.md) +- [CreateProductModel](docs/Model/CreateProductModel.md) +- [CreateSender](docs/Model/CreateSender.md) +- [CreateSenderIpsInner](docs/Model/CreateSenderIpsInner.md) +- [CreateSenderModel](docs/Model/CreateSenderModel.md) +- [CreateSmsCampaign](docs/Model/CreateSmsCampaign.md) +- [CreateSmsCampaignRecipients](docs/Model/CreateSmsCampaignRecipients.md) +- [CreateSmtpEmail](docs/Model/CreateSmtpEmail.md) +- [CreateSmtpTemplate](docs/Model/CreateSmtpTemplate.md) +- [CreateSmtpTemplateSender](docs/Model/CreateSmtpTemplateSender.md) +- [CreateSubAccount](docs/Model/CreateSubAccount.md) +- [CreateSubAccountResponse](docs/Model/CreateSubAccountResponse.md) +- [CreateSubscriptionMemberPayload](docs/Model/CreateSubscriptionMemberPayload.md) +- [CreateSubscriptionMemberResponse](docs/Model/CreateSubscriptionMemberResponse.md) +- [CreateSubscriptionPayload](docs/Model/CreateSubscriptionPayload.md) +- [CreateSubscriptionResponse](docs/Model/CreateSubscriptionResponse.md) +- [CreateTierGroupRequest](docs/Model/CreateTierGroupRequest.md) +- [CreateTransactionPayload](docs/Model/CreateTransactionPayload.md) +- [CreateUpdateBatchCategory](docs/Model/CreateUpdateBatchCategory.md) +- [CreateUpdateBatchCategoryModel](docs/Model/CreateUpdateBatchCategoryModel.md) +- [CreateUpdateBatchProducts](docs/Model/CreateUpdateBatchProducts.md) +- [CreateUpdateBatchProductsModel](docs/Model/CreateUpdateBatchProductsModel.md) +- [CreateUpdateCategories](docs/Model/CreateUpdateCategories.md) +- [CreateUpdateCategory](docs/Model/CreateUpdateCategory.md) +- [CreateUpdateContactModel](docs/Model/CreateUpdateContactModel.md) +- [CreateUpdateFolder](docs/Model/CreateUpdateFolder.md) +- [CreateUpdateProduct](docs/Model/CreateUpdateProduct.md) +- [CreateUpdateProducts](docs/Model/CreateUpdateProducts.md) +- [CreateWebhook](docs/Model/CreateWebhook.md) +- [CreateWhatsAppCampaign](docs/Model/CreateWhatsAppCampaign.md) +- [CreateWhatsAppCampaignRecipients](docs/Model/CreateWhatsAppCampaignRecipients.md) +- [CreateWhatsAppTemplate](docs/Model/CreateWhatsAppTemplate.md) +- [CreatedBatchId](docs/Model/CreatedBatchId.md) +- [CreatedProcessId](docs/Model/CreatedProcessId.md) +- [CrmDealsIdPatchRequest](docs/Model/CrmDealsIdPatchRequest.md) +- [CrmDealsLinkUnlinkIdPatchRequest](docs/Model/CrmDealsLinkUnlinkIdPatchRequest.md) +- [CrmDealsPost201Response](docs/Model/CrmDealsPost201Response.md) +- [CrmDealsPostRequest](docs/Model/CrmDealsPostRequest.md) +- [CrmTasksIdPatchRequest](docs/Model/CrmTasksIdPatchRequest.md) +- [CrmTasksPost201Response](docs/Model/CrmTasksPost201Response.md) +- [CrmTasksPostRequest](docs/Model/CrmTasksPostRequest.md) +- [Deal](docs/Model/Deal.md) +- [DealAttributesInner](docs/Model/DealAttributesInner.md) +- [DealsList](docs/Model/DealsList.md) +- [DeleteHardbounces](docs/Model/DeleteHardbounces.md) +- [DeleteSubscriptionMemberPayload](docs/Model/DeleteSubscriptionMemberPayload.md) +- [EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response](docs/Model/EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response.md) +- [EcommerceAttributionMetricsGet200Response](docs/Model/EcommerceAttributionMetricsGet200Response.md) +- [EcommerceAttributionMetricsGet200ResponseTotals](docs/Model/EcommerceAttributionMetricsGet200ResponseTotals.md) +- [EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response](docs/Model/EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response.md) +- [EcommerceConfigDisplayCurrencyGet200Response](docs/Model/EcommerceConfigDisplayCurrencyGet200Response.md) +- [EmailExportRecipients](docs/Model/EmailExportRecipients.md) +- [ErrorModel](docs/Model/ErrorModel.md) +- [ErrorResponse](docs/Model/ErrorResponse.md) +- [Event](docs/Model/Event.md) +- [EventContactPropertiesValue](docs/Model/EventContactPropertiesValue.md) +- [EventEventPropertiesValue](docs/Model/EventEventPropertiesValue.md) +- [EventIdentifiers](docs/Model/EventIdentifiers.md) +- [ExportWebhooksHistory](docs/Model/ExportWebhooksHistory.md) +- [ExportWebhooksHistoryRequest](docs/Model/ExportWebhooksHistoryRequest.md) +- [FileData](docs/Model/FileData.md) +- [FileDownloadableLink](docs/Model/FileDownloadableLink.md) +- [GetAccount](docs/Model/GetAccount.md) +- [GetAccountActivity](docs/Model/GetAccountActivity.md) +- [GetAccountActivityLogsInner](docs/Model/GetAccountActivityLogsInner.md) +- [GetAccountAllOfMarketingAutomation](docs/Model/GetAccountAllOfMarketingAutomation.md) +- [GetAccountAllOfPlan](docs/Model/GetAccountAllOfPlan.md) +- [GetAccountAllOfRelay](docs/Model/GetAccountAllOfRelay.md) +- [GetAccountAllOfRelayData](docs/Model/GetAccountAllOfRelayData.md) +- [GetAggregatedReport](docs/Model/GetAggregatedReport.md) +- [GetAllExternalFeeds](docs/Model/GetAllExternalFeeds.md) +- [GetAllExternalFeedsFeedsInner](docs/Model/GetAllExternalFeedsFeedsInner.md) +- [GetAttributes](docs/Model/GetAttributes.md) +- [GetAttributesAttributesInner](docs/Model/GetAttributesAttributesInner.md) +- [GetAttributesAttributesInnerEnumerationInner](docs/Model/GetAttributesAttributesInnerEnumerationInner.md) +- [GetBlockedDomains](docs/Model/GetBlockedDomains.md) +- [GetCampaignOverview](docs/Model/GetCampaignOverview.md) +- [GetCampaignRecipients](docs/Model/GetCampaignRecipients.md) +- [GetCampaignStats](docs/Model/GetCampaignStats.md) +- [GetCategories](docs/Model/GetCategories.md) +- [GetCategoryDetails](docs/Model/GetCategoryDetails.md) +- [GetClient](docs/Model/GetClient.md) +- [GetContactCampaignStats](docs/Model/GetContactCampaignStats.md) +- [GetContactCampaignStatsClickedInner](docs/Model/GetContactCampaignStatsClickedInner.md) +- [GetContactCampaignStatsOpenedInner](docs/Model/GetContactCampaignStatsOpenedInner.md) +- [GetContactCampaignStatsTransacAttributesInner](docs/Model/GetContactCampaignStatsTransacAttributesInner.md) +- [GetContactCampaignStatsUnsubscriptions](docs/Model/GetContactCampaignStatsUnsubscriptions.md) +- [GetContactDetails](docs/Model/GetContactDetails.md) +- [GetContactInfoIdentifierParameter](docs/Model/GetContactInfoIdentifierParameter.md) +- [GetContacts](docs/Model/GetContacts.md) +- [GetCorporateInvitedUsersList](docs/Model/GetCorporateInvitedUsersList.md) +- [GetCorporateInvitedUsersListUsersInner](docs/Model/GetCorporateInvitedUsersListUsersInner.md) +- [GetCorporateInvitedUsersListUsersInnerFeatureAccess](docs/Model/GetCorporateInvitedUsersListUsersInnerFeatureAccess.md) +- [GetCorporateInvitedUsersListUsersInnerGroups](docs/Model/GetCorporateInvitedUsersListUsersInnerGroups.md) +- [GetCorporateUserPermission](docs/Model/GetCorporateUserPermission.md) +- [GetCorporateUserPermissionFeatureAccess](docs/Model/GetCorporateUserPermissionFeatureAccess.md) +- [GetCorporateUserPermissionGroupsInner](docs/Model/GetCorporateUserPermissionGroupsInner.md) +- [GetCouponCollection](docs/Model/GetCouponCollection.md) +- [GetDeviceBrowserStats](docs/Model/GetDeviceBrowserStats.md) +- [GetDomainConfigurationModel](docs/Model/GetDomainConfigurationModel.md) +- [GetDomainsList](docs/Model/GetDomainsList.md) +- [GetDomainsListDomainsInner](docs/Model/GetDomainsListDomainsInner.md) +- [GetEmailCampaign](docs/Model/GetEmailCampaign.md) +- [GetEmailCampaigns](docs/Model/GetEmailCampaigns.md) +- [GetEmailCampaignsCampaignsInner](docs/Model/GetEmailCampaignsCampaignsInner.md) +- [GetEmailEventReport](docs/Model/GetEmailEventReport.md) +- [GetEmailEventReportEventsInner](docs/Model/GetEmailEventReportEventsInner.md) +- [GetExtendedCampaignOverview](docs/Model/GetExtendedCampaignOverview.md) +- [GetExtendedCampaignOverviewAllOfSender](docs/Model/GetExtendedCampaignOverviewAllOfSender.md) +- [GetExtendedCampaignStats](docs/Model/GetExtendedCampaignStats.md) +- [GetExtendedClient](docs/Model/GetExtendedClient.md) +- [GetExtendedClientAllOfAddress](docs/Model/GetExtendedClientAllOfAddress.md) +- [GetExtendedContactDetails](docs/Model/GetExtendedContactDetails.md) +- [GetExtendedContactDetailsAllOfStatistics](docs/Model/GetExtendedContactDetailsAllOfStatistics.md) +- [GetExtendedContactDetailsAllOfStatisticsClicked](docs/Model/GetExtendedContactDetailsAllOfStatisticsClicked.md) +- [GetExtendedContactDetailsAllOfStatisticsLinks](docs/Model/GetExtendedContactDetailsAllOfStatisticsLinks.md) +- [GetExtendedContactDetailsAllOfStatisticsMessagesSent](docs/Model/GetExtendedContactDetailsAllOfStatisticsMessagesSent.md) +- [GetExtendedContactDetailsAllOfStatisticsOpened](docs/Model/GetExtendedContactDetailsAllOfStatisticsOpened.md) +- [GetExtendedContactDetailsAllOfStatisticsUnsubscriptions](docs/Model/GetExtendedContactDetailsAllOfStatisticsUnsubscriptions.md) +- [GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription](docs/Model/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription.md) +- [GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription](docs/Model/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription.md) +- [GetExtendedList](docs/Model/GetExtendedList.md) +- [GetExtendedListAllOfCampaignStats](docs/Model/GetExtendedListAllOfCampaignStats.md) +- [GetExternalFeedByUUID](docs/Model/GetExternalFeedByUUID.md) +- [GetExternalFeedByUUIDHeadersInner](docs/Model/GetExternalFeedByUUIDHeadersInner.md) +- [GetFolder](docs/Model/GetFolder.md) +- [GetFolderLists](docs/Model/GetFolderLists.md) +- [GetFolders](docs/Model/GetFolders.md) +- [GetInboundEmailEvents](docs/Model/GetInboundEmailEvents.md) +- [GetInboundEmailEventsByUuid](docs/Model/GetInboundEmailEventsByUuid.md) +- [GetInboundEmailEventsByUuidAttachmentsInner](docs/Model/GetInboundEmailEventsByUuidAttachmentsInner.md) +- [GetInboundEmailEventsByUuidLogsInner](docs/Model/GetInboundEmailEventsByUuidLogsInner.md) +- [GetInboundEmailEventsEventsInner](docs/Model/GetInboundEmailEventsEventsInner.md) +- [GetInvitedUsersList](docs/Model/GetInvitedUsersList.md) +- [GetInvitedUsersListUsersInner](docs/Model/GetInvitedUsersListUsersInner.md) +- [GetInvitedUsersListUsersInnerFeatureAccess](docs/Model/GetInvitedUsersListUsersInnerFeatureAccess.md) +- [GetIp](docs/Model/GetIp.md) +- [GetIpFromSender](docs/Model/GetIpFromSender.md) +- [GetIps](docs/Model/GetIps.md) +- [GetIpsFromSender](docs/Model/GetIpsFromSender.md) +- [GetList](docs/Model/GetList.md) +- [GetLists](docs/Model/GetLists.md) +- [GetListsListsInner](docs/Model/GetListsListsInner.md) +- [GetPaymentRequest](docs/Model/GetPaymentRequest.md) +- [GetProcess](docs/Model/GetProcess.md) +- [GetProcesses](docs/Model/GetProcesses.md) +- [GetProductDetails](docs/Model/GetProductDetails.md) +- [GetProducts](docs/Model/GetProducts.md) +- [GetReports](docs/Model/GetReports.md) +- [GetReportsReportsInner](docs/Model/GetReportsReportsInner.md) +- [GetScheduledEmailByBatchId](docs/Model/GetScheduledEmailByBatchId.md) +- [GetScheduledEmailByBatchIdBatchesInner](docs/Model/GetScheduledEmailByBatchIdBatchesInner.md) +- [GetScheduledEmailById200Response](docs/Model/GetScheduledEmailById200Response.md) +- [GetScheduledEmailByMessageId](docs/Model/GetScheduledEmailByMessageId.md) +- [GetSegments](docs/Model/GetSegments.md) +- [GetSendersList](docs/Model/GetSendersList.md) +- [GetSendersListSendersInner](docs/Model/GetSendersListSendersInner.md) +- [GetSendersListSendersInnerIpsInner](docs/Model/GetSendersListSendersInnerIpsInner.md) +- [GetSharedTemplateUrl](docs/Model/GetSharedTemplateUrl.md) +- [GetSmsCampaign](docs/Model/GetSmsCampaign.md) +- [GetSmsCampaignOverview](docs/Model/GetSmsCampaignOverview.md) +- [GetSmsCampaignStats](docs/Model/GetSmsCampaignStats.md) +- [GetSmsCampaigns](docs/Model/GetSmsCampaigns.md) +- [GetSmsCampaignsCampaignsInner](docs/Model/GetSmsCampaignsCampaignsInner.md) +- [GetSmsEventReport](docs/Model/GetSmsEventReport.md) +- [GetSmsEventReportEventsInner](docs/Model/GetSmsEventReportEventsInner.md) +- [GetSmtpTemplateOverview](docs/Model/GetSmtpTemplateOverview.md) +- [GetSmtpTemplateOverviewSender](docs/Model/GetSmtpTemplateOverviewSender.md) +- [GetSmtpTemplates](docs/Model/GetSmtpTemplates.md) +- [GetSsoToken](docs/Model/GetSsoToken.md) +- [GetStatsByDevice](docs/Model/GetStatsByDevice.md) +- [GetSubAccountGroups200ResponseInner](docs/Model/GetSubAccountGroups200ResponseInner.md) +- [GetSubscriptionInfoResponse](docs/Model/GetSubscriptionInfoResponse.md) +- [GetSubscriptionInfoResponseBalance](docs/Model/GetSubscriptionInfoResponseBalance.md) +- [GetSubscriptionInfoResponseBalanceBalancesInner](docs/Model/GetSubscriptionInfoResponseBalanceBalancesInner.md) +- [GetSubscriptionInfoResponseMembersInner](docs/Model/GetSubscriptionInfoResponseMembersInner.md) +- [GetSubscriptionInfoResponseRewardInner](docs/Model/GetSubscriptionInfoResponseRewardInner.md) +- [GetSubscriptionInfoResponseTierInner](docs/Model/GetSubscriptionInfoResponseTierInner.md) +- [GetSubscriptionMemberResponse](docs/Model/GetSubscriptionMemberResponse.md) +- [GetSubscriptionMemberResponseMemberContactIdInner](docs/Model/GetSubscriptionMemberResponseMemberContactIdInner.md) +- [GetTransacAggregatedSmsReport](docs/Model/GetTransacAggregatedSmsReport.md) +- [GetTransacBlockedContacts](docs/Model/GetTransacBlockedContacts.md) +- [GetTransacBlockedContactsContactsInner](docs/Model/GetTransacBlockedContactsContactsInner.md) +- [GetTransacBlockedContactsContactsInnerReason](docs/Model/GetTransacBlockedContactsContactsInnerReason.md) +- [GetTransacEmailContent](docs/Model/GetTransacEmailContent.md) +- [GetTransacEmailContentEventsInner](docs/Model/GetTransacEmailContentEventsInner.md) +- [GetTransacEmailsList](docs/Model/GetTransacEmailsList.md) +- [GetTransacEmailsListTransactionalEmailsInner](docs/Model/GetTransacEmailsListTransactionalEmailsInner.md) +- [GetTransacSmsReport](docs/Model/GetTransacSmsReport.md) +- [GetTransacSmsReportReportsInner](docs/Model/GetTransacSmsReportReportsInner.md) +- [GetUserPermission](docs/Model/GetUserPermission.md) +- [GetUserPermissionPrivilegesInner](docs/Model/GetUserPermissionPrivilegesInner.md) +- [GetVersionInfoResponse](docs/Model/GetVersionInfoResponse.md) +- [GetWebhook](docs/Model/GetWebhook.md) +- [GetWebhooks](docs/Model/GetWebhooks.md) +- [GetWhatsAppConfig](docs/Model/GetWhatsAppConfig.md) +- [GetWhatsappCampaignOverview](docs/Model/GetWhatsappCampaignOverview.md) +- [GetWhatsappCampaigns](docs/Model/GetWhatsappCampaigns.md) +- [GetWhatsappCampaignsCampaignsInner](docs/Model/GetWhatsappCampaignsCampaignsInner.md) +- [GetWhatsappEventReport](docs/Model/GetWhatsappEventReport.md) +- [GetWhatsappEventReportEventsInner](docs/Model/GetWhatsappEventReportEventsInner.md) +- [GetWhatsappTemplates](docs/Model/GetWhatsappTemplates.md) +- [GetWhatsappTemplatesTemplatesInner](docs/Model/GetWhatsappTemplatesTemplatesInner.md) +- [InviteAdminUser](docs/Model/InviteAdminUser.md) +- [InviteAdminUserPrivilegesInner](docs/Model/InviteAdminUserPrivilegesInner.md) +- [Inviteuser](docs/Model/Inviteuser.md) +- [InviteuserPrivilegesInner](docs/Model/InviteuserPrivilegesInner.md) +- [InviteuserResponse](docs/Model/InviteuserResponse.md) +- [LoyaltyProgram](docs/Model/LoyaltyProgram.md) +- [LoyaltyProgramPage](docs/Model/LoyaltyProgramPage.md) +- [LoyaltyProgramValidationError](docs/Model/LoyaltyProgramValidationError.md) +- [LoyaltyTierPage](docs/Model/LoyaltyTierPage.md) +- [MasterDetailsResponse](docs/Model/MasterDetailsResponse.md) +- [MasterDetailsResponseBillingInfo](docs/Model/MasterDetailsResponseBillingInfo.md) +- [MasterDetailsResponseBillingInfoAddress](docs/Model/MasterDetailsResponseBillingInfoAddress.md) +- [MasterDetailsResponseBillingInfoName](docs/Model/MasterDetailsResponseBillingInfoName.md) +- [MasterDetailsResponsePlanInfo](docs/Model/MasterDetailsResponsePlanInfo.md) +- [MasterDetailsResponsePlanInfoFeaturesInner](docs/Model/MasterDetailsResponsePlanInfoFeaturesInner.md) +- [Note](docs/Model/Note.md) +- [NoteData](docs/Model/NoteData.md) +- [NoteId](docs/Model/NoteId.md) +- [Notification](docs/Model/Notification.md) +- [Offer](docs/Model/Offer.md) +- [OfferList](docs/Model/OfferList.md) +- [OffersListResponse](docs/Model/OffersListResponse.md) +- [Order](docs/Model/Order.md) +- [OrderBatch](docs/Model/OrderBatch.md) +- [OrderBilling](docs/Model/OrderBilling.md) +- [OrderIdentifiers](docs/Model/OrderIdentifiers.md) +- [OrderProductsInner](docs/Model/OrderProductsInner.md) +- [Otp](docs/Model/Otp.md) +- [PatchLoyaltyProgramPayload](docs/Model/PatchLoyaltyProgramPayload.md) +- [Pipeline](docs/Model/Pipeline.md) +- [PipelineStage](docs/Model/PipelineStage.md) +- [PostContactInfo](docs/Model/PostContactInfo.md) +- [PostContactInfoContacts](docs/Model/PostContactInfoContacts.md) +- [PostContactInfoContactsFailure](docs/Model/PostContactInfoContactsFailure.md) +- [PostContactInfoContactsSuccess](docs/Model/PostContactInfoContactsSuccess.md) +- [PostSendFailed](docs/Model/PostSendFailed.md) +- [PostSendSmsTestFailed](docs/Model/PostSendSmsTestFailed.md) +- [PutRevokeUserPermission](docs/Model/PutRevokeUserPermission.md) +- [PutRevokeUserPermissionResponse](docs/Model/PutRevokeUserPermissionResponse.md) +- [Putresendcancelinvitation](docs/Model/Putresendcancelinvitation.md) +- [PutresendcancelinvitationResponse](docs/Model/PutresendcancelinvitationResponse.md) +- [RedeemRewardPayload](docs/Model/RedeemRewardPayload.md) +- [RedeemedRewardFailedConditionErrorResponse](docs/Model/RedeemedRewardFailedConditionErrorResponse.md) +- [RemoveContactFromListByAll](docs/Model/RemoveContactFromListByAll.md) +- [RemoveContactFromListByEmails](docs/Model/RemoveContactFromListByEmails.md) +- [RemoveContactFromListByExtIDs](docs/Model/RemoveContactFromListByExtIDs.md) +- [RemoveContactFromListByIDs](docs/Model/RemoveContactFromListByIDs.md) +- [RemoveContactFromListRequest](docs/Model/RemoveContactFromListRequest.md) +- [RequestContactExport](docs/Model/RequestContactExport.md) +- [RequestContactExportCustomContactFilter](docs/Model/RequestContactExportCustomContactFilter.md) +- [RequestContactImport](docs/Model/RequestContactImport.md) +- [RequestContactImportJsonBodyInner](docs/Model/RequestContactImportJsonBodyInner.md) +- [RequestContactImportNewList](docs/Model/RequestContactImportNewList.md) +- [RequestSmsRecipientExport](docs/Model/RequestSmsRecipientExport.md) +- [RewardAttributionResponse](docs/Model/RewardAttributionResponse.md) +- [RewardRedeemResponse](docs/Model/RewardRedeemResponse.md) +- [ScheduleSmtpEmail](docs/Model/ScheduleSmtpEmail.md) +- [Segment](docs/Model/Segment.md) +- [SendReport](docs/Model/SendReport.md) +- [SendReportEmail](docs/Model/SendReportEmail.md) +- [SendSms](docs/Model/SendSms.md) +- [SendSmtpEmail](docs/Model/SendSmtpEmail.md) +- [SendSmtpEmailAttachmentInner](docs/Model/SendSmtpEmailAttachmentInner.md) +- [SendSmtpEmailBccInner](docs/Model/SendSmtpEmailBccInner.md) +- [SendSmtpEmailCcInner](docs/Model/SendSmtpEmailCcInner.md) +- [SendSmtpEmailMessageVersionsInner](docs/Model/SendSmtpEmailMessageVersionsInner.md) +- [SendSmtpEmailReplyTo](docs/Model/SendSmtpEmailReplyTo.md) +- [SendSmtpEmailSender](docs/Model/SendSmtpEmailSender.md) +- [SendSmtpEmailToInner](docs/Model/SendSmtpEmailToInner.md) +- [SendTestEmail](docs/Model/SendTestEmail.md) +- [SendTestSms](docs/Model/SendTestSms.md) +- [SendTransacSms](docs/Model/SendTransacSms.md) +- [SendWhatsappMessage201Response](docs/Model/SendWhatsappMessage201Response.md) +- [SendWhatsappMessageRequest](docs/Model/SendWhatsappMessageRequest.md) +- [SendWhatsappMessageTemplate](docs/Model/SendWhatsappMessageTemplate.md) +- [SendWhatsappMessageText](docs/Model/SendWhatsappMessageText.md) +- [SubAccountAppsToggleRequest](docs/Model/SubAccountAppsToggleRequest.md) +- [SubAccountDetailsResponse](docs/Model/SubAccountDetailsResponse.md) +- [SubAccountDetailsResponseGroupsInner](docs/Model/SubAccountDetailsResponseGroupsInner.md) +- [SubAccountDetailsResponsePlanInfo](docs/Model/SubAccountDetailsResponsePlanInfo.md) +- [SubAccountDetailsResponsePlanInfoCredits](docs/Model/SubAccountDetailsResponsePlanInfoCredits.md) +- [SubAccountDetailsResponsePlanInfoCreditsEmails](docs/Model/SubAccountDetailsResponsePlanInfoCreditsEmails.md) +- [SubAccountDetailsResponsePlanInfoCreditsExternalFeeds](docs/Model/SubAccountDetailsResponsePlanInfoCreditsExternalFeeds.md) +- [SubAccountDetailsResponsePlanInfoCreditsSms](docs/Model/SubAccountDetailsResponsePlanInfoCreditsSms.md) +- [SubAccountDetailsResponsePlanInfoCreditsWhatsapp](docs/Model/SubAccountDetailsResponsePlanInfoCreditsWhatsapp.md) +- [SubAccountDetailsResponsePlanInfoCreditsWpSubscribers](docs/Model/SubAccountDetailsResponsePlanInfoCreditsWpSubscribers.md) +- [SubAccountDetailsResponsePlanInfoFeatures](docs/Model/SubAccountDetailsResponsePlanInfoFeatures.md) +- [SubAccountDetailsResponsePlanInfoFeaturesInbox](docs/Model/SubAccountDetailsResponsePlanInfoFeaturesInbox.md) +- [SubAccountDetailsResponsePlanInfoFeaturesLandingPage](docs/Model/SubAccountDetailsResponsePlanInfoFeaturesLandingPage.md) +- [SubAccountDetailsResponsePlanInfoFeaturesUsers](docs/Model/SubAccountDetailsResponsePlanInfoFeaturesUsers.md) +- [SubAccountUpdatePlanRequest](docs/Model/SubAccountUpdatePlanRequest.md) +- [SubAccountUpdatePlanRequestCredits](docs/Model/SubAccountUpdatePlanRequestCredits.md) +- [SubAccountUpdatePlanRequestFeatures](docs/Model/SubAccountUpdatePlanRequestFeatures.md) +- [SubAccountsResponse](docs/Model/SubAccountsResponse.md) +- [SubAccountsResponseSubAccountsInner](docs/Model/SubAccountsResponseSubAccountsInner.md) +- [SubAccountsResponseSubAccountsInnerGroupsInner](docs/Model/SubAccountsResponseSubAccountsInnerGroupsInner.md) +- [SubscriptionNotFoundErrorResponse](docs/Model/SubscriptionNotFoundErrorResponse.md) +- [Task](docs/Model/Task.md) +- [TaskList](docs/Model/TaskList.md) +- [TaskReminder](docs/Model/TaskReminder.md) +- [TaskTypes](docs/Model/TaskTypes.md) +- [Tier](docs/Model/Tier.md) +- [TierAccessConditionsInner](docs/Model/TierAccessConditionsInner.md) +- [TierForContact](docs/Model/TierForContact.md) +- [TierGroup](docs/Model/TierGroup.md) +- [TierGroupPage](docs/Model/TierGroupPage.md) +- [TierRequest](docs/Model/TierRequest.md) +- [TierRequestAccessConditionsInner](docs/Model/TierRequestAccessConditionsInner.md) +- [TierRequestTierRewardsInner](docs/Model/TierRequestTierRewardsInner.md) +- [TierTierRewardsInner](docs/Model/TierTierRewardsInner.md) +- [Transaction](docs/Model/Transaction.md) +- [UnauthorizedResponse](docs/Model/UnauthorizedResponse.md) +- [UpdateAttribute](docs/Model/UpdateAttribute.md) +- [UpdateAttributeEnumerationInner](docs/Model/UpdateAttributeEnumerationInner.md) +- [UpdateBalanceDefinitionPayload](docs/Model/UpdateBalanceDefinitionPayload.md) +- [UpdateBatchContacts](docs/Model/UpdateBatchContacts.md) +- [UpdateBatchContactsContactsInner](docs/Model/UpdateBatchContactsContactsInner.md) +- [UpdateBatchContactsModel](docs/Model/UpdateBatchContactsModel.md) +- [UpdateCampaignStatus](docs/Model/UpdateCampaignStatus.md) +- [UpdateContact](docs/Model/UpdateContact.md) +- [UpdateCouponCollection200Response](docs/Model/UpdateCouponCollection200Response.md) +- [UpdateCouponCollectionRequest](docs/Model/UpdateCouponCollectionRequest.md) +- [UpdateEmailCampaign](docs/Model/UpdateEmailCampaign.md) +- [UpdateEmailCampaignEmailExpirationDate](docs/Model/UpdateEmailCampaignEmailExpirationDate.md) +- [UpdateEmailCampaignRecipients](docs/Model/UpdateEmailCampaignRecipients.md) +- [UpdateEmailCampaignSender](docs/Model/UpdateEmailCampaignSender.md) +- [UpdateExternalFeed](docs/Model/UpdateExternalFeed.md) +- [UpdateList](docs/Model/UpdateList.md) +- [UpdateLoyaltyProgramPayload](docs/Model/UpdateLoyaltyProgramPayload.md) +- [UpdateSender](docs/Model/UpdateSender.md) +- [UpdateSmsCampaign](docs/Model/UpdateSmsCampaign.md) +- [UpdateSmtpTemplate](docs/Model/UpdateSmtpTemplate.md) +- [UpdateSmtpTemplateSender](docs/Model/UpdateSmtpTemplateSender.md) +- [UpdateTierGroup404Response](docs/Model/UpdateTierGroup404Response.md) +- [UpdateTierGroupRequest](docs/Model/UpdateTierGroupRequest.md) +- [UpdateUserResponse](docs/Model/UpdateUserResponse.md) +- [UpdateWebhook](docs/Model/UpdateWebhook.md) +- [UpdateWhatsAppCampaign](docs/Model/UpdateWhatsAppCampaign.md) +- [UploadImageModel](docs/Model/UploadImageModel.md) +- [UploadImageToGallery](docs/Model/UploadImageToGallery.md) +- [ValidateRewardPayload](docs/Model/ValidateRewardPayload.md) +- [ValidatedRewardResponse](docs/Model/ValidatedRewardResponse.md) +- [ValidationError](docs/Model/ValidationError.md) +- [VariablesItems](docs/Model/VariablesItems.md) +- [VersionInfo](docs/Model/VersionInfo.md) +- [WhatsappCampStats](docs/Model/WhatsappCampStats.md) +- [WhatsappCampTemplate](docs/Model/WhatsappCampTemplate.md) + +## Authorization + +### api-key - **Type**: API key - **API key parameter name**: api-key - **Location**: HTTP header + + +### partner-key + +- **Type**: API key +- **API key parameter name**: partner-key +- **Location**: HTTP header + + +## Tests + +To run the tests, use: + +```bash +composer install +vendor/bin/phpunit +``` + +## Author + +contact@brevo.com + +## About this package + ## partner-key The partner key should be passed in the request headers as `partner-key` along with `api-key` pair for successful authentication of partner (Optional). @@ -724,3 +857,13 @@ The partner key should be passed in the request headers as `partner-key` along w If you find a bug, please post the issue on [Github](https://github.com/getbrevo/brevo-php/issues). As always, if you need additional assistance, drop us a note [here](https://account.brevo.com/support). + +You can generate the PHP code with the CLI command: openapi-generator generate --skip-validate-spec -c config-openapi-generator.yml + +This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: `3.0.0` + - Package version: `3.0.0` + - Generator version: `7.9.0` +- Build package: `org.openapitools.codegen.languages.PhpNextgenClientCodegen` + diff --git a/composer.json b/composer.json index 176f1d7..e57cf8b 100755 --- a/composer.json +++ b/composer.json @@ -2,42 +2,44 @@ "name": "getbrevo/brevo-php", "description": "Official Brevo provided RESTFul API V3 php library", "keywords": [ - "brevo", - "swagger", - "php", - "sdk", - "api" + "brevo", + "swagger", + "php", + "sdk", + "api" ], "homepage": "https://github.com/getbrevo/brevo-php", "license": "MIT", "authors": [ - { - "name": "Brevo Developers", - "email": "contact@brevo.com", - "homepage": "https://www.brevo.com/" - } + { + "name": "Brevo Developers", + "email": "contact@brevo.com", + "homepage": "https://www.brevo.com/" + } ], "require": { - "php": ">=5.6", + "php": "^8.1", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", - "guzzlehttp/guzzle": "^7.4.0" + "guzzlehttp/guzzle": "^7.4.5", + "guzzlehttp/psr7": "^2.0" }, "require-dev": { - "phpunit/phpunit": "^4.8", - "squizlabs/php_codesniffer": "~2.6", - "friendsofphp/php-cs-fixer": "~1.12" + "friendsofphp/php-cs-fixer": "^3.5", + "overtrue/phplint": "^9.0", + "phpunit/phpunit": "^9.0" }, "autoload": { "psr-4": { "Brevo\\Client\\" : "lib/" } }, "autoload-dev": { - "psr-4": { "Brevo\\Client\\" : "test/" } + "psr-4": { "Brevo\\Client\\Test\\" : "tests/" } }, - "extra": { - "branch-alias": { - "dev-master": "1.x.x-dev" - } + "scripts": { + "test": [ + "@phplint" + ], + "phplint": "phplint" } -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock index fb002d7..5a85735 100644 --- a/composer.lock +++ b/composer.lock @@ -4,39 +4,51 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "fc3a3187a6ed0508923186df909358ff", + "content-hash": "41b10897330045330672bb5d3ce0a568", "packages": [ { "name": "guzzlehttp/guzzle", - "version": "6.3.3", + "version": "7.9.2", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba" + "reference": "d281ed313b989f213357e3be1a179f02196ac99b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba", - "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b", + "reference": "d281ed313b989f213357e3be1a179f02196ac99b", "shasum": "" }, "require": { - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.4", - "php": ">=5.5" + "ext-json": "*", + "guzzlehttp/promises": "^1.5.3 || ^2.0.3", + "guzzlehttp/psr7": "^2.7.0", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" }, "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", "ext-curl": "*", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", - "psr/log": "^1.0" + "guzzle/client-integration-tests": "3.0.2", + "php-http/message-factory": "^1.1", + "phpunit/phpunit": "^8.5.39 || ^9.6.20", + "psr/log": "^1.1 || ^2.0 || ^3.0" }, "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", "psr/log": "Required for using the Log middleware" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "6.3-dev" + "bamarni-bin": { + "bin-links": true, + "forward-command": false } }, "autoload": { @@ -52,128 +64,240 @@ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" } ], "description": "Guzzle is a PHP HTTP client library", - "homepage": "http://guzzlephp.org/", "keywords": [ "client", "curl", "framework", "http", "http client", + "psr-18", + "psr-7", "rest", "web service" ], - "time": "2018-04-22T15:46:56+00:00" + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/7.9.2" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "time": "2024-07-24T11:22:20+00:00" }, { "name": "guzzlehttp/promises", - "version": "v1.3.1", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "url": "https://api.github.com/repos/guzzle/promises/zipball/f9c436286ab2892c7db7be8c8da4ef61ccf7b455", + "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455", "shasum": "" }, "require": { - "php": ">=5.5.0" + "php": "^7.2.5 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^4.0" + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.4-dev" + "bamarni-bin": { + "bin-links": true, + "forward-command": false } }, "autoload": { "psr-4": { "GuzzleHttp\\Promise\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" } ], "description": "Guzzle promises library", "keywords": [ "promise" ], - "time": "2016-12-20T10:07:11+00:00" + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "time": "2024-10-17T10:06:22+00:00" }, { "name": "guzzlehttp/psr7", - "version": "1.5.2", + "version": "2.7.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "9f83dded91781a01c63574e387eaa769be769115" + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/9f83dded91781a01c63574e387eaa769be769115", - "reference": "9f83dded91781a01c63574e387eaa769be769115", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201", + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201", "shasum": "" }, "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0", - "ralouphie/getallheaders": "^2.0.5" + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 || ^2.0", + "ralouphie/getallheaders": "^3.0" }, "provide": { + "psr/http-factory-implementation": "1.0", "psr/http-message-implementation": "1.0" }, "require-dev": { - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + "bamarni/composer-bin-plugin": "^1.8.2", + "http-interop/http-factory-tests": "0.9.0", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.5-dev" + "bamarni-bin": { + "bin-links": true, + "forward-command": false } }, "autoload": { "psr-4": { "GuzzleHttp\\Psr7\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, { "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" } ], "description": "PSR-7 message implementation that also provides common utility methods", @@ -187,24 +311,43 @@ "uri", "url" ], - "time": "2018-12-04T20:46:45+00:00" + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/2.7.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2024-07-18T11:15:46+00:00" }, { - "name": "psr/http-message", - "version": "1.0.1", + "name": "psr/http-client", + "version": "1.0.3", "source": { "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + "url": "https://github.com/php-fig/http-client.git", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { @@ -214,7 +357,7 @@ }, "autoload": { "psr-4": { - "Psr\\Http\\Message\\": "src/" + "Psr\\Http\\Client\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -224,47 +367,50 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], - "description": "Common interface for HTTP messages", - "homepage": "https://github.com/php-fig/http-message", + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", "keywords": [ "http", - "http-message", + "http-client", "psr", - "psr-7", - "request", - "response" + "psr-18" ], - "time": "2016-08-06T14:39:51+00:00" + "support": { + "source": "https://github.com/php-fig/http-client" + }, + "time": "2023-09-23T14:17:50+00:00" }, { - "name": "ralouphie/getallheaders", - "version": "2.0.5", + "name": "psr/http-factory", + "version": "1.1.0", "source": { "type": "git", - "url": "https://github.com/ralouphie/getallheaders.git", - "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa" + "url": "https://github.com/php-fig/http-factory.git", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/5601c8a83fbba7ef674a7369456d12f1e0d0eafa", - "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", "shasum": "" }, "require": { - "php": ">=5.3" - }, - "require-dev": { - "phpunit/phpunit": "~3.7.0", - "satooshi/php-coveralls": ">=1.0" + "php": ">=7.1", + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { - "files": [ - "src/getallheaders.php" - ] + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -272,48 +418,52 @@ ], "authors": [ { - "name": "Ralph Khattar", - "email": "ralph.khattar@gmail.com" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "description": "A polyfill for getallheaders.", - "time": "2016-02-11T07:05:27+00:00" - } - ], - "packages-dev": [ + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory" + }, + "time": "2024-04-15T12:06:14+00:00" + }, { - "name": "doctrine/instantiator", - "version": "1.0.5", + "name": "psr/http-message", + "version": "2.0", "source": { "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", "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" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + "Psr\\Http\\Message\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -322,59 +472,51 @@ ], "authors": [ { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", "keywords": [ - "constructor", - "instantiate" + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" ], - "time": "2015-06-14T21:17:01+00:00" + "support": { + "source": "https://github.com/php-fig/http-message/tree/2.0" + }, + "time": "2023-04-04T09:54:51+00:00" }, { - "name": "friendsofphp/php-cs-fixer", - "version": "v1.13.3", + "name": "ralouphie/getallheaders", + "version": "3.0.3", "source": { "type": "git", - "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "387e4c86c9dc0e1e4c475291fc114ec45b98e624" + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/387e4c86c9dc0e1e4c475291fc114ec45b98e624", - "reference": "387e4c86c9dc0e1e4c475291fc114ec45b98e624", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", "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" + "php": ">=5.6" }, "require-dev": { - "phpunit/phpunit": "^4.5|^5", - "satooshi/php-coveralls": "^1.0" + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" }, - "bin": [ - "php-cs-fixer" - ], - "type": "application", + "type": "library", "autoload": { - "psr-4": { - "Symfony\\CS\\": "Symfony/CS/" - } + "files": [ + "src/getallheaders.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -382,49 +524,48 @@ ], "authors": [ { - "name": "Dariusz Rumiński", - "email": "dariusz.ruminski@gmail.com" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" } ], - "description": "A tool to automatically fix PHP code style", - "time": "2017-09-11T14:11:16+00:00" + "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "time": "2019-03-08T08:55:37+00:00" }, { - "name": "phpdocumentor/reflection-common", - "version": "1.0.1", + "name": "symfony/deprecation-contracts", + "version": "v3.5.0", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", "shasum": "" }, "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] - } + "files": [ + "function.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -432,51 +573,63 @@ ], "authors": [ { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } ], - "time": "2017-09-11T18:02:19+00:00" - }, + "time": "2024-04-18T09:32:20+00:00" + } + ], + "packages-dev": [ { - "name": "phpdocumentor/reflection-docblock", - "version": "3.3.2", + "name": "clue/ndjson-react", + "version": "v1.3.0", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "bf329f6c1aadea3299f08ee804682b7c45b326a2" + "url": "https://github.com/clue/reactphp-ndjson.git", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bf329f6c1aadea3299f08ee804682b7c45b326a2", - "reference": "bf329f6c1aadea3299f08ee804682b7c45b326a2", + "url": "https://api.github.com/repos/clue/reactphp-ndjson/zipball/392dc165fce93b5bb5c637b67e59619223c931b0", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0", - "phpdocumentor/reflection-common": "^1.0.0", - "phpdocumentor/type-resolver": "^0.4.0", - "webmozart/assert": "^1.0" + "php": ">=5.3", + "react/stream": "^1.2" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.4" + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35", + "react/event-loop": "^1.2" }, "type": "library", "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "Clue\\React\\NDJson\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -485,46 +638,75 @@ ], "authors": [ { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" + "name": "Christian Lück", + "email": "christian@clue.engineering" + } + ], + "description": "Streaming newline-delimited JSON (NDJSON) parser and encoder for ReactPHP.", + "homepage": "https://github.com/clue/reactphp-ndjson", + "keywords": [ + "NDJSON", + "json", + "jsonlines", + "newline", + "reactphp", + "streaming" + ], + "support": { + "issues": "https://github.com/clue/reactphp-ndjson/issues", + "source": "https://github.com/clue/reactphp-ndjson/tree/v1.3.0" + }, + "funding": [ + { + "url": "https://clue.engineering/support", + "type": "custom" + }, + { + "url": "https://github.com/clue", + "type": "github" } ], - "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" + "time": "2022-12-23T10:58:28+00:00" }, { - "name": "phpdocumentor/type-resolver", - "version": "0.4.0", + "name": "composer/pcre", + "version": "3.3.2", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + "url": "https://github.com/composer/pcre.git", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0", - "phpdocumentor/reflection-common": "^1.0" + "php": "^7.4 || ^8.0" + }, + "conflict": { + "phpstan/phpstan": "<1.11.10" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" + "phpstan/phpstan": "^1.12 || ^2", + "phpstan/phpstan-strict-rules": "^1 || ^2", + "phpunit/phpunit": "^8 || ^9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-main": "3.x-dev" + }, + "phpstan": { + "includes": [ + "extension.neon" + ] } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "Composer\\Pcre\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -533,46 +715,68 @@ ], "authors": [ { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.3.2" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" } ], - "time": "2017-07-14T14:27:02+00:00" + "time": "2024-11-12T16:29:46+00:00" }, { - "name": "phpspec/prophecy", - "version": "1.8.0", + "name": "composer/semver", + "version": "3.4.3", "source": { "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" + "url": "https://github.com/composer/semver.git", + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "url": "https://api.github.com/repos/composer/semver/zipball/4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", "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" + "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^3 || ^7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8.x-dev" + "dev-main": "3.x-dev" } }, "autoload": { - "psr-0": { - "Prophecy\\": "src/" + "psr-4": { + "Composer\\Semver\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -581,383 +785,493 @@ ], "authors": [ { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" }, { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" } ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", + "description": "Semver library that offers utilities, version constraint parsing and validation.", "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" + "semantic", + "semver", + "validation", + "versioning" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.4.3" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } ], - "time": "2018-08-05T17:53:17+00:00" + "time": "2024-09-19T14:15:21+00:00" }, { - "name": "phpunit/php-code-coverage", - "version": "2.2.4", + "name": "composer/xdebug-handler", + "version": "3.0.5", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/6c1925561632e83d60a44492e0b344cf48ab85ef", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef", "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" + "composer/pcre": "^1 || ^2 || ^3", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1 || ^2 || ^3" }, "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" - }, - "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "phpunit/phpunit": "^8.5 || ^9.6 || ^10.5" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" } ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "description": "Restarts a process without Xdebug.", "keywords": [ - "coverage", - "testing", - "xunit" + "Xdebug", + "performance" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/3.0.5" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } ], - "time": "2015-10-06T15:47:00+00:00" + "time": "2024-05-06T16:37:16+00:00" }, { - "name": "phpunit/php-file-iterator", - "version": "1.4.5", + "name": "doctrine/instantiator", + "version": "2.0.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + "url": "https://github.com/doctrine/instantiator.git", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^8.1" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } + "require-dev": { + "doctrine/coding-standard": "^11", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^5.4" }, + "type": "library", "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "https://ocramius.github.io/" } ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ - "filesystem", - "iterator" + "constructor", + "instantiate" + ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } ], - "time": "2017-11-27T13:52:08+00:00" + "time": "2022-12-30T00:23:10+00:00" }, { - "name": "phpunit/php-text-template", - "version": "1.2.1", + "name": "evenement/evenement", + "version": "v3.0.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + "url": "https://github.com/igorw/evenement.git", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "url": "https://api.github.com/repos/igorw/evenement/zipball/0a16b0d71ab13284339abb99d9d2bd813640efbc", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^9 || ^6" }, "type": "library", "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Evenement\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" } ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "description": "Événement is a very simple event dispatching library for PHP", "keywords": [ - "template" + "event-dispatcher", + "event-emitter" ], - "time": "2015-06-21T13:50:34+00:00" + "support": { + "issues": "https://github.com/igorw/evenement/issues", + "source": "https://github.com/igorw/evenement/tree/v3.0.2" + }, + "time": "2023-08-08T05:53:35+00:00" }, { - "name": "phpunit/php-timer", - "version": "1.0.9", + "name": "fidry/cpu-core-counter", + "version": "1.2.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + "url": "https://github.com/theofidry/cpu-core-counter.git", + "reference": "8520451a140d3f46ac33042715115e290cf5785f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/8520451a140d3f46ac33042715115e290cf5785f", + "reference": "8520451a140d3f46ac33042715115e290cf5785f", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^7.2 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "fidry/makefile": "^0.2.0", + "fidry/php-cs-fixer-config": "^1.1.2", + "phpstan/extension-installer": "^1.2.0", + "phpstan/phpstan": "^1.9.2", + "phpstan/phpstan-deprecation-rules": "^1.0.0", + "phpstan/phpstan-phpunit": "^1.2.2", + "phpstan/phpstan-strict-rules": "^1.4.4", + "phpunit/phpunit": "^8.5.31 || ^9.5.26", + "webmozarts/strict-phpunit": "^7.5" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Fidry\\CpuCoreCounter\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com" } ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", + "description": "Tiny utility to get the number of CPU cores.", "keywords": [ - "timer" + "CPU", + "core" + ], + "support": { + "issues": "https://github.com/theofidry/cpu-core-counter/issues", + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.2.0" + }, + "funding": [ + { + "url": "https://github.com/theofidry", + "type": "github" + } ], - "time": "2017-02-26T11:10:40+00:00" + "time": "2024-08-06T10:04:20+00:00" }, { - "name": "phpunit/php-token-stream", - "version": "1.4.12", + "name": "friendsofphp/php-cs-fixer", + "version": "v3.65.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" + "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", + "reference": "79d4f3e77b250a7d8043d76c6af8f0695e8a469f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", - "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/79d4f3e77b250a7d8043d76c6af8f0695e8a469f", + "reference": "79d4f3e77b250a7d8043d76c6af8f0695e8a469f", "shasum": "" }, "require": { + "clue/ndjson-react": "^1.0", + "composer/semver": "^3.4", + "composer/xdebug-handler": "^3.0.3", + "ext-filter": "*", + "ext-json": "*", "ext-tokenizer": "*", - "php": ">=5.3.3" + "fidry/cpu-core-counter": "^1.2", + "php": "^7.4 || ^8.0", + "react/child-process": "^0.6.5", + "react/event-loop": "^1.0", + "react/promise": "^2.0 || ^3.0", + "react/socket": "^1.0", + "react/stream": "^1.0", + "sebastian/diff": "^4.0 || ^5.0 || ^6.0", + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0", + "symfony/filesystem": "^5.4 || ^6.0 || ^7.0", + "symfony/finder": "^5.4 || ^6.0 || ^7.0", + "symfony/options-resolver": "^5.4 || ^6.0 || ^7.0", + "symfony/polyfill-mbstring": "^1.28", + "symfony/polyfill-php80": "^1.28", + "symfony/polyfill-php81": "^1.28", + "symfony/process": "^5.4 || ^6.0 || ^7.0", + "symfony/stopwatch": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "facile-it/paraunit": "^1.3.1 || ^2.4", + "infection/infection": "^0.29.8", + "justinrainbow/json-schema": "^5.3 || ^6.0", + "keradus/cli-executor": "^2.1", + "mikey179/vfsstream": "^1.6.12", + "php-coveralls/php-coveralls": "^2.7", + "php-cs-fixer/accessible-object": "^1.1", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.5", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.5", + "phpunit/phpunit": "^9.6.21 || ^10.5.38 || ^11.4.3", + "symfony/var-dumper": "^5.4.47 || ^6.4.15 || ^7.1.8", + "symfony/yaml": "^5.4.45 || ^6.4.13 || ^7.1.6" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters." }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", "autoload": { - "classmap": [ - "src/" + "psr-4": { + "PhpCsFixer\\": "src/" + }, + "exclude-from-classmap": [ + "src/Fixer/Internal/*" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" } ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "description": "A tool to automatically fix PHP code style", "keywords": [ - "tokenizer" + "Static code analysis", + "fixer", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.65.0" + }, + "funding": [ + { + "url": "https://github.com/keradus", + "type": "github" + } ], - "time": "2017-12-04T08:55:13+00:00" + "time": "2024-11-25T00:39:24+00:00" }, { - "name": "phpunit/phpunit", - "version": "4.8.36", + "name": "myclabs/deep-copy", + "version": "1.12.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "46023de9a91eec7dfb06cc56cb4e260017298517" + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517", - "reference": "46023de9a91eec7dfb06cc56cb4e260017298517", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845", + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845", "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" + "php": "^7.1 || ^8.0" }, - "suggest": { - "phpunit/php-invoker": "~1.1" + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.8.x-dev" - } + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, + "type": "library", "autoload": { - "classmap": [ - "src/" - ] + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], - "authors": [ + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.1" + }, + "funding": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" } ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2017-06-21T08:07:12+00:00" + "time": "2024-11-08T17:47:46+00:00" }, { - "name": "phpunit/phpunit-mock-objects", - "version": "2.3.8", + "name": "nikic/php-parser", + "version": "v5.3.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" + "ext-ctype": "*", + "ext-json": "*", + "ext-tokenizer": "*", + "php": ">=7.4" }, "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "suggest": { - "ext-soap": "*" + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^9.0" }, + "bin": [ + "bin/php-parse" + ], "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3.x-dev" + "dev-master": "5.0-dev" } }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -965,46 +1279,77 @@ ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" + "name": "Nikita Popov" } ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "description": "A PHP parser written in PHP", "keywords": [ - "mock", - "xunit" + "parser", + "php" ], - "abandoned": true, - "time": "2015-10-02T06:51:40+00:00" + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" + }, + "time": "2024-10-08T18:51:32+00:00" }, { - "name": "psr/log", - "version": "1.1.0", + "name": "overtrue/phplint", + "version": "9.5.4", "source": { "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" + "url": "https://github.com/overtrue/phplint.git", + "reference": "7999b43e4a898b8427959585e4960d71bedddb4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", - "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "url": "https://api.github.com/repos/overtrue/phplint/zipball/7999b43e4a898b8427959585e4960d71bedddb4e", + "reference": "7999b43e4a898b8427959585e4960d71bedddb4e", "shasum": "" }, "require": { - "php": ">=5.3.0" + "composer-runtime-api": "^2.0", + "ext-dom": "*", + "ext-json": "*", + "ext-mbstring": "*", + "php": "^8.2", + "symfony/cache": "^7.0", + "symfony/console": "^7.0", + "symfony/event-dispatcher": "^7.0", + "symfony/finder": "^7.0", + "symfony/options-resolver": "^7.0", + "symfony/process": "^7.0", + "symfony/yaml": "^7.0" }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4", + "brainmaestro/composer-git-hooks": "^3.0.0", + "jetbrains/phpstorm-stubs": "^2024.1", + "php-parallel-lint/php-console-highlighter": "^1.0" + }, + "bin": [ + "bin/phplint" + ], "type": "library", "extra": { + "bamarni-bin": { + "bin-links": true, + "target-directory": "vendor-bin", + "forward-command": true + }, + "hooks": { + "pre-commit": [ + "composer style:fix", + "composer code:check" + ] + }, "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-main": "9.5.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Overtrue\\PHPLint\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1013,45 +1358,60 @@ ], "authors": [ { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "name": "overtrue", + "email": "anzhengchao@gmail.com" + }, + { + "name": "Laurent Laville", + "homepage": "https://github.com/llaville" } ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", + "description": "`phplint` is a tool that can speed up linting of php files by running several lint processes at once.", "keywords": [ - "log", - "psr", - "psr-3" + "check", + "lint", + "phplint", + "static analysis", + "syntax" + ], + "support": { + "issues": "https://github.com/overtrue/phplint/issues", + "source": "https://github.com/overtrue/phplint/tree/9.5.4" + }, + "funding": [ + { + "url": "https://github.com/overtrue", + "type": "github" + } ], - "time": "2018-11-20T15:27:04+00:00" + "time": "2024-11-01T04:32:38+00:00" }, { - "name": "sebastian/comparator", - "version": "1.2.4", + "name": "phar-io/manifest", + "version": "2.0.4", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + "url": "https://github.com/phar-io/manifest.git", + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" + "ext-dom": "*", + "ext-libxml": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1065,57 +1425,52 @@ ], "authors": [ { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" }, { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" }, { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "Developer" } ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } ], - "time": "2017-01-29T09:50:25+00:00" + "time": "2024-03-03T12:33:53+00:00" }, { - "name": "sebastian/diff", - "version": "1.4.3", + "name": "phar-io/version", + "version": "3.2.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "php": "^7.2 || ^8.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, "autoload": { "classmap": [ "src/" @@ -1127,45 +1482,68 @@ ], "authors": [ { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" }, { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "Developer" } ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2017-05-22T07:24:03+00:00" + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" }, { - "name": "sebastian/environment", - "version": "1.3.8", + "name": "phpunit/php-code-coverage", + "version": "9.2.32", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5", + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.19.1 || ^5.1.0", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.6", + "phpunit/php-text-template": "^2.0.4", + "sebastian/code-unit-reverse-lookup": "^2.0.3", + "sebastian/complexity": "^2.0.3", + "sebastian/environment": "^5.1.5", + "sebastian/lines-of-code": "^1.0.4", + "sebastian/version": "^3.0.2", + "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^4.8 || ^5.0" + "phpunit/phpunit": "^9.6" + }, + "suggest": { + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-main": "9.2.x-dev" } }, "autoload": { @@ -1180,44 +1558,54 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", "keywords": [ - "Xdebug", - "environment", - "hhvm" + "coverage", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "time": "2016-08-18T05:49:44+00:00" + "time": "2024-08-22T04:23:01+00:00" }, { - "name": "sebastian/exporter", - "version": "1.2.2", + "name": "phpunit/php-file-iterator", + "version": "3.0.6", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" + "php": ">=7.3" }, "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1230,62 +1618,58 @@ "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" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", "keywords": [ - "export", - "exporter" + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "time": "2016-06-17T09:04:28+00:00" + "time": "2021-12-02T12:48:52+00:00" }, { - "name": "sebastian/global-state", - "version": "1.1.1", + "name": "phpunit/php-invoker", + "version": "3.1.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-uopz": "*" + "ext-pcntl": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1300,40 +1684,51 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", "keywords": [ - "global state" + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "time": "2015-10-12T03:26:01+00:00" + "time": "2020-09-28T05:58:55+00:00" }, { - "name": "sebastian/recursion-context", - "version": "1.0.5", + "name": "phpunit/php-text-template", + "version": "2.0.4", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1346,38 +1741,55 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + }, + "funding": [ { - "name": "Adam Harvey", - "email": "aharvey@php.net" + "url": "https://github.com/sebastianbergmann", + "type": "github" } ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-10-03T07:41:43+00:00" + "time": "2020-10-26T05:33:50+00:00" }, { - "name": "sebastian/version", - "version": "1.0.6", + "name": "phpunit/php-timer", + "version": "5.0.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", "shasum": "" }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -1394,68 +1806,85 @@ "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" + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:16:10+00:00" }, { - "name": "squizlabs/php_codesniffer", - "version": "2.9.2", + "name": "phpunit/phpunit", + "version": "9.6.21", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "2acf168de78487db620ab4bc524135a13cfe6745" + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/2acf168de78487db620ab4bc524135a13cfe6745", - "reference": "2acf168de78487db620ab4bc524135a13cfe6745", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa", + "reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa", "shasum": "" }, "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", + "doctrine/instantiator": "^1.5.0 || ^2", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", "ext-xmlwriter": "*", - "php": ">=5.1.2" + "myclabs/deep-copy": "^1.12.0", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", + "php": ">=7.3", + "phpunit/php-code-coverage": "^9.2.32", + "phpunit/php-file-iterator": "^3.0.6", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.4", + "phpunit/php-timer": "^5.0.3", + "sebastian/cli-parser": "^1.0.2", + "sebastian/code-unit": "^1.0.8", + "sebastian/comparator": "^4.0.8", + "sebastian/diff": "^4.0.6", + "sebastian/environment": "^5.1.5", + "sebastian/exporter": "^4.0.6", + "sebastian/global-state": "^5.0.7", + "sebastian/object-enumerator": "^4.0.4", + "sebastian/resource-operations": "^3.0.4", + "sebastian/type": "^3.2.1", + "sebastian/version": "^3.0.2" }, - "require-dev": { - "phpunit/phpunit": "~4.0" + "suggest": { + "ext-soap": "To be able to generate mocks based on WSDL files", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "bin": [ - "scripts/phpcs", - "scripts/phpcbf" + "phpunit" ], "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "9.6-dev" } }, "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], "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/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1464,71 +1893,115 @@ ], "authors": [ { - "name": "Greg Sherwood", + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", "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", + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", "keywords": [ - "phpcs", - "standards" + "phpunit", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.21" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" + } ], - "time": "2018-11-07T22:31:41+00:00" + "time": "2024-09-19T10:50:18+00:00" }, { - "name": "symfony/console", - "version": "v3.4.26", + "name": "psr/cache", + "version": "3.0.0", "source": { "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "15a9104356436cb26e08adab97706654799d31d8" + "url": "https://github.com/php-fig/cache.git", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/15a9104356436cb26e08adab97706654799d31d8", - "reference": "15a9104356436cb26e08adab97706654799d31d8", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0|~4.0", - "symfony/polyfill-mbstring": "~1.0" + "php": ">=8.0.0" }, - "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/process": "<3.3" + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } }, - "provide": { - "psr/log-implementation": "1.0" + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } }, - "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" + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/3.0.0" }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" + "time": "2021-02-03T23:26:27+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + "Psr\\Container\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1536,117 +2009,2588 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2019-04-08T09:29:13+00:00" + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" }, { - "name": "symfony/debug", - "version": "v3.4.26", + "name": "psr/event-dispatcher", + "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "681afbb26488903c5ac15e63734f1d8ac430c9b9" + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/681afbb26488903c5ac15e63734f1d8ac430c9b9", - "reference": "681afbb26488903c5ac15e63734f1d8ac430c9b9", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "psr/log": "~1.0" + "php": ">=7.2.0" }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } }, - "require-dev": { - "symfony/http-kernel": "~2.8|~3.0|~4.0" + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/log", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "3.x-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + "Psr\\Log\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "authors": [ + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.2" + }, + "time": "2024-09-11T13:17:53+00:00" + }, + { + "name": "react/cache", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/cache.git", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/cache/zipball/d47c472b64aa5608225f47965a484b75c7817d5b", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/promise": "^3.0 || ^2.0 || ^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, Promise-based cache interface for ReactPHP", + "keywords": [ + "cache", + "caching", + "promise", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/cache/issues", + "source": "https://github.com/reactphp/cache/tree/v1.2.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2022-11-30T15:59:55+00:00" + }, + { + "name": "react/child-process", + "version": "v0.6.5", + "source": { + "type": "git", + "url": "https://github.com/reactphp/child-process.git", + "reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/child-process/zipball/e71eb1aa55f057c7a4a0d08d06b0b0a484bead43", + "reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/event-loop": "^1.2", + "react/stream": "^1.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35", + "react/socket": "^1.8", + "sebastian/environment": "^5.0 || ^3.0 || ^2.0 || ^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\ChildProcess\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven library for executing child processes with ReactPHP.", + "keywords": [ + "event-driven", + "process", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/child-process/issues", + "source": "https://github.com/reactphp/child-process/tree/v0.6.5" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-09-16T13:41:56+00:00" + }, + { + "name": "react/dns", + "version": "v1.13.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/dns.git", + "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/dns/zipball/eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", + "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/cache": "^1.0 || ^0.6 || ^0.5", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.7 || ^1.2.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3 || ^2", + "react/promise-timer": "^1.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Dns\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async DNS resolver for ReactPHP", + "keywords": [ + "async", + "dns", + "dns-resolver", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/dns/issues", + "source": "https://github.com/reactphp/dns/tree/v1.13.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-06-13T14:18:03+00:00" + }, + { + "name": "react/event-loop", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/event-loop.git", + "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/event-loop/zipball/bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", + "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "suggest": { + "ext-pcntl": "For signal handling support when using the StreamSelectLoop" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\EventLoop\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.", + "keywords": [ + "asynchronous", + "event-loop" + ], + "support": { + "issues": "https://github.com/reactphp/event-loop/issues", + "source": "https://github.com/reactphp/event-loop/tree/v1.5.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2023-11-13T13:48:05+00:00" + }, + { + "name": "react/promise", + "version": "v3.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "8a164643313c71354582dc850b42b33fa12a4b63" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/8a164643313c71354582dc850b42b33fa12a4b63", + "reference": "8a164643313c71354582dc850b42b33fa12a4b63", + "shasum": "" + }, + "require": { + "php": ">=7.1.0" + }, + "require-dev": { + "phpstan/phpstan": "1.10.39 || 1.4.10", + "phpunit/phpunit": "^9.6 || ^7.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "support": { + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v3.2.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-05-24T10:39:05+00:00" + }, + { + "name": "react/socket", + "version": "v1.16.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/socket.git", + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/socket/zipball/23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/dns": "^1.13", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.6 || ^1.2.1", + "react/stream": "^1.4" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3.3 || ^2", + "react/promise-stream": "^1.4", + "react/promise-timer": "^1.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Socket\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP", + "keywords": [ + "Connection", + "Socket", + "async", + "reactphp", + "stream" + ], + "support": { + "issues": "https://github.com/reactphp/socket/issues", + "source": "https://github.com/reactphp/socket/tree/v1.16.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-07-26T10:38:09+00:00" + }, + { + "name": "react/stream", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/stream.git", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/stream/zipball/1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.8", + "react/event-loop": "^1.2" + }, + "require-dev": { + "clue/stream-filter": "~1.2", + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Stream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP", + "keywords": [ + "event-driven", + "io", + "non-blocking", + "pipe", + "reactphp", + "readable", + "stream", + "writable" + ], + "support": { + "issues": "https://github.com/reactphp/stream/issues", + "source": "https://github.com/reactphp/stream/tree/v1.4.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-06-11T12:45:25+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:27:43+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:08:54+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:30:19+00:00" + }, + { + "name": "sebastian/comparator", + "version": "4.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T12:41:17+00:00" + }, + { + "name": "sebastian/complexity", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-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": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-12-22T06:19:30+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:30:58+00:00" + }, + { + "name": "sebastian/environment", + "version": "5.1.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.1-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" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:03:51+00:00" + }, + { + "name": "sebastian/exporter", + "version": "4.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "https://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:33:00+00:00" + }, + { + "name": "sebastian/global-state", + "version": "5.0.7", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.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" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:35:11+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "1.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-12-22T06:20:34+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:12:34+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:14:26+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "4.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "https://github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:07:39+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "3.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "support": { + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-14T16:00:52+00:00" + }, + { + "name": "sebastian/type", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-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": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:13:03+00:00" + }, + { + "name": "sebastian/version", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c6c1022351a901512170118436c764e473f6de8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-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": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:39:44+00:00" + }, + { + "name": "symfony/cache", + "version": "v7.1.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/cache.git", + "reference": "23b61c9592ee72233c31625f0ae805dd1571e928" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/cache/zipball/23b61c9592ee72233c31625f0ae805dd1571e928", + "reference": "23b61c9592ee72233c31625f0ae805dd1571e928", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "psr/cache": "^2.0|^3.0", + "psr/log": "^1.1|^2|^3", + "symfony/cache-contracts": "^2.5|^3", + "symfony/deprecation-contracts": "^2.5|^3.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/var-exporter": "^6.4|^7.0" + }, + "conflict": { + "doctrine/dbal": "<3.6", + "symfony/dependency-injection": "<6.4", + "symfony/http-kernel": "<6.4", + "symfony/var-dumper": "<6.4" + }, + "provide": { + "psr/cache-implementation": "2.0|3.0", + "psr/simple-cache-implementation": "1.0|2.0|3.0", + "symfony/cache-implementation": "1.1|2.0|3.0" + }, + "require-dev": { + "cache/integration-tests": "dev-master", + "doctrine/dbal": "^3.6|^4", + "predis/predis": "^1.1|^2.0", + "psr/simple-cache": "^1.0|^2.0|^3.0", + "symfony/config": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/filesystem": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/messenger": "^6.4|^7.0", + "symfony/var-dumper": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Cache\\": "" + }, + "classmap": [ + "Traits/ValueWrapper.php" + ], + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "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": "Provides extended PSR-6, PSR-16 (and tags) implementations", + "homepage": "https://symfony.com", + "keywords": [ + "caching", + "psr6" + ], + "support": { + "source": "https://github.com/symfony/cache/tree/v7.1.7" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-11-05T15:34:55+00:00" + }, + { + "name": "symfony/cache-contracts", + "version": "v3.5.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/cache-contracts.git", + "reference": "df6a1a44c890faded49a5fca33c2d5c5fd3c2197" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/df6a1a44c890faded49a5fca33c2d5c5fd3c2197", + "reference": "df6a1a44c890faded49a5fca33c2d5c5fd3c2197", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/cache": "^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Cache\\": "" + } + }, + "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": "Generic abstractions related to caching", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/cache-contracts/tree/v3.5.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-04-18T09:32:20+00:00" + }, + { + "name": "symfony/console", + "version": "v7.1.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "ff04e5b5ba043d2badfb308197b9e6b42883fcd5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/ff04e5b5ba043d2badfb308197b9e6b42883fcd5", + "reference": "ff04e5b5ba043d2badfb308197b9e6b42883fcd5", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/polyfill-mbstring": "~1.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/string": "^6.4|^7.0" + }, + "conflict": { + "symfony/dependency-injection": "<6.4", + "symfony/dotenv": "<6.4", + "symfony/event-dispatcher": "<6.4", + "symfony/lock": "<6.4", + "symfony/process": "<6.4" + }, + "provide": { + "psr/log-implementation": "1.0|2.0|3.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/event-dispatcher": "^6.4|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/lock": "^6.4|^7.0", + "symfony/messenger": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/stopwatch": "^6.4|^7.0", + "symfony/var-dumper": "^6.4|^7.0" + }, + "type": "library", + "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": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v7.1.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-11-06T14:23:19+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v7.1.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "87254c78dd50721cfd015b62277a8281c5589702" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/87254c78dd50721cfd015b62277a8281c5589702", + "reference": "87254c78dd50721cfd015b62277a8281c5589702", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/event-dispatcher-contracts": "^2.5|^3" + }, + "conflict": { + "symfony/dependency-injection": "<6.4", + "symfony/service-contracts": "<2.5" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "2.0|3.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/error-handler": "^6.4|^7.0", + "symfony/expression-language": "^6.4|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/stopwatch": "^6.4|^7.0" + }, + "type": "library", + "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": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/event-dispatcher/tree/v7.1.6" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:20:29+00:00" + }, + { + "name": "symfony/event-dispatcher-contracts", + "version": "v3.5.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "8f93aec25d41b72493c6ddff14e916177c9efc50" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/8f93aec25d41b72493c6ddff14e916177c9efc50", + "reference": "8f93aec25d41b72493c6ddff14e916177c9efc50", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/event-dispatcher": "^1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\EventDispatcher\\": "" + } + }, + "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": "Generic abstractions related to dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.5.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-04-18T09:32:20+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v7.1.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "c835867b3c62bb05c7fe3d637c871c7ae52024d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/c835867b3c62bb05c7fe3d637c871c7ae52024d4", + "reference": "c835867b3c62bb05c7fe3d637c871c7ae52024d4", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8" + }, + "require-dev": { + "symfony/process": "^6.4|^7.0" + }, + "type": "library", + "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": "Provides basic utilities for the filesystem", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/filesystem/tree/v7.1.6" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-10-25T15:11:02+00:00" + }, + { + "name": "symfony/finder", + "version": "v7.1.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "2cb89664897be33f78c65d3d2845954c8d7a43b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/2cb89664897be33f78c65d3d2845954c8d7a43b8", + "reference": "2cb89664897be33f78c65d3d2845954c8d7a43b8", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "symfony/filesystem": "^6.4|^7.0" + }, + "type": "library", + "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": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/v7.1.6" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-10-01T08:31:23+00:00" + }, + { + "name": "symfony/options-resolver", + "version": "v7.1.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "85e95eeede2d41cd146146e98c9c81d9214cae85" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/85e95eeede2d41cd146146e98c9c81d9214cae85", + "reference": "85e95eeede2d41cd146146e98c9c81d9214cae85", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "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": "Provides an improved replacement for the array_replace PHP function", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "support": { + "source": "https://github.com/symfony/options-resolver/tree/v7.1.6" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:20:29+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } + }, + "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 intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "3833d7255cc303546435cb650316bff708a1c75c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", + "reference": "3833d7255cc303546435cb650316bff708a1c75c", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "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 intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "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" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" + }, + "funding": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "url": "https://symfony.com/sponsor", + "type": "custom" }, { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "description": "Symfony Debug Component", - "homepage": "https://symfony.com", - "time": "2019-04-11T09:48:14+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { - "name": "symfony/event-dispatcher", - "version": "v3.4.26", + "name": "symfony/polyfill-php80", + "version": "v1.31.0", "source": { "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "a088aafcefb4eef2520a290ed82e4374092a6dff" + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a088aafcefb4eef2520a290ed82e4374092a6dff", - "reference": "a088aafcefb4eef2520a290ed82e4374092a6dff", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", "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": "" + "php": ">=7.2" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "3.4-dev" + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { + "files": [ + "bootstrap.php" + ], "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" + "Symfony\\Polyfill\\Php80\\": "" }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1655,48 +4599,78 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony EventDispatcher Component", + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", "homepage": "https://symfony.com", - "time": "2019-04-02T08:51:52+00:00" + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" }, { - "name": "symfony/filesystem", - "version": "v3.4.26", + "name": "symfony/polyfill-php81", + "version": "v1.31.0", "source": { "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "acf99758b1df8e9295e6b85aa69f294565c9fedb" + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/acf99758b1df8e9295e6b85aa69f294565c9fedb", - "reference": "acf99758b1df8e9295e6b85aa69f294565c9fedb", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-ctype": "~1.8" + "php": ">=7.2" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "3.4-dev" + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { + "files": [ + "bootstrap.php" + ], "psr-4": { - "Symfony\\Component\\Filesystem\\": "" + "Symfony\\Polyfill\\Php81\\": "" }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1705,44 +4679,62 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Filesystem Component", + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", "homepage": "https://symfony.com", - "time": "2019-02-04T21:34:32+00:00" + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" }, { - "name": "symfony/finder", - "version": "v3.4.26", + "name": "symfony/process", + "version": "v7.1.8", "source": { "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "61af5ce0b34b942d414fe8f1b11950d0e9a90e98" + "url": "https://github.com/symfony/process.git", + "reference": "42783370fda6e538771f7c7a36e9fa2ee3a84892" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/61af5ce0b34b942d414fe8f1b11950d0e9a90e98", - "reference": "61af5ce0b34b942d414fe8f1b11950d0e9a90e98", + "url": "https://api.github.com/repos/symfony/process/zipball/42783370fda6e538771f7c7a36e9fa2ee3a84892", + "reference": "42783370fda6e538771f7c7a36e9fa2ee3a84892", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": ">=8.2" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, "autoload": { "psr-4": { - "Symfony\\Component\\Finder\\": "" + "Symfony\\Component\\Process\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -1762,42 +4754,65 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Finder Component", + "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", - "time": "2019-04-02T19:54:57+00:00" + "support": { + "source": "https://github.com/symfony/process/tree/v7.1.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-11-06T14:23:19+00:00" }, { - "name": "symfony/polyfill-ctype", - "version": "v1.11.0", + "name": "symfony/service-contracts", + "version": "v3.5.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "82ebae02209c21113908c229e9883c419720738a" + "url": "https://github.com/symfony/service-contracts.git", + "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a", - "reference": "82ebae02209c21113908c229e9883c419720738a", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", + "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=8.1", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3" }, - "suggest": { - "ext-ctype": "For best performance" + "conflict": { + "ext-psr": "<1.1|>=2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11-dev" + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" + "Symfony\\Contracts\\Service\\": "" }, - "files": [ - "bootstrap.php" + "exclude-from-classmap": [ + "/Test/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1806,56 +4821,68 @@ ], "authors": [ { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { - "name": "Gert de Pagter", - "email": "backendtea@gmail.com" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for ctype functions", + "description": "Generic abstractions related to writing services", "homepage": "https://symfony.com", "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v3.5.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } ], - "time": "2019-02-06T07:57:58+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { - "name": "symfony/polyfill-mbstring", - "version": "v1.11.0", + "name": "symfony/stopwatch", + "version": "v7.1.6", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "fe5e94c604826c35a32fa832f35bd036b6799609" + "url": "https://github.com/symfony/stopwatch.git", + "reference": "8b4a434e6e7faf6adedffb48783a5c75409a1a05" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fe5e94c604826c35a32fa832f35bd036b6799609", - "reference": "fe5e94c604826c35a32fa832f35bd036b6799609", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/8b4a434e6e7faf6adedffb48783a5c75409a1a05", + "reference": "8b4a434e6e7faf6adedffb48783a5c75409a1a05", "shasum": "" }, "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" + "php": ">=8.2", + "symfony/service-contracts": "^2.5|^3" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.11-dev" - } - }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" + "Symfony\\Component\\Stopwatch\\": "" }, - "files": [ - "bootstrap.php" + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1864,51 +4891,74 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for the Mbstring extension", + "description": "Provides a way to profile code", "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" + "support": { + "source": "https://github.com/symfony/stopwatch/tree/v7.1.6" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } ], - "time": "2019-02-06T07:57:58+00:00" + "time": "2024-09-25T14:20:29+00:00" }, { - "name": "symfony/process", - "version": "v3.4.26", + "name": "symfony/string", + "version": "v7.1.8", "source": { "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "a9c4dfbf653023b668c282e4e02609d131f4057a" + "url": "https://github.com/symfony/string.git", + "reference": "591ebd41565f356fcd8b090fe64dbb5878f50281" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/a9c4dfbf653023b668c282e4e02609d131f4057a", - "reference": "a9c4dfbf653023b668c282e4e02609d131f4057a", + "url": "https://api.github.com/repos/symfony/string/zipball/591ebd41565f356fcd8b090fe64dbb5878f50281", + "reference": "591ebd41565f356fcd8b090fe64dbb5878f50281", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": ">=8.2", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } + "conflict": { + "symfony/translation-contracts": "<2.5" + }, + "require-dev": { + "symfony/emoji": "^7.1", + "symfony/error-handler": "^6.4|^7.0", + "symfony/http-client": "^6.4|^7.0", + "symfony/intl": "^6.4|^7.0", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^6.4|^7.0" }, + "type": "library", "autoload": { + "files": [ + "Resources/functions.php" + ], "psr-4": { - "Symfony\\Component\\Process\\": "" + "Symfony\\Component\\String\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -1920,44 +4970,69 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Process Component", + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", "homepage": "https://symfony.com", - "time": "2019-04-08T16:15:54+00:00" + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v7.1.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-11-13T13:31:21+00:00" }, { - "name": "symfony/stopwatch", - "version": "v3.4.26", + "name": "symfony/var-exporter", + "version": "v7.1.6", "source": { "type": "git", - "url": "https://github.com/symfony/stopwatch.git", - "reference": "2a651c2645c10bbedd21170771f122d935e0dd58" + "url": "https://github.com/symfony/var-exporter.git", + "reference": "90173ef89c40e7c8c616653241048705f84130ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/2a651c2645c10bbedd21170771f122d935e0dd58", - "reference": "2a651c2645c10bbedd21170771f122d935e0dd58", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/90173ef89c40e7c8c616653241048705f84130ef", + "reference": "90173ef89c40e7c8c616653241048705f84130ef", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": ">=8.2" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } + "require-dev": { + "symfony/property-access": "^6.4|^7.0", + "symfony/serializer": "^6.4|^7.0", + "symfony/var-dumper": "^6.4|^7.0" }, + "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\Stopwatch\\": "" + "Symfony\\Component\\VarExporter\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -1969,51 +5044,73 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Stopwatch Component", + "description": "Allows exporting any serializable PHP data structure to plain PHP code", "homepage": "https://symfony.com", - "time": "2019-01-16T09:39:14+00:00" + "keywords": [ + "clone", + "construct", + "export", + "hydrate", + "instantiate", + "lazy-loading", + "proxy", + "serialize" + ], + "support": { + "source": "https://github.com/symfony/var-exporter/tree/v7.1.6" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:20:29+00:00" }, { "name": "symfony/yaml", - "version": "v3.4.26", + "version": "v7.1.6", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "212a27b731e5bfb735679d1ffaac82bd6a1dc996" + "reference": "3ced3f29e4f0d6bce2170ff26719f1fe9aacc671" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/212a27b731e5bfb735679d1ffaac82bd6a1dc996", - "reference": "212a27b731e5bfb735679d1ffaac82bd6a1dc996", + "url": "https://api.github.com/repos/symfony/yaml/zipball/3ced3f29e4f0d6bce2170ff26719f1fe9aacc671", + "reference": "3ced3f29e4f0d6bce2170ff26719f1fe9aacc671", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-ctype": "~1.8" + "php": ">=8.2", + "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/console": "<3.4" + "symfony/console": "<6.4" }, "require-dev": { - "symfony/console": "~3.4|~4.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" + "symfony/console": "^6.4|^7.0" }, + "bin": [ + "Resources/bin/yaml-lint" + ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Yaml\\": "" @@ -2036,60 +5133,76 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Yaml Component", + "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", - "time": "2019-03-25T07:48:46+00:00" + "support": { + "source": "https://github.com/symfony/yaml/tree/v7.1.6" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:20:29+00:00" }, { - "name": "webmozart/assert", - "version": "1.4.0", + "name": "theseer/tokenizer", + "version": "1.2.3", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9" + "url": "https://github.com/theseer/tokenizer.git", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9", - "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0", - "symfony/polyfill-ctype": "^1.8" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" } ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } ], - "time": "2018-12-25T11:19:39+00:00" + "time": "2024-03-03T12:36:25+00:00" } ], "aliases": [], @@ -2098,10 +5211,11 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.6", + "php": "^8.1", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*" }, - "platform-dev": [] -} \ No newline at end of file + "platform-dev": [], + "plugin-api-version": "2.6.0" +} diff --git a/docs/Api/AccountApi.md b/docs/Api/AccountApi.md index fb8a867..109182f 100644 --- a/docs/Api/AccountApi.md +++ b/docs/Api/AccountApi.md @@ -1,32 +1,39 @@ # Brevo\Client\AccountApi -All URIs are relative to *https://api.brevo.com/v3* +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**getAccount**](AccountApi.md#getAccount) | **GET** /account | Get your account information, plan and credits details -[**getAccountActivity**](AccountApi.md#getAccountActivity) | **GET** /organization/activities | Get user activity logs +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**getAccount()**](AccountApi.md#getAccount) | **GET** /account | Get your account information, plan and credits details | +| [**getAccountActivity()**](AccountApi.md#getAccountActivity) | **GET** /organization/activities | Get user activity logs | -# **getAccount** -> \Brevo\Client\Model\GetAccount getAccount() +## `getAccount()` + +```php +getAccount(): \Brevo\Client\Models\GetAccount +``` Get your account information, plan and credits details ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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. @@ -40,15 +47,15 @@ try { } catch (Exception $e) { echo 'Exception when calling AccountApi->getAccount: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters + This endpoint does not need any parameter. ### Return type -[**\Brevo\Client\Model\GetAccount**](../Model/GetAccount.md) +[**\Brevo\Client\Models\GetAccount**](../Model/GetAccount.md) ### Authorization @@ -56,38 +63,47 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getAccountActivity** -> \Brevo\Client\Model\GetAccountActivity getAccountActivity($startDate, $endDate, $limit, $offset) +## `getAccountActivity()` + +```php +getAccountActivity($startDate, $endDate, $limit, $offset): \Brevo\Client\Models\GetAccountActivity +``` Get user activity logs ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 ); -$startDate = "startDate_example"; // string | Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. -$endDate = "endDate_example"; // string | Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. +$startDate = 'startDate_example'; // string | Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. +$endDate = 'endDate_example'; // string | Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. $limit = 10; // int | Number of documents per page $offset = 0; // int | Index of the first document in the page. @@ -97,21 +113,20 @@ try { } catch (Exception $e) { echo 'Exception when calling AccountApi->getAccountActivity: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **startDate** | **string**| Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. | [optional] - **endDate** | **string**| Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. | [optional] - **limit** | **int**| Number of documents per page | [optional] [default to 10] - **offset** | **int**| Index of the first document in the page. | [optional] [default to 0] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **startDate** | **string**| Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. | [optional] | +| **endDate** | **string**| Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. | [optional] | +| **limit** | **int**| Number of documents per page | [optional] [default to 10] | +| **offset** | **int**| Index of the first document in the page. | [optional] [default to 0] | ### Return type -[**\Brevo\Client\Model\GetAccountActivity**](../Model/GetAccountActivity.md) +[**\Brevo\Client\Models\GetAccountActivity**](../Model/GetAccountActivity.md) ### Authorization @@ -119,8 +134,9 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: Not defined +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/AttributesApi.md b/docs/Api/AttributesApi.md deleted file mode 100644 index 03be401..0000000 --- a/docs/Api/AttributesApi.md +++ /dev/null @@ -1,243 +0,0 @@ -# Brevo\Client\AttributesApi - -All URIs are relative to *https://api.brevo.com/v3* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createAttribute**](AttributesApi.md#createAttribute) | **POST** /contacts/attributes/{attributeCategory}/{attributeName} | Create contact attribute -[**deleteAttribute**](AttributesApi.md#deleteAttribute) | **DELETE** /contacts/attributes/{attributeCategory}/{attributeName} | Delete an attribute -[**getAttributes**](AttributesApi.md#getAttributes) | **GET** /contacts/attributes | List all attributes -[**updateAttribute**](AttributesApi.md#updateAttribute) | **PUT** /contacts/attributes/{attributeCategory}/{attributeName} | Update contact attribute - - -# **createAttribute** -> createAttribute($attributeCategory, $attributeName, $createAttribute) - -Create contact attribute - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 \Brevo\Client\Model\CreateAttribute(); // \Brevo\Client\Model\CreateAttribute | Values to create an attribute - -try { - $apiInstance->createAttribute($attributeCategory, $attributeName, $createAttribute); -} catch (Exception $e) { - echo 'Exception when calling AttributesApi->createAttribute: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **attributeCategory** | **string**| Category of the attribute | - **attributeName** | **string**| Name of the attribute | - **createAttribute** | [**\Brevo\Client\Model\CreateAttribute**](../Model/CreateAttribute.md)| Values to create an attribute | - -### Return type - -void (empty response body) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **deleteAttribute** -> deleteAttribute($attributeCategory, $attributeName) - -Delete an attribute - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 { - $apiInstance->deleteAttribute($attributeCategory, $attributeName); -} catch (Exception $e) { - echo 'Exception when calling AttributesApi->deleteAttribute: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **attributeCategory** | **string**| Category of the attribute | - **attributeName** | **string**| Name of the existing attribute | - -### Return type - -void (empty response body) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **getAttributes** -> \Brevo\Client\Model\GetAttributes getAttributes() - -List all attributes - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 = $apiInstance->getAttributes(); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling AttributesApi->getAttributes: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -[**\Brevo\Client\Model\GetAttributes**](../Model/GetAttributes.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **updateAttribute** -> updateAttribute($attributeCategory, $attributeName, $updateAttribute) - -Update contact attribute - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 \Brevo\Client\Model\UpdateAttribute(); // \Brevo\Client\Model\UpdateAttribute | Values to update an attribute - -try { - $apiInstance->updateAttribute($attributeCategory, $attributeName, $updateAttribute); -} catch (Exception $e) { - echo 'Exception when calling AttributesApi->updateAttribute: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **attributeCategory** | **string**| Category of the attribute | - **attributeName** | **string**| Name of the existing attribute | - **updateAttribute** | [**\Brevo\Client\Model\UpdateAttribute**](../Model/UpdateAttribute.md)| Values to update an attribute | - -### Return type - -void (empty response body) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - diff --git a/docs/Api/BalanceApi.md b/docs/Api/BalanceApi.md new file mode 100644 index 0000000..e058d21 --- /dev/null +++ b/docs/Api/BalanceApi.md @@ -0,0 +1,1089 @@ +# Brevo\Client\BalanceApi + +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**beginTransaction()**](BalanceApi.md#beginTransaction) | **POST** /loyalty/balance/programs/{loyaltyProgramId}/transactions | Create new transaction | +| [**cancelTransaction()**](BalanceApi.md#cancelTransaction) | **POST** /loyalty/balance/programs/{loyaltyProgramId}/transactions/{transactionId}/cancel | Cancel transaction | +| [**completeTransaction()**](BalanceApi.md#completeTransaction) | **POST** /loyalty/balance/programs/{loyaltyProgramId}/transactions/{transactionId}/complete | Complete transaction | +| [**createBalanceOrder()**](BalanceApi.md#createBalanceOrder) | **POST** /loyalty/balance/programs/{loyaltyProgramId}/create-order | Create balance order | +| [**getBalanceDefinitionList()**](BalanceApi.md#getBalanceDefinitionList) | **GET** /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions | Get balance definition list | +| [**getContactBalances()**](BalanceApi.md#getContactBalances) | **GET** /loyalty/balance/programs/{loyaltyProgramId}/contact-balances | Get balance list | +| [**getSubscriptionBalances()**](BalanceApi.md#getSubscriptionBalances) | **GET** /loyalty/balance/programs/{loyaltyProgramId}/subscriptions/{contactId}/balances | Get subscription balances | +| [**loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete()**](BalanceApi.md#loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete) | **DELETE** /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId} | Delete balance definition | +| [**loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet()**](BalanceApi.md#loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet) | **GET** /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId} | Get balance definition | +| [**loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete()**](BalanceApi.md#loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete) | **DELETE** /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId}/limits/{balanceLimitId} | Delete balance limit | +| [**loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet()**](BalanceApi.md#loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet) | **GET** /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId}/limits/{balanceLimitId} | Get balance limits | +| [**loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut()**](BalanceApi.md#loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut) | **PUT** /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId}/limits/{balanceLimitId} | Updates balance limit | +| [**loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost()**](BalanceApi.md#loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost) | **POST** /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId}/limits | Create balance limits | +| [**loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut()**](BalanceApi.md#loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut) | **PUT** /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId} | Update balance definition | +| [**loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost()**](BalanceApi.md#loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost) | **POST** /loyalty/balance/programs/{loyaltyProgramId}/balance-definitions | Create balance definition | + + +## `beginTransaction()` + +```php +beginTransaction($loyaltyProgramId, $createTransactionPayload): \Brevo\Client\Models\Transaction +``` + +Create new transaction + +Creates new transaction and returns information + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\BalanceApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$createTransactionPayload = new \Brevo\Client\Models\CreateTransactionPayload(); // \Brevo\Client\Models\CreateTransactionPayload | Transaction information + +try { + $result = $apiInstance->beginTransaction($loyaltyProgramId, $createTransactionPayload); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BalanceApi->beginTransaction: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **createTransactionPayload** | [**\Brevo\Client\Models\CreateTransactionPayload**](../Model/CreateTransactionPayload.md)| Transaction information | [optional] | + +### Return type + +[**\Brevo\Client\Models\Transaction**](../Model/Transaction.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `cancelTransaction()` + +```php +cancelTransaction($loyaltyProgramId, $transactionId): \Brevo\Client\Models\CancelledTransaction +``` + +Cancel transaction + +Cancels transaction + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\BalanceApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty program Id +$transactionId = 'transactionId_example'; // string | Transaction Id + +try { + $result = $apiInstance->cancelTransaction($loyaltyProgramId, $transactionId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BalanceApi->cancelTransaction: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty program Id | | +| **transactionId** | **string**| Transaction Id | | + +### Return type + +[**\Brevo\Client\Models\CancelledTransaction**](../Model/CancelledTransaction.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `completeTransaction()` + +```php +completeTransaction($loyaltyProgramId, $transactionId, $completeTransactionPayload): \Brevo\Client\Models\CompletedTransaction +``` + +Complete transaction + +Completes transaction + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\BalanceApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$transactionId = 'transactionId_example'; // string | Transaction Id +$completeTransactionPayload = new \Brevo\Client\Models\CompleteTransactionPayload(); // \Brevo\Client\Models\CompleteTransactionPayload | Transaction information + +try { + $result = $apiInstance->completeTransaction($loyaltyProgramId, $transactionId, $completeTransactionPayload); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BalanceApi->completeTransaction: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **transactionId** | **string**| Transaction Id | | +| **completeTransactionPayload** | [**\Brevo\Client\Models\CompleteTransactionPayload**](../Model/CompleteTransactionPayload.md)| Transaction information | [optional] | + +### Return type + +[**\Brevo\Client\Models\CompletedTransaction**](../Model/CompletedTransaction.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createBalanceOrder()` + +```php +createBalanceOrder($loyaltyProgramId, $createOrderPayload): \Brevo\Client\Models\CreateOrderPayload +``` + +Create balance order + +Returns created order + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\BalanceApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$createOrderPayload = new \Brevo\Client\Models\CreateOrderPayload(); // \Brevo\Client\Models\CreateOrderPayload | Create order information + +try { + $result = $apiInstance->createBalanceOrder($loyaltyProgramId, $createOrderPayload); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BalanceApi->createBalanceOrder: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **createOrderPayload** | [**\Brevo\Client\Models\CreateOrderPayload**](../Model/CreateOrderPayload.md)| Create order information | [optional] | + +### Return type + +[**\Brevo\Client\Models\CreateOrderPayload**](../Model/CreateOrderPayload.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getBalanceDefinitionList()` + +```php +getBalanceDefinitionList($loyaltyProgramId, $limit, $offset, $sortField, $sort, $version): \Brevo\Client\Models\BalanceDefinitionPage +``` + +Get balance definition list + +Returns balance definition page + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\BalanceApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$limit = 50; // int | Number of documents per page +$offset = 0; // int | Index of the first document in the page +$sortField = 'name'; // string | Sort documents by field +$sort = 'desc'; // string | Sort the documents in the ascending or descending order +$version = 'draft'; // string | Select 'active' to retrieve list of all balances which are live for clients. Select draft to retrieve list of all non deleted balances. + +try { + $result = $apiInstance->getBalanceDefinitionList($loyaltyProgramId, $limit, $offset, $sortField, $sort, $version); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BalanceApi->getBalanceDefinitionList: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **limit** | **int**| Number of documents per page | [optional] [default to 50] | +| **offset** | **int**| Index of the first document in the page | [optional] [default to 0] | +| **sortField** | **string**| Sort documents by field | [optional] [default to 'name'] | +| **sort** | **string**| Sort the documents in the ascending or descending order | [optional] [default to 'desc'] | +| **version** | **string**| Select 'active' to retrieve list of all balances which are live for clients. Select draft to retrieve list of all non deleted balances. | [optional] [default to 'draft'] | + +### Return type + +[**\Brevo\Client\Models\BalanceDefinitionPage**](../Model/BalanceDefinitionPage.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getContactBalances()` + +```php +getContactBalances($loyaltyProgramId, $balanceDefinitionId, $limit, $offset, $sort, $sortField): \Brevo\Client\Models\ContactBalances +``` + +Get balance list + +Returns balance list + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\BalanceApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty program id +$balanceDefinitionId = 'balanceDefinitionId_example'; // string | Balance Definition Id +$limit = 100; // int | Number of documents per page +$offset = 0; // int | Index of the first document in the page +$sort = 'desc'; // string | Sort the documents in the ascending or descending order +$sortField = 'updatedAt'; // string | Sort documents by field + +try { + $result = $apiInstance->getContactBalances($loyaltyProgramId, $balanceDefinitionId, $limit, $offset, $sort, $sortField); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BalanceApi->getContactBalances: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty program id | | +| **balanceDefinitionId** | **string**| Balance Definition Id | | +| **limit** | **int**| Number of documents per page | [optional] [default to 100] | +| **offset** | **int**| Index of the first document in the page | [optional] [default to 0] | +| **sort** | **string**| Sort the documents in the ascending or descending order | [optional] [default to 'desc'] | +| **sortField** | **string**| Sort documents by field | [optional] [default to 'updatedAt'] | + +### Return type + +[**\Brevo\Client\Models\ContactBalances**](../Model/ContactBalances.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getSubscriptionBalances()` + +```php +getSubscriptionBalances($loyaltyProgramId, $contactId): \Brevo\Client\Models\BalancePage +``` + +Get subscription balances + +Returns subscription balances + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\BalanceApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$contactId = 'contactId_example'; // string | Contact id + +try { + $result = $apiInstance->getSubscriptionBalances($loyaltyProgramId, $contactId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BalanceApi->getSubscriptionBalances: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **contactId** | **string**| Contact id | | + +### Return type + +[**\Brevo\Client\Models\BalancePage**](../Model/BalancePage.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete()` + +```php +loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete($loyaltyProgramId, $balanceDefinitionId) +``` + +Delete balance definition + +Delete Balance definition + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\BalanceApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$balanceDefinitionId = 'balanceDefinitionId_example'; // string | Balance Definition Id + +try { + $apiInstance->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete($loyaltyProgramId, $balanceDefinitionId); +} catch (Exception $e) { + echo 'Exception when calling BalanceApi->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **balanceDefinitionId** | **string**| Balance Definition Id | | + +### Return type + +void (empty response body) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet()` + +```php +loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet($loyaltyProgramId, $balanceDefinitionId, $version): \Brevo\Client\Models\BalanceDefinition +``` + +Get balance definition + +Returns balance definition + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\BalanceApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$balanceDefinitionId = 'balanceDefinitionId_example'; // string | Balance Definition Id +$version = 'draft'; // string | Select active to get balance definition configuration which is live for the clients. Select draft to retrieve balance definition configuration with the recent edits + +try { + $result = $apiInstance->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet($loyaltyProgramId, $balanceDefinitionId, $version); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BalanceApi->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **balanceDefinitionId** | **string**| Balance Definition Id | | +| **version** | **string**| Select active to get balance definition configuration which is live for the clients. Select draft to retrieve balance definition configuration with the recent edits | [optional] [default to 'draft'] | + +### Return type + +[**\Brevo\Client\Models\BalanceDefinition**](../Model/BalanceDefinition.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete()` + +```php +loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete($loyaltyProgramId, $balanceDefinitionId, $balanceLimitId) +``` + +Delete balance limit + +Delete balance limit + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\BalanceApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$balanceDefinitionId = 'balanceDefinitionId_example'; // string | Balance Definition Id +$balanceLimitId = 'balanceLimitId_example'; // string | Id of the limit to be deleted + +try { + $apiInstance->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete($loyaltyProgramId, $balanceDefinitionId, $balanceLimitId); +} catch (Exception $e) { + echo 'Exception when calling BalanceApi->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **balanceDefinitionId** | **string**| Balance Definition Id | | +| **balanceLimitId** | **string**| Id of the limit to be deleted | | + +### Return type + +void (empty response body) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet()` + +```php +loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet($loyaltyProgramId, $balanceDefinitionId, $balanceLimitId, $version): \Brevo\Client\Models\BalanceLimitPayload +``` + +Get balance limits + +Fetches balance limits and send the created UUID along with the data + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\BalanceApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$balanceDefinitionId = 'balanceDefinitionId_example'; // string | Balance definition id +$balanceLimitId = 'balanceLimitId_example'; // string | Balance limit id +$version = 'draft'; // string | Select active to get balance definition configuration which is live for the clients. Select draft to retrieve balance definition configuration with the recent edits + +try { + $result = $apiInstance->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet($loyaltyProgramId, $balanceDefinitionId, $balanceLimitId, $version); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BalanceApi->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **balanceDefinitionId** | **string**| Balance definition id | | +| **balanceLimitId** | **string**| Balance limit id | | +| **version** | **string**| Select active to get balance definition configuration which is live for the clients. Select draft to retrieve balance definition configuration with the recent edits | [optional] [default to 'draft'] | + +### Return type + +[**\Brevo\Client\Models\BalanceLimitPayload**](../Model/BalanceLimitPayload.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut()` + +```php +loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut($loyaltyProgramId, $balanceDefinitionId, $balanceLimitId, $balanceLimit): \Brevo\Client\Models\BalanceLimitPayload +``` + +Updates balance limit + +Updates balance limit + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\BalanceApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$balanceDefinitionId = 'balanceDefinitionId_example'; // string | Balance Definition Id +$balanceLimitId = 'balanceLimitId_example'; // string | Balance Limit Id +$balanceLimit = new \Brevo\Client\Models\BalanceLimit(); // \Brevo\Client\Models\BalanceLimit | Balance limit request + +try { + $result = $apiInstance->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut($loyaltyProgramId, $balanceDefinitionId, $balanceLimitId, $balanceLimit); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BalanceApi->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **balanceDefinitionId** | **string**| Balance Definition Id | | +| **balanceLimitId** | **string**| Balance Limit Id | | +| **balanceLimit** | [**\Brevo\Client\Models\BalanceLimit**](../Model/BalanceLimit.md)| Balance limit request | [optional] | + +### Return type + +[**\Brevo\Client\Models\BalanceLimitPayload**](../Model/BalanceLimitPayload.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost()` + +```php +loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost($loyaltyProgramId, $balanceDefinitionId, $balanceLimit): \Brevo\Client\Models\BalanceLimitPayload +``` + +Create balance limits + +Creates balance limit and send the created UUID along with the data + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\BalanceApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$balanceDefinitionId = 'balanceDefinitionId_example'; // string | Balance Definition Id +$balanceLimit = new \Brevo\Client\Models\BalanceLimit(); // \Brevo\Client\Models\BalanceLimit | Balance definition information + +try { + $result = $apiInstance->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost($loyaltyProgramId, $balanceDefinitionId, $balanceLimit); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BalanceApi->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **balanceDefinitionId** | **string**| Balance Definition Id | | +| **balanceLimit** | [**\Brevo\Client\Models\BalanceLimit**](../Model/BalanceLimit.md)| Balance definition information | [optional] | + +### Return type + +[**\Brevo\Client\Models\BalanceLimitPayload**](../Model/BalanceLimitPayload.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut()` + +```php +loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut($loyaltyProgramId, $balanceDefinitionId, $updateBalanceDefinitionPayload): \Brevo\Client\Models\BalanceDefinition +``` + +Update balance definition + +Updates Balance definition + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\BalanceApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$balanceDefinitionId = 'balanceDefinitionId_example'; // string | Balance Definition Id +$updateBalanceDefinitionPayload = new \Brevo\Client\Models\UpdateBalanceDefinitionPayload(); // \Brevo\Client\Models\UpdateBalanceDefinitionPayload | Balance definition information + +try { + $result = $apiInstance->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut($loyaltyProgramId, $balanceDefinitionId, $updateBalanceDefinitionPayload); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BalanceApi->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **balanceDefinitionId** | **string**| Balance Definition Id | | +| **updateBalanceDefinitionPayload** | [**\Brevo\Client\Models\UpdateBalanceDefinitionPayload**](../Model/UpdateBalanceDefinitionPayload.md)| Balance definition information | [optional] | + +### Return type + +[**\Brevo\Client\Models\BalanceDefinition**](../Model/BalanceDefinition.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost()` + +```php +loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost($loyaltyProgramId, $createBalanceDefinitionPayload): \Brevo\Client\Models\BalanceDefinition +``` + +Create balance definition + +Creates balance definition and returns information + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\BalanceApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$createBalanceDefinitionPayload = new \Brevo\Client\Models\CreateBalanceDefinitionPayload(); // \Brevo\Client\Models\CreateBalanceDefinitionPayload | Balance definition information + +try { + $result = $apiInstance->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost($loyaltyProgramId, $createBalanceDefinitionPayload); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BalanceApi->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **createBalanceDefinitionPayload** | [**\Brevo\Client\Models\CreateBalanceDefinitionPayload**](../Model/CreateBalanceDefinitionPayload.md)| Balance definition information | | + +### Return type + +[**\Brevo\Client\Models\BalanceDefinition**](../Model/BalanceDefinition.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/CRMApi.md b/docs/Api/CRMApi.md deleted file mode 100644 index 1802918..0000000 --- a/docs/Api/CRMApi.md +++ /dev/null @@ -1,678 +0,0 @@ -# Brevo\Client\CRMApi - -All URIs are relative to *https://api.brevo.com/v3* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**crmNotesGet**](CRMApi.md#crmNotesGet) | **GET** /crm/notes | Get all notes -[**crmNotesIdDelete**](CRMApi.md#crmNotesIdDelete) | **DELETE** /crm/notes/{id} | Delete a note -[**crmNotesIdGet**](CRMApi.md#crmNotesIdGet) | **GET** /crm/notes/{id} | Get a note -[**crmNotesIdPatch**](CRMApi.md#crmNotesIdPatch) | **PATCH** /crm/notes/{id} | Update a note -[**crmNotesPost**](CRMApi.md#crmNotesPost) | **POST** /crm/notes | Create a note -[**crmTasksGet**](CRMApi.md#crmTasksGet) | **GET** /crm/tasks | Get all tasks -[**crmTasksIdDelete**](CRMApi.md#crmTasksIdDelete) | **DELETE** /crm/tasks/{id} | Delete a task -[**crmTasksIdGet**](CRMApi.md#crmTasksIdGet) | **GET** /crm/tasks/{id} | Get a task -[**crmTasksIdPatch**](CRMApi.md#crmTasksIdPatch) | **PATCH** /crm/tasks/{id} | Update a task -[**crmTasksPost**](CRMApi.md#crmTasksPost) | **POST** /crm/tasks | Create a task -[**crmTasktypesGet**](CRMApi.md#crmTasktypesGet) | **GET** /crm/tasktypes | Get all task types - - -# **crmNotesGet** -> \Brevo\Client\Model\NoteList crmNotesGet($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort) - -Get all notes - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\Client\Api\CRMApi( - // 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 -); -$entity = "entity_example"; // string | Filter by note entity type -$entityIds = "entityIds_example"; // string | Filter by note entity IDs -$dateFrom = 56; // int | dateFrom to date range filter type (timestamp in milliseconds) -$dateTo = 56; // int | dateTo to date range filter type (timestamp in milliseconds) -$offset = 789; // int | Index of the first document of the page -$limit = 50; // int | Number of documents per page -$sort = "sort_example"; // string | Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed - -try { - $result = $apiInstance->crmNotesGet($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling CRMApi->crmNotesGet: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **entity** | **string**| Filter by note entity type | [optional] - **entityIds** | **string**| Filter by note entity IDs | [optional] - **dateFrom** | **int**| dateFrom to date range filter type (timestamp in milliseconds) | [optional] - **dateTo** | **int**| dateTo to date range filter type (timestamp in milliseconds) | [optional] - **offset** | **int**| Index of the first document of the page | [optional] - **limit** | **int**| Number of documents per page | [optional] [default to 50] - **sort** | **string**| Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed | [optional] - -### Return type - -[**\Brevo\Client\Model\NoteList**](../Model/NoteList.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **crmNotesIdDelete** -> crmNotesIdDelete($id) - -Delete a note - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\Client\Api\CRMApi( - // 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 -); -$id = "id_example"; // string | Note ID to delete - -try { - $apiInstance->crmNotesIdDelete($id); -} catch (Exception $e) { - echo 'Exception when calling CRMApi->crmNotesIdDelete: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| Note ID to delete | - -### Return type - -void (empty response body) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **crmNotesIdGet** -> \Brevo\Client\Model\Note crmNotesIdGet($id) - -Get a note - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\Client\Api\CRMApi( - // 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 -); -$id = "id_example"; // string | Note ID to get - -try { - $result = $apiInstance->crmNotesIdGet($id); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling CRMApi->crmNotesIdGet: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| Note ID to get | - -### Return type - -[**\Brevo\Client\Model\Note**](../Model/Note.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **crmNotesIdPatch** -> crmNotesIdPatch($id, $body) - -Update a note - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\Client\Api\CRMApi( - // 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 -); -$id = "id_example"; // string | Note ID to update -$body = new \Brevo\Client\Model\NoteData(); // \Brevo\Client\Model\NoteData | Note data to update a note - -try { - $apiInstance->crmNotesIdPatch($id, $body); -} catch (Exception $e) { - echo 'Exception when calling CRMApi->crmNotesIdPatch: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| Note ID to update | - **body** | [**\Brevo\Client\Model\NoteData**](../Model/NoteData.md)| Note data to update a note | - -### Return type - -void (empty response body) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **crmNotesPost** -> \Brevo\Client\Model\NoteId crmNotesPost($body) - -Create a note - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\Client\Api\CRMApi( - // 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 -); -$body = new \Brevo\Client\Model\NoteData(); // \Brevo\Client\Model\NoteData | Note data to create a note. - -try { - $result = $apiInstance->crmNotesPost($body); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling CRMApi->crmNotesPost: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**\Brevo\Client\Model\NoteData**](../Model/NoteData.md)| Note data to create a note. | - -### Return type - -[**\Brevo\Client\Model\NoteId**](../Model/NoteId.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **crmTasksGet** -> \Brevo\Client\Model\TaskList crmTasksGet($filterType, $filterStatus, $filterDate, $filterAssignTo, $filterContacts, $filterDeals, $filterCompanies, $dateFrom, $dateTo, $offset, $limit, $sort, $sortBy) - -Get all tasks - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\Client\Api\CRMApi( - // 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 -); -$filterType = "filterType_example"; // string | Filter by task type (ID) -$filterStatus = "filterStatus_example"; // string | Filter by task status -$filterDate = "filterDate_example"; // string | Filter by date -$filterAssignTo = "filterAssignTo_example"; // string | Filter by assignTo id -$filterContacts = "filterContacts_example"; // string | Filter by contact ids -$filterDeals = "filterDeals_example"; // string | Filter by deals ids -$filterCompanies = "filterCompanies_example"; // string | Filter by companies ids -$dateFrom = 56; // int | dateFrom to date range filter type (timestamp in milliseconds) -$dateTo = 56; // int | dateTo to date range filter type (timestamp in milliseconds) -$offset = 789; // int | Index of the first document of the page -$limit = 50; // int | Number of documents per page -$sort = "sort_example"; // string | Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed -$sortBy = "sortBy_example"; // string | The field used to sort field names. - -try { - $result = $apiInstance->crmTasksGet($filterType, $filterStatus, $filterDate, $filterAssignTo, $filterContacts, $filterDeals, $filterCompanies, $dateFrom, $dateTo, $offset, $limit, $sort, $sortBy); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling CRMApi->crmTasksGet: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **filterType** | **string**| Filter by task type (ID) | [optional] - **filterStatus** | **string**| Filter by task status | [optional] - **filterDate** | **string**| Filter by date | [optional] - **filterAssignTo** | **string**| Filter by assignTo id | [optional] - **filterContacts** | **string**| Filter by contact ids | [optional] - **filterDeals** | **string**| Filter by deals ids | [optional] - **filterCompanies** | **string**| Filter by companies ids | [optional] - **dateFrom** | **int**| dateFrom to date range filter type (timestamp in milliseconds) | [optional] - **dateTo** | **int**| dateTo to date range filter type (timestamp in milliseconds) | [optional] - **offset** | **int**| Index of the first document of the page | [optional] - **limit** | **int**| Number of documents per page | [optional] [default to 50] - **sort** | **string**| Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed | [optional] - **sortBy** | **string**| The field used to sort field names. | [optional] - -### Return type - -[**\Brevo\Client\Model\TaskList**](../Model/TaskList.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **crmTasksIdDelete** -> crmTasksIdDelete($id) - -Delete a task - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\Client\Api\CRMApi( - // 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 -); -$id = "id_example"; // string | - -try { - $apiInstance->crmTasksIdDelete($id); -} catch (Exception $e) { - echo 'Exception when calling CRMApi->crmTasksIdDelete: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| | - -### Return type - -void (empty response body) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **crmTasksIdGet** -> \Brevo\Client\Model\Task crmTasksIdGet($id) - -Get a task - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\Client\Api\CRMApi( - // 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 -); -$id = "id_example"; // string | - -try { - $result = $apiInstance->crmTasksIdGet($id); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling CRMApi->crmTasksIdGet: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| | - -### Return type - -[**\Brevo\Client\Model\Task**](../Model/Task.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **crmTasksIdPatch** -> crmTasksIdPatch($id, $body) - -Update a task - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\Client\Api\CRMApi( - // 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 -); -$id = "id_example"; // string | -$body = new \Brevo\Client\Model\Body1(); // \Brevo\Client\Model\Body1 | Updated task details. - -try { - $apiInstance->crmTasksIdPatch($id, $body); -} catch (Exception $e) { - echo 'Exception when calling CRMApi->crmTasksIdPatch: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| | - **body** | [**\Brevo\Client\Model\Body1**](../Model/Body1.md)| Updated task details. | - -### Return type - -void (empty response body) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **crmTasksPost** -> \Brevo\Client\Model\InlineResponse201 crmTasksPost($body) - -Create a task - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\Client\Api\CRMApi( - // 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 -); -$body = new \Brevo\Client\Model\Body(); // \Brevo\Client\Model\Body | Task name. - -try { - $result = $apiInstance->crmTasksPost($body); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling CRMApi->crmTasksPost: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**\Brevo\Client\Model\Body**](../Model/Body.md)| Task name. | - -### Return type - -[**\Brevo\Client\Model\InlineResponse201**](../Model/InlineResponse201.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **crmTasktypesGet** -> \Brevo\Client\Model\TaskTypes crmTasktypesGet() - -Get all task types - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\Client\Api\CRMApi( - // 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 = $apiInstance->crmTasktypesGet(); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling CRMApi->crmTasktypesGet: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -[**\Brevo\Client\Model\TaskTypes**](../Model/TaskTypes.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - diff --git a/docs/Api/CompaniesApi.md b/docs/Api/CompaniesApi.md index a17f87a..7733d95 100644 --- a/docs/Api/CompaniesApi.md +++ b/docs/Api/CompaniesApi.md @@ -1,37 +1,45 @@ # Brevo\Client\CompaniesApi -All URIs are relative to *https://api.brevo.com/v3* +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**companiesAttributesGet**](CompaniesApi.md#companiesAttributesGet) | **GET** /companies/attributes | Get company attributes -[**companiesGet**](CompaniesApi.md#companiesGet) | **GET** /companies | Get all companies -[**companiesIdDelete**](CompaniesApi.md#companiesIdDelete) | **DELETE** /companies/{id} | Delete a company -[**companiesIdGet**](CompaniesApi.md#companiesIdGet) | **GET** /companies/{id} | Get a company -[**companiesIdPatch**](CompaniesApi.md#companiesIdPatch) | **PATCH** /companies/{id} | Update a company -[**companiesLinkUnlinkIdPatch**](CompaniesApi.md#companiesLinkUnlinkIdPatch) | **PATCH** /companies/link-unlink/{id} | Link and Unlink company with contacts and deals -[**companiesPost**](CompaniesApi.md#companiesPost) | **POST** /companies | Create a company +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**companiesAttributesGet()**](CompaniesApi.md#companiesAttributesGet) | **GET** /companies/attributes | Get company attributes | +| [**companiesGet()**](CompaniesApi.md#companiesGet) | **GET** /companies | Get all Companies | +| [**companiesIdDelete()**](CompaniesApi.md#companiesIdDelete) | **DELETE** /companies/{id} | Delete a company | +| [**companiesIdGet()**](CompaniesApi.md#companiesIdGet) | **GET** /companies/{id} | Get a company | +| [**companiesIdPatch()**](CompaniesApi.md#companiesIdPatch) | **PATCH** /companies/{id} | Update a company | +| [**companiesImportPost()**](CompaniesApi.md#companiesImportPost) | **POST** /companies/import | Import companies(creation and updation) | +| [**companiesLinkUnlinkIdPatch()**](CompaniesApi.md#companiesLinkUnlinkIdPatch) | **PATCH** /companies/link-unlink/{id} | Link and Unlink company with contact and deal | +| [**companiesPost()**](CompaniesApi.md#companiesPost) | **POST** /companies | Create a company | -# **companiesAttributesGet** -> \Brevo\Client\Model\CompanyAttributes companiesAttributesGet() +## `companiesAttributesGet()` + +```php +companiesAttributesGet(): \Brevo\Client\Models\CompanyAttributesInner[] +``` Get company attributes ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\CompaniesApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. @@ -45,15 +53,15 @@ try { } catch (Exception $e) { echo 'Exception when calling CompaniesApi->companiesAttributesGet: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters + This endpoint does not need any parameter. ### Return type -[**\Brevo\Client\Model\CompanyAttributes**](../Model/CompanyAttributes.md) +[**\Brevo\Client\Models\CompanyAttributesInner[]**](../Model/CompanyAttributesInner.md) ### Authorization @@ -61,43 +69,52 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `companiesGet()` -# **companiesGet** -> \Brevo\Client\Model\CompaniesList companiesGet($filters, $linkedContactsIds, $linkedDealsIds, $page, $limit, $sort, $sortBy) +```php +companiesGet($filters, $linkedContactsIds, $linkedDealsIds, $page, $limit, $sort, $sortBy): \Brevo\Client\Models\CompaniesList +``` -Get all companies +Get all Companies ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\CompaniesApi( // 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 ); -$filters = "filters_example"; // string | Filter by attrbutes. If you have filter for owner on your side please send it as {\"attributes.owner\":\"5b1a17d914b73d35a76ca0c7\"} -$linkedContactsIds = 789; // int | Filter by linked contacts ids -$linkedDealsIds = "linkedDealsIds_example"; // string | Filter by linked deals ids -$page = 789; // int | Index of the first document of the page -$limit = 50; // int | Number of documents per page -$sort = "sort_example"; // string | Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed -$sortBy = "sortBy_example"; // string | The field used to sort field names. +$filters = 'filters_example'; // string | Filter by attrbutes. If you have filter for owner on your side please send it as {\"attributes.owner\":\"6299dcf3874a14eacbc65c46\"} +$linkedContactsIds = 56; // int | Filter by linked contacts ids +$linkedDealsIds = 'linkedDealsIds_example'; // string | Filter by linked Deals ids +$page = 56; // int | Index of the first document of the page +$limit = 56; // int | Number of documents per page +$sort = 'sort_example'; // string | Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed +$sortBy = 'sortBy_example'; // string | The field used to sort field names. try { $result = $apiInstance->companiesGet($filters, $linkedContactsIds, $linkedDealsIds, $page, $limit, $sort, $sortBy); @@ -105,24 +122,23 @@ try { } catch (Exception $e) { echo 'Exception when calling CompaniesApi->companiesGet: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **filters** | **string**| Filter by attrbutes. If you have filter for owner on your side please send it as {\"attributes.owner\":\"5b1a17d914b73d35a76ca0c7\"} | [optional] - **linkedContactsIds** | **int**| Filter by linked contacts ids | [optional] - **linkedDealsIds** | **string**| Filter by linked deals ids | [optional] - **page** | **int**| Index of the first document of the page | [optional] - **limit** | **int**| Number of documents per page | [optional] [default to 50] - **sort** | **string**| Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed | [optional] - **sortBy** | **string**| The field used to sort field names. | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **filters** | **string**| Filter by attrbutes. If you have filter for owner on your side please send it as {\"attributes.owner\":\"6299dcf3874a14eacbc65c46\"} | [optional] | +| **linkedContactsIds** | **int**| Filter by linked contacts ids | [optional] | +| **linkedDealsIds** | **string**| Filter by linked Deals ids | [optional] | +| **page** | **int**| Index of the first document of the page | [optional] | +| **limit** | **int**| Number of documents per page | [optional] | +| **sort** | **string**| Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed | [optional] | +| **sortBy** | **string**| The field used to sort field names. | [optional] | ### Return type -[**\Brevo\Client\Model\CompaniesList**](../Model/CompaniesList.md) +[**\Brevo\Client\Models\CompaniesList**](../Model/CompaniesList.md) ### Authorization @@ -130,51 +146,59 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **companiesIdDelete** -> companiesIdDelete($id) +## `companiesIdDelete()` + +```php +companiesIdDelete($id) +``` Delete a company ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\CompaniesApi( // 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 ); -$id = "id_example"; // string | +$id = 'id_example'; // string | Company ID to delete try { $apiInstance->companiesIdDelete($id); } catch (Exception $e) { echo 'Exception when calling CompaniesApi->companiesIdDelete: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| Company ID to delete | | ### Return type @@ -186,37 +210,46 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `companiesIdGet()` -# **companiesIdGet** -> \Brevo\Client\Model\Company companiesIdGet($id) +```php +companiesIdGet($id): \Brevo\Client\Models\Company +``` Get a company ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\CompaniesApi( // 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 ); -$id = "id_example"; // string | +$id = 'id_example'; // string | Get Company Details try { $result = $apiInstance->companiesIdGet($id); @@ -224,18 +257,17 @@ try { } catch (Exception $e) { echo 'Exception when calling CompaniesApi->companiesIdGet: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| Get Company Details | | ### Return type -[**\Brevo\Client\Model\Company**](../Model/Company.md) +[**\Brevo\Client\Models\Company**](../Model/Company.md) ### Authorization @@ -243,58 +275,135 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **companiesIdPatch** -> \Brevo\Client\Model\Company companiesIdPatch($id, $body) +## `companiesIdPatch()` + +```php +companiesIdPatch($id, $companiesIdPatchRequest): \Brevo\Client\Models\Company +``` Update a company ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\CompaniesApi( // 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 ); -$id = "id_example"; // string | -$body = new \Brevo\Client\Model\Body3(); // \Brevo\Client\Model\Body3 | Updated company details. +$id = 'id_example'; // string +$companiesIdPatchRequest = new \Brevo\Client\Models\CompaniesIdPatchRequest(); // \Brevo\Client\Models\CompaniesIdPatchRequest | Updated company details. try { - $result = $apiInstance->companiesIdPatch($id, $body); + $result = $apiInstance->companiesIdPatch($id, $companiesIdPatchRequest); print_r($result); } catch (Exception $e) { echo 'Exception when calling CompaniesApi->companiesIdPatch: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| | - **body** | [**\Brevo\Client\Model\Body3**](../Model/Body3.md)| Updated company details. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| | | +| **companiesIdPatchRequest** | [**\Brevo\Client\Models\CompaniesIdPatchRequest**](../Model/CompaniesIdPatchRequest.md)| Updated company details. | | + +### Return type + +[**\Brevo\Client\Models\Company**](../Model/Company.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `companiesImportPost()` + +```php +companiesImportPost($file, $mapping): \Brevo\Client\Models\CompaniesImportPost200Response +``` + +Import companies(creation and updation) + +Import companies from a CSV file with mapping options. + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\CompaniesApi( + // 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 +); +$file = "/path/to/file.txt"; // \SplFileObject | The CSV file to upload.The file should have the first row as the mapping attribute. Some default attribute names are (a) company_id [brevo mongoID to update deals] (b) associated_contact (c) associated_deal (f) any other attribute with internal name +$mapping = array('key' => new \stdClass); // object | The mapping options in JSON format. Here is an example of the JSON structure: ```json { \\\"link_entities\\\": true, // Determines whether to link related entities during the import process \\\"unlink_entities\\\": false, // Determines whether to unlink related entities during the import process \\\"update_existing_records\\\": true, // Determines whether to update based on company ID or treat every row as create \\\"unset_empty_attributes\\\": false // Determines whether to unset a specific attribute during update if the values input is blank } ``` + +try { + $result = $apiInstance->companiesImportPost($file, $mapping); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CompaniesApi->companiesImportPost: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **file** | **\SplFileObject****\SplFileObject**| The CSV file to upload.The file should have the first row as the mapping attribute. Some default attribute names are (a) company_id [brevo mongoID to update deals] (b) associated_contact (c) associated_deal (f) any other attribute with internal name | [optional] | +| **mapping** | [**object**](../Model/object.md)| The mapping options in JSON format. Here is an example of the JSON structure: ```json { \\\"link_entities\\\": true, // Determines whether to link related entities during the import process \\\"unlink_entities\\\": false, // Determines whether to unlink related entities during the import process \\\"update_existing_records\\\": true, // Determines whether to update based on company ID or treat every row as create \\\"unset_empty_attributes\\\": false // Determines whether to unset a specific attribute during update if the values input is blank } ``` | [optional] | ### Return type -[**\Brevo\Client\Model\Company**](../Model/Company.md) +[**\Brevo\Client\Models\CompaniesImportPost200Response**](../Model/CompaniesImportPost200Response.md) ### Authorization @@ -302,53 +411,61 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `multipart/form-data` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **companiesLinkUnlinkIdPatch** -> companiesLinkUnlinkIdPatch($id, $body) +## `companiesLinkUnlinkIdPatch()` + +```php +companiesLinkUnlinkIdPatch($id, $companiesLinkUnlinkIdPatchRequest) +``` -Link and Unlink company with contacts and deals +Link and Unlink company with contact and deal ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\CompaniesApi( // 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 ); -$id = "id_example"; // string | -$body = new \Brevo\Client\Model\Body4(); // \Brevo\Client\Model\Body4 | Linked / Unlinked contacts and deals ids. +$id = 'id_example'; // string +$companiesLinkUnlinkIdPatchRequest = new \Brevo\Client\Models\CompaniesLinkUnlinkIdPatchRequest(); // \Brevo\Client\Models\CompaniesLinkUnlinkIdPatchRequest | Linked / Unlinked contacts and deals ids. try { - $apiInstance->companiesLinkUnlinkIdPatch($id, $body); + $apiInstance->companiesLinkUnlinkIdPatch($id, $companiesLinkUnlinkIdPatchRequest); } catch (Exception $e) { echo 'Exception when calling CompaniesApi->companiesLinkUnlinkIdPatch: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| | - **body** | [**\Brevo\Client\Model\Body4**](../Model/Body4.md)| Linked / Unlinked contacts and deals ids. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| | | +| **companiesLinkUnlinkIdPatchRequest** | [**\Brevo\Client\Models\CompaniesLinkUnlinkIdPatchRequest**](../Model/CompaniesLinkUnlinkIdPatchRequest.md)| Linked / Unlinked contacts and deals ids. | | ### Return type @@ -360,56 +477,64 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `companiesPost()` -# **companiesPost** -> \Brevo\Client\Model\InlineResponse2001 companiesPost($body) +```php +companiesPost($companiesPostRequest): \Brevo\Client\Models\CompaniesPost200Response +``` Create a company ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\CompaniesApi( // 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 ); -$body = new \Brevo\Client\Model\Body2(); // \Brevo\Client\Model\Body2 | Company create data. +$companiesPostRequest = new \Brevo\Client\Models\CompaniesPostRequest(); // \Brevo\Client\Models\CompaniesPostRequest | Company create data. try { - $result = $apiInstance->companiesPost($body); + $result = $apiInstance->companiesPost($companiesPostRequest); print_r($result); } catch (Exception $e) { echo 'Exception when calling CompaniesApi->companiesPost: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**\Brevo\Client\Model\Body2**](../Model/Body2.md)| Company create data. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **companiesPostRequest** | [**\Brevo\Client\Models\CompaniesPostRequest**](../Model/CompaniesPostRequest.md)| Company create data. | | ### Return type -[**\Brevo\Client\Model\InlineResponse2001**](../Model/InlineResponse2001.md) +[**\Brevo\Client\Models\CompaniesPost200Response**](../Model/CompaniesPost200Response.md) ### Authorization @@ -417,8 +542,9 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: `application/json` +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/ContactsApi.md b/docs/Api/ContactsApi.md index 2139c2d..fada3ba 100644 --- a/docs/Api/ContactsApi.md +++ b/docs/Api/ContactsApi.md @@ -1,88 +1,94 @@ # Brevo\Client\ContactsApi -All URIs are relative to *https://api.brevo.com/v3* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**addContactToList**](ContactsApi.md#addContactToList) | **POST** /contacts/lists/{listId}/contacts/add | Add existing contacts to a list -[**createAttribute**](ContactsApi.md#createAttribute) | **POST** /contacts/attributes/{attributeCategory}/{attributeName} | Create contact attribute -[**createContact**](ContactsApi.md#createContact) | **POST** /contacts | Create a contact -[**createDoiContact**](ContactsApi.md#createDoiContact) | **POST** /contacts/doubleOptinConfirmation | Create Contact via DOI (Double-Opt-In) Flow -[**createFolder**](ContactsApi.md#createFolder) | **POST** /contacts/folders | Create a folder -[**createList**](ContactsApi.md#createList) | **POST** /contacts/lists | Create a list -[**deleteAttribute**](ContactsApi.md#deleteAttribute) | **DELETE** /contacts/attributes/{attributeCategory}/{attributeName} | Delete an attribute -[**deleteContact**](ContactsApi.md#deleteContact) | **DELETE** /contacts/{identifier} | Delete a contact -[**deleteFolder**](ContactsApi.md#deleteFolder) | **DELETE** /contacts/folders/{folderId} | Delete a folder (and all its lists) -[**deleteList**](ContactsApi.md#deleteList) | **DELETE** /contacts/lists/{listId} | Delete a list -[**deleteMultiAttributeOptions**](ContactsApi.md#deleteMultiAttributeOptions) | **DELETE** /contacts/attributes/{attributeType}/{multipleChoiceAttribute}/{multipleChoiceAttributeOption} | Delete a multiple-choice attribute option -[**getAttributes**](ContactsApi.md#getAttributes) | **GET** /contacts/attributes | List all attributes -[**getContactInfo**](ContactsApi.md#getContactInfo) | **GET** /contacts/{identifier} | Get a contact's details -[**getContactStats**](ContactsApi.md#getContactStats) | **GET** /contacts/{identifier}/campaignStats | Get email campaigns' statistics for a contact -[**getContacts**](ContactsApi.md#getContacts) | **GET** /contacts | Get all the contacts -[**getContactsFromList**](ContactsApi.md#getContactsFromList) | **GET** /contacts/lists/{listId}/contacts | Get contacts in a list -[**getFolder**](ContactsApi.md#getFolder) | **GET** /contacts/folders/{folderId} | Returns a folder's details -[**getFolderLists**](ContactsApi.md#getFolderLists) | **GET** /contacts/folders/{folderId}/lists | Get lists in a folder -[**getFolders**](ContactsApi.md#getFolders) | **GET** /contacts/folders | Get all folders -[**getList**](ContactsApi.md#getList) | **GET** /contacts/lists/{listId} | Get a list's details -[**getLists**](ContactsApi.md#getLists) | **GET** /contacts/lists | Get all the lists -[**getSegments**](ContactsApi.md#getSegments) | **GET** /contacts/segments | Get all the Segments -[**importContacts**](ContactsApi.md#importContacts) | **POST** /contacts/import | Import contacts -[**removeContactFromList**](ContactsApi.md#removeContactFromList) | **POST** /contacts/lists/{listId}/contacts/remove | Delete a contact from a list -[**requestContactExport**](ContactsApi.md#requestContactExport) | **POST** /contacts/export | Export contacts -[**updateAttribute**](ContactsApi.md#updateAttribute) | **PUT** /contacts/attributes/{attributeCategory}/{attributeName} | Update contact attribute -[**updateBatchContacts**](ContactsApi.md#updateBatchContacts) | **POST** /contacts/batch | Update multiple contacts -[**updateContact**](ContactsApi.md#updateContact) | **PUT** /contacts/{identifier} | Update a contact -[**updateFolder**](ContactsApi.md#updateFolder) | **PUT** /contacts/folders/{folderId} | Update a folder -[**updateList**](ContactsApi.md#updateList) | **PUT** /contacts/lists/{listId} | Update a list - - -# **addContactToList** -> \Brevo\Client\Model\PostContactInfo addContactToList($listId, $contactEmails) +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**addContactToList()**](ContactsApi.md#addContactToList) | **POST** /contacts/lists/{listId}/contacts/add | Add existing contacts to a list | +| [**createAttribute()**](ContactsApi.md#createAttribute) | **POST** /contacts/attributes/{attributeCategory}/{attributeName} | Create contact attribute | +| [**createContact()**](ContactsApi.md#createContact) | **POST** /contacts | Create a contact | +| [**createDoiContact()**](ContactsApi.md#createDoiContact) | **POST** /contacts/doubleOptinConfirmation | Create Contact via DOI (Double-Opt-In) Flow | +| [**createFolder()**](ContactsApi.md#createFolder) | **POST** /contacts/folders | Create a folder | +| [**createList()**](ContactsApi.md#createList) | **POST** /contacts/lists | Create a list | +| [**deleteAttribute()**](ContactsApi.md#deleteAttribute) | **DELETE** /contacts/attributes/{attributeCategory}/{attributeName} | Delete an attribute | +| [**deleteContact()**](ContactsApi.md#deleteContact) | **DELETE** /contacts/{identifier} | Delete a contact | +| [**deleteFolder()**](ContactsApi.md#deleteFolder) | **DELETE** /contacts/folders/{folderId} | Delete a folder (and all its lists) | +| [**deleteList()**](ContactsApi.md#deleteList) | **DELETE** /contacts/lists/{listId} | Delete a list | +| [**deleteMultiAttributeOptions()**](ContactsApi.md#deleteMultiAttributeOptions) | **DELETE** /contacts/attributes/{attributeType}/{multipleChoiceAttribute}/{multipleChoiceAttributeOption} | Delete a multiple-choice attribute option | +| [**getAttributes()**](ContactsApi.md#getAttributes) | **GET** /contacts/attributes | List all attributes | +| [**getContactInfo()**](ContactsApi.md#getContactInfo) | **GET** /contacts/{identifier} | Get a contact's details | +| [**getContactStats()**](ContactsApi.md#getContactStats) | **GET** /contacts/{identifier}/campaignStats | Get email campaigns' statistics for a contact | +| [**getContacts()**](ContactsApi.md#getContacts) | **GET** /contacts | Get all the contacts | +| [**getContactsFromList()**](ContactsApi.md#getContactsFromList) | **GET** /contacts/lists/{listId}/contacts | Get contacts in a list | +| [**getFolder()**](ContactsApi.md#getFolder) | **GET** /contacts/folders/{folderId} | Returns a folder's details | +| [**getFolderLists()**](ContactsApi.md#getFolderLists) | **GET** /contacts/folders/{folderId}/lists | Get lists in a folder | +| [**getFolders()**](ContactsApi.md#getFolders) | **GET** /contacts/folders | Get all folders | +| [**getList()**](ContactsApi.md#getList) | **GET** /contacts/lists/{listId} | Get a list's details | +| [**getLists()**](ContactsApi.md#getLists) | **GET** /contacts/lists | Get all the lists | +| [**getSegments()**](ContactsApi.md#getSegments) | **GET** /contacts/segments | Get all the segments | +| [**importContacts()**](ContactsApi.md#importContacts) | **POST** /contacts/import | Import contacts | +| [**removeContactFromList()**](ContactsApi.md#removeContactFromList) | **POST** /contacts/lists/{listId}/contacts/remove | Delete a contact from a list | +| [**requestContactExport()**](ContactsApi.md#requestContactExport) | **POST** /contacts/export | Export contacts | +| [**updateAttribute()**](ContactsApi.md#updateAttribute) | **PUT** /contacts/attributes/{attributeCategory}/{attributeName} | Update contact attribute | +| [**updateBatchContacts()**](ContactsApi.md#updateBatchContacts) | **POST** /contacts/batch | Update multiple contacts | +| [**updateContact()**](ContactsApi.md#updateContact) | **PUT** /contacts/{identifier} | Update a contact | +| [**updateFolder()**](ContactsApi.md#updateFolder) | **PUT** /contacts/folders/{folderId} | Update a folder | +| [**updateList()**](ContactsApi.md#updateList) | **PUT** /contacts/lists/{listId} | Update a list | + + +## `addContactToList()` + +```php +addContactToList($listId, $addContactToListRequest): \Brevo\Client\Models\PostContactInfo +``` Add existing contacts to a list ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\AddContactToList(); // \Brevo\Client\Model\AddContactToList | Emails addresses OR IDs of the contacts +$listId = 56; // int | Id of the list +$addContactToListRequest = {"emails":["jeff32@example.com","jim56@example.com"]}; // \Brevo\Client\Models\AddContactToListRequest | Emails addresses OR IDs OR EXT_ID attributes of the contacts try { - $result = $apiInstance->addContactToList($listId, $contactEmails); + $result = $apiInstance->addContactToList($listId, $addContactToListRequest); print_r($result); } catch (Exception $e) { echo 'Exception when calling ContactsApi->addContactToList: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **listId** | **int**| Id of the list | - **contactEmails** | [**\Brevo\Client\Model\AddContactToList**](../Model/AddContactToList.md)| Emails addresses OR IDs of the contacts | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **listId** | **int**| Id of the list | | +| **addContactToListRequest** | [**\Brevo\Client\Models\AddContactToListRequest**](../Model/AddContactToListRequest.md)| Emails addresses OR IDs OR EXT_ID attributes of the contacts | | ### Return type -[**\Brevo\Client\Model\PostContactInfo**](../Model/PostContactInfo.md) +[**\Brevo\Client\Models\PostContactInfo**](../Model/PostContactInfo.md) ### Authorization @@ -90,55 +96,63 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **createAttribute** -> createAttribute($attributeCategory, $attributeName, $createAttribute) +## `createAttribute()` + +```php +createAttribute($attributeCategory, $attributeName, $createAttribute) +``` Create contact attribute ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\CreateAttribute(); // \Brevo\Client\Model\CreateAttribute | Values to create an attribute +$attributeCategory = 'attributeCategory_example'; // string | Category of the attribute +$attributeName = 'attributeName_example'; // string | Name of the attribute +$createAttribute = new \Brevo\Client\Models\CreateAttribute(); // \Brevo\Client\Models\CreateAttribute | Values to create an attribute try { $apiInstance->createAttribute($attributeCategory, $attributeName, $createAttribute); } catch (Exception $e) { echo 'Exception when calling ContactsApi->createAttribute: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **attributeCategory** | **string**| Category of the attribute | - **attributeName** | **string**| Name of the attribute | - **createAttribute** | [**\Brevo\Client\Model\CreateAttribute**](../Model/CreateAttribute.md)| Values to create an attribute | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **attributeCategory** | **string**| Category of the attribute | | +| **attributeName** | **string**| Name of the attribute | | +| **createAttribute** | [**\Brevo\Client\Models\CreateAttribute**](../Model/CreateAttribute.md)| Values to create an attribute | | ### Return type @@ -150,39 +164,48 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **createContact** -> \Brevo\Client\Model\CreateUpdateContactModel createContact($createContact) +## `createContact()` + +```php +createContact($createContact): \Brevo\Client\Models\CreateUpdateContactModel +``` Create a contact Creates new contacts on Brevo. Contacts can be created by passing either -

1. email address of the contact (email_id),
2. phone number of the contact (to be passed as \"SMS\" field in \"attributes\" along with proper country code), For example- {\"SMS\":\"+91xxxxxxxxxx\"} or {\"SMS\":\"0091xxxxxxxxxx\"}
3. ext_id
### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\CreateContact(); // \Brevo\Client\Model\CreateContact | Values to create a contact +$createContact = new \Brevo\Client\Models\CreateContact(); // \Brevo\Client\Models\CreateContact | Values to create a contact try { $result = $apiInstance->createContact($createContact); @@ -190,18 +213,17 @@ try { } catch (Exception $e) { echo 'Exception when calling ContactsApi->createContact: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **createContact** | [**\Brevo\Client\Model\CreateContact**](../Model/CreateContact.md)| Values to create a contact | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **createContact** | [**\Brevo\Client\Models\CreateContact**](../Model/CreateContact.md)| Values to create a contact | | ### Return type -[**\Brevo\Client\Model\CreateUpdateContactModel**](../Model/CreateUpdateContactModel.md) +[**\Brevo\Client\Models\CreateUpdateContactModel**](../Model/CreateUpdateContactModel.md) ### Authorization @@ -209,51 +231,59 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **createDoiContact** -> createDoiContact($createDoiContact) +## `createDoiContact()` + +```php +createDoiContact($createDoiContact) +``` Create Contact via DOI (Double-Opt-In) Flow ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 ); -$createDoiContact = new \Brevo\Client\Model\CreateDoiContact(); // \Brevo\Client\Model\CreateDoiContact | Values to create the Double opt-in (DOI) contact +$createDoiContact = new \Brevo\Client\Models\CreateDoiContact(); // \Brevo\Client\Models\CreateDoiContact | Values to create the Double opt-in (DOI) contact try { $apiInstance->createDoiContact($createDoiContact); } catch (Exception $e) { echo 'Exception when calling ContactsApi->createDoiContact: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **createDoiContact** | [**\Brevo\Client\Model\CreateDoiContact**](../Model/CreateDoiContact.md)| Values to create the Double opt-in (DOI) contact | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **createDoiContact** | [**\Brevo\Client\Models\CreateDoiContact**](../Model/CreateDoiContact.md)| Values to create the Double opt-in (DOI) contact | | ### Return type @@ -265,37 +295,46 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `createFolder()` -# **createFolder** -> \Brevo\Client\Model\CreateModel createFolder($createFolder) +```php +createFolder($createFolder): \Brevo\Client\Models\CreateModel +``` Create a folder ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\CreateUpdateFolder(); // \Brevo\Client\Model\CreateUpdateFolder | Name of the folder +$createFolder = new \Brevo\Client\Models\CreateUpdateFolder(); // \Brevo\Client\Models\CreateUpdateFolder | Name of the folder try { $result = $apiInstance->createFolder($createFolder); @@ -303,18 +342,17 @@ try { } catch (Exception $e) { echo 'Exception when calling ContactsApi->createFolder: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **createFolder** | [**\Brevo\Client\Model\CreateUpdateFolder**](../Model/CreateUpdateFolder.md)| Name of the folder | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **createFolder** | [**\Brevo\Client\Models\CreateUpdateFolder**](../Model/CreateUpdateFolder.md)| Name of the folder | | ### Return type -[**\Brevo\Client\Model\CreateModel**](../Model/CreateModel.md) +[**\Brevo\Client\Models\CreateModel**](../Model/CreateModel.md) ### Authorization @@ -322,37 +360,46 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `createList()` -# **createList** -> \Brevo\Client\Model\CreateModel createList($createList) +```php +createList($createList): \Brevo\Client\Models\CreateModel +``` Create a list ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\CreateList(); // \Brevo\Client\Model\CreateList | Values to create a list +$createList = new \Brevo\Client\Models\CreateList(); // \Brevo\Client\Models\CreateList | Values to create a list try { $result = $apiInstance->createList($createList); @@ -360,18 +407,17 @@ try { } catch (Exception $e) { echo 'Exception when calling ContactsApi->createList: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **createList** | [**\Brevo\Client\Model\CreateList**](../Model/CreateList.md)| Values to create a list | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **createList** | [**\Brevo\Client\Models\CreateList**](../Model/CreateList.md)| Values to create a list | | ### Return type -[**\Brevo\Client\Model\CreateModel**](../Model/CreateModel.md) +[**\Brevo\Client\Models\CreateModel**](../Model/CreateModel.md) ### Authorization @@ -379,53 +425,61 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **deleteAttribute** -> deleteAttribute($attributeCategory, $attributeName) +## `deleteAttribute()` + +```php +deleteAttribute($attributeCategory, $attributeName) +``` Delete an attribute ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 +$attributeCategory = 'attributeCategory_example'; // string | Category of the attribute +$attributeName = 'attributeName_example'; // string | Name of the existing attribute try { $apiInstance->deleteAttribute($attributeCategory, $attributeName); } catch (Exception $e) { echo 'Exception when calling ContactsApi->deleteAttribute: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **attributeCategory** | **string**| Category of the attribute | - **attributeName** | **string**| Name of the existing attribute | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **attributeCategory** | **string**| Category of the attribute | | +| **attributeName** | **string**| Name of the existing attribute | | ### Return type @@ -437,55 +491,63 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `deleteContact()` -# **deleteContact** -> deleteContact($identifier, $identifierType) +```php +deleteContact($identifier, $identifierType) +``` Delete a contact There are 2 ways to delete a contact

Option 1- https://api.brevo.com/v3/contacts/{identifier}

Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={}

Option 1 only works if identifierType is email_id (for EMAIL) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL and ID of the contact.

Option 2 works for all identifierType, use email_id for EMAIL attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 ); -$identifier = "identifier_example"; // string | Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) -$identifierType = new \stdClass; // object | email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute +$identifier = new \Brevo\Client\Models\\Brevo\Client\Models\GetContactInfoIdentifierParameter(); // \Brevo\Client\Models\GetContactInfoIdentifierParameter | Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) +$identifierType = 'identifierType_example'; // string | email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute try { $apiInstance->deleteContact($identifier, $identifierType); } catch (Exception $e) { echo 'Exception when calling ContactsApi->deleteContact: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **identifier** | **string**| Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) | - **identifierType** | [**object**](../Model/.md)| email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **identifier** | [**\Brevo\Client\Models\GetContactInfoIdentifierParameter**](../Model/.md)| Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) | | +| **identifierType** | **string**| email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute | [optional] | ### Return type @@ -497,51 +559,59 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **deleteFolder** -> deleteFolder($folderId) +## `deleteFolder()` + +```php +deleteFolder($folderId) +``` Delete a folder (and all its lists) ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 +$folderId = 56; // int | Id of the folder try { $apiInstance->deleteFolder($folderId); } catch (Exception $e) { echo 'Exception when calling ContactsApi->deleteFolder: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **folderId** | **int**| Id of the folder | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **folderId** | **int**| Id of the folder | | ### Return type @@ -553,51 +623,59 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **deleteList** -> deleteList($listId) +## `deleteList()` + +```php +deleteList($listId) +``` Delete a list ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 +$listId = 56; // int | Id of the list try { $apiInstance->deleteList($listId); } catch (Exception $e) { echo 'Exception when calling ContactsApi->deleteList: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **listId** | **int**| Id of the list | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **listId** | **int**| Id of the list | | ### Return type @@ -609,55 +687,63 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **deleteMultiAttributeOptions** -> deleteMultiAttributeOptions($attributeType, $multipleChoiceAttribute, $multipleChoiceAttributeOption) +## `deleteMultiAttributeOptions()` + +```php +deleteMultiAttributeOptions($attributeType, $multipleChoiceAttribute, $multipleChoiceAttributeOption) +``` Delete a multiple-choice attribute option ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 ); -$attributeType = "attributeType_example"; // string | Type of the attribute -$multipleChoiceAttribute = "multipleChoiceAttribute_example"; // string | Name of the existing multiple-choice attribute -$multipleChoiceAttributeOption = "multipleChoiceAttributeOption_example"; // string | Name of the existing multiple-choice attribute option that you want to delete +$attributeType = 'attributeType_example'; // string | Type of the attribute +$multipleChoiceAttribute = 'multipleChoiceAttribute_example'; // string | Name of the existing muliple-choice attribute +$multipleChoiceAttributeOption = 'multipleChoiceAttributeOption_example'; // string | Name of the existing multiple-choice attribute option that you want to delete try { $apiInstance->deleteMultiAttributeOptions($attributeType, $multipleChoiceAttribute, $multipleChoiceAttributeOption); } catch (Exception $e) { echo 'Exception when calling ContactsApi->deleteMultiAttributeOptions: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **attributeType** | **string**| Type of the attribute | - **multipleChoiceAttribute** | **string**| Name of the existing multiple-choice attribute | - **multipleChoiceAttributeOption** | **string**| Name of the existing multiple-choice attribute option that you want to delete | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **attributeType** | **string**| Type of the attribute | | +| **multipleChoiceAttribute** | **string**| Name of the existing muliple-choice attribute | | +| **multipleChoiceAttributeOption** | **string**| Name of the existing multiple-choice attribute option that you want to delete | | ### Return type @@ -669,30 +755,39 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getAttributes** -> \Brevo\Client\Model\GetAttributes getAttributes() +## `getAttributes()` + +```php +getAttributes(): \Brevo\Client\Models\GetAttributes +``` List all attributes ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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. @@ -706,15 +801,15 @@ try { } catch (Exception $e) { echo 'Exception when calling ContactsApi->getAttributes: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters + This endpoint does not need any parameter. ### Return type -[**\Brevo\Client\Model\GetAttributes**](../Model/GetAttributes.md) +[**\Brevo\Client\Models\GetAttributes**](../Model/GetAttributes.md) ### Authorization @@ -722,42 +817,51 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getContactInfo** -> \Brevo\Client\Model\GetExtendedContactDetails getContactInfo($identifier, $identifierType, $startDate, $endDate) +## `getContactInfo()` + +```php +getContactInfo($identifier, $identifierType, $startDate, $endDate): \Brevo\Client\Models\GetExtendedContactDetails +``` Get a contact's details -There are 2 ways to get a contact

Option 1- https://api.brevo.com/v3/contacts/{identifier}

Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={}

Option 1 only works if identifierType is email_id (for EMAIL), phone_id (for SMS) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL, SMS and ID of the contact.

Option 2 works for all identifierType, use email_id for EMAIL attribute, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute

Along with the contact details, this endpoint will show the statistics of contact for the recent 90 days by default. To fetch the earlier statistics, please use Get contact campaign stats ``https://developers.brevo.com/reference/contacts-7#getcontactstats`` endpoint with the appropriate date ranges. +There are 2 ways to get a contact

Option 1- https://api.brevo.com/v3/contacts/{identifier}

Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={}

Option 1 only works if identifierType is email_id (for EMAIL), phone_id (for SMS) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL, SMS and ID of the contact.

Option 2 works for all identifierType, use email_id for EMAIL attribute, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute

Along with the contact details, this endpoint will show the statistics of contact for the recent 90 days by default. To fetch the earlier statistics, please use Get contact campaign stats ``https://developers.brevo.com/reference/contacts-7#getcontactstats`` endpoint with the appropriate date ranges. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 ); -$identifier = "identifier_example"; // string | Email (urlencoded) OR ID of the contact OR its SMS attribute value OR EXT_ID attribute (urlencoded) -$identifierType = new \stdClass; // object | email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute -$startDate = "startDate_example"; // string | **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate -$endDate = "endDate_example"; // string | **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. +$identifier = new \Brevo\Client\Models\\Brevo\Client\Models\GetContactInfoIdentifierParameter(); // \Brevo\Client\Models\GetContactInfoIdentifierParameter | Email (urlencoded) OR ID of the contact OR its SMS attribute value OR EXT_ID attribute (urlencoded) +$identifierType = 'identifierType_example'; // string | email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute +$startDate = 'startDate_example'; // string | **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate +$endDate = 'endDate_example'; // string | **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. try { $result = $apiInstance->getContactInfo($identifier, $identifierType, $startDate, $endDate); @@ -765,21 +869,20 @@ try { } catch (Exception $e) { echo 'Exception when calling ContactsApi->getContactInfo: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **identifier** | **string**| Email (urlencoded) OR ID of the contact OR its SMS attribute value OR EXT_ID attribute (urlencoded) | - **identifierType** | [**object**](../Model/.md)| email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute | [optional] - **startDate** | **string**| **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate | [optional] - **endDate** | **string**| **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **identifier** | [**\Brevo\Client\Models\GetContactInfoIdentifierParameter**](../Model/.md)| Email (urlencoded) OR ID of the contact OR its SMS attribute value OR EXT_ID attribute (urlencoded) | | +| **identifierType** | **string**| email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute | [optional] | +| **startDate** | **string**| **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate | [optional] | +| **endDate** | **string**| **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. | [optional] | ### Return type -[**\Brevo\Client\Model\GetExtendedContactDetails**](../Model/GetExtendedContactDetails.md) +[**\Brevo\Client\Models\GetExtendedContactDetails**](../Model/GetExtendedContactDetails.md) ### Authorization @@ -787,39 +890,48 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `getContactStats()` -# **getContactStats** -> \Brevo\Client\Model\GetContactCampaignStats getContactStats($identifier, $startDate, $endDate) +```php +getContactStats($identifier, $startDate, $endDate): \Brevo\Client\Models\GetContactCampaignStats +``` Get email campaigns' statistics for a contact ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 ); -$identifier = "identifier_example"; // string | Email (urlencoded) OR ID of the contact -$startDate = "startDate_example"; // string | Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate -$endDate = "endDate_example"; // string | Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days +$identifier = new \Brevo\Client\Models\\Brevo\Client\Models\GetContactInfoIdentifierParameter(); // \Brevo\Client\Models\GetContactInfoIdentifierParameter | Email (urlencoded) OR ID of the contact +$startDate = 'startDate_example'; // string | **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate +$endDate = 'endDate_example'; // string | **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days try { $result = $apiInstance->getContactStats($identifier, $startDate, $endDate); @@ -827,20 +939,19 @@ try { } catch (Exception $e) { echo 'Exception when calling ContactsApi->getContactStats: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **identifier** | **string**| Email (urlencoded) OR ID of the contact | - **startDate** | **string**| Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate | [optional] - **endDate** | **string**| Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **identifier** | [**\Brevo\Client\Models\GetContactInfoIdentifierParameter**](../Model/.md)| Email (urlencoded) OR ID of the contact | | +| **startDate** | **string**| **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate | [optional] | +| **endDate** | **string**| **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days | [optional] | ### Return type -[**\Brevo\Client\Model\GetContactCampaignStats**](../Model/GetContactCampaignStats.md) +[**\Brevo\Client\Models\GetContactCampaignStats**](../Model/GetContactCampaignStats.md) ### Authorization @@ -848,30 +959,39 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getContacts** -> \Brevo\Client\Model\GetContacts getContacts($limit, $offset, $modifiedSince, $createdSince, $sort, $segmentId, $listIds, $filter) +## `getContacts()` + +```php +getContacts($limit, $offset, $modifiedSince, $createdSince, $sort, $segmentId, $listIds, $filter): \Brevo\Client\Models\GetContacts +``` Get all the contacts ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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. @@ -880,12 +1000,12 @@ $apiInstance = new Brevo\Client\Api\ContactsApi( ); $limit = 50; // int | Number of documents per page $offset = 0; // int | Index of the first document of the page -$modifiedSince = "modifiedSince_example"; // string | 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. -$createdSince = "createdSince_example"; // string | Filter (urlencoded) the contacts created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed -$segmentId = 789; // int | Id of the segment. **Either listIds or segmentId can be passed.** +$modifiedSince = 'modifiedSince_example'; // string | 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.** +$createdSince = 'createdSince_example'; // string | Filter (urlencoded) the contacts created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed +$segmentId = 56; // int | Id of the segment. **Either listIds or segmentId can be passed.** $listIds = array(56); // int[] | Ids of the list. **Either listIds or segmentId can be passed.** -$filter = "filter_example"; // string | Filter the contacts on the basis of attributes. **Allowed operator: equals. (e.g. filter=equals(FIRSTNAME,\"Antoine\"), filter=equals(B1, true), filter=equals(DOB, \"1989-11-23\"))** +$filter = 'filter_example'; // string | Filter the contacts on the basis of attributes. **Allowed operator: equals. (e.g. filter=equals(FIRSTNAME,\"Antoine\"), filter=equals(B1, true), filter=equals(DOB, \"1989-11-23\"))** try { $result = $apiInstance->getContacts($limit, $offset, $modifiedSince, $createdSince, $sort, $segmentId, $listIds, $filter); @@ -893,25 +1013,24 @@ try { } catch (Exception $e) { echo 'Exception when calling ContactsApi->getContacts: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **limit** | **int**| Number of documents per page | [optional] [default to 50] - **offset** | **int**| Index of the first document of the page | [optional] [default to 0] - **modifiedSince** | **string**| 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] - **createdSince** | **string**| Filter (urlencoded) the contacts created 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] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] - **segmentId** | **int**| Id of the segment. **Either listIds or segmentId can be passed.** | [optional] - **listIds** | [**int[]**](../Model/int.md)| Ids of the list. **Either listIds or segmentId can be passed.** | [optional] - **filter** | **string**| Filter the contacts on the basis of attributes. **Allowed operator: equals. (e.g. filter=equals(FIRSTNAME,\"Antoine\"), filter=equals(B1, true), filter=equals(DOB, \"1989-11-23\"))** | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Number of documents per page | [optional] [default to 50] | +| **offset** | **int**| Index of the first document of the page | [optional] [default to 0] | +| **modifiedSince** | **string**| 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] | +| **createdSince** | **string**| Filter (urlencoded) the contacts created 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] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | +| **segmentId** | **int**| Id of the segment. **Either listIds or segmentId can be passed.** | [optional] | +| **listIds** | [**int[]**](../Model/int.md)| Ids of the list. **Either listIds or segmentId can be passed.** | [optional] | +| **filter** | **string**| Filter the contacts on the basis of attributes. **Allowed operator: equals. (e.g. filter=equals(FIRSTNAME,\"Antoine\"), filter=equals(B1, true), filter=equals(DOB, \"1989-11-23\"))** | [optional] | ### Return type -[**\Brevo\Client\Model\GetContacts**](../Model/GetContacts.md) +[**\Brevo\Client\Models\GetContacts**](../Model/GetContacts.md) ### Authorization @@ -919,41 +1038,50 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getContactsFromList** -> \Brevo\Client\Model\GetContacts getContactsFromList($listId, $modifiedSince, $limit, $offset, $sort) +## `getContactsFromList()` + +```php +getContactsFromList($listId, $modifiedSince, $limit, $offset, $sort): \Brevo\Client\Models\GetContacts +``` Get contacts in a list ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 = "modifiedSince_example"; // string | 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. +$listId = 56; // int | Id of the list +$modifiedSince = 'modifiedSince_example'; // string | 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 -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed try { $result = $apiInstance->getContactsFromList($listId, $modifiedSince, $limit, $offset, $sort); @@ -961,22 +1089,21 @@ try { } catch (Exception $e) { echo 'Exception when calling ContactsApi->getContactsFromList: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **listId** | **int**| Id of the list | - **modifiedSince** | **string**| 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] - **limit** | **int**| Number of documents per page | [optional] [default to 50] - **offset** | **int**| Index of the first document of the page | [optional] [default to 0] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **listId** | **int**| Id of the list | | +| **modifiedSince** | **string**| 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] | +| **limit** | **int**| Number of documents per page | [optional] [default to 50] | +| **offset** | **int**| Index of the first document of the page | [optional] [default to 0] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | ### Return type -[**\Brevo\Client\Model\GetContacts**](../Model/GetContacts.md) +[**\Brevo\Client\Models\GetContacts**](../Model/GetContacts.md) ### Authorization @@ -984,37 +1111,46 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getFolder** -> \Brevo\Client\Model\GetFolder getFolder($folderId) +## `getFolder()` + +```php +getFolder($folderId): \Brevo\Client\Models\GetFolder +``` Returns a folder's details ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 +$folderId = 56; // int | id of the folder try { $result = $apiInstance->getFolder($folderId); @@ -1022,18 +1158,17 @@ try { } catch (Exception $e) { echo 'Exception when calling ContactsApi->getFolder: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **folderId** | **int**| id of the folder | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **folderId** | **int**| id of the folder | | ### Return type -[**\Brevo\Client\Model\GetFolder**](../Model/GetFolder.md) +[**\Brevo\Client\Models\GetFolder**](../Model/GetFolder.md) ### Authorization @@ -1041,40 +1176,49 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getFolderLists** -> \Brevo\Client\Model\GetFolderLists getFolderLists($folderId, $limit, $offset, $sort) +## `getFolderLists()` + +```php +getFolderLists($folderId, $limit, $offset, $sort): \Brevo\Client\Models\GetFolderLists +``` Get lists in a folder ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 +$folderId = 56; // int | Id of the folder $limit = 10; // int | Number of documents per page $offset = 0; // int | Index of the first document of the page -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed try { $result = $apiInstance->getFolderLists($folderId, $limit, $offset, $sort); @@ -1082,21 +1226,20 @@ try { } catch (Exception $e) { echo 'Exception when calling ContactsApi->getFolderLists: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **folderId** | **int**| Id of the folder | - **limit** | **int**| Number of documents per page | [optional] [default to 10] - **offset** | **int**| Index of the first document of the page | [optional] [default to 0] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **folderId** | **int**| Id of the folder | | +| **limit** | **int**| Number of documents per page | [optional] [default to 10] | +| **offset** | **int**| Index of the first document of the page | [optional] [default to 0] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | ### Return type -[**\Brevo\Client\Model\GetFolderLists**](../Model/GetFolderLists.md) +[**\Brevo\Client\Models\GetFolderLists**](../Model/GetFolderLists.md) ### Authorization @@ -1104,30 +1247,39 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getFolders** -> \Brevo\Client\Model\GetFolders getFolders($limit, $offset, $sort) +## `getFolders()` + +```php +getFolders($limit, $offset, $sort): \Brevo\Client\Models\GetFolders +``` Get all folders ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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. @@ -1136,7 +1288,7 @@ $apiInstance = new Brevo\Client\Api\ContactsApi( ); $limit = 10; // int | Number of documents per page $offset = 0; // int | Index of the first document of the page -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed try { $result = $apiInstance->getFolders($limit, $offset, $sort); @@ -1144,20 +1296,19 @@ try { } catch (Exception $e) { echo 'Exception when calling ContactsApi->getFolders: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **limit** | **int**| Number of documents per page | [default to 10] - **offset** | **int**| Index of the first document of the page | [default to 0] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Number of documents per page | [optional] [default to 10] | +| **offset** | **int**| Index of the first document of the page | [optional] [default to 0] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | ### Return type -[**\Brevo\Client\Model\GetFolders**](../Model/GetFolders.md) +[**\Brevo\Client\Models\GetFolders**](../Model/GetFolders.md) ### Authorization @@ -1165,39 +1316,48 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `getList()` -# **getList** -> \Brevo\Client\Model\GetExtendedList getList($listId, $startDate, $endDate) +```php +getList($listId, $startDate, $endDate): \Brevo\Client\Models\GetExtendedList +``` Get a list's details ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 -$startDate = "startDate_example"; // string | Mandatory if endDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id.Prefer to pass your timezone in date-time format for accurate result -$endDate = "endDate_example"; // string | Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id.Prefer to pass your timezone in date-time format for accurate result +$listId = 56; // int | Id of the list +$startDate = 'startDate_example'; // string | **Mandatory if endDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result** +$endDate = 'endDate_example'; // string | **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result** try { $result = $apiInstance->getList($listId, $startDate, $endDate); @@ -1205,20 +1365,19 @@ try { } catch (Exception $e) { echo 'Exception when calling ContactsApi->getList: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **listId** | **int**| Id of the list | - **startDate** | **string**| Mandatory if endDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id.Prefer to pass your timezone in date-time format for accurate result | [optional] - **endDate** | **string**| Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id.Prefer to pass your timezone in date-time format for accurate result | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **listId** | **int**| Id of the list | | +| **startDate** | **string**| **Mandatory if endDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result** | [optional] | +| **endDate** | **string**| **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result** | [optional] | ### Return type -[**\Brevo\Client\Model\GetExtendedList**](../Model/GetExtendedList.md) +[**\Brevo\Client\Models\GetExtendedList**](../Model/GetExtendedList.md) ### Authorization @@ -1226,30 +1385,39 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `getLists()` -# **getLists** -> \Brevo\Client\Model\GetLists getLists($limit, $offset, $sort) +```php +getLists($limit, $offset, $sort): \Brevo\Client\Models\GetLists +``` Get all the lists ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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. @@ -1258,7 +1426,7 @@ $apiInstance = new Brevo\Client\Api\ContactsApi( ); $limit = 10; // int | Number of documents per page $offset = 0; // int | Index of the first document of the page -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed try { $result = $apiInstance->getLists($limit, $offset, $sort); @@ -1266,20 +1434,19 @@ try { } catch (Exception $e) { echo 'Exception when calling ContactsApi->getLists: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **limit** | **int**| Number of documents per page | [optional] [default to 10] - **offset** | **int**| Index of the first document of the page | [optional] [default to 0] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Number of documents per page | [optional] [default to 10] | +| **offset** | **int**| Index of the first document of the page | [optional] [default to 0] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | ### Return type -[**\Brevo\Client\Model\GetLists**](../Model/GetLists.md) +[**\Brevo\Client\Models\GetLists**](../Model/GetLists.md) ### Authorization @@ -1287,30 +1454,39 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getSegments** -> \Brevo\Client\Model\GetSegments getSegments($limit, $offset, $sort) +## `getSegments()` -Get all the Segments +```php +getSegments($limit, $offset, $sort): \Brevo\Client\Models\GetSegments +``` + +Get all the segments ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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. @@ -1319,7 +1495,7 @@ $apiInstance = new Brevo\Client\Api\ContactsApi( ); $limit = 10; // int | Number of documents per page $offset = 0; // int | Index of the first document of the page -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed try { $result = $apiInstance->getSegments($limit, $offset, $sort); @@ -1327,20 +1503,19 @@ try { } catch (Exception $e) { echo 'Exception when calling ContactsApi->getSegments: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **limit** | **int**| Number of documents per page | [default to 10] - **offset** | **int**| Index of the first document of the page | [default to 0] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Number of documents per page | [optional] [default to 10] | +| **offset** | **int**| Index of the first document of the page | [optional] [default to 0] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | ### Return type -[**\Brevo\Client\Model\GetSegments**](../Model/GetSegments.md) +[**\Brevo\Client\Models\GetSegments**](../Model/GetSegments.md) ### Authorization @@ -1348,39 +1523,48 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `importContacts()` -# **importContacts** -> \Brevo\Client\Model\CreatedProcessId importContacts($requestContactImport) +```php +importContacts($requestContactImport): \Brevo\Client\Models\CreatedProcessId +``` Import contacts It returns the background process ID which on completion calls the notify URL that you have set in the input. **Note**: - Any contact attribute that doesn't exist in your account will be ignored at import end. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\RequestContactImport(); // \Brevo\Client\Model\RequestContactImport | Values to import contacts in Brevo. To know more about the expected format, please have a look at ``https://help.brevo.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` +$requestContactImport = new \Brevo\Client\Models\RequestContactImport(); // \Brevo\Client\Models\RequestContactImport | Values to import contacts in Brevo. To know more about the expected format, please have a look at ``https://help.brevo.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` try { $result = $apiInstance->importContacts($requestContactImport); @@ -1388,18 +1572,17 @@ try { } catch (Exception $e) { echo 'Exception when calling ContactsApi->importContacts: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **requestContactImport** | [**\Brevo\Client\Model\RequestContactImport**](../Model/RequestContactImport.md)| Values to import contacts in Brevo. To know more about the expected format, please have a look at ``https://help.brevo.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **requestContactImport** | [**\Brevo\Client\Models\RequestContactImport**](../Model/RequestContactImport.md)| Values to import contacts in Brevo. To know more about the expected format, please have a look at ``https://help.brevo.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` | | ### Return type -[**\Brevo\Client\Model\CreatedProcessId**](../Model/CreatedProcessId.md) +[**\Brevo\Client\Models\CreatedProcessId**](../Model/CreatedProcessId.md) ### Authorization @@ -1407,38 +1590,47 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **removeContactFromList** -> \Brevo\Client\Model\PostContactInfo removeContactFromList($listId, $contactEmails) +## `removeContactFromList()` + +```php +removeContactFromList($listId, $contactEmails): \Brevo\Client\Models\PostContactInfo +``` Delete a contact from a list ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\RemoveContactFromList(); // \Brevo\Client\Model\RemoveContactFromList | Emails addresses OR IDs of the contacts +$listId = 56; // int | Id of the list +$contactEmails = {"emails":["jeff32@example.com","jim56@example.com"]}; // \Brevo\Client\Models\RemoveContactFromListRequest | Emails adresses OR IDs OR EXT_ID attributes of the contacts OR 'all' true try { $result = $apiInstance->removeContactFromList($listId, $contactEmails); @@ -1446,19 +1638,18 @@ try { } catch (Exception $e) { echo 'Exception when calling ContactsApi->removeContactFromList: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **listId** | **int**| Id of the list | - **contactEmails** | [**\Brevo\Client\Model\RemoveContactFromList**](../Model/RemoveContactFromList.md)| Emails addresses OR IDs of the contacts | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **listId** | **int**| Id of the list | | +| **contactEmails** | [**\Brevo\Client\Models\RemoveContactFromListRequest**](../Model/RemoveContactFromListRequest.md)| Emails adresses OR IDs OR EXT_ID attributes of the contacts OR 'all' true | | ### Return type -[**\Brevo\Client\Model\PostContactInfo**](../Model/PostContactInfo.md) +[**\Brevo\Client\Models\PostContactInfo**](../Model/PostContactInfo.md) ### Authorization @@ -1466,39 +1657,48 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **requestContactExport** -> \Brevo\Client\Model\CreatedProcessId requestContactExport($requestContactExport) +## `requestContactExport()` + +```php +requestContactExport($requestContactExport): \Brevo\Client\Models\CreatedProcessId +``` Export contacts It returns the background process ID which on completion calls the notify URL that you have set in the input. File will be available in csv. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\RequestContactExport(); // \Brevo\Client\Model\RequestContactExport | Values to request a contact export +$requestContactExport = new \Brevo\Client\Models\RequestContactExport(); // \Brevo\Client\Models\RequestContactExport | Values to request a contact export try { $result = $apiInstance->requestContactExport($requestContactExport); @@ -1506,18 +1706,17 @@ try { } catch (Exception $e) { echo 'Exception when calling ContactsApi->requestContactExport: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **requestContactExport** | [**\Brevo\Client\Model\RequestContactExport**](../Model/RequestContactExport.md)| Values to request a contact export | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **requestContactExport** | [**\Brevo\Client\Models\RequestContactExport**](../Model/RequestContactExport.md)| Values to request a contact export | | ### Return type -[**\Brevo\Client\Model\CreatedProcessId**](../Model/CreatedProcessId.md) +[**\Brevo\Client\Models\CreatedProcessId**](../Model/CreatedProcessId.md) ### Authorization @@ -1525,55 +1724,63 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **updateAttribute** -> updateAttribute($attributeCategory, $attributeName, $updateAttribute) +## `updateAttribute()` + +```php +updateAttribute($attributeCategory, $attributeName, $updateAttribute) +``` Update contact attribute ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\UpdateAttribute(); // \Brevo\Client\Model\UpdateAttribute | Values to update an attribute +$attributeCategory = 'attributeCategory_example'; // string | Category of the attribute +$attributeName = 'attributeName_example'; // string | Name of the existing attribute +$updateAttribute = new \Brevo\Client\Models\UpdateAttribute(); // \Brevo\Client\Models\UpdateAttribute | Values to update an attribute try { $apiInstance->updateAttribute($attributeCategory, $attributeName, $updateAttribute); } catch (Exception $e) { echo 'Exception when calling ContactsApi->updateAttribute: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **attributeCategory** | **string**| Category of the attribute | - **attributeName** | **string**| Name of the existing attribute | - **updateAttribute** | [**\Brevo\Client\Model\UpdateAttribute**](../Model/UpdateAttribute.md)| Values to update an attribute | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **attributeCategory** | **string**| Category of the attribute | | +| **attributeName** | **string**| Name of the existing attribute | | +| **updateAttribute** | [**\Brevo\Client\Models\UpdateAttribute**](../Model/UpdateAttribute.md)| Values to update an attribute | | ### Return type @@ -1585,51 +1792,59 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **updateBatchContacts** -> updateBatchContacts($updateBatchContacts) +## `updateBatchContacts()` + +```php +updateBatchContacts($updateBatchContacts) +``` Update multiple contacts ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 ); -$updateBatchContacts = new \Brevo\Client\Model\UpdateBatchContacts(); // \Brevo\Client\Model\UpdateBatchContacts | Values to update multiple contacts +$updateBatchContacts = new \Brevo\Client\Models\UpdateBatchContacts(); // \Brevo\Client\Models\UpdateBatchContacts | Values to update multiple contacts try { $apiInstance->updateBatchContacts($updateBatchContacts); } catch (Exception $e) { echo 'Exception when calling ContactsApi->updateBatchContacts: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **updateBatchContacts** | [**\Brevo\Client\Model\UpdateBatchContacts**](../Model/UpdateBatchContacts.md)| Values to update multiple contacts | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **updateBatchContacts** | [**\Brevo\Client\Models\UpdateBatchContacts**](../Model/UpdateBatchContacts.md)| Values to update multiple contacts | | ### Return type @@ -1641,57 +1856,65 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **updateContact** -> updateContact($identifier, $updateContact, $identifierType) +## `updateContact()` + +```php +updateContact($identifier, $updateContact, $identifierType) +``` Update a contact There are 2 ways to update a contact

Option 1- https://api.brevo.com/v3/contacts/{identifier}

Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={}

Option 1 only works if identifierType is email_id (for EMAIL) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL and ID of the contact.

Option 2 works for all identifierType, use email_id for EMAIL attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 ); -$identifier = "identifier_example"; // string | Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value -$updateContact = new \Brevo\Client\Model\UpdateContact(); // \Brevo\Client\Model\UpdateContact | Values to update a contact -$identifierType = new \stdClass; // object | email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute +$identifier = new \Brevo\Client\Models\\Brevo\Client\Models\GetContactInfoIdentifierParameter(); // \Brevo\Client\Models\GetContactInfoIdentifierParameter | Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value +$updateContact = new \Brevo\Client\Models\UpdateContact(); // \Brevo\Client\Models\UpdateContact | Values to update a contact +$identifierType = 'identifierType_example'; // string | email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute try { $apiInstance->updateContact($identifier, $updateContact, $identifierType); } catch (Exception $e) { echo 'Exception when calling ContactsApi->updateContact: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **identifier** | **string**| Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value | - **updateContact** | [**\Brevo\Client\Model\UpdateContact**](../Model/UpdateContact.md)| Values to update a contact | - **identifierType** | [**object**](../Model/.md)| email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **identifier** | [**\Brevo\Client\Models\GetContactInfoIdentifierParameter**](../Model/.md)| Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value | | +| **updateContact** | [**\Brevo\Client\Models\UpdateContact**](../Model/UpdateContact.md)| Values to update a contact | | +| **identifierType** | **string**| email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute | [optional] | ### Return type @@ -1703,53 +1926,61 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `updateFolder()` -# **updateFolder** -> updateFolder($folderId, $updateFolder) +```php +updateFolder($folderId, $updateFolder) +``` Update a folder ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\CreateUpdateFolder(); // \Brevo\Client\Model\CreateUpdateFolder | Name of the folder +$folderId = 56; // int | Id of the folder +$updateFolder = new \Brevo\Client\Models\CreateUpdateFolder(); // \Brevo\Client\Models\CreateUpdateFolder | Name of the folder try { $apiInstance->updateFolder($folderId, $updateFolder); } catch (Exception $e) { echo 'Exception when calling ContactsApi->updateFolder: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **folderId** | **int**| Id of the folder | - **updateFolder** | [**\Brevo\Client\Model\CreateUpdateFolder**](../Model/CreateUpdateFolder.md)| Name of the folder | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **folderId** | **int**| Id of the folder | | +| **updateFolder** | [**\Brevo\Client\Models\CreateUpdateFolder**](../Model/CreateUpdateFolder.md)| Name of the folder | | ### Return type @@ -1761,53 +1992,61 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **updateList** -> updateList($listId, $updateList) +## `updateList()` + +```php +updateList($listId, $updateList) +``` Update a list ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\UpdateList(); // \Brevo\Client\Model\UpdateList | Values to update a list +$listId = 56; // int | Id of the list +$updateList = new \Brevo\Client\Models\UpdateList(); // \Brevo\Client\Models\UpdateList | Values to update a list try { $apiInstance->updateList($listId, $updateList); } catch (Exception $e) { echo 'Exception when calling ContactsApi->updateList: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **listId** | **int**| Id of the list | - **updateList** | [**\Brevo\Client\Model\UpdateList**](../Model/UpdateList.md)| Values to update a list | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **listId** | **int**| Id of the list | | +| **updateList** | [**\Brevo\Client\Models\UpdateList**](../Model/UpdateList.md)| Values to update a list | | ### Return type @@ -1819,8 +2058,9 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: `application/json` +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/ConversationsApi.md b/docs/Api/ConversationsApi.md index 429514d..19dc061 100644 --- a/docs/Api/ConversationsApi.md +++ b/docs/Api/ConversationsApi.md @@ -1,62 +1,68 @@ # Brevo\Client\ConversationsApi -All URIs are relative to *https://api.brevo.com/v3* +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**conversationsAgentOnlinePingPost**](ConversationsApi.md#conversationsAgentOnlinePingPost) | **POST** /conversations/agentOnlinePing | Sets agent’s status to online for 2-3 minutes -[**conversationsMessagesIdDelete**](ConversationsApi.md#conversationsMessagesIdDelete) | **DELETE** /conversations/messages/{id} | Delete a message sent by an agent -[**conversationsMessagesIdGet**](ConversationsApi.md#conversationsMessagesIdGet) | **GET** /conversations/messages/{id} | Get a message -[**conversationsMessagesIdPut**](ConversationsApi.md#conversationsMessagesIdPut) | **PUT** /conversations/messages/{id} | Update a message sent by an agent -[**conversationsMessagesPost**](ConversationsApi.md#conversationsMessagesPost) | **POST** /conversations/messages | Send a message as an agent -[**conversationsPushedMessagesIdDelete**](ConversationsApi.md#conversationsPushedMessagesIdDelete) | **DELETE** /conversations/pushedMessages/{id} | Delete an automated message -[**conversationsPushedMessagesIdGet**](ConversationsApi.md#conversationsPushedMessagesIdGet) | **GET** /conversations/pushedMessages/{id} | Get an automated message -[**conversationsPushedMessagesIdPut**](ConversationsApi.md#conversationsPushedMessagesIdPut) | **PUT** /conversations/pushedMessages/{id} | Update an automated message -[**conversationsPushedMessagesPost**](ConversationsApi.md#conversationsPushedMessagesPost) | **POST** /conversations/pushedMessages | Send an automated message to a visitor +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**conversationsAgentOnlinePingPost()**](ConversationsApi.md#conversationsAgentOnlinePingPost) | **POST** /conversations/agentOnlinePing | Sets agent’s status to online for 2-3 minutes | +| [**conversationsMessagesIdDelete()**](ConversationsApi.md#conversationsMessagesIdDelete) | **DELETE** /conversations/messages/{id} | Delete a message sent by an agent | +| [**conversationsMessagesIdGet()**](ConversationsApi.md#conversationsMessagesIdGet) | **GET** /conversations/messages/{id} | Get a message | +| [**conversationsMessagesIdPut()**](ConversationsApi.md#conversationsMessagesIdPut) | **PUT** /conversations/messages/{id} | Update a message sent by an agent | +| [**conversationsMessagesPost()**](ConversationsApi.md#conversationsMessagesPost) | **POST** /conversations/messages | Send a message as an agent | +| [**conversationsPushedMessagesIdDelete()**](ConversationsApi.md#conversationsPushedMessagesIdDelete) | **DELETE** /conversations/pushedMessages/{id} | Delete an automated message | +| [**conversationsPushedMessagesIdGet()**](ConversationsApi.md#conversationsPushedMessagesIdGet) | **GET** /conversations/pushedMessages/{id} | Get an automated message | +| [**conversationsPushedMessagesIdPut()**](ConversationsApi.md#conversationsPushedMessagesIdPut) | **PUT** /conversations/pushedMessages/{id} | Update an automated message | +| [**conversationsPushedMessagesPost()**](ConversationsApi.md#conversationsPushedMessagesPost) | **POST** /conversations/pushedMessages | Send an automated message to a visitor | -# **conversationsAgentOnlinePingPost** -> conversationsAgentOnlinePingPost($body) +## `conversationsAgentOnlinePingPost()` + +```php +conversationsAgentOnlinePingPost($conversationsAgentOnlinePingPostRequest) +``` Sets agent’s status to online for 2-3 minutes We recommend pinging this endpoint every minute for as long as the agent has to be considered online. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\ConversationsApi( // 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 ); -$body = new \Brevo\Client\Model\Body14(); // \Brevo\Client\Model\Body14 | Agent fields. +$conversationsAgentOnlinePingPostRequest = {"agentId":"d9nKoegKSjmCtyK78"}; // \Brevo\Client\Models\ConversationsAgentOnlinePingPostRequest try { - $apiInstance->conversationsAgentOnlinePingPost($body); + $apiInstance->conversationsAgentOnlinePingPost($conversationsAgentOnlinePingPostRequest); } catch (Exception $e) { echo 'Exception when calling ConversationsApi->conversationsAgentOnlinePingPost: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**\Brevo\Client\Model\Body14**](../Model/Body14.md)| Agent fields. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **conversationsAgentOnlinePingPostRequest** | [**\Brevo\Client\Models\ConversationsAgentOnlinePingPostRequest**](../Model/ConversationsAgentOnlinePingPostRequest.md)| | | ### Return type @@ -68,53 +74,61 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `conversationsMessagesIdDelete()` -# **conversationsMessagesIdDelete** -> conversationsMessagesIdDelete($id) +```php +conversationsMessagesIdDelete($id) +``` Delete a message sent by an agent Only agents’ messages can be deleted. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\ConversationsApi( // 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 ); -$id = "id_example"; // string | ID of the message +$id = 'id_example'; // string | ID of the message try { $apiInstance->conversationsMessagesIdDelete($id); } catch (Exception $e) { echo 'Exception when calling ConversationsApi->conversationsMessagesIdDelete: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| ID of the message | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| ID of the message | | ### Return type @@ -126,37 +140,46 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **conversationsMessagesIdGet** -> \Brevo\Client\Model\ConversationsMessage conversationsMessagesIdGet($id) +## `conversationsMessagesIdGet()` + +```php +conversationsMessagesIdGet($id): \Brevo\Client\Models\ConversationsMessage +``` Get a message ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\ConversationsApi( // 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 ); -$id = "id_example"; // string | ID of the message +$id = 'id_example'; // string | ID of the message try { $result = $apiInstance->conversationsMessagesIdGet($id); @@ -164,18 +187,17 @@ try { } catch (Exception $e) { echo 'Exception when calling ConversationsApi->conversationsMessagesIdGet: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| ID of the message | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| ID of the message | | ### Return type -[**\Brevo\Client\Model\ConversationsMessage**](../Model/ConversationsMessage.md) +[**\Brevo\Client\Models\ConversationsMessage**](../Model/ConversationsMessage.md) ### Authorization @@ -183,60 +205,68 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `conversationsMessagesIdPut()` -# **conversationsMessagesIdPut** -> \Brevo\Client\Model\ConversationsMessage conversationsMessagesIdPut($id, $body) +```php +conversationsMessagesIdPut($id, $conversationsMessagesIdPutRequest): \Brevo\Client\Models\ConversationsMessage +``` Update a message sent by an agent Only agents’ messages can be edited. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\ConversationsApi( // 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 ); -$id = "id_example"; // string | ID of the message -$body = new \Brevo\Client\Model\Body11(); // \Brevo\Client\Model\Body11 | +$id = 'id_example'; // string | ID of the message +$conversationsMessagesIdPutRequest = {"text":"Good morning! How can I help you?"}; // \Brevo\Client\Models\ConversationsMessagesIdPutRequest try { - $result = $apiInstance->conversationsMessagesIdPut($id, $body); + $result = $apiInstance->conversationsMessagesIdPut($id, $conversationsMessagesIdPutRequest); print_r($result); } catch (Exception $e) { echo 'Exception when calling ConversationsApi->conversationsMessagesIdPut: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| ID of the message | - **body** | [**\Brevo\Client\Model\Body11**](../Model/Body11.md)| | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| ID of the message | | +| **conversationsMessagesIdPutRequest** | [**\Brevo\Client\Models\ConversationsMessagesIdPutRequest**](../Model/ConversationsMessagesIdPutRequest.md)| | | ### Return type -[**\Brevo\Client\Model\ConversationsMessage**](../Model/ConversationsMessage.md) +[**\Brevo\Client\Models\ConversationsMessage**](../Model/ConversationsMessage.md) ### Authorization @@ -244,56 +274,64 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **conversationsMessagesPost** -> \Brevo\Client\Model\ConversationsMessage conversationsMessagesPost($body) +## `conversationsMessagesPost()` + +```php +conversationsMessagesPost($conversationsMessagesPostRequest): \Brevo\Client\Models\ConversationsMessage +``` Send a message as an agent ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\ConversationsApi( // 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 ); -$body = new \Brevo\Client\Model\Body10(); // \Brevo\Client\Model\Body10 | Message fields. +$conversationsMessagesPostRequest = {"visitorId":"kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg","text":"Hello! How can I help you?","agentId":"d9nKoegKSjmCtyK78"}; // \Brevo\Client\Models\ConversationsMessagesPostRequest try { - $result = $apiInstance->conversationsMessagesPost($body); + $result = $apiInstance->conversationsMessagesPost($conversationsMessagesPostRequest); print_r($result); } catch (Exception $e) { echo 'Exception when calling ConversationsApi->conversationsMessagesPost: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**\Brevo\Client\Model\Body10**](../Model/Body10.md)| Message fields. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **conversationsMessagesPostRequest** | [**\Brevo\Client\Models\ConversationsMessagesPostRequest**](../Model/ConversationsMessagesPostRequest.md)| | | ### Return type -[**\Brevo\Client\Model\ConversationsMessage**](../Model/ConversationsMessage.md) +[**\Brevo\Client\Models\ConversationsMessage**](../Model/ConversationsMessage.md) ### Authorization @@ -301,51 +339,59 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `conversationsPushedMessagesIdDelete()` -# **conversationsPushedMessagesIdDelete** -> conversationsPushedMessagesIdDelete($id) +```php +conversationsPushedMessagesIdDelete($id) +``` Delete an automated message ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\ConversationsApi( // 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 ); -$id = "id_example"; // string | ID of the message +$id = 'id_example'; // string | ID of the message try { $apiInstance->conversationsPushedMessagesIdDelete($id); } catch (Exception $e) { echo 'Exception when calling ConversationsApi->conversationsPushedMessagesIdDelete: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| ID of the message | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| ID of the message | | ### Return type @@ -357,37 +403,46 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **conversationsPushedMessagesIdGet** -> \Brevo\Client\Model\ConversationsMessage conversationsPushedMessagesIdGet($id) +## `conversationsPushedMessagesIdGet()` + +```php +conversationsPushedMessagesIdGet($id): \Brevo\Client\Models\ConversationsMessage +``` Get an automated message ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\ConversationsApi( // 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 ); -$id = "id_example"; // string | ID of the message sent previously +$id = 'id_example'; // string | ID of the message sent previously try { $result = $apiInstance->conversationsPushedMessagesIdGet($id); @@ -395,18 +450,17 @@ try { } catch (Exception $e) { echo 'Exception when calling ConversationsApi->conversationsPushedMessagesIdGet: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| ID of the message sent previously | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| ID of the message sent previously | | ### Return type -[**\Brevo\Client\Model\ConversationsMessage**](../Model/ConversationsMessage.md) +[**\Brevo\Client\Models\ConversationsMessage**](../Model/ConversationsMessage.md) ### Authorization @@ -414,58 +468,66 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `conversationsPushedMessagesIdPut()` -# **conversationsPushedMessagesIdPut** -> \Brevo\Client\Model\ConversationsMessage conversationsPushedMessagesIdPut($id, $body) +```php +conversationsPushedMessagesIdPut($id, $conversationsMessagesIdPutRequest): \Brevo\Client\Models\ConversationsMessage +``` Update an automated message ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\ConversationsApi( // 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 ); -$id = "id_example"; // string | ID of the message -$body = new \Brevo\Client\Model\Body13(); // \Brevo\Client\Model\Body13 | +$id = 'id_example'; // string | ID of the message +$conversationsMessagesIdPutRequest = {"text":"Your order has shipped! Here’s your tracking number: 9114 5847 4668 7775 9233 54"}; // \Brevo\Client\Models\ConversationsMessagesIdPutRequest try { - $result = $apiInstance->conversationsPushedMessagesIdPut($id, $body); + $result = $apiInstance->conversationsPushedMessagesIdPut($id, $conversationsMessagesIdPutRequest); print_r($result); } catch (Exception $e) { echo 'Exception when calling ConversationsApi->conversationsPushedMessagesIdPut: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| ID of the message | - **body** | [**\Brevo\Client\Model\Body13**](../Model/Body13.md)| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| ID of the message | | +| **conversationsMessagesIdPutRequest** | [**\Brevo\Client\Models\ConversationsMessagesIdPutRequest**](../Model/ConversationsMessagesIdPutRequest.md)| | | ### Return type -[**\Brevo\Client\Model\ConversationsMessage**](../Model/ConversationsMessage.md) +[**\Brevo\Client\Models\ConversationsMessage**](../Model/ConversationsMessage.md) ### Authorization @@ -473,58 +535,66 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **conversationsPushedMessagesPost** -> \Brevo\Client\Model\ConversationsMessage conversationsPushedMessagesPost($body) +## `conversationsPushedMessagesPost()` + +```php +conversationsPushedMessagesPost($conversationsPushedMessagesPostRequest): \Brevo\Client\Models\ConversationsMessage +``` Send an automated message to a visitor Example of automated messages: order status, announce new features in your web app, etc. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\ConversationsApi( // 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 ); -$body = new \Brevo\Client\Model\Body12(); // \Brevo\Client\Model\Body12 | +$conversationsPushedMessagesPostRequest = {"visitorId":"kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg","text":"Your order has shipped! Here’s your tracking number: 9114 5847 3325 9667 4328 88"}; // \Brevo\Client\Models\ConversationsPushedMessagesPostRequest try { - $result = $apiInstance->conversationsPushedMessagesPost($body); + $result = $apiInstance->conversationsPushedMessagesPost($conversationsPushedMessagesPostRequest); print_r($result); } catch (Exception $e) { echo 'Exception when calling ConversationsApi->conversationsPushedMessagesPost: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**\Brevo\Client\Model\Body12**](../Model/Body12.md)| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **conversationsPushedMessagesPostRequest** | [**\Brevo\Client\Models\ConversationsPushedMessagesPostRequest**](../Model/ConversationsPushedMessagesPostRequest.md)| | | ### Return type -[**\Brevo\Client\Model\ConversationsMessage**](../Model/ConversationsMessage.md) +[**\Brevo\Client\Models\ConversationsMessage**](../Model/ConversationsMessage.md) ### Authorization @@ -532,8 +602,9 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: `application/json` +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/CouponsApi.md b/docs/Api/CouponsApi.md index e8acc32..729c5e4 100644 --- a/docs/Api/CouponsApi.md +++ b/docs/Api/CouponsApi.md @@ -1,61 +1,67 @@ # Brevo\Client\CouponsApi -All URIs are relative to *https://api.brevo.com/v3* +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createCouponCollection**](CouponsApi.md#createCouponCollection) | **POST** /couponCollections | Create а coupon collection -[**createCoupons**](CouponsApi.md#createCoupons) | **POST** /coupons | Create coupons for a coupon collection -[**getCouponCollection**](CouponsApi.md#getCouponCollection) | **GET** /couponCollections/{id} | Get a coupon collection by id -[**getCouponCollections**](CouponsApi.md#getCouponCollections) | **GET** /couponCollections | Get all your coupon collections -[**updateCouponCollection**](CouponsApi.md#updateCouponCollection) | **PATCH** /couponCollections/{id} | Update a coupon collection by id +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createCouponCollection()**](CouponsApi.md#createCouponCollection) | **POST** /couponCollections | Create а coupon collection | +| [**createCoupons()**](CouponsApi.md#createCoupons) | **POST** /coupons | Create coupons for a coupon collection | +| [**getCouponCollection()**](CouponsApi.md#getCouponCollection) | **GET** /couponCollections/{id} | Get a coupon collection by id | +| [**getCouponCollections()**](CouponsApi.md#getCouponCollections) | **GET** /couponCollections | Get all your coupon collections | +| [**updateCouponCollection()**](CouponsApi.md#updateCouponCollection) | **PATCH** /couponCollections/{id} | Update a coupon collection by id | -# **createCouponCollection** -> \Brevo\Client\Model\InlineResponse2013 createCouponCollection($createCouponCollection) +## `createCouponCollection()` + +```php +createCouponCollection($createCouponCollectionRequest): \Brevo\Client\Models\CreateCouponCollection201Response +``` Create а coupon collection ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\CouponsApi( // 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 ); -$createCouponCollection = new \Brevo\Client\Model\CreateCouponCollection(); // \Brevo\Client\Model\CreateCouponCollection | Values to create a coupon collection +$createCouponCollectionRequest = new \Brevo\Client\Models\CreateCouponCollectionRequest(); // \Brevo\Client\Models\CreateCouponCollectionRequest | Values to create a coupon collection try { - $result = $apiInstance->createCouponCollection($createCouponCollection); + $result = $apiInstance->createCouponCollection($createCouponCollectionRequest); print_r($result); } catch (Exception $e) { echo 'Exception when calling CouponsApi->createCouponCollection: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **createCouponCollection** | [**\Brevo\Client\Model\CreateCouponCollection**](../Model/CreateCouponCollection.md)| Values to create a coupon collection | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **createCouponCollectionRequest** | [**\Brevo\Client\Models\CreateCouponCollectionRequest**](../Model/CreateCouponCollectionRequest.md)| Values to create a coupon collection | | ### Return type -[**\Brevo\Client\Model\InlineResponse2013**](../Model/InlineResponse2013.md) +[**\Brevo\Client\Models\CreateCouponCollection201Response**](../Model/CreateCouponCollection201Response.md) ### Authorization @@ -63,51 +69,59 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **createCoupons** -> createCoupons($createCoupons) +## `createCoupons()` + +```php +createCoupons($createCouponsRequest) +``` Create coupons for a coupon collection ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\CouponsApi( // 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 ); -$createCoupons = new \Brevo\Client\Model\CreateCoupons(); // \Brevo\Client\Model\CreateCoupons | Values to create coupons +$createCouponsRequest = new \Brevo\Client\Models\CreateCouponsRequest(); // \Brevo\Client\Models\CreateCouponsRequest | Values to create coupons try { - $apiInstance->createCoupons($createCoupons); + $apiInstance->createCoupons($createCouponsRequest); } catch (Exception $e) { echo 'Exception when calling CouponsApi->createCoupons: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **createCoupons** | [**\Brevo\Client\Model\CreateCoupons**](../Model/CreateCoupons.md)| Values to create coupons | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **createCouponsRequest** | [**\Brevo\Client\Models\CreateCouponsRequest**](../Model/CreateCouponsRequest.md)| Values to create coupons | | ### Return type @@ -119,37 +133,46 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getCouponCollection** -> \Brevo\Client\Model\GetCouponCollection getCouponCollection($id) +## `getCouponCollection()` + +```php +getCouponCollection($id): \Brevo\Client\Models\GetCouponCollection +``` Get a coupon collection by id ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\CouponsApi( // 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 ); -$id = "id_example"; // string | Id of the collection to return +$id = 'id_example'; // string | Id of the collection to return try { $result = $apiInstance->getCouponCollection($id); @@ -157,18 +180,17 @@ try { } catch (Exception $e) { echo 'Exception when calling CouponsApi->getCouponCollection: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| Id of the collection to return | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| Id of the collection to return | | ### Return type -[**\Brevo\Client\Model\GetCouponCollection**](../Model/GetCouponCollection.md) +[**\Brevo\Client\Models\GetCouponCollection**](../Model/GetCouponCollection.md) ### Authorization @@ -176,30 +198,39 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getCouponCollections** -> \Brevo\Client\Model\GetCouponCollection getCouponCollections($limit, $offset, $sort) +## `getCouponCollections()` + +```php +getCouponCollections($limit, $offset, $sort, $sortBy): \Brevo\Client\Models\GetCouponCollection +``` Get all your coupon collections ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\CouponsApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. @@ -208,28 +239,29 @@ $apiInstance = new Brevo\Client\Api\CouponsApi( ); $limit = 50; // int | Number of documents returned per page $offset = 0; // int | Index of the first document on the page -$sort = "desc"; // string | Sort the results by creation time in ascending/descending order +$sort = 'desc'; // string | Sort the results by creation time in ascending/descending order +$sortBy = 'createdAt'; // string | The field used to sort coupon collections try { - $result = $apiInstance->getCouponCollections($limit, $offset, $sort); + $result = $apiInstance->getCouponCollections($limit, $offset, $sort, $sortBy); print_r($result); } catch (Exception $e) { echo 'Exception when calling CouponsApi->getCouponCollections: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **limit** | **int**| Number of documents returned per page | [optional] [default to 50] - **offset** | **int**| Index of the first document on the page | [optional] [default to 0] - **sort** | **string**| Sort the results by creation time in ascending/descending order | [optional] [default to desc] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Number of documents returned per page | [optional] [default to 50] | +| **offset** | **int**| Index of the first document on the page | [optional] [default to 0] | +| **sort** | **string**| Sort the results by creation time in ascending/descending order | [optional] [default to 'desc'] | +| **sortBy** | **string**| The field used to sort coupon collections | [optional] [default to 'createdAt'] | ### Return type -[**\Brevo\Client\Model\GetCouponCollection**](../Model/GetCouponCollection.md) +[**\Brevo\Client\Models\GetCouponCollection**](../Model/GetCouponCollection.md) ### Authorization @@ -237,58 +269,66 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **updateCouponCollection** -> \Brevo\Client\Model\InlineResponse2002 updateCouponCollection($id, $updateCouponCollection) +## `updateCouponCollection()` + +```php +updateCouponCollection($id, $updateCouponCollectionRequest): \Brevo\Client\Models\UpdateCouponCollection200Response +``` Update a coupon collection by id ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\CouponsApi( // 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 ); -$id = "id_example"; // string | Id of the collection to update -$updateCouponCollection = new \Brevo\Client\Model\UpdateCouponCollection(); // \Brevo\Client\Model\UpdateCouponCollection | Values to update the coupon collection +$id = 'id_example'; // string | Id of the collection to update +$updateCouponCollectionRequest = new \Brevo\Client\Models\UpdateCouponCollectionRequest(); // \Brevo\Client\Models\UpdateCouponCollectionRequest | Values to update the coupon collection try { - $result = $apiInstance->updateCouponCollection($id, $updateCouponCollection); + $result = $apiInstance->updateCouponCollection($id, $updateCouponCollectionRequest); print_r($result); } catch (Exception $e) { echo 'Exception when calling CouponsApi->updateCouponCollection: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| Id of the collection to update | - **updateCouponCollection** | [**\Brevo\Client\Model\UpdateCouponCollection**](../Model/UpdateCouponCollection.md)| Values to update the coupon collection | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| Id of the collection to update | | +| **updateCouponCollectionRequest** | [**\Brevo\Client\Models\UpdateCouponCollectionRequest**](../Model/UpdateCouponCollectionRequest.md)| Values to update the coupon collection | [optional] | ### Return type -[**\Brevo\Client\Model\InlineResponse2002**](../Model/InlineResponse2002.md) +[**\Brevo\Client\Models\UpdateCouponCollection200Response**](../Model/UpdateCouponCollection200Response.md) ### Authorization @@ -296,8 +336,9 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: `application/json` +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/DealsApi.md b/docs/Api/DealsApi.md index 27b1a9e..5670fde 100644 --- a/docs/Api/DealsApi.md +++ b/docs/Api/DealsApi.md @@ -1,40 +1,48 @@ # Brevo\Client\DealsApi -All URIs are relative to *https://api.brevo.com/v3* +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**crmAttributesDealsGet**](DealsApi.md#crmAttributesDealsGet) | **GET** /crm/attributes/deals | Get deal attributes -[**crmDealsGet**](DealsApi.md#crmDealsGet) | **GET** /crm/deals | Get all deals -[**crmDealsIdDelete**](DealsApi.md#crmDealsIdDelete) | **DELETE** /crm/deals/{id} | Delete a deal -[**crmDealsIdGet**](DealsApi.md#crmDealsIdGet) | **GET** /crm/deals/{id} | Get a deal -[**crmDealsIdPatch**](DealsApi.md#crmDealsIdPatch) | **PATCH** /crm/deals/{id} | Update a deal -[**crmDealsLinkUnlinkIdPatch**](DealsApi.md#crmDealsLinkUnlinkIdPatch) | **PATCH** /crm/deals/link-unlink/{id} | Link and Unlink a deal with contacts and companies -[**crmDealsPost**](DealsApi.md#crmDealsPost) | **POST** /crm/deals | Create a deal -[**crmPipelineDetailsAllGet**](DealsApi.md#crmPipelineDetailsAllGet) | **GET** /crm/pipeline/details/all | Get all pipelines -[**crmPipelineDetailsGet**](DealsApi.md#crmPipelineDetailsGet) | **GET** /crm/pipeline/details | Get pipeline stages -[**crmPipelineDetailsPipelineIDGet**](DealsApi.md#crmPipelineDetailsPipelineIDGet) | **GET** /crm/pipeline/details/{pipelineID} | Get a pipeline +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**crmAttributesDealsGet()**](DealsApi.md#crmAttributesDealsGet) | **GET** /crm/attributes/deals | Get deal attributes | +| [**crmDealsGet()**](DealsApi.md#crmDealsGet) | **GET** /crm/deals | Get all deals | +| [**crmDealsIdDelete()**](DealsApi.md#crmDealsIdDelete) | **DELETE** /crm/deals/{id} | Delete a deal | +| [**crmDealsIdGet()**](DealsApi.md#crmDealsIdGet) | **GET** /crm/deals/{id} | Get a deal | +| [**crmDealsIdPatch()**](DealsApi.md#crmDealsIdPatch) | **PATCH** /crm/deals/{id} | Update a deal | +| [**crmDealsImportPost()**](DealsApi.md#crmDealsImportPost) | **POST** /crm/deals/import | Import deals(creation and updation) | +| [**crmDealsLinkUnlinkIdPatch()**](DealsApi.md#crmDealsLinkUnlinkIdPatch) | **PATCH** /crm/deals/link-unlink/{id} | Link and Unlink a deal with contacts and companies | +| [**crmDealsPost()**](DealsApi.md#crmDealsPost) | **POST** /crm/deals | Create a deal | +| [**crmPipelineDetailsAllGet()**](DealsApi.md#crmPipelineDetailsAllGet) | **GET** /crm/pipeline/details/all | Get all pipelines | +| [**crmPipelineDetailsGet()**](DealsApi.md#crmPipelineDetailsGet) | **GET** /crm/pipeline/details | Get pipeline stages | +| [**crmPipelineDetailsPipelineIDGet()**](DealsApi.md#crmPipelineDetailsPipelineIDGet) | **GET** /crm/pipeline/details/{pipelineID} | Get a pipeline | -# **crmAttributesDealsGet** -> \Brevo\Client\Model\DealAttributes crmAttributesDealsGet() +## `crmAttributesDealsGet()` + +```php +crmAttributesDealsGet(): \Brevo\Client\Models\DealAttributesInner[] +``` Get deal attributes ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\DealsApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. @@ -48,15 +56,15 @@ try { } catch (Exception $e) { echo 'Exception when calling DealsApi->crmAttributesDealsGet: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters + This endpoint does not need any parameter. ### Return type -[**\Brevo\Client\Model\DealAttributes**](../Model/DealAttributes.md) +[**\Brevo\Client\Models\DealAttributesInner[]**](../Model/DealAttributesInner.md) ### Authorization @@ -64,68 +72,74 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **crmDealsGet** -> \Brevo\Client\Model\DealsList crmDealsGet($filtersAttributesDealName, $filtersLinkedCompaniesIds, $filtersLinkedContactsIds, $offset, $limit, $sort, $sortBy) +## `crmDealsGet()` + +```php +crmDealsGet($filtersAttributesDealName, $filtersLinkedCompaniesIds, $filtersLinkedContactsIds, $offset, $limit, $sort): \Brevo\Client\Models\DealsList +``` Get all deals ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\DealsApi( // 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 ); -$filtersAttributesDealName = "filtersAttributesDealName_example"; // string | Filter by attributes. If you have filter for owner on your side please send it as `filters[attributes.deal_owner]`.\" -$filtersLinkedCompaniesIds = "filtersLinkedCompaniesIds_example"; // string | Filter by linked companies ids -$filtersLinkedContactsIds = "filtersLinkedContactsIds_example"; // string | Filter by linked companies ids -$offset = 789; // int | Index of the first document of the page -$limit = 50; // int | Number of documents per page -$sort = "sort_example"; // string | Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed -$sortBy = "sortBy_example"; // string | The field used to sort field names. +$filtersAttributesDealName = 'filtersAttributesDealName_example'; // string | Filter by attributes. If you have a filter for the owner on your end, please send it as filters[attributes.deal_owner] and utilize the account email for the filtering. +$filtersLinkedCompaniesIds = 'filtersLinkedCompaniesIds_example'; // string | Filter by linked companies ids +$filtersLinkedContactsIds = 'filtersLinkedContactsIds_example'; // string | Filter by linked companies ids +$offset = 56; // int | Index of the first document of the page +$limit = 56; // int | Number of documents per page +$sort = 'sort_example'; // string | Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed try { - $result = $apiInstance->crmDealsGet($filtersAttributesDealName, $filtersLinkedCompaniesIds, $filtersLinkedContactsIds, $offset, $limit, $sort, $sortBy); + $result = $apiInstance->crmDealsGet($filtersAttributesDealName, $filtersLinkedCompaniesIds, $filtersLinkedContactsIds, $offset, $limit, $sort); print_r($result); } catch (Exception $e) { echo 'Exception when calling DealsApi->crmDealsGet: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **filtersAttributesDealName** | **string**| Filter by attributes. If you have filter for owner on your side please send it as `filters[attributes.deal_owner]`.\" | [optional] - **filtersLinkedCompaniesIds** | **string**| Filter by linked companies ids | [optional] - **filtersLinkedContactsIds** | **string**| Filter by linked companies ids | [optional] - **offset** | **int**| Index of the first document of the page | [optional] - **limit** | **int**| Number of documents per page | [optional] [default to 50] - **sort** | **string**| Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed | [optional] - **sortBy** | **string**| The field used to sort field names. | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **filtersAttributesDealName** | **string**| Filter by attributes. If you have a filter for the owner on your end, please send it as filters[attributes.deal_owner] and utilize the account email for the filtering. | [optional] | +| **filtersLinkedCompaniesIds** | **string**| Filter by linked companies ids | [optional] | +| **filtersLinkedContactsIds** | **string**| Filter by linked companies ids | [optional] | +| **offset** | **int**| Index of the first document of the page | [optional] | +| **limit** | **int**| Number of documents per page | [optional] | +| **sort** | **string**| Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed | [optional] | ### Return type -[**\Brevo\Client\Model\DealsList**](../Model/DealsList.md) +[**\Brevo\Client\Models\DealsList**](../Model/DealsList.md) ### Authorization @@ -133,51 +147,59 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `crmDealsIdDelete()` -# **crmDealsIdDelete** -> crmDealsIdDelete($id) +```php +crmDealsIdDelete($id) +``` Delete a deal ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\DealsApi( // 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 ); -$id = "id_example"; // string | +$id = 'id_example'; // string try { $apiInstance->crmDealsIdDelete($id); } catch (Exception $e) { echo 'Exception when calling DealsApi->crmDealsIdDelete: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| | | ### Return type @@ -189,37 +211,46 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **crmDealsIdGet** -> \Brevo\Client\Model\Deal crmDealsIdGet($id) +## `crmDealsIdGet()` + +```php +crmDealsIdGet($id): \Brevo\Client\Models\Deal +``` Get a deal ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\DealsApi( // 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 ); -$id = "id_example"; // string | +$id = 'id_example'; // string try { $result = $apiInstance->crmDealsIdGet($id); @@ -227,18 +258,17 @@ try { } catch (Exception $e) { echo 'Exception when calling DealsApi->crmDealsIdGet: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| | | ### Return type -[**\Brevo\Client\Model\Deal**](../Model/Deal.md) +[**\Brevo\Client\Models\Deal**](../Model/Deal.md) ### Authorization @@ -246,53 +276,61 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `crmDealsIdPatch()` -# **crmDealsIdPatch** -> crmDealsIdPatch($id, $body) +```php +crmDealsIdPatch($id, $crmDealsIdPatchRequest) +``` Update a deal ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\DealsApi( // 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 ); -$id = "id_example"; // string | -$body = new \Brevo\Client\Model\Body6(); // \Brevo\Client\Model\Body6 | Updated deal details. +$id = 'id_example'; // string +$crmDealsIdPatchRequest = new \Brevo\Client\Models\CrmDealsIdPatchRequest(); // \Brevo\Client\Models\CrmDealsIdPatchRequest | Updated deal details. try { - $apiInstance->crmDealsIdPatch($id, $body); + $apiInstance->crmDealsIdPatch($id, $crmDealsIdPatchRequest); } catch (Exception $e) { echo 'Exception when calling DealsApi->crmDealsIdPatch: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| | - **body** | [**\Brevo\Client\Model\Body6**](../Model/Body6.md)| Updated deal details. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| | | +| **crmDealsIdPatchRequest** | [**\Brevo\Client\Models\CrmDealsIdPatchRequest**](../Model/CrmDealsIdPatchRequest.md)| Updated deal details. | | ### Return type @@ -304,53 +342,130 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `crmDealsImportPost()` + +```php +crmDealsImportPost($file, $mapping): \Brevo\Client\Models\CompaniesImportPost200Response +``` + +Import deals(creation and updation) + +Import deals from a CSV file with mapping options. + +### Example -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +```php + crmDealsLinkUnlinkIdPatch($id, $body) + +// Configure API key authorization: api-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\DealsApi( + // 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 +); +$file = "/path/to/file.txt"; // \SplFileObject | The CSV file to upload.The file should have the first row as the mapping attribute. Some default attribute names are (a) deal_id [brevo mongoID to update deals] (b) associated_contact (c) associated_company (f) any other attribute with internal name +$mapping = array('key' => new \stdClass); // object | The mapping options in JSON format. Here is an example of the JSON structure: ```json { \\\"link_entities\\\": true, // Determines whether to link related entities during the import process \\\"unlink_entities\\\": false, // Determines whether to unlink related entities during the import process \\\"update_existing_records\\\": true, // Determines whether to update based on company ID or treat every row as create \\\"unset_empty_attributes\\\": false // Determines whether to unset a specific attribute during update if the values input is blank } ``` + +try { + $result = $apiInstance->crmDealsImportPost($file, $mapping); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DealsApi->crmDealsImportPost: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **file** | **\SplFileObject****\SplFileObject**| The CSV file to upload.The file should have the first row as the mapping attribute. Some default attribute names are (a) deal_id [brevo mongoID to update deals] (b) associated_contact (c) associated_company (f) any other attribute with internal name | [optional] | +| **mapping** | [**object**](../Model/object.md)| The mapping options in JSON format. Here is an example of the JSON structure: ```json { \\\"link_entities\\\": true, // Determines whether to link related entities during the import process \\\"unlink_entities\\\": false, // Determines whether to unlink related entities during the import process \\\"update_existing_records\\\": true, // Determines whether to update based on company ID or treat every row as create \\\"unset_empty_attributes\\\": false // Determines whether to unset a specific attribute during update if the values input is blank } ``` | [optional] | + +### Return type + +[**\Brevo\Client\Models\CompaniesImportPost200Response**](../Model/CompaniesImportPost200Response.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `multipart/form-data` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `crmDealsLinkUnlinkIdPatch()` + +```php +crmDealsLinkUnlinkIdPatch($id, $crmDealsLinkUnlinkIdPatchRequest) +``` Link and Unlink a deal with contacts and companies ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\DealsApi( // 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 ); -$id = "id_example"; // string | -$body = new \Brevo\Client\Model\Body7(); // \Brevo\Client\Model\Body7 | Linked / Unlinked contacts and companies ids. +$id = 'id_example'; // string +$crmDealsLinkUnlinkIdPatchRequest = new \Brevo\Client\Models\CrmDealsLinkUnlinkIdPatchRequest(); // \Brevo\Client\Models\CrmDealsLinkUnlinkIdPatchRequest | Linked / Unlinked contacts and companies ids. try { - $apiInstance->crmDealsLinkUnlinkIdPatch($id, $body); + $apiInstance->crmDealsLinkUnlinkIdPatch($id, $crmDealsLinkUnlinkIdPatchRequest); } catch (Exception $e) { echo 'Exception when calling DealsApi->crmDealsLinkUnlinkIdPatch: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| | - **body** | [**\Brevo\Client\Model\Body7**](../Model/Body7.md)| Linked / Unlinked contacts and companies ids. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| | | +| **crmDealsLinkUnlinkIdPatchRequest** | [**\Brevo\Client\Models\CrmDealsLinkUnlinkIdPatchRequest**](../Model/CrmDealsLinkUnlinkIdPatchRequest.md)| Linked / Unlinked contacts and companies ids. | | ### Return type @@ -362,56 +477,64 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **crmDealsPost** -> \Brevo\Client\Model\InlineResponse2011 crmDealsPost($body) +## `crmDealsPost()` + +```php +crmDealsPost($crmDealsPostRequest): \Brevo\Client\Models\CrmDealsPost201Response +``` Create a deal ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\DealsApi( // 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 ); -$body = new \Brevo\Client\Model\Body5(); // \Brevo\Client\Model\Body5 | Deal create data. +$crmDealsPostRequest = new \Brevo\Client\Models\CrmDealsPostRequest(); // \Brevo\Client\Models\CrmDealsPostRequest | Deal create data. try { - $result = $apiInstance->crmDealsPost($body); + $result = $apiInstance->crmDealsPost($crmDealsPostRequest); print_r($result); } catch (Exception $e) { echo 'Exception when calling DealsApi->crmDealsPost: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**\Brevo\Client\Model\Body5**](../Model/Body5.md)| Deal create data. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **crmDealsPostRequest** | [**\Brevo\Client\Models\CrmDealsPostRequest**](../Model/CrmDealsPostRequest.md)| Deal create data. | | ### Return type -[**\Brevo\Client\Model\InlineResponse2011**](../Model/InlineResponse2011.md) +[**\Brevo\Client\Models\CrmDealsPost201Response**](../Model/CrmDealsPost201Response.md) ### Authorization @@ -419,30 +542,39 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `crmPipelineDetailsAllGet()` -# **crmPipelineDetailsAllGet** -> \Brevo\Client\Model\Pipelines crmPipelineDetailsAllGet() +```php +crmPipelineDetailsAllGet(): \Brevo\Client\Models\Pipeline[] +``` Get all pipelines ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\DealsApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. @@ -456,15 +588,15 @@ try { } catch (Exception $e) { echo 'Exception when calling DealsApi->crmPipelineDetailsAllGet: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters + This endpoint does not need any parameter. ### Return type -[**\Brevo\Client\Model\Pipelines**](../Model/Pipelines.md) +[**\Brevo\Client\Models\Pipeline[]**](../Model/Pipeline.md) ### Authorization @@ -472,32 +604,41 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **crmPipelineDetailsGet** -> \Brevo\Client\Model\Pipeline crmPipelineDetailsGet() +## `crmPipelineDetailsGet()` + +```php +crmPipelineDetailsGet(): \Brevo\Client\Models\Pipeline +``` Get pipeline stages This endpoint is deprecated. Prefer /crm/pipeline/details/{pipelineID} instead. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\DealsApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. @@ -511,15 +652,15 @@ try { } catch (Exception $e) { echo 'Exception when calling DealsApi->crmPipelineDetailsGet: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters + This endpoint does not need any parameter. ### Return type -[**\Brevo\Client\Model\Pipeline**](../Model/Pipeline.md) +[**\Brevo\Client\Models\Pipeline**](../Model/Pipeline.md) ### Authorization @@ -527,37 +668,46 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **crmPipelineDetailsPipelineIDGet** -> \Brevo\Client\Model\Pipelines crmPipelineDetailsPipelineIDGet($pipelineID) +## `crmPipelineDetailsPipelineIDGet()` + +```php +crmPipelineDetailsPipelineIDGet($pipelineID): \Brevo\Client\Models\Pipeline[] +``` Get a pipeline ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\DealsApi( // 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 ); -$pipelineID = "pipelineID_example"; // string | +$pipelineID = 'pipelineID_example'; // string try { $result = $apiInstance->crmPipelineDetailsPipelineIDGet($pipelineID); @@ -565,18 +715,17 @@ try { } catch (Exception $e) { echo 'Exception when calling DealsApi->crmPipelineDetailsPipelineIDGet: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pipelineID** | **string**| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **pipelineID** | **string**| | | ### Return type -[**\Brevo\Client\Model\Pipelines**](../Model/Pipelines.md) +[**\Brevo\Client\Models\Pipeline[]**](../Model/Pipeline.md) ### Authorization @@ -584,8 +733,9 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: Not defined +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/DomainsApi.md b/docs/Api/DomainsApi.md index 29d9a47..d523dc0 100644 --- a/docs/Api/DomainsApi.md +++ b/docs/Api/DomainsApi.md @@ -1,42 +1,49 @@ # Brevo\Client\DomainsApi -All URIs are relative to *https://api.brevo.com/v3* +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**authenticateDomain**](DomainsApi.md#authenticateDomain) | **PUT** /senders/domains/{domainName}/authenticate | Authenticate a domain -[**createDomain**](DomainsApi.md#createDomain) | **POST** /senders/domains | Create a new domain -[**deleteDomain**](DomainsApi.md#deleteDomain) | **DELETE** /senders/domains/{domainName} | Delete a domain -[**getDomainConfiguration**](DomainsApi.md#getDomainConfiguration) | **GET** /senders/domains/{domainName} | Validate domain configuration -[**getDomains**](DomainsApi.md#getDomains) | **GET** /senders/domains | Get the list of all your domains +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**authenticateDomain()**](DomainsApi.md#authenticateDomain) | **PUT** /senders/domains/{domainName}/authenticate | Authenticate a domain | +| [**createDomain()**](DomainsApi.md#createDomain) | **POST** /senders/domains | Create a new domain | +| [**deleteDomain()**](DomainsApi.md#deleteDomain) | **DELETE** /senders/domains/{domainName} | Delete a domain | +| [**getDomainConfiguration()**](DomainsApi.md#getDomainConfiguration) | **GET** /senders/domains/{domainName} | Validate domain configuration | +| [**getDomains()**](DomainsApi.md#getDomains) | **GET** /senders/domains | Get the list of all your domains | -# **authenticateDomain** -> \Brevo\Client\Model\AuthenticateDomainModel authenticateDomain($domainName) +## `authenticateDomain()` + +```php +authenticateDomain($domainName): \Brevo\Client\Models\AuthenticateDomainModel +``` Authenticate a domain ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\DomainsApi( // 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 ); -$domainName = "domainName_example"; // string | Domain name +$domainName = 'domainName_example'; // string | Domain name try { $result = $apiInstance->authenticateDomain($domainName); @@ -44,18 +51,17 @@ try { } catch (Exception $e) { echo 'Exception when calling DomainsApi->authenticateDomain: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **domainName** | **string**| Domain name | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **domainName** | **string**| Domain name | | ### Return type -[**\Brevo\Client\Model\AuthenticateDomainModel**](../Model/AuthenticateDomainModel.md) +[**\Brevo\Client\Models\AuthenticateDomainModel**](../Model/AuthenticateDomainModel.md) ### Authorization @@ -63,56 +69,64 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `createDomain()` -# **createDomain** -> \Brevo\Client\Model\CreateDomainModel createDomain($domainName) +```php +createDomain($domain): \Brevo\Client\Models\CreateDomainModel +``` Create a new domain ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\DomainsApi( // 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 ); -$domainName = new \Brevo\Client\Model\CreateDomain(); // \Brevo\Client\Model\CreateDomain | domain's name +$domain = new \Brevo\Client\Models\CreateDomain(); // \Brevo\Client\Models\CreateDomain | domain's name try { - $result = $apiInstance->createDomain($domainName); + $result = $apiInstance->createDomain($domain); print_r($result); } catch (Exception $e) { echo 'Exception when calling DomainsApi->createDomain: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **domainName** | [**\Brevo\Client\Model\CreateDomain**](../Model/CreateDomain.md)| domain's name | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **domain** | [**\Brevo\Client\Models\CreateDomain**](../Model/CreateDomain.md)| domain's name | [optional] | ### Return type -[**\Brevo\Client\Model\CreateDomainModel**](../Model/CreateDomainModel.md) +[**\Brevo\Client\Models\CreateDomainModel**](../Model/CreateDomainModel.md) ### Authorization @@ -120,51 +134,59 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **deleteDomain** -> deleteDomain($domainName) +## `deleteDomain()` + +```php +deleteDomain($domainName) +``` Delete a domain ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\DomainsApi( // 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 ); -$domainName = "domainName_example"; // string | Domain name +$domainName = 'domainName_example'; // string | Domain name try { $apiInstance->deleteDomain($domainName); } catch (Exception $e) { echo 'Exception when calling DomainsApi->deleteDomain: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **domainName** | **string**| Domain name | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **domainName** | **string**| Domain name | | ### Return type @@ -176,37 +198,46 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `getDomainConfiguration()` -# **getDomainConfiguration** -> \Brevo\Client\Model\GetDomainConfigurationModel getDomainConfiguration($domainName) +```php +getDomainConfiguration($domainName): \Brevo\Client\Models\GetDomainConfigurationModel +``` Validate domain configuration ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\DomainsApi( // 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 ); -$domainName = "domainName_example"; // string | Domain name +$domainName = 'domainName_example'; // string | Domain name try { $result = $apiInstance->getDomainConfiguration($domainName); @@ -214,18 +245,17 @@ try { } catch (Exception $e) { echo 'Exception when calling DomainsApi->getDomainConfiguration: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **domainName** | **string**| Domain name | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **domainName** | **string**| Domain name | | ### Return type -[**\Brevo\Client\Model\GetDomainConfigurationModel**](../Model/GetDomainConfigurationModel.md) +[**\Brevo\Client\Models\GetDomainConfigurationModel**](../Model/GetDomainConfigurationModel.md) ### Authorization @@ -233,30 +263,39 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getDomains** -> \Brevo\Client\Model\GetDomainsList getDomains() +## `getDomains()` + +```php +getDomains(): \Brevo\Client\Models\GetDomainsList +``` Get the list of all your domains ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\DomainsApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. @@ -270,15 +309,15 @@ try { } catch (Exception $e) { echo 'Exception when calling DomainsApi->getDomains: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters + This endpoint does not need any parameter. ### Return type -[**\Brevo\Client\Model\GetDomainsList**](../Model/GetDomainsList.md) +[**\Brevo\Client\Models\GetDomainsList**](../Model/GetDomainsList.md) ### Authorization @@ -286,8 +325,9 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: Not defined +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/EcommerceApi.md b/docs/Api/EcommerceApi.md index caf3e5a..677d3d4 100644 --- a/docs/Api/EcommerceApi.md +++ b/docs/Api/EcommerceApi.md @@ -1,69 +1,81 @@ # Brevo\Client\EcommerceApi -All URIs are relative to *https://api.brevo.com/v3* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createBatchOrder**](EcommerceApi.md#createBatchOrder) | **POST** /orders/status/batch | Create orders in batch -[**createOrder**](EcommerceApi.md#createOrder) | **POST** /orders/status | Managing the status of the order -[**createUpdateBatchCategory**](EcommerceApi.md#createUpdateBatchCategory) | **POST** /categories/batch | Create categories in batch -[**createUpdateBatchProducts**](EcommerceApi.md#createUpdateBatchProducts) | **POST** /products/batch | Create products in batch -[**createUpdateCategory**](EcommerceApi.md#createUpdateCategory) | **POST** /categories | Create/Update a category -[**createUpdateProduct**](EcommerceApi.md#createUpdateProduct) | **POST** /products | Create/Update a product -[**ecommerceActivatePost**](EcommerceApi.md#ecommerceActivatePost) | **POST** /ecommerce/activate | Activate the eCommerce app -[**getCategories**](EcommerceApi.md#getCategories) | **GET** /categories | Return all your categories -[**getCategoryInfo**](EcommerceApi.md#getCategoryInfo) | **GET** /categories/{id} | Get a category details -[**getOrders**](EcommerceApi.md#getOrders) | **GET** /orders | Get order details -[**getProductInfo**](EcommerceApi.md#getProductInfo) | **GET** /products/{id} | Get a product's details -[**getProducts**](EcommerceApi.md#getProducts) | **GET** /products | Return all your products - - -# **createBatchOrder** -> createBatchOrder($orderBatch) +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createBatchOrder()**](EcommerceApi.md#createBatchOrder) | **POST** /orders/status/batch | Create orders in batch | +| [**createOrder()**](EcommerceApi.md#createOrder) | **POST** /orders/status | Managing the status of the order | +| [**createUpdateBatchCategory()**](EcommerceApi.md#createUpdateBatchCategory) | **POST** /categories/batch | Create categories in batch | +| [**createUpdateBatchProducts()**](EcommerceApi.md#createUpdateBatchProducts) | **POST** /products/batch | Create products in batch | +| [**createUpdateCategory()**](EcommerceApi.md#createUpdateCategory) | **POST** /categories | Create/Update a category | +| [**createUpdateProduct()**](EcommerceApi.md#createUpdateProduct) | **POST** /products | Create/Update a product | +| [**ecommerceActivatePost()**](EcommerceApi.md#ecommerceActivatePost) | **POST** /ecommerce/activate | Activate the eCommerce app | +| [**ecommerceAttributionMetricsConversionSourceConversionSourceIdGet()**](EcommerceApi.md#ecommerceAttributionMetricsConversionSourceConversionSourceIdGet) | **GET** /ecommerce/attribution/metrics/{conversionSource}/{conversionSourceId} | Get detailed attribution metrics for a single Brevo campaign | +| [**ecommerceAttributionMetricsGet()**](EcommerceApi.md#ecommerceAttributionMetricsGet) | **GET** /ecommerce/attribution/metrics | Get attribution metrics for one or more Brevo campaigns | +| [**ecommerceAttributionProductsConversionSourceConversionSourceIdGet()**](EcommerceApi.md#ecommerceAttributionProductsConversionSourceConversionSourceIdGet) | **GET** /ecommerce/attribution/products/{conversionSource}/{conversionSourceId} | Get attributed product sales for a single Brevo campaign | +| [**ecommerceConfigDisplayCurrencyGet()**](EcommerceApi.md#ecommerceConfigDisplayCurrencyGet) | **GET** /ecommerce/config/displayCurrency | Get the ISO 4217 compliant display currency code for your Brevo account | +| [**getCategories()**](EcommerceApi.md#getCategories) | **GET** /categories | Return all your categories | +| [**getCategoryInfo()**](EcommerceApi.md#getCategoryInfo) | **GET** /categories/{id} | Get a category details | +| [**getOrders()**](EcommerceApi.md#getOrders) | **GET** /orders | Get order details | +| [**getProductInfo()**](EcommerceApi.md#getProductInfo) | **GET** /products/{id} | Get a product's details | +| [**getProducts()**](EcommerceApi.md#getProducts) | **GET** /products | Return all your products | +| [**setConfigDisplayCurrency()**](EcommerceApi.md#setConfigDisplayCurrency) | **POST** /ecommerce/config/displayCurrency | Set the ISO 4217 compliant display currency code for your Brevo account | + + +## `createBatchOrder()` + +```php +createBatchOrder($orderBatch): \Brevo\Client\Models\CreatedBatchId +``` Create orders in batch Create multiple orders at one time instead of one order at a time ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\EcommerceApi( // 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 ); -$orderBatch = new \Brevo\Client\Model\OrderBatch(); // \Brevo\Client\Model\OrderBatch | +$orderBatch = new \Brevo\Client\Models\OrderBatch(); // \Brevo\Client\Models\OrderBatch try { - $apiInstance->createBatchOrder($orderBatch); + $result = $apiInstance->createBatchOrder($orderBatch); + print_r($result); } catch (Exception $e) { echo 'Exception when calling EcommerceApi->createBatchOrder: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **orderBatch** | [**\Brevo\Client\Model\OrderBatch**](../Model/OrderBatch.md)| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **orderBatch** | [**\Brevo\Client\Models\OrderBatch**](../Model/OrderBatch.md)| | | ### Return type -void (empty response body) +[**\Brevo\Client\Models\CreatedBatchId**](../Model/CreatedBatchId.md) ### Authorization @@ -71,53 +83,61 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **createOrder** -> createOrder($order) +## `createOrder()` + +```php +createOrder($order) +``` Managing the status of the order Manages the transactional status of the order ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\EcommerceApi( // 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 ); -$order = new \Brevo\Client\Model\Order(); // \Brevo\Client\Model\Order | +$order = new \Brevo\Client\Models\Order(); // \Brevo\Client\Models\Order try { $apiInstance->createOrder($order); } catch (Exception $e) { echo 'Exception when calling EcommerceApi->createOrder: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **order** | [**\Brevo\Client\Model\Order**](../Model/Order.md)| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **order** | [**\Brevo\Client\Models\Order**](../Model/Order.md)| | | ### Return type @@ -129,37 +149,46 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **createUpdateBatchCategory** -> \Brevo\Client\Model\CreateUpdateBatchCategoryModel createUpdateBatchCategory($createUpdateBatchCategory) +## `createUpdateBatchCategory()` + +```php +createUpdateBatchCategory($createUpdateBatchCategory): \Brevo\Client\Models\CreateUpdateBatchCategoryModel +``` Create categories in batch ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\EcommerceApi( // 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 ); -$createUpdateBatchCategory = new \Brevo\Client\Model\CreateUpdateBatchCategory(); // \Brevo\Client\Model\CreateUpdateBatchCategory | Values to create a batch of categories +$createUpdateBatchCategory = new \Brevo\Client\Models\CreateUpdateBatchCategory(); // \Brevo\Client\Models\CreateUpdateBatchCategory | Values to create a batch of categories try { $result = $apiInstance->createUpdateBatchCategory($createUpdateBatchCategory); @@ -167,18 +196,17 @@ try { } catch (Exception $e) { echo 'Exception when calling EcommerceApi->createUpdateBatchCategory: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **createUpdateBatchCategory** | [**\Brevo\Client\Model\CreateUpdateBatchCategory**](../Model/CreateUpdateBatchCategory.md)| Values to create a batch of categories | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **createUpdateBatchCategory** | [**\Brevo\Client\Models\CreateUpdateBatchCategory**](../Model/CreateUpdateBatchCategory.md)| Values to create a batch of categories | | ### Return type -[**\Brevo\Client\Model\CreateUpdateBatchCategoryModel**](../Model/CreateUpdateBatchCategoryModel.md) +[**\Brevo\Client\Models\CreateUpdateBatchCategoryModel**](../Model/CreateUpdateBatchCategoryModel.md) ### Authorization @@ -186,37 +214,46 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `createUpdateBatchProducts()` -# **createUpdateBatchProducts** -> \Brevo\Client\Model\CreateUpdateBatchProductsModel createUpdateBatchProducts($createUpdateBatchProducts) +```php +createUpdateBatchProducts($createUpdateBatchProducts): \Brevo\Client\Models\CreateUpdateBatchProductsModel +``` Create products in batch ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\EcommerceApi( // 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 ); -$createUpdateBatchProducts = new \Brevo\Client\Model\CreateUpdateBatchProducts(); // \Brevo\Client\Model\CreateUpdateBatchProducts | Values to create a batch of products +$createUpdateBatchProducts = new \Brevo\Client\Models\CreateUpdateBatchProducts(); // \Brevo\Client\Models\CreateUpdateBatchProducts | Values to create a batch of products try { $result = $apiInstance->createUpdateBatchProducts($createUpdateBatchProducts); @@ -224,18 +261,17 @@ try { } catch (Exception $e) { echo 'Exception when calling EcommerceApi->createUpdateBatchProducts: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **createUpdateBatchProducts** | [**\Brevo\Client\Model\CreateUpdateBatchProducts**](../Model/CreateUpdateBatchProducts.md)| Values to create a batch of products | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **createUpdateBatchProducts** | [**\Brevo\Client\Models\CreateUpdateBatchProducts**](../Model/CreateUpdateBatchProducts.md)| Values to create a batch of products | | ### Return type -[**\Brevo\Client\Model\CreateUpdateBatchProductsModel**](../Model/CreateUpdateBatchProductsModel.md) +[**\Brevo\Client\Models\CreateUpdateBatchProductsModel**](../Model/CreateUpdateBatchProductsModel.md) ### Authorization @@ -243,37 +279,46 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `createUpdateCategory()` -# **createUpdateCategory** -> \Brevo\Client\Model\CreateCategoryModel createUpdateCategory($createUpdateCategory) +```php +createUpdateCategory($createUpdateCategory): \Brevo\Client\Models\CreateCategoryModel +``` Create/Update a category ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\EcommerceApi( // 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 ); -$createUpdateCategory = new \Brevo\Client\Model\CreateUpdateCategory(); // \Brevo\Client\Model\CreateUpdateCategory | Values to create/update a category +$createUpdateCategory = new \Brevo\Client\Models\CreateUpdateCategory(); // \Brevo\Client\Models\CreateUpdateCategory | Values to create/update a category try { $result = $apiInstance->createUpdateCategory($createUpdateCategory); @@ -281,18 +326,17 @@ try { } catch (Exception $e) { echo 'Exception when calling EcommerceApi->createUpdateCategory: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **createUpdateCategory** | [**\Brevo\Client\Model\CreateUpdateCategory**](../Model/CreateUpdateCategory.md)| Values to create/update a category | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **createUpdateCategory** | [**\Brevo\Client\Models\CreateUpdateCategory**](../Model/CreateUpdateCategory.md)| Values to create/update a category | | ### Return type -[**\Brevo\Client\Model\CreateCategoryModel**](../Model/CreateCategoryModel.md) +[**\Brevo\Client\Models\CreateCategoryModel**](../Model/CreateCategoryModel.md) ### Authorization @@ -300,37 +344,46 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `createUpdateProduct()` -# **createUpdateProduct** -> \Brevo\Client\Model\CreateProductModel createUpdateProduct($createUpdateProduct) +```php +createUpdateProduct($createUpdateProduct): \Brevo\Client\Models\CreateProductModel +``` Create/Update a product ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\EcommerceApi( // 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 ); -$createUpdateProduct = new \Brevo\Client\Model\CreateUpdateProduct(); // \Brevo\Client\Model\CreateUpdateProduct | Values to create/update a product +$createUpdateProduct = new \Brevo\Client\Models\CreateUpdateProduct(); // \Brevo\Client\Models\CreateUpdateProduct | Values to create/update a product try { $result = $apiInstance->createUpdateProduct($createUpdateProduct); @@ -338,18 +391,17 @@ try { } catch (Exception $e) { echo 'Exception when calling EcommerceApi->createUpdateProduct: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **createUpdateProduct** | [**\Brevo\Client\Model\CreateUpdateProduct**](../Model/CreateUpdateProduct.md)| Values to create/update a product | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **createUpdateProduct** | [**\Brevo\Client\Models\CreateUpdateProduct**](../Model/CreateUpdateProduct.md)| Values to create/update a product | | ### Return type -[**\Brevo\Client\Model\CreateProductModel**](../Model/CreateProductModel.md) +[**\Brevo\Client\Models\CreateProductModel**](../Model/CreateProductModel.md) ### Authorization @@ -357,32 +409,41 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `ecommerceActivatePost()` -# **ecommerceActivatePost** -> ecommerceActivatePost() +```php +ecommerceActivatePost() +``` Activate the eCommerce app Getting access to Brevo eCommerce. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\EcommerceApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. @@ -395,10 +456,10 @@ try { } catch (Exception $e) { echo 'Exception when calling EcommerceApi->ecommerceActivatePost: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters + This endpoint does not need any parameter. ### Return type @@ -411,30 +472,304 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `ecommerceAttributionMetricsConversionSourceConversionSourceIdGet()` + +```php +ecommerceAttributionMetricsConversionSourceConversionSourceIdGet($conversionSource, $conversionSourceId): \Brevo\Client\Models\EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response +``` + +Get detailed attribution metrics for a single Brevo campaign + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\EcommerceApi( + // 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 +); +$conversionSource = 'conversionSource_example'; // string | The Brevo campaign type for which data will be retrieved +$conversionSourceId = 1; // float | The Brevo campaign id for which data will be retrieved + +try { + $result = $apiInstance->ecommerceAttributionMetricsConversionSourceConversionSourceIdGet($conversionSource, $conversionSourceId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EcommerceApi->ecommerceAttributionMetricsConversionSourceConversionSourceIdGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **conversionSource** | **string**| The Brevo campaign type for which data will be retrieved | | +| **conversionSourceId** | **float**| The Brevo campaign id for which data will be retrieved | | + +### Return type + +[**\Brevo\Client\Models\EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response**](../Model/EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getCategories** -> \Brevo\Client\Model\GetCategories getCategories($limit, $offset, $sort, $ids, $name, $modifiedSince, $createdSince) +## `ecommerceAttributionMetricsGet()` + +```php +ecommerceAttributionMetricsGet($periodFrom, $periodTo, $emailCampaignId): \Brevo\Client\Models\EcommerceAttributionMetricsGet200Response +``` + +Get attribution metrics for one or more Brevo campaigns + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\EcommerceApi( + // 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 +); +$periodFrom = 2022-01-02T00:00Z; // \DateTime | When getting metrics for a specific period, define the starting datetime in RFC3339 format +$periodTo = 2022-01-03T00:00Z; // \DateTime | When getting metrics for a specific period, define the end datetime in RFC3339 format +$emailCampaignId = array(3.4); // float[] | The email campaign id(s) to get metrics for + +try { + $result = $apiInstance->ecommerceAttributionMetricsGet($periodFrom, $periodTo, $emailCampaignId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EcommerceApi->ecommerceAttributionMetricsGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **periodFrom** | **\DateTime**| When getting metrics for a specific period, define the starting datetime in RFC3339 format | [optional] | +| **periodTo** | **\DateTime**| When getting metrics for a specific period, define the end datetime in RFC3339 format | [optional] | +| **emailCampaignId** | [**float[]**](../Model/float.md)| The email campaign id(s) to get metrics for | [optional] | + +### Return type + +[**\Brevo\Client\Models\EcommerceAttributionMetricsGet200Response**](../Model/EcommerceAttributionMetricsGet200Response.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `ecommerceAttributionProductsConversionSourceConversionSourceIdGet()` + +```php +ecommerceAttributionProductsConversionSourceConversionSourceIdGet($conversionSource, $conversionSourceId): \Brevo\Client\Models\EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response +``` + +Get attributed product sales for a single Brevo campaign + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\EcommerceApi( + // 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 +); +$conversionSource = 'conversionSource_example'; // string | The Brevo campaign type for which data will be retrieved +$conversionSourceId = 1; // float | The Brevo campaign id for which data will be retrieved + +try { + $result = $apiInstance->ecommerceAttributionProductsConversionSourceConversionSourceIdGet($conversionSource, $conversionSourceId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EcommerceApi->ecommerceAttributionProductsConversionSourceConversionSourceIdGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **conversionSource** | **string**| The Brevo campaign type for which data will be retrieved | | +| **conversionSourceId** | **float**| The Brevo campaign id for which data will be retrieved | | + +### Return type + +[**\Brevo\Client\Models\EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response**](../Model/EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `ecommerceConfigDisplayCurrencyGet()` + +```php +ecommerceConfigDisplayCurrencyGet(): \Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response +``` + +Get the ISO 4217 compliant display currency code for your Brevo account + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\EcommerceApi( + // 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 = $apiInstance->ecommerceConfigDisplayCurrencyGet(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EcommerceApi->ecommerceConfigDisplayCurrencyGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response**](../Model/EcommerceConfigDisplayCurrencyGet200Response.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getCategories()` + +```php +getCategories($limit, $offset, $sort, $ids, $name, $modifiedSince, $createdSince): \Brevo\Client\Models\GetCategories +``` Return all your categories ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\EcommerceApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. @@ -443,11 +778,11 @@ $apiInstance = new Brevo\Client\Api\EcommerceApi( ); $limit = 50; // int | Number of documents per page $offset = 0; // int | Index of the first document in the page -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed -$ids = array("ids_example"); // string[] | Filter by category ids -$name = "name_example"; // string | Filter by category name -$modifiedSince = "modifiedSince_example"; // string | Filter (urlencoded) the categories 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.** -$createdSince = "createdSince_example"; // string | Filter (urlencoded) the categories created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed +$ids = array('ids_example'); // string[] | Filter by category ids +$name = 'name_example'; // string | Filter by category name +$modifiedSince = 'modifiedSince_example'; // string | Filter (urlencoded) the categories 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.** +$createdSince = 'createdSince_example'; // string | Filter (urlencoded) the categories created 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 = $apiInstance->getCategories($limit, $offset, $sort, $ids, $name, $modifiedSince, $createdSince); @@ -455,24 +790,23 @@ try { } catch (Exception $e) { echo 'Exception when calling EcommerceApi->getCategories: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **limit** | **int**| Number of documents per page | [optional] [default to 50] - **offset** | **int**| Index of the first document in the page | [optional] [default to 0] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] - **ids** | [**string[]**](../Model/string.md)| Filter by category ids | [optional] - **name** | **string**| Filter by category name | [optional] - **modifiedSince** | **string**| Filter (urlencoded) the categories 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] - **createdSince** | **string**| Filter (urlencoded) the categories created 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] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Number of documents per page | [optional] [default to 50] | +| **offset** | **int**| Index of the first document in the page | [optional] [default to 0] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | +| **ids** | [**string[]**](../Model/string.md)| Filter by category ids | [optional] | +| **name** | **string**| Filter by category name | [optional] | +| **modifiedSince** | **string**| Filter (urlencoded) the categories 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] | +| **createdSince** | **string**| Filter (urlencoded) the categories created 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] | ### Return type -[**\Brevo\Client\Model\GetCategories**](../Model/GetCategories.md) +[**\Brevo\Client\Models\GetCategories**](../Model/GetCategories.md) ### Authorization @@ -480,37 +814,46 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getCategoryInfo** -> \Brevo\Client\Model\GetCategoryDetails getCategoryInfo($id) +## `getCategoryInfo()` + +```php +getCategoryInfo($id): \Brevo\Client\Models\GetCategoryDetails +``` Get a category details ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\EcommerceApi( // 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 ); -$id = "id_example"; // string | Category ID +$id = 'id_example'; // string | Category ID try { $result = $apiInstance->getCategoryInfo($id); @@ -518,18 +861,17 @@ try { } catch (Exception $e) { echo 'Exception when calling EcommerceApi->getCategoryInfo: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| Category ID | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| Category ID | | ### Return type -[**\Brevo\Client\Model\GetCategoryDetails**](../Model/GetCategoryDetails.md) +[**\Brevo\Client\Models\GetCategoryDetails**](../Model/GetCategoryDetails.md) ### Authorization @@ -537,32 +879,41 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getOrders** -> \Brevo\Client\Model\GetOrders getOrders($limit, $offset, $sort, $modifiedSince, $createdSince) +## `getOrders()` + +```php +getOrders($limit, $offset, $sort, $modifiedSince, $createdSince) +``` Get order details Get all the orders ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\EcommerceApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. @@ -571,32 +922,30 @@ $apiInstance = new Brevo\Client\Api\EcommerceApi( ); $limit = 50; // int | Number of documents per page $offset = 0; // int | Index of the first document in the page -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed -$modifiedSince = "modifiedSince_example"; // string | Filter (urlencoded) the orders 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.** -$createdSince = "createdSince_example"; // string | Filter (urlencoded) the orders created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed +$modifiedSince = 'modifiedSince_example'; // string | Filter (urlencoded) the orders 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.** +$createdSince = 'createdSince_example'; // string | Filter (urlencoded) the orders created 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 = $apiInstance->getOrders($limit, $offset, $sort, $modifiedSince, $createdSince); - print_r($result); + $apiInstance->getOrders($limit, $offset, $sort, $modifiedSince, $createdSince); } catch (Exception $e) { echo 'Exception when calling EcommerceApi->getOrders: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **limit** | **int**| Number of documents per page | [optional] [default to 50] - **offset** | **int**| Index of the first document in the page | [optional] [default to 0] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] - **modifiedSince** | **string**| Filter (urlencoded) the orders 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] - **createdSince** | **string**| Filter (urlencoded) the orders created 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] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Number of documents per page | [optional] [default to 50] | +| **offset** | **int**| Index of the first document in the page | [optional] [default to 0] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | +| **modifiedSince** | **string**| Filter (urlencoded) the orders 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] | +| **createdSince** | **string**| Filter (urlencoded) the orders created 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] | ### Return type -[**\Brevo\Client\Model\GetOrders**](../Model/GetOrders.md) +void (empty response body) ### Authorization @@ -604,37 +953,46 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getProductInfo** -> \Brevo\Client\Model\GetProductDetails getProductInfo($id) +## `getProductInfo()` + +```php +getProductInfo($id): \Brevo\Client\Models\GetProductDetails +``` Get a product's details ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\EcommerceApi( // 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 ); -$id = "id_example"; // string | Product ID +$id = 'id_example'; // string | Product ID try { $result = $apiInstance->getProductInfo($id); @@ -642,18 +1000,17 @@ try { } catch (Exception $e) { echo 'Exception when calling EcommerceApi->getProductInfo: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| Product ID | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| Product ID | | ### Return type -[**\Brevo\Client\Model\GetProductDetails**](../Model/GetProductDetails.md) +[**\Brevo\Client\Models\GetProductDetails**](../Model/GetProductDetails.md) ### Authorization @@ -661,30 +1018,39 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getProducts** -> \Brevo\Client\Model\GetProducts getProducts($limit, $offset, $sort, $ids, $name, $priceLte, $priceGte, $priceLt, $priceGt, $priceEq, $priceNe, $categories, $modifiedSince, $createdSince) +## `getProducts()` + +```php +getProducts($limit, $offset, $sort, $ids, $name, $priceLte, $priceGte, $priceLt, $priceGt, $priceEq, $priceNe, $categories, $modifiedSince, $createdSince): \Brevo\Client\Models\GetProducts +``` Return all your products ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\EcommerceApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. @@ -693,18 +1059,18 @@ $apiInstance = new Brevo\Client\Api\EcommerceApi( ); $limit = 50; // int | Number of documents per page $offset = 0; // int | Index of the first document in the page -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed -$ids = array("ids_example"); // string[] | Filter by product ids -$name = "name_example"; // string | Filter by product name, minimum 3 characters should be present for search -$priceLte = 8.14; // float | Price filter for products less than and equals to particular amount -$priceGte = 8.14; // float | Price filter for products greater than and equals to particular amount -$priceLt = 8.14; // float | Price filter for products less than particular amount -$priceGt = 8.14; // float | Price filter for products greater than particular amount -$priceEq = 8.14; // float | Price filter for products equals to particular amount -$priceNe = 8.14; // float | Price filter for products not equals to particular amount -$categories = array("categories_example"); // string[] | Filter by category ids -$modifiedSince = "modifiedSince_example"; // string | Filter (urlencoded) the orders 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.** -$createdSince = "createdSince_example"; // string | Filter (urlencoded) the orders created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed +$ids = array('ids_example'); // string[] | Filter by product ids +$name = 'name_example'; // string | Filter by product name, minimum 3 characters should be present for search +$priceLte = 3.4; // float | Price filter for products less than and equals to particular amount +$priceGte = 3.4; // float | Price filter for products greater than and equals to particular amount +$priceLt = 3.4; // float | Price filter for products less than particular amount +$priceGt = 3.4; // float | Price filter for products greater than particular amount +$priceEq = 3.4; // float | Price filter for products equals to particular amount +$priceNe = 3.4; // float | Price filter for products not equals to particular amount +$categories = array('categories_example'); // string[] | Filter by product categories +$modifiedSince = 'modifiedSince_example'; // string | Filter (urlencoded) the orders 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.** +$createdSince = 'createdSince_example'; // string | Filter (urlencoded) the orders created 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 = $apiInstance->getProducts($limit, $offset, $sort, $ids, $name, $priceLte, $priceGte, $priceLt, $priceGt, $priceEq, $priceNe, $categories, $modifiedSince, $createdSince); @@ -712,31 +1078,30 @@ try { } catch (Exception $e) { echo 'Exception when calling EcommerceApi->getProducts: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **limit** | **int**| Number of documents per page | [optional] [default to 50] - **offset** | **int**| Index of the first document in the page | [optional] [default to 0] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] - **ids** | [**string[]**](../Model/string.md)| Filter by product ids | [optional] - **name** | **string**| Filter by product name, minimum 3 characters should be present for search | [optional] - **priceLte** | **float**| Price filter for products less than and equals to particular amount | [optional] - **priceGte** | **float**| Price filter for products greater than and equals to particular amount | [optional] - **priceLt** | **float**| Price filter for products less than particular amount | [optional] - **priceGt** | **float**| Price filter for products greater than particular amount | [optional] - **priceEq** | **float**| Price filter for products equals to particular amount | [optional] - **priceNe** | **float**| Price filter for products not equals to particular amount | [optional] - **categories** | [**string[]**](../Model/string.md)| Filter by category ids | [optional] - **modifiedSince** | **string**| Filter (urlencoded) the orders 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] - **createdSince** | **string**| Filter (urlencoded) the orders created 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] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Number of documents per page | [optional] [default to 50] | +| **offset** | **int**| Index of the first document in the page | [optional] [default to 0] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | +| **ids** | [**string[]**](../Model/string.md)| Filter by product ids | [optional] | +| **name** | **string**| Filter by product name, minimum 3 characters should be present for search | [optional] | +| **priceLte** | **float**| Price filter for products less than and equals to particular amount | [optional] | +| **priceGte** | **float**| Price filter for products greater than and equals to particular amount | [optional] | +| **priceLt** | **float**| Price filter for products less than particular amount | [optional] | +| **priceGt** | **float**| Price filter for products greater than particular amount | [optional] | +| **priceEq** | **float**| Price filter for products equals to particular amount | [optional] | +| **priceNe** | **float**| Price filter for products not equals to particular amount | [optional] | +| **categories** | [**string[]**](../Model/string.md)| Filter by product categories | [optional] | +| **modifiedSince** | **string**| Filter (urlencoded) the orders 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] | +| **createdSince** | **string**| Filter (urlencoded) the orders created 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] | ### Return type -[**\Brevo\Client\Model\GetProducts**](../Model/GetProducts.md) +[**\Brevo\Client\Models\GetProducts**](../Model/GetProducts.md) ### Authorization @@ -744,8 +1109,74 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `setConfigDisplayCurrency()` + +```php +setConfigDisplayCurrency($ecommerceConfigDisplayCurrencyGet200Response): \Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response +``` + +Set the ISO 4217 compliant display currency code for your Brevo account + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\EcommerceApi( + // 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 +); +$ecommerceConfigDisplayCurrencyGet200Response = new \Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response(); // \Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response | set ISO 4217 compliant display currency code payload + +try { + $result = $apiInstance->setConfigDisplayCurrency($ecommerceConfigDisplayCurrencyGet200Response); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EcommerceApi->setConfigDisplayCurrency: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **ecommerceConfigDisplayCurrencyGet200Response** | [**\Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response**](../Model/EcommerceConfigDisplayCurrencyGet200Response.md)| set ISO 4217 compliant display currency code payload | [optional] | + +### Return type + +[**\Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response**](../Model/EcommerceConfigDisplayCurrencyGet200Response.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: `application/json` +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/EmailCampaignsApi.md b/docs/Api/EmailCampaignsApi.md index b25d8f3..2e9fa51 100644 --- a/docs/Api/EmailCampaignsApi.md +++ b/docs/Api/EmailCampaignsApi.md @@ -1,69 +1,75 @@ # Brevo\Client\EmailCampaignsApi -All URIs are relative to *https://api.brevo.com/v3* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createEmailCampaign**](EmailCampaignsApi.md#createEmailCampaign) | **POST** /emailCampaigns | Create an email campaign -[**deleteEmailCampaign**](EmailCampaignsApi.md#deleteEmailCampaign) | **DELETE** /emailCampaigns/{campaignId} | Delete an email campaign -[**emailExportRecipients**](EmailCampaignsApi.md#emailExportRecipients) | **POST** /emailCampaigns/{campaignId}/exportRecipients | Export the recipients of an email campaign -[**getAbTestCampaignResult**](EmailCampaignsApi.md#getAbTestCampaignResult) | **GET** /emailCampaigns/{campaignId}/abTestCampaignResult | Get an A/B test email campaign results -[**getEmailCampaign**](EmailCampaignsApi.md#getEmailCampaign) | **GET** /emailCampaigns/{campaignId} | Get an email campaign report -[**getEmailCampaigns**](EmailCampaignsApi.md#getEmailCampaigns) | **GET** /emailCampaigns | Return all your created email campaigns -[**getSharedTemplateUrl**](EmailCampaignsApi.md#getSharedTemplateUrl) | **GET** /emailCampaigns/{campaignId}/sharedUrl | Get a shared template url -[**sendEmailCampaignNow**](EmailCampaignsApi.md#sendEmailCampaignNow) | **POST** /emailCampaigns/{campaignId}/sendNow | Send an email campaign immediately, based on campaignId -[**sendReport**](EmailCampaignsApi.md#sendReport) | **POST** /emailCampaigns/{campaignId}/sendReport | Send the report of a campaign -[**sendTestEmail**](EmailCampaignsApi.md#sendTestEmail) | **POST** /emailCampaigns/{campaignId}/sendTest | Send an email campaign to your test list -[**updateCampaignStatus**](EmailCampaignsApi.md#updateCampaignStatus) | **PUT** /emailCampaigns/{campaignId}/status | Update an email campaign status -[**updateEmailCampaign**](EmailCampaignsApi.md#updateEmailCampaign) | **PUT** /emailCampaigns/{campaignId} | Update an email campaign -[**uploadImageToGallery**](EmailCampaignsApi.md#uploadImageToGallery) | **POST** /emailCampaigns/images | Upload an image to your account's image gallery - - -# **createEmailCampaign** -> \Brevo\Client\Model\CreateModel createEmailCampaign($emailCampaigns) +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createEmailCampaign()**](EmailCampaignsApi.md#createEmailCampaign) | **POST** /emailCampaigns | Create an email campaign | +| [**deleteEmailCampaign()**](EmailCampaignsApi.md#deleteEmailCampaign) | **DELETE** /emailCampaigns/{campaignId} | Delete an email campaign | +| [**emailExportRecipients()**](EmailCampaignsApi.md#emailExportRecipients) | **POST** /emailCampaigns/{campaignId}/exportRecipients | Export the recipients of an email campaign | +| [**getAbTestCampaignResult()**](EmailCampaignsApi.md#getAbTestCampaignResult) | **GET** /emailCampaigns/{campaignId}/abTestCampaignResult | Get an A/B test email campaign results | +| [**getEmailCampaign()**](EmailCampaignsApi.md#getEmailCampaign) | **GET** /emailCampaigns/{campaignId} | Get an email campaign report | +| [**getEmailCampaigns()**](EmailCampaignsApi.md#getEmailCampaigns) | **GET** /emailCampaigns | Return all your created email campaigns | +| [**getSharedTemplateUrl()**](EmailCampaignsApi.md#getSharedTemplateUrl) | **GET** /emailCampaigns/{campaignId}/sharedUrl | Get a shared template url | +| [**sendEmailCampaignNow()**](EmailCampaignsApi.md#sendEmailCampaignNow) | **POST** /emailCampaigns/{campaignId}/sendNow | Send an email campaign immediately, based on campaignId | +| [**sendReport()**](EmailCampaignsApi.md#sendReport) | **POST** /emailCampaigns/{campaignId}/sendReport | Send the report of a campaign | +| [**sendTestEmail()**](EmailCampaignsApi.md#sendTestEmail) | **POST** /emailCampaigns/{campaignId}/sendTest | Send an email campaign to your test list | +| [**updateCampaignStatus()**](EmailCampaignsApi.md#updateCampaignStatus) | **PUT** /emailCampaigns/{campaignId}/status | Update an email campaign status | +| [**updateEmailCampaign()**](EmailCampaignsApi.md#updateEmailCampaign) | **PUT** /emailCampaigns/{campaignId} | Update an email campaign | +| [**uploadImageToGallery()**](EmailCampaignsApi.md#uploadImageToGallery) | **POST** /emailCampaigns/images | Upload an image to your account's image gallery | + + +## `createEmailCampaign()` + +```php +createEmailCampaign($createEmailCampaign): \Brevo\Client\Models\CreateModel +``` Create an email campaign ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\CreateEmailCampaign(); // \Brevo\Client\Model\CreateEmailCampaign | Values to create a campaign +$createEmailCampaign = new \Brevo\Client\Models\CreateEmailCampaign(); // \Brevo\Client\Models\CreateEmailCampaign | Values to create a campaign try { - $result = $apiInstance->createEmailCampaign($emailCampaigns); + $result = $apiInstance->createEmailCampaign($createEmailCampaign); print_r($result); } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->createEmailCampaign: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **emailCampaigns** | [**\Brevo\Client\Model\CreateEmailCampaign**](../Model/CreateEmailCampaign.md)| Values to create a campaign | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **createEmailCampaign** | [**\Brevo\Client\Models\CreateEmailCampaign**](../Model/CreateEmailCampaign.md)| Values to create a campaign | | ### Return type -[**\Brevo\Client\Model\CreateModel**](../Model/CreateModel.md) +[**\Brevo\Client\Models\CreateModel**](../Model/CreateModel.md) ### Authorization @@ -71,51 +77,59 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `deleteEmailCampaign()` -# **deleteEmailCampaign** -> deleteEmailCampaign($campaignId) +```php +deleteEmailCampaign($campaignId) +``` Delete an email campaign ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 +$campaignId = 56; // int | id of the campaign try { $apiInstance->deleteEmailCampaign($campaignId); } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->deleteEmailCampaign: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **campaignId** | **int**| id of the campaign | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **int**| id of the campaign | | ### Return type @@ -127,58 +141,66 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `emailExportRecipients()` -# **emailExportRecipients** -> \Brevo\Client\Model\CreatedProcessId emailExportRecipients($campaignId, $recipientExport) +```php +emailExportRecipients($campaignId, $emailExportRecipients): \Brevo\Client\Models\CreatedProcessId +``` Export the recipients of an email campaign ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\EmailExportRecipients(); // \Brevo\Client\Model\EmailExportRecipients | Values to send for a recipient export request +$campaignId = 56; // int | Id of the campaign +$emailExportRecipients = new \Brevo\Client\Models\EmailExportRecipients(); // \Brevo\Client\Models\EmailExportRecipients | Values to send for a recipient export request try { - $result = $apiInstance->emailExportRecipients($campaignId, $recipientExport); + $result = $apiInstance->emailExportRecipients($campaignId, $emailExportRecipients); print_r($result); } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->emailExportRecipients: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **campaignId** | **int**| Id of the campaign | - **recipientExport** | [**\Brevo\Client\Model\EmailExportRecipients**](../Model/EmailExportRecipients.md)| Values to send for a recipient export request | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **int**| Id of the campaign | | +| **emailExportRecipients** | [**\Brevo\Client\Models\EmailExportRecipients**](../Model/EmailExportRecipients.md)| Values to send for a recipient export request | [optional] | ### Return type -[**\Brevo\Client\Model\CreatedProcessId**](../Model/CreatedProcessId.md) +[**\Brevo\Client\Models\CreatedProcessId**](../Model/CreatedProcessId.md) ### Authorization @@ -186,39 +208,48 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getAbTestCampaignResult** -> \Brevo\Client\Model\AbTestCampaignResult getAbTestCampaignResult($campaignId) +## `getAbTestCampaignResult()` + +```php +getAbTestCampaignResult($campaignId): \Brevo\Client\Models\AbTestCampaignResult +``` Get an A/B test email campaign results Obtain winning version of an A/B test email campaign ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 A/B test campaign +$campaignId = 56; // int | Id of the A/B test campaign try { $result = $apiInstance->getAbTestCampaignResult($campaignId); @@ -226,18 +257,17 @@ try { } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->getAbTestCampaignResult: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **campaignId** | **int**| Id of the A/B test campaign | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **int**| Id of the A/B test campaign | | ### Return type -[**\Brevo\Client\Model\AbTestCampaignResult**](../Model/AbTestCampaignResult.md) +[**\Brevo\Client\Models\AbTestCampaignResult**](../Model/AbTestCampaignResult.md) ### Authorization @@ -245,38 +275,47 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `getEmailCampaign()` -# **getEmailCampaign** -> \Brevo\Client\Model\GetEmailCampaign getEmailCampaign($campaignId, $statistics) +```php +getEmailCampaign($campaignId, $statistics): \Brevo\Client\Models\GetEmailCampaign +``` Get an email campaign report ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 -$statistics = "statistics_example"; // string | Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. +$campaignId = 56; // int | Id of the campaign +$statistics = 'statistics_example'; // string | Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. try { $result = $apiInstance->getEmailCampaign($campaignId, $statistics); @@ -284,19 +323,18 @@ try { } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->getEmailCampaign: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **campaignId** | **int**| Id of the campaign | - **statistics** | **string**| Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **int**| Id of the campaign | | +| **statistics** | **string**| Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. | [optional] | ### Return type -[**\Brevo\Client\Model\GetEmailCampaign**](../Model/GetEmailCampaign.md) +[**\Brevo\Client\Models\GetEmailCampaign**](../Model/GetEmailCampaign.md) ### Authorization @@ -304,45 +342,54 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getEmailCampaigns** -> \Brevo\Client\Model\GetEmailCampaigns getEmailCampaigns($type, $status, $statistics, $startDate, $endDate, $limit, $offset, $sort, $excludeHtmlContent) +## `getEmailCampaigns()` + +```php +getEmailCampaigns($type, $status, $statistics, $startDate, $endDate, $limit, $offset, $sort, $excludeHtmlContent): \Brevo\Client\Models\GetEmailCampaigns +``` Return all your created email campaigns ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 -$statistics = "statistics_example"; // string | Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. -$startDate = "startDate_example"; // string | Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) -$endDate = "endDate_example"; // string | Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) +$type = 'type_example'; // string | Filter on the type of the campaigns +$status = 'status_example'; // string | Filter on the status of the campaign +$statistics = 'statistics_example'; // string | Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response.This option only returns data for events occurred in the last 6 months.For older campaigns, it’s advisable to use the **Get Campaign Report** endpoint. +$startDate = 'startDate_example'; // string | **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) +$endDate = 'endDate_example'; // string | **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) $limit = 50; // int | Number of documents per page $offset = 0; // int | Index of the first document in the page -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed -$excludeHtmlContent = true; // bool | Use this flag to exclude htmlContent from the response body. If set to **true**, htmlContent field will be returned as empty string in the response body +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed +$excludeHtmlContent = True; // bool | Use this flag to exclude htmlContent from the response body. If set to **true**, htmlContent field will be returned as empty string in the response body try { $result = $apiInstance->getEmailCampaigns($type, $status, $statistics, $startDate, $endDate, $limit, $offset, $sort, $excludeHtmlContent); @@ -350,26 +397,25 @@ try { } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->getEmailCampaigns: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **type** | **string**| Filter on the type of the campaigns | [optional] - **status** | **string**| Filter on the status of the campaign | [optional] - **statistics** | **string**| Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. | [optional] - **startDate** | **string**| Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) | [optional] - **endDate** | **string**| Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) | [optional] - **limit** | **int**| Number of documents per page | [optional] [default to 50] - **offset** | **int**| Index of the first document in the page | [optional] [default to 0] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] - **excludeHtmlContent** | **bool**| Use this flag to exclude htmlContent from the response body. If set to **true**, htmlContent field will be returned as empty string in the response body | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **type** | **string**| Filter on the type of the campaigns | [optional] | +| **status** | **string**| Filter on the status of the campaign | [optional] | +| **statistics** | **string**| Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response.This option only returns data for events occurred in the last 6 months.For older campaigns, it’s advisable to use the **Get Campaign Report** endpoint. | [optional] | +| **startDate** | **string**| **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) | [optional] | +| **endDate** | **string**| **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) | [optional] | +| **limit** | **int**| Number of documents per page | [optional] [default to 50] | +| **offset** | **int**| Index of the first document in the page | [optional] [default to 0] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | +| **excludeHtmlContent** | **bool**| Use this flag to exclude htmlContent from the response body. If set to **true**, htmlContent field will be returned as empty string in the response body | [optional] | ### Return type -[**\Brevo\Client\Model\GetEmailCampaigns**](../Model/GetEmailCampaigns.md) +[**\Brevo\Client\Models\GetEmailCampaigns**](../Model/GetEmailCampaigns.md) ### Authorization @@ -377,39 +423,48 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getSharedTemplateUrl** -> \Brevo\Client\Model\GetSharedTemplateUrl getSharedTemplateUrl($campaignId) +## `getSharedTemplateUrl()` + +```php +getSharedTemplateUrl($campaignId): \Brevo\Client\Models\GetSharedTemplateUrl +``` Get a shared template url Get a unique URL to share & import an email template from one Brevo account to another. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 or template +$campaignId = 56; // int | Id of the campaign or template try { $result = $apiInstance->getSharedTemplateUrl($campaignId); @@ -417,18 +472,17 @@ try { } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->getSharedTemplateUrl: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **campaignId** | **int**| Id of the campaign or template | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **int**| Id of the campaign or template | | ### Return type -[**\Brevo\Client\Model\GetSharedTemplateUrl**](../Model/GetSharedTemplateUrl.md) +[**\Brevo\Client\Models\GetSharedTemplateUrl**](../Model/GetSharedTemplateUrl.md) ### Authorization @@ -436,51 +490,59 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **sendEmailCampaignNow** -> sendEmailCampaignNow($campaignId) +## `sendEmailCampaignNow()` + +```php +sendEmailCampaignNow($campaignId) +``` Send an email campaign immediately, based on campaignId ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 +$campaignId = 56; // int | Id of the campaign try { $apiInstance->sendEmailCampaignNow($campaignId); } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->sendEmailCampaignNow: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **campaignId** | **int**| Id of the campaign | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **int**| Id of the campaign | | ### Return type @@ -492,55 +554,63 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **sendReport** -> sendReport($campaignId, $sendReport) +## `sendReport()` + +```php +sendReport($campaignId, $sendReport) +``` Send the report of a campaign A PDF will be sent to the specified email addresses ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\SendReport(); // \Brevo\Client\Model\SendReport | Values for send a report +$campaignId = 56; // int | Id of the campaign +$sendReport = new \Brevo\Client\Models\SendReport(); // \Brevo\Client\Models\SendReport | Values for send a report try { $apiInstance->sendReport($campaignId, $sendReport); } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->sendReport: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **campaignId** | **int**| Id of the campaign | - **sendReport** | [**\Brevo\Client\Model\SendReport**](../Model/SendReport.md)| Values for send a report | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **int**| Id of the campaign | | +| **sendReport** | [**\Brevo\Client\Models\SendReport**](../Model/SendReport.md)| Values for send a report | | ### Return type @@ -552,53 +622,61 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **sendTestEmail** -> sendTestEmail($campaignId, $emailTo) +## `sendTestEmail()` + +```php +sendTestEmail($campaignId, $sendTestEmail) +``` Send an email campaign to your test list ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\SendTestEmail(); // \Brevo\Client\Model\SendTestEmail | +$campaignId = 56; // int | Id of the campaign +$sendTestEmail = new \Brevo\Client\Models\SendTestEmail(); // \Brevo\Client\Models\SendTestEmail try { - $apiInstance->sendTestEmail($campaignId, $emailTo); + $apiInstance->sendTestEmail($campaignId, $sendTestEmail); } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->sendTestEmail: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **campaignId** | **int**| Id of the campaign | - **emailTo** | [**\Brevo\Client\Model\SendTestEmail**](../Model/SendTestEmail.md)| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **int**| Id of the campaign | | +| **sendTestEmail** | [**\Brevo\Client\Models\SendTestEmail**](../Model/SendTestEmail.md)| | | ### Return type @@ -610,53 +688,61 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `updateCampaignStatus()` -# **updateCampaignStatus** -> updateCampaignStatus($campaignId, $status) +```php +updateCampaignStatus($campaignId, $updateCampaignStatus) +``` Update an email campaign status ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\UpdateCampaignStatus(); // \Brevo\Client\Model\UpdateCampaignStatus | Status of the campaign +$campaignId = 56; // int | Id of the campaign +$updateCampaignStatus = new \Brevo\Client\Models\UpdateCampaignStatus(); // \Brevo\Client\Models\UpdateCampaignStatus | Status of the campaign try { - $apiInstance->updateCampaignStatus($campaignId, $status); + $apiInstance->updateCampaignStatus($campaignId, $updateCampaignStatus); } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->updateCampaignStatus: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **campaignId** | **int**| Id of the campaign | - **status** | [**\Brevo\Client\Model\UpdateCampaignStatus**](../Model/UpdateCampaignStatus.md)| Status of the campaign | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **int**| Id of the campaign | | +| **updateCampaignStatus** | [**\Brevo\Client\Models\UpdateCampaignStatus**](../Model/UpdateCampaignStatus.md)| Status of the campaign | | ### Return type @@ -668,53 +754,61 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `updateEmailCampaign()` -# **updateEmailCampaign** -> updateEmailCampaign($campaignId, $emailCampaign) +```php +updateEmailCampaign($campaignId, $updateEmailCampaign) +``` Update an email campaign ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\UpdateEmailCampaign(); // \Brevo\Client\Model\UpdateEmailCampaign | Values to update a campaign +$campaignId = 56; // int | Id of the campaign +$updateEmailCampaign = new \Brevo\Client\Models\UpdateEmailCampaign(); // \Brevo\Client\Models\UpdateEmailCampaign | Values to update a campaign try { - $apiInstance->updateEmailCampaign($campaignId, $emailCampaign); + $apiInstance->updateEmailCampaign($campaignId, $updateEmailCampaign); } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->updateEmailCampaign: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **campaignId** | **int**| Id of the campaign | - **emailCampaign** | [**\Brevo\Client\Model\UpdateEmailCampaign**](../Model/UpdateEmailCampaign.md)| Values to update a campaign | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **int**| Id of the campaign | | +| **updateEmailCampaign** | [**\Brevo\Client\Models\UpdateEmailCampaign**](../Model/UpdateEmailCampaign.md)| Values to update a campaign | | ### Return type @@ -726,56 +820,64 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **uploadImageToGallery** -> \Brevo\Client\Model\UploadImageModel uploadImageToGallery($uploadImage) +## `uploadImageToGallery()` + +```php +uploadImageToGallery($uploadImageToGallery): \Brevo\Client\Models\UploadImageModel +``` Upload an image to your account's image gallery ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 ); -$uploadImage = new \Brevo\Client\Model\UploadImageToGallery(); // \Brevo\Client\Model\UploadImageToGallery | Parameters to upload an image +$uploadImageToGallery = new \Brevo\Client\Models\UploadImageToGallery(); // \Brevo\Client\Models\UploadImageToGallery | Parameters to upload an image try { - $result = $apiInstance->uploadImageToGallery($uploadImage); + $result = $apiInstance->uploadImageToGallery($uploadImageToGallery); print_r($result); } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->uploadImageToGallery: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **uploadImage** | [**\Brevo\Client\Model\UploadImageToGallery**](../Model/UploadImageToGallery.md)| Parameters to upload an image | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **uploadImageToGallery** | [**\Brevo\Client\Models\UploadImageToGallery**](../Model/UploadImageToGallery.md)| Parameters to upload an image | | ### Return type -[**\Brevo\Client\Model\UploadImageModel**](../Model/UploadImageModel.md) +[**\Brevo\Client\Models\UploadImageModel**](../Model/UploadImageModel.md) ### Authorization @@ -783,8 +885,9 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: `application/json` +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/EventsApi.md b/docs/Api/EventApi.md similarity index 57% rename from docs/Api/EventsApi.md rename to docs/Api/EventApi.md index 50957d9..a39381a 100644 --- a/docs/Api/EventsApi.md +++ b/docs/Api/EventApi.md @@ -1,54 +1,60 @@ -# Brevo\Client\EventsApi +# Brevo\Client\EventApi -All URIs are relative to *https://api.brevo.com/v3* +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createEvent**](EventsApi.md#createEvent) | **POST** /events | Create an event +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createEvent()**](EventApi.md#createEvent) | **POST** /events | Create an event | -# **createEvent** -> createEvent($event) +## `createEvent()` + +```php +createEvent($event) +``` Create an event Create an event to track a contact's interaction. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); -$apiInstance = new Brevo\Client\Api\EventsApi( + +$apiInstance = new Brevo\Client\Api\EventApi( // 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 ); -$event = new \Brevo\Client\Model\Event(); // \Brevo\Client\Model\Event | +$event = new \Brevo\Client\Models\Event(); // \Brevo\Client\Models\Event try { $apiInstance->createEvent($event); } catch (Exception $e) { - echo 'Exception when calling EventsApi->createEvent: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling EventApi->createEvent: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **event** | [**\Brevo\Client\Model\Event**](../Model/Event.md)| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **event** | [**\Brevo\Client\Models\Event**](../Model/Event.md)| | | ### Return type @@ -60,8 +66,9 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: `application/json` +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/ExternalFeedsApi.md b/docs/Api/ExternalFeedsApi.md index b72ddeb..1ad8c69 100644 --- a/docs/Api/ExternalFeedsApi.md +++ b/docs/Api/ExternalFeedsApi.md @@ -1,44 +1,51 @@ # Brevo\Client\ExternalFeedsApi -All URIs are relative to *https://api.brevo.com/v3* +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createExternalFeed**](ExternalFeedsApi.md#createExternalFeed) | **POST** /feeds | Create an external feed -[**deleteExternalFeed**](ExternalFeedsApi.md#deleteExternalFeed) | **DELETE** /feeds/{uuid} | Delete an external feed -[**getAllExternalFeeds**](ExternalFeedsApi.md#getAllExternalFeeds) | **GET** /feeds | Fetch all external feeds -[**getExternalFeedByUUID**](ExternalFeedsApi.md#getExternalFeedByUUID) | **GET** /feeds/{uuid} | Get an external feed by UUID -[**updateExternalFeed**](ExternalFeedsApi.md#updateExternalFeed) | **PUT** /feeds/{uuid} | Update an external feed +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createExternalFeed()**](ExternalFeedsApi.md#createExternalFeed) | **POST** /feeds | Create an external feed | +| [**deleteExternalFeed()**](ExternalFeedsApi.md#deleteExternalFeed) | **DELETE** /feeds/{uuid} | Delete an external feed | +| [**getAllExternalFeeds()**](ExternalFeedsApi.md#getAllExternalFeeds) | **GET** /feeds | Fetch all external feeds | +| [**getExternalFeedByUUID()**](ExternalFeedsApi.md#getExternalFeedByUUID) | **GET** /feeds/{uuid} | Get an external feed by UUID | +| [**updateExternalFeed()**](ExternalFeedsApi.md#updateExternalFeed) | **PUT** /feeds/{uuid} | Update an external feed | -# **createExternalFeed** -> \Brevo\Client\Model\InlineResponse2015 createExternalFeed($createExternalFeed) +## `createExternalFeed()` + +```php +createExternalFeed($createExternalFeed): \Brevo\Client\Models\CreateExternalFeed201Response +``` Create an external feed This endpoint will create an external feed. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\ExternalFeedsApi( // 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 ); -$createExternalFeed = new \Brevo\Client\Model\CreateExternalFeed(); // \Brevo\Client\Model\CreateExternalFeed | Values to create a feed +$createExternalFeed = new \Brevo\Client\Models\CreateExternalFeed(); // \Brevo\Client\Models\CreateExternalFeed | Values to create a feed try { $result = $apiInstance->createExternalFeed($createExternalFeed); @@ -46,18 +53,17 @@ try { } catch (Exception $e) { echo 'Exception when calling ExternalFeedsApi->createExternalFeed: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **createExternalFeed** | [**\Brevo\Client\Model\CreateExternalFeed**](../Model/CreateExternalFeed.md)| Values to create a feed | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **createExternalFeed** | [**\Brevo\Client\Models\CreateExternalFeed**](../Model/CreateExternalFeed.md)| Values to create a feed | | ### Return type -[**\Brevo\Client\Model\InlineResponse2015**](../Model/InlineResponse2015.md) +[**\Brevo\Client\Models\CreateExternalFeed201Response**](../Model/CreateExternalFeed201Response.md) ### Authorization @@ -65,53 +71,61 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **deleteExternalFeed** -> deleteExternalFeed($uuid) +## `deleteExternalFeed()` + +```php +deleteExternalFeed($uuid) +``` Delete an external feed This endpoint will delete an external feed. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\ExternalFeedsApi( // 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 ); -$uuid = "uuid_example"; // string | UUID of the feed to delete +$uuid = 38f351fb-6e77-4b38-979a-a2465260449e; // string | UUID of the feed to delete try { $apiInstance->deleteExternalFeed($uuid); } catch (Exception $e) { echo 'Exception when calling ExternalFeedsApi->deleteExternalFeed: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **uuid** | **string**| UUID of the feed to delete | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **uuid** | **string**| UUID of the feed to delete | | ### Return type @@ -123,44 +137,53 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getAllExternalFeeds** -> \Brevo\Client\Model\GetAllExternalFeeds getAllExternalFeeds($search, $startDate, $endDate, $sort, $authType, $limit, $offset) +## `getAllExternalFeeds()` + +```php +getAllExternalFeeds($search, $startDate, $endDate, $sort, $authType, $limit, $offset): \Brevo\Client\Models\GetAllExternalFeeds +``` Fetch all external feeds This endpoint can fetch all created external feeds. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\ExternalFeedsApi( // 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 ); -$search = "search_example"; // string | Can be used to filter records by search keyword on feed name -$startDate = new \DateTime("2013-10-20"); // \DateTime | Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older than current date. -$endDate = new \DateTime("2013-10-20"); // \DateTime | Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. -$authType = "authType_example"; // string | Filter the records by `authType` of the feed. -$limit = 50; // int | Number of documents returned per page. +$search = search; // string | Can be used to filter records by search keyword on feed name +$startDate = 2022-09-04; // \DateTime | Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older than current date. +$endDate = 2022-10-01; // \DateTime | Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. +$authType = 'authType_example'; // string | Filter the records by `authType` of the feed. +$limit = 100; // int | Number of documents returned per page. $offset = 0; // int | Index of the first document on the page. try { @@ -169,24 +192,23 @@ try { } catch (Exception $e) { echo 'Exception when calling ExternalFeedsApi->getAllExternalFeeds: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **search** | **string**| Can be used to filter records by search keyword on feed name | [optional] - **startDate** | **\DateTime**| Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older than current date. | [optional] - **endDate** | **\DateTime**| Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. | [optional] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. | [optional] [default to desc] - **authType** | **string**| Filter the records by `authType` of the feed. | [optional] - **limit** | **int**| Number of documents returned per page. | [optional] [default to 50] - **offset** | **int**| Index of the first document on the page. | [optional] [default to 0] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **search** | **string**| Can be used to filter records by search keyword on feed name | [optional] | +| **startDate** | **\DateTime**| Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older than current date. | [optional] | +| **endDate** | **\DateTime**| Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. | [optional] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. | [optional] [default to 'desc'] | +| **authType** | **string**| Filter the records by `authType` of the feed. | [optional] | +| **limit** | **int**| Number of documents returned per page. | [optional] [default to 50] | +| **offset** | **int**| Index of the first document on the page. | [optional] [default to 0] | ### Return type -[**\Brevo\Client\Model\GetAllExternalFeeds**](../Model/GetAllExternalFeeds.md) +[**\Brevo\Client\Models\GetAllExternalFeeds**](../Model/GetAllExternalFeeds.md) ### Authorization @@ -194,39 +216,48 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getExternalFeedByUUID** -> \Brevo\Client\Model\GetExternalFeedByUUID getExternalFeedByUUID($uuid) +## `getExternalFeedByUUID()` + +```php +getExternalFeedByUUID($uuid): \Brevo\Client\Models\GetExternalFeedByUUID +``` Get an external feed by UUID This endpoint will update an external feed. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\ExternalFeedsApi( // 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 ); -$uuid = "uuid_example"; // string | UUID of the feed to fetch +$uuid = 38f351fb-6e77-4b38-979a-a2465260449e; // string | UUID of the feed to fetch try { $result = $apiInstance->getExternalFeedByUUID($uuid); @@ -234,18 +265,17 @@ try { } catch (Exception $e) { echo 'Exception when calling ExternalFeedsApi->getExternalFeedByUUID: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **uuid** | **string**| UUID of the feed to fetch | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **uuid** | **string**| UUID of the feed to fetch | | ### Return type -[**\Brevo\Client\Model\GetExternalFeedByUUID**](../Model/GetExternalFeedByUUID.md) +[**\Brevo\Client\Models\GetExternalFeedByUUID**](../Model/GetExternalFeedByUUID.md) ### Authorization @@ -253,55 +283,63 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **updateExternalFeed** -> updateExternalFeed($uuid, $updateExternalFeed) +## `updateExternalFeed()` + +```php +updateExternalFeed($uuid, $updateExternalFeed) +``` Update an external feed This endpoint will update an external feed. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\ExternalFeedsApi( // 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 ); -$uuid = "uuid_example"; // string | UUID of the feed to update -$updateExternalFeed = new \Brevo\Client\Model\UpdateExternalFeed(); // \Brevo\Client\Model\UpdateExternalFeed | Values to update a feed +$uuid = 38f351fb-6e77-4b38-979a-a2465260449e; // string | UUID of the feed to update +$updateExternalFeed = new \Brevo\Client\Models\UpdateExternalFeed(); // \Brevo\Client\Models\UpdateExternalFeed | Values to update a feed try { $apiInstance->updateExternalFeed($uuid, $updateExternalFeed); } catch (Exception $e) { echo 'Exception when calling ExternalFeedsApi->updateExternalFeed: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **uuid** | **string**| UUID of the feed to update | - **updateExternalFeed** | [**\Brevo\Client\Model\UpdateExternalFeed**](../Model/UpdateExternalFeed.md)| Values to update a feed | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **uuid** | **string**| UUID of the feed to update | | +| **updateExternalFeed** | [**\Brevo\Client\Models\UpdateExternalFeed**](../Model/UpdateExternalFeed.md)| Values to update a feed | | ### Return type @@ -313,8 +351,9 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: `application/json` +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/FilesApi.md b/docs/Api/FilesApi.md index 3a64955..8b481a8 100644 --- a/docs/Api/FilesApi.md +++ b/docs/Api/FilesApi.md @@ -1,48 +1,55 @@ # Brevo\Client\FilesApi -All URIs are relative to *https://api.brevo.com/v3* +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**crmFilesGet**](FilesApi.md#crmFilesGet) | **GET** /crm/files | Get all files -[**crmFilesIdDataGet**](FilesApi.md#crmFilesIdDataGet) | **GET** /crm/files/{id}/data | Get file details -[**crmFilesIdDelete**](FilesApi.md#crmFilesIdDelete) | **DELETE** /crm/files/{id} | Delete a file -[**crmFilesIdGet**](FilesApi.md#crmFilesIdGet) | **GET** /crm/files/{id} | Download a file -[**crmFilesPost**](FilesApi.md#crmFilesPost) | **POST** /crm/files | Upload a file +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**crmFilesGet()**](FilesApi.md#crmFilesGet) | **GET** /crm/files | Get all files | +| [**crmFilesIdDataGet()**](FilesApi.md#crmFilesIdDataGet) | **GET** /crm/files/{id}/data | Get file details | +| [**crmFilesIdDelete()**](FilesApi.md#crmFilesIdDelete) | **DELETE** /crm/files/{id} | Delete a file | +| [**crmFilesIdGet()**](FilesApi.md#crmFilesIdGet) | **GET** /crm/files/{id} | Download a file | +| [**crmFilesPost()**](FilesApi.md#crmFilesPost) | **POST** /crm/files | Upload a file | -# **crmFilesGet** -> \Brevo\Client\Model\FileList crmFilesGet($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort) +## `crmFilesGet()` + +```php +crmFilesGet($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort): \Brevo\Client\Models\FileData[] +``` Get all files ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\FilesApi( // 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 ); -$entity = "entity_example"; // string | Filter by file entity type -$entityIds = "entityIds_example"; // string | Filter by file entity IDs +$entity = 'entity_example'; // string | Filter by file entity type +$entityIds = 'entityIds_example'; // string | Filter by file entity IDs $dateFrom = 56; // int | dateFrom to date range filter type (timestamp in milliseconds) $dateTo = 56; // int | dateTo to date range filter type (timestamp in milliseconds) -$offset = 789; // int | Index of the first document of the page +$offset = 56; // int | Index of the first document of the page $limit = 50; // int | Number of documents per page -$sort = "sort_example"; // string | Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed +$sort = 'sort_example'; // string | Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed try { $result = $apiInstance->crmFilesGet($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort); @@ -50,24 +57,23 @@ try { } catch (Exception $e) { echo 'Exception when calling FilesApi->crmFilesGet: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **entity** | **string**| Filter by file entity type | [optional] - **entityIds** | **string**| Filter by file entity IDs | [optional] - **dateFrom** | **int**| dateFrom to date range filter type (timestamp in milliseconds) | [optional] - **dateTo** | **int**| dateTo to date range filter type (timestamp in milliseconds) | [optional] - **offset** | **int**| Index of the first document of the page | [optional] - **limit** | **int**| Number of documents per page | [optional] [default to 50] - **sort** | **string**| Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **entity** | **string**| Filter by file entity type | [optional] | +| **entityIds** | **string**| Filter by file entity IDs | [optional] | +| **dateFrom** | **int**| dateFrom to date range filter type (timestamp in milliseconds) | [optional] | +| **dateTo** | **int**| dateTo to date range filter type (timestamp in milliseconds) | [optional] | +| **offset** | **int**| Index of the first document of the page | [optional] | +| **limit** | **int**| Number of documents per page | [optional] [default to 50] | +| **sort** | **string**| Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed | [optional] | ### Return type -[**\Brevo\Client\Model\FileList**](../Model/FileList.md) +[**\Brevo\Client\Models\FileData[]**](../Model/FileData.md) ### Authorization @@ -75,37 +81,46 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **crmFilesIdDataGet** -> \Brevo\Client\Model\FileData crmFilesIdDataGet($id) +## `crmFilesIdDataGet()` + +```php +crmFilesIdDataGet($id): \Brevo\Client\Models\FileData +``` Get file details ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\FilesApi( // 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 ); -$id = "id_example"; // string | File id to get file data. +$id = 'id_example'; // string | File id to get file data. try { $result = $apiInstance->crmFilesIdDataGet($id); @@ -113,18 +128,17 @@ try { } catch (Exception $e) { echo 'Exception when calling FilesApi->crmFilesIdDataGet: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| File id to get file data. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| File id to get file data. | | ### Return type -[**\Brevo\Client\Model\FileData**](../Model/FileData.md) +[**\Brevo\Client\Models\FileData**](../Model/FileData.md) ### Authorization @@ -132,51 +146,59 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **crmFilesIdDelete** -> crmFilesIdDelete($id) +## `crmFilesIdDelete()` + +```php +crmFilesIdDelete($id) +``` Delete a file ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\FilesApi( // 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 ); -$id = "id_example"; // string | File id to delete. +$id = 'id_example'; // string | File id to delete. try { $apiInstance->crmFilesIdDelete($id); } catch (Exception $e) { echo 'Exception when calling FilesApi->crmFilesIdDelete: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| File id to delete. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| File id to delete. | | ### Return type @@ -188,37 +210,46 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **crmFilesIdGet** -> \Brevo\Client\Model\FileDownloadableLink crmFilesIdGet($id) +## `crmFilesIdGet()` + +```php +crmFilesIdGet($id): \Brevo\Client\Models\FileDownloadableLink +``` Download a file ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\FilesApi( // 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 ); -$id = "id_example"; // string | File id to download. +$id = 'id_example'; // string | File id to download. try { $result = $apiInstance->crmFilesIdGet($id); @@ -226,18 +257,17 @@ try { } catch (Exception $e) { echo 'Exception when calling FilesApi->crmFilesIdGet: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| File id to download. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| File id to download. | | ### Return type -[**\Brevo\Client\Model\FileDownloadableLink**](../Model/FileDownloadableLink.md) +[**\Brevo\Client\Models\FileDownloadableLink**](../Model/FileDownloadableLink.md) ### Authorization @@ -245,30 +275,39 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **crmFilesPost** -> \Brevo\Client\Model\FileData crmFilesPost($file, $dealId, $contactId, $companyId) +## `crmFilesPost()` + +```php +crmFilesPost($file, $dealId, $contactId, $companyId): \Brevo\Client\Models\FileData +``` Upload a file ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\FilesApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. @@ -276,9 +315,9 @@ $apiInstance = new Brevo\Client\Api\FilesApi( $config ); $file = "/path/to/file.txt"; // \SplFileObject | File data to create a file. -$dealId = "dealId_example"; // string | Deal id linked to a file -$contactId = 789; // int | Contact id linked to a file -$companyId = "companyId_example"; // string | Company id linked to a file +$dealId = 'dealId_example'; // string +$contactId = 56; // int +$companyId = 'companyId_example'; // string try { $result = $apiInstance->crmFilesPost($file, $dealId, $contactId, $companyId); @@ -286,21 +325,20 @@ try { } catch (Exception $e) { echo 'Exception when calling FilesApi->crmFilesPost: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **file** | **\SplFileObject**| File data to create a file. | - **dealId** | **string**| Deal id linked to a file | [optional] - **contactId** | **int**| Contact id linked to a file | [optional] - **companyId** | **string**| Company id linked to a file | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **file** | **\SplFileObject****\SplFileObject**| File data to create a file. | | +| **dealId** | **string**| | [optional] | +| **contactId** | **int**| | [optional] | +| **companyId** | **string**| | [optional] | ### Return type -[**\Brevo\Client\Model\FileData**](../Model/FileData.md) +[**\Brevo\Client\Models\FileData**](../Model/FileData.md) ### Authorization @@ -308,8 +346,9 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: multipart/form-data - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: `multipart/form-data` +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/FoldersApi.md b/docs/Api/FoldersApi.md deleted file mode 100644 index e974372..0000000 --- a/docs/Api/FoldersApi.md +++ /dev/null @@ -1,366 +0,0 @@ -# Brevo\Client\FoldersApi - -All URIs are relative to *https://api.brevo.com/v3* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createFolder**](FoldersApi.md#createFolder) | **POST** /contacts/folders | Create a folder -[**deleteFolder**](FoldersApi.md#deleteFolder) | **DELETE** /contacts/folders/{folderId} | Delete a folder (and all its lists) -[**getFolder**](FoldersApi.md#getFolder) | **GET** /contacts/folders/{folderId} | Returns a folder's details -[**getFolderLists**](FoldersApi.md#getFolderLists) | **GET** /contacts/folders/{folderId}/lists | Get lists in a folder -[**getFolders**](FoldersApi.md#getFolders) | **GET** /contacts/folders | Get all folders -[**updateFolder**](FoldersApi.md#updateFolder) | **PUT** /contacts/folders/{folderId} | Update a folder - - -# **createFolder** -> \Brevo\Client\Model\CreateModel createFolder($createFolder) - -Create a folder - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 \Brevo\Client\Model\CreateUpdateFolder(); // \Brevo\Client\Model\CreateUpdateFolder | Name of the folder - -try { - $result = $apiInstance->createFolder($createFolder); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling FoldersApi->createFolder: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **createFolder** | [**\Brevo\Client\Model\CreateUpdateFolder**](../Model/CreateUpdateFolder.md)| Name of the folder | - -### Return type - -[**\Brevo\Client\Model\CreateModel**](../Model/CreateModel.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **deleteFolder** -> deleteFolder($folderId) - -Delete a folder (and all its lists) - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 { - $apiInstance->deleteFolder($folderId); -} catch (Exception $e) { - echo 'Exception when calling FoldersApi->deleteFolder: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **folderId** | **int**| Id of the folder | - -### Return type - -void (empty response body) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **getFolder** -> \Brevo\Client\Model\GetFolder getFolder($folderId) - -Returns a folder's details - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 = $apiInstance->getFolder($folderId); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling FoldersApi->getFolder: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **folderId** | **int**| id of the folder | - -### Return type - -[**\Brevo\Client\Model\GetFolder**](../Model/GetFolder.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **getFolderLists** -> \Brevo\Client\Model\GetFolderLists getFolderLists($folderId, $limit, $offset, $sort) - -Get lists in a folder - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - -try { - $result = $apiInstance->getFolderLists($folderId, $limit, $offset, $sort); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling FoldersApi->getFolderLists: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **folderId** | **int**| Id of the folder | - **limit** | **int**| Number of documents per page | [optional] [default to 10] - **offset** | **int**| Index of the first document of the page | [optional] [default to 0] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] - -### Return type - -[**\Brevo\Client\Model\GetFolderLists**](../Model/GetFolderLists.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **getFolders** -> \Brevo\Client\Model\GetFolders getFolders($limit, $offset, $sort) - -Get all folders - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - -try { - $result = $apiInstance->getFolders($limit, $offset, $sort); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling FoldersApi->getFolders: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **limit** | **int**| Number of documents per page | [default to 10] - **offset** | **int**| Index of the first document of the page | [default to 0] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] - -### Return type - -[**\Brevo\Client\Model\GetFolders**](../Model/GetFolders.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **updateFolder** -> updateFolder($folderId, $updateFolder) - -Update a folder - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 \Brevo\Client\Model\CreateUpdateFolder(); // \Brevo\Client\Model\CreateUpdateFolder | Name of the folder - -try { - $apiInstance->updateFolder($folderId, $updateFolder); -} catch (Exception $e) { - echo 'Exception when calling FoldersApi->updateFolder: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **folderId** | **int**| Id of the folder | - **updateFolder** | [**\Brevo\Client\Model\CreateUpdateFolder**](../Model/CreateUpdateFolder.md)| Name of the folder | - -### Return type - -void (empty response body) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - diff --git a/docs/Api/InboundParsingApi.md b/docs/Api/InboundParsingApi.md index 00c0221..475c58f 100644 --- a/docs/Api/InboundParsingApi.md +++ b/docs/Api/InboundParsingApi.md @@ -1,42 +1,49 @@ # Brevo\Client\InboundParsingApi -All URIs are relative to *https://api.brevo.com/v3* +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**getInboundEmailAttachment**](InboundParsingApi.md#getInboundEmailAttachment) | **GET** /inbound/attachments/{downloadToken} | Retrieve inbound attachment with download token. -[**getInboundEmailEvents**](InboundParsingApi.md#getInboundEmailEvents) | **GET** /inbound/events | Get the list of all the events for the received emails. -[**getInboundEmailEventsByUuid**](InboundParsingApi.md#getInboundEmailEventsByUuid) | **GET** /inbound/events/{uuid} | Fetch all events history for one particular received email. +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**getInboundEmailAttachment()**](InboundParsingApi.md#getInboundEmailAttachment) | **GET** /inbound/attachments/{downloadToken} | Retrieve inbound attachment with download token. | +| [**getInboundEmailEvents()**](InboundParsingApi.md#getInboundEmailEvents) | **GET** /inbound/events | Get the list of all the events for the received emails. | +| [**getInboundEmailEventsByUuid()**](InboundParsingApi.md#getInboundEmailEventsByUuid) | **GET** /inbound/events/{uuid} | Fetch all events history for one particular received email. | -# **getInboundEmailAttachment** -> \SplFileObject getInboundEmailAttachment($downloadToken) +## `getInboundEmailAttachment()` + +```php +getInboundEmailAttachment($downloadToken): \SplFileObject +``` Retrieve inbound attachment with download token. This endpoint will retrieve inbound attachment with download token. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\InboundParsingApi( // 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 ); -$downloadToken = "downloadToken_example"; // string | Token to fetch a particular attachment +$downloadToken = 'downloadToken_example'; // string | Token to fetch a particular attachment try { $result = $apiInstance->getInboundEmailAttachment($downloadToken); @@ -44,18 +51,17 @@ try { } catch (Exception $e) { echo 'Exception when calling InboundParsingApi->getInboundEmailAttachment: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **downloadToken** | **string**| Token to fetch a particular attachment | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **downloadToken** | **string**| Token to fetch a particular attachment | | ### Return type -[**\SplFileObject**](../Model/\SplFileObject.md) +**\SplFileObject** ### Authorization @@ -63,44 +69,53 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/octet-stream`, `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getInboundEmailEvents** -> \Brevo\Client\Model\GetInboundEmailEvents getInboundEmailEvents($sender, $startDate, $endDate, $limit, $offset, $sort) +## `getInboundEmailEvents()` + +```php +getInboundEmailEvents($sender, $startDate, $endDate, $limit, $offset, $sort): \Brevo\Client\Models\GetInboundEmailEvents +``` Get the list of all the events for the received emails. This endpoint will show the list of all the events for the received emails. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\InboundParsingApi( // 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 = "sender_example"; // string | Email address of the sender. -$startDate = "startDate_example"; // string | Mandatory if endDate is used. Starting date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) from which you want to fetch the list. Maximum time period that can be selected is one month. -$endDate = "endDate_example"; // string | Mandatory if startDate is used. Ending date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) till which you want to fetch the list. Maximum time period that can be selected is one month. +$sender = 'sender_example'; // string | Email address of the sender. +$startDate = 'startDate_example'; // string | Mandatory if endDate is used. Starting date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) from which you want to fetch the list. Maximum time period that can be selected is one month. +$endDate = 'endDate_example'; // string | Mandatory if startDate is used. Ending date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) till which you want to fetch the list. Maximum time period that can be selected is one month. $limit = 100; // int | Number of documents returned per page $offset = 0; // int | Index of the first document on the page -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation try { $result = $apiInstance->getInboundEmailEvents($sender, $startDate, $endDate, $limit, $offset, $sort); @@ -108,23 +123,22 @@ try { } catch (Exception $e) { echo 'Exception when calling InboundParsingApi->getInboundEmailEvents: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **sender** | **string**| Email address of the sender. | [optional] - **startDate** | **string**| Mandatory if endDate is used. Starting date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) from which you want to fetch the list. Maximum time period that can be selected is one month. | [optional] - **endDate** | **string**| Mandatory if startDate is used. Ending date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) till which you want to fetch the list. Maximum time period that can be selected is one month. | [optional] - **limit** | **int**| Number of documents returned per page | [optional] [default to 100] - **offset** | **int**| Index of the first document on the page | [optional] [default to 0] - **sort** | **string**| Sort the results in the ascending/descending order of record creation | [optional] [default to desc] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **sender** | **string**| Email address of the sender. | [optional] | +| **startDate** | **string**| Mandatory if endDate is used. Starting date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) from which you want to fetch the list. Maximum time period that can be selected is one month. | [optional] | +| **endDate** | **string**| Mandatory if startDate is used. Ending date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) till which you want to fetch the list. Maximum time period that can be selected is one month. | [optional] | +| **limit** | **int**| Number of documents returned per page | [optional] [default to 100] | +| **offset** | **int**| Index of the first document on the page | [optional] [default to 0] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation | [optional] [default to 'desc'] | ### Return type -[**\Brevo\Client\Model\GetInboundEmailEvents**](../Model/GetInboundEmailEvents.md) +[**\Brevo\Client\Models\GetInboundEmailEvents**](../Model/GetInboundEmailEvents.md) ### Authorization @@ -132,39 +146,48 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getInboundEmailEventsByUuid** -> \Brevo\Client\Model\GetInboundEmailEventsByUuid getInboundEmailEventsByUuid($uuid) +## `getInboundEmailEventsByUuid()` + +```php +getInboundEmailEventsByUuid($uuid): \Brevo\Client\Models\GetInboundEmailEventsByUuid +``` Fetch all events history for one particular received email. This endpoint will show the list of all events history for one particular received email. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\InboundParsingApi( // 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 ); -$uuid = "uuid_example"; // string | UUID to fetch events specific to recieved email +$uuid = 'uuid_example'; // string | UUID to fetch events specific to recieved email try { $result = $apiInstance->getInboundEmailEventsByUuid($uuid); @@ -172,18 +195,17 @@ try { } catch (Exception $e) { echo 'Exception when calling InboundParsingApi->getInboundEmailEventsByUuid: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **uuid** | **string**| UUID to fetch events specific to recieved email | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **uuid** | **string**| UUID to fetch events specific to recieved email | | ### Return type -[**\Brevo\Client\Model\GetInboundEmailEventsByUuid**](../Model/GetInboundEmailEventsByUuid.md) +[**\Brevo\Client\Models\GetInboundEmailEventsByUuid**](../Model/GetInboundEmailEventsByUuid.md) ### Authorization @@ -191,8 +213,9 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: Not defined +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/ListsApi.md b/docs/Api/ListsApi.md deleted file mode 100644 index 94f60a1..0000000 --- a/docs/Api/ListsApi.md +++ /dev/null @@ -1,552 +0,0 @@ -# Brevo\Client\ListsApi - -All URIs are relative to *https://api.brevo.com/v3* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**addContactToList**](ListsApi.md#addContactToList) | **POST** /contacts/lists/{listId}/contacts/add | Add existing contacts to a list -[**createList**](ListsApi.md#createList) | **POST** /contacts/lists | Create a list -[**deleteList**](ListsApi.md#deleteList) | **DELETE** /contacts/lists/{listId} | Delete a list -[**getContactsFromList**](ListsApi.md#getContactsFromList) | **GET** /contacts/lists/{listId}/contacts | Get contacts in a list -[**getFolderLists**](ListsApi.md#getFolderLists) | **GET** /contacts/folders/{folderId}/lists | Get lists in a folder -[**getList**](ListsApi.md#getList) | **GET** /contacts/lists/{listId} | Get a list's details -[**getLists**](ListsApi.md#getLists) | **GET** /contacts/lists | Get all the lists -[**removeContactFromList**](ListsApi.md#removeContactFromList) | **POST** /contacts/lists/{listId}/contacts/remove | Delete a contact from a list -[**updateList**](ListsApi.md#updateList) | **PUT** /contacts/lists/{listId} | Update a list - - -# **addContactToList** -> \Brevo\Client\Model\PostContactInfo addContactToList($listId, $contactEmails) - -Add existing contacts to a list - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 \Brevo\Client\Model\AddContactToList(); // \Brevo\Client\Model\AddContactToList | Emails addresses OR IDs of the contacts - -try { - $result = $apiInstance->addContactToList($listId, $contactEmails); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ListsApi->addContactToList: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **listId** | **int**| Id of the list | - **contactEmails** | [**\Brevo\Client\Model\AddContactToList**](../Model/AddContactToList.md)| Emails addresses OR IDs of the contacts | - -### Return type - -[**\Brevo\Client\Model\PostContactInfo**](../Model/PostContactInfo.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **createList** -> \Brevo\Client\Model\CreateModel createList($createList) - -Create a list - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 \Brevo\Client\Model\CreateList(); // \Brevo\Client\Model\CreateList | Values to create a list - -try { - $result = $apiInstance->createList($createList); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ListsApi->createList: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **createList** | [**\Brevo\Client\Model\CreateList**](../Model/CreateList.md)| Values to create a list | - -### Return type - -[**\Brevo\Client\Model\CreateModel**](../Model/CreateModel.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **deleteList** -> deleteList($listId) - -Delete a list - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 { - $apiInstance->deleteList($listId); -} catch (Exception $e) { - echo 'Exception when calling ListsApi->deleteList: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **listId** | **int**| Id of the list | - -### Return type - -void (empty response body) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **getContactsFromList** -> \Brevo\Client\Model\GetContacts getContactsFromList($listId, $modifiedSince, $limit, $offset, $sort) - -Get contacts in a list - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 = "modifiedSince_example"; // string | 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 -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - -try { - $result = $apiInstance->getContactsFromList($listId, $modifiedSince, $limit, $offset, $sort); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ListsApi->getContactsFromList: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **listId** | **int**| Id of the list | - **modifiedSince** | **string**| 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] - **limit** | **int**| Number of documents per page | [optional] [default to 50] - **offset** | **int**| Index of the first document of the page | [optional] [default to 0] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] - -### Return type - -[**\Brevo\Client\Model\GetContacts**](../Model/GetContacts.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **getFolderLists** -> \Brevo\Client\Model\GetFolderLists getFolderLists($folderId, $limit, $offset, $sort) - -Get lists in a folder - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - -try { - $result = $apiInstance->getFolderLists($folderId, $limit, $offset, $sort); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ListsApi->getFolderLists: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **folderId** | **int**| Id of the folder | - **limit** | **int**| Number of documents per page | [optional] [default to 10] - **offset** | **int**| Index of the first document of the page | [optional] [default to 0] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] - -### Return type - -[**\Brevo\Client\Model\GetFolderLists**](../Model/GetFolderLists.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **getList** -> \Brevo\Client\Model\GetExtendedList getList($listId) - -Get a list's details - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 = $apiInstance->getList($listId); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ListsApi->getList: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **listId** | **int**| Id of the list | - -### Return type - -[**\Brevo\Client\Model\GetExtendedList**](../Model/GetExtendedList.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **getLists** -> \Brevo\Client\Model\GetLists getLists($limit, $offset, $sort) - -Get all the lists - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed - -try { - $result = $apiInstance->getLists($limit, $offset, $sort); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ListsApi->getLists: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **limit** | **int**| Number of documents per page | [optional] [default to 10] - **offset** | **int**| Index of the first document of the page | [optional] [default to 0] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] - -### Return type - -[**\Brevo\Client\Model\GetLists**](../Model/GetLists.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **removeContactFromList** -> \Brevo\Client\Model\PostContactInfo removeContactFromList($listId, $contactEmails) - -Delete a contact from a list - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 \Brevo\Client\Model\RemoveContactFromList(); // \Brevo\Client\Model\RemoveContactFromList | Emails addresses OR IDs of the contacts - -try { - $result = $apiInstance->removeContactFromList($listId, $contactEmails); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ListsApi->removeContactFromList: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **listId** | **int**| Id of the list | - **contactEmails** | [**\Brevo\Client\Model\RemoveContactFromList**](../Model/RemoveContactFromList.md)| Emails addresses OR IDs of the contacts | - -### Return type - -[**\Brevo\Client\Model\PostContactInfo**](../Model/PostContactInfo.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **updateList** -> updateList($listId, $updateList) - -Update a list - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 \Brevo\Client\Model\UpdateList(); // \Brevo\Client\Model\UpdateList | Values to update a list - -try { - $apiInstance->updateList($listId, $updateList); -} catch (Exception $e) { - echo 'Exception when calling ListsApi->updateList: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **listId** | **int**| Id of the list | - **updateList** | [**\Brevo\Client\Model\UpdateList**](../Model/UpdateList.md)| Values to update a list | - -### Return type - -void (empty response body) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - diff --git a/docs/Api/MasterAccountApi.md b/docs/Api/MasterAccountApi.md index a561e9c..e2cec04 100644 --- a/docs/Api/MasterAccountApi.md +++ b/docs/Api/MasterAccountApi.md @@ -1,71 +1,687 @@ # Brevo\Client\MasterAccountApi -All URIs are relative to *https://api.brevo.com/v3* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**corporateGroupIdPut**](MasterAccountApi.md#corporateGroupIdPut) | **PUT** /corporate/group/{id} | Update a group of sub-accounts -[**corporateGroupPost**](MasterAccountApi.md#corporateGroupPost) | **POST** /corporate/group | Create a new group of sub-accounts -[**corporateMasterAccountGet**](MasterAccountApi.md#corporateMasterAccountGet) | **GET** /corporate/masterAccount | Get the details of requested master account -[**corporateSubAccountGet**](MasterAccountApi.md#corporateSubAccountGet) | **GET** /corporate/subAccount | Get the list of all the sub-accounts of the master account. -[**corporateSubAccountIdApplicationsTogglePut**](MasterAccountApi.md#corporateSubAccountIdApplicationsTogglePut) | **PUT** /corporate/subAccount/{id}/applications/toggle | Enable/disable sub-account application(s) -[**corporateSubAccountIdDelete**](MasterAccountApi.md#corporateSubAccountIdDelete) | **DELETE** /corporate/subAccount/{id} | Delete a sub-account -[**corporateSubAccountIdGet**](MasterAccountApi.md#corporateSubAccountIdGet) | **GET** /corporate/subAccount/{id} | Get sub-account details -[**corporateSubAccountIdPlanPut**](MasterAccountApi.md#corporateSubAccountIdPlanPut) | **PUT** /corporate/subAccount/{id}/plan | Update sub-account plan -[**corporateSubAccountKeyPost**](MasterAccountApi.md#corporateSubAccountKeyPost) | **POST** /corporate/subAccount/key | Create an API key for a sub-account -[**corporateSubAccountPost**](MasterAccountApi.md#corporateSubAccountPost) | **POST** /corporate/subAccount | Create a new sub-account under a master account. -[**corporateSubAccountSsoTokenPost**](MasterAccountApi.md#corporateSubAccountSsoTokenPost) | **POST** /corporate/subAccount/ssoToken | Generate SSO token to access Brevo -[**corporateUserRevokeEmailDelete**](MasterAccountApi.md#corporateUserRevokeEmailDelete) | **DELETE** /corporate/user/revoke/{email} | Revoke an admin user -[**getAccountActivity**](MasterAccountApi.md#getAccountActivity) | **GET** /organization/activities | Get user activity logs -[**getCorporateInvitedUsersList**](MasterAccountApi.md#getCorporateInvitedUsersList) | **GET** /corporate/invited/users | Get the list of all admin users -[**getSubAccountGroups**](MasterAccountApi.md#getSubAccountGroups) | **GET** /corporate/groups | Get the list of groups -[**inviteAdminUser**](MasterAccountApi.md#inviteAdminUser) | **POST** /corporate/user/invitation/send | Send invitation to an admin user - - -# **corporateGroupIdPut** -> corporateGroupIdPut($id, $body) +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**corporateGroupIdDelete()**](MasterAccountApi.md#corporateGroupIdDelete) | **DELETE** /corporate/group/{id} | Delete a group | +| [**corporateGroupIdGet()**](MasterAccountApi.md#corporateGroupIdGet) | **GET** /corporate/group/{id} | GET a group details | +| [**corporateGroupIdPut()**](MasterAccountApi.md#corporateGroupIdPut) | **PUT** /corporate/group/{id} | Update a group of sub-accounts | +| [**corporateGroupPost()**](MasterAccountApi.md#corporateGroupPost) | **POST** /corporate/group | Create a group of sub-accounts | +| [**corporateGroupUnlinkGroupIdSubAccountsPut()**](MasterAccountApi.md#corporateGroupUnlinkGroupIdSubAccountsPut) | **PUT** /corporate/group/unlink/{groupId}/subAccounts | Delete sub-account from group | +| [**corporateIpGet()**](MasterAccountApi.md#corporateIpGet) | **GET** /corporate/ip | List of all IPs | +| [**corporateMasterAccountGet()**](MasterAccountApi.md#corporateMasterAccountGet) | **GET** /corporate/masterAccount | Get the details of requested master account | +| [**corporateSsoTokenPost()**](MasterAccountApi.md#corporateSsoTokenPost) | **POST** /corporate/ssoToken | Generate SSO token to access admin account | +| [**corporateSubAccountGet()**](MasterAccountApi.md#corporateSubAccountGet) | **GET** /corporate/subAccount | Get the list of all the sub-accounts of the master account. | +| [**corporateSubAccountIdApplicationsTogglePut()**](MasterAccountApi.md#corporateSubAccountIdApplicationsTogglePut) | **PUT** /corporate/subAccount/{id}/applications/toggle | Enable/disable sub-account application(s) | +| [**corporateSubAccountIdDelete()**](MasterAccountApi.md#corporateSubAccountIdDelete) | **DELETE** /corporate/subAccount/{id} | Delete a sub-account | +| [**corporateSubAccountIdGet()**](MasterAccountApi.md#corporateSubAccountIdGet) | **GET** /corporate/subAccount/{id} | Get sub-account details | +| [**corporateSubAccountIdPlanPut()**](MasterAccountApi.md#corporateSubAccountIdPlanPut) | **PUT** /corporate/subAccount/{id}/plan | Update sub-account plan | +| [**corporateSubAccountIpAssociatePost()**](MasterAccountApi.md#corporateSubAccountIpAssociatePost) | **POST** /corporate/subAccount/ip/associate | Associate an IP to sub-accounts | +| [**corporateSubAccountIpDissociatePut()**](MasterAccountApi.md#corporateSubAccountIpDissociatePut) | **PUT** /corporate/subAccount/ip/dissociate | Dissociate an IP to sub-accounts | +| [**corporateSubAccountKeyPost()**](MasterAccountApi.md#corporateSubAccountKeyPost) | **POST** /corporate/subAccount/key | Create an API key for a sub-account | +| [**corporateSubAccountPost()**](MasterAccountApi.md#corporateSubAccountPost) | **POST** /corporate/subAccount | Create a new sub-account under a master account. | +| [**corporateSubAccountSsoTokenPost()**](MasterAccountApi.md#corporateSubAccountSsoTokenPost) | **POST** /corporate/subAccount/ssoToken | Generate SSO token to access sub-account | +| [**corporateUserEmailPermissionsPut()**](MasterAccountApi.md#corporateUserEmailPermissionsPut) | **PUT** /corporate/user/{email}/permissions | Change admin user permissions | +| [**corporateUserInvitationActionEmailPut()**](MasterAccountApi.md#corporateUserInvitationActionEmailPut) | **PUT** /corporate/user/invitation/{action}/{email} | Resend / cancel admin user invitation | +| [**corporateUserRevokeEmailDelete()**](MasterAccountApi.md#corporateUserRevokeEmailDelete) | **DELETE** /corporate/user/revoke/{email} | Revoke an admin user | +| [**getAccountActivity_0()**](MasterAccountApi.md#getAccountActivity_0) | **GET** /organization/activities | Get user activity logs | +| [**getCorporateInvitedUsersList()**](MasterAccountApi.md#getCorporateInvitedUsersList) | **GET** /corporate/invited/users | Get the list of all admin users | +| [**getCorporateUserPermission()**](MasterAccountApi.md#getCorporateUserPermission) | **GET** /corporate/user/{email}/permissions | Check admin user permissions | +| [**getSubAccountGroups()**](MasterAccountApi.md#getSubAccountGroups) | **GET** /corporate/groups | Get the list of groups | +| [**inviteAdminUser()**](MasterAccountApi.md#inviteAdminUser) | **POST** /corporate/user/invitation/send | Send invitation to an admin user | + + +## `corporateGroupIdDelete()` + +```php +corporateGroupIdDelete($id) +``` + +Delete a group + +This endpoint allows you to delete a group of sub-organizations. When a group is deleted, the sub-organizations are no longer part of this group. The users associated with the group are no longer associated with the group once deleted. + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\MasterAccountApi( + // 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 +); +$id = 'id_example'; // string | Id of the group + +try { + $apiInstance->corporateGroupIdDelete($id); +} catch (Exception $e) { + echo 'Exception when calling MasterAccountApi->corporateGroupIdDelete: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| Id of the group | | + +### Return type + +void (empty response body) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `corporateGroupIdGet()` + +```php +corporateGroupIdGet($id): \Brevo\Client\Models\CorporateGroupDetailsResponse +``` + +GET a group details + +This endpoint allows you to retrieve a specific group’s information such as the list of sub-organizations and the user associated with the group. + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\MasterAccountApi( + // 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 +); +$id = 'id_example'; // string | Id of the group of sub-organization + +try { + $result = $apiInstance->corporateGroupIdGet($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MasterAccountApi->corporateGroupIdGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| Id of the group of sub-organization | | + +### Return type + +[**\Brevo\Client\Models\CorporateGroupDetailsResponse**](../Model/CorporateGroupDetailsResponse.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `corporateGroupIdPut()` + +```php +corporateGroupIdPut($id, $corporateGroupIdPutRequest) +``` Update a group of sub-accounts -This endpoint allows you to update a group of sub-accounts +This endpoint allows to update a group of sub-accounts + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\MasterAccountApi( + // 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 +); +$id = 'id_example'; // string | Id of the group +$corporateGroupIdPutRequest = new \Brevo\Client\Models\CorporateGroupIdPutRequest(); // \Brevo\Client\Models\CorporateGroupIdPutRequest | Group details to be updated. + +try { + $apiInstance->corporateGroupIdPut($id, $corporateGroupIdPutRequest); +} catch (Exception $e) { + echo 'Exception when calling MasterAccountApi->corporateGroupIdPut: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| Id of the group | | +| **corporateGroupIdPutRequest** | [**\Brevo\Client\Models\CorporateGroupIdPutRequest**](../Model/CorporateGroupIdPutRequest.md)| Group details to be updated. | | + +### Return type + +void (empty response body) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `corporateGroupPost()` + +```php +corporateGroupPost($corporateGroupPostRequest): \Brevo\Client\Models\CorporateGroupPost201Response +``` + +Create a group of sub-accounts + +This endpoint allows to create a group of sub-accounts + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\MasterAccountApi( + // 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 +); +$corporateGroupPostRequest = new \Brevo\Client\Models\CorporateGroupPostRequest(); // \Brevo\Client\Models\CorporateGroupPostRequest + +try { + $result = $apiInstance->corporateGroupPost($corporateGroupPostRequest); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MasterAccountApi->corporateGroupPost: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **corporateGroupPostRequest** | [**\Brevo\Client\Models\CorporateGroupPostRequest**](../Model/CorporateGroupPostRequest.md)| | [optional] | + +### Return type + +[**\Brevo\Client\Models\CorporateGroupPost201Response**](../Model/CorporateGroupPost201Response.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `corporateGroupUnlinkGroupIdSubAccountsPut()` + +```php +corporateGroupUnlinkGroupIdSubAccountsPut($groupId, $corporateGroupUnlinkGroupIdSubAccountsPutRequest) +``` + +Delete sub-account from group + +This endpoint allows you to remove a sub-organization from a group. + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\MasterAccountApi( + // 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 +); +$groupId = 'groupId_example'; // string | Group id +$corporateGroupUnlinkGroupIdSubAccountsPutRequest = new \Brevo\Client\Models\CorporateGroupUnlinkGroupIdSubAccountsPutRequest(); // \Brevo\Client\Models\CorporateGroupUnlinkGroupIdSubAccountsPutRequest | List of sub-account ids + +try { + $apiInstance->corporateGroupUnlinkGroupIdSubAccountsPut($groupId, $corporateGroupUnlinkGroupIdSubAccountsPutRequest); +} catch (Exception $e) { + echo 'Exception when calling MasterAccountApi->corporateGroupUnlinkGroupIdSubAccountsPut: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupId** | **string**| Group id | | +| **corporateGroupUnlinkGroupIdSubAccountsPutRequest** | [**\Brevo\Client\Models\CorporateGroupUnlinkGroupIdSubAccountsPutRequest**](../Model/CorporateGroupUnlinkGroupIdSubAccountsPutRequest.md)| List of sub-account ids | | + +### Return type + +void (empty response body) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `corporateIpGet()` + +```php +corporateIpGet(): \Brevo\Client\Models\CorporateIpGet200ResponseInner[] +``` + +List of all IPs + +This endpoint allows you to retrieve the list of active IPs on your Admin account + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\MasterAccountApi( + // 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 = $apiInstance->corporateIpGet(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MasterAccountApi->corporateIpGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Brevo\Client\Models\CorporateIpGet200ResponseInner[]**](../Model/CorporateIpGet200ResponseInner.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `corporateMasterAccountGet()` + +```php +corporateMasterAccountGet(): \Brevo\Client\Models\MasterDetailsResponse +``` + +Get the details of requested master account + +This endpoint will provide the details of the master account. + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\MasterAccountApi( + // 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 = $apiInstance->corporateMasterAccountGet(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MasterAccountApi->corporateMasterAccountGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Brevo\Client\Models\MasterDetailsResponse**](../Model/MasterDetailsResponse.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `corporateSsoTokenPost()` + +```php +corporateSsoTokenPost($corporateSsoTokenPostRequest): \Brevo\Client\Models\GetSsoToken +``` + +Generate SSO token to access admin account + +This endpoint generates an SSO token to authenticate and access the admin account using the endpoint https://account-app.brevo.com/account/login/corporate/sso/[token], where [token] will be replaced by the actual token. + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\MasterAccountApi( + // 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 +); +$corporateSsoTokenPostRequest = new \Brevo\Client\Models\CorporateSsoTokenPostRequest(); // \Brevo\Client\Models\CorporateSsoTokenPostRequest + +try { + $result = $apiInstance->corporateSsoTokenPost($corporateSsoTokenPostRequest); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MasterAccountApi->corporateSsoTokenPost: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **corporateSsoTokenPostRequest** | [**\Brevo\Client\Models\CorporateSsoTokenPostRequest**](../Model/CorporateSsoTokenPostRequest.md)| | [optional] | + +### Return type + +[**\Brevo\Client\Models\GetSsoToken**](../Model/GetSsoToken.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `corporateSubAccountGet()` + +```php +corporateSubAccountGet($offset, $limit): \Brevo\Client\Models\SubAccountsResponse +``` + +Get the list of all the sub-accounts of the master account. + +This endpoint will provide the list all the sub-accounts of the master account. + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\MasterAccountApi( + // 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 +); +$offset = 56; // int | Index of the first sub-account in the page +$limit = 56; // int | Number of sub-accounts to be displayed on each page + +try { + $result = $apiInstance->corporateSubAccountGet($offset, $limit); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MasterAccountApi->corporateSubAccountGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **offset** | **int**| Index of the first sub-account in the page | | +| **limit** | **int**| Number of sub-accounts to be displayed on each page | | + +### Return type + +[**\Brevo\Client\Models\SubAccountsResponse**](../Model/SubAccountsResponse.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `corporateSubAccountIdApplicationsTogglePut()` + +```php +corporateSubAccountIdApplicationsTogglePut($id, $subAccountAppsToggleRequest) +``` + +Enable/disable sub-account application(s) + +API endpoints for the Corporate owner to enable/disable applications on the sub-account ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\MasterAccountApi( // 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 ); -$id = "id_example"; // string | Id of the group -$body = new \Brevo\Client\Model\Body1(); // \Brevo\Client\Model\Body1 | Group details to be updated. +$id = 56; // int | Id of the sub-account organization (mandatory) +$subAccountAppsToggleRequest = new \Brevo\Client\Models\SubAccountAppsToggleRequest(); // \Brevo\Client\Models\SubAccountAppsToggleRequest | List of applications to activate or deactivate on a sub-account try { - $apiInstance->corporateGroupIdPut($id, $body); + $apiInstance->corporateSubAccountIdApplicationsTogglePut($id, $subAccountAppsToggleRequest); } catch (Exception $e) { - echo 'Exception when calling MasterAccountApi->corporateGroupIdPut: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling MasterAccountApi->corporateSubAccountIdApplicationsTogglePut: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| Id of the group | - **body** | [**\Brevo\Client\Model\Body1**](../Model/Body1.md)| Group details to be updated. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| Id of the sub-account organization (mandatory) | | +| **subAccountAppsToggleRequest** | [**\Brevo\Client\Models\SubAccountAppsToggleRequest**](../Model/SubAccountAppsToggleRequest.md)| List of applications to activate or deactivate on a sub-account | | ### Return type @@ -77,58 +693,63 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **corporateGroupPost** -> \Brevo\Client\Model\InlineResponse201 corporateGroupPost($body) +## `corporateSubAccountIdDelete()` -Create a new group of sub-accounts +```php +corporateSubAccountIdDelete($id) +``` -This endpoint allows to create a group of sub-accounts +Delete a sub-account ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\MasterAccountApi( // 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 ); -$body = new \Brevo\Client\Model\Body(); // \Brevo\Client\Model\Body | Group details to be created. +$id = 56; // int | Id of the sub-account organization to be deleted try { - $result = $apiInstance->corporateGroupPost($body); - print_r($result); + $apiInstance->corporateSubAccountIdDelete($id); } catch (Exception $e) { - echo 'Exception when calling MasterAccountApi->corporateGroupPost: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling MasterAccountApi->corporateSubAccountIdDelete: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**\Brevo\Client\Model\Body**](../Model/Body.md)| Group details to be created. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| Id of the sub-account organization to be deleted | | ### Return type -[**\Brevo\Client\Model\InlineResponse201**](../Model/InlineResponse201.md) +void (empty response body) ### Authorization @@ -136,54 +757,66 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **corporateMasterAccountGet** -> \Brevo\Client\Model\MasterDetailsResponse corporateMasterAccountGet() +## `corporateSubAccountIdGet()` -Get the details of requested master account +```php +corporateSubAccountIdGet($id): \Brevo\Client\Models\SubAccountDetailsResponse +``` -This endpoint will provide the details of the master account. +Get sub-account details + +This endpoint will provide the details for the specified sub-account company ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\MasterAccountApi( // 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 ); +$id = 56; // int | Id of the sub-account organization try { - $result = $apiInstance->corporateMasterAccountGet(); + $result = $apiInstance->corporateSubAccountIdGet($id); print_r($result); } catch (Exception $e) { - echo 'Exception when calling MasterAccountApi->corporateMasterAccountGet: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling MasterAccountApi->corporateSubAccountIdGet: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -This endpoint does not need any parameter. + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| Id of the sub-account organization | | ### Return type -[**\Brevo\Client\Model\MasterDetailsResponse**](../Model/MasterDetailsResponse.md) +[**\Brevo\Client\Models\SubAccountDetailsResponse**](../Model/SubAccountDetailsResponse.md) ### Authorization @@ -191,60 +824,67 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **corporateSubAccountGet** -> \Brevo\Client\Model\SubAccountsResponse corporateSubAccountGet($offset, $limit) +## `corporateSubAccountIdPlanPut()` -Get the list of all the sub-accounts of the master account. +```php +corporateSubAccountIdPlanPut($id, $subAccountUpdatePlanRequest) +``` -This endpoint will provide the list all the sub-accounts of the master account. +Update sub-account plan + +This endpoint will update the sub-account plan. On the Corporate solution new version v2, you can set an unlimited number of credits in your sub-organization. Please pass the value “-1\" to set the consumable in unlimited mode. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\MasterAccountApi( // 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 ); -$offset = 56; // int | Index of the first sub-account in the page -$limit = 56; // int | Number of sub-accounts to be displayed on each page +$id = 56; // int | Id of the sub-account organization +$subAccountUpdatePlanRequest = new \Brevo\Client\Models\SubAccountUpdatePlanRequest(); // \Brevo\Client\Models\SubAccountUpdatePlanRequest | Values to update a sub-account plan try { - $result = $apiInstance->corporateSubAccountGet($offset, $limit); - print_r($result); + $apiInstance->corporateSubAccountIdPlanPut($id, $subAccountUpdatePlanRequest); } catch (Exception $e) { - echo 'Exception when calling MasterAccountApi->corporateSubAccountGet: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling MasterAccountApi->corporateSubAccountIdPlanPut: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **offset** | **int**| Index of the first sub-account in the page | - **limit** | **int**| Number of sub-accounts to be displayed on each page | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| Id of the sub-account organization | | +| **subAccountUpdatePlanRequest** | [**\Brevo\Client\Models\SubAccountUpdatePlanRequest**](../Model/SubAccountUpdatePlanRequest.md)| Values to update a sub-account plan | | ### Return type -[**\Brevo\Client\Model\SubAccountsResponse**](../Model/SubAccountsResponse.md) +void (empty response body) ### Authorization @@ -252,59 +892,66 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **corporateSubAccountIdApplicationsTogglePut** -> corporateSubAccountIdApplicationsTogglePut($id, $toggleApplications) +## `corporateSubAccountIpAssociatePost()` -Enable/disable sub-account application(s) +```php +corporateSubAccountIpAssociatePost($corporateSubAccountIpAssociatePostRequest): object +``` + +Associate an IP to sub-accounts -API endpoint for the Corporate owner to enable/disable applications on the sub-account +This endpoint allows to associate an IP to sub-accounts ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\MasterAccountApi( // 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 ); -$id = 789; // int | Id of the sub-account organization (mandatory) -$toggleApplications = new \Brevo\Client\Model\SubAccountAppsToggleRequest(); // \Brevo\Client\Model\SubAccountAppsToggleRequest | List of applications to activate or deactivate on a sub-account +$corporateSubAccountIpAssociatePostRequest = new \Brevo\Client\Models\CorporateSubAccountIpAssociatePostRequest(); // \Brevo\Client\Models\CorporateSubAccountIpAssociatePostRequest try { - $apiInstance->corporateSubAccountIdApplicationsTogglePut($id, $toggleApplications); + $result = $apiInstance->corporateSubAccountIpAssociatePost($corporateSubAccountIpAssociatePostRequest); + print_r($result); } catch (Exception $e) { - echo 'Exception when calling MasterAccountApi->corporateSubAccountIdApplicationsTogglePut: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling MasterAccountApi->corporateSubAccountIpAssociatePost: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| Id of the sub-account organization (mandatory) | - **toggleApplications** | [**\Brevo\Client\Model\SubAccountAppsToggleRequest**](../Model/SubAccountAppsToggleRequest.md)| List of applications to activate or deactivate on a sub-account | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **corporateSubAccountIpAssociatePostRequest** | [**\Brevo\Client\Models\CorporateSubAccountIpAssociatePostRequest**](../Model/CorporateSubAccountIpAssociatePostRequest.md)| | [optional] | ### Return type -void (empty response body) +**object** ### Authorization @@ -312,51 +959,61 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **corporateSubAccountIdDelete** -> corporateSubAccountIdDelete($id) +## `corporateSubAccountIpDissociatePut()` -Delete a sub-account +```php +corporateSubAccountIpDissociatePut($corporateSubAccountIpDissociatePutRequest) +``` + +Dissociate an IP to sub-accounts + +This endpoint allows to dissociate an IP from sub-accounts ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\MasterAccountApi( // 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 ); -$id = 789; // int | Id of the sub-account organization to be deleted +$corporateSubAccountIpDissociatePutRequest = new \Brevo\Client\Models\CorporateSubAccountIpDissociatePutRequest(); // \Brevo\Client\Models\CorporateSubAccountIpDissociatePutRequest try { - $apiInstance->corporateSubAccountIdDelete($id); + $apiInstance->corporateSubAccountIpDissociatePut($corporateSubAccountIpDissociatePutRequest); } catch (Exception $e) { - echo 'Exception when calling MasterAccountApi->corporateSubAccountIdDelete: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling MasterAccountApi->corporateSubAccountIpDissociatePut: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| Id of the sub-account organization to be deleted | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **corporateSubAccountIpDissociatePutRequest** | [**\Brevo\Client\Models\CorporateSubAccountIpDissociatePutRequest**](../Model/CorporateSubAccountIpDissociatePutRequest.md)| | [optional] | ### Return type @@ -368,58 +1025,66 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **corporateSubAccountIdGet** -> \Brevo\Client\Model\SubAccountDetailsResponse corporateSubAccountIdGet($id) +## `corporateSubAccountKeyPost()` -Get sub-account details +```php +corporateSubAccountKeyPost($corporateSubAccountKeyPostRequest): \Brevo\Client\Models\CreateApiKeyResponse +``` -This endpoint will provide the details for the specified sub-account company +Create an API key for a sub-account + +This endpoint will generate an API v3 key for a sub account ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\MasterAccountApi( // 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 ); -$id = 789; // int | Id of the sub-account organization +$corporateSubAccountKeyPostRequest = new \Brevo\Client\Models\CorporateSubAccountKeyPostRequest(); // \Brevo\Client\Models\CorporateSubAccountKeyPostRequest try { - $result = $apiInstance->corporateSubAccountIdGet($id); + $result = $apiInstance->corporateSubAccountKeyPost($corporateSubAccountKeyPostRequest); print_r($result); } catch (Exception $e) { - echo 'Exception when calling MasterAccountApi->corporateSubAccountIdGet: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling MasterAccountApi->corporateSubAccountKeyPost: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| Id of the sub-account organization | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **corporateSubAccountKeyPostRequest** | [**\Brevo\Client\Models\CorporateSubAccountKeyPostRequest**](../Model/CorporateSubAccountKeyPostRequest.md)| | [optional] | ### Return type -[**\Brevo\Client\Model\SubAccountDetailsResponse**](../Model/SubAccountDetailsResponse.md) +[**\Brevo\Client\Models\CreateApiKeyResponse**](../Model/CreateApiKeyResponse.md) ### Authorization @@ -427,59 +1092,66 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **corporateSubAccountIdPlanPut** -> corporateSubAccountIdPlanPut($id, $updatePlanDetails) +## `corporateSubAccountPost()` -Update sub-account plan +```php +corporateSubAccountPost($createSubAccount): \Brevo\Client\Models\CreateSubAccountResponse +``` + +Create a new sub-account under a master account. -This endpoint will update the sub-account plan +This endpoint will create a new sub-account under a master account ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\MasterAccountApi( // 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 ); -$id = 789; // int | Id of the sub-account organization -$updatePlanDetails = new \Brevo\Client\Model\SubAccountUpdatePlanRequest(); // \Brevo\Client\Model\SubAccountUpdatePlanRequest | Values to update a sub-account plan +$createSubAccount = new \Brevo\Client\Models\CreateSubAccount(); // \Brevo\Client\Models\CreateSubAccount | Request body with sub-account organization name try { - $apiInstance->corporateSubAccountIdPlanPut($id, $updatePlanDetails); + $result = $apiInstance->corporateSubAccountPost($createSubAccount); + print_r($result); } catch (Exception $e) { - echo 'Exception when calling MasterAccountApi->corporateSubAccountIdPlanPut: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling MasterAccountApi->corporateSubAccountPost: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| Id of the sub-account organization | - **updatePlanDetails** | [**\Brevo\Client\Model\SubAccountUpdatePlanRequest**](../Model/SubAccountUpdatePlanRequest.md)| Values to update a sub-account plan | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **createSubAccount** | [**\Brevo\Client\Models\CreateSubAccount**](../Model/CreateSubAccount.md)| Request body with sub-account organization name | | ### Return type -void (empty response body) +[**\Brevo\Client\Models\CreateSubAccountResponse**](../Model/CreateSubAccountResponse.md) ### Authorization @@ -487,58 +1159,66 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **corporateSubAccountKeyPost** -> \Brevo\Client\Model\CreateApiKeyResponse corporateSubAccountKeyPost($createApiKeyRequest) +## `corporateSubAccountSsoTokenPost()` -Create an API key for a sub-account +```php +corporateSubAccountSsoTokenPost($corporateSubAccountSsoTokenPostRequest): \Brevo\Client\Models\GetSsoToken +``` -This endpoint will generate an API v3 key for a sub account +Generate SSO token to access sub-account + +This endpoint generates an sso token to authenticate and access a sub-account of the master using the account endpoint https://account-app.brevo.com/account/login/sub-account/sso/[token], where [token] will be replaced by the actual token. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\MasterAccountApi( // 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 ); -$createApiKeyRequest = new \Brevo\Client\Model\CreateApiKeyRequest(); // \Brevo\Client\Model\CreateApiKeyRequest | Values to generate API key for sub-account +$corporateSubAccountSsoTokenPostRequest = new \Brevo\Client\Models\CorporateSubAccountSsoTokenPostRequest(); // \Brevo\Client\Models\CorporateSubAccountSsoTokenPostRequest try { - $result = $apiInstance->corporateSubAccountKeyPost($createApiKeyRequest); + $result = $apiInstance->corporateSubAccountSsoTokenPost($corporateSubAccountSsoTokenPostRequest); print_r($result); } catch (Exception $e) { - echo 'Exception when calling MasterAccountApi->corporateSubAccountKeyPost: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling MasterAccountApi->corporateSubAccountSsoTokenPost: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **createApiKeyRequest** | [**\Brevo\Client\Model\CreateApiKeyRequest**](../Model/CreateApiKeyRequest.md)| Values to generate API key for sub-account | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **corporateSubAccountSsoTokenPostRequest** | [**\Brevo\Client\Models\CorporateSubAccountSsoTokenPostRequest**](../Model/CorporateSubAccountSsoTokenPostRequest.md)| | [optional] | ### Return type -[**\Brevo\Client\Model\CreateApiKeyResponse**](../Model/CreateApiKeyResponse.md) +[**\Brevo\Client\Models\GetSsoToken**](../Model/GetSsoToken.md) ### Authorization @@ -546,58 +1226,67 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **corporateSubAccountPost** -> \Brevo\Client\Model\CreateSubAccountResponse corporateSubAccountPost($subAccountCreate) +## `corporateUserEmailPermissionsPut()` -Create a new sub-account under a master account. +```php +corporateUserEmailPermissionsPut($email, $corporateUserEmailPermissionsPutRequest) +``` -This endpoint will create a new sub-account under a master account +Change admin user permissions + +This endpoint will allow you to change the permissions of Admin users of your Admin account ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\MasterAccountApi( // 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 ); -$subAccountCreate = new \Brevo\Client\Model\CreateSubAccount(); // \Brevo\Client\Model\CreateSubAccount | values to create new sub-account +$email = 'email_example'; // string | Email address of Admin user +$corporateUserEmailPermissionsPutRequest = {"all_features_access":false,"privileges":[{"feature":"user_management","permissions":["all"]},{"feature":"api","permissions":["all"]},{"feature":"my_plan","permissions":["none"]},{"feature":"apps_management","permissions":["all"]},{"feature":"create_sub_organizations","permissions":["all"]},{"feature":"sub_organization_groups","permissions":["create","edit_delete"]},{"feature":"manage_sub_organizations","permissions":["all"]},{"feature":"security","permissions":["none"]},{"feature":"analytics","permissions":["create_alerts","download_data","my_looks","explore_create"]}]}; // \Brevo\Client\Models\CorporateUserEmailPermissionsPutRequest | Values to update an admin user permissions try { - $result = $apiInstance->corporateSubAccountPost($subAccountCreate); - print_r($result); + $apiInstance->corporateUserEmailPermissionsPut($email, $corporateUserEmailPermissionsPutRequest); } catch (Exception $e) { - echo 'Exception when calling MasterAccountApi->corporateSubAccountPost: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling MasterAccountApi->corporateUserEmailPermissionsPut: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **subAccountCreate** | [**\Brevo\Client\Model\CreateSubAccount**](../Model/CreateSubAccount.md)| values to create new sub-account | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email** | **string**| Email address of Admin user | | +| **corporateUserEmailPermissionsPutRequest** | [**\Brevo\Client\Models\CorporateUserEmailPermissionsPutRequest**](../Model/CorporateUserEmailPermissionsPutRequest.md)| Values to update an admin user permissions | | ### Return type -[**\Brevo\Client\Model\CreateSubAccountResponse**](../Model/CreateSubAccountResponse.md) +void (empty response body) ### Authorization @@ -605,58 +1294,68 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **corporateSubAccountSsoTokenPost** -> \Brevo\Client\Model\GetSsoToken corporateSubAccountSsoTokenPost($ssoTokenRequest) +## `corporateUserInvitationActionEmailPut()` + +```php +corporateUserInvitationActionEmailPut($action, $email): \Brevo\Client\Models\CorporateUserInvitationActionEmailPut200Response +``` -Generate SSO token to access Brevo +Resend / cancel admin user invitation -This endpoint generates an sso token to authenticate and access a sub-account of the master using the account endpoint https://account-app.brevo.com/account/login/sub-account/sso/[token], where [token] will be replaced by the actual token. +This endpoint will allow the user to: - Resend an admin user invitation - Cancel an admin user invitation ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\MasterAccountApi( // 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 ); -$ssoTokenRequest = new \Brevo\Client\Model\SsoTokenRequest(); // \Brevo\Client\Model\SsoTokenRequest | Values to generate SSO token for sub-account +$action = 'action_example'; // string | Action to be performed (cancel / resend) +$email = 'email_example'; // string | Email address of the recipient try { - $result = $apiInstance->corporateSubAccountSsoTokenPost($ssoTokenRequest); + $result = $apiInstance->corporateUserInvitationActionEmailPut($action, $email); print_r($result); } catch (Exception $e) { - echo 'Exception when calling MasterAccountApi->corporateSubAccountSsoTokenPost: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling MasterAccountApi->corporateUserInvitationActionEmailPut: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **ssoTokenRequest** | [**\Brevo\Client\Model\SsoTokenRequest**](../Model/SsoTokenRequest.md)| Values to generate SSO token for sub-account | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **action** | **string**| Action to be performed (cancel / resend) | | +| **email** | **string**| Email address of the recipient | | ### Return type -[**\Brevo\Client\Model\GetSsoToken**](../Model/GetSsoToken.md) +[**\Brevo\Client\Models\CorporateUserInvitationActionEmailPut200Response**](../Model/CorporateUserInvitationActionEmailPut200Response.md) ### Authorization @@ -664,53 +1363,61 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `corporateUserRevokeEmailDelete()` -# **corporateUserRevokeEmailDelete** -> corporateUserRevokeEmailDelete($email) +```php +corporateUserRevokeEmailDelete($email) +``` Revoke an admin user This endpoint allows to revoke/remove an invited member of your Admin account ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\MasterAccountApi( // 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 of the invited user +$email = 'email_example'; // string | Email of the invited user try { $apiInstance->corporateUserRevokeEmailDelete($email); } catch (Exception $e) { echo 'Exception when calling MasterAccountApi->corporateUserRevokeEmailDelete: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **email** | **string**| Email of the invited user | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email** | **string**| Email of the invited user | | ### Return type @@ -722,62 +1429,70 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getAccountActivity** -> \Brevo\Client\Model\GetAccountActivity getAccountActivity($startDate, $endDate, $limit, $offset) +## `getAccountActivity_0()` + +```php +getAccountActivity_0($startDate, $endDate, $limit, $offset): \Brevo\Client\Models\GetAccountActivity +``` Get user activity logs ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\MasterAccountApi( // 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 = "startDate_example"; // string | Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. -$endDate = "endDate_example"; // string | Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. +$startDate = 'startDate_example'; // string | Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. +$endDate = 'endDate_example'; // string | Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. $limit = 10; // int | Number of documents per page $offset = 0; // int | Index of the first document in the page. try { - $result = $apiInstance->getAccountActivity($startDate, $endDate, $limit, $offset); + $result = $apiInstance->getAccountActivity_0($startDate, $endDate, $limit, $offset); print_r($result); } catch (Exception $e) { - echo 'Exception when calling MasterAccountApi->getAccountActivity: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling MasterAccountApi->getAccountActivity_0: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **startDate** | **string**| Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. | [optional] - **endDate** | **string**| Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. | [optional] - **limit** | **int**| Number of documents per page | [optional] [default to 10] - **offset** | **int**| Index of the first document in the page. | [optional] [default to 0] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **startDate** | **string**| Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. | [optional] | +| **endDate** | **string**| Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. | [optional] | +| **limit** | **int**| Number of documents per page | [optional] [default to 10] | +| **offset** | **int**| Index of the first document in the page. | [optional] [default to 0] | ### Return type -[**\Brevo\Client\Model\GetAccountActivity**](../Model/GetAccountActivity.md) +[**\Brevo\Client\Models\GetAccountActivity**](../Model/GetAccountActivity.md) ### Authorization @@ -785,32 +1500,41 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `getCorporateInvitedUsersList()` -# **getCorporateInvitedUsersList** -> \Brevo\Client\Model\GetCorporateInvitedUsersList getCorporateInvitedUsersList() +```php +getCorporateInvitedUsersList(): \Brevo\Client\Models\GetCorporateInvitedUsersList +``` Get the list of all admin users This endpoint allows you to list all Admin users of your Admin account ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\MasterAccountApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. @@ -824,15 +1548,82 @@ try { } catch (Exception $e) { echo 'Exception when calling MasterAccountApi->getCorporateInvitedUsersList: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters + This endpoint does not need any parameter. ### Return type -[**\Brevo\Client\Model\GetCorporateInvitedUsersList**](../Model/GetCorporateInvitedUsersList.md) +[**\Brevo\Client\Models\GetCorporateInvitedUsersList**](../Model/GetCorporateInvitedUsersList.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getCorporateUserPermission()` + +```php +getCorporateUserPermission($email): \Brevo\Client\Models\GetCorporateUserPermission +``` + +Check admin user permissions + +This endpoint will provide the list of admin user permissions + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\MasterAccountApi( + // 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 of the invited user. + +try { + $result = $apiInstance->getCorporateUserPermission($email); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MasterAccountApi->getCorporateUserPermission: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email** | **string**| Email of the invited user. | | + +### Return type + +[**\Brevo\Client\Models\GetCorporateUserPermission**](../Model/GetCorporateUserPermission.md) ### Authorization @@ -840,32 +1631,41 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getSubAccountGroups** -> \Brevo\Client\Model\InlineResponse200[] getSubAccountGroups() +## `getSubAccountGroups()` + +```php +getSubAccountGroups(): \Brevo\Client\Models\GetSubAccountGroups200ResponseInner[] +``` Get the list of groups This endpoint allows you to list all groups created on your Admin account. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\MasterAccountApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. @@ -879,15 +1679,15 @@ try { } catch (Exception $e) { echo 'Exception when calling MasterAccountApi->getSubAccountGroups: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters + This endpoint does not need any parameter. ### Return type -[**\Brevo\Client\Model\InlineResponse200[]**](../Model/InlineResponse200.md) +[**\Brevo\Client\Models\GetSubAccountGroups200ResponseInner[]**](../Model/GetSubAccountGroups200ResponseInner.md) ### Authorization @@ -895,58 +1695,66 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **inviteAdminUser** -> \Brevo\Client\Model\InviteAdminUser inviteAdminUser($sendInvitation) +## `inviteAdminUser()` + +```php +inviteAdminUser($inviteAdminUser): \Brevo\Client\Models\CorporateGroupPost201Response +``` Send invitation to an admin user -`This endpoint allows you to invite a member to manage the Admin account Features and their respective permissions are as below: - `my_plan`: - \"all\" - `api`: - \"none\" - `user_management`: - \"all\" - `app_management` | Not available in ENTv2: - \"all\" **Note**: - If `all_features_access: false` then only privileges are required otherwise if `true` then it's assumed that all permissions will be there for the invited admin user. +`This endpoint allows you to invite a member to manage the Admin account Features and their respective permissions are as below: - `my_plan`: - \"all\" - `api`: - \"none\" - `user_management`: - \"all\" - `app_management` | Not available in ENTv2: - \"all\" - `sub_organization_groups` - \"create\" - \"edit_delete\" - `create_sub_organizations` - \"all\" - `manage_sub_organizations` - \"all\" - `analytics` - \"download_data\" - \"create_alerts\" - \"my_looks\" - \"explore_create\" - `security` - \"all\" **Note**: - If `all_features_access: false` then only privileges are required otherwise if `true` then it's assumed that all permissions will be there for the invited admin user. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\MasterAccountApi( // 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 ); -$sendInvitation = new \Brevo\Client\Model\InviteAdminUser(); // \Brevo\Client\Model\InviteAdminUser | Payload to send an invitation +$inviteAdminUser = new \Brevo\Client\Models\InviteAdminUser(); // \Brevo\Client\Models\InviteAdminUser | Payload to send an invitation try { - $result = $apiInstance->inviteAdminUser($sendInvitation); + $result = $apiInstance->inviteAdminUser($inviteAdminUser); print_r($result); } catch (Exception $e) { echo 'Exception when calling MasterAccountApi->inviteAdminUser: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **sendInvitation** | [**\Brevo\Client\Model\InviteAdminUser**](../Model/InviteAdminUser.md)| Payload to send an invitation | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inviteAdminUser** | [**\Brevo\Client\Models\InviteAdminUser**](../Model/InviteAdminUser.md)| Payload to send an invitation | | ### Return type -[**\Brevo\Client\Model\InviteAdminUser**](../Model/InviteAdminUser.md) +[**\Brevo\Client\Models\CorporateGroupPost201Response**](../Model/CorporateGroupPost201Response.md) ### Authorization @@ -954,8 +1762,9 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: `application/json` +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/NotesApi.md b/docs/Api/NotesApi.md index ca8e332..8457fcf 100644 --- a/docs/Api/NotesApi.md +++ b/docs/Api/NotesApi.md @@ -1,48 +1,55 @@ # Brevo\Client\NotesApi -All URIs are relative to *https://api.brevo.com/v3* +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**crmNotesGet**](NotesApi.md#crmNotesGet) | **GET** /crm/notes | Get all notes -[**crmNotesIdDelete**](NotesApi.md#crmNotesIdDelete) | **DELETE** /crm/notes/{id} | Delete a note -[**crmNotesIdGet**](NotesApi.md#crmNotesIdGet) | **GET** /crm/notes/{id} | Get a note -[**crmNotesIdPatch**](NotesApi.md#crmNotesIdPatch) | **PATCH** /crm/notes/{id} | Update a note -[**crmNotesPost**](NotesApi.md#crmNotesPost) | **POST** /crm/notes | Create a note +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**crmNotesGet()**](NotesApi.md#crmNotesGet) | **GET** /crm/notes | Get all notes | +| [**crmNotesIdDelete()**](NotesApi.md#crmNotesIdDelete) | **DELETE** /crm/notes/{id} | Delete a note | +| [**crmNotesIdGet()**](NotesApi.md#crmNotesIdGet) | **GET** /crm/notes/{id} | Get a note | +| [**crmNotesIdPatch()**](NotesApi.md#crmNotesIdPatch) | **PATCH** /crm/notes/{id} | Update a note | +| [**crmNotesPost()**](NotesApi.md#crmNotesPost) | **POST** /crm/notes | Create a note | -# **crmNotesGet** -> \Brevo\Client\Model\NoteList crmNotesGet($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort) +## `crmNotesGet()` + +```php +crmNotesGet($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort): \Brevo\Client\Models\Note[] +``` Get all notes ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\NotesApi( // 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 ); -$entity = "entity_example"; // string | Filter by note entity type -$entityIds = "entityIds_example"; // string | Filter by note entity IDs +$entity = 'entity_example'; // string | Filter by note entity type +$entityIds = 'entityIds_example'; // string | Filter by note entity IDs $dateFrom = 56; // int | dateFrom to date range filter type (timestamp in milliseconds) $dateTo = 56; // int | dateTo to date range filter type (timestamp in milliseconds) -$offset = 789; // int | Index of the first document of the page +$offset = 56; // int | Index of the first document of the page $limit = 50; // int | Number of documents per page -$sort = "sort_example"; // string | Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed +$sort = 'sort_example'; // string | Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed try { $result = $apiInstance->crmNotesGet($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort); @@ -50,24 +57,23 @@ try { } catch (Exception $e) { echo 'Exception when calling NotesApi->crmNotesGet: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **entity** | **string**| Filter by note entity type | [optional] - **entityIds** | **string**| Filter by note entity IDs | [optional] - **dateFrom** | **int**| dateFrom to date range filter type (timestamp in milliseconds) | [optional] - **dateTo** | **int**| dateTo to date range filter type (timestamp in milliseconds) | [optional] - **offset** | **int**| Index of the first document of the page | [optional] - **limit** | **int**| Number of documents per page | [optional] [default to 50] - **sort** | **string**| Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **entity** | **string**| Filter by note entity type | [optional] | +| **entityIds** | **string**| Filter by note entity IDs | [optional] | +| **dateFrom** | **int**| dateFrom to date range filter type (timestamp in milliseconds) | [optional] | +| **dateTo** | **int**| dateTo to date range filter type (timestamp in milliseconds) | [optional] | +| **offset** | **int**| Index of the first document of the page | [optional] | +| **limit** | **int**| Number of documents per page | [optional] [default to 50] | +| **sort** | **string**| Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed | [optional] | ### Return type -[**\Brevo\Client\Model\NoteList**](../Model/NoteList.md) +[**\Brevo\Client\Models\Note[]**](../Model/Note.md) ### Authorization @@ -75,51 +81,59 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **crmNotesIdDelete** -> crmNotesIdDelete($id) +## `crmNotesIdDelete()` + +```php +crmNotesIdDelete($id) +``` Delete a note ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\NotesApi( // 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 ); -$id = "id_example"; // string | Note ID to delete +$id = 'id_example'; // string | Note ID to delete try { $apiInstance->crmNotesIdDelete($id); } catch (Exception $e) { echo 'Exception when calling NotesApi->crmNotesIdDelete: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| Note ID to delete | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| Note ID to delete | | ### Return type @@ -131,37 +145,46 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **crmNotesIdGet** -> \Brevo\Client\Model\Note crmNotesIdGet($id) +## `crmNotesIdGet()` + +```php +crmNotesIdGet($id): \Brevo\Client\Models\Note +``` Get a note ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\NotesApi( // 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 ); -$id = "id_example"; // string | Note ID to get +$id = 'id_example'; // string | Note ID to get try { $result = $apiInstance->crmNotesIdGet($id); @@ -169,18 +192,17 @@ try { } catch (Exception $e) { echo 'Exception when calling NotesApi->crmNotesIdGet: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| Note ID to get | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| Note ID to get | | ### Return type -[**\Brevo\Client\Model\Note**](../Model/Note.md) +[**\Brevo\Client\Models\Note**](../Model/Note.md) ### Authorization @@ -188,53 +210,61 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **crmNotesIdPatch** -> crmNotesIdPatch($id, $body) +## `crmNotesIdPatch()` + +```php +crmNotesIdPatch($id, $noteData) +``` Update a note ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\NotesApi( // 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 ); -$id = "id_example"; // string | Note ID to update -$body = new \Brevo\Client\Model\NoteData(); // \Brevo\Client\Model\NoteData | Note data to update a note +$id = 'id_example'; // string | Note ID to update +$noteData = new \Brevo\Client\Models\NoteData(); // \Brevo\Client\Models\NoteData | Note data to update a note. try { - $apiInstance->crmNotesIdPatch($id, $body); + $apiInstance->crmNotesIdPatch($id, $noteData); } catch (Exception $e) { echo 'Exception when calling NotesApi->crmNotesIdPatch: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| Note ID to update | - **body** | [**\Brevo\Client\Model\NoteData**](../Model/NoteData.md)| Note data to update a note | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| Note ID to update | | +| **noteData** | [**\Brevo\Client\Models\NoteData**](../Model/NoteData.md)| Note data to update a note. | | ### Return type @@ -246,56 +276,64 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **crmNotesPost** -> \Brevo\Client\Model\NoteId crmNotesPost($body) +## `crmNotesPost()` + +```php +crmNotesPost($noteData): \Brevo\Client\Models\NoteId +``` Create a note ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\NotesApi( // 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 ); -$body = new \Brevo\Client\Model\NoteData(); // \Brevo\Client\Model\NoteData | Note data to create a note. +$noteData = new \Brevo\Client\Models\NoteData(); // \Brevo\Client\Models\NoteData | Note data to create a note. try { - $result = $apiInstance->crmNotesPost($body); + $result = $apiInstance->crmNotesPost($noteData); print_r($result); } catch (Exception $e) { echo 'Exception when calling NotesApi->crmNotesPost: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**\Brevo\Client\Model\NoteData**](../Model/NoteData.md)| Note data to create a note. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **noteData** | [**\Brevo\Client\Models\NoteData**](../Model/NoteData.md)| Note data to create a note. | | ### Return type -[**\Brevo\Client\Model\NoteId**](../Model/NoteId.md) +[**\Brevo\Client\Models\NoteId**](../Model/NoteId.md) ### Authorization @@ -303,8 +341,9 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: `application/json` +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/PaymentsApi.md b/docs/Api/PaymentsApi.md new file mode 100644 index 0000000..bc1352e --- /dev/null +++ b/docs/Api/PaymentsApi.md @@ -0,0 +1,204 @@ +# Brevo\Client\PaymentsApi + +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createPaymentRequest()**](PaymentsApi.md#createPaymentRequest) | **POST** /payments/requests | Create a payment request | +| [**deletePaymentRequest()**](PaymentsApi.md#deletePaymentRequest) | **DELETE** /payments/requests/{id} | Delete a payment request. | +| [**getPaymentRequest()**](PaymentsApi.md#getPaymentRequest) | **GET** /payments/requests/{id} | Get payment request details | + + +## `createPaymentRequest()` + +```php +createPaymentRequest($createPaymentRequest): \Brevo\Client\Models\CreatePaymentResponse +``` + +Create a payment request + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\PaymentsApi( + // 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 +); +$createPaymentRequest = new \Brevo\Client\Models\CreatePaymentRequest(); // \Brevo\Client\Models\CreatePaymentRequest | Create a payment request + +try { + $result = $apiInstance->createPaymentRequest($createPaymentRequest); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PaymentsApi->createPaymentRequest: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **createPaymentRequest** | [**\Brevo\Client\Models\CreatePaymentRequest**](../Model/CreatePaymentRequest.md)| Create a payment request | | + +### Return type + +[**\Brevo\Client\Models\CreatePaymentResponse**](../Model/CreatePaymentResponse.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deletePaymentRequest()` + +```php +deletePaymentRequest($id) +``` + +Delete a payment request. + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\PaymentsApi( + // 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 +); +$id = 9ae7d68a-565c-4695-9381-d8fb3e3a14cc; // string | ID of the payment request. + +try { + $apiInstance->deletePaymentRequest($id); +} catch (Exception $e) { + echo 'Exception when calling PaymentsApi->deletePaymentRequest: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| ID of the payment request. | | + +### Return type + +void (empty response body) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getPaymentRequest()` + +```php +getPaymentRequest($id): \Brevo\Client\Models\GetPaymentRequest +``` + +Get payment request details + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\PaymentsApi( + // 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 +); +$id = 050db7b0-9bb7-4c1e-9c68-5a8dace8c1dc; // string | Id of the payment Request + +try { + $result = $apiInstance->getPaymentRequest($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PaymentsApi->getPaymentRequest: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| Id of the payment Request | | + +### Return type + +[**\Brevo\Client\Models\GetPaymentRequest**](../Model/GetPaymentRequest.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/ProcessApi.md b/docs/Api/ProcessApi.md index 8e37af7..542066c 100644 --- a/docs/Api/ProcessApi.md +++ b/docs/Api/ProcessApi.md @@ -1,39 +1,46 @@ # Brevo\Client\ProcessApi -All URIs are relative to *https://api.brevo.com/v3* +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**getProcess**](ProcessApi.md#getProcess) | **GET** /processes/{processId} | Return the informations for a process -[**getProcesses**](ProcessApi.md#getProcesses) | **GET** /processes | Return all the processes for your account +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**getProcess()**](ProcessApi.md#getProcess) | **GET** /processes/{processId} | Return the informations for a process | +| [**getProcesses()**](ProcessApi.md#getProcesses) | **GET** /processes | Return all the processes for your account | -# **getProcess** -> \Brevo\Client\Model\GetProcess getProcess($processId) +## `getProcess()` + +```php +getProcess($processId): \Brevo\Client\Models\GetProcess +``` Return the informations for a process ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 +$processId = 56; // int | Id of the process try { $result = $apiInstance->getProcess($processId); @@ -41,18 +48,17 @@ try { } catch (Exception $e) { echo 'Exception when calling ProcessApi->getProcess: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **processId** | **int**| Id of the process | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **processId** | **int**| Id of the process | | ### Return type -[**\Brevo\Client\Model\GetProcess**](../Model/GetProcess.md) +[**\Brevo\Client\Models\GetProcess**](../Model/GetProcess.md) ### Authorization @@ -60,30 +66,39 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getProcesses** -> \Brevo\Client\Model\GetProcesses getProcesses($limit, $offset, $sort) +## `getProcesses()` + +```php +getProcesses($limit, $offset, $sort): \Brevo\Client\Models\GetProcesses +``` Return all the processes for your account ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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. @@ -92,7 +107,7 @@ $apiInstance = new Brevo\Client\Api\ProcessApi( ); $limit = 10; // int | Number limitation for the result returned $offset = 0; // int | Beginning point in the list to retrieve from. -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed try { $result = $apiInstance->getProcesses($limit, $offset, $sort); @@ -100,20 +115,19 @@ try { } catch (Exception $e) { echo 'Exception when calling ProcessApi->getProcesses: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **limit** | **int**| Number limitation for the result returned | [optional] [default to 10] - **offset** | **int**| Beginning point in the list to retrieve from. | [optional] [default to 0] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Number limitation for the result returned | [optional] [default to 10] | +| **offset** | **int**| Beginning point in the list to retrieve from. | [optional] [default to 0] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | ### Return type -[**\Brevo\Client\Model\GetProcesses**](../Model/GetProcesses.md) +[**\Brevo\Client\Models\GetProcesses**](../Model/GetProcesses.md) ### Authorization @@ -121,8 +135,9 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: Not defined +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/ProgramApi.md b/docs/Api/ProgramApi.md new file mode 100644 index 0000000..59edf8e --- /dev/null +++ b/docs/Api/ProgramApi.md @@ -0,0 +1,915 @@ +# Brevo\Client\ProgramApi + +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createNewLP()**](ProgramApi.md#createNewLP) | **POST** /loyalty/config/programs | Create loyalty program | +| [**deleteContactMembers()**](ProgramApi.md#deleteContactMembers) | **DELETE** /loyalty/config/programs/{loyaltyProgramId}/subscriptions-members | Delete subscription member | +| [**deleteLoyaltyProgram()**](ProgramApi.md#deleteLoyaltyProgram) | **DELETE** /loyalty/config/programs/{loyaltyProgramId} | Delete Loyalty Program | +| [**deleteSubscriptionMember()**](ProgramApi.md#deleteSubscriptionMember) | **DELETE** /loyalty/config/programs/{loyaltyProgramId}/contact/{contactId} | Delete subscription | +| [**getLPList()**](ProgramApi.md#getLPList) | **GET** /loyalty/config/programs | Get loyalty program list | +| [**getLoyaltyProgramInfo()**](ProgramApi.md#getLoyaltyProgramInfo) | **GET** /loyalty/config/programs/{loyaltyProgramId} | Get loyalty program Info | +| [**getParameterSubscriptionInfo()**](ProgramApi.md#getParameterSubscriptionInfo) | **GET** /loyalty/config/programs/{loyaltyProgramId}/account-info | Get Subscription Data | +| [**getSubscriptionMember()**](ProgramApi.md#getSubscriptionMember) | **GET** /loyalty/config/programs/{loyaltyProgramId}/contact/{contactId} | Get subscription info | +| [**partiallyUpdateLoyaltyProgram()**](ProgramApi.md#partiallyUpdateLoyaltyProgram) | **PATCH** /loyalty/config/programs/{loyaltyProgramId} | Partially update loyalty program | +| [**publishLoyaltyProgram()**](ProgramApi.md#publishLoyaltyProgram) | **POST** /loyalty/config/programs/{loyaltyProgramId}/publish | Publish loyalty program | +| [**subscribeMemberToASubscription()**](ProgramApi.md#subscribeMemberToASubscription) | **POST** /loyalty/config/programs/{loyaltyProgramId}/subscriptions-members | Create subscription member | +| [**subscribeToLoyaltyProgram()**](ProgramApi.md#subscribeToLoyaltyProgram) | **POST** /loyalty/config/programs/{loyaltyProgramId}/subscriptions | Create subscription | +| [**updateLoyaltyProgram()**](ProgramApi.md#updateLoyaltyProgram) | **PUT** /loyalty/config/programs/{loyaltyProgramId} | Update loyalty program | + + +## `createNewLP()` + +```php +createNewLP($createLoyaltyProgramPayload): \Brevo\Client\Models\LoyaltyProgram +``` + +Create loyalty program + +Creates loyalty program + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\ProgramApi( + // 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 +); +$createLoyaltyProgramPayload = new \Brevo\Client\Models\CreateLoyaltyProgramPayload(); // \Brevo\Client\Models\CreateLoyaltyProgramPayload | Loyalty Program information + +try { + $result = $apiInstance->createNewLP($createLoyaltyProgramPayload); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProgramApi->createNewLP: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **createLoyaltyProgramPayload** | [**\Brevo\Client\Models\CreateLoyaltyProgramPayload**](../Model/CreateLoyaltyProgramPayload.md)| Loyalty Program information | [optional] | + +### Return type + +[**\Brevo\Client\Models\LoyaltyProgram**](../Model/LoyaltyProgram.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteContactMembers()` + +```php +deleteContactMembers($loyaltyProgramId, $contactId, $memberContactIds) +``` + +Delete subscription member + +Deletes member from a subscription + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\ProgramApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$contactId = 56; // int | Contact Id +$memberContactIds = 56; // int | Member Contact Ids, comma-seperated + +try { + $apiInstance->deleteContactMembers($loyaltyProgramId, $contactId, $memberContactIds); +} catch (Exception $e) { + echo 'Exception when calling ProgramApi->deleteContactMembers: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **contactId** | **int**| Contact Id | | +| **memberContactIds** | **int**| Member Contact Ids, comma-seperated | | + +### Return type + +void (empty response body) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteLoyaltyProgram()` + +```php +deleteLoyaltyProgram($loyaltyProgramId) +``` + +Delete Loyalty Program + +Deletes Loyalty Program + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\ProgramApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id + +try { + $apiInstance->deleteLoyaltyProgram($loyaltyProgramId); +} catch (Exception $e) { + echo 'Exception when calling ProgramApi->deleteLoyaltyProgram: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | + +### Return type + +void (empty response body) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteSubscriptionMember()` + +```php +deleteSubscriptionMember($loyaltyProgramId, $contactId) +``` + +Delete subscription + +Deletes subscription + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\ProgramApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$contactId = 'contactId_example'; // string | Contact Id + +try { + $apiInstance->deleteSubscriptionMember($loyaltyProgramId, $contactId); +} catch (Exception $e) { + echo 'Exception when calling ProgramApi->deleteSubscriptionMember: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **contactId** | **string**| Contact Id | | + +### Return type + +void (empty response body) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getLPList()` + +```php +getLPList($limit, $offset, $sortField, $sort): \Brevo\Client\Models\LoyaltyProgramPage +``` + +Get loyalty program list + +Returns list of loyalty programs + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\ProgramApi( + // 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 = 200; // int | Number of documents per page +$offset = 0; // int | Index of the first document in the page +$sortField = 'updatedAt'; // string | Sort documents by field +$sort = 'desc'; // string | Sort the documents in the ascending or descending order + +try { + $result = $apiInstance->getLPList($limit, $offset, $sortField, $sort); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProgramApi->getLPList: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Number of documents per page | [optional] [default to 200] | +| **offset** | **int**| Index of the first document in the page | [optional] [default to 0] | +| **sortField** | **string**| Sort documents by field | [optional] [default to 'updatedAt'] | +| **sort** | **string**| Sort the documents in the ascending or descending order | [optional] [default to 'desc'] | + +### Return type + +[**\Brevo\Client\Models\LoyaltyProgramPage**](../Model/LoyaltyProgramPage.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getLoyaltyProgramInfo()` + +```php +getLoyaltyProgramInfo($loyaltyProgramId): \Brevo\Client\Models\LoyaltyProgram +``` + +Get loyalty program Info + +Returns loyalty program + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\ProgramApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id + +try { + $result = $apiInstance->getLoyaltyProgramInfo($loyaltyProgramId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProgramApi->getLoyaltyProgramInfo: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | + +### Return type + +[**\Brevo\Client\Models\LoyaltyProgram**](../Model/LoyaltyProgram.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getParameterSubscriptionInfo()` + +```php +getParameterSubscriptionInfo($loyaltyProgramId, $contactId, $loyaltySubscriptionId, $params): \Brevo\Client\Models\GetSubscriptionInfoResponse +``` + +Get Subscription Data + +Get Information of balances, tiers, rewards and subscription members for a subscription + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\ProgramApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$contactId = 56; // int | One of contact id or loyalty subscription id is required +$loyaltySubscriptionId = 'loyaltySubscriptionId_example'; // string | Loyalty Subscription Id +$params = array('params_example'); // string[] | Add query params (balance, tier, reward, or member) + +try { + $result = $apiInstance->getParameterSubscriptionInfo($loyaltyProgramId, $contactId, $loyaltySubscriptionId, $params); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProgramApi->getParameterSubscriptionInfo: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **contactId** | **int**| One of contact id or loyalty subscription id is required | | +| **loyaltySubscriptionId** | **string**| Loyalty Subscription Id | [optional] | +| **params** | [**string[]**](../Model/string.md)| Add query params (balance, tier, reward, or member) | [optional] | + +### Return type + +[**\Brevo\Client\Models\GetSubscriptionInfoResponse**](../Model/GetSubscriptionInfoResponse.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getSubscriptionMember()` + +```php +getSubscriptionMember($loyaltyProgramId, $contactId): \Brevo\Client\Models\GetSubscriptionMemberResponse +``` + +Get subscription info + +Get subscription info + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\ProgramApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$contactId = 'contactId_example'; // string | Contact Id + +try { + $result = $apiInstance->getSubscriptionMember($loyaltyProgramId, $contactId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProgramApi->getSubscriptionMember: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **contactId** | **string**| Contact Id | | + +### Return type + +[**\Brevo\Client\Models\GetSubscriptionMemberResponse**](../Model/GetSubscriptionMemberResponse.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `partiallyUpdateLoyaltyProgram()` + +```php +partiallyUpdateLoyaltyProgram($loyaltyProgramId, $patchLoyaltyProgramPayload): \Brevo\Client\Models\LoyaltyProgram +``` + +Partially update loyalty program + +Partially updates loyalty program + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\ProgramApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$patchLoyaltyProgramPayload = new \Brevo\Client\Models\PatchLoyaltyProgramPayload(); // \Brevo\Client\Models\PatchLoyaltyProgramPayload | Loyalty Program information + +try { + $result = $apiInstance->partiallyUpdateLoyaltyProgram($loyaltyProgramId, $patchLoyaltyProgramPayload); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProgramApi->partiallyUpdateLoyaltyProgram: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **patchLoyaltyProgramPayload** | [**\Brevo\Client\Models\PatchLoyaltyProgramPayload**](../Model/PatchLoyaltyProgramPayload.md)| Loyalty Program information | [optional] | + +### Return type + +[**\Brevo\Client\Models\LoyaltyProgram**](../Model/LoyaltyProgram.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `publishLoyaltyProgram()` + +```php +publishLoyaltyProgram($loyaltyProgramId) +``` + +Publish loyalty program + +Publishes loyalty program + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\ProgramApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id + +try { + $apiInstance->publishLoyaltyProgram($loyaltyProgramId); +} catch (Exception $e) { + echo 'Exception when calling ProgramApi->publishLoyaltyProgram: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | + +### Return type + +void (empty response body) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `subscribeMemberToASubscription()` + +```php +subscribeMemberToASubscription($loyaltyProgramId, $createSubscriptionMemberPayload): \Brevo\Client\Models\CreateSubscriptionMemberResponse +``` + +Create subscription member + +Add member to a subscription + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\ProgramApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$createSubscriptionMemberPayload = new \Brevo\Client\Models\CreateSubscriptionMemberPayload(); // \Brevo\Client\Models\CreateSubscriptionMemberPayload | Subscription Member information + +try { + $result = $apiInstance->subscribeMemberToASubscription($loyaltyProgramId, $createSubscriptionMemberPayload); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProgramApi->subscribeMemberToASubscription: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **createSubscriptionMemberPayload** | [**\Brevo\Client\Models\CreateSubscriptionMemberPayload**](../Model/CreateSubscriptionMemberPayload.md)| Subscription Member information | [optional] | + +### Return type + +[**\Brevo\Client\Models\CreateSubscriptionMemberResponse**](../Model/CreateSubscriptionMemberResponse.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `subscribeToLoyaltyProgram()` + +```php +subscribeToLoyaltyProgram($loyaltyProgramId, $createSubscriptionPayload): \Brevo\Client\Models\CreateSubscriptionResponse +``` + +Create subscription + +Subscribes to a loyalty program + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\ProgramApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program ID +$createSubscriptionPayload = new \Brevo\Client\Models\CreateSubscriptionPayload(); // \Brevo\Client\Models\CreateSubscriptionPayload | Subscription information + +try { + $result = $apiInstance->subscribeToLoyaltyProgram($loyaltyProgramId, $createSubscriptionPayload); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProgramApi->subscribeToLoyaltyProgram: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program ID | | +| **createSubscriptionPayload** | [**\Brevo\Client\Models\CreateSubscriptionPayload**](../Model/CreateSubscriptionPayload.md)| Subscription information | | + +### Return type + +[**\Brevo\Client\Models\CreateSubscriptionResponse**](../Model/CreateSubscriptionResponse.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateLoyaltyProgram()` + +```php +updateLoyaltyProgram($loyaltyProgramId, $updateLoyaltyProgramPayload): \Brevo\Client\Models\LoyaltyProgram +``` + +Update loyalty program + +Updates loyalty program + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\ProgramApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$updateLoyaltyProgramPayload = new \Brevo\Client\Models\UpdateLoyaltyProgramPayload(); // \Brevo\Client\Models\UpdateLoyaltyProgramPayload | Loyalty Program information + +try { + $result = $apiInstance->updateLoyaltyProgram($loyaltyProgramId, $updateLoyaltyProgramPayload); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProgramApi->updateLoyaltyProgram: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **updateLoyaltyProgramPayload** | [**\Brevo\Client\Models\UpdateLoyaltyProgramPayload**](../Model/UpdateLoyaltyProgramPayload.md)| Loyalty Program information | [optional] | + +### Return type + +[**\Brevo\Client\Models\LoyaltyProgram**](../Model/LoyaltyProgram.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/ResellerApi.md b/docs/Api/ResellerApi.md deleted file mode 100644 index 8504edf..0000000 --- a/docs/Api/ResellerApi.md +++ /dev/null @@ -1,952 +0,0 @@ -# Brevo\Client\ResellerApi - -All URIs are relative to *https://api.brevo.com/v3* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**addCredits**](ResellerApi.md#addCredits) | **POST** /reseller/children/{childIdentifier}/credits/add | Add Email and/or SMS credits to a specific child account -[**associateIpToChild**](ResellerApi.md#associateIpToChild) | **POST** /reseller/children/{childIdentifier}/ips/associate | Associate a dedicated IP to the child -[**createChildDomain**](ResellerApi.md#createChildDomain) | **POST** /reseller/children/{childIdentifier}/domains | Create a domain for a child account -[**createResellerChild**](ResellerApi.md#createResellerChild) | **POST** /reseller/children | Creates a reseller child -[**deleteChildDomain**](ResellerApi.md#deleteChildDomain) | **DELETE** /reseller/children/{childIdentifier}/domains/{domainName} | Delete the sender domain of the reseller child based on the childIdentifier and domainName passed -[**deleteResellerChild**](ResellerApi.md#deleteResellerChild) | **DELETE** /reseller/children/{childIdentifier} | Delete a single reseller child based on the child identifier supplied -[**dissociateIpFromChild**](ResellerApi.md#dissociateIpFromChild) | **POST** /reseller/children/{childIdentifier}/ips/dissociate | Dissociate a dedicated IP to the child -[**getChildAccountCreationStatus**](ResellerApi.md#getChildAccountCreationStatus) | **GET** /reseller/children/{childIdentifier}/accountCreationStatus | Get the status of a reseller's child account creation, whether it is successfully created (exists) or not based on the identifier supplied -[**getChildDomains**](ResellerApi.md#getChildDomains) | **GET** /reseller/children/{childIdentifier}/domains | Get all sender domains for a specific child account -[**getChildInfo**](ResellerApi.md#getChildInfo) | **GET** /reseller/children/{childIdentifier} | Get a child account's details -[**getResellerChilds**](ResellerApi.md#getResellerChilds) | **GET** /reseller/children | Get the list of all children accounts -[**getSsoToken**](ResellerApi.md#getSsoToken) | **GET** /reseller/children/{childIdentifier}/auth | Get session token to access Brevo (SSO) -[**removeCredits**](ResellerApi.md#removeCredits) | **POST** /reseller/children/{childIdentifier}/credits/remove | Remove Email and/or SMS credits from a specific child account -[**updateChildAccountStatus**](ResellerApi.md#updateChildAccountStatus) | **PUT** /reseller/children/{childIdentifier}/accountStatus | Update info of reseller's child account status based on the childIdentifier supplied -[**updateChildDomain**](ResellerApi.md#updateChildDomain) | **PUT** /reseller/children/{childIdentifier}/domains/{domainName} | Update the sender domain of reseller's child based on the childIdentifier and domainName passed -[**updateResellerChild**](ResellerApi.md#updateResellerChild) | **PUT** /reseller/children/{childIdentifier} | Update info of reseller's child based on the child identifier supplied - - -# **addCredits** -> \Brevo\Client\Model\RemainingCreditModel addCredits($childIdentifier, $addCredits) - -Add Email and/or SMS credits to a specific child account - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 -); -$childIdentifier = "childIdentifier_example"; // string | Either auth key or id of reseller's child -$addCredits = new \Brevo\Client\Model\AddCredits(); // \Brevo\Client\Model\AddCredits | Values to post to add credit to a specific child account - -try { - $result = $apiInstance->addCredits($childIdentifier, $addCredits); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ResellerApi->addCredits: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **childIdentifier** | **string**| Either auth key or id of reseller's child | - **addCredits** | [**\Brevo\Client\Model\AddCredits**](../Model/AddCredits.md)| Values to post to add credit to a specific child account | - -### Return type - -[**\Brevo\Client\Model\RemainingCreditModel**](../Model/RemainingCreditModel.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **associateIpToChild** -> associateIpToChild($childIdentifier, $ip) - -Associate a dedicated IP to the child - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 -); -$childIdentifier = "childIdentifier_example"; // string | Either auth key or id of reseller's child -$ip = new \Brevo\Client\Model\ManageIp(); // \Brevo\Client\Model\ManageIp | IP to associate - -try { - $apiInstance->associateIpToChild($childIdentifier, $ip); -} catch (Exception $e) { - echo 'Exception when calling ResellerApi->associateIpToChild: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **childIdentifier** | **string**| Either auth key or id of reseller's child | - **ip** | [**\Brevo\Client\Model\ManageIp**](../Model/ManageIp.md)| IP to associate | - -### Return type - -void (empty response body) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **createChildDomain** -> createChildDomain($childIdentifier, $addChildDomain) - -Create a domain for a child account - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 -); -$childIdentifier = "childIdentifier_example"; // string | Either auth key or id of reseller's child -$addChildDomain = new \Brevo\Client\Model\AddChildDomain(); // \Brevo\Client\Model\AddChildDomain | Sender domain to add for a specific child account. This will not be displayed to the parent account. - -try { - $apiInstance->createChildDomain($childIdentifier, $addChildDomain); -} catch (Exception $e) { - echo 'Exception when calling ResellerApi->createChildDomain: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **childIdentifier** | **string**| Either auth key or id of reseller's child | - **addChildDomain** | [**\Brevo\Client\Model\AddChildDomain**](../Model/AddChildDomain.md)| Sender domain to add for a specific child account. This will not be displayed to the parent account. | - -### Return type - -void (empty response body) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **createResellerChild** -> \Brevo\Client\Model\CreateReseller createResellerChild($resellerChild) - -Creates a reseller child - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 \Brevo\Client\Model\CreateChild(); // \Brevo\Client\Model\CreateChild | reseller child to add - -try { - $result = $apiInstance->createResellerChild($resellerChild); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ResellerApi->createResellerChild: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **resellerChild** | [**\Brevo\Client\Model\CreateChild**](../Model/CreateChild.md)| reseller child to add | [optional] - -### Return type - -[**\Brevo\Client\Model\CreateReseller**](../Model/CreateReseller.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **deleteChildDomain** -> deleteChildDomain($childIdentifier, $domainName) - -Delete the sender domain of the reseller child based on the childIdentifier and domainName passed - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 -); -$childIdentifier = "childIdentifier_example"; // string | Either auth key or id of reseller's child -$domainName = "domainName_example"; // string | Pass the existing domain that needs to be deleted - -try { - $apiInstance->deleteChildDomain($childIdentifier, $domainName); -} catch (Exception $e) { - echo 'Exception when calling ResellerApi->deleteChildDomain: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **childIdentifier** | **string**| Either auth key or id of reseller's child | - **domainName** | **string**| Pass the existing domain that needs to be deleted | - -### Return type - -void (empty response body) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **deleteResellerChild** -> deleteResellerChild($childIdentifier) - -Delete a single reseller child based on the child identifier supplied - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 -); -$childIdentifier = "childIdentifier_example"; // string | Either auth key or child id of reseller's child - -try { - $apiInstance->deleteResellerChild($childIdentifier); -} catch (Exception $e) { - echo 'Exception when calling ResellerApi->deleteResellerChild: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **childIdentifier** | **string**| Either auth key or child id of reseller's child | - -### Return type - -void (empty response body) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **dissociateIpFromChild** -> dissociateIpFromChild($childIdentifier, $ip) - -Dissociate a dedicated IP to the child - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 -); -$childIdentifier = "childIdentifier_example"; // string | Either auth key or id of reseller's child -$ip = new \Brevo\Client\Model\ManageIp(); // \Brevo\Client\Model\ManageIp | IP to dissociate - -try { - $apiInstance->dissociateIpFromChild($childIdentifier, $ip); -} catch (Exception $e) { - echo 'Exception when calling ResellerApi->dissociateIpFromChild: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **childIdentifier** | **string**| Either auth key or id of reseller's child | - **ip** | [**\Brevo\Client\Model\ManageIp**](../Model/ManageIp.md)| IP to dissociate | - -### Return type - -void (empty response body) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **getChildAccountCreationStatus** -> \Brevo\Client\Model\GetChildAccountCreationStatus getChildAccountCreationStatus($childIdentifier) - -Get the status of a reseller's child account creation, whether it is successfully created (exists) or not based on the identifier supplied - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 -); -$childIdentifier = "childIdentifier_example"; // string | Either auth key or id of reseller's child - -try { - $result = $apiInstance->getChildAccountCreationStatus($childIdentifier); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ResellerApi->getChildAccountCreationStatus: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **childIdentifier** | **string**| Either auth key or id of reseller's child | - -### Return type - -[**\Brevo\Client\Model\GetChildAccountCreationStatus**](../Model/GetChildAccountCreationStatus.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **getChildDomains** -> \Brevo\Client\Model\GetChildDomains getChildDomains($childIdentifier) - -Get all sender domains for a specific child account - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 -); -$childIdentifier = "childIdentifier_example"; // string | Either auth key or id of reseller's child - -try { - $result = $apiInstance->getChildDomains($childIdentifier); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ResellerApi->getChildDomains: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **childIdentifier** | **string**| Either auth key or id of reseller's child | - -### Return type - -[**\Brevo\Client\Model\GetChildDomains**](../Model/GetChildDomains.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **getChildInfo** -> \Brevo\Client\Model\GetChildInfo getChildInfo($childIdentifier) - -Get a child account's details - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 -); -$childIdentifier = "childIdentifier_example"; // string | Either auth key or id of reseller's child - -try { - $result = $apiInstance->getChildInfo($childIdentifier); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ResellerApi->getChildInfo: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **childIdentifier** | **string**| Either auth key or id of reseller's child | - -### Return type - -[**\Brevo\Client\Model\GetChildInfo**](../Model/GetChildInfo.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **getResellerChilds** -> \Brevo\Client\Model\GetChildrenList getResellerChilds($limit, $offset) - -Get the list of all children accounts - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 -); -$limit = 10; // int | Number of documents for child accounts information per page -$offset = 0; // int | Index of the first document in the page - -try { - $result = $apiInstance->getResellerChilds($limit, $offset); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ResellerApi->getResellerChilds: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **limit** | **int**| Number of documents for child accounts information per page | [optional] [default to 10] - **offset** | **int**| Index of the first document in the page | [optional] [default to 0] - -### Return type - -[**\Brevo\Client\Model\GetChildrenList**](../Model/GetChildrenList.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **getSsoToken** -> \Brevo\Client\Model\GetSsoToken getSsoToken($childIdentifier) - -Get session token to access Brevo (SSO) - -It returns a session [token] which will remain valid for a short period of time. A child account will be able to access a white-labeled section by using the following url pattern => https:/email.mydomain.com/login/sso?token=[token] - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 -); -$childIdentifier = "childIdentifier_example"; // string | Either auth key or id of reseller's child - -try { - $result = $apiInstance->getSsoToken($childIdentifier); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ResellerApi->getSsoToken: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **childIdentifier** | **string**| Either auth key or id of reseller's child | - -### Return type - -[**\Brevo\Client\Model\GetSsoToken**](../Model/GetSsoToken.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **removeCredits** -> \Brevo\Client\Model\RemainingCreditModel removeCredits($childIdentifier, $removeCredits) - -Remove Email and/or SMS credits from a specific child account - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 -); -$childIdentifier = "childIdentifier_example"; // string | Either auth key or id of reseller's child -$removeCredits = new \Brevo\Client\Model\RemoveCredits(); // \Brevo\Client\Model\RemoveCredits | Values to post to remove email or SMS credits from a specific child account - -try { - $result = $apiInstance->removeCredits($childIdentifier, $removeCredits); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ResellerApi->removeCredits: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **childIdentifier** | **string**| Either auth key or id of reseller's child | - **removeCredits** | [**\Brevo\Client\Model\RemoveCredits**](../Model/RemoveCredits.md)| Values to post to remove email or SMS credits from a specific child account | - -### Return type - -[**\Brevo\Client\Model\RemainingCreditModel**](../Model/RemainingCreditModel.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **updateChildAccountStatus** -> updateChildAccountStatus($childIdentifier, $updateChildAccountStatus) - -Update info of reseller's child account status based on the childIdentifier supplied - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 -); -$childIdentifier = "childIdentifier_example"; // string | Either auth key or id of reseller's child -$updateChildAccountStatus = new \Brevo\Client\Model\UpdateChildAccountStatus(); // \Brevo\Client\Model\UpdateChildAccountStatus | values to update in child account status - -try { - $apiInstance->updateChildAccountStatus($childIdentifier, $updateChildAccountStatus); -} catch (Exception $e) { - echo 'Exception when calling ResellerApi->updateChildAccountStatus: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **childIdentifier** | **string**| Either auth key or id of reseller's child | - **updateChildAccountStatus** | [**\Brevo\Client\Model\UpdateChildAccountStatus**](../Model/UpdateChildAccountStatus.md)| values to update in child account status | - -### Return type - -void (empty response body) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **updateChildDomain** -> updateChildDomain($childIdentifier, $domainName, $updateChildDomain) - -Update the sender domain of reseller's child based on the childIdentifier and domainName passed - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 -); -$childIdentifier = "childIdentifier_example"; // string | Either auth key or id of reseller's child -$domainName = "domainName_example"; // string | Pass the existing domain that needs to be updated -$updateChildDomain = new \Brevo\Client\Model\UpdateChildDomain(); // \Brevo\Client\Model\UpdateChildDomain | value to update for sender domain - -try { - $apiInstance->updateChildDomain($childIdentifier, $domainName, $updateChildDomain); -} catch (Exception $e) { - echo 'Exception when calling ResellerApi->updateChildDomain: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **childIdentifier** | **string**| Either auth key or id of reseller's child | - **domainName** | **string**| Pass the existing domain that needs to be updated | - **updateChildDomain** | [**\Brevo\Client\Model\UpdateChildDomain**](../Model/UpdateChildDomain.md)| value to update for sender domain | - -### Return type - -void (empty response body) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **updateResellerChild** -> updateResellerChild($childIdentifier, $resellerChild) - -Update info of reseller's child based on the child identifier supplied - -### Example -```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\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 -); -$childIdentifier = "childIdentifier_example"; // string | Either auth key or id of reseller's child -$resellerChild = new \Brevo\Client\Model\UpdateChild(); // \Brevo\Client\Model\UpdateChild | values to update in child profile - -try { - $apiInstance->updateResellerChild($childIdentifier, $resellerChild); -} catch (Exception $e) { - echo 'Exception when calling ResellerApi->updateResellerChild: ', $e->getMessage(), PHP_EOL; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **childIdentifier** | **string**| Either auth key or id of reseller's child | - **resellerChild** | [**\Brevo\Client\Model\UpdateChild**](../Model/UpdateChild.md)| values to update in child profile | - -### Return type - -void (empty response body) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - diff --git a/docs/Api/RewardsApi.md b/docs/Api/RewardsApi.md new file mode 100644 index 0000000..4503905 --- /dev/null +++ b/docs/Api/RewardsApi.md @@ -0,0 +1,362 @@ +# Brevo\Client\RewardsApi + +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**attributeReward()**](RewardsApi.md#attributeReward) | **POST** /loyalty/offer/programs/{loyaltyProgramId}/rewards/attribute | Attribute reward to a contact | +| [**getOffersList()**](RewardsApi.md#getOffersList) | **GET** /loyalty/offer/programs/{loyaltyProgramId}/offers | Get Reward list | +| [**redeemReward()**](RewardsApi.md#redeemReward) | **POST** /loyalty/offer/programs/{loyaltyProgramId}/rewards/redeem | Redeem reward | +| [**revokeReward()**](RewardsApi.md#revokeReward) | **DELETE** /loyalty/offer/programs/{loyaltyProgramId}/rewards/revoke | Revoke reward | +| [**validateReward()**](RewardsApi.md#validateReward) | **POST** /loyalty/offer/programs/{loyaltyProgramId}/rewards/validate | Validates a voucher | + + +## `attributeReward()` + +```php +attributeReward($loyaltyProgramId, $attributeRewardPayload): \Brevo\Client\Models\RewardAttributionResponse +``` + +Attribute reward to a contact + +Attributes reward to a new contact + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\RewardsApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$attributeRewardPayload = new \Brevo\Client\Models\AttributeRewardPayload(); // \Brevo\Client\Models\AttributeRewardPayload | Attribute reward information (One of contactId and loyaltySubscriptionId must be provided.) + +try { + $result = $apiInstance->attributeReward($loyaltyProgramId, $attributeRewardPayload); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RewardsApi->attributeReward: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **attributeRewardPayload** | [**\Brevo\Client\Models\AttributeRewardPayload**](../Model/AttributeRewardPayload.md)| Attribute reward information (One of contactId and loyaltySubscriptionId must be provided.) | | + +### Return type + +[**\Brevo\Client\Models\RewardAttributionResponse**](../Model/RewardAttributionResponse.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getOffersList()` + +```php +getOffersList($loyaltyProgramId, $limit, $offset, $rewardState, $rewardVersion): \Brevo\Client\Models\OffersListResponse +``` + +Get Reward list + +Returns a list of rewards for a given loyalty program + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\RewardsApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$limit = 100; // int | Number of documents per page +$offset = 0; // int | Index of the first document in the page +$rewardState = 'all'; // string | State of the reward +$rewardVersion = 'draft'; // string | Select 'active' to retrieve list of all rewards which are live for clients. Select draft to retrieve list of all non deleted rewards. + +try { + $result = $apiInstance->getOffersList($loyaltyProgramId, $limit, $offset, $rewardState, $rewardVersion); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RewardsApi->getOffersList: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **limit** | **int**| Number of documents per page | [optional] [default to 100] | +| **offset** | **int**| Index of the first document in the page | [optional] [default to 0] | +| **rewardState** | **string**| State of the reward | [optional] [default to 'all'] | +| **rewardVersion** | **string**| Select 'active' to retrieve list of all rewards which are live for clients. Select draft to retrieve list of all non deleted rewards. | [optional] [default to 'draft'] | + +### Return type + +[**\Brevo\Client\Models\OffersListResponse**](../Model/OffersListResponse.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `redeemReward()` + +```php +redeemReward($loyaltyProgramId, $redeemRewardPayload): \Brevo\Client\Models\RewardRedeemResponse +``` + +Redeem reward + +Redeems/Burn a reward for a contact + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\RewardsApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$redeemRewardPayload = new \Brevo\Client\Models\RedeemRewardPayload(); // \Brevo\Client\Models\RedeemRewardPayload | Redeemed reward information (Either contactId or loyaltySubscriptionId must be present.) + +try { + $result = $apiInstance->redeemReward($loyaltyProgramId, $redeemRewardPayload); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RewardsApi->redeemReward: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **redeemRewardPayload** | [**\Brevo\Client\Models\RedeemRewardPayload**](../Model/RedeemRewardPayload.md)| Redeemed reward information (Either contactId or loyaltySubscriptionId must be present.) | | + +### Return type + +[**\Brevo\Client\Models\RewardRedeemResponse**](../Model/RewardRedeemResponse.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `revokeReward()` + +```php +revokeReward($loyaltyProgramId, $attributedRewardId) +``` + +Revoke reward + +Revokes reward + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\RewardsApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$attributedRewardId = 'attributedRewardId_example'; // string | Attributed Reward Id + +try { + $apiInstance->revokeReward($loyaltyProgramId, $attributedRewardId); +} catch (Exception $e) { + echo 'Exception when calling RewardsApi->revokeReward: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **attributedRewardId** | **string**| Attributed Reward Id | | + +### Return type + +void (empty response body) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `validateReward()` + +```php +validateReward($loyaltyProgramId, $validateRewardPayload): \Brevo\Client\Models\ValidatedRewardResponse +``` + +Validates a voucher + +Validates a reward for a contact and return the response + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\RewardsApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$validateRewardPayload = new \Brevo\Client\Models\ValidateRewardPayload(); // \Brevo\Client\Models\ValidateRewardPayload | Validate reward information (One of contactId and loyaltySubscriptionId must be present, or one of code and attributedRewardId must be present.) + +try { + $result = $apiInstance->validateReward($loyaltyProgramId, $validateRewardPayload); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RewardsApi->validateReward: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **validateRewardPayload** | [**\Brevo\Client\Models\ValidateRewardPayload**](../Model/ValidateRewardPayload.md)| Validate reward information (One of contactId and loyaltySubscriptionId must be present, or one of code and attributedRewardId must be present.) | | + +### Return type + +[**\Brevo\Client\Models\ValidatedRewardResponse**](../Model/ValidatedRewardResponse.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/SMSCampaignsApi.md b/docs/Api/SMSCampaignsApi.md index ac37a41..55a607a 100644 --- a/docs/Api/SMSCampaignsApi.md +++ b/docs/Api/SMSCampaignsApi.md @@ -1,47 +1,54 @@ # Brevo\Client\SMSCampaignsApi -All URIs are relative to *https://api.brevo.com/v3* +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createSmsCampaign**](SMSCampaignsApi.md#createSmsCampaign) | **POST** /smsCampaigns | Creates an SMS campaign -[**deleteSmsCampaign**](SMSCampaignsApi.md#deleteSmsCampaign) | **DELETE** /smsCampaigns/{campaignId} | Delete an SMS campaign -[**getSmsCampaign**](SMSCampaignsApi.md#getSmsCampaign) | **GET** /smsCampaigns/{campaignId} | Get an SMS campaign -[**getSmsCampaigns**](SMSCampaignsApi.md#getSmsCampaigns) | **GET** /smsCampaigns | Returns the information for all your created SMS campaigns -[**requestSmsRecipientExport**](SMSCampaignsApi.md#requestSmsRecipientExport) | **POST** /smsCampaigns/{campaignId}/exportRecipients | Export an SMS campaign's recipients -[**sendSmsCampaignNow**](SMSCampaignsApi.md#sendSmsCampaignNow) | **POST** /smsCampaigns/{campaignId}/sendNow | Send your SMS campaign immediately -[**sendSmsReport**](SMSCampaignsApi.md#sendSmsReport) | **POST** /smsCampaigns/{campaignId}/sendReport | Send an SMS campaign's report -[**sendTestSms**](SMSCampaignsApi.md#sendTestSms) | **POST** /smsCampaigns/{campaignId}/sendTest | Send a test SMS campaign -[**updateSmsCampaign**](SMSCampaignsApi.md#updateSmsCampaign) | **PUT** /smsCampaigns/{campaignId} | Update an SMS campaign -[**updateSmsCampaignStatus**](SMSCampaignsApi.md#updateSmsCampaignStatus) | **PUT** /smsCampaigns/{campaignId}/status | Update a campaign's status +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createSmsCampaign()**](SMSCampaignsApi.md#createSmsCampaign) | **POST** /smsCampaigns | Creates an SMS campaign | +| [**deleteSmsCampaign()**](SMSCampaignsApi.md#deleteSmsCampaign) | **DELETE** /smsCampaigns/{campaignId} | Delete an SMS campaign | +| [**getSmsCampaign()**](SMSCampaignsApi.md#getSmsCampaign) | **GET** /smsCampaigns/{campaignId} | Get an SMS campaign | +| [**getSmsCampaigns()**](SMSCampaignsApi.md#getSmsCampaigns) | **GET** /smsCampaigns | Returns the information for all your created SMS campaigns | +| [**requestSmsRecipientExport()**](SMSCampaignsApi.md#requestSmsRecipientExport) | **POST** /smsCampaigns/{campaignId}/exportRecipients | Export an SMS campaign's recipients | +| [**sendSmsCampaignNow()**](SMSCampaignsApi.md#sendSmsCampaignNow) | **POST** /smsCampaigns/{campaignId}/sendNow | Send your SMS campaign immediately | +| [**sendSmsReport()**](SMSCampaignsApi.md#sendSmsReport) | **POST** /smsCampaigns/{campaignId}/sendReport | Send an SMS campaign's report | +| [**sendTestSms()**](SMSCampaignsApi.md#sendTestSms) | **POST** /smsCampaigns/{campaignId}/sendTest | Send a test SMS campaign | +| [**updateSmsCampaign()**](SMSCampaignsApi.md#updateSmsCampaign) | **PUT** /smsCampaigns/{campaignId} | Update an SMS campaign | +| [**updateSmsCampaignStatus()**](SMSCampaignsApi.md#updateSmsCampaignStatus) | **PUT** /smsCampaigns/{campaignId}/status | Update a campaign's status | -# **createSmsCampaign** -> \Brevo\Client\Model\CreateModel createSmsCampaign($createSmsCampaign) +## `createSmsCampaign()` + +```php +createSmsCampaign($createSmsCampaign): \Brevo\Client\Models\CreateModel +``` Creates an SMS campaign ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\CreateSmsCampaign(); // \Brevo\Client\Model\CreateSmsCampaign | Values to create an SMS Campaign +$createSmsCampaign = new \Brevo\Client\Models\CreateSmsCampaign(); // \Brevo\Client\Models\CreateSmsCampaign | Values to create an SMS Campaign try { $result = $apiInstance->createSmsCampaign($createSmsCampaign); @@ -49,18 +56,17 @@ try { } catch (Exception $e) { echo 'Exception when calling SMSCampaignsApi->createSmsCampaign: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **createSmsCampaign** | [**\Brevo\Client\Model\CreateSmsCampaign**](../Model/CreateSmsCampaign.md)| Values to create an SMS Campaign | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **createSmsCampaign** | [**\Brevo\Client\Models\CreateSmsCampaign**](../Model/CreateSmsCampaign.md)| Values to create an SMS Campaign | | ### Return type -[**\Brevo\Client\Model\CreateModel**](../Model/CreateModel.md) +[**\Brevo\Client\Models\CreateModel**](../Model/CreateModel.md) ### Authorization @@ -68,51 +74,59 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **deleteSmsCampaign** -> deleteSmsCampaign($campaignId) +## `deleteSmsCampaign()` + +```php +deleteSmsCampaign($campaignId) +``` Delete an SMS campaign ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 +$campaignId = 56; // int | id of the SMS campaign try { $apiInstance->deleteSmsCampaign($campaignId); } catch (Exception $e) { echo 'Exception when calling SMSCampaignsApi->deleteSmsCampaign: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **campaignId** | **int**| id of the SMS campaign | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **int**| id of the SMS campaign | | ### Return type @@ -124,37 +138,46 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getSmsCampaign** -> \Brevo\Client\Model\GetSmsCampaign getSmsCampaign($campaignId) +## `getSmsCampaign()` + +```php +getSmsCampaign($campaignId): \Brevo\Client\Models\GetSmsCampaign +``` Get an SMS campaign ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 +$campaignId = 56; // int | id of the SMS campaign try { $result = $apiInstance->getSmsCampaign($campaignId); @@ -162,18 +185,17 @@ try { } catch (Exception $e) { echo 'Exception when calling SMSCampaignsApi->getSmsCampaign: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **campaignId** | **int**| id of the SMS campaign | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **int**| id of the SMS campaign | | ### Return type -[**\Brevo\Client\Model\GetSmsCampaign**](../Model/GetSmsCampaign.md) +[**\Brevo\Client\Models\GetSmsCampaign**](../Model/GetSmsCampaign.md) ### Authorization @@ -181,42 +203,51 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getSmsCampaigns** -> \Brevo\Client\Model\GetSmsCampaigns getSmsCampaigns($status, $startDate, $endDate, $limit, $offset, $sort) +## `getSmsCampaigns()` + +```php +getSmsCampaigns($status, $startDate, $endDate, $limit, $offset, $sort): \Brevo\Client\Models\GetSmsCampaigns +``` Returns the information for all your created SMS campaigns ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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. -$startDate = "startDate_example"; // string | Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) -$endDate = "endDate_example"; // string | Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) +$status = 'status_example'; // string | Status of campaign. +$startDate = 'startDate_example'; // string | **Mandatory if endDate is used.** Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) +$endDate = 'endDate_example'; // string | **Mandatory if startDate is used.** Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) $limit = 500; // int | Number limitation for the result returned $offset = 0; // int | Beginning point in the list to retrieve from. -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed try { $result = $apiInstance->getSmsCampaigns($status, $startDate, $endDate, $limit, $offset, $sort); @@ -224,23 +255,22 @@ try { } catch (Exception $e) { echo 'Exception when calling SMSCampaignsApi->getSmsCampaigns: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | **string**| Status of campaign. | [optional] - **startDate** | **string**| Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) | [optional] - **endDate** | **string**| Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) | [optional] - **limit** | **int**| Number limitation for the result returned | [optional] [default to 500] - **offset** | **int**| Beginning point in the list to retrieve from. | [optional] [default to 0] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **status** | **string**| Status of campaign. | [optional] | +| **startDate** | **string**| **Mandatory if endDate is used.** Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) | [optional] | +| **endDate** | **string**| **Mandatory if startDate is used.** Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) | [optional] | +| **limit** | **int**| Number limitation for the result returned | [optional] [default to 500] | +| **offset** | **int**| Beginning point in the list to retrieve from. | [optional] [default to 0] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | ### Return type -[**\Brevo\Client\Model\GetSmsCampaigns**](../Model/GetSmsCampaigns.md) +[**\Brevo\Client\Models\GetSmsCampaigns**](../Model/GetSmsCampaigns.md) ### Authorization @@ -248,40 +278,49 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **requestSmsRecipientExport** -> \Brevo\Client\Model\CreatedProcessId requestSmsRecipientExport($campaignId, $recipientExport) +## `requestSmsRecipientExport()` + +```php +requestSmsRecipientExport($campaignId, $recipientExport): \Brevo\Client\Models\CreatedProcessId +``` Export an SMS campaign's recipients It returns the background process ID which on completion calls the notify URL that you have set in the input. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\RequestSmsRecipientExport(); // \Brevo\Client\Model\RequestSmsRecipientExport | Values to send for a recipient export request +$campaignId = 56; // int | id of the campaign +$recipientExport = new \Brevo\Client\Models\RequestSmsRecipientExport(); // \Brevo\Client\Models\RequestSmsRecipientExport | Values to send for a recipient export request try { $result = $apiInstance->requestSmsRecipientExport($campaignId, $recipientExport); @@ -289,19 +328,18 @@ try { } catch (Exception $e) { echo 'Exception when calling SMSCampaignsApi->requestSmsRecipientExport: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **campaignId** | **int**| id of the campaign | - **recipientExport** | [**\Brevo\Client\Model\RequestSmsRecipientExport**](../Model/RequestSmsRecipientExport.md)| Values to send for a recipient export request | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **int**| id of the campaign | | +| **recipientExport** | [**\Brevo\Client\Models\RequestSmsRecipientExport**](../Model/RequestSmsRecipientExport.md)| Values to send for a recipient export request | [optional] | ### Return type -[**\Brevo\Client\Model\CreatedProcessId**](../Model/CreatedProcessId.md) +[**\Brevo\Client\Models\CreatedProcessId**](../Model/CreatedProcessId.md) ### Authorization @@ -309,51 +347,59 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **sendSmsCampaignNow** -> sendSmsCampaignNow($campaignId) +## `sendSmsCampaignNow()` + +```php +sendSmsCampaignNow($campaignId) +``` Send your SMS campaign immediately ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 +$campaignId = 56; // int | id of the campaign try { $apiInstance->sendSmsCampaignNow($campaignId); } catch (Exception $e) { echo 'Exception when calling SMSCampaignsApi->sendSmsCampaignNow: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **campaignId** | **int**| id of the campaign | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **int**| id of the campaign | | ### Return type @@ -365,55 +411,63 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `sendSmsReport()` -# **sendSmsReport** -> sendSmsReport($campaignId, $sendReport) +```php +sendSmsReport($campaignId, $sendReport) +``` Send an SMS campaign's report Send report of Sent and Archived campaign, to the specified email addresses, with respective data and a pdf attachment in detail. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\SendReport(); // \Brevo\Client\Model\SendReport | Values for send a report +$campaignId = 56; // int | id of the campaign +$sendReport = new \Brevo\Client\Models\SendReport(); // \Brevo\Client\Models\SendReport | Values for send a report try { $apiInstance->sendSmsReport($campaignId, $sendReport); } catch (Exception $e) { echo 'Exception when calling SMSCampaignsApi->sendSmsReport: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **campaignId** | **int**| id of the campaign | - **sendReport** | [**\Brevo\Client\Model\SendReport**](../Model/SendReport.md)| Values for send a report | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **int**| id of the campaign | | +| **sendReport** | [**\Brevo\Client\Models\SendReport**](../Model/SendReport.md)| Values for send a report | | ### Return type @@ -425,53 +479,61 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **sendTestSms** -> sendTestSms($campaignId, $phoneNumber) +## `sendTestSms()` + +```php +sendTestSms($campaignId, $sendTestSms) +``` Send a test SMS campaign ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 -$phoneNumber = new \Brevo\Client\Model\SendTestSms(); // \Brevo\Client\Model\SendTestSms | Mobile number of the recipient with the country code. This number must belong to one of your contacts in Brevo account and must not be blacklisted +$campaignId = 56; // int | Id of the SMS campaign +$sendTestSms = new \Brevo\Client\Models\SendTestSms(); // \Brevo\Client\Models\SendTestSms | Mobile number of the recipient with the country code. This number **must belong to one of your contacts in Brevo account and must not be blacklisted** try { - $apiInstance->sendTestSms($campaignId, $phoneNumber); + $apiInstance->sendTestSms($campaignId, $sendTestSms); } catch (Exception $e) { echo 'Exception when calling SMSCampaignsApi->sendTestSms: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **campaignId** | **int**| Id of the SMS campaign | - **phoneNumber** | [**\Brevo\Client\Model\SendTestSms**](../Model/SendTestSms.md)| Mobile number of the recipient with the country code. This number must belong to one of your contacts in Brevo account and must not be blacklisted | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **int**| Id of the SMS campaign | | +| **sendTestSms** | [**\Brevo\Client\Models\SendTestSms**](../Model/SendTestSms.md)| Mobile number of the recipient with the country code. This number **must belong to one of your contacts in Brevo account and must not be blacklisted** | | ### Return type @@ -483,53 +545,61 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `updateSmsCampaign()` -# **updateSmsCampaign** -> updateSmsCampaign($campaignId, $updateSmsCampaign) +```php +updateSmsCampaign($campaignId, $updateSmsCampaign) +``` Update an SMS campaign ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\UpdateSmsCampaign(); // \Brevo\Client\Model\UpdateSmsCampaign | Values to update an SMS Campaign +$campaignId = 56; // int | id of the SMS campaign +$updateSmsCampaign = new \Brevo\Client\Models\UpdateSmsCampaign(); // \Brevo\Client\Models\UpdateSmsCampaign | Values to update an SMS Campaign try { $apiInstance->updateSmsCampaign($campaignId, $updateSmsCampaign); } catch (Exception $e) { echo 'Exception when calling SMSCampaignsApi->updateSmsCampaign: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **campaignId** | **int**| id of the SMS campaign | - **updateSmsCampaign** | [**\Brevo\Client\Model\UpdateSmsCampaign**](../Model/UpdateSmsCampaign.md)| Values to update an SMS Campaign | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **int**| id of the SMS campaign | | +| **updateSmsCampaign** | [**\Brevo\Client\Models\UpdateSmsCampaign**](../Model/UpdateSmsCampaign.md)| Values to update an SMS Campaign | | ### Return type @@ -541,53 +611,61 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **updateSmsCampaignStatus** -> updateSmsCampaignStatus($campaignId, $status) +## `updateSmsCampaignStatus()` + +```php +updateSmsCampaignStatus($campaignId, $status) +``` Update a campaign's status ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\UpdateCampaignStatus(); // \Brevo\Client\Model\UpdateCampaignStatus | Status of the campaign. +$campaignId = 56; // int | id of the campaign +$status = new \Brevo\Client\Models\UpdateCampaignStatus(); // \Brevo\Client\Models\UpdateCampaignStatus | Status of the campaign. try { $apiInstance->updateSmsCampaignStatus($campaignId, $status); } catch (Exception $e) { echo 'Exception when calling SMSCampaignsApi->updateSmsCampaignStatus: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **campaignId** | **int**| id of the campaign | - **status** | [**\Brevo\Client\Model\UpdateCampaignStatus**](../Model/UpdateCampaignStatus.md)| Status of the campaign. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **int**| id of the campaign | | +| **status** | [**\Brevo\Client\Models\UpdateCampaignStatus**](../Model/UpdateCampaignStatus.md)| Status of the campaign. | | ### Return type @@ -599,8 +677,9 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: `application/json` +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/SendersApi.md b/docs/Api/SendersApi.md index 53a1e77..58da459 100644 --- a/docs/Api/SendersApi.md +++ b/docs/Api/SendersApi.md @@ -1,44 +1,51 @@ # Brevo\Client\SendersApi -All URIs are relative to *https://api.brevo.com/v3* +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createSender**](SendersApi.md#createSender) | **POST** /senders | Create a new sender -[**deleteSender**](SendersApi.md#deleteSender) | **DELETE** /senders/{senderId} | Delete a sender -[**getIps**](SendersApi.md#getIps) | **GET** /senders/ips | Get all the dedicated IPs for your account -[**getIpsFromSender**](SendersApi.md#getIpsFromSender) | **GET** /senders/{senderId}/ips | Get all the dedicated IPs for a sender -[**getSenders**](SendersApi.md#getSenders) | **GET** /senders | Get the list of all your senders -[**updateSender**](SendersApi.md#updateSender) | **PUT** /senders/{senderId} | Update a sender -[**validateSenderByOTP**](SendersApi.md#validateSenderByOTP) | **PUT** /senders/{senderId}/validate | Update a sender +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createSender()**](SendersApi.md#createSender) | **POST** /senders | Create a new sender | +| [**deleteSender()**](SendersApi.md#deleteSender) | **DELETE** /senders/{senderId} | Delete a sender | +| [**getIps()**](SendersApi.md#getIps) | **GET** /senders/ips | Get all the dedicated IPs for your account | +| [**getIpsFromSender()**](SendersApi.md#getIpsFromSender) | **GET** /senders/{senderId}/ips | Get all the dedicated IPs for a sender | +| [**getSenders()**](SendersApi.md#getSenders) | **GET** /senders | Get the list of all your senders | +| [**updateSender()**](SendersApi.md#updateSender) | **PUT** /senders/{senderId} | Update a sender | +| [**validateSenderByOTP()**](SendersApi.md#validateSenderByOTP) | **PUT** /senders/{senderId}/validate | Validate Sender using OTP | -# **createSender** -> \Brevo\Client\Model\CreateSenderModel createSender($sender) +## `createSender()` + +```php +createSender($sender): \Brevo\Client\Models\CreateSenderModel +``` Create a new sender ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\CreateSender(); // \Brevo\Client\Model\CreateSender | sender's name +$sender = new \Brevo\Client\Models\CreateSender(); // \Brevo\Client\Models\CreateSender | sender's name try { $result = $apiInstance->createSender($sender); @@ -46,18 +53,17 @@ try { } catch (Exception $e) { echo 'Exception when calling SendersApi->createSender: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **sender** | [**\Brevo\Client\Model\CreateSender**](../Model/CreateSender.md)| sender's name | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **sender** | [**\Brevo\Client\Models\CreateSender**](../Model/CreateSender.md)| sender's name | [optional] | ### Return type -[**\Brevo\Client\Model\CreateSenderModel**](../Model/CreateSenderModel.md) +[**\Brevo\Client\Models\CreateSenderModel**](../Model/CreateSenderModel.md) ### Authorization @@ -65,51 +71,59 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **deleteSender** -> deleteSender($senderId) +## `deleteSender()` + +```php +deleteSender($senderId) +``` Delete a sender ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 +$senderId = 56; // int | Id of the sender try { $apiInstance->deleteSender($senderId); } catch (Exception $e) { echo 'Exception when calling SendersApi->deleteSender: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **senderId** | **int**| Id of the sender | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **senderId** | **int**| Id of the sender | | ### Return type @@ -121,30 +135,39 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `getIps()` -# **getIps** -> \Brevo\Client\Model\GetIps getIps() +```php +getIps(): \Brevo\Client\Models\GetIps +``` Get all the dedicated IPs for your account ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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. @@ -158,15 +181,15 @@ try { } catch (Exception $e) { echo 'Exception when calling SendersApi->getIps: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters + This endpoint does not need any parameter. ### Return type -[**\Brevo\Client\Model\GetIps**](../Model/GetIps.md) +[**\Brevo\Client\Models\GetIps**](../Model/GetIps.md) ### Authorization @@ -174,37 +197,46 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `getIpsFromSender()` -# **getIpsFromSender** -> \Brevo\Client\Model\GetIpsFromSender getIpsFromSender($senderId) +```php +getIpsFromSender($senderId): \Brevo\Client\Models\GetIpsFromSender +``` Get all the dedicated IPs for a sender ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 +$senderId = 56; // int | Id of the sender try { $result = $apiInstance->getIpsFromSender($senderId); @@ -212,18 +244,17 @@ try { } catch (Exception $e) { echo 'Exception when calling SendersApi->getIpsFromSender: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **senderId** | **int**| Id of the sender | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **senderId** | **int**| Id of the sender | | ### Return type -[**\Brevo\Client\Model\GetIpsFromSender**](../Model/GetIpsFromSender.md) +[**\Brevo\Client\Models\GetIpsFromSender**](../Model/GetIpsFromSender.md) ### Authorization @@ -231,38 +262,47 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getSenders** -> \Brevo\Client\Model\GetSendersList getSenders($ip, $domain) +## `getSenders()` + +```php +getSenders($ip, $domain): \Brevo\Client\Models\GetSendersList +``` Get the list of all your senders ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 +$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 = $apiInstance->getSenders($ip, $domain); @@ -270,19 +310,18 @@ try { } catch (Exception $e) { echo 'Exception when calling SendersApi->getSenders: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **ip** | **string**| Filter your senders for a specific ip (available for dedicated IP usage only) | [optional] - **domain** | **string**| Filter your senders for a specific domain | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **ip** | **string**| Filter your senders for a specific ip. **Available for dedicated IP usage only** | [optional] | +| **domain** | **string**| Filter your senders for a specific domain | [optional] | ### Return type -[**\Brevo\Client\Model\GetSendersList**](../Model/GetSendersList.md) +[**\Brevo\Client\Models\GetSendersList**](../Model/GetSendersList.md) ### Authorization @@ -290,53 +329,61 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **updateSender** -> updateSender($senderId, $sender) +## `updateSender()` + +```php +updateSender($senderId, $sender) +``` Update a sender ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\UpdateSender(); // \Brevo\Client\Model\UpdateSender | sender's name +$senderId = 56; // int | Id of the sender +$sender = new \Brevo\Client\Models\UpdateSender(); // \Brevo\Client\Models\UpdateSender | sender's name try { $apiInstance->updateSender($senderId, $sender); } catch (Exception $e) { echo 'Exception when calling SendersApi->updateSender: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **senderId** | **int**| Id of the sender | - **sender** | [**\Brevo\Client\Model\UpdateSender**](../Model/UpdateSender.md)| sender's name | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **senderId** | **int**| Id of the sender | | +| **sender** | [**\Brevo\Client\Models\UpdateSender**](../Model/UpdateSender.md)| sender's name | [optional] | ### Return type @@ -348,53 +395,61 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **validateSenderByOTP** -> validateSenderByOTP($senderId, $otp) +## `validateSenderByOTP()` -Update a sender +```php +validateSenderByOTP($senderId, $sender) +``` + +Validate Sender using OTP ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 -$otp = new \Brevo\Client\Model\Otp(); // \Brevo\Client\Model\Otp | otp +$senderId = 56; // int | Id of the sender +$sender = new \Brevo\Client\Models\Otp(); // \Brevo\Client\Models\Otp | otp try { - $apiInstance->validateSenderByOTP($senderId, $otp); + $apiInstance->validateSenderByOTP($senderId, $sender); } catch (Exception $e) { echo 'Exception when calling SendersApi->validateSenderByOTP: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **senderId** | **int**| Id of the sender | - **otp** | [**\Brevo\Client\Model\Otp**](../Model/Otp.md)| otp | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **senderId** | **int**| Id of the sender | | +| **sender** | [**\Brevo\Client\Models\Otp**](../Model/Otp.md)| otp | [optional] | ### Return type @@ -406,8 +461,9 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: `application/json` +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/TasksApi.md b/docs/Api/TasksApi.md index 0d9a90e..64d29ea 100644 --- a/docs/Api/TasksApi.md +++ b/docs/Api/TasksApi.md @@ -1,55 +1,62 @@ # Brevo\Client\TasksApi -All URIs are relative to *https://api.brevo.com/v3* +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**crmTasksGet**](TasksApi.md#crmTasksGet) | **GET** /crm/tasks | Get all tasks -[**crmTasksIdDelete**](TasksApi.md#crmTasksIdDelete) | **DELETE** /crm/tasks/{id} | Delete a task -[**crmTasksIdGet**](TasksApi.md#crmTasksIdGet) | **GET** /crm/tasks/{id} | Get a task -[**crmTasksIdPatch**](TasksApi.md#crmTasksIdPatch) | **PATCH** /crm/tasks/{id} | Update a task -[**crmTasksPost**](TasksApi.md#crmTasksPost) | **POST** /crm/tasks | Create a task -[**crmTasktypesGet**](TasksApi.md#crmTasktypesGet) | **GET** /crm/tasktypes | Get all task types +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**crmTasksGet()**](TasksApi.md#crmTasksGet) | **GET** /crm/tasks | Get all tasks | +| [**crmTasksIdDelete()**](TasksApi.md#crmTasksIdDelete) | **DELETE** /crm/tasks/{id} | Delete a task | +| [**crmTasksIdGet()**](TasksApi.md#crmTasksIdGet) | **GET** /crm/tasks/{id} | Get a task | +| [**crmTasksIdPatch()**](TasksApi.md#crmTasksIdPatch) | **PATCH** /crm/tasks/{id} | Update a task | +| [**crmTasksPost()**](TasksApi.md#crmTasksPost) | **POST** /crm/tasks | Create a task | +| [**crmTasktypesGet()**](TasksApi.md#crmTasktypesGet) | **GET** /crm/tasktypes | Get all task types | -# **crmTasksGet** -> \Brevo\Client\Model\TaskList crmTasksGet($filterType, $filterStatus, $filterDate, $filterAssignTo, $filterContacts, $filterDeals, $filterCompanies, $dateFrom, $dateTo, $offset, $limit, $sort, $sortBy) +## `crmTasksGet()` + +```php +crmTasksGet($filterType, $filterStatus, $filterDate, $filterAssignTo, $filterContacts, $filterDeals, $filterCompanies, $dateFrom, $dateTo, $offset, $limit, $sort, $sortBy): \Brevo\Client\Models\TaskList +``` Get all tasks ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TasksApi( // 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 ); -$filterType = "filterType_example"; // string | Filter by task type (ID) -$filterStatus = "filterStatus_example"; // string | Filter by task status -$filterDate = "filterDate_example"; // string | Filter by date -$filterAssignTo = "filterAssignTo_example"; // string | Filter by assignTo id -$filterContacts = "filterContacts_example"; // string | Filter by contact ids -$filterDeals = "filterDeals_example"; // string | Filter by deals ids -$filterCompanies = "filterCompanies_example"; // string | Filter by companies ids +$filterType = 'filterType_example'; // string | Filter by task type (ID) +$filterStatus = 'filterStatus_example'; // string | Filter by task status +$filterDate = 'filterDate_example'; // string | Filter by date +$filterAssignTo = 'filterAssignTo_example'; // string | Filter by the \"assignTo\" ID. You can utilize account emails for the \"assignTo\" attribute. +$filterContacts = 'filterContacts_example'; // string | Filter by contact ids +$filterDeals = 'filterDeals_example'; // string | Filter by deals ids +$filterCompanies = 'filterCompanies_example'; // string | Filter by companies ids $dateFrom = 56; // int | dateFrom to date range filter type (timestamp in milliseconds) $dateTo = 56; // int | dateTo to date range filter type (timestamp in milliseconds) -$offset = 789; // int | Index of the first document of the page +$offset = 56; // int | Index of the first document of the page $limit = 50; // int | Number of documents per page -$sort = "sort_example"; // string | Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed -$sortBy = "sortBy_example"; // string | The field used to sort field names. +$sort = 'sort_example'; // string | Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed +$sortBy = name; // string | The field used to sort field names. try { $result = $apiInstance->crmTasksGet($filterType, $filterStatus, $filterDate, $filterAssignTo, $filterContacts, $filterDeals, $filterCompanies, $dateFrom, $dateTo, $offset, $limit, $sort, $sortBy); @@ -57,30 +64,29 @@ try { } catch (Exception $e) { echo 'Exception when calling TasksApi->crmTasksGet: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **filterType** | **string**| Filter by task type (ID) | [optional] - **filterStatus** | **string**| Filter by task status | [optional] - **filterDate** | **string**| Filter by date | [optional] - **filterAssignTo** | **string**| Filter by assignTo id | [optional] - **filterContacts** | **string**| Filter by contact ids | [optional] - **filterDeals** | **string**| Filter by deals ids | [optional] - **filterCompanies** | **string**| Filter by companies ids | [optional] - **dateFrom** | **int**| dateFrom to date range filter type (timestamp in milliseconds) | [optional] - **dateTo** | **int**| dateTo to date range filter type (timestamp in milliseconds) | [optional] - **offset** | **int**| Index of the first document of the page | [optional] - **limit** | **int**| Number of documents per page | [optional] [default to 50] - **sort** | **string**| Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed | [optional] - **sortBy** | **string**| The field used to sort field names. | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **filterType** | **string**| Filter by task type (ID) | [optional] | +| **filterStatus** | **string**| Filter by task status | [optional] | +| **filterDate** | **string**| Filter by date | [optional] | +| **filterAssignTo** | **string**| Filter by the \"assignTo\" ID. You can utilize account emails for the \"assignTo\" attribute. | [optional] | +| **filterContacts** | **string**| Filter by contact ids | [optional] | +| **filterDeals** | **string**| Filter by deals ids | [optional] | +| **filterCompanies** | **string**| Filter by companies ids | [optional] | +| **dateFrom** | **int**| dateFrom to date range filter type (timestamp in milliseconds) | [optional] | +| **dateTo** | **int**| dateTo to date range filter type (timestamp in milliseconds) | [optional] | +| **offset** | **int**| Index of the first document of the page | [optional] | +| **limit** | **int**| Number of documents per page | [optional] [default to 50] | +| **sort** | **string**| Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed | [optional] | +| **sortBy** | **string**| The field used to sort field names. | [optional] | ### Return type -[**\Brevo\Client\Model\TaskList**](../Model/TaskList.md) +[**\Brevo\Client\Models\TaskList**](../Model/TaskList.md) ### Authorization @@ -88,51 +94,59 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **crmTasksIdDelete** -> crmTasksIdDelete($id) +## `crmTasksIdDelete()` + +```php +crmTasksIdDelete($id) +``` Delete a task ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TasksApi( // 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 ); -$id = "id_example"; // string | +$id = 'id_example'; // string try { $apiInstance->crmTasksIdDelete($id); } catch (Exception $e) { echo 'Exception when calling TasksApi->crmTasksIdDelete: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| | | ### Return type @@ -144,37 +158,46 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **crmTasksIdGet** -> \Brevo\Client\Model\Task crmTasksIdGet($id) +## `crmTasksIdGet()` + +```php +crmTasksIdGet($id): \Brevo\Client\Models\Task +``` Get a task ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TasksApi( // 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 ); -$id = "id_example"; // string | +$id = 'id_example'; // string try { $result = $apiInstance->crmTasksIdGet($id); @@ -182,18 +205,17 @@ try { } catch (Exception $e) { echo 'Exception when calling TasksApi->crmTasksIdGet: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| | | ### Return type -[**\Brevo\Client\Model\Task**](../Model/Task.md) +[**\Brevo\Client\Models\Task**](../Model/Task.md) ### Authorization @@ -201,53 +223,61 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `crmTasksIdPatch()` -# **crmTasksIdPatch** -> crmTasksIdPatch($id, $body) +```php +crmTasksIdPatch($id, $crmTasksIdPatchRequest) +``` Update a task ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TasksApi( // 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 ); -$id = "id_example"; // string | -$body = new \Brevo\Client\Model\Body9(); // \Brevo\Client\Model\Body9 | Updated task details. +$id = 'id_example'; // string +$crmTasksIdPatchRequest = new \Brevo\Client\Models\CrmTasksIdPatchRequest(); // \Brevo\Client\Models\CrmTasksIdPatchRequest | Updated task details. try { - $apiInstance->crmTasksIdPatch($id, $body); + $apiInstance->crmTasksIdPatch($id, $crmTasksIdPatchRequest); } catch (Exception $e) { echo 'Exception when calling TasksApi->crmTasksIdPatch: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **string**| | - **body** | [**\Brevo\Client\Model\Body9**](../Model/Body9.md)| Updated task details. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| | | +| **crmTasksIdPatchRequest** | [**\Brevo\Client\Models\CrmTasksIdPatchRequest**](../Model/CrmTasksIdPatchRequest.md)| Updated task details. | | ### Return type @@ -259,56 +289,64 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **crmTasksPost** -> \Brevo\Client\Model\InlineResponse2012 crmTasksPost($body) +## `crmTasksPost()` + +```php +crmTasksPost($crmTasksPostRequest): \Brevo\Client\Models\CrmTasksPost201Response +``` Create a task ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TasksApi( // 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 ); -$body = new \Brevo\Client\Model\Body8(); // \Brevo\Client\Model\Body8 | Task name. +$crmTasksPostRequest = new \Brevo\Client\Models\CrmTasksPostRequest(); // \Brevo\Client\Models\CrmTasksPostRequest | Task name. try { - $result = $apiInstance->crmTasksPost($body); + $result = $apiInstance->crmTasksPost($crmTasksPostRequest); print_r($result); } catch (Exception $e) { echo 'Exception when calling TasksApi->crmTasksPost: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**\Brevo\Client\Model\Body8**](../Model/Body8.md)| Task name. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **crmTasksPostRequest** | [**\Brevo\Client\Models\CrmTasksPostRequest**](../Model/CrmTasksPostRequest.md)| Task name. | | ### Return type -[**\Brevo\Client\Model\InlineResponse2012**](../Model/InlineResponse2012.md) +[**\Brevo\Client\Models\CrmTasksPost201Response**](../Model/CrmTasksPost201Response.md) ### Authorization @@ -316,30 +354,39 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `crmTasktypesGet()` -# **crmTasktypesGet** -> \Brevo\Client\Model\TaskTypes crmTasktypesGet() +```php +crmTasktypesGet(): \Brevo\Client\Models\TaskTypes +``` Get all task types ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TasksApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. @@ -353,15 +400,15 @@ try { } catch (Exception $e) { echo 'Exception when calling TasksApi->crmTasktypesGet: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters + This endpoint does not need any parameter. ### Return type -[**\Brevo\Client\Model\TaskTypes**](../Model/TaskTypes.md) +[**\Brevo\Client\Models\TaskTypes**](../Model/TaskTypes.md) ### Authorization @@ -369,8 +416,9 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: Not defined +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/TierApi.md b/docs/Api/TierApi.md new file mode 100644 index 0000000..1e86e72 --- /dev/null +++ b/docs/Api/TierApi.md @@ -0,0 +1,715 @@ +# Brevo\Client\TierApi + +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createTierForTierGroup()**](TierApi.md#createTierForTierGroup) | **POST** /loyalty/tier/programs/{loyaltyProgramId}/tier-groups/{tierGroupId}/tiers | Create new tier | +| [**createTierGroup()**](TierApi.md#createTierGroup) | **POST** /loyalty/tier/programs/{loyaltyProgramId}/tier-groups | Create tier group | +| [**deleteTierGroup()**](TierApi.md#deleteTierGroup) | **DELETE** /loyalty/tier/programs/{loyaltyProgramId}/tier-groups/{tierGroupId} | Delete tier group | +| [**getListOfTierGroups()**](TierApi.md#getListOfTierGroups) | **GET** /loyalty/tier/programs/{loyaltyProgramId}/tier-groups | Get tier group page | +| [**getLoyaltyProgramTier()**](TierApi.md#getLoyaltyProgramTier) | **GET** /loyalty/tier/programs/{loyaltyProgramId}/tiers | Get tier page | +| [**getTierGroup()**](TierApi.md#getTierGroup) | **GET** /loyalty/tier/programs/{loyaltyProgramId}/tier-groups/{tierGroupId} | Get tier group by Id | +| [**loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost()**](TierApi.md#loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost) | **POST** /loyalty/tier/programs/{loyaltyProgramId}/contacts/{contactId}/tiers/{tierId} | Add subscription to a tier | +| [**loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete()**](TierApi.md#loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete) | **DELETE** /loyalty/tier/programs/{loyaltyProgramId}/tiers/{tierId} | Delete tier | +| [**loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut()**](TierApi.md#loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut) | **PUT** /loyalty/tier/programs/{loyaltyProgramId}/tiers/{tierId} | Update tier | +| [**updateTierGroup()**](TierApi.md#updateTierGroup) | **PUT** /loyalty/tier/programs/{loyaltyProgramId}/tier-groups/{tierGroupId} | Update tier group | + + +## `createTierForTierGroup()` + +```php +createTierForTierGroup($loyaltyProgramId, $tierGroupId, $tierRequest): \Brevo\Client\Models\Tier +``` + +Create new tier + +Creates a new tier for the specified tier group + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\TierApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$tierGroupId = 'tierGroupId_example'; // string | Tier group Id +$tierRequest = new \Brevo\Client\Models\TierRequest(); // \Brevo\Client\Models\TierRequest + +try { + $result = $apiInstance->createTierForTierGroup($loyaltyProgramId, $tierGroupId, $tierRequest); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TierApi->createTierForTierGroup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **tierGroupId** | **string**| Tier group Id | | +| **tierRequest** | [**\Brevo\Client\Models\TierRequest**](../Model/TierRequest.md)| | | + +### Return type + +[**\Brevo\Client\Models\Tier**](../Model/Tier.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createTierGroup()` + +```php +createTierGroup($loyaltyProgramId, $createTierGroupRequest): \Brevo\Client\Models\TierGroup +``` + +Create tier group + +Creates tier group for the specified loyalty program + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\TierApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$createTierGroupRequest = new \Brevo\Client\Models\CreateTierGroupRequest(); // \Brevo\Client\Models\CreateTierGroupRequest | Subscription Member information + +try { + $result = $apiInstance->createTierGroup($loyaltyProgramId, $createTierGroupRequest); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TierApi->createTierGroup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **createTierGroupRequest** | [**\Brevo\Client\Models\CreateTierGroupRequest**](../Model/CreateTierGroupRequest.md)| Subscription Member information | | + +### Return type + +[**\Brevo\Client\Models\TierGroup**](../Model/TierGroup.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteTierGroup()` + +```php +deleteTierGroup($loyaltyProgramId, $tierGroupId) +``` + +Delete tier group + +Deletes tier group for the specified loyalty program + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\TierApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$tierGroupId = 'tierGroupId_example'; // string | Tier group Id + +try { + $apiInstance->deleteTierGroup($loyaltyProgramId, $tierGroupId); +} catch (Exception $e) { + echo 'Exception when calling TierApi->deleteTierGroup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **tierGroupId** | **string**| Tier group Id | | + +### Return type + +void (empty response body) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getListOfTierGroups()` + +```php +getListOfTierGroups($loyaltyProgramId, $version): \Brevo\Client\Models\TierGroupPage +``` + +Get tier group page + +Return a list of tier groups for the specified loyalty program + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\TierApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$version = 'draft'; // string | Select 'active' to retrieve list of all tier groups which are live for clients. Select draft to retrieve list of all non deleted tier groups. + +try { + $result = $apiInstance->getListOfTierGroups($loyaltyProgramId, $version); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TierApi->getListOfTierGroups: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **version** | **string**| Select 'active' to retrieve list of all tier groups which are live for clients. Select draft to retrieve list of all non deleted tier groups. | [optional] [default to 'draft'] | + +### Return type + +[**\Brevo\Client\Models\TierGroupPage**](../Model/TierGroupPage.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getLoyaltyProgramTier()` + +```php +getLoyaltyProgramTier($loyaltyProgramId, $version): \Brevo\Client\Models\LoyaltyTierPage +``` + +Get tier page + +Returns tier page + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\TierApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$version = 'draft'; // string | Select 'active' to retrieve list of all tiers which are live for clients. Select draft to retrieve list of all non deleted tiers. + +try { + $result = $apiInstance->getLoyaltyProgramTier($loyaltyProgramId, $version); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TierApi->getLoyaltyProgramTier: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **version** | **string**| Select 'active' to retrieve list of all tiers which are live for clients. Select draft to retrieve list of all non deleted tiers. | [optional] [default to 'draft'] | + +### Return type + +[**\Brevo\Client\Models\LoyaltyTierPage**](../Model/LoyaltyTierPage.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getTierGroup()` + +```php +getTierGroup($loyaltyProgramId, $tierGroupId, $version): \Brevo\Client\Models\TierGroup +``` + +Get tier group by Id + +Returns the specified tier group for the specified loyalty program + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\TierApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$tierGroupId = 'tierGroupId_example'; // string | Tier group Id +$version = 'draft'; // string | Select active to retrieve active version of tier group. Select draft to retrieve latest changes in tier group. + +try { + $result = $apiInstance->getTierGroup($loyaltyProgramId, $tierGroupId, $version); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TierApi->getTierGroup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **tierGroupId** | **string**| Tier group Id | | +| **version** | **string**| Select active to retrieve active version of tier group. Select draft to retrieve latest changes in tier group. | [optional] [default to 'draft'] | + +### Return type + +[**\Brevo\Client\Models\TierGroup**](../Model/TierGroup.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost()` + +```php +loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost($loyaltyProgramId, $contactId, $tierId): \Brevo\Client\Models\TierForContact +``` + +Add subscription to a tier + +Assigns a subscription tier to a specific contact within a loyalty program + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\TierApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$contactId = 'contactId_example'; // string | Contact Id +$tierId = 'tierId_example'; // string | Tier Id + +try { + $result = $apiInstance->loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost($loyaltyProgramId, $contactId, $tierId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TierApi->loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **contactId** | **string**| Contact Id | | +| **tierId** | **string**| Tier Id | | + +### Return type + +[**\Brevo\Client\Models\TierForContact**](../Model/TierForContact.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete()` + +```php +loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete($loyaltyProgramId, $tierId) +``` + +Delete tier + +Deletes an existing tier for the specified tier group + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\TierApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$tierId = 'tierId_example'; // string | Tier Id + +try { + $apiInstance->loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete($loyaltyProgramId, $tierId); +} catch (Exception $e) { + echo 'Exception when calling TierApi->loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **tierId** | **string**| Tier Id | | + +### Return type + +void (empty response body) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut()` + +```php +loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut($loyaltyProgramId, $tierId, $tierRequest): \Brevo\Client\Models\Tier +``` + +Update tier + +Modifies an existing tier for the specified tier group + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\TierApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$tierId = 'tierId_example'; // string | Tier Id +$tierRequest = new \Brevo\Client\Models\TierRequest(); // \Brevo\Client\Models\TierRequest + +try { + $result = $apiInstance->loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut($loyaltyProgramId, $tierId, $tierRequest); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TierApi->loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **tierId** | **string**| Tier Id | | +| **tierRequest** | [**\Brevo\Client\Models\TierRequest**](../Model/TierRequest.md)| | | + +### Return type + +[**\Brevo\Client\Models\Tier**](../Model/Tier.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateTierGroup()` + +```php +updateTierGroup($loyaltyProgramId, $tierGroupId, $updateTierGroupRequest): \Brevo\Client\Models\TierGroup +``` + +Update tier group + +Modifies an existing tier group for the specified loyalty program + +### Example + +```php +setApiKey('api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +// Configure API key authorization: partner-key +$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + + +$apiInstance = new Brevo\Client\Api\TierApi( + // 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 +); +$loyaltyProgramId = 'loyaltyProgramId_example'; // string | Loyalty Program Id +$tierGroupId = 'tierGroupId_example'; // string | Tier group Id +$updateTierGroupRequest = new \Brevo\Client\Models\UpdateTierGroupRequest(); // \Brevo\Client\Models\UpdateTierGroupRequest + +try { + $result = $apiInstance->updateTierGroup($loyaltyProgramId, $tierGroupId, $updateTierGroupRequest); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TierApi->updateTierGroup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltyProgramId** | **string**| Loyalty Program Id | | +| **tierGroupId** | **string**| Tier group Id | | +| **updateTierGroupRequest** | [**\Brevo\Client\Models\UpdateTierGroupRequest**](../Model/UpdateTierGroupRequest.md)| | | + +### Return type + +[**\Brevo\Client\Models\TierGroup**](../Model/TierGroup.md) + +### Authorization + +[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/TransactionalEmailsApi.md b/docs/Api/TransactionalEmailsApi.md index 52efc93..d7d4c31 100644 --- a/docs/Api/TransactionalEmailsApi.md +++ b/docs/Api/TransactionalEmailsApi.md @@ -1,75 +1,80 @@ # Brevo\Client\TransactionalEmailsApi -All URIs are relative to *https://api.brevo.com/v3* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**blockNewDomain**](TransactionalEmailsApi.md#blockNewDomain) | **POST** /smtp/blockedDomains | Add a new domain to the list of blocked domains -[**createSmtpTemplate**](TransactionalEmailsApi.md#createSmtpTemplate) | **POST** /smtp/templates | Create an email template -[**deleteBlockedDomain**](TransactionalEmailsApi.md#deleteBlockedDomain) | **DELETE** /smtp/blockedDomains/{domain} | Unblock an existing domain from the list of blocked domains -[**deleteHardbounces**](TransactionalEmailsApi.md#deleteHardbounces) | **POST** /smtp/deleteHardbounces | Delete hardbounces -[**deleteScheduledEmailById**](TransactionalEmailsApi.md#deleteScheduledEmailById) | **DELETE** /smtp/email/{identifier} | Delete scheduled emails by batchId or messageId -[**deleteSmtpTemplate**](TransactionalEmailsApi.md#deleteSmtpTemplate) | **DELETE** /smtp/templates/{templateId} | Delete an inactive email template -[**getAggregatedSmtpReport**](TransactionalEmailsApi.md#getAggregatedSmtpReport) | **GET** /smtp/statistics/aggregatedReport | Get your transactional email activity aggregated over a period of time -[**getBlockedDomains**](TransactionalEmailsApi.md#getBlockedDomains) | **GET** /smtp/blockedDomains | Get the list of blocked domains -[**getEmailEventReport**](TransactionalEmailsApi.md#getEmailEventReport) | **GET** /smtp/statistics/events | Get all your transactional email activity (unaggregated events) -[**getScheduledEmailByBatchId**](TransactionalEmailsApi.md#getScheduledEmailByBatchId) | **GET** /smtp/emailStatus/{batchId} | Fetch scheduled emails by batchId -[**getScheduledEmailByMessageId**](TransactionalEmailsApi.md#getScheduledEmailByMessageId) | **GET** /smtp/emailStatus/{messageId} | Fetch scheduled email by messageId -[**getSmtpReport**](TransactionalEmailsApi.md#getSmtpReport) | **GET** /smtp/statistics/reports | Get your transactional email activity aggregated per day -[**getSmtpTemplate**](TransactionalEmailsApi.md#getSmtpTemplate) | **GET** /smtp/templates/{templateId} | Returns the template information -[**getSmtpTemplates**](TransactionalEmailsApi.md#getSmtpTemplates) | **GET** /smtp/templates | Get the list of email templates -[**getTransacBlockedContacts**](TransactionalEmailsApi.md#getTransacBlockedContacts) | **GET** /smtp/blockedContacts | Get the list of blocked or unsubscribed transactional contacts -[**getTransacEmailContent**](TransactionalEmailsApi.md#getTransacEmailContent) | **GET** /smtp/emails/{uuid} | Get the personalized content of a sent transactional email -[**getTransacEmailsList**](TransactionalEmailsApi.md#getTransacEmailsList) | **GET** /smtp/emails | Get the list of transactional emails on the basis of allowed filters -[**sendTestTemplate**](TransactionalEmailsApi.md#sendTestTemplate) | **POST** /smtp/templates/{templateId}/sendTest | Send a template to your test list -[**sendTransacEmail**](TransactionalEmailsApi.md#sendTransacEmail) | **POST** /smtp/email | Send a transactional email -[**smtpBlockedContactsEmailDelete**](TransactionalEmailsApi.md#smtpBlockedContactsEmailDelete) | **DELETE** /smtp/blockedContacts/{email} | Unblock or resubscribe a transactional contact -[**smtpLogIdentifierDelete**](TransactionalEmailsApi.md#smtpLogIdentifierDelete) | **DELETE** /smtp/log/{identifier} | Delete an SMTP transactional log -[**updateSmtpTemplate**](TransactionalEmailsApi.md#updateSmtpTemplate) | **PUT** /smtp/templates/{templateId} | Update an email template - - -# **blockNewDomain** -> blockNewDomain($blockDomain) +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**blockNewDomain()**](TransactionalEmailsApi.md#blockNewDomain) | **POST** /smtp/blockedDomains | Add a new domain to the list of blocked domains | +| [**createSmtpTemplate()**](TransactionalEmailsApi.md#createSmtpTemplate) | **POST** /smtp/templates | Create an email template | +| [**deleteBlockedDomain()**](TransactionalEmailsApi.md#deleteBlockedDomain) | **DELETE** /smtp/blockedDomains/{domain} | Unblock an existing domain from the list of blocked domains | +| [**deleteHardbounces()**](TransactionalEmailsApi.md#deleteHardbounces) | **POST** /smtp/deleteHardbounces | Delete hardbounces | +| [**deleteScheduledEmailById()**](TransactionalEmailsApi.md#deleteScheduledEmailById) | **DELETE** /smtp/email/{identifier} | Delete scheduled emails by batchId or messageId | +| [**deleteSmtpTemplate()**](TransactionalEmailsApi.md#deleteSmtpTemplate) | **DELETE** /smtp/templates/{templateId} | Delete an inactive email template | +| [**getAggregatedSmtpReport()**](TransactionalEmailsApi.md#getAggregatedSmtpReport) | **GET** /smtp/statistics/aggregatedReport | Get your transactional email activity aggregated over a period of time | +| [**getBlockedDomains()**](TransactionalEmailsApi.md#getBlockedDomains) | **GET** /smtp/blockedDomains | Get the list of blocked domains | +| [**getEmailEventReport()**](TransactionalEmailsApi.md#getEmailEventReport) | **GET** /smtp/statistics/events | Get all your transactional email activity (unaggregated events) | +| [**getScheduledEmailById()**](TransactionalEmailsApi.md#getScheduledEmailById) | **GET** /smtp/emailStatus/{identifier} | Fetch scheduled emails by batchId or messageId | +| [**getSmtpReport()**](TransactionalEmailsApi.md#getSmtpReport) | **GET** /smtp/statistics/reports | Get your transactional email activity aggregated per day | +| [**getSmtpTemplate()**](TransactionalEmailsApi.md#getSmtpTemplate) | **GET** /smtp/templates/{templateId} | Returns the template information | +| [**getSmtpTemplates()**](TransactionalEmailsApi.md#getSmtpTemplates) | **GET** /smtp/templates | Get the list of email templates | +| [**getTransacBlockedContacts()**](TransactionalEmailsApi.md#getTransacBlockedContacts) | **GET** /smtp/blockedContacts | Get the list of blocked or unsubscribed transactional contacts | +| [**getTransacEmailContent()**](TransactionalEmailsApi.md#getTransacEmailContent) | **GET** /smtp/emails/{uuid} | Get the personalized content of a sent transactional email | +| [**getTransacEmailsList()**](TransactionalEmailsApi.md#getTransacEmailsList) | **GET** /smtp/emails | Get the list of transactional emails on the basis of allowed filters | +| [**sendTestTemplate()**](TransactionalEmailsApi.md#sendTestTemplate) | **POST** /smtp/templates/{templateId}/sendTest | Send a template to your test list | +| [**sendTransacEmail()**](TransactionalEmailsApi.md#sendTransacEmail) | **POST** /smtp/email | Send a transactional email | +| [**smtpBlockedContactsEmailDelete()**](TransactionalEmailsApi.md#smtpBlockedContactsEmailDelete) | **DELETE** /smtp/blockedContacts/{email} | Unblock or resubscribe a transactional contact | +| [**smtpLogIdentifierDelete()**](TransactionalEmailsApi.md#smtpLogIdentifierDelete) | **DELETE** /smtp/log/{identifier} | Delete an SMTP transactional log | +| [**updateSmtpTemplate()**](TransactionalEmailsApi.md#updateSmtpTemplate) | **PUT** /smtp/templates/{templateId} | Update an email template | + + +## `blockNewDomain()` + +```php +blockNewDomain($blockDomain) +``` Add a new domain to the list of blocked domains Blocks a new domain in order to avoid messages being sent to the same ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // 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 ); -$blockDomain = new \Brevo\Client\Model\BlockDomain(); // \Brevo\Client\Model\BlockDomain | +$blockDomain = new \Brevo\Client\Models\BlockDomain(); // \Brevo\Client\Models\BlockDomain | Name of the domain to be blocked try { $apiInstance->blockNewDomain($blockDomain); } catch (Exception $e) { echo 'Exception when calling TransactionalEmailsApi->blockNewDomain: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **blockDomain** | [**\Brevo\Client\Model\BlockDomain**](../Model/BlockDomain.md)| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **blockDomain** | [**\Brevo\Client\Models\BlockDomain**](../Model/BlockDomain.md)| Name of the domain to be blocked | | ### Return type @@ -81,56 +86,64 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `createSmtpTemplate()` -# **createSmtpTemplate** -> \Brevo\Client\Model\CreateModel createSmtpTemplate($smtpTemplate) +```php +createSmtpTemplate($createSmtpTemplate): \Brevo\Client\Models\CreateModel +``` Create an email template ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // 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 \Brevo\Client\Model\CreateSmtpTemplate(); // \Brevo\Client\Model\CreateSmtpTemplate | values to update in transactional email template +$createSmtpTemplate = new \Brevo\Client\Models\CreateSmtpTemplate(); // \Brevo\Client\Models\CreateSmtpTemplate | values to update in transactional email template try { - $result = $apiInstance->createSmtpTemplate($smtpTemplate); + $result = $apiInstance->createSmtpTemplate($createSmtpTemplate); print_r($result); } catch (Exception $e) { echo 'Exception when calling TransactionalEmailsApi->createSmtpTemplate: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **smtpTemplate** | [**\Brevo\Client\Model\CreateSmtpTemplate**](../Model/CreateSmtpTemplate.md)| values to update in transactional email template | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **createSmtpTemplate** | [**\Brevo\Client\Models\CreateSmtpTemplate**](../Model/CreateSmtpTemplate.md)| values to update in transactional email template | | ### Return type -[**\Brevo\Client\Model\CreateModel**](../Model/CreateModel.md) +[**\Brevo\Client\Models\CreateModel**](../Model/CreateModel.md) ### Authorization @@ -138,53 +151,61 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `deleteBlockedDomain()` -# **deleteBlockedDomain** -> deleteBlockedDomain($domain) +```php +deleteBlockedDomain($domain) +``` Unblock an existing domain from the list of blocked domains Unblocks an existing domain from the list of blocked domains ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // 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 ); -$domain = "domain_example"; // string | The name of the domain to be deleted +$domain = 'domain_example'; // string | The name of the domain to be deleted try { $apiInstance->deleteBlockedDomain($domain); } catch (Exception $e) { echo 'Exception when calling TransactionalEmailsApi->deleteBlockedDomain: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **domain** | **string**| The name of the domain to be deleted | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **domain** | **string**| The name of the domain to be deleted | | ### Return type @@ -196,53 +217,61 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **deleteHardbounces** -> deleteHardbounces($deleteHardbounces) +## `deleteHardbounces()` + +```php +deleteHardbounces($deleteHardbounces) +``` Delete hardbounces Delete hardbounces. To use carefully (e.g. in case of temporary ISP failures) ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // 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 \Brevo\Client\Model\DeleteHardbounces(); // \Brevo\Client\Model\DeleteHardbounces | values to delete hardbounces +$deleteHardbounces = new \Brevo\Client\Models\DeleteHardbounces(); // \Brevo\Client\Models\DeleteHardbounces | values to delete hardbounces try { $apiInstance->deleteHardbounces($deleteHardbounces); } catch (Exception $e) { echo 'Exception when calling TransactionalEmailsApi->deleteHardbounces: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **deleteHardbounces** | [**\Brevo\Client\Model\DeleteHardbounces**](../Model/DeleteHardbounces.md)| values to delete hardbounces | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **deleteHardbounces** | [**\Brevo\Client\Models\DeleteHardbounces**](../Model/DeleteHardbounces.md)| values to delete hardbounces | [optional] | ### Return type @@ -254,53 +283,61 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `deleteScheduledEmailById()` -# **deleteScheduledEmailById** -> deleteScheduledEmailById($identifier) +```php +deleteScheduledEmailById($identifier) +``` Delete scheduled emails by batchId or messageId Delete scheduled batch of emails by batchId or single scheduled email by messageId ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // 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 ); -$identifier = "identifier_example"; // string | The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. +$identifier = 4320f270-a4e3-4a2e-b591-edfe30a5e627; // string | The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. try { $apiInstance->deleteScheduledEmailById($identifier); } catch (Exception $e) { echo 'Exception when calling TransactionalEmailsApi->deleteScheduledEmailById: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **identifier** | **string**| The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **identifier** | **string**| The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. | | ### Return type @@ -312,51 +349,59 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **deleteSmtpTemplate** -> deleteSmtpTemplate($templateId) +## `deleteSmtpTemplate()` + +```php +deleteSmtpTemplate($templateId) +``` Delete an inactive email template ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // 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 +$templateId = 56; // int | id of the template try { $apiInstance->deleteSmtpTemplate($templateId); } catch (Exception $e) { echo 'Exception when calling TransactionalEmailsApi->deleteSmtpTemplate: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **templateId** | **int**| id of the template | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **templateId** | **int**| id of the template | | ### Return type @@ -368,42 +413,51 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getAggregatedSmtpReport** -> \Brevo\Client\Model\GetAggregatedReport getAggregatedSmtpReport($startDate, $endDate, $days, $tag) +## `getAggregatedSmtpReport()` + +```php +getAggregatedSmtpReport($startDate, $endDate, $days, $tag): \Brevo\Client\Models\GetAggregatedReport +``` Get your transactional email activity aggregated over a period of time This endpoint will show the aggregated stats for past 90 days by default if `startDate` and `endDate` OR `days` is not passed. The date range can not exceed 90 days ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // 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 = "startDate_example"; // string | Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate -$endDate = "endDate_example"; // string | Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate -$days = 789; // 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 +$startDate = 'startDate_example'; // string | **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate +$endDate = 'endDate_example'; // string | **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 = $apiInstance->getAggregatedSmtpReport($startDate, $endDate, $days, $tag); @@ -411,21 +465,20 @@ try { } catch (Exception $e) { echo 'Exception when calling TransactionalEmailsApi->getAggregatedSmtpReport: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **startDate** | **string**| Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate | [optional] - **endDate** | **string**| Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate | [optional] - **days** | **int**| Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' | [optional] - **tag** | **string**| Tag of the emails | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **startDate** | **string**| **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate | [optional] | +| **endDate** | **string**| **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate | [optional] | +| **days** | **int**| Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ | [optional] | +| **tag** | **string**| Tag of the emails | [optional] | ### Return type -[**\Brevo\Client\Model\GetAggregatedReport**](../Model/GetAggregatedReport.md) +[**\Brevo\Client\Models\GetAggregatedReport**](../Model/GetAggregatedReport.md) ### Authorization @@ -433,32 +486,41 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `getBlockedDomains()` -# **getBlockedDomains** -> \Brevo\Client\Model\GetBlockedDomains getBlockedDomains() +```php +getBlockedDomains(): \Brevo\Client\Models\GetBlockedDomains +``` Get the list of blocked domains Get the list of blocked domains ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. @@ -472,15 +534,15 @@ try { } catch (Exception $e) { echo 'Exception when calling TransactionalEmailsApi->getBlockedDomains: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters + This endpoint does not need any parameter. ### Return type -[**\Brevo\Client\Model\GetBlockedDomains**](../Model/GetBlockedDomains.md) +[**\Brevo\Client\Models\GetBlockedDomains**](../Model/GetBlockedDomains.md) ### Authorization @@ -488,32 +550,41 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `getEmailEventReport()` -# **getEmailEventReport** -> \Brevo\Client\Model\GetEmailEventReport getEmailEventReport($limit, $offset, $startDate, $endDate, $days, $email, $event, $tags, $messageId, $templateId, $sort) +```php +getEmailEventReport($limit, $offset, $startDate, $endDate, $days, $email, $event, $tags, $messageId, $templateId, $sort): \Brevo\Client\Models\GetEmailEventReport +``` Get all your transactional email activity (unaggregated events) This endpoint will show the aggregated stats for past 30 days by default if `startDate` and `endDate` OR `days` is not passed. The date range can not exceed 90 days ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. @@ -522,15 +593,15 @@ $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( ); $limit = 2500; // int | Number limitation for the result returned $offset = 0; // int | Beginning point in the list to retrieve from. -$startDate = "startDate_example"; // string | Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate -$endDate = "endDate_example"; // string | Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate -$days = 789; // int | Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' -$email = "email_example"; // string | Filter the report for a specific email addresses -$event = "event_example"; // string | Filter the report for a specific event type -$tags = "tags_example"; // string | Filter the report for tags (serialized and urlencoded array) -$messageId = "messageId_example"; // string | Filter on a specific message id -$templateId = 789; // int | Filter on a specific template id -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed +$startDate = 'startDate_example'; // string | **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate +$endDate = 'endDate_example'; // string | **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'_ +$email = 'email_example'; // string | Filter the report for a specific email addresses +$event = 'event_example'; // string | Filter the report for a specific event type +$tags = 'tags_example'; // string | Filter the report for tags (serialized and urlencoded array). To pass multiple tags, a format of string separated by commas is used such as **\"one, two, three\"** +$messageId = 'messageId_example'; // string | Filter on a specific message id +$templateId = 56; // int | Filter on a specific template id +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed try { $result = $apiInstance->getEmailEventReport($limit, $offset, $startDate, $endDate, $days, $email, $event, $tags, $messageId, $templateId, $sort); @@ -538,28 +609,27 @@ try { } catch (Exception $e) { echo 'Exception when calling TransactionalEmailsApi->getEmailEventReport: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **limit** | **int**| Number limitation for the result returned | [optional] [default to 2500] - **offset** | **int**| Beginning point in the list to retrieve from. | [optional] [default to 0] - **startDate** | **string**| Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate | [optional] - **endDate** | **string**| Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate | [optional] - **days** | **int**| Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' | [optional] - **email** | **string**| Filter the report for a specific email addresses | [optional] - **event** | **string**| Filter the report for a specific event type | [optional] - **tags** | **string**| Filter the report for tags (serialized and urlencoded array) | [optional] - **messageId** | **string**| Filter on a specific message id | [optional] - **templateId** | **int**| Filter on a specific template id | [optional] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Number limitation for the result returned | [optional] [default to 2500] | +| **offset** | **int**| Beginning point in the list to retrieve from. | [optional] [default to 0] | +| **startDate** | **string**| **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate | [optional] | +| **endDate** | **string**| **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate | [optional] | +| **days** | **int**| Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ | [optional] | +| **email** | **string**| Filter the report for a specific email addresses | [optional] | +| **event** | **string**| Filter the report for a specific event type | [optional] | +| **tags** | **string**| Filter the report for tags (serialized and urlencoded array). To pass multiple tags, a format of string separated by commas is used such as **\"one, two, three\"** | [optional] | +| **messageId** | **string**| Filter on a specific message id | [optional] | +| **templateId** | **int**| Filter on a specific template id | [optional] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | ### Return type -[**\Brevo\Client\Model\GetEmailEventReport**](../Model/GetEmailEventReport.md) +[**\Brevo\Client\Models\GetEmailEventReport**](../Model/GetEmailEventReport.md) ### Authorization @@ -567,133 +637,78 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: Not defined +- **Accept**: `application/json` -# **getScheduledEmailByBatchId** -> \Brevo\Client\Model\GetScheduledEmailByBatchId getScheduledEmailByBatchId($batchId, $startDate, $endDate, $sort, $status, $limit, $offset) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -Fetch scheduled emails by batchId +## `getScheduledEmailById()` -Fetch scheduled batch of emails by batchId (Can retrieve data upto 30 days old) - -### Example ```php -setApiKey('api-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -// Configure API key authorization: partner-key -$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); - -$apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( - // 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 -); -$batchId = "batchId_example"; // string | The batchId of scheduled emails batch (Should be a valid UUIDv4) -$startDate = new \DateTime("2013-10-20"); // \DateTime | Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. -$endDate = new \DateTime("2013-10-20"); // \DateTime | Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed -$status = "status_example"; // string | Filter the records by `status` of the scheduled email batch or message. -$limit = 100; // int | Number of documents returned per page -$offset = 0; // int | Index of the first document on the page - -try { - $result = $apiInstance->getScheduledEmailByBatchId($batchId, $startDate, $endDate, $sort, $status, $limit, $offset); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling TransactionalEmailsApi->getScheduledEmailByBatchId: ', $e->getMessage(), PHP_EOL; -} -?> +getScheduledEmailById($identifier, $startDate, $endDate, $sort, $status, $limit, $offset): \Brevo\Client\Models\GetScheduledEmailById200Response ``` -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **batchId** | **string**| The batchId of scheduled emails batch (Should be a valid UUIDv4) | - **startDate** | **\DateTime**| Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. | [optional] - **endDate** | **\DateTime**| Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. | [optional] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] - **status** | **string**| Filter the records by `status` of the scheduled email batch or message. | [optional] - **limit** | **int**| Number of documents returned per page | [optional] [default to 100] - **offset** | **int**| Index of the first document on the page | [optional] [default to 0] - -### Return type - -[**\Brevo\Client\Model\GetScheduledEmailByBatchId**](../Model/GetScheduledEmailByBatchId.md) - -### Authorization - -[api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - -# **getScheduledEmailByMessageId** -> \Brevo\Client\Model\GetScheduledEmailByMessageId getScheduledEmailByMessageId($messageId, $startDate, $endDate) - -Fetch scheduled email by messageId +Fetch scheduled emails by batchId or messageId -Fetch scheduled email by messageId (Can retrieve data upto 30 days old) +Fetch scheduled batch of emails by batchId or single scheduled email by messageId (Can retrieve data upto 30 days old) ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // 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 ); -$messageId = "messageId_example"; // string | The messageId of scheduled email -$startDate = new \DateTime("2013-10-20"); // \DateTime | Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. -$endDate = new \DateTime("2013-10-20"); // \DateTime | Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. +$identifier = 4320f270-a4e3-4a2e-b591-edfe30a5e627; // string | The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. +$startDate = 2022-02-02; // \DateTime | Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. +$endDate = 2022-03-02; // \DateTime | Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. Not valid when identifier is `messageId`. +$status = 'status_example'; // string | Filter the records by `status` of the scheduled email batch or message. Not valid when identifier is `messageId`. +$limit = 100; // int | Number of documents returned per page. Not valid when identifier is `messageId`. +$offset = 0; // int | Index of the first document on the page. Not valid when identifier is `messageId`. try { - $result = $apiInstance->getScheduledEmailByMessageId($messageId, $startDate, $endDate); + $result = $apiInstance->getScheduledEmailById($identifier, $startDate, $endDate, $sort, $status, $limit, $offset); print_r($result); } catch (Exception $e) { - echo 'Exception when calling TransactionalEmailsApi->getScheduledEmailByMessageId: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling TransactionalEmailsApi->getScheduledEmailById: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **messageId** | **string**| The messageId of scheduled email | - **startDate** | **\DateTime**| Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. | [optional] - **endDate** | **\DateTime**| Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **identifier** | **string**| The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. | | +| **startDate** | **\DateTime**| Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. | [optional] | +| **endDate** | **\DateTime**| Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. | [optional] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. Not valid when identifier is `messageId`. | [optional] [default to 'desc'] | +| **status** | **string**| Filter the records by `status` of the scheduled email batch or message. Not valid when identifier is `messageId`. | [optional] | +| **limit** | **int**| Number of documents returned per page. Not valid when identifier is `messageId`. | [optional] [default to 100] | +| **offset** | **int**| Index of the first document on the page. Not valid when identifier is `messageId`. | [optional] [default to 0] | ### Return type -[**\Brevo\Client\Model\GetScheduledEmailByMessageId**](../Model/GetScheduledEmailByMessageId.md) +[**\Brevo\Client\Models\GetScheduledEmailById200Response**](../Model/GetScheduledEmailById200Response.md) ### Authorization @@ -701,30 +716,39 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `getSmtpReport()` -# **getSmtpReport** -> \Brevo\Client\Model\GetReports getSmtpReport($limit, $offset, $startDate, $endDate, $days, $tag, $sort) +```php +getSmtpReport($limit, $offset, $startDate, $endDate, $days, $tag, $sort): \Brevo\Client\Models\GetReports +``` Get your transactional email activity aggregated per day ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. @@ -733,11 +757,11 @@ $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( ); $limit = 10; // int | Number of documents returned per page $offset = 0; // int | Index of the first document on the page -$startDate = "startDate_example"; // string | Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD) -$endDate = "endDate_example"; // string | Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD) -$days = 789; // 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 -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed +$startDate = 'startDate_example'; // string | **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD) +$endDate = 'endDate_example'; // string | **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD) +$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 +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed try { $result = $apiInstance->getSmtpReport($limit, $offset, $startDate, $endDate, $days, $tag, $sort); @@ -745,24 +769,23 @@ try { } catch (Exception $e) { echo 'Exception when calling TransactionalEmailsApi->getSmtpReport: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **limit** | **int**| Number of documents returned per page | [optional] [default to 10] - **offset** | **int**| Index of the first document on the page | [optional] [default to 0] - **startDate** | **string**| Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD) | [optional] - **endDate** | **string**| Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD) | [optional] - **days** | **int**| Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' | [optional] - **tag** | **string**| Tag of the emails | [optional] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Number of documents returned per page | [optional] [default to 10] | +| **offset** | **int**| Index of the first document on the page | [optional] [default to 0] | +| **startDate** | **string**| **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD) | [optional] | +| **endDate** | **string**| **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD) | [optional] | +| **days** | **int**| Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ | [optional] | +| **tag** | **string**| Tag of the emails | [optional] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | ### Return type -[**\Brevo\Client\Model\GetReports**](../Model/GetReports.md) +[**\Brevo\Client\Models\GetReports**](../Model/GetReports.md) ### Authorization @@ -770,37 +793,46 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getSmtpTemplate** -> \Brevo\Client\Model\GetSmtpTemplateOverview getSmtpTemplate($templateId) +## `getSmtpTemplate()` + +```php +getSmtpTemplate($templateId): \Brevo\Client\Models\GetSmtpTemplateOverview +``` Returns the template information ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // 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 +$templateId = 56; // int | id of the template try { $result = $apiInstance->getSmtpTemplate($templateId); @@ -808,18 +840,17 @@ try { } catch (Exception $e) { echo 'Exception when calling TransactionalEmailsApi->getSmtpTemplate: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **templateId** | **int**| id of the template | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **templateId** | **int**| id of the template | | ### Return type -[**\Brevo\Client\Model\GetSmtpTemplateOverview**](../Model/GetSmtpTemplateOverview.md) +[**\Brevo\Client\Models\GetSmtpTemplateOverview**](../Model/GetSmtpTemplateOverview.md) ### Authorization @@ -827,40 +858,49 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getSmtpTemplates** -> \Brevo\Client\Model\GetSmtpTemplates getSmtpTemplates($templateStatus, $limit, $offset, $sort) +## `getSmtpTemplates()` + +```php +getSmtpTemplates($templateStatus, $limit, $offset, $sort): \Brevo\Client\Models\GetSmtpTemplates +``` Get the list of email templates ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // 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 +$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 -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed try { $result = $apiInstance->getSmtpTemplates($templateStatus, $limit, $offset, $sort); @@ -868,21 +908,20 @@ try { } catch (Exception $e) { echo 'Exception when calling TransactionalEmailsApi->getSmtpTemplates: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **templateStatus** | **bool**| Filter on the status of the template. Active = true, inactive = false | [optional] - **limit** | **int**| Number of documents returned per page | [optional] [default to 50] - **offset** | **int**| Index of the first document in the page | [optional] [default to 0] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **templateStatus** | **bool**| Filter on the status of the template. Active = true, inactive = false | [optional] | +| **limit** | **int**| Number of documents returned per page | [optional] [default to 50] | +| **offset** | **int**| Index of the first document in the page | [optional] [default to 0] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | ### Return type -[**\Brevo\Client\Model\GetSmtpTemplates**](../Model/GetSmtpTemplates.md) +[**\Brevo\Client\Models\GetSmtpTemplates**](../Model/GetSmtpTemplates.md) ### Authorization @@ -890,42 +929,51 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `getTransacBlockedContacts()` -# **getTransacBlockedContacts** -> \Brevo\Client\Model\GetTransacBlockedContacts getTransacBlockedContacts($startDate, $endDate, $limit, $offset, $senders, $sort) +```php +getTransacBlockedContacts($startDate, $endDate, $limit, $offset, $senders, $sort): \Brevo\Client\Models\GetTransacBlockedContacts +``` Get the list of blocked or unsubscribed transactional contacts ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // 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 = "startDate_example"; // string | Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the blocked or unsubscribed contacts -$endDate = "endDate_example"; // string | Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the blocked or unsubscribed contacts +$startDate = 'startDate_example'; // string | **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the blocked or unsubscribed contacts +$endDate = 'endDate_example'; // string | **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the blocked or unsubscribed contacts $limit = 50; // int | Number of documents returned per page $offset = 0; // int | Index of the first document on the page -$senders = array("senders_example"); // string[] | Comma separated list of emails of the senders from which contacts are blocked or unsubscribed -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed +$senders = array('senders_example'); // string[] | Comma separated list of emails of the senders from which contacts are blocked or unsubscribed +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed try { $result = $apiInstance->getTransacBlockedContacts($startDate, $endDate, $limit, $offset, $senders, $sort); @@ -933,23 +981,22 @@ try { } catch (Exception $e) { echo 'Exception when calling TransactionalEmailsApi->getTransacBlockedContacts: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **startDate** | **string**| Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the blocked or unsubscribed contacts | [optional] - **endDate** | **string**| Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the blocked or unsubscribed contacts | [optional] - **limit** | **int**| Number of documents returned per page | [optional] [default to 50] - **offset** | **int**| Index of the first document on the page | [optional] [default to 0] - **senders** | [**string[]**](../Model/string.md)| Comma separated list of emails of the senders from which contacts are blocked or unsubscribed | [optional] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **startDate** | **string**| **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the blocked or unsubscribed contacts | [optional] | +| **endDate** | **string**| **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the blocked or unsubscribed contacts | [optional] | +| **limit** | **int**| Number of documents returned per page | [optional] [default to 50] | +| **offset** | **int**| Index of the first document on the page | [optional] [default to 0] | +| **senders** | [**string[]**](../Model/string.md)| Comma separated list of emails of the senders from which contacts are blocked or unsubscribed | [optional] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | ### Return type -[**\Brevo\Client\Model\GetTransacBlockedContacts**](../Model/GetTransacBlockedContacts.md) +[**\Brevo\Client\Models\GetTransacBlockedContacts**](../Model/GetTransacBlockedContacts.md) ### Authorization @@ -957,37 +1004,46 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `getTransacEmailContent()` -# **getTransacEmailContent** -> \Brevo\Client\Model\GetTransacEmailContent getTransacEmailContent($uuid) +```php +getTransacEmailContent($uuid): \Brevo\Client\Models\GetTransacEmailContent +``` Get the personalized content of a sent transactional email ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // 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 ); -$uuid = "uuid_example"; // string | Unique id of the transactional email that has been sent to a particular contact +$uuid = 'uuid_example'; // string | Unique id of the transactional email that has been sent to a particular contact try { $result = $apiInstance->getTransacEmailContent($uuid); @@ -995,18 +1051,17 @@ try { } catch (Exception $e) { echo 'Exception when calling TransactionalEmailsApi->getTransacEmailContent: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **uuid** | **string**| Unique id of the transactional email that has been sent to a particular contact | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **uuid** | **string**| Unique id of the transactional email that has been sent to a particular contact | | ### Return type -[**\Brevo\Client\Model\GetTransacEmailContent**](../Model/GetTransacEmailContent.md) +[**\Brevo\Client\Models\GetTransacEmailContent**](../Model/GetTransacEmailContent.md) ### Authorization @@ -1014,44 +1069,53 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `getTransacEmailsList()` -# **getTransacEmailsList** -> \Brevo\Client\Model\GetTransacEmailsList getTransacEmailsList($email, $templateId, $messageId, $startDate, $endDate, $sort, $limit, $offset) +```php +getTransacEmailsList($email, $templateId, $messageId, $startDate, $endDate, $sort, $limit, $offset): \Brevo\Client\Models\GetTransacEmailsList +``` Get the list of transactional emails on the basis of allowed filters This endpoint will show the list of emails for past 30 days by default. To retrieve emails before that time, please pass startDate and endDate in query filters. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // 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 | Mandatory if templateId and messageId are not passed in query filters. Email address to which transactional email has been sent. -$templateId = 789; // int | Mandatory if email and messageId are not passed in query filters. Id of the template that was used to compose transactional email. -$messageId = "messageId_example"; // string | Mandatory if templateId and email are not passed in query filters. Message ID of the transactional email sent. -$startDate = "startDate_example"; // string | Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Maximum time period that can be selected is one month. -$endDate = "endDate_example"; // string | Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed +$email = 'email_example'; // string | **Mandatory if templateId and messageId are not passed in query filters.** Email address to which transactional email has been sent. +$templateId = 56; // int | **Mandatory if email and messageId are not passed in query filters.** Id of the template that was used to compose transactional email. +$messageId = 'messageId_example'; // string | **Mandatory if templateId and email are not passed in query filters.** Message ID of the transactional email sent. +$startDate = 'startDate_example'; // string | **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the list. **Maximum time period that can be selected is one month**. +$endDate = 'endDate_example'; // string | **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the list. **Maximum time period that can be selected is one month.** +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed $limit = 500; // int | Number of documents returned per page $offset = 0; // int | Index of the first document in the page @@ -1061,25 +1125,24 @@ try { } catch (Exception $e) { echo 'Exception when calling TransactionalEmailsApi->getTransacEmailsList: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **email** | **string**| Mandatory if templateId and messageId are not passed in query filters. Email address to which transactional email has been sent. | [optional] - **templateId** | **int**| Mandatory if email and messageId are not passed in query filters. Id of the template that was used to compose transactional email. | [optional] - **messageId** | **string**| Mandatory if templateId and email are not passed in query filters. Message ID of the transactional email sent. | [optional] - **startDate** | **string**| Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Maximum time period that can be selected is one month. | [optional] - **endDate** | **string**| Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. | [optional] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] - **limit** | **int**| Number of documents returned per page | [optional] [default to 500] - **offset** | **int**| Index of the first document in the page | [optional] [default to 0] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email** | **string**| **Mandatory if templateId and messageId are not passed in query filters.** Email address to which transactional email has been sent. | [optional] | +| **templateId** | **int**| **Mandatory if email and messageId are not passed in query filters.** Id of the template that was used to compose transactional email. | [optional] | +| **messageId** | **string**| **Mandatory if templateId and email are not passed in query filters.** Message ID of the transactional email sent. | [optional] | +| **startDate** | **string**| **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the list. **Maximum time period that can be selected is one month**. | [optional] | +| **endDate** | **string**| **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the list. **Maximum time period that can be selected is one month.** | [optional] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | +| **limit** | **int**| Number of documents returned per page | [optional] [default to 500] | +| **offset** | **int**| Index of the first document in the page | [optional] [default to 0] | ### Return type -[**\Brevo\Client\Model\GetTransacEmailsList**](../Model/GetTransacEmailsList.md) +[**\Brevo\Client\Models\GetTransacEmailsList**](../Model/GetTransacEmailsList.md) ### Authorization @@ -1087,53 +1150,61 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `sendTestTemplate()` -# **sendTestTemplate** -> sendTestTemplate($templateId, $sendTestEmail) +```php +sendTestTemplate($templateId, $sendTestEmail) +``` Send a template to your test list ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // 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 \Brevo\Client\Model\SendTestEmail(); // \Brevo\Client\Model\SendTestEmail | +$templateId = 56; // int | Id of the template +$sendTestEmail = new \Brevo\Client\Models\SendTestEmail(); // \Brevo\Client\Models\SendTestEmail try { $apiInstance->sendTestTemplate($templateId, $sendTestEmail); } catch (Exception $e) { echo 'Exception when calling TransactionalEmailsApi->sendTestTemplate: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **templateId** | **int**| Id of the template | - **sendTestEmail** | [**\Brevo\Client\Model\SendTestEmail**](../Model/SendTestEmail.md)| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **templateId** | **int**| Id of the template | | +| **sendTestEmail** | [**\Brevo\Client\Models\SendTestEmail**](../Model/SendTestEmail.md)| | | ### Return type @@ -1145,37 +1216,46 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **sendTransacEmail** -> \Brevo\Client\Model\CreateSmtpEmail sendTransacEmail($sendSmtpEmail) +## `sendTransacEmail()` + +```php +sendTransacEmail($sendSmtpEmail): \Brevo\Client\Models\CreateSmtpEmail +``` Send a transactional email ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // 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 \Brevo\Client\Model\SendSmtpEmail(); // \Brevo\Client\Model\SendSmtpEmail | Values to send a transactional email +$sendSmtpEmail = new \Brevo\Client\Models\SendSmtpEmail(); // \Brevo\Client\Models\SendSmtpEmail | Values to send a transactional email try { $result = $apiInstance->sendTransacEmail($sendSmtpEmail); @@ -1183,18 +1263,17 @@ try { } catch (Exception $e) { echo 'Exception when calling TransactionalEmailsApi->sendTransacEmail: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **sendSmtpEmail** | [**\Brevo\Client\Model\SendSmtpEmail**](../Model/SendSmtpEmail.md)| Values to send a transactional email | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **sendSmtpEmail** | [**\Brevo\Client\Models\SendSmtpEmail**](../Model/SendSmtpEmail.md)| Values to send a transactional email | | ### Return type -[**\Brevo\Client\Model\CreateSmtpEmail**](../Model/CreateSmtpEmail.md) +[**\Brevo\Client\Models\CreateSmtpEmail**](../Model/CreateSmtpEmail.md) ### Authorization @@ -1202,51 +1281,59 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `smtpBlockedContactsEmailDelete()` -# **smtpBlockedContactsEmailDelete** -> smtpBlockedContactsEmailDelete($email) +```php +smtpBlockedContactsEmailDelete($email) +``` Unblock or resubscribe a transactional contact ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // 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 | contact email (urlencoded) to unblock. +$email = 'email_example'; // string | contact email (urlencoded) to unblock. try { $apiInstance->smtpBlockedContactsEmailDelete($email); } catch (Exception $e) { echo 'Exception when calling TransactionalEmailsApi->smtpBlockedContactsEmailDelete: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **email** | **string**| contact email (urlencoded) to unblock. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email** | **string**| contact email (urlencoded) to unblock. | | ### Return type @@ -1258,51 +1345,59 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `smtpLogIdentifierDelete()` -# **smtpLogIdentifierDelete** -> smtpLogIdentifierDelete($identifier) +```php +smtpLogIdentifierDelete($identifier) +``` Delete an SMTP transactional log ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // 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 ); -$identifier = "identifier_example"; // string | MessageId or Email of the transactional log(s) to delete +$identifier = 'identifier_example'; // string | MessageId or Email of the transactional log(s) to delete try { $apiInstance->smtpLogIdentifierDelete($identifier); } catch (Exception $e) { echo 'Exception when calling TransactionalEmailsApi->smtpLogIdentifierDelete: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **identifier** | **string**| MessageId or Email of the transactional log(s) to delete | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **identifier** | **string**| MessageId or Email of the transactional log(s) to delete | | ### Return type @@ -1314,53 +1409,61 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **updateSmtpTemplate** -> updateSmtpTemplate($templateId, $smtpTemplate) +## `updateSmtpTemplate()` + +```php +updateSmtpTemplate($templateId, $updateSmtpTemplate) +``` Update an email template ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // 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 \Brevo\Client\Model\UpdateSmtpTemplate(); // \Brevo\Client\Model\UpdateSmtpTemplate | values to update in transactional email template +$templateId = 56; // int | id of the template +$updateSmtpTemplate = new \Brevo\Client\Models\UpdateSmtpTemplate(); // \Brevo\Client\Models\UpdateSmtpTemplate | values to update in transactional email template try { - $apiInstance->updateSmtpTemplate($templateId, $smtpTemplate); + $apiInstance->updateSmtpTemplate($templateId, $updateSmtpTemplate); } catch (Exception $e) { echo 'Exception when calling TransactionalEmailsApi->updateSmtpTemplate: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **templateId** | **int**| id of the template | - **smtpTemplate** | [**\Brevo\Client\Model\UpdateSmtpTemplate**](../Model/UpdateSmtpTemplate.md)| values to update in transactional email template | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **templateId** | **int**| id of the template | | +| **updateSmtpTemplate** | [**\Brevo\Client\Models\UpdateSmtpTemplate**](../Model/UpdateSmtpTemplate.md)| values to update in transactional email template | | ### Return type @@ -1372,8 +1475,9 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: `application/json` +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/TransactionalSMSApi.md b/docs/Api/TransactionalSMSApi.md index 685d4ba..ecb3e14 100644 --- a/docs/Api/TransactionalSMSApi.md +++ b/docs/Api/TransactionalSMSApi.md @@ -1,34 +1,41 @@ # Brevo\Client\TransactionalSMSApi -All URIs are relative to *https://api.brevo.com/v3* +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**getSmsEvents**](TransactionalSMSApi.md#getSmsEvents) | **GET** /transactionalSMS/statistics/events | Get all your SMS activity (unaggregated events) -[**getTransacAggregatedSmsReport**](TransactionalSMSApi.md#getTransacAggregatedSmsReport) | **GET** /transactionalSMS/statistics/aggregatedReport | Get your SMS activity aggregated over a period of time -[**getTransacSmsReport**](TransactionalSMSApi.md#getTransacSmsReport) | **GET** /transactionalSMS/statistics/reports | Get your SMS activity aggregated per day -[**sendTransacSms**](TransactionalSMSApi.md#sendTransacSms) | **POST** /transactionalSMS/sms | Send SMS message to a mobile number +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**getSmsEvents()**](TransactionalSMSApi.md#getSmsEvents) | **GET** /transactionalSMS/statistics/events | Get all your SMS activity (unaggregated events) | +| [**getTransacAggregatedSmsReport()**](TransactionalSMSApi.md#getTransacAggregatedSmsReport) | **GET** /transactionalSMS/statistics/aggregatedReport | Get your SMS activity aggregated over a period of time | +| [**getTransacSmsReport()**](TransactionalSMSApi.md#getTransacSmsReport) | **GET** /transactionalSMS/statistics/reports | Get your SMS activity aggregated per day | +| [**sendTransacSms()**](TransactionalSMSApi.md#sendTransacSms) | **POST** /transactionalSMS/sms | Send SMS message to a mobile number | -# **getSmsEvents** -> \Brevo\Client\Model\GetSmsEventReport getSmsEvents($limit, $startDate, $endDate, $offset, $days, $phoneNumber, $event, $tags, $sort) +## `getSmsEvents()` + +```php +getSmsEvents($limit, $startDate, $endDate, $offset, $days, $phoneNumber, $event, $tags, $sort): \Brevo\Client\Models\GetSmsEventReport +``` Get all your SMS activity (unaggregated events) ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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. @@ -36,14 +43,14 @@ $apiInstance = new Brevo\Client\Api\TransactionalSMSApi( $config ); $limit = 50; // int | Number of documents per page -$startDate = "startDate_example"; // string | Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report -$endDate = "endDate_example"; // string | Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report +$startDate = 'startDate_example'; // string | **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report +$endDate = 'endDate_example'; // string | **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report $offset = 0; // int | Index of the first document of the page -$days = 789; // int | Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' -$phoneNumber = "phoneNumber_example"; // string | Filter the report for a specific phone number -$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 -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed +$days = 56; // int | Number of days in the past including today (positive integer). **Not compatible with 'startDate' and 'endDate'** +$phoneNumber = 'phoneNumber_example'; // string | Filter the report for a specific phone number +$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 +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed try { $result = $apiInstance->getSmsEvents($limit, $startDate, $endDate, $offset, $days, $phoneNumber, $event, $tags, $sort); @@ -51,26 +58,25 @@ try { } catch (Exception $e) { echo 'Exception when calling TransactionalSMSApi->getSmsEvents: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **limit** | **int**| Number of documents per page | [optional] [default to 50] - **startDate** | **string**| Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report | [optional] - **endDate** | **string**| Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report | [optional] - **offset** | **int**| Index of the first document of the page | [optional] [default to 0] - **days** | **int**| Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' | [optional] - **phoneNumber** | **string**| Filter the report for a specific phone number | [optional] - **event** | **string**| Filter the report for specific events | [optional] - **tags** | **string**| Filter the report for specific tags passed as a serialized urlencoded array | [optional] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Number of documents per page | [optional] [default to 50] | +| **startDate** | **string**| **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report | [optional] | +| **endDate** | **string**| **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report | [optional] | +| **offset** | **int**| Index of the first document of the page | [optional] [default to 0] | +| **days** | **int**| Number of days in the past including today (positive integer). **Not compatible with 'startDate' and 'endDate'** | [optional] | +| **phoneNumber** | **string**| Filter the report for a specific phone number | [optional] | +| **event** | **string**| Filter the report for specific events | [optional] | +| **tags** | **string**| Filter the report for specific tags passed as a serialized urlencoded array | [optional] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | ### Return type -[**\Brevo\Client\Model\GetSmsEventReport**](../Model/GetSmsEventReport.md) +[**\Brevo\Client\Models\GetSmsEventReport**](../Model/GetSmsEventReport.md) ### Authorization @@ -78,40 +84,49 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getTransacAggregatedSmsReport** -> \Brevo\Client\Model\GetTransacAggregatedSmsReport getTransacAggregatedSmsReport($startDate, $endDate, $days, $tag) +## `getTransacAggregatedSmsReport()` + +```php +getTransacAggregatedSmsReport($startDate, $endDate, $days, $tag): \Brevo\Client\Models\GetTransacAggregatedSmsReport +``` Get your SMS activity aggregated over a period of time ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 = "startDate_example"; // string | Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report -$endDate = "endDate_example"; // string | Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report -$days = 789; // 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 +$startDate = 'startDate_example'; // string | **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report +$endDate = 'endDate_example'; // string | **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 = $apiInstance->getTransacAggregatedSmsReport($startDate, $endDate, $days, $tag); @@ -119,21 +134,20 @@ try { } catch (Exception $e) { echo 'Exception when calling TransactionalSMSApi->getTransacAggregatedSmsReport: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **startDate** | **string**| Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report | [optional] - **endDate** | **string**| Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report | [optional] - **days** | **int**| Number of days in the past including today (positive integer). Not compatible with startDate and endDate | [optional] - **tag** | **string**| Filter on a tag | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **startDate** | **string**| **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report | [optional] | +| **endDate** | **string**| **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report | [optional] | +| **days** | **int**| Number of days in the past including today (positive integer). **Not compatible with startDate and endDate** | [optional] | +| **tag** | **string**| Filter on a tag | [optional] | ### Return type -[**\Brevo\Client\Model\GetTransacAggregatedSmsReport**](../Model/GetTransacAggregatedSmsReport.md) +[**\Brevo\Client\Models\GetTransacAggregatedSmsReport**](../Model/GetTransacAggregatedSmsReport.md) ### Authorization @@ -141,41 +155,50 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getTransacSmsReport** -> \Brevo\Client\Model\GetTransacSmsReport getTransacSmsReport($startDate, $endDate, $days, $tag, $sort) +## `getTransacSmsReport()` + +```php +getTransacSmsReport($startDate, $endDate, $days, $tag, $sort): \Brevo\Client\Models\GetTransacSmsReport +``` Get your SMS activity aggregated per day ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 = "startDate_example"; // string | Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report -$endDate = "endDate_example"; // string | Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report -$days = 789; // 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 -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed +$startDate = 'startDate_example'; // string | **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report +$endDate = 'endDate_example'; // string | **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 +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed try { $result = $apiInstance->getTransacSmsReport($startDate, $endDate, $days, $tag, $sort); @@ -183,22 +206,21 @@ try { } catch (Exception $e) { echo 'Exception when calling TransactionalSMSApi->getTransacSmsReport: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **startDate** | **string**| Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report | [optional] - **endDate** | **string**| Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report | [optional] - **days** | **int**| Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' | [optional] - **tag** | **string**| Filter on a tag | [optional] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **startDate** | **string**| **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report | [optional] | +| **endDate** | **string**| **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report | [optional] | +| **days** | **int**| Number of days in the past including today (positive integer). **Not compatible with 'startDate' and 'endDate'** | [optional] | +| **tag** | **string**| Filter on a tag | [optional] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | ### Return type -[**\Brevo\Client\Model\GetTransacSmsReport**](../Model/GetTransacSmsReport.md) +[**\Brevo\Client\Models\GetTransacSmsReport**](../Model/GetTransacSmsReport.md) ### Authorization @@ -206,37 +228,46 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `sendTransacSms()` -# **sendTransacSms** -> \Brevo\Client\Model\SendSms sendTransacSms($sendTransacSms) +```php +sendTransacSms($sendTransacSms): \Brevo\Client\Models\SendSms +``` Send SMS message to a mobile number ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\SendTransacSms(); // \Brevo\Client\Model\SendTransacSms | Values to send a transactional SMS +$sendTransacSms = new \Brevo\Client\Models\SendTransacSms(); // \Brevo\Client\Models\SendTransacSms | Values to send a transactional SMS try { $result = $apiInstance->sendTransacSms($sendTransacSms); @@ -244,18 +275,17 @@ try { } catch (Exception $e) { echo 'Exception when calling TransactionalSMSApi->sendTransacSms: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **sendTransacSms** | [**\Brevo\Client\Model\SendTransacSms**](../Model/SendTransacSms.md)| Values to send a transactional SMS | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **sendTransacSms** | [**\Brevo\Client\Models\SendTransacSms**](../Model/SendTransacSms.md)| Values to send a transactional SMS | | ### Return type -[**\Brevo\Client\Model\SendSms**](../Model/SendSms.md) +[**\Brevo\Client\Models\SendSms**](../Model/SendSms.md) ### Authorization @@ -263,8 +293,9 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: `application/json` +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/TransactionalWhatsAppApi.md b/docs/Api/TransactionalWhatsAppApi.md index e1641af..ee1854b 100644 --- a/docs/Api/TransactionalWhatsAppApi.md +++ b/docs/Api/TransactionalWhatsAppApi.md @@ -1,34 +1,41 @@ # Brevo\Client\TransactionalWhatsAppApi -All URIs are relative to *https://api.brevo.com/v3* +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**getWhatsappEventReport**](TransactionalWhatsAppApi.md#getWhatsappEventReport) | **GET** /whatsapp/statistics/events | Get all your WhatsApp activity (unaggregated events) -[**sendWhatsappMessage**](TransactionalWhatsAppApi.md#sendWhatsappMessage) | **POST** /whatsapp/sendMessage | Send a WhatsApp message +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**getWhatsappEventReport()**](TransactionalWhatsAppApi.md#getWhatsappEventReport) | **GET** /whatsapp/statistics/events | Get all your WhatsApp activity (unaggregated events) | +| [**sendWhatsappMessage()**](TransactionalWhatsAppApi.md#sendWhatsappMessage) | **POST** /whatsapp/sendMessage | Send a WhatsApp message | -# **getWhatsappEventReport** -> \Brevo\Client\Model\GetWhatsappEventReport getWhatsappEventReport($limit, $offset, $startDate, $endDate, $days, $contactNumber, $event, $sort) +## `getWhatsappEventReport()` + +```php +getWhatsappEventReport($limit, $offset, $startDate, $endDate, $days, $contactNumber, $event, $sort): \Brevo\Client\Models\GetWhatsappEventReport +``` Get all your WhatsApp activity (unaggregated events) This endpoint will show the unaggregated statistics for WhatsApp activity (30 days by default if `startDate` and `endDate` or `days` is not passed. The date range can not exceed 90 days) ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalWhatsAppApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. @@ -37,12 +44,12 @@ $apiInstance = new Brevo\Client\Api\TransactionalWhatsAppApi( ); $limit = 2500; // int | Number limitation for the result returned $offset = 0; // int | Beginning point in the list to retrieve from -$startDate = "startDate_example"; // string | **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate -$endDate = "endDate_example"; // string | **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate -$days = 789; // int | Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ -$contactNumber = "contactNumber_example"; // string | Filter results for specific contact (WhatsApp Number with country code. Example, 85264318721) -$event = "event_example"; // string | Filter the report for a specific event type -$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed +$startDate = 'startDate_example'; // string | **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate +$endDate = 'endDate_example'; // string | **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'_ +$contactNumber = 'contactNumber_example'; // string | Filter results for specific contact (WhatsApp Number with country code. Example, 85264318721) +$event = 'event_example'; // string | Filter the report for a specific event type +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed try { $result = $apiInstance->getWhatsappEventReport($limit, $offset, $startDate, $endDate, $days, $contactNumber, $event, $sort); @@ -50,25 +57,24 @@ try { } catch (Exception $e) { echo 'Exception when calling TransactionalWhatsAppApi->getWhatsappEventReport: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **limit** | **int**| Number limitation for the result returned | [optional] [default to 2500] - **offset** | **int**| Beginning point in the list to retrieve from | [optional] [default to 0] - **startDate** | **string**| **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate | [optional] - **endDate** | **string**| **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate | [optional] - **days** | **int**| Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ | [optional] - **contactNumber** | **string**| Filter results for specific contact (WhatsApp Number with country code. Example, 85264318721) | [optional] - **event** | **string**| Filter the report for a specific event type | [optional] - **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to desc] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Number limitation for the result returned | [optional] [default to 2500] | +| **offset** | **int**| Beginning point in the list to retrieve from | [optional] [default to 0] | +| **startDate** | **string**| **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate | [optional] | +| **endDate** | **string**| **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate | [optional] | +| **days** | **int**| Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ | [optional] | +| **contactNumber** | **string**| Filter results for specific contact (WhatsApp Number with country code. Example, 85264318721) | [optional] | +| **event** | **string**| Filter the report for a specific event type | [optional] | +| **sort** | **string**| Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | ### Return type -[**\Brevo\Client\Model\GetWhatsappEventReport**](../Model/GetWhatsappEventReport.md) +[**\Brevo\Client\Models\GetWhatsappEventReport**](../Model/GetWhatsappEventReport.md) ### Authorization @@ -76,58 +82,66 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **sendWhatsappMessage** -> \Brevo\Client\Model\InlineResponse2014 sendWhatsappMessage($sendWhatsappMessage) +## `sendWhatsappMessage()` + +```php +sendWhatsappMessage($sendWhatsappMessageRequest): \Brevo\Client\Models\SendWhatsappMessage201Response +``` Send a WhatsApp message This endpoint is used to send a WhatsApp message.
(**The first message you send using the API must contain a Template ID. You must create a template on WhatsApp on the Brevo platform to fetch the Template ID.**) ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\TransactionalWhatsAppApi( // 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 ); -$sendWhatsappMessage = new \Brevo\Client\Model\SendWhatsappMessage(); // \Brevo\Client\Model\SendWhatsappMessage | Values to send WhatsApp message +$sendWhatsappMessageRequest = new \Brevo\Client\Models\SendWhatsappMessageRequest(); // \Brevo\Client\Models\SendWhatsappMessageRequest | Values to send WhatsApp message try { - $result = $apiInstance->sendWhatsappMessage($sendWhatsappMessage); + $result = $apiInstance->sendWhatsappMessage($sendWhatsappMessageRequest); print_r($result); } catch (Exception $e) { echo 'Exception when calling TransactionalWhatsAppApi->sendWhatsappMessage: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **sendWhatsappMessage** | [**\Brevo\Client\Model\SendWhatsappMessage**](../Model/SendWhatsappMessage.md)| Values to send WhatsApp message | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **sendWhatsappMessageRequest** | [**\Brevo\Client\Models\SendWhatsappMessageRequest**](../Model/SendWhatsappMessageRequest.md)| Values to send WhatsApp message | | ### Return type -[**\Brevo\Client\Model\InlineResponse2014**](../Model/InlineResponse2014.md) +[**\Brevo\Client\Models\SendWhatsappMessage201Response**](../Model/SendWhatsappMessage201Response.md) ### Authorization @@ -135,8 +149,9 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: `application/json` +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/UserApi.md b/docs/Api/UserApi.md index 87f3900..5c3a94f 100644 --- a/docs/Api/UserApi.md +++ b/docs/Api/UserApi.md @@ -1,64 +1,70 @@ # Brevo\Client\UserApi -All URIs are relative to *https://api.brevo.com/v3* +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**editUserPermission**](UserApi.md#editUserPermission) | **POST** /organization/user/update/permissions | Update permission for a user -[**getInvitedUsersList**](UserApi.md#getInvitedUsersList) | **GET** /organization/invited/users | Get the list of all your users -[**getUserPermission**](UserApi.md#getUserPermission) | **GET** /organization/user/{email}/permissions | Check user permission -[**inviteuser**](UserApi.md#inviteuser) | **POST** /organization/user/invitation/send | Send invitation to user -[**putRevokeUserPermission**](UserApi.md#putRevokeUserPermission) | **PUT** /organization/user/invitation/revoke/{email} | Revoke user permission -[**putresendcancelinvitation**](UserApi.md#putresendcancelinvitation) | **PUT** /organization/user/invitation/{action}/{email} | Resend / Cancel invitation +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**editUserPermission()**](UserApi.md#editUserPermission) | **POST** /organization/user/update/permissions | Update permission for a user | +| [**getInvitedUsersList()**](UserApi.md#getInvitedUsersList) | **GET** /organization/invited/users | Get the list of all your users | +| [**getUserPermission()**](UserApi.md#getUserPermission) | **GET** /organization/user/{email}/permissions | Check user permission | +| [**inviteuser()**](UserApi.md#inviteuser) | **POST** /organization/user/invitation/send | Send invitation to user | +| [**putRevokeUserPermission()**](UserApi.md#putRevokeUserPermission) | **PUT** /organization/user/invitation/revoke/{email} | Revoke user permission | +| [**putresendcancelinvitation()**](UserApi.md#putresendcancelinvitation) | **PUT** /organization/user/invitation/{action}/{email} | Resend / Cancel invitation | -# **editUserPermission** -> \Brevo\Client\Model\Inviteuser editUserPermission($updatePermissions) +## `editUserPermission()` + +```php +editUserPermission($inviteuser): \Brevo\Client\Models\UpdateUserResponse +``` Update permission for a user -`Feature` - A Feature represents a specific functionality like Email campaign, Deals, Calls, Automations, etc. on Brevo. While inviting a user, determine which feature you want to manage access to. You must specify the feature accurately to avoid errors. `Permission` - A Permission defines the level of access or control a user has over a specific feature. While inviting user, decide on the permission level required for the selected feature. Make sure the chosen permission is related to the selected feature. Features and their respective permissions are as below: - `email_campaigns`: - \"create_edit_delete\" - \"send_schedule_suspend\" - `sms_campaigns`: - \"create_edit_delete\" - \"send_schedule_suspend\" - `contacts`: - \"view\" - \"send_schedule_suspend\" - \"import\" - \"export\" - \"list_and_attributes\" - \"forms\" - `templates`: - \"create_edit_delete\" - \"activate_deactivate\" - `workflows`: - \"create_edit_delete\" - \"activate_deactivate_pause\" - \"settings\" - `facebook_ads`: - \"create_edit_delete\" - \"schedule_pause\" - `landing_pages`: - \"all\" - `transactional_emails`: - \"settings\" - \"logs\" - `smtp_api`: - \"smtp\" - \"api_keys\" - \"authorized_ips\" - `user_management`: - \"all\" - `sales_platform`: - \"manage_owned_deals_tasks_companies\" - \"manage_others_deals_tasks_companies\" - \"reports\" - \"settings\" - `phone`: - \"all\" - `conversations`: - \"access\" - \"assign\" - \"configure\" - `senders_domains_dedicated_ips`: - \"senders_management\" - \"domains_management\" - \"dedicated_ips_management\" - `push_notifications`: - \"view\" - \"create_edit_delete\" - \"send\" - \"settings\" **Note**: - The privileges array remains the same as in the send invitation; the user simply needs to provide the permissions that need to be updated. - The availability of feature and its permission depends on your current plan. Please select the features and permissions accordingly. +`Feature` - A Feature represents a specific functionality like Email campaign, Deals, Calls, Automations, etc. on Brevo. While inviting a user, determine which feature you want to manage access to. You must specify the feature accurately to avoid errors. `Permission` - A Permission defines the level of access or control a user has over a specific feature. While inviting user, decide on the permission level required for the selected feature. Make sure the chosen permission is related to the selected feature. Features and their respective permissions are as below: - `email_campaigns`: - \"create_edit_delete\" - \"send_schedule_suspend\" - `sms_campaigns`: - \"create_edit_delete\" - \"send_schedule_suspend\" - `contacts`: - \"view\" - \"create_edit_delete\" - \"import\" - \"export\" - \"list_and_attributes\" - \"forms\" - `templates`: - \"create_edit_delete\" - \"activate_deactivate\" - `workflows`: - \"create_edit_delete\" - \"activate_deactivate_pause\" - \"settings\" - `facebook_ads`: - \"create_edit_delete\" - \"schedule_pause\" - `landing_pages`: - \"all\" - `transactional_emails`: - \"settings\" - \"logs\" - `smtp_api`: - \"smtp\" - \"api_keys\" - \"authorized_ips\" - `user_management`: - \"all\" - `sales_platform`: - \"create_edit_deals\" - \"delete_owned_deals\" - \"manage_others_deals_tasks\" - \"reports\" - \"settings\" - `phone`: - \"all\" - `conversations`: - \"access\" - \"assign\" - \"configure\" - `senders_domains_dedicated_ips`: - \"senders_management\" - \"domains_management\" - \"dedicated_ips_management\" - `push_notifications`: - \"view\" - \"create_edit_delete\" - \"send\" - \"settings\" - `companies`: - \"manage_owned_companies\" - \"manage_other_companies\" - \"settings\" **Note**: - The privileges array remains the same as in the send invitation; the user simply needs to provide the permissions that need to be updated. - The availability of feature and its permission depends on your current plan. Please select the features and permissions accordingly. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\UserApi( // 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 ); -$updatePermissions = new \Brevo\Client\Model\Inviteuser(); // \Brevo\Client\Model\Inviteuser | Values to update permissions for an invited user +$inviteuser = new \Brevo\Client\Models\Inviteuser(); // \Brevo\Client\Models\Inviteuser | Values to create an invitation try { - $result = $apiInstance->editUserPermission($updatePermissions); + $result = $apiInstance->editUserPermission($inviteuser); print_r($result); } catch (Exception $e) { echo 'Exception when calling UserApi->editUserPermission: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **updatePermissions** | [**\Brevo\Client\Model\Inviteuser**](../Model/Inviteuser.md)| Values to update permissions for an invited user | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inviteuser** | [**\Brevo\Client\Models\Inviteuser**](../Model/Inviteuser.md)| Values to create an invitation | | ### Return type -[**\Brevo\Client\Model\Inviteuser**](../Model/Inviteuser.md) +[**\Brevo\Client\Models\UpdateUserResponse**](../Model/UpdateUserResponse.md) ### Authorization @@ -66,30 +72,39 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getInvitedUsersList** -> \Brevo\Client\Model\GetInvitedUsersList getInvitedUsersList() +## `getInvitedUsersList()` + +```php +getInvitedUsersList(): \Brevo\Client\Models\GetInvitedUsersList +``` Get the list of all your users ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\UserApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. @@ -103,15 +118,15 @@ try { } catch (Exception $e) { echo 'Exception when calling UserApi->getInvitedUsersList: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters + This endpoint does not need any parameter. ### Return type -[**\Brevo\Client\Model\GetInvitedUsersList**](../Model/GetInvitedUsersList.md) +[**\Brevo\Client\Models\GetInvitedUsersList**](../Model/GetInvitedUsersList.md) ### Authorization @@ -119,37 +134,46 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getUserPermission** -> \Brevo\Client\Model\GetUserPermission getUserPermission($email) +## `getUserPermission()` + +```php +getUserPermission($email): \Brevo\Client\Models\GetUserPermission +``` Check user permission ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\UserApi( // 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 of the invited user. +$email = 'email_example'; // string | Email of the invited user. try { $result = $apiInstance->getUserPermission($email); @@ -157,18 +181,17 @@ try { } catch (Exception $e) { echo 'Exception when calling UserApi->getUserPermission: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **email** | **string**| Email of the invited user. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email** | **string**| Email of the invited user. | | ### Return type -[**\Brevo\Client\Model\GetUserPermission**](../Model/GetUserPermission.md) +[**\Brevo\Client\Models\GetUserPermission**](../Model/GetUserPermission.md) ### Authorization @@ -176,58 +199,66 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **inviteuser** -> \Brevo\Client\Model\Inviteuser inviteuser($sendInvitation) +## `inviteuser()` + +```php +inviteuser($inviteuser): \Brevo\Client\Models\InviteuserResponse +``` Send invitation to user -`Feature` - A Feature represents a specific functionality like Email campaign, Deals, Calls, Automations, etc. on Brevo. While inviting a user, determine which feature you want to manage access to. You must specify the feature accurately to avoid errors. `Permission` - A Permission defines the level of access or control a user has over a specific feature. While inviting user, decide on the permission level required for the selected feature. Make sure the chosen permission is related to the selected feature. Features and their respective permissions are as below: - `email_campaigns`: - \"create_edit_delete\" - \"send_schedule_suspend\" - `sms_campaigns`: - \"create_edit_delete\" - \"send_schedule_suspend\" - `contacts`: - \"view\" - \"send_schedule_suspend\" - \"import\" - \"export\" - \"list_and_attributes\" - \"forms\" - `templates`: - \"create_edit_delete\" - \"activate_deactivate\" - `workflows`: - \"create_edit_delete\" - \"activate_deactivate_pause\" - \"settings\" - `facebook_ads`: - \"create_edit_delete\" - \"schedule_pause\" - `landing_pages`: - \"all\" - `transactional_emails`: - \"settings\" - \"logs\" - `smtp_api`: - \"smtp\" - \"api_keys\" - \"authorized_ips\" - `user_management`: - \"all\" - `sales_platform`: - \"manage_owned_deals_tasks_companies\" - \"manage_others_deals_tasks_companies\" - \"reports\" - \"settings\" - `phone`: - \"all\" - `conversations`: - \"access\" - \"assign\" - \"configure\" - `senders_domains_dedicated_ips`: - \"senders_management\" - \"domains_management\" - \"dedicated_ips_management\" - `push_notifications`: - \"view\" - \"create_edit_delete\" - \"send\" - \"settings\" **Note**: - If `all_features_access: false` then only privileges are required otherwise if `true` then it's assumed that all permissions will be there for the invited user. - The availability of feature and its permission depends on your current plan. Please select the features and permissions accordingly. +`Feature` - A Feature represents a specific functionality like Email campaign, Deals, Calls, Automations, etc. on Brevo. While inviting a user, determine which feature you want to manage access to. You must specify the feature accurately to avoid errors. `Permission` - A Permission defines the level of access or control a user has over a specific feature. While inviting user, decide on the permission level required for the selected feature. Make sure the chosen permission is related to the selected feature. Features and their respective permissions are as below: - `email_campaigns`: - \"create_edit_delete\" - \"send_schedule_suspend\" - `sms_campaigns`: - \"create_edit_delete\" - \"send_schedule_suspend\" - `contacts`: - \"view\" - \"create_edit_delete\" - \"import\" - \"export\" - \"list_and_attributes\" - \"forms\" - `templates`: - \"create_edit_delete\" - \"activate_deactivate\" - `workflows`: - \"create_edit_delete\" - \"activate_deactivate_pause\" - \"settings\" - `facebook_ads`: - \"create_edit_delete\" - \"schedule_pause\" - `landing_pages`: - \"all\" - `transactional_emails`: - \"settings\" - \"logs\" - `smtp_api`: - \"smtp\" - \"api_keys\" - \"authorized_ips\" - `user_management`: - \"all\" - `sales_platform`: - \"create_edit_deals\" - \"delete_owned_deals\" - \"manage_others_deals_tasks\" - \"reports\" - \"settings\" - `phone`: - \"all\" - `conversations`: - \"access\" - \"assign\" - \"configure\" - `senders_domains_dedicated_ips`: - \"senders_management\" - \"domains_management\" - \"dedicated_ips_management\" - `push_notifications`: - \"view\" - \"create_edit_delete\" - \"send\" - \"settings\" - `companies`: - \"manage_owned_companies\" - \"manage_other_companies\" - \"settings\" **Note**: - If `all_features_access: false` then only privileges are required otherwise if `true` then it's assumed that all permissions will be there for the invited user. - The availability of feature and its permission depends on your current plan. Please select the features and permissions accordingly. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\UserApi( // 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 ); -$sendInvitation = new \Brevo\Client\Model\Inviteuser(); // \Brevo\Client\Model\Inviteuser | Values to create an invitation +$inviteuser = new \Brevo\Client\Models\Inviteuser(); // \Brevo\Client\Models\Inviteuser | Values to create an invitation try { - $result = $apiInstance->inviteuser($sendInvitation); + $result = $apiInstance->inviteuser($inviteuser); print_r($result); } catch (Exception $e) { echo 'Exception when calling UserApi->inviteuser: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **sendInvitation** | [**\Brevo\Client\Model\Inviteuser**](../Model/Inviteuser.md)| Values to create an invitation | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inviteuser** | [**\Brevo\Client\Models\Inviteuser**](../Model/Inviteuser.md)| Values to create an invitation | | ### Return type -[**\Brevo\Client\Model\Inviteuser**](../Model/Inviteuser.md) +[**\Brevo\Client\Models\InviteuserResponse**](../Model/InviteuserResponse.md) ### Authorization @@ -235,37 +266,46 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **putRevokeUserPermission** -> \Brevo\Client\Model\PutRevokeUserPermission putRevokeUserPermission($email) +## `putRevokeUserPermission()` + +```php +putRevokeUserPermission($email): \Brevo\Client\Models\PutRevokeUserPermissionResponse +``` Revoke user permission ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\UserApi( // 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 of the invited user. +$email = 'email_example'; // string | Email of the invited user. try { $result = $apiInstance->putRevokeUserPermission($email); @@ -273,18 +313,17 @@ try { } catch (Exception $e) { echo 'Exception when calling UserApi->putRevokeUserPermission: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **email** | **string**| Email of the invited user. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email** | **string**| Email of the invited user. | | ### Return type -[**\Brevo\Client\Model\PutRevokeUserPermission**](../Model/PutRevokeUserPermission.md) +[**\Brevo\Client\Models\PutRevokeUserPermissionResponse**](../Model/PutRevokeUserPermissionResponse.md) ### Authorization @@ -292,38 +331,47 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **putresendcancelinvitation** -> \Brevo\Client\Model\Putresendcancelinvitation putresendcancelinvitation($action, $email) +## `putresendcancelinvitation()` + +```php +putresendcancelinvitation($action, $email): \Brevo\Client\Models\PutresendcancelinvitationResponse +``` Resend / Cancel invitation ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\UserApi( // 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 ); -$action = "action_example"; // string | action -$email = "email_example"; // string | Email of the invited user. +$action = 'action_example'; // string | action +$email = 'email_example'; // string | Email of the invited user. try { $result = $apiInstance->putresendcancelinvitation($action, $email); @@ -331,19 +379,18 @@ try { } catch (Exception $e) { echo 'Exception when calling UserApi->putresendcancelinvitation: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **action** | **string**| action | - **email** | **string**| Email of the invited user. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **action** | **string**| action | | +| **email** | **string**| Email of the invited user. | | ### Return type -[**\Brevo\Client\Model\Putresendcancelinvitation**](../Model/Putresendcancelinvitation.md) +[**\Brevo\Client\Models\PutresendcancelinvitationResponse**](../Model/PutresendcancelinvitationResponse.md) ### Authorization @@ -351,8 +398,9 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: Not defined +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/WebhooksApi.md b/docs/Api/WebhooksApi.md index 9dca158..ebfd98f 100644 --- a/docs/Api/WebhooksApi.md +++ b/docs/Api/WebhooksApi.md @@ -1,43 +1,50 @@ # Brevo\Client\WebhooksApi -All URIs are relative to *https://api.brevo.com/v3* +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createWebhook**](WebhooksApi.md#createWebhook) | **POST** /webhooks | Create a webhook -[**deleteWebhook**](WebhooksApi.md#deleteWebhook) | **DELETE** /webhooks/{webhookId} | Delete a webhook -[**exportWebhooksHistory**](WebhooksApi.md#exportWebhooksHistory) | **POST** /webhooks/export | Export all webhook events -[**getWebhook**](WebhooksApi.md#getWebhook) | **GET** /webhooks/{webhookId} | Get a webhook details -[**getWebhooks**](WebhooksApi.md#getWebhooks) | **GET** /webhooks | Get all webhooks -[**updateWebhook**](WebhooksApi.md#updateWebhook) | **PUT** /webhooks/{webhookId} | Update a webhook +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createWebhook()**](WebhooksApi.md#createWebhook) | **POST** /webhooks | Create a webhook | +| [**deleteWebhook()**](WebhooksApi.md#deleteWebhook) | **DELETE** /webhooks/{webhookId} | Delete a webhook | +| [**exportWebhooksHistory()**](WebhooksApi.md#exportWebhooksHistory) | **POST** /webhooks/export | Export all webhook events | +| [**getWebhook()**](WebhooksApi.md#getWebhook) | **GET** /webhooks/{webhookId} | Get a webhook details | +| [**getWebhooks()**](WebhooksApi.md#getWebhooks) | **GET** /webhooks | Get all webhooks | +| [**updateWebhook()**](WebhooksApi.md#updateWebhook) | **PUT** /webhooks/{webhookId} | Update a webhook | -# **createWebhook** -> \Brevo\Client\Model\CreateModel createWebhook($createWebhook) +## `createWebhook()` + +```php +createWebhook($createWebhook): \Brevo\Client\Models\CreateModel +``` Create a webhook ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\CreateWebhook(); // \Brevo\Client\Model\CreateWebhook | Values to create a webhook +$createWebhook = new \Brevo\Client\Models\CreateWebhook(); // \Brevo\Client\Models\CreateWebhook | Values to create a webhook try { $result = $apiInstance->createWebhook($createWebhook); @@ -45,18 +52,17 @@ try { } catch (Exception $e) { echo 'Exception when calling WebhooksApi->createWebhook: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **createWebhook** | [**\Brevo\Client\Model\CreateWebhook**](../Model/CreateWebhook.md)| Values to create a webhook | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **createWebhook** | [**\Brevo\Client\Models\CreateWebhook**](../Model/CreateWebhook.md)| Values to create a webhook | | ### Return type -[**\Brevo\Client\Model\CreateModel**](../Model/CreateModel.md) +[**\Brevo\Client\Models\CreateModel**](../Model/CreateModel.md) ### Authorization @@ -64,51 +70,59 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **deleteWebhook** -> deleteWebhook($webhookId) +## `deleteWebhook()` + +```php +deleteWebhook($webhookId) +``` Delete a webhook ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 +$webhookId = 56; // int | Id of the webhook try { $apiInstance->deleteWebhook($webhookId); } catch (Exception $e) { echo 'Exception when calling WebhooksApi->deleteWebhook: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **webhookId** | **int**| Id of the webhook | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **webhookId** | **int**| Id of the webhook | | ### Return type @@ -120,58 +134,66 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **exportWebhooksHistory** -> \Brevo\Client\Model\CreatedProcessId exportWebhooksHistory($exportWebhookHistory) +## `exportWebhooksHistory()` + +```php +exportWebhooksHistory($exportWebhooksHistoryRequest): \Brevo\Client\Models\CreatedProcessId +``` Export all webhook events This endpoint will submit a request to get the history of webhooks in the CSV file. The link to download the CSV file will be sent to the webhook that was provided in the notifyURL. ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 ); -$exportWebhookHistory = new \Brevo\Client\Model\ExportWebhooksHistory(); // \Brevo\Client\Model\ExportWebhooksHistory | Values to submit for webhooks history +$exportWebhooksHistoryRequest = new \Brevo\Client\Models\ExportWebhooksHistoryRequest(); // \Brevo\Client\Models\ExportWebhooksHistoryRequest | Values to submit for webhooks history try { - $result = $apiInstance->exportWebhooksHistory($exportWebhookHistory); + $result = $apiInstance->exportWebhooksHistory($exportWebhooksHistoryRequest); print_r($result); } catch (Exception $e) { echo 'Exception when calling WebhooksApi->exportWebhooksHistory: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **exportWebhookHistory** | [**\Brevo\Client\Model\ExportWebhooksHistory**](../Model/ExportWebhooksHistory.md)| Values to submit for webhooks history | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **exportWebhooksHistoryRequest** | [**\Brevo\Client\Models\ExportWebhooksHistoryRequest**](../Model/ExportWebhooksHistoryRequest.md)| Values to submit for webhooks history | | ### Return type -[**\Brevo\Client\Model\CreatedProcessId**](../Model/CreatedProcessId.md) +[**\Brevo\Client\Models\CreatedProcessId**](../Model/CreatedProcessId.md) ### Authorization @@ -179,37 +201,46 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getWebhook** -> \Brevo\Client\Model\GetWebhook getWebhook($webhookId) +## `getWebhook()` + +```php +getWebhook($webhookId): \Brevo\Client\Models\GetWebhook +``` Get a webhook details ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 +$webhookId = 56; // int | Id of the webhook try { $result = $apiInstance->getWebhook($webhookId); @@ -217,18 +248,17 @@ try { } catch (Exception $e) { echo 'Exception when calling WebhooksApi->getWebhook: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **webhookId** | **int**| Id of the webhook | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **webhookId** | **int**| Id of the webhook | | ### Return type -[**\Brevo\Client\Model\GetWebhook**](../Model/GetWebhook.md) +[**\Brevo\Client\Models\GetWebhook**](../Model/GetWebhook.md) ### Authorization @@ -236,38 +266,47 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getWebhooks** -> \Brevo\Client\Model\GetWebhooks getWebhooks($type, $sort) +## `getWebhooks()` + +```php +getWebhooks($type, $sort): \Brevo\Client\Models\GetWebhooks +``` Get all webhooks ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 -$sort = "desc"; // string | Sort the results in the ascending/descending order of webhook creation +$type = 'transactional'; // string | Filter on webhook type +$sort = 'desc'; // string | Sort the results in the ascending/descending order of webhook creation try { $result = $apiInstance->getWebhooks($type, $sort); @@ -275,19 +314,18 @@ try { } catch (Exception $e) { echo 'Exception when calling WebhooksApi->getWebhooks: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **type** | **string**| Filter on webhook type | [optional] [default to transactional] - **sort** | **string**| Sort the results in the ascending/descending order of webhook creation | [optional] [default to desc] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **type** | **string**| Filter on webhook type | [optional] [default to 'transactional'] | +| **sort** | **string**| Sort the results in the ascending/descending order of webhook creation | [optional] [default to 'desc'] | ### Return type -[**\Brevo\Client\Model\GetWebhooks**](../Model/GetWebhooks.md) +[**\Brevo\Client\Models\GetWebhooks**](../Model/GetWebhooks.md) ### Authorization @@ -295,53 +333,61 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `updateWebhook()` -# **updateWebhook** -> updateWebhook($webhookId, $updateWebhook) +```php +updateWebhook($webhookId, $updateWebhook) +``` Update a webhook ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\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 \Brevo\Client\Model\UpdateWebhook(); // \Brevo\Client\Model\UpdateWebhook | Values to update a webhook +$webhookId = 56; // int | Id of the webhook +$updateWebhook = new \Brevo\Client\Models\UpdateWebhook(); // \Brevo\Client\Models\UpdateWebhook | Values to update a webhook try { $apiInstance->updateWebhook($webhookId, $updateWebhook); } catch (Exception $e) { echo 'Exception when calling WebhooksApi->updateWebhook: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **webhookId** | **int**| Id of the webhook | - **updateWebhook** | [**\Brevo\Client\Model\UpdateWebhook**](../Model/UpdateWebhook.md)| Values to update a webhook | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **webhookId** | **int**| Id of the webhook | | +| **updateWebhook** | [**\Brevo\Client\Models\UpdateWebhook**](../Model/UpdateWebhook.md)| Values to update a webhook | | ### Return type @@ -353,8 +399,9 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: `application/json` +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/WhatsAppCampaignsApi.md b/docs/Api/WhatsAppCampaignsApi.md index 32b4a15..75ff85a 100644 --- a/docs/Api/WhatsAppCampaignsApi.md +++ b/docs/Api/WhatsAppCampaignsApi.md @@ -1,65 +1,71 @@ # Brevo\Client\WhatsAppCampaignsApi -All URIs are relative to *https://api.brevo.com/v3* +All URIs are relative to https://api.brevo.com/v3, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createWhatsAppCampaign**](WhatsAppCampaignsApi.md#createWhatsAppCampaign) | **POST** /whatsappCampaigns | Create and Send a WhatsApp campaign -[**createWhatsAppTemplate**](WhatsAppCampaignsApi.md#createWhatsAppTemplate) | **POST** /whatsppCampaigns/template | Create a WhatsApp template -[**deleteWhatsAppCampaign**](WhatsAppCampaignsApi.md#deleteWhatsAppCampaign) | **DELETE** /whatsappCampaigns/{campaignId} | Delete a WhatsApp campaign -[**getWhatsAppCampaign**](WhatsAppCampaignsApi.md#getWhatsAppCampaign) | **GET** /whatsappCampaigns/{campaignId} | Get a WhatsApp campaign -[**getWhatsAppCampaigns**](WhatsAppCampaignsApi.md#getWhatsAppCampaigns) | **GET** /whatsappCampaigns | Return all your created WhatsApp campaigns -[**getWhatsAppConfig**](WhatsAppCampaignsApi.md#getWhatsAppConfig) | **GET** /whatsappCampaigns/config | Get your WhatsApp API account information -[**getWhatsAppTemplates**](WhatsAppCampaignsApi.md#getWhatsAppTemplates) | **GET** /whatsappCampaigns/template-list | Return all your created WhatsApp templates -[**sendWhatsAppTemplateApproval**](WhatsAppCampaignsApi.md#sendWhatsAppTemplateApproval) | **POST** /whatsappCampaigns/template/approval/{templateId} | Send your WhatsApp template for approval -[**updateWhatsAppCampaign**](WhatsAppCampaignsApi.md#updateWhatsAppCampaign) | **PUT** /whatsappCampaigns/{campaignId} | Update a WhatsApp campaign +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createWhatsAppCampaign()**](WhatsAppCampaignsApi.md#createWhatsAppCampaign) | **POST** /whatsappCampaigns | Create and Send a WhatsApp campaign | +| [**createWhatsAppTemplate()**](WhatsAppCampaignsApi.md#createWhatsAppTemplate) | **POST** /whatsappCampaigns/template | Create a WhatsApp template | +| [**deleteWhatsAppCampaign()**](WhatsAppCampaignsApi.md#deleteWhatsAppCampaign) | **DELETE** /whatsappCampaigns/{campaignId} | Delete a WhatsApp campaign | +| [**getWhatsAppCampaign()**](WhatsAppCampaignsApi.md#getWhatsAppCampaign) | **GET** /whatsappCampaigns/{campaignId} | Get a WhatsApp campaign | +| [**getWhatsAppCampaigns()**](WhatsAppCampaignsApi.md#getWhatsAppCampaigns) | **GET** /whatsappCampaigns | Return all your created WhatsApp campaigns | +| [**getWhatsAppConfig()**](WhatsAppCampaignsApi.md#getWhatsAppConfig) | **GET** /whatsappCampaigns/config | Get your WhatsApp API account information | +| [**getWhatsAppTemplates()**](WhatsAppCampaignsApi.md#getWhatsAppTemplates) | **GET** /whatsappCampaigns/template-list | Return all your created WhatsApp templates | +| [**sendWhatsAppTemplateApproval()**](WhatsAppCampaignsApi.md#sendWhatsAppTemplateApproval) | **POST** /whatsappCampaigns/template/approval/{templateId} | Send your WhatsApp template for approval | +| [**updateWhatsAppCampaign()**](WhatsAppCampaignsApi.md#updateWhatsAppCampaign) | **PUT** /whatsappCampaigns/{campaignId} | Update a WhatsApp campaign | -# **createWhatsAppCampaign** -> \Brevo\Client\Model\CreateModel createWhatsAppCampaign($whatsAppCampaigns) +## `createWhatsAppCampaign()` + +```php +createWhatsAppCampaign($createWhatsAppCampaign): \Brevo\Client\Models\CreateModel +``` Create and Send a WhatsApp campaign ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\WhatsAppCampaignsApi( // 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 ); -$whatsAppCampaigns = new \Brevo\Client\Model\CreateWhatsAppCampaign(); // \Brevo\Client\Model\CreateWhatsAppCampaign | Values to create a campaign +$createWhatsAppCampaign = new \Brevo\Client\Models\CreateWhatsAppCampaign(); // \Brevo\Client\Models\CreateWhatsAppCampaign | Values to create a WhatsApp Campaign try { - $result = $apiInstance->createWhatsAppCampaign($whatsAppCampaigns); + $result = $apiInstance->createWhatsAppCampaign($createWhatsAppCampaign); print_r($result); } catch (Exception $e) { echo 'Exception when calling WhatsAppCampaignsApi->createWhatsAppCampaign: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **whatsAppCampaigns** | [**\Brevo\Client\Model\CreateWhatsAppCampaign**](../Model/CreateWhatsAppCampaign.md)| Values to create a campaign | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **createWhatsAppCampaign** | [**\Brevo\Client\Models\CreateWhatsAppCampaign**](../Model/CreateWhatsAppCampaign.md)| Values to create a WhatsApp Campaign | | ### Return type -[**\Brevo\Client\Model\CreateModel**](../Model/CreateModel.md) +[**\Brevo\Client\Models\CreateModel**](../Model/CreateModel.md) ### Authorization @@ -67,56 +73,64 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **createWhatsAppTemplate** -> \Brevo\Client\Model\CreateModel createWhatsAppTemplate($whatsAppTemplates) +## `createWhatsAppTemplate()` + +```php +createWhatsAppTemplate($createWhatsAppTemplate): \Brevo\Client\Models\CreateModel +``` Create a WhatsApp template ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\WhatsAppCampaignsApi( // 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 ); -$whatsAppTemplates = new \Brevo\Client\Model\CreateWhatsAppTemplate(); // \Brevo\Client\Model\CreateWhatsAppTemplate | Values to create a template +$createWhatsAppTemplate = new \Brevo\Client\Models\CreateWhatsAppTemplate(); // \Brevo\Client\Models\CreateWhatsAppTemplate | Values to create a WhatsApp template try { - $result = $apiInstance->createWhatsAppTemplate($whatsAppTemplates); + $result = $apiInstance->createWhatsAppTemplate($createWhatsAppTemplate); print_r($result); } catch (Exception $e) { echo 'Exception when calling WhatsAppCampaignsApi->createWhatsAppTemplate: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **whatsAppTemplates** | [**\Brevo\Client\Model\CreateWhatsAppTemplate**](../Model/CreateWhatsAppTemplate.md)| Values to create a template | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **createWhatsAppTemplate** | [**\Brevo\Client\Models\CreateWhatsAppTemplate**](../Model/CreateWhatsAppTemplate.md)| Values to create a WhatsApp template | | ### Return type -[**\Brevo\Client\Model\CreateModel**](../Model/CreateModel.md) +[**\Brevo\Client\Models\CreateModel**](../Model/CreateModel.md) ### Authorization @@ -124,51 +138,59 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `deleteWhatsAppCampaign()` -# **deleteWhatsAppCampaign** -> deleteWhatsAppCampaign($campaignId) +```php +deleteWhatsAppCampaign($campaignId) +``` Delete a WhatsApp campaign ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\WhatsAppCampaignsApi( // 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 +$campaignId = 56; // int | id of the campaign try { $apiInstance->deleteWhatsAppCampaign($campaignId); } catch (Exception $e) { echo 'Exception when calling WhatsAppCampaignsApi->deleteWhatsAppCampaign: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **campaignId** | **int**| id of the campaign | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **int**| id of the campaign | | ### Return type @@ -180,37 +202,46 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getWhatsAppCampaign** -> \Brevo\Client\Model\GetWhatsappCampaignOverview getWhatsAppCampaign($campaignId) +## `getWhatsAppCampaign()` + +```php +getWhatsAppCampaign($campaignId): \Brevo\Client\Models\GetWhatsappCampaignOverview +``` Get a WhatsApp campaign ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\WhatsAppCampaignsApi( // 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 +$campaignId = 56; // int | Id of the campaign try { $result = $apiInstance->getWhatsAppCampaign($campaignId); @@ -218,18 +249,17 @@ try { } catch (Exception $e) { echo 'Exception when calling WhatsAppCampaignsApi->getWhatsAppCampaign: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **campaignId** | **int**| Id of the campaign | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **int**| Id of the campaign | | ### Return type -[**\Brevo\Client\Model\GetWhatsappCampaignOverview**](../Model/GetWhatsappCampaignOverview.md) +[**\Brevo\Client\Models\GetWhatsappCampaignOverview**](../Model/GetWhatsappCampaignOverview.md) ### Authorization @@ -237,41 +267,50 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `getWhatsAppCampaigns()` -# **getWhatsAppCampaigns** -> \Brevo\Client\Model\GetWhatsappCampaigns getWhatsAppCampaigns($startDate, $endDate, $limit, $offset, $sort) +```php +getWhatsAppCampaigns($startDate, $endDate, $limit, $offset, $sort): \Brevo\Client\Models\GetWhatsappCampaigns +``` Return all your created WhatsApp campaigns ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\WhatsAppCampaignsApi( // 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 = "startDate_example"; // string | **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the campaigns created. **Prefer to pass your timezone in date-time format for accurate result** -$endDate = "endDate_example"; // string | **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the campaigns created. **Prefer to pass your timezone in date-time format for accurate result** +$startDate = 'startDate_example'; // string | **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the WhatsApp campaigns created. **Prefer to pass your timezone in date-time format for accurate result** +$endDate = 'endDate_example'; // string | **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the WhatsApp campaigns created. **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 in the page -$sort = "desc"; // string | Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed try { $result = $apiInstance->getWhatsAppCampaigns($startDate, $endDate, $limit, $offset, $sort); @@ -279,22 +318,21 @@ try { } catch (Exception $e) { echo 'Exception when calling WhatsAppCampaignsApi->getWhatsAppCampaigns: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **startDate** | **string**| **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the campaigns created. **Prefer to pass your timezone in date-time format for accurate result** | [optional] - **endDate** | **string**| **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the campaigns created. **Prefer to pass your timezone in date-time format for accurate result** | [optional] - **limit** | **int**| Number of documents per page | [optional] [default to 50] - **offset** | **int**| Index of the first document in the page | [optional] [default to 0] - **sort** | **string**| Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed | [optional] [default to desc] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **startDate** | **string**| **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the WhatsApp campaigns created. **Prefer to pass your timezone in date-time format for accurate result** | [optional] | +| **endDate** | **string**| **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the WhatsApp campaigns created. **Prefer to pass your timezone in date-time format for accurate result** | [optional] | +| **limit** | **int**| Number of documents per page | [optional] [default to 50] | +| **offset** | **int**| Index of the first document in the page | [optional] [default to 0] | +| **sort** | **string**| Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | ### Return type -[**\Brevo\Client\Model\GetWhatsappCampaigns**](../Model/GetWhatsappCampaigns.md) +[**\Brevo\Client\Models\GetWhatsappCampaigns**](../Model/GetWhatsappCampaigns.md) ### Authorization @@ -302,30 +340,39 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getWhatsAppConfig** -> \Brevo\Client\Model\GetWhatsAppConfig getWhatsAppConfig() +## `getWhatsAppConfig()` + +```php +getWhatsAppConfig(): \Brevo\Client\Models\GetWhatsAppConfig +``` Get your WhatsApp API account information ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\WhatsAppCampaignsApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. @@ -339,15 +386,15 @@ try { } catch (Exception $e) { echo 'Exception when calling WhatsAppCampaignsApi->getWhatsAppConfig: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters + This endpoint does not need any parameter. ### Return type -[**\Brevo\Client\Model\GetWhatsAppConfig**](../Model/GetWhatsAppConfig.md) +[**\Brevo\Client\Models\GetWhatsAppConfig**](../Model/GetWhatsAppConfig.md) ### Authorization @@ -355,42 +402,51 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **getWhatsAppTemplates** -> \Brevo\Client\Model\GetWATemplates getWhatsAppTemplates($startDate, $endDate, $limit, $offset, $sort, $source) +## `getWhatsAppTemplates()` + +```php +getWhatsAppTemplates($startDate, $endDate, $limit, $offset, $sort, $source): \Brevo\Client\Models\GetWhatsappTemplates +``` Return all your created WhatsApp templates ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\WhatsAppCampaignsApi( // 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 = "startDate_example"; // string | **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** -$endDate = "endDate_example"; // string | **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** +$startDate = 'startDate_example'; // string | **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** +$endDate = 'endDate_example'; // string | **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **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 in the page -$sort = "desc"; // string | Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed -$source = "source_example"; // string | source of the template +$sort = 'desc'; // string | Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed +$source = 'source_example'; // string | source of the template try { $result = $apiInstance->getWhatsAppTemplates($startDate, $endDate, $limit, $offset, $sort, $source); @@ -398,23 +454,22 @@ try { } catch (Exception $e) { echo 'Exception when calling WhatsAppCampaignsApi->getWhatsAppTemplates: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **startDate** | **string**| **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** | [optional] - **endDate** | **string**| **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** | [optional] - **limit** | **int**| Number of documents per page | [optional] [default to 50] - **offset** | **int**| Index of the first document in the page | [optional] [default to 0] - **sort** | **string**| Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed | [optional] [default to desc] - **source** | **string**| source of the template | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **startDate** | **string**| **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** | [optional] | +| **endDate** | **string**| **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** | [optional] | +| **limit** | **int**| Number of documents per page | [optional] [default to 50] | +| **offset** | **int**| Index of the first document in the page | [optional] [default to 0] | +| **sort** | **string**| Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed | [optional] [default to 'desc'] | +| **source** | **string**| source of the template | [optional] | ### Return type -[**\Brevo\Client\Model\GetWATemplates**](../Model/GetWATemplates.md) +[**\Brevo\Client\Models\GetWhatsappTemplates**](../Model/GetWhatsappTemplates.md) ### Authorization @@ -422,51 +477,59 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +## `sendWhatsAppTemplateApproval()` -# **sendWhatsAppTemplateApproval** -> sendWhatsAppTemplateApproval($templateId) +```php +sendWhatsAppTemplateApproval($templateId) +``` Send your WhatsApp template for approval ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\WhatsAppCampaignsApi( // 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 campaign +$templateId = 56; // int | id of the template try { $apiInstance->sendWhatsAppTemplateApproval($templateId); } catch (Exception $e) { echo 'Exception when calling WhatsAppCampaignsApi->sendWhatsAppTemplateApproval: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **templateId** | **int**| id of the campaign | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **templateId** | **int**| id of the template | | ### Return type @@ -478,53 +541,61 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: `application/json` -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) -# **updateWhatsAppCampaign** -> updateWhatsAppCampaign($campaignId, $whatsAppCampaign) +## `updateWhatsAppCampaign()` + +```php +updateWhatsAppCampaign($campaignId, $updateWhatsAppCampaign) +``` Update a WhatsApp campaign ### Example + ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); + $apiInstance = new Brevo\Client\Api\WhatsAppCampaignsApi( // 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 -$whatsAppCampaign = new \Brevo\Client\Model\UpdateWhatsAppCampaign(); // \Brevo\Client\Model\UpdateWhatsAppCampaign | values to update WhatsApp Campaign +$campaignId = 56; // int | id of the campaign +$updateWhatsAppCampaign = new \Brevo\Client\Models\UpdateWhatsAppCampaign(); // \Brevo\Client\Models\UpdateWhatsAppCampaign | Values to update a WhatsApp Campaign try { - $apiInstance->updateWhatsAppCampaign($campaignId, $whatsAppCampaign); + $apiInstance->updateWhatsAppCampaign($campaignId, $updateWhatsAppCampaign); } catch (Exception $e) { echo 'Exception when calling WhatsAppCampaignsApi->updateWhatsAppCampaign: ', $e->getMessage(), PHP_EOL; } -?> ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **campaignId** | **int**| Id of the campaign | - **whatsAppCampaign** | [**\Brevo\Client\Model\UpdateWhatsAppCampaign**](../Model/UpdateWhatsAppCampaign.md)| values to update WhatsApp Campaign | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **int**| id of the campaign | | +| **updateWhatsAppCampaign** | [**\Brevo\Client\Models\UpdateWhatsAppCampaign**](../Model/UpdateWhatsAppCampaign.md)| Values to update a WhatsApp Campaign | | ### Return type @@ -536,8 +607,9 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +- **Content-Type**: `application/json` +- **Accept**: `application/json` +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Model/AbTestCampaignResult.md b/docs/Model/AbTestCampaignResult.md index b3c5ae9..eacad24 100644 --- a/docs/Model/AbTestCampaignResult.md +++ b/docs/Model/AbTestCampaignResult.md @@ -1,17 +1,16 @@ -# AbTestCampaignResult +# # AbTestCampaignResult ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**winningVersion** | **string** | Winning Campaign Info. pending = Campaign has been picked for sending and winning version is yet to be decided, tie = A tie happened between both the versions, notAvailable = Campaign has not yet been picked for sending. | [optional] -**winningCriteria** | **string** | Criteria choosen for winning version (Open/Click) | [optional] -**winningSubjectLine** | **string** | Subject Line of current winning version | [optional] -**openRate** | **string** | Open rate for current winning version | [optional] -**clickRate** | **string** | Click rate for current winning version | [optional] -**winningVersionRate** | **string** | Open/Click rate for the winner version | [optional] -**statistics** | [**\Brevo\Client\Model\AbTestCampaignResultStatistics**](AbTestCampaignResultStatistics.md) | | [optional] -**clickedLinks** | [**\Brevo\Client\Model\AbTestCampaignResultClickedLinks**](AbTestCampaignResultClickedLinks.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) - +**winningVersion** | **string** | Winning Campaign Info. pending = Campaign has been picked for sending and winning version is yet to be decided, tie = A tie happened between both the versions, notAvailable = Campaign has not yet been picked for sending. | [optional] +**winningCriteria** | **string** | Criteria choosen for winning version (Open/Click) | [optional] +**winningSubjectLine** | **string** | Subject Line of current winning version | [optional] +**openRate** | **string** | Open rate for current winning version | [optional] +**clickRate** | **string** | Click rate for current winning version | [optional] +**winningVersionRate** | **string** | Open/Click rate for the winner version | [optional] +**statistics** | [**\Brevo\Client\Models\AbTestCampaignResultStatistics**](AbTestCampaignResultStatistics.md) | | [optional] +**clickedLinks** | [**\Brevo\Client\Models\AbTestCampaignResultClickedLinks**](AbTestCampaignResultClickedLinks.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AbTestCampaignResultClickedLinks.md b/docs/Model/AbTestCampaignResultClickedLinks.md index 64a07a5..a87adbb 100644 --- a/docs/Model/AbTestCampaignResultClickedLinks.md +++ b/docs/Model/AbTestCampaignResultClickedLinks.md @@ -1,11 +1,10 @@ -# AbTestCampaignResultClickedLinks +# # AbTestCampaignResultClickedLinks ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**versionA** | [**\Brevo\Client\Model\AbTestVersionClicks**](AbTestVersionClicks.md) | | -**versionB** | [**\Brevo\Client\Model\AbTestVersionClicks**](AbTestVersionClicks.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) - +**versionA** | [**\Brevo\Client\Models\AbTestVersionClicksInner[]**](AbTestVersionClicksInner.md) | Information on clicked links for a particular version | +**versionB** | [**\Brevo\Client\Models\AbTestVersionClicksInner[]**](AbTestVersionClicksInner.md) | Information on clicked links for a particular version | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AbTestCampaignResultStatistics.md b/docs/Model/AbTestCampaignResultStatistics.md index 8a081d2..37d2f53 100644 --- a/docs/Model/AbTestCampaignResultStatistics.md +++ b/docs/Model/AbTestCampaignResultStatistics.md @@ -1,15 +1,14 @@ -# AbTestCampaignResultStatistics +# # AbTestCampaignResultStatistics ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**openers** | [**\Brevo\Client\Model\AbTestVersionStats**](AbTestVersionStats.md) | | -**clicks** | [**\Brevo\Client\Model\AbTestVersionStats**](AbTestVersionStats.md) | | -**unsubscribed** | [**\Brevo\Client\Model\AbTestVersionStats**](AbTestVersionStats.md) | | -**hardBounces** | [**\Brevo\Client\Model\AbTestVersionStats**](AbTestVersionStats.md) | | -**softBounces** | [**\Brevo\Client\Model\AbTestVersionStats**](AbTestVersionStats.md) | | -**complaints** | [**\Brevo\Client\Model\AbTestVersionStats**](AbTestVersionStats.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) - - +**openers** | [**\Brevo\Client\Models\AbTestVersionStats**](AbTestVersionStats.md) | | +**clicks** | [**\Brevo\Client\Models\AbTestVersionStats**](AbTestVersionStats.md) | | +**unsubscribed** | [**\Brevo\Client\Models\AbTestVersionStats**](AbTestVersionStats.md) | | +**hardBounces** | [**\Brevo\Client\Models\AbTestVersionStats**](AbTestVersionStats.md) | | +**softBounces** | [**\Brevo\Client\Models\AbTestVersionStats**](AbTestVersionStats.md) | | +**complaints** | [**\Brevo\Client\Models\AbTestVersionStats**](AbTestVersionStats.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AbTestVersionClicks.md b/docs/Model/AbTestVersionClicks.md deleted file mode 100644 index b178c69..0000000 --- a/docs/Model/AbTestVersionClicks.md +++ /dev/null @@ -1,9 +0,0 @@ -# AbTestVersionClicks - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/AbTestVersionClicksInner.md b/docs/Model/AbTestVersionClicksInner.md index e83fd39..b4c8784 100644 --- a/docs/Model/AbTestVersionClicksInner.md +++ b/docs/Model/AbTestVersionClicksInner.md @@ -1,12 +1,11 @@ -# AbTestVersionClicksInner +# # AbTestVersionClicksInner ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**link** | **string** | URL of the link | -**clicksCount** | **int** | Number of times a link is clicked | -**clickRate** | **string** | Percentage of clicks of link with respect to total clicks | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**link** | **string** | URL of the link | +**clicksCount** | **int** | Number of times a link is clicked | +**clickRate** | **string** | Percentage of clicks of link with respect to total clicks | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AbTestVersionStats.md b/docs/Model/AbTestVersionStats.md index 270d356..8eda7a3 100644 --- a/docs/Model/AbTestVersionStats.md +++ b/docs/Model/AbTestVersionStats.md @@ -1,11 +1,10 @@ -# AbTestVersionStats +# # AbTestVersionStats ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**versionA** | **string** | percentage of an event for version A | -**versionB** | **string** | percentage of an event for version B | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**versionA** | **string** | percentage of an event for version A | +**versionB** | **string** | percentage of an event for version B | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AddChildDomain.md b/docs/Model/AddChildDomain.md deleted file mode 100644 index 25d5a30..0000000 --- a/docs/Model/AddChildDomain.md +++ /dev/null @@ -1,10 +0,0 @@ -# AddChildDomain - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**domain** | **string** | Sender domain to add for a specific 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/AddContactToList.md b/docs/Model/AddContactToList.md deleted file mode 100644 index 8153336..0000000 --- a/docs/Model/AddContactToList.md +++ /dev/null @@ -1,11 +0,0 @@ -# AddContactToList - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**emails** | **string[]** | Mandatory if IDs are not passed, ignored otherwise. Emails to add to a list. You can pass a maximum of 150 emails for addition in one request. If you need to add the emails in bulk, please prefer /contacts/import api. | [optional] -**ids** | **int[]** | Mandatory if Emails are not passed, ignored otherwise. Emails to add to a list. You can pass a maximum of 150 emails for addition in one request. If you need to add the emails in bulk, please prefer /contacts/import api. | [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/AddContactToListByEmails.md b/docs/Model/AddContactToListByEmails.md new file mode 100644 index 0000000..0482f54 --- /dev/null +++ b/docs/Model/AddContactToListByEmails.md @@ -0,0 +1,9 @@ +# # AddContactToListByEmails + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**emails** | **string[]** | Emails to add to a list. You can pass a **maximum of 150 emails** for addition in one request. **_If you need to add the emails in bulk, please prefer /contacts/import api._** | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AddContactToListByExtIDs.md b/docs/Model/AddContactToListByExtIDs.md new file mode 100644 index 0000000..de08f1f --- /dev/null +++ b/docs/Model/AddContactToListByExtIDs.md @@ -0,0 +1,9 @@ +# # AddContactToListByExtIDs + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**extIds** | **string[]** | EXT_ID attributes to add to a list. You can pass a **maximum of 150 EXT_ID attributes** for addition in one request. **_If you need to add the emails in bulk, please prefer /contacts/import api._** | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AddContactToListByIDs.md b/docs/Model/AddContactToListByIDs.md new file mode 100644 index 0000000..70d36b6 --- /dev/null +++ b/docs/Model/AddContactToListByIDs.md @@ -0,0 +1,9 @@ +# # AddContactToListByIDs + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | **int[]** | IDs to add to a list. You can pass a **maximum of 150 IDs** for addition in one request. **_If you need to add the emails in bulk, please prefer /contacts/import api._** | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AddContactToListRequest.md b/docs/Model/AddContactToListRequest.md new file mode 100644 index 0000000..c3d6df2 --- /dev/null +++ b/docs/Model/AddContactToListRequest.md @@ -0,0 +1,11 @@ +# # AddContactToListRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**emails** | **string[]** | Emails to add to a list. You can pass a **maximum of 150 emails** for addition in one request. **_If you need to add the emails in bulk, please prefer /contacts/import api._** | [optional] +**ids** | **int[]** | IDs to add to a list. You can pass a **maximum of 150 IDs** for addition in one request. **_If you need to add the emails in bulk, please prefer /contacts/import api._** | [optional] +**extIds** | **string[]** | EXT_ID attributes to add to a list. You can pass a **maximum of 150 EXT_ID attributes** for addition in one request. **_If you need to add the emails in bulk, please prefer /contacts/import api._** | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AddCredits.md b/docs/Model/AddCredits.md deleted file mode 100644 index 81e3694..0000000 --- a/docs/Model/AddCredits.md +++ /dev/null @@ -1,11 +0,0 @@ -# AddCredits - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**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/AttributeRewardPayload.md b/docs/Model/AttributeRewardPayload.md new file mode 100644 index 0000000..d3e8c0b --- /dev/null +++ b/docs/Model/AttributeRewardPayload.md @@ -0,0 +1,11 @@ +# # AttributeRewardPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rewardId** | **string** | Reward id | +**contactId** | **float** | Contact to attribute the reward | [optional] +**loyaltySubscriptionId** | **string** | One of contactId or loyaltySubscriptionId is required | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AttributedRewardFailedConditionErrorResponse.md b/docs/Model/AttributedRewardFailedConditionErrorResponse.md new file mode 100644 index 0000000..ec57fd2 --- /dev/null +++ b/docs/Model/AttributedRewardFailedConditionErrorResponse.md @@ -0,0 +1,9 @@ +# # AttributedRewardFailedConditionErrorResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AuthenticateDomainModel.md b/docs/Model/AuthenticateDomainModel.md index fdebfed..517dbb3 100644 --- a/docs/Model/AuthenticateDomainModel.md +++ b/docs/Model/AuthenticateDomainModel.md @@ -1,11 +1,10 @@ -# AuthenticateDomainModel +# # AuthenticateDomainModel ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**domainName** | **string** | Domain | -**message** | **string** | Success message | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**domainName** | **string** | Domain | +**message** | **string** | Success message | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BadRequestPayload.md b/docs/Model/BadRequestPayload.md new file mode 100644 index 0000000..c7c7a04 --- /dev/null +++ b/docs/Model/BadRequestPayload.md @@ -0,0 +1,9 @@ +# # BadRequestPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | **string** | Readable message associated to the failure | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Balance.md b/docs/Model/Balance.md new file mode 100644 index 0000000..a384b26 --- /dev/null +++ b/docs/Model/Balance.md @@ -0,0 +1,11 @@ +# # Balance + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyaltyProgramId** | **string** | Loyalty program Id | [optional] +**contactId** | **int** | Contact Id associated with the balance | [optional] +**balances** | [**\Brevo\Client\Models\BalanceBalancesInner[]**](BalanceBalancesInner.md) | List of balances | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BalanceBalancesInner.md b/docs/Model/BalanceBalancesInner.md new file mode 100644 index 0000000..8470993 --- /dev/null +++ b/docs/Model/BalanceBalancesInner.md @@ -0,0 +1,10 @@ +# # BalanceBalancesInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**balanceDefinitionId** | **string** | Balance definition Id | [optional] +**value** | **float** | The monetary value corresponding to the current balance | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BalanceDefinition.md b/docs/Model/BalanceDefinition.md new file mode 100644 index 0000000..71bc412 --- /dev/null +++ b/docs/Model/BalanceDefinition.md @@ -0,0 +1,26 @@ +# # BalanceDefinition + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier for the balance definition. | [optional] +**name** | **string** | Name for the balance definition | [optional] +**description** | **string** | Description for the balance definition | [optional] +**meta** | **object** | Additional metadata related to the balance definition. | [optional] +**unit** | **string** | The unit for this balance definition | [optional] +**minAmount** | **float** | Minimum possible amount for balance | [optional] +**maxAmount** | **float** | Maximum possible amount for balance | [optional] +**maximumCreditAmountLimit** | **float** | Maximum credit amount limit per operation | [optional] +**maximumDebitAmountLimit** | **float** | Maximum debit amount limit per operation | [optional] +**balanceOptionAmountOvertakingStrategy** | **string** | Partial enables partial credit of balance if maximum balance limit is reaching. Strict enables rejection of transaction if it will breach the max credit amount limit. | [optional] +**balanceOptionCreditRounding** | **string** | | [optional] +**balanceOptionDebitRounding** | **string** | | [optional] +**balanceAvailabilityDurationValue** | **float** | Number of days/weeks/month/year for balance expiry | [optional] +**balanceAvailabilityDurationUnit** | **string** | Unit of time for the balance's availability (e.g., day/week/month/year). | [optional] +**balanceAvailabilityDurationModifier** | **string** | startOfPeriod depicts the balancy expiry on start of day/week/month/year. endOfPeriod depicts the balancy expiry on end of day/week/month/year | [optional] +**balanceExpirationDate** | **\DateTime** | Date when the balance expires and can no longer be used, in dd/mm format. The balance will be expired when this date appears next in the calendar and only one of balanceExpirationDate or balance availability fields can be used. | [optional] +**createdAt** | **\DateTime** | | [optional] +**updatedAt** | **\DateTime** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BalanceDefinitionIdDoesNotExist.md b/docs/Model/BalanceDefinitionIdDoesNotExist.md new file mode 100644 index 0000000..8f440f7 --- /dev/null +++ b/docs/Model/BalanceDefinitionIdDoesNotExist.md @@ -0,0 +1,9 @@ +# # BalanceDefinitionIdDoesNotExist + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | **string** | Provided balance definition id does not exist | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BalanceDefinitionPage.md b/docs/Model/BalanceDefinitionPage.md new file mode 100644 index 0000000..eac0497 --- /dev/null +++ b/docs/Model/BalanceDefinitionPage.md @@ -0,0 +1,9 @@ +# # BalanceDefinitionPage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**items** | [**\Brevo\Client\Models\BalanceDefinition[]**](BalanceDefinition.md) | Balance definition list | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BalanceLimit.md b/docs/Model/BalanceLimit.md new file mode 100644 index 0000000..b96ece7 --- /dev/null +++ b/docs/Model/BalanceLimit.md @@ -0,0 +1,13 @@ +# # BalanceLimit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**constraintType** | **string** | Select amount to define constraints on amount and transaction to define constraints on transaction | [optional] [default to 'amount'] +**transactionType** | **string** | Select debit to configure limit for debit transaction type. Select credit to configure limit for credit transaction type | [optional] [default to 'debit'] +**durationValue** | **int** | Number of days/weeks/month/year for balance limit | [optional] +**durationUnit** | **string** | Unit for the balance's availability | [optional] [default to 'day'] +**value** | **float** | The value or amount associated with the balance limit. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BalanceLimitPayload.md b/docs/Model/BalanceLimitPayload.md new file mode 100644 index 0000000..ad7907b --- /dev/null +++ b/docs/Model/BalanceLimitPayload.md @@ -0,0 +1,14 @@ +# # BalanceLimitPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier for the balance limit in UUID format. | [optional] +**transactionType** | **string** | | [optional] +**durationValue** | **int** | Number of days/weeks/month/year for balance expiry | [optional] +**durationUnit** | **string** | Unit of time for the balance's availability (e.g., day/week/month/year). | [optional] +**value** | **float** | The value or amount associated with the balance limit. | [optional] +**constraintType** | **string** | Defines the type of constraint imposed by the balance limit. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BalancePage.md b/docs/Model/BalancePage.md new file mode 100644 index 0000000..7669778 --- /dev/null +++ b/docs/Model/BalancePage.md @@ -0,0 +1,9 @@ +# # BalancePage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**balance** | [**\Brevo\Client\Models\Balance**](Balance.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BlockDomain.md b/docs/Model/BlockDomain.md index 4410eda..ebd9056 100644 --- a/docs/Model/BlockDomain.md +++ b/docs/Model/BlockDomain.md @@ -1,10 +1,9 @@ -# BlockDomain +# # BlockDomain ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**domain** | **string** | name of the domain to be blocked | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**domain** | **string** | name of the domain to be blocked | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Body10.md b/docs/Model/Body10.md deleted file mode 100644 index 5552229..0000000 --- a/docs/Model/Body10.md +++ /dev/null @@ -1,15 +0,0 @@ -# Body10 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**visitorId** | **string** | visitor’s ID received <a href=\"https://developers.brevo.com/docs/conversations-webhooks\">from a webhook</a> or generated by you to <a href=\"https://developers.brevo.com/docs/customize-the-widget#identifying-existing-users\">bind existing user account to Conversations</a> | -**text** | **string** | message text | -**agentId** | **string** | agent ID. It can be found on agent’s page or received <a href=\"https://developers.brevo.com/docs/conversations-webhooks\">from a webhook</a>. Alternatively, you can use `agentEmail` + `agentName` + `receivedFrom` instead (all 3 fields required). | [optional] -**receivedFrom** | **string** | mark your messages to distinguish messages created by you from the others. | [optional] -**agentEmail** | **string** | agent email. When sending messages from a standalone system, it’s hard to maintain a 1-to-1 relationship between the users of both systems. In this case, an agent can be specified by their email address. | [optional] -**agentName** | **string** | agent name | [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/Body11.md b/docs/Model/Body11.md deleted file mode 100644 index e74265d..0000000 --- a/docs/Model/Body11.md +++ /dev/null @@ -1,10 +0,0 @@ -# Body11 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**text** | **string** | edited message text | - -[[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/Body12.md b/docs/Model/Body12.md deleted file mode 100644 index 6ca690c..0000000 --- a/docs/Model/Body12.md +++ /dev/null @@ -1,13 +0,0 @@ -# Body12 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**visitorId** | **string** | visitor’s ID received <a href=\"https://developers.brevo.com/docs/conversations-webhooks\">from a webhook</a> or generated by you to <a href=\"https://developers.brevo.com/docs/customize-the-widget#identifying-existing-users\">bind existing user account to Conversations</a> | -**text** | **string** | message text | -**agentId** | **string** | agent ID. It can be found on agent’s page or received <a href=\"https://developers.brevo.com/docs/conversations-webhooks\">from a webhook</a>. Optional if `groupId` is set. | [optional] -**groupId** | **string** | group ID. It can be found on group’s page. Optional if `agentId` is set. | [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/Body13.md b/docs/Model/Body13.md deleted file mode 100644 index c317817..0000000 --- a/docs/Model/Body13.md +++ /dev/null @@ -1,10 +0,0 @@ -# Body13 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**text** | **string** | edited message text | - -[[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/Body14.md b/docs/Model/Body14.md deleted file mode 100644 index 00d11af..0000000 --- a/docs/Model/Body14.md +++ /dev/null @@ -1,13 +0,0 @@ -# Body14 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**agentId** | **string** | agent ID. It can be found on agent’s page or received <a href=\"https://developers.brevo.com/docs/conversations-webhooks\">from a webhook</a>. Alternatively, you can use `agentEmail` + `agentName` + `receivedFrom` instead (all 3 fields required). | [optional] -**receivedFrom** | **string** | mark your messages to distinguish messages created by you from the others. | [optional] -**agentEmail** | **string** | agent email. When sending online pings from a standalone system, it’s hard to maintain a 1-to-1 relationship between the users of both systems. In this case, an agent can be specified by their email address. If there’s no agent with the specified email address in your Brevo organization, a dummy agent will be created automatically. | [optional] -**agentName** | **string** | agent name. | [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/Body2.md b/docs/Model/Body2.md deleted file mode 100644 index 49657a1..0000000 --- a/docs/Model/Body2.md +++ /dev/null @@ -1,12 +0,0 @@ -# Body2 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **string** | Name of company | -**attributes** | **object** | Attributes for company creation | [optional] -**countryCode** | **int** | Country code if phone_number is passed in attributes. | [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/Body3.md b/docs/Model/Body3.md deleted file mode 100644 index 66ca62b..0000000 --- a/docs/Model/Body3.md +++ /dev/null @@ -1,12 +0,0 @@ -# Body3 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **string** | Name of company | [optional] -**attributes** | **object** | Attributes for company update | [optional] -**countryCode** | **int** | Country code if phone_number is passed in attributes. | [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/Body4.md b/docs/Model/Body4.md deleted file mode 100644 index 5229618..0000000 --- a/docs/Model/Body4.md +++ /dev/null @@ -1,13 +0,0 @@ -# Body4 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**linkContactIds** | **int[]** | Contact ids for contacts to be linked with company | [optional] -**unlinkContactIds** | **int[]** | Contact ids for contacts to be unlinked from company | [optional] -**linkDealsIds** | **string[]** | Deals ids for deals to be linked with company | [optional] -**unlinkDealsIds** | **string[]** | Deals ids for deals to be unlinked from company | [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/Body5.md b/docs/Model/Body5.md deleted file mode 100644 index 12bb233..0000000 --- a/docs/Model/Body5.md +++ /dev/null @@ -1,11 +0,0 @@ -# Body5 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **string** | Name of deal | -**attributes** | **object** | Attributes for deal creation If you want to create a deal on a specific pipeline and stage you can use the following attributes `pipeline` and `deal_stage`. Pipeline and deal_stage are ids you can fetch using this endpoint `/crm/pipeline/details/{pipelineID}` | [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/Body6.md b/docs/Model/Body6.md deleted file mode 100644 index b9e9d14..0000000 --- a/docs/Model/Body6.md +++ /dev/null @@ -1,11 +0,0 @@ -# Body6 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **string** | Name of deal | [optional] -**attributes** | **object** | Attributes for deal update If you wish to update the pipeline of a deal you need to provide the `pipeline` and the `deal_stage`. Pipeline and deal_stage are ids you can fetch using this endpoint `/crm/pipeline/details/{pipelineID}` | [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/Body8.md b/docs/Model/Body8.md deleted file mode 100644 index a35d577..0000000 --- a/docs/Model/Body8.md +++ /dev/null @@ -1,20 +0,0 @@ -# Body8 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **string** | Name of task | -**duration** | **int** | Duration of task in milliseconds [1 minute = 60000 ms] | [optional] -**taskTypeId** | **string** | Id for type of task e.g Call / Email / Meeting etc. | -**date** | [**\DateTime**] | Task due date and time | -**notes** | **string** | Notes added to a task | [optional] -**done** | **bool** | Task marked as done | [optional] -**assignToId** | **string** | User id to whom task is assigned | [optional] -**contactsIds** | **int[]** | Contact ids for contacts linked to this task | [optional] -**dealsIds** | **string[]** | Deal ids for deals a task is linked to | [optional] -**companiesIds** | **string[]** | Companies ids for companies a task is linked to | [optional] -**reminder** | [**\Brevo\Client\Model\TaskReminder**](TaskReminder.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/Body9.md b/docs/Model/Body9.md deleted file mode 100644 index 393dac0..0000000 --- a/docs/Model/Body9.md +++ /dev/null @@ -1,19 +0,0 @@ -# Body9 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **string** | Name of task | [optional] -**duration** | **int** | Duration of task in milliseconds [1 minute = 60000 ms] | [optional] -**taskTypeId** | **string** | Id for type of task e.g Call / Email / Meeting etc. | [optional] -**date** | [**\DateTime**] | Task date/time | [optional] -**notes** | **string** | Notes added to a task | [optional] -**done** | **bool** | Task marked as done | [optional] -**assignToId** | **string** | User id to whom task is assigned | [optional] -**contactsIds** | **int[]** | Contact ids for contacts linked to this task | [optional] -**dealsIds** | **string[]** | Deal ids for deals a task is linked to | [optional] -**companiesIds** | **string[]** | Companies ids for companies a task is linked to | [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/BodyVariablesItems.md b/docs/Model/BodyVariablesItems.md deleted file mode 100644 index 71240ad..0000000 --- a/docs/Model/BodyVariablesItems.md +++ /dev/null @@ -1,9 +0,0 @@ -# BodyVariablesItems - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/CancelledTransaction.md b/docs/Model/CancelledTransaction.md new file mode 100644 index 0000000..f30850b --- /dev/null +++ b/docs/Model/CancelledTransaction.md @@ -0,0 +1,19 @@ +# # CancelledTransaction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier for the transaction. | [optional] +**status** | **string** | Current status of the transaction, indicating its state (draft/complete/cancelled/rejected/expired) | [optional] +**amount** | **float** | The monetary value of the transaction. | [optional] +**meta** | **object** | Additional metadata related to the transaction | [optional] +**rejectedAt** | **\DateTime** | Timestamp indicating when the transaction was rejected | [optional] +**rejectReason** | **string** | Reason for rejecting the transaction | [optional] +**expirationDate** | **\DateTime** | Date when the transaction expires if not completed. | [optional] +**completedAt** | **\DateTime** | | [optional] +**cancelledAt** | **\DateTime** | | [optional] +**createdAt** | **\DateTime** | | [optional] +**updatedAt** | **\DateTime** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Cart.md b/docs/Model/Cart.md new file mode 100644 index 0000000..93e7a93 --- /dev/null +++ b/docs/Model/Cart.md @@ -0,0 +1,10 @@ +# # Cart + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**currency** | **string** | Currency code for the payment amount. | +**specificAmount** | **int** | Payment amount, in cents. e.g. if you want to request €12.00, then the amount in cents is 1200. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CompaniesIdPatchRequest.md b/docs/Model/CompaniesIdPatchRequest.md new file mode 100644 index 0000000..51eb8f6 --- /dev/null +++ b/docs/Model/CompaniesIdPatchRequest.md @@ -0,0 +1,11 @@ +# # CompaniesIdPatchRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of company | [optional] +**attributes** | **object** | Attributes for company update | [optional] +**countryCode** | **int** | Country code if phone_number is passed in attributes. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CompaniesImportPost200Response.md b/docs/Model/CompaniesImportPost200Response.md new file mode 100644 index 0000000..e799bd3 --- /dev/null +++ b/docs/Model/CompaniesImportPost200Response.md @@ -0,0 +1,9 @@ +# # CompaniesImportPost200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**processId** | **int** | The ID of the import process | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CompaniesImportPost400Response.md b/docs/Model/CompaniesImportPost400Response.md new file mode 100644 index 0000000..1b2992e --- /dev/null +++ b/docs/Model/CompaniesImportPost400Response.md @@ -0,0 +1,9 @@ +# # CompaniesImportPost400Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CompaniesLinkUnlinkIdPatchRequest.md b/docs/Model/CompaniesLinkUnlinkIdPatchRequest.md new file mode 100644 index 0000000..884e4de --- /dev/null +++ b/docs/Model/CompaniesLinkUnlinkIdPatchRequest.md @@ -0,0 +1,12 @@ +# # CompaniesLinkUnlinkIdPatchRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**linkContactIds** | **int[]** | Contact ids for contacts to be linked with company | [optional] +**unlinkContactIds** | **int[]** | Contact ids for contacts to be unlinked from company | [optional] +**linkDealsIds** | **string[]** | Deal ids for deals to be linked with company | [optional] +**unlinkDealsIds** | **string[]** | Deal ids for deals to be unlinked from company | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CompaniesList.md b/docs/Model/CompaniesList.md index ec65186..bc2c553 100644 --- a/docs/Model/CompaniesList.md +++ b/docs/Model/CompaniesList.md @@ -1,10 +1,9 @@ -# CompaniesList +# # CompaniesList ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**items** | [**\Brevo\Client\Model\Company[]**](Company.md) | List of compaies | [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) - +**items** | [**\Brevo\Client\Models\Company[]**](Company.md) | List of compaies | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CompaniesPost200Response.md b/docs/Model/CompaniesPost200Response.md new file mode 100644 index 0000000..9c20d05 --- /dev/null +++ b/docs/Model/CompaniesPost200Response.md @@ -0,0 +1,9 @@ +# # CompaniesPost200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique company id | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CompaniesPostRequest.md b/docs/Model/CompaniesPostRequest.md new file mode 100644 index 0000000..7ef98b9 --- /dev/null +++ b/docs/Model/CompaniesPostRequest.md @@ -0,0 +1,13 @@ +# # CompaniesPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of company | +**attributes** | **object** | Attributes for company creation | [optional] +**countryCode** | **int** | Country code if phone_number is passed in attributes. | [optional] +**linkedContactsIds** | **int[]** | Contact ids to be linked with company | [optional] +**linkedDealsIds** | **string[]** | Deal ids to be linked with company | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Company.md b/docs/Model/Company.md index 7bfb6b3..10e242f 100644 --- a/docs/Model/Company.md +++ b/docs/Model/Company.md @@ -1,13 +1,12 @@ -# Company +# # Company ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Unique company id | [optional] -**attributes** | **object** | Company attributes with values | [optional] -**linkedContactsIds** | **int[]** | Contact ids for contacts linked to this company | [optional] -**linkedDealsIds** | **string[]** | Deals ids for companies linked to this company | [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) - +**id** | **string** | Unique comoany id | [optional] +**attributes** | **object** | Company attributes with values | [optional] +**linkedContactsIds** | **int[]** | Contact ids for contacts linked to this company | [optional] +**linkedDealsIds** | **string[]** | Deals ids for companies linked to this company | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CompanyAttributes.md b/docs/Model/CompanyAttributes.md deleted file mode 100644 index 3698f9e..0000000 --- a/docs/Model/CompanyAttributes.md +++ /dev/null @@ -1,9 +0,0 @@ -# CompanyAttributes - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/CompanyAttributesInner.md b/docs/Model/CompanyAttributesInner.md index c0011f0..eb30ae6 100644 --- a/docs/Model/CompanyAttributesInner.md +++ b/docs/Model/CompanyAttributesInner.md @@ -1,14 +1,13 @@ -# CompanyAttributesInner +# # CompanyAttributesInner ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**internalName** | **string** | | [optional] -**label** | **string** | | [optional] -**attributeTypeName** | **string** | | [optional] -**attributeOptions** | **object[]** | | [optional] -**isRequired** | **bool** | | [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) - +**internalName** | **string** | | [optional] +**label** | **string** | | [optional] +**attributeTypeName** | **string** | | [optional] +**attributeOptions** | **object[]** | | [optional] +**isRequired** | **bool** | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CompleteTransactionPayload.md b/docs/Model/CompleteTransactionPayload.md new file mode 100644 index 0000000..a31641a --- /dev/null +++ b/docs/Model/CompleteTransactionPayload.md @@ -0,0 +1,9 @@ +# # CompleteTransactionPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**balanceExpiryInMinutes** | **float** | Adds expiry in minutes to the balance on completion of transaction | [optional] [default to 0] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CompletedTransaction.md b/docs/Model/CompletedTransaction.md new file mode 100644 index 0000000..03dde9a --- /dev/null +++ b/docs/Model/CompletedTransaction.md @@ -0,0 +1,19 @@ +# # CompletedTransaction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier for the transaction. | [optional] +**status** | **string** | Current status of the transaction, indicating its state (draft/complete/cancelled/rejected/expired) | [optional] +**amount** | **float** | The monetary value of the transaction. | [optional] +**meta** | **object** | Additional metadata related to the transaction | [optional] +**rejectedAt** | **\DateTime** | Timestamp indicating when the transaction was rejected | [optional] +**rejectReason** | **string** | Reason for rejecting the transaction | [optional] +**expirationDate** | **\DateTime** | Date when the transaction expires if not completed. | [optional] +**completedAt** | **\DateTime** | | [optional] +**cancelledAt** | **\DateTime** | | [optional] +**createdAt** | **\DateTime** | | [optional] +**updatedAt** | **\DateTime** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ComponentItems.md b/docs/Model/ComponentItems.md index 9b44af1..df429f0 100644 --- a/docs/Model/ComponentItems.md +++ b/docs/Model/ComponentItems.md @@ -1,11 +1,10 @@ -# ComponentItems +# # ComponentItems ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**type** | **string** | | [optional] -**text** | **string** | | [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) - +**type** | **string** | | [optional] +**text** | **string** | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Configuration.md b/docs/Model/Configuration.md new file mode 100644 index 0000000..35718da --- /dev/null +++ b/docs/Model/Configuration.md @@ -0,0 +1,9 @@ +# # Configuration + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**customSuccessUrl** | **string** | Absolute URL of the custom success page. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Contact.md b/docs/Model/Contact.md deleted file mode 100644 index aa35bd3..0000000 --- a/docs/Model/Contact.md +++ /dev/null @@ -1,17 +0,0 @@ -# Contact - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**virtualNextTask** | **object** | Next incomplete task of contact | [optional] -**email** | **string** | Contact email | -**assignToId** | **string** | User id to whom contact is assigned | [optional] -**contactsId** | **int** | Contact id | [optional] -**crmLists** | **object** | CRM lists in which contact is added | -**attributes** | **object** | Contact attributes e.g firstname / lastname / SMS etc. | [optional] -**createdAt** | [**\DateTime**] | Contact created date/time | [optional] -**updatedAt** | [**\DateTime**] | Contact updated date/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/ContactBalances.md b/docs/Model/ContactBalances.md new file mode 100644 index 0000000..866e65d --- /dev/null +++ b/docs/Model/ContactBalances.md @@ -0,0 +1,12 @@ +# # ContactBalances + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyaltyProgramId** | **string** | Unique identifier for the loyalty program. | +**balanceDefinitionId** | **string** | Unique identifier for the balance definition. | +**count** | **int** | Total count of balances. | +**balances** | [**\Brevo\Client\Models\ContactBalancesBalancesInner[]**](ContactBalancesBalancesInner.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ContactBalancesBalancesInner.md b/docs/Model/ContactBalancesBalancesInner.md new file mode 100644 index 0000000..134072e --- /dev/null +++ b/docs/Model/ContactBalancesBalancesInner.md @@ -0,0 +1,12 @@ +# # ContactBalancesBalancesInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**contactId** | **int** | Unique identifier for the contact. | +**value** | **int** | Total balance value associated with the contact. | +**updatedAt** | **\DateTime** | Timestamp of the last update to the contact's balance record. | +**loyaltySubscriptionId** | **string** | Identifier for the contact's loyalty subscription. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ContactErrorModel.md b/docs/Model/ContactErrorModel.md new file mode 100644 index 0000000..4bb8abf --- /dev/null +++ b/docs/Model/ContactErrorModel.md @@ -0,0 +1,11 @@ +# # ContactErrorModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **string** | Error code displayed in case of a failure | +**message** | **string** | Readable message associated to the failure | +**metadata** | **object** | Additional information about the error | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ContactIdInvalidResponse.md b/docs/Model/ContactIdInvalidResponse.md new file mode 100644 index 0000000..6ea0c1f --- /dev/null +++ b/docs/Model/ContactIdInvalidResponse.md @@ -0,0 +1,9 @@ +# # ContactIdInvalidResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | **string** | Readable message associated to the failure | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConversationsAgentOnlinePingPostRequest.md b/docs/Model/ConversationsAgentOnlinePingPostRequest.md new file mode 100644 index 0000000..929eb13 --- /dev/null +++ b/docs/Model/ConversationsAgentOnlinePingPostRequest.md @@ -0,0 +1,12 @@ +# # ConversationsAgentOnlinePingPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**agentId** | **mixed** | agent ID. It can be found on agent’s page or received <a href=\"https://developers.brevo.com/docs/conversations-webhooks\">from a webhook</a>. Alternatively, you can use `agentEmail` + `agentName` + `receivedFrom` instead (all 3 fields required). | [optional] +**receivedFrom** | **mixed** | mark your messages to distinguish messages created by you from the others. | [optional] +**agentEmail** | **mixed** | agent email. When sending online pings from a standalone system, it’s hard to maintain a 1-to-1 relationship between the users of both systems. In this case, an agent can be specified by their email address. If there’s no agent with the specified email address in your Brevo organization, a dummy agent will be created automatically. | [optional] +**agentName** | **mixed** | agent name | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Conversationsmessage.md b/docs/Model/ConversationsMessage.md similarity index 53% rename from docs/Model/Conversationsmessage.md rename to docs/Model/ConversationsMessage.md index 7c0dc49..49cea6c 100644 --- a/docs/Model/Conversationsmessage.md +++ b/docs/Model/ConversationsMessage.md @@ -1,19 +1,18 @@ -# ConversationsMessage +# # ConversationsMessage ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Message ID. It can be used for further manipulations with the message. | [optional] -**type** | **string** | `\"agent\"` for agents’ messages, `\"visitor\"` for visitors’ messages. | [optional] -**text** | **string** | Message text or name of the attached file | [optional] -**visitorId** | **string** | visitor’s ID | [optional] -**agentId** | **string** | ID of the agent on whose behalf the message was sent (only in messages sent by an agent). | [optional] -**agentName** | **string** | Agent’s name as displayed to the visitor. Only in the messages sent by an agent. | [optional] -**createdAt** | **int** | Timestamp in milliseconds. | [optional] -**isPushed** | **bool** | `true` for pushed messages | [optional] -**receivedFrom** | **string** | In two-way integrations, messages sent via REST API can be marked with receivedFrom property and then filtered out when received in a webhook to avoid infinite loop. | [optional] -**file** | [**\Brevo\Client\Model\ConversationsMessageFile**](ConversationsMessageFile.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) - +**id** | **string** | Message ID. It can be used for further manipulations with the message. | [optional] +**type** | **string** | `\"agent\"` for agents’ messages, `\"visitor\"` for visitors’ messages. | [optional] +**text** | **string** | Message text or name of the attached file | [optional] +**visitorId** | **string** | visitor’s ID | [optional] +**agentId** | **string** | ID of the agent on whose behalf the message was sent (only in messages sent by an agent). | [optional] +**agentName** | **string** | Agent’s name as displayed to the visitor. Only in the messages sent by an agent. | [optional] +**createdAt** | **int** | Timestamp in milliseconds. | [optional] +**isPushed** | **bool** | `true` for pushed messages | [optional] +**receivedFrom** | **string** | In two-way integrations, messages sent via REST API can be marked with receivedFrom property and then filtered out when received in a webhook to avoid infinite loop. | [optional] +**file** | [**\Brevo\Client\Models\ConversationsMessageFile**](ConversationsMessageFile.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConversationsMessageFile.md b/docs/Model/ConversationsMessageFile.md index d9d691d..f616a00 100644 --- a/docs/Model/ConversationsMessageFile.md +++ b/docs/Model/ConversationsMessageFile.md @@ -1,14 +1,13 @@ -# ConversationsMessageFile +# # ConversationsMessageFile ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**filename** | **string** | Name of the file | [optional] -**size** | **int** | Size in bytes | [optional] -**isImage** | **bool** | Whether the file is an image | [optional] -**url** | **string** | URL of the file | [optional] -**imageInfo** | [**\Brevo\Client\Model\ConversationsMessageFileImageInfo**](ConversationsMessageFileImageInfo.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) - +**filename** | **string** | Name of the file | [optional] +**size** | **int** | Size in bytes | [optional] +**isImage** | **bool** | Whether the file is an image | [optional] +**url** | **string** | URL of the file | [optional] +**imageInfo** | [**\Brevo\Client\Models\ConversationsMessageFileImageInfo**](ConversationsMessageFileImageInfo.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConversationsMessagesIdPutRequest.md b/docs/Model/ConversationsMessagesIdPutRequest.md new file mode 100644 index 0000000..c8ea286 --- /dev/null +++ b/docs/Model/ConversationsMessagesIdPutRequest.md @@ -0,0 +1,9 @@ +# # ConversationsMessagesIdPutRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**text** | **string** | edited message text | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConversationsMessagesPostRequest.md b/docs/Model/ConversationsMessagesPostRequest.md new file mode 100644 index 0000000..888c36a --- /dev/null +++ b/docs/Model/ConversationsMessagesPostRequest.md @@ -0,0 +1,14 @@ +# # ConversationsMessagesPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**visitorId** | **mixed** | visitor’s ID received <a href=\"https://developers.brevo.com/docs/conversations-webhooks\">from a webhook</a> or generated by you to <a href=\"https://developers.brevo.com/docs/customize-the-widget#identifying-existing-users\">bind existing user account to Conversations</a> | +**text** | **mixed** | message text | +**agentId** | **mixed** | agent ID. It can be found on agent’s page or received <a href=\"https://developers.brevo.com/docs/conversations-webhooks\">from a webhook</a>. Alternatively, you can use `agentEmail` + `agentName` + `receivedFrom` instead (all 3 fields required). | [optional] +**receivedFrom** | **mixed** | mark your messages to distinguish messages created by you from the others. | [optional] +**agentEmail** | **mixed** | agent email. When sending messages from a standalone system, it’s hard to maintain a 1-to-1 relationship between the users of both systems. In this case, an agent can be specified by their email address. | [optional] +**agentName** | **mixed** | agent name | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConversationsPushedMessagesPostRequest.md b/docs/Model/ConversationsPushedMessagesPostRequest.md new file mode 100644 index 0000000..f07380e --- /dev/null +++ b/docs/Model/ConversationsPushedMessagesPostRequest.md @@ -0,0 +1,12 @@ +# # ConversationsPushedMessagesPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**visitorId** | **mixed** | visitor’s ID received <a href=\"https://developers.brevo.com/docs/conversations-webhooks\">from a webhook</a> or generated by you to <a href=\"https://developers.brevo.com/docs/customize-the-widget#identifying-existing-users\">bind existing user account to Conversations</a> | +**text** | **mixed** | message text | +**agentId** | **mixed** | agent ID. It can be found on agent’s page or received <a href=\"https://developers.brevo.com/docs/conversations-webhooks\">from a webhook</a>. | [optional] +**groupId** | **mixed** | group ID. It can be found on group’s page. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConversationsmessageFileImageInfo.md b/docs/Model/ConversationsmessageFileImageInfo.md index 12e18ca..286e683 100644 --- a/docs/Model/ConversationsmessageFileImageInfo.md +++ b/docs/Model/ConversationsmessageFileImageInfo.md @@ -1,12 +1,11 @@ -# ConversationsMessageFileImageInfo +# # ConversationsMessageFileImageInfo ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**width** | **int** | Width of the image | [optional] -**height** | **int** | height of the image | [optional] -**previewUrl** | **string** | URL of the preview | [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) - +**width** | **int** | Width of the image | [optional] +**height** | **int** | height of the image | [optional] +**previewUrl** | **string** | URL of the preview | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConversionSourceMetrics.md b/docs/Model/ConversionSourceMetrics.md new file mode 100644 index 0000000..5b6973c --- /dev/null +++ b/docs/Model/ConversionSourceMetrics.md @@ -0,0 +1,13 @@ +# # ConversionSourceMetrics + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **float** | | +**conversionSource** | **string** | | +**ordersCount** | **float** | | +**revenue** | **float** | | +**averageBasket** | **float** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConversionSourceProduct.md b/docs/Model/ConversionSourceProduct.md new file mode 100644 index 0000000..db74d2a --- /dev/null +++ b/docs/Model/ConversionSourceProduct.md @@ -0,0 +1,16 @@ +# # ConversionSourceProduct + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**name** | **string** | | [optional] +**sku** | **string** | | [optional] +**price** | **float** | | [optional] +**url** | **string** | | [optional] +**imageUrl** | **string** | | [optional] +**ordersCount** | **int** | | [optional] +**revenue** | **float** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CorporateGroupDetailsResponse.md b/docs/Model/CorporateGroupDetailsResponse.md new file mode 100644 index 0000000..819e84d --- /dev/null +++ b/docs/Model/CorporateGroupDetailsResponse.md @@ -0,0 +1,11 @@ +# # CorporateGroupDetailsResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**group** | [**\Brevo\Client\Models\CorporateGroupDetailsResponseGroup**](CorporateGroupDetailsResponseGroup.md) | | [optional] +**subAccounts** | [**\Brevo\Client\Models\CorporateGroupDetailsResponseSubAccountsInner[]**](CorporateGroupDetailsResponseSubAccountsInner.md) | | [optional] +**users** | [**\Brevo\Client\Models\CorporateGroupDetailsResponseUsersInner[]**](CorporateGroupDetailsResponseUsersInner.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CorporateGroupDetailsResponseGroup.md b/docs/Model/CorporateGroupDetailsResponseGroup.md new file mode 100644 index 0000000..df650fa --- /dev/null +++ b/docs/Model/CorporateGroupDetailsResponseGroup.md @@ -0,0 +1,11 @@ +# # CorporateGroupDetailsResponseGroup + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Group id | [optional] +**groupName** | **string** | Name of the group | [optional] +**createdAt** | **string** | Group creation date | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CorporateGroupDetailsResponseSubAccountsInner.md b/docs/Model/CorporateGroupDetailsResponseSubAccountsInner.md new file mode 100644 index 0000000..590597d --- /dev/null +++ b/docs/Model/CorporateGroupDetailsResponseSubAccountsInner.md @@ -0,0 +1,11 @@ +# # CorporateGroupDetailsResponseSubAccountsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Id of the sub-account organzation | [optional] +**companyName** | **string** | Name of the sub-account organzation | [optional] +**createdAt** | **string** | Creation date of the sub-account organzation | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CorporateGroupDetailsResponseUsersInner.md b/docs/Model/CorporateGroupDetailsResponseUsersInner.md new file mode 100644 index 0000000..76855f0 --- /dev/null +++ b/docs/Model/CorporateGroupDetailsResponseUsersInner.md @@ -0,0 +1,11 @@ +# # CorporateGroupDetailsResponseUsersInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email** | **string** | Email address of the user | [optional] +**lastName** | **string** | Last name of the user | [optional] +**firstName** | **string** | First name of the user | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Body.md b/docs/Model/CorporateGroupIdPutRequest.md similarity index 51% rename from docs/Model/Body.md rename to docs/Model/CorporateGroupIdPutRequest.md index a8259be..e87aa78 100644 --- a/docs/Model/Body.md +++ b/docs/Model/CorporateGroupIdPutRequest.md @@ -1,11 +1,10 @@ -# Body +# # CorporateGroupIdPutRequest ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**groupName** | **string** | The name of the group of sub-accounts | -**subAccountIds** | **int[]** | Pass the list of sub-account Ids to be included in the group | [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) - +**groupName** | **string** | The name of the group of sub-accounts | [optional] +**subAccountIds** | **int[]** | Pass the list of sub-account Ids to be included in the group | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CorporateGroupPost201Response.md b/docs/Model/CorporateGroupPost201Response.md new file mode 100644 index 0000000..415ebaf --- /dev/null +++ b/docs/Model/CorporateGroupPost201Response.md @@ -0,0 +1,9 @@ +# # CorporateGroupPost201Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Body1.md b/docs/Model/CorporateGroupPostRequest.md similarity index 51% rename from docs/Model/Body1.md rename to docs/Model/CorporateGroupPostRequest.md index 4ddc5ee..1a67b39 100644 --- a/docs/Model/Body1.md +++ b/docs/Model/CorporateGroupPostRequest.md @@ -1,11 +1,10 @@ -# Body1 +# # CorporateGroupPostRequest ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**groupName** | **string** | The name of the group of sub-accounts | -**subAccountIds** | **int[]** | Pass the list of sub-account Ids to be included in the group | [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) - +**groupName** | **string** | The name of the group of sub-accounts | +**subAccountIds** | **int[]** | Pass the list of sub-account Ids to be included in the group | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CorporateGroupUnlinkGroupIdSubAccountsPutRequest.md b/docs/Model/CorporateGroupUnlinkGroupIdSubAccountsPutRequest.md new file mode 100644 index 0000000..acf8907 --- /dev/null +++ b/docs/Model/CorporateGroupUnlinkGroupIdSubAccountsPutRequest.md @@ -0,0 +1,9 @@ +# # CorporateGroupUnlinkGroupIdSubAccountsPutRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**subAccountIds** | **int[]** | List of sub-account ids | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CorporateIpGet200ResponseInner.md b/docs/Model/CorporateIpGet200ResponseInner.md new file mode 100644 index 0000000..d937fb3 --- /dev/null +++ b/docs/Model/CorporateIpGet200ResponseInner.md @@ -0,0 +1,11 @@ +# # CorporateIpGet200ResponseInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ip** | **string** | | [optional] +**domain** | **string** | | [optional] +**transactional** | **bool** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CorporateSsoTokenPostRequest.md b/docs/Model/CorporateSsoTokenPostRequest.md new file mode 100644 index 0000000..7bb5785 --- /dev/null +++ b/docs/Model/CorporateSsoTokenPostRequest.md @@ -0,0 +1,9 @@ +# # CorporateSsoTokenPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email** | **string** | User email of admin account | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CorporateSubAccountIpAssociatePostRequest.md b/docs/Model/CorporateSubAccountIpAssociatePostRequest.md new file mode 100644 index 0000000..0c29319 --- /dev/null +++ b/docs/Model/CorporateSubAccountIpAssociatePostRequest.md @@ -0,0 +1,10 @@ +# # CorporateSubAccountIpAssociatePostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ip** | **string** | IP address | +**ids** | **int[]** | Pass the list of sub-account Ids to be associated with the IP address | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CorporateSubAccountIpDissociatePutRequest.md b/docs/Model/CorporateSubAccountIpDissociatePutRequest.md new file mode 100644 index 0000000..2d4e613 --- /dev/null +++ b/docs/Model/CorporateSubAccountIpDissociatePutRequest.md @@ -0,0 +1,10 @@ +# # CorporateSubAccountIpDissociatePutRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ip** | **string** | IP address | +**ids** | **int[]** | Pass the list of sub-account Ids to be dissociated from the IP address | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CorporateSubAccountKeyPostRequest.md b/docs/Model/CorporateSubAccountKeyPostRequest.md new file mode 100644 index 0000000..bc52aa6 --- /dev/null +++ b/docs/Model/CorporateSubAccountKeyPostRequest.md @@ -0,0 +1,10 @@ +# # CorporateSubAccountKeyPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Id of the sub-account organization | +**name** | **string** | Name of the API key | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CorporateSubAccountSsoTokenPostRequest.md b/docs/Model/CorporateSubAccountSsoTokenPostRequest.md new file mode 100644 index 0000000..28a4d1d --- /dev/null +++ b/docs/Model/CorporateSubAccountSsoTokenPostRequest.md @@ -0,0 +1,12 @@ +# # CorporateSubAccountSsoTokenPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Id of the sub-account organization | +**email** | **string** | User email of sub-account organization | [optional] +**target** | **string** | **Set target after login success** * **automation** - Redirect to Automation after login * **email_campaign** - Redirect to Email Campaign after login * **contacts** - Redirect to Contacts after login * **landing_pages** - Redirect to Landing Pages after login * **email_transactional** - Redirect to Email Transactional after login * **senders** - Redirect to Senders after login * **sms_campaign** - Redirect to Sms Campaign after login * **sms_transactional** - Redirect to Sms Transactional after login | [optional] +**url** | **string** | Set the full target URL after login success. The user will land directly on this target URL after login | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CorporateUserEmailPermissionsPutRequest.md b/docs/Model/CorporateUserEmailPermissionsPutRequest.md new file mode 100644 index 0000000..761631b --- /dev/null +++ b/docs/Model/CorporateUserEmailPermissionsPutRequest.md @@ -0,0 +1,10 @@ +# # CorporateUserEmailPermissionsPutRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**allFeaturesAccess** | **bool** | All access to the features | +**privileges** | [**\Brevo\Client\Models\CorporateUserEmailPermissionsPutRequestPrivilegesInner[]**](CorporateUserEmailPermissionsPutRequestPrivilegesInner.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CorporateUserEmailPermissionsPutRequestPrivilegesInner.md b/docs/Model/CorporateUserEmailPermissionsPutRequestPrivilegesInner.md new file mode 100644 index 0000000..2c52eda --- /dev/null +++ b/docs/Model/CorporateUserEmailPermissionsPutRequestPrivilegesInner.md @@ -0,0 +1,10 @@ +# # CorporateUserEmailPermissionsPutRequestPrivilegesInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**feature** | **string** | feature name | [optional] +**permissions** | **string[]** | Permission for the feature | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CorporateUserInvitationActionEmailPut200Response.md b/docs/Model/CorporateUserInvitationActionEmailPut200Response.md new file mode 100644 index 0000000..f19795f --- /dev/null +++ b/docs/Model/CorporateUserInvitationActionEmailPut200Response.md @@ -0,0 +1,9 @@ +# # CorporateUserInvitationActionEmailPut200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **string** | Action success message | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateApiKeyRequest.md b/docs/Model/CreateApiKeyRequest.md deleted file mode 100644 index 252d23e..0000000 --- a/docs/Model/CreateApiKeyRequest.md +++ /dev/null @@ -1,11 +0,0 @@ -# CreateApiKeyRequest - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | Id of the sub-account organization | -**name** | **string** | Name of the API key | [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/CreateApiKeyResponse.md b/docs/Model/CreateApiKeyResponse.md index 3f3e3ea..59b0265 100644 --- a/docs/Model/CreateApiKeyResponse.md +++ b/docs/Model/CreateApiKeyResponse.md @@ -1,11 +1,10 @@ -# CreateApiKeyResponse +# # CreateApiKeyResponse ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**status** | **string** | Status of the API operation. | [optional] -**key** | **string** | API Key | [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) - +**status** | **string** | Status of the API operation. | +**key** | **string** | API key | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateAttribute.md b/docs/Model/CreateAttribute.md index 357be1f..4873191 100644 --- a/docs/Model/CreateAttribute.md +++ b/docs/Model/CreateAttribute.md @@ -1,13 +1,13 @@ -# CreateAttribute +# # CreateAttribute ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**value** | **string** | Value of the attribute. Use only if the attribute's category is 'calculated' or 'global' | [optional] -**isRecurring** | **bool** | Type of the attribute. Use only if the attribute's category is 'calculated' or 'global' | [optional] -**enumeration** | [**\Brevo\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 'boolean' is only available if the category is 'normal' attribute, 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) - +**value** | **string** | Value of the attribute. **Use only if the attribute's category is 'calculated' or 'global'** | [optional] +**isRecurring** | **bool** | Type of the attribute. **Use only if the attribute's category is 'calculated' or 'global'** | [optional] +**enumeration** | [**\Brevo\Client\Models\CreateAttributeEnumerationInner[]**](CreateAttributeEnumerationInner.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] +**multiCategoryOptions** | **string[]** | List of options you want to add for multiple-choice attribute. **Use only if the attribute's category is \"normal\" and attribute's type is \"multiple-choice\".** For example: **[\"USA\",\"INDIA\"]** | [optional] +**type** | **string** | Type of the attribute. **Use only if the attribute's category is 'normal', 'category' or 'transactional'** Type **boolean and multiple-choice** is only available if the category is **normal** attribute 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#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateAttributeEnumeration.md b/docs/Model/CreateAttributeEnumeration.md deleted file mode 100644 index a88a8af..0000000 --- a/docs/Model/CreateAttributeEnumeration.md +++ /dev/null @@ -1,11 +0,0 @@ -# CreateAttributeEnumeration - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**value** | **int** | Id of the value | -**label** | **string** | Label of the value | - -[[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/CreateAttributeEnumerationInner.md b/docs/Model/CreateAttributeEnumerationInner.md new file mode 100644 index 0000000..a931b43 --- /dev/null +++ b/docs/Model/CreateAttributeEnumerationInner.md @@ -0,0 +1,10 @@ +# # CreateAttributeEnumerationInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | **int** | Id of the value | +**label** | **string** | Label of the value | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateBalanceDefinitionPayload.md b/docs/Model/CreateBalanceDefinitionPayload.md new file mode 100644 index 0000000..3b74ec6 --- /dev/null +++ b/docs/Model/CreateBalanceDefinitionPayload.md @@ -0,0 +1,23 @@ +# # CreateBalanceDefinitionPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name for the balance | +**unit** | **string** | The unit for this balance definition. | +**description** | **string** | Description for the balance | [optional] +**meta** | **object** | Additional metadata related to the balance definition. | [optional] +**minAmount** | **float** | Minimum possible amount for balance | [optional] +**maxAmount** | **float** | Maximum possible amount for balance | [optional] +**maxCreditAmountLimit** | **float** | Maximum credit amount limit per operation | [optional] +**maxDebitAmountLimit** | **float** | Maximum debit amount limit per operation | [optional] +**balanceOptionAmountOvertakingStrategy** | **string** | Select partial to enable partial credit of balance if maximum balance limit is reaching. Select strict to reject the transaction if it will breach the max credit amount limit. | [optional] [default to 'strict'] +**balanceOptionCreditRounding** | **string** | Select natural to round to nearest integer. Select upper to round up . Select lower to round down | [optional] [default to 'natural'] +**balanceOptionDebitRounding** | **string** | Select natural to round to nearest integer. Select upper to round up . Select lower to round down | [optional] [default to 'natural'] +**balanceAvailabilityDurationValue** | **float** | Number of days/weeks/month/year for balance expiry | [optional] +**balanceAvailabilityDurationUnit** | **string** | Unit for balance expiry (e.g., day/week/month/year). | [optional] [default to 'day'] +**balanceAvailabilityDurationModifier** | **string** | Select startOfPeriod to configure balance expiry on start of day/week/month/year. Select endOfPeriod to configure balance expiry on end of day/week/month/year, else select noModification | [optional] [default to 'noModification'] +**balanceExpirationDate** | **string** | Date when the balance expires and can no longer be used, in dd/mm format. The balance will be expired when this date appears next in the calendar and only one of balanceExpirationDate or balance availability fields can be used. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateCategoryModel.md b/docs/Model/CreateCategoryModel.md index b159bae..01049f7 100644 --- a/docs/Model/CreateCategoryModel.md +++ b/docs/Model/CreateCategoryModel.md @@ -1,10 +1,9 @@ -# CreateCategoryModel +# # CreateCategoryModel ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | ID of the category when a new category is created | [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) - +**id** | **int** | ID of the category when a new category is created | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateChild.md b/docs/Model/CreateChild.md deleted file mode 100644 index cc18ace..0000000 --- a/docs/Model/CreateChild.md +++ /dev/null @@ -1,15 +0,0 @@ -# CreateChild - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**email** | **string** | Email address to create the child account | -**firstName** | **string** | First name to use to create the child account | -**lastName** | **string** | Last name to use to create the child account | -**companyName** | **string** | Company name to use to create the child account | -**password** | **string** | Password for the child account to login | -**language** | **string** | Language of 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/CreateContact.md b/docs/Model/CreateContact.md index 84fe8f4..68649fd 100644 --- a/docs/Model/CreateContact.md +++ b/docs/Model/CreateContact.md @@ -1,17 +1,16 @@ -# CreateContact +# # CreateContact ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**email** | **string** | Email address of the user. Mandatory if \"SMS\" field is not passed in \"attributes\" parameter. Mobile Number in \"SMS\" field should be passed with proper country code. For example {'SMS':'+91xxxxxxxxxx'} or {'SMS':'0091xxxxxxxxxx'} | [optional] -**extId** | **string** | Pass your own Id to create a contact. | [optional] -**attributes** | **object** | Pass the set of attributes and their values. The attribute's parameter should be passed in capital letter while creating a contact. Values that don't match the attribute type (e.g. text or string in a date attribute) will be ignored.These attributes must be present in your Brevo 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] +**email** | **string** | Email address of the user. **Mandatory if \"ext_id\" & \"SMS\" field is not passed.** | [optional] +**extId** | **string** | Pass your own Id to create a contact. | [optional] +**attributes** | [**array**](CreateDoiContactAttributesValue.md) | Pass the set of attributes and their values. The attribute's parameter should be passed in capital letter while creating a contact. Values that don't match the attribute type (e.g. text or string in a date attribute) will be ignored. **These attributes must be present in your Brevo account.**. For eg: **{\"FNAME\":\"Elly\", \"LNAME\":\"Roger\", \"COUNTRIES\":[\"India\",\"China\"]}** | [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 the existing contact in the same request (updateEnabled = true) | [optional] [default to false] -**smtpBlacklistSender** | **string[]** | transactional email 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) - +**smtpBlacklistSender** | **string[]** | transactional email forbidden sender for contact. Use only for email Contact ( only available if updateEnabled = true ) | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateCouponCollection.md b/docs/Model/CreateCouponCollection.md deleted file mode 100644 index 343ba37..0000000 --- a/docs/Model/CreateCouponCollection.md +++ /dev/null @@ -1,11 +0,0 @@ -# CreateCouponCollection - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **object** | Name of the collection with no white spaces between words | -**defaultCoupon** | **object** | A default coupon to be used in case there are no coupons left | - -[[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/CreateCouponCollection201Response.md b/docs/Model/CreateCouponCollection201Response.md new file mode 100644 index 0000000..55b5429 --- /dev/null +++ b/docs/Model/CreateCouponCollection201Response.md @@ -0,0 +1,9 @@ +# # CreateCouponCollection201Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The id of the created collection | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateCouponCollectionRequest.md b/docs/Model/CreateCouponCollectionRequest.md new file mode 100644 index 0000000..988d035 --- /dev/null +++ b/docs/Model/CreateCouponCollectionRequest.md @@ -0,0 +1,13 @@ +# # CreateCouponCollectionRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of the coupons collection | +**defaultCoupon** | **string** | Default coupons collection name | +**expirationDate** | **\DateTime** | Specify an expiration date for the coupon collection in RFC3339 format. Use null to remove the expiration date. | [optional] +**remainingDaysAlert** | **int** | Send a notification alert (email) when the remaining days until the expiration date are equal or fall bellow this number. Use null to disable alerts. | [optional] +**remainingCouponsAlert** | **int** | Send a notification alert (email) when the remaining coupons count is equal or fall bellow this number. Use null to disable alerts. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateCoupons.md b/docs/Model/CreateCoupons.md deleted file mode 100644 index 10b5195..0000000 --- a/docs/Model/CreateCoupons.md +++ /dev/null @@ -1,11 +0,0 @@ -# CreateCoupons - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**collectionId** | **string** | The id of the coupon collection for which the coupons will be created | -**coupons** | **string[]** | | - -[[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/CreateCouponsRequest.md b/docs/Model/CreateCouponsRequest.md new file mode 100644 index 0000000..39523f2 --- /dev/null +++ b/docs/Model/CreateCouponsRequest.md @@ -0,0 +1,10 @@ +# # CreateCouponsRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**collectionId** | **string** | The id of the coupon collection for which the coupons will be created | +**coupons** | **string[]** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateDoiContact.md b/docs/Model/CreateDoiContact.md index 8ec195d..7c8691f 100644 --- a/docs/Model/CreateDoiContact.md +++ b/docs/Model/CreateDoiContact.md @@ -1,15 +1,14 @@ -# CreateDoiContact +# # CreateDoiContact ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**email** | **string** | Email address where the confirmation email will be sent. This email address will be the identifier for all other contact attributes. | -**attributes** | **object** | Pass the set of attributes and their values. These attributes must be present in your Brevo account. For eg. {'FNAME':'Elly', 'LNAME':'Roger'} | [optional] -**includeListIds** | **int[]** | Lists under user account where contact should be added | -**excludeListIds** | **int[]** | Lists under user account where contact should not be added | [optional] -**templateId** | **int** | Id of the Double opt-in (DOI) template | -**redirectionUrl** | **string** | URL of the web page that user will be redirected to after clicking on the double opt in URL. When editing your DOI template you can reference this URL by using the tag {{ params.DOIurl }}. | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - - +**email** | **string** | Email address where the confirmation email will be sent. This email address will be the identifier for all other contact attributes. | +**includeListIds** | **int[]** | Lists under user account where contact should be added | +**templateId** | **int** | Id of the Double opt-in (DOI) template | +**redirectionUrl** | **string** | URL of the web page that user will be redirected to after clicking on the double opt in URL. When editing your DOI template you can reference this URL by using the tag **{{ params.DOIurl }}**. | +**attributes** | [**array**](CreateDoiContactAttributesValue.md) | Pass the set of attributes and their values. **These attributes must be present in your Brevo account**. For eg. **{'FNAME':'Elly', 'LNAME':'Roger', 'COUNTRIES':['India','China']}** | [optional] +**excludeListIds** | **int[]** | Lists under user account where contact should not be added | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateDoiContactAttributesValue.md b/docs/Model/CreateDoiContactAttributesValue.md new file mode 100644 index 0000000..cf66bdc --- /dev/null +++ b/docs/Model/CreateDoiContactAttributesValue.md @@ -0,0 +1,8 @@ +# # CreateDoiContactAttributesValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateDomain.md b/docs/Model/CreateDomain.md index bffba78..fe3ed36 100644 --- a/docs/Model/CreateDomain.md +++ b/docs/Model/CreateDomain.md @@ -1,10 +1,9 @@ -# CreateDomain +# # CreateDomain ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | Domain name | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**name** | **string** | Domain name | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateDomainModel.md b/docs/Model/CreateDomainModel.md index 34b5901..a28621e 100644 --- a/docs/Model/CreateDomainModel.md +++ b/docs/Model/CreateDomainModel.md @@ -1,13 +1,13 @@ -# CreateDomainModel +# # CreateDomainModel ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | ID of the Domain created | -**domainName** | **string** | Domain | [optional] -**message** | **string** | Success message | [optional] -**dnsRecords** | [**\Brevo\Client\Model\CreateDomainModelDnsRecords**](CreateDomainModelDnsRecords.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) - +**id** | **int** | ID of the Domain created | +**domainName** | **string** | Domain | [optional] +**domainProvider** | **string** | Domain Provider | [optional] +**message** | **string** | Success message | [optional] +**dnsRecords** | [**\Brevo\Client\Models\CreateDomainModelDnsRecords**](CreateDomainModelDnsRecords.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateDomainModelDnsRecords.md b/docs/Model/CreateDomainModelDnsRecords.md index c697281..f40d643 100644 --- a/docs/Model/CreateDomainModelDnsRecords.md +++ b/docs/Model/CreateDomainModelDnsRecords.md @@ -1,11 +1,11 @@ -# CreateDomainModelDnsRecords +# # CreateDomainModelDnsRecords ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**dkimRecord** | [**\Brevo\Client\Model\CreateDomainModelDnsRecordsDkimRecord**](CreateDomainModelDnsRecordsDkimRecord.md) | | [optional] -**brevoCode** | [**\Brevo\Client\Model\CreateDomainModelDnsRecordsDkimRecord**](CreateDomainModelDnsRecordsDkimRecord.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) - +**dkimRecord** | [**\Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord**](CreateDomainModelDnsRecordsDkimRecord.md) | | [optional] +**brevoCode** | [**\Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord**](CreateDomainModelDnsRecordsDkimRecord.md) | | [optional] +**dmarcRecord** | [**\Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord**](CreateDomainModelDnsRecordsDkimRecord.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateDomainModelDnsRecordsDkimRecord.md b/docs/Model/CreateDomainModelDnsRecordsDkimRecord.md index b45d54c..2c8fabd 100644 --- a/docs/Model/CreateDomainModelDnsRecordsDkimRecord.md +++ b/docs/Model/CreateDomainModelDnsRecordsDkimRecord.md @@ -1,13 +1,12 @@ -# CreateDomainModelDnsRecordsDkimRecord +# # CreateDomainModelDnsRecordsDkimRecord ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**type** | **string** | | [optional] -**value** | **string** | | [optional] -**hostName** | **string** | | [optional] -**status** | **bool** | | [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) - +**type** | **string** | | [optional] +**value** | **string** | | [optional] +**hostName** | **string** | | [optional] +**status** | **bool** | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateEmailCampaign.md b/docs/Model/CreateEmailCampaign.md index 85dd214..7adf09a 100644 --- a/docs/Model/CreateEmailCampaign.md +++ b/docs/Model/CreateEmailCampaign.md @@ -1,40 +1,40 @@ -# CreateEmailCampaign +# # CreateEmailCampaign ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**tag** | **string** | Tag of the campaign | [optional] -**sender** | [**\Brevo\Client\Model\CreateEmailCampaignSender**](CreateEmailCampaignSender.md) | | -**name** | **string** | Name of the campaign | -**htmlContent** | **string** | Mandatory if htmlUrl and templateId are empty. Body of the message (HTML) | [optional] -**htmlUrl** | **string** | Mandatory if htmlContent and templateId are empty. Url to the message (HTML) | [optional] -**templateId** | **int** | Mandatory if htmlContent and htmlUrl are empty. Id of the transactional email template with status 'active'. Used to copy only its content fetched from htmlContent/htmlUrl to an email campaign for RSS feature. | [optional] -**scheduledAt** | **string** | Sending UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. If sendAtBestTime is set to true, your campaign will be sent according to the date passed (ignoring the time part). | [optional] -**subject** | **string** | Subject of the campaign. Mandatory if abTesting is false. Ignored if abTesting is true. | [optional] -**previewText** | **string** | Preview text or preheader of the email campaign | [optional] -**replyTo** | **string** | Email on which the campaign recipients will be able to reply to | [optional] -**toField** | **string** | To personalize the «To» Field. If you want to include the first name and last name of your recipient, add {FNAME} {LNAME}. These contact attributes must already exist in your Brevo account. If input parameter 'params' used please use {{contact.FNAME}} {{contact.LNAME}} for personalization | [optional] -**recipients** | [**\Brevo\Client\Model\CreateEmailCampaignRecipients**](CreateEmailCampaignRecipients.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** | 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 | [optional] [default to false] -**mirrorActive** | **bool** | Use true to enable the mirror link | [optional] -**footer** | **string** | Footer of the email campaign | [optional] -**header** | **string** | Header of the email campaign | [optional] -**utmCampaign** | **string** | Customize the utm_campaign value. If this field is empty, the campaign name will be used. Only alphanumeric characters and spaces are allowed | [optional] -**params** | **object** | Pass the set of attributes to customize the type classic campaign. For example, `{\"FNAME\":\"Joe\", \"LNAME:\"Doe\"}`. Only available if 'type' is 'classic'. It's considered only if campaign is in New Template Language format. The New Template Language is dependent on the values of 'subject', 'htmlContent/htmlUrl', 'sender.name' & 'toField' | [optional] +**sender** | [**\Brevo\Client\Models\CreateEmailCampaignSender**](CreateEmailCampaignSender.md) | | +**name** | **string** | Name of the campaign | +**tag** | **string** | Tag of the campaign | [optional] +**htmlContent** | **string** | Mandatory if htmlUrl and templateId are empty. Body of the message (HTML). | [optional] +**htmlUrl** | **string** | **Mandatory if htmlContent and templateId are empty**. Url to the message (HTML). For example: **https://html.domain.com** | [optional] +**templateId** | **int** | **Mandatory if htmlContent and htmlUrl are empty**. Id of the transactional email template with status _active_. Used to copy only its content fetched from htmlContent/htmlUrl to an email campaign for RSS feature. | [optional] +**scheduledAt** | **string** | Sending UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result**. If sendAtBestTime is set to true, your campaign will be sent according to the date passed (ignoring the time part). For example: **2017-06-01T12:30:00+02:00** | [optional] +**subject** | **string** | Subject of the campaign. **Mandatory if abTesting is false**. Ignored if abTesting is true. | [optional] +**previewText** | **string** | Preview text or preheader of the email campaign | [optional] +**replyTo** | **string** | Email on which the campaign recipients will be able to reply to | [optional] +**toField** | **string** | To personalize the **To** Field. If you want to include the first name and last name of your recipient, add **{FNAME} {LNAME}**. These contact attributes must already exist in your Brevo account. If input parameter **params** used please use **{{contact.FNAME}} {{contact.LNAME}}** for personalization | [optional] +**recipients** | [**\Brevo\Client\Models\CreateEmailCampaignRecipients**](CreateEmailCampaignRecipients.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** | 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_ | [optional] [default to false] +**mirrorActive** | **bool** | Use true to enable the mirror link | [optional] +**footer** | **string** | Footer of the email campaign | [optional] +**header** | **string** | Header of the email campaign | [optional] +**utmCampaign** | **string** | Customize the utm_campaign value. If this field is empty, the campaign name will be used. Only alphanumeric characters and spaces are allowed | [optional] +**params** | **array** | Pass the set of attributes to customize the type classic campaign. For example: **{\"FNAME\":\"Joe\", \"LNAME\":\"Doe\"}**. Only available if **type** is **classic**. It's considered only if campaign is in _New Template Language format_. The New Template Language is dependent on the values of **subject, htmlContent/htmlUrl, sender.name & toField** | [optional] **sendAtBestTime** | **bool** | Set this to true if you want to send your campaign at best time. | [optional] [default to false] -**abTesting** | **bool** | Status of A/B Test. abTesting = false means it is disabled, & abTesting = true means it is enabled. 'subjectA', 'subjectB', 'splitRule', 'winnerCriteria' & 'winnerDelay' will be considered when abTesting is set to true. 'subjectA' & 'subjectB' are mandatory together & 'subject' if passed is ignored. Can be set to true only if 'sendAtBestTime' is 'false'. You will be able to set up two subject lines for your campaign and send them to a random sample of your total recipients. Half of the test group will receive version A, and the other half will receive version B | [optional] [default to false] -**subjectA** | **string** | Subject A of the campaign. Mandatory if abTesting = true. subjectA & subjectB should have unique value | [optional] -**subjectB** | **string** | Subject B of the campaign. Mandatory if abTesting = true. subjectA & subjectB should have unique value | [optional] -**splitRule** | **int** | Add the size of your test groups. Mandatory if abTesting = true & 'recipients' is passed. We'll send version A and B to a random sample of recipients, and then the winning version to everyone else | [optional] -**winnerCriteria** | **string** | Choose the metrics that will determinate the winning version. Mandatory if 'splitRule' >= 1 and < 50. If splitRule = 50, 'winnerCriteria' is ignored if passed | [optional] -**winnerDelay** | **int** | Choose the duration of the test in hours. Maximum is 7 days, pass 24*7 = 168 hours. The winning version will be sent at the end of the test. Mandatory if 'splitRule' >= 1 and < 50. If splitRule = 50, 'winnerDelay' is ignored if passed | [optional] -**ipWarmupEnable** | **bool** | Available for dedicated ip clients. Set this to true if you wish to warm up your ip. | [optional] [default to false] -**initialQuota** | **int** | Mandatory if ipWarmupEnable is set to true. Set an initial quota greater than 1 for warming up your ip. We recommend you set a value of 3000. | [optional] -**increaseRate** | **int** | Mandatory if ipWarmupEnable is set to true. Set a percentage increase rate for warming up your ip. We recommend you set the increase rate to 30% per day. If you want to send the same number of emails every day, set the daily increase value to 0%. | [optional] -**unsubscriptionPageId** | **string** | Enter an unsubscription page id. The page id is a 24 digit alphanumeric id that can be found in the URL when editing the page. If not entered, then the default unsubscription page will be used. | [optional] -**updateFormId** | **string** | Mandatory if templateId is used containing the {{ update_profile }} tag. Enter an update profile form id. The form id is a 24 digit alphanumeric id that can be found in the URL when editing the form. If not entered, then the default update profile form will be used. | [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) - +**abTesting** | **bool** | Status of A/B Test. abTesting = false means it is disabled & abTesting = true means it is enabled. **subjectA, subjectB, splitRule, winnerCriteria & winnerDelay** will be considered when abTesting is set to true. subjectA & subjectB are mandatory together & subject if passed is ignored. **Can be set to true only if sendAtBestTime is false**. You will be able to set up two subject lines for your campaign and send them to a random sample of your total recipients. Half of the test group will receive version A, and the other half will receive version B | [optional] [default to false] +**subjectA** | **string** | Subject A of the campaign. **Mandatory if abTesting = true**. subjectA & subjectB should have unique value | [optional] +**subjectB** | **string** | Subject B of the campaign. **Mandatory if abTesting = true**. subjectA & subjectB should have unique value | [optional] +**splitRule** | **int** | Add the size of your test groups. **Mandatory if abTesting = true & 'recipients' is passed**. We'll send version A and B to a random sample of recipients, and then the winning version to everyone else | [optional] +**winnerCriteria** | **string** | Choose the metrics that will determinate the winning version. **Mandatory if _splitRule_ >= 1 and < 50**. If splitRule = 50, `winnerCriteria` is ignored if passed | [optional] +**winnerDelay** | **int** | Choose the duration of the test in hours. Maximum is 7 days, pass 24*7 = 168 hours. The winning version will be sent at the end of the test. **Mandatory if _splitRule_ >= 1 and < 50**. If splitRule = 50, `winnerDelay` is ignored if passed | [optional] +**ipWarmupEnable** | **bool** | **Available for dedicated ip clients**. Set this to true if you wish to warm up your ip. | [optional] [default to false] +**initialQuota** | **int** | **Mandatory if ipWarmupEnable is set to true**. Set an initial quota greater than 1 for warming up your ip. We recommend you set a value of 3000. | [optional] +**increaseRate** | **int** | **Mandatory if ipWarmupEnable is set to true**. Set a percentage increase rate for warming up your ip. We recommend you set the increase rate to 30% per day. If you want to send the same number of emails every day, set the daily increase value to 0%. | [optional] +**unsubscriptionPageId** | **string** | Enter an unsubscription page id. The page id is a 24 digit alphanumeric id that can be found in the URL when editing the page. If not entered, then the default unsubscription page will be used. | [optional] +**updateFormId** | **string** | **Mandatory if templateId is used containing the {{ update_profile }} tag**. Enter an update profile form id. The form id is a 24 digit alphanumeric id that can be found in the URL when editing the form. If not entered, then the default update profile form will be used. | [optional] +**emailExpirationDate** | [**\Brevo\Client\Models\CreateEmailCampaignEmailExpirationDate**](CreateEmailCampaignEmailExpirationDate.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateEmailCampaignEmailExpirationDate.md b/docs/Model/CreateEmailCampaignEmailExpirationDate.md new file mode 100644 index 0000000..29fc1e4 --- /dev/null +++ b/docs/Model/CreateEmailCampaignEmailExpirationDate.md @@ -0,0 +1,10 @@ +# # CreateEmailCampaignEmailExpirationDate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**duration** | **int** | Duration of the email expiry. maximum duration can be 3600 days or 480 weeks or 120 months. | [optional] +**unit** | **string** | unit of the duration | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateEmailCampaignRecipients.md b/docs/Model/CreateEmailCampaignRecipients.md index 3c037ee..f493d5a 100644 --- a/docs/Model/CreateEmailCampaignRecipients.md +++ b/docs/Model/CreateEmailCampaignRecipients.md @@ -1,12 +1,11 @@ -# CreateEmailCampaignRecipients +# # CreateEmailCampaignRecipients ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**exclusionListIds** | **int[]** | List ids to exclude from the campaign | [optional] -**listIds** | **int[]** | Mandatory if scheduledAt is not empty. List Ids to send the campaign to | [optional] -**segmentIds** | **int[]** | Mandatory if listIds are not used. Segment ids to send the campaign to. | [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) - +**exclusionListIds** | **int[]** | List ids to exclude from the campaign | [optional] +**listIds** | **int[]** | **Mandatory if scheduledAt is not empty**. List Ids to send the campaign to | [optional] +**segmentIds** | **int[]** | **Mandatory if listIds are not used**. Segment ids to send the campaign to. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateEmailCampaignSender.md b/docs/Model/CreateEmailCampaignSender.md index 2892c2e..704e95e 100644 --- a/docs/Model/CreateEmailCampaignSender.md +++ b/docs/Model/CreateEmailCampaignSender.md @@ -1,12 +1,11 @@ -# CreateEmailCampaignSender +# # CreateEmailCampaignSender ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | Sender Name | [optional] -**email** | **string** | Sender email | -**id** | **int** | Select the sender for the campaign on the basis of sender id. In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email). | [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) - +**name** | **string** | Sender Name | [optional] +**email** | **string** | Sender email | [optional] +**id** | **int** | Select the sender for the campaign on the basis of sender id. _In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email)_. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateExternalFeed.md b/docs/Model/CreateExternalFeed.md index c86ac9e..cb1c5e7 100644 --- a/docs/Model/CreateExternalFeed.md +++ b/docs/Model/CreateExternalFeed.md @@ -1,18 +1,17 @@ -# CreateExternalFeed +# # CreateExternalFeed ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | Name of the feed | -**url** | **string** | URL of the feed | -**authType** | **string** | Auth type of the feed: * `basic` * `token` * `noAuth` | [optional] [default to 'noAuth'] -**username** | **string** | Username for authType `basic` | [optional] -**password** | **string** | Password for authType `basic` | [optional] -**token** | **string** | Token for authType `token` | [optional] -**headers** | [**\Brevo\Client\Model\GetExternalFeedByUUIDHeaders[]**](GetExternalFeedByUUIDHeaders.md) | Custom headers for the feed | [optional] -**maxRetries** | **int** | Maximum number of retries on the feed url | [optional] +**name** | **string** | Name of the feed | +**url** | **string** | URL of the feed | +**authType** | **string** | Auth type of the feed: * `basic` * `token` * `noAuth` | [optional] [default to 'noAuth'] +**username** | **string** | Username for authType `basic` | [optional] +**password** | **string** | Password for authType `basic` | [optional] +**token** | **string** | Token for authType `token` | [optional] +**headers** | [**\Brevo\Client\Models\GetExternalFeedByUUIDHeadersInner[]**](GetExternalFeedByUUIDHeadersInner.md) | Custom headers for the feed | [optional] +**maxRetries** | **int** | Maximum number of retries on the feed url | [optional] [default to 5] **cache** | **bool** | Toggle caching of feed url response | [optional] [default to false] -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - - +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateExternalFeed201Response.md b/docs/Model/CreateExternalFeed201Response.md new file mode 100644 index 0000000..90f642a --- /dev/null +++ b/docs/Model/CreateExternalFeed201Response.md @@ -0,0 +1,9 @@ +# # CreateExternalFeed201Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | ID of the object created | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateList.md b/docs/Model/CreateList.md index 78c8344..2eae3da 100644 --- a/docs/Model/CreateList.md +++ b/docs/Model/CreateList.md @@ -1,11 +1,10 @@ -# CreateList +# # CreateList ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | Name of 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) - +**name** | **string** | Name of the list | +**folderId** | **int** | Id of the parent folder in which this list is to be created | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateLoyaltyProgramPayload.md b/docs/Model/CreateLoyaltyProgramPayload.md new file mode 100644 index 0000000..511289d --- /dev/null +++ b/docs/Model/CreateLoyaltyProgramPayload.md @@ -0,0 +1,11 @@ +# # CreateLoyaltyProgramPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Loyalty Program name | +**description** | **string** | Loyalty Program description | [optional] +**meta** | **object** | Loyalty Program meta data | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateModel.md b/docs/Model/CreateModel.md index f660732..2ce51d9 100644 --- a/docs/Model/CreateModel.md +++ b/docs/Model/CreateModel.md @@ -1,10 +1,9 @@ -# CreateModel +# # CreateModel ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | ID of the object 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) - +**id** | **int** | ID of the object created | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateOrderPayload.md b/docs/Model/CreateOrderPayload.md new file mode 100644 index 0000000..14feadc --- /dev/null +++ b/docs/Model/CreateOrderPayload.md @@ -0,0 +1,14 @@ +# # CreateOrderPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **float** | Amount of the order | +**dueAt** | **string** | Date and time at which the order needs to be processed | +**contactId** | **float** | Contact id | +**balanceDefinitionId** | **string** | Balance definition id | +**expiresAt** | **string** | Add expiration to the balance credited by the order | [optional] +**meta** | **object** | Additional metadata related to the order. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreatePaymentRequest.md b/docs/Model/CreatePaymentRequest.md new file mode 100644 index 0000000..f51d308 --- /dev/null +++ b/docs/Model/CreatePaymentRequest.md @@ -0,0 +1,14 @@ +# # CreatePaymentRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**reference** | **string** | Reference of the payment request, it will appear on the payment page. | +**cart** | [**\Brevo\Client\Models\Cart**](Cart.md) | | +**contactId** | **int** | Brevo ID of the contact requested to pay. | +**description** | **string** | description of payment request | [optional] +**notification** | [**\Brevo\Client\Models\Notification**](Notification.md) | | [optional] +**configuration** | [**\Brevo\Client\Models\Configuration**](Configuration.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreatePaymentResponse.md b/docs/Model/CreatePaymentResponse.md new file mode 100644 index 0000000..4c23942 --- /dev/null +++ b/docs/Model/CreatePaymentResponse.md @@ -0,0 +1,10 @@ +# # CreatePaymentResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | ID of the object created | +**url** | **string** | URL of the payment request created | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateProductModel.md b/docs/Model/CreateProductModel.md index 38538c5..2b3c3ce 100644 --- a/docs/Model/CreateProductModel.md +++ b/docs/Model/CreateProductModel.md @@ -1,10 +1,9 @@ -# CreateProductModel +# # CreateProductModel ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | ID of the Product when a new product is created | [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) - +**id** | **int** | ID of the Product when a new product is created | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateReseller.md b/docs/Model/CreateReseller.md deleted file mode 100644 index c2a7e84..0000000 --- a/docs/Model/CreateReseller.md +++ /dev/null @@ -1,11 +0,0 @@ -# CreateReseller - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**authKey** | **string** | AuthKey of Reseller child created | -**id** | **int** | Id of Reseller child created | [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/CreateSender.md b/docs/Model/CreateSender.md index d862758..ab5a9af 100644 --- a/docs/Model/CreateSender.md +++ b/docs/Model/CreateSender.md @@ -1,12 +1,11 @@ -# CreateSender +# # CreateSender ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | From Name to use for the sender | -**email** | **string** | From email to use for the sender. A verification email will be sent to this address. | -**ips** | [**\Brevo\Client\Model\CreateSenderIps[]**](CreateSenderIps.md) | Mandatory in case of dedicated IP, IPs to associate to the sender | [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) - +**name** | **string** | From Name to use for the sender | +**email** | **string** | From email to use for the sender. A verification email will be sent to this address. | +**ips** | [**\Brevo\Client\Models\CreateSenderIpsInner[]**](CreateSenderIpsInner.md) | **Mandatory in case of dedicated IP**. IPs to associate to the sender | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateSenderIps.md b/docs/Model/CreateSenderIps.md deleted file mode 100644 index 18c602d..0000000 --- a/docs/Model/CreateSenderIps.md +++ /dev/null @@ -1,12 +0,0 @@ -# CreateSenderIps - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ip** | **string** | Dedicated IP available in your account | -**domain** | **string** | Domain of the IP | -**weight** | **int** | 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. | [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/CreateSenderIpsInner.md b/docs/Model/CreateSenderIpsInner.md new file mode 100644 index 0000000..d5a9b93 --- /dev/null +++ b/docs/Model/CreateSenderIpsInner.md @@ -0,0 +1,11 @@ +# # CreateSenderIpsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ip** | **string** | Dedicated IP available in your account | +**domain** | **string** | Domain of the IP | +**weight** | **int** | 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. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateSenderModel.md b/docs/Model/CreateSenderModel.md index ae4b381..12537be 100644 --- a/docs/Model/CreateSenderModel.md +++ b/docs/Model/CreateSenderModel.md @@ -1,12 +1,11 @@ -# CreateSenderModel +# # CreateSenderModel ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | ID of the Sender created | -**spfError** | **bool** | Status of SPF configuration for the sender (true = SPF not well configured, false = SPF well configured) | [optional] -**dkimError** | **bool** | Status of DKIM configuration for the sender (true = DKIM not well configured, false = DKIM well configured) | [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) - +**id** | **int** | ID of the Sender created | +**spfError** | **bool** | Status of SPF configuration for the sender (true = SPF not well configured, false = SPF well configured) | [optional] +**dkimError** | **bool** | Status of DKIM configuration for the sender (true = DKIM not well configured, false = DKIM well configured) | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateSmsCampaign.md b/docs/Model/CreateSmsCampaign.md index 769bfa1..2b84054 100644 --- a/docs/Model/CreateSmsCampaign.md +++ b/docs/Model/CreateSmsCampaign.md @@ -1,17 +1,16 @@ -# CreateSmsCampaign +# # CreateSmsCampaign ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | Name of the campaign | -**sender** | **string** | Name of the sender. **The number of characters is limited to 11 for alphanumeric characters and 15 for numeric characters** | -**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 | -**recipients** | [**\Brevo\Client\Model\CreateSmsCampaignRecipients**](CreateSmsCampaignRecipients.md) | | [optional] -**scheduledAt** | **string** | 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] +**name** | **string** | Name of the campaign | +**sender** | **string** | Name of the sender. **The number of characters is limited to 11 for alphanumeric characters and 15 for numeric characters** | +**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 | +**recipients** | [**\Brevo\Client\Models\CreateSmsCampaignRecipients**](CreateSmsCampaignRecipients.md) | | [optional] +**scheduledAt** | **string** | 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] **unicodeEnabled** | **bool** | Format of the message. It indicates whether the content should be treated as unicode or not. | [optional] [default to false] -**organisationPrefix** | **string** | A recognizable prefix will ensure your audience knows who you are. Recommended by U.S. carriers. This will be added as your Brand Name before the message content. **Prefer verifying maximum length of 160 characters including this prefix in message content to avoid multiple sending of same sms.** | [optional] -**unsubscribeInstruction** | **string** | Instructions to unsubscribe from future communications. Recommended by U.S. carriers. Must include **STOP** keyword. This will be added as instructions after the end of message content. **Prefer verifying maximum length of 160 characters including this instructions in message content to avoid multiple sending of same sms.** | [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) - +**organisationPrefix** | **string** | A recognizable prefix will ensure your audience knows who you are. Recommended by U.S. carriers. This will be added as your Brand Name before the message content. **Prefer verifying maximum length of 160 characters including this prefix in message content to avoid multiple sending of same sms.** | [optional] +**unsubscribeInstruction** | **string** | Instructions to unsubscribe from future communications. Recommended by U.S. carriers. Must include **STOP** keyword. This will be added as instructions after the end of message content. **Prefer verifying maximum length of 160 characters including this instructions in message content to avoid multiple sending of same sms.** | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateSmsCampaignRecipients.md b/docs/Model/CreateSmsCampaignRecipients.md index fb8799d..863574b 100644 --- a/docs/Model/CreateSmsCampaignRecipients.md +++ b/docs/Model/CreateSmsCampaignRecipients.md @@ -1,11 +1,10 @@ -# CreateSmsCampaignRecipients +# # CreateSmsCampaignRecipients ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**listIds** | **int[]** | Lists Ids to send the campaign to. REQUIRED if scheduledAt is not empty | -**exclusionListIds** | **int[]** | List ids which have to be excluded from a 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) - +**listIds** | **int[]** | Lists Ids to send the campaign to. **REQUIRED if scheduledAt is not empty** | +**exclusionListIds** | **int[]** | List ids which have to be excluded from a campaign | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateSmtpEmail.md b/docs/Model/CreateSmtpEmail.md index 64940e9..2ccf536 100644 --- a/docs/Model/CreateSmtpEmail.md +++ b/docs/Model/CreateSmtpEmail.md @@ -1,11 +1,10 @@ -# CreateSmtpEmail +# # CreateSmtpEmail ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**messageId** | **string** | Message ID of the transactional email sent | [optional] -**messageIds** | **string[]** | | [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) - +**messageId** | **string** | Message ID of the transactional email sent | [optional] +**messageIds** | **string[]** | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateSmtpTemplate.md b/docs/Model/CreateSmtpTemplate.md index 847908f..99a5024 100644 --- a/docs/Model/CreateSmtpTemplate.md +++ b/docs/Model/CreateSmtpTemplate.md @@ -1,19 +1,18 @@ -# CreateSmtpTemplate +# # CreateSmtpTemplate ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**tag** | **string** | Tag of the template | [optional] -**sender** | [**\Brevo\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] -**subject** | **string** | Subject of the template | -**replyTo** | **string** | Email on which campaign recipients will be able to reply to | [optional] -**toField** | **string** | To personalize the «To» Field. If you want to include the first name and last name of your recipient, add {FNAME} {LNAME}. These contact attributes must already exist in your Brevo account. If input parameter 'params' used please use {{contact.FNAME}} {{contact.LNAME}} for personalization | [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 template. isActive = true means template is active and isActive = false means template is inactive | [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) - +**sender** | [**\Brevo\Client\Models\CreateSmtpTemplateSender**](CreateSmtpTemplateSender.md) | | +**templateName** | **string** | Name of the template | +**subject** | **string** | Subject of the template | +**tag** | **string** | Tag of the template | [optional] +**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] +**replyTo** | **string** | Email on which campaign recipients will be able to reply to | [optional] +**toField** | **string** | To personalize the **To** Field. If you want to include the first name and last name of your recipient, add **{FNAME} {LNAME}**. These contact attributes must already exist in your Brevo account. If input parameter **params** used please use **{{contact.FNAME}} {{contact.LNAME}}** for personalization | [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 template. isActive = true means template is active and isActive = false means template is inactive | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateSmtpTemplateSender.md b/docs/Model/CreateSmtpTemplateSender.md index 474ffc3..612eea7 100644 --- a/docs/Model/CreateSmtpTemplateSender.md +++ b/docs/Model/CreateSmtpTemplateSender.md @@ -1,12 +1,11 @@ -# CreateSmtpTemplateSender +# # CreateSmtpTemplateSender ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | Name of the sender. If not passed, will be set to default | [optional] -**email** | **string** | Email of the sender | [optional] -**id** | **int** | Select the sender for the template on the basis of sender id. In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email). | [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) - +**name** | **string** | Name of the sender. **If not passed, will be set to default** | [optional] +**email** | **string** | Email of the sender | [optional] +**id** | **int** | Select the sender for the template on the basis of sender id. _In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email)_. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateSubAccount.md b/docs/Model/CreateSubAccount.md index ae80e64..5030b35 100644 --- a/docs/Model/CreateSubAccount.md +++ b/docs/Model/CreateSubAccount.md @@ -1,13 +1,13 @@ -# CreateSubAccount +# # CreateSubAccount ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**companyName** | **string** | Set the name of the sub-account company | -**email** | **string** | Email address for the organization | -**language** | **string** | Set the language of the sub-account | [optional] -**timezone** | **string** | Set the timezone of the sub-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) - +**companyName** | **string** | Set the name of the sub-account company | +**email** | **string** | Email address for the organization | +**language** | **string** | Set the language of the sub-account | [optional] +**timezone** | **string** | Set the timezone of the sub-account | [optional] +**groupIds** | **string[]** | Set the group(s) for the sub-account | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateSubAccountResponse.md b/docs/Model/CreateSubAccountResponse.md index db5fd6b..d8f7356 100644 --- a/docs/Model/CreateSubAccountResponse.md +++ b/docs/Model/CreateSubAccountResponse.md @@ -1,10 +1,9 @@ -# CreateSubAccountResponse +# # CreateSubAccountResponse ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | ID of the sub-account 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) - +**id** | **int** | ID of the sub-account created | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateSubscriptionMemberPayload.md b/docs/Model/CreateSubscriptionMemberPayload.md new file mode 100644 index 0000000..713e5e9 --- /dev/null +++ b/docs/Model/CreateSubscriptionMemberPayload.md @@ -0,0 +1,11 @@ +# # CreateSubscriptionMemberPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**memberContactIds** | **int[]** | Member Contact Ids | +**contactId** | **int** | One of contact id or loyalty subscription id is required | [optional] +**loyaltySubscriptionId** | **string** | Client Reference | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateSubscriptionMemberResponse.md b/docs/Model/CreateSubscriptionMemberResponse.md new file mode 100644 index 0000000..69f4f19 --- /dev/null +++ b/docs/Model/CreateSubscriptionMemberResponse.md @@ -0,0 +1,13 @@ +# # CreateSubscriptionMemberResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**organizationId** | **int** | Organization Id | [optional] +**ownerContactId** | **int** | Owner Contact Id | [optional] +**memberContactIds** | **int[]** | Member Contact Ids | [optional] +**createdAt** | **\DateTime** | Subscription creation date | [optional] +**updatedAt** | **\DateTime** | Subscription last modification date | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateSubscriptionPayload.md b/docs/Model/CreateSubscriptionPayload.md new file mode 100644 index 0000000..4ceb912 --- /dev/null +++ b/docs/Model/CreateSubscriptionPayload.md @@ -0,0 +1,10 @@ +# # CreateSubscriptionPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**contactId** | **int** | Contact ID | +**loyaltySubscriptionId** | **string** | Loyalty Subscription ID | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateSubscriptionResponse.md b/docs/Model/CreateSubscriptionResponse.md new file mode 100644 index 0000000..eb6c3b4 --- /dev/null +++ b/docs/Model/CreateSubscriptionResponse.md @@ -0,0 +1,15 @@ +# # CreateSubscriptionResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**organizationId** | **int** | Organization ID | [optional] +**loyaltyProgramId** | **string** | Loyalty Program ID | [optional] +**versionId** | **int** | Version ID | [optional] +**contactId** | **int** | Contact ID | [optional] +**loyaltySubscriptionId** | **string** | Loyalty Subscription ID | [optional] +**createdAt** | **\DateTime** | Subscription creation date | [optional] +**updatedAt** | **\DateTime** | Subscription last modification date | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateTierGroupRequest.md b/docs/Model/CreateTierGroupRequest.md new file mode 100644 index 0000000..b470729 --- /dev/null +++ b/docs/Model/CreateTierGroupRequest.md @@ -0,0 +1,11 @@ +# # CreateTierGroupRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of the tier group | [optional] +**upgradeStrategy** | **string** | Select real_time to upgrade tier on real time balance updates. Select anniversary to upgrade tier on subscription anniversary. | [optional] [default to 'real_time'] +**downgradeStrategy** | **string** | Select real_time to downgrade tier on real time balance updates. Select anniversary to downgrade tier on subscription anniversary. | [optional] [default to 'real_time'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateTransactionPayload.md b/docs/Model/CreateTransactionPayload.md new file mode 100644 index 0000000..f3c6dc8 --- /dev/null +++ b/docs/Model/CreateTransactionPayload.md @@ -0,0 +1,13 @@ +# # CreateTransactionPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **float** | Enter positive value for credit transaction and negative value for debit transaction | +**balanceDefinitionId** | **string** | Balance definition id for which the transaction is made | +**contactId** | **float** | Contact id | +**meta** | **object** | Additional metadata related to the transaction. | [optional] +**ttl** | **int** | Time to live for the transaction in seconds. This defines how long the transaction remains valid before it expires. | [optional] [default to 300] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateUpdateBatchCategory.md b/docs/Model/CreateUpdateBatchCategory.md index 1549710..b538ecb 100644 --- a/docs/Model/CreateUpdateBatchCategory.md +++ b/docs/Model/CreateUpdateBatchCategory.md @@ -1,11 +1,10 @@ -# CreateUpdateBatchCategory +# # CreateUpdateBatchCategory ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**categories** | [**\Brevo\Client\Model\CreateUpdateCategories[]**](CreateUpdateCategories.md) | array of categories objects | -**updateEnabled** | **bool** | Facilitate to update the existing categories in the same request (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) - +**categories** | [**\Brevo\Client\Models\CreateUpdateCategories[]**](CreateUpdateCategories.md) | array of categories objects | +**updateEnabled** | **bool** | Facilitate to update the existing categories in the same request (updateEnabled = true) | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateUpdateBatchCategoryModel.md b/docs/Model/CreateUpdateBatchCategoryModel.md index 1934ae9..96957e5 100644 --- a/docs/Model/CreateUpdateBatchCategoryModel.md +++ b/docs/Model/CreateUpdateBatchCategoryModel.md @@ -1,11 +1,10 @@ -# CreateUpdateBatchCategoryModel +# # CreateUpdateBatchCategoryModel ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**createdCount** | **int** | Number of the new created categories | [optional] -**updatedCount** | **int** | Number of the existing categories updated | [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) - +**createdCount** | **int** | Number of the new created categories | [optional] +**updatedCount** | **int** | Number of the existing categories updated | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateUpdateBatchProducts.md b/docs/Model/CreateUpdateBatchProducts.md index 19d9cae..8dda31f 100644 --- a/docs/Model/CreateUpdateBatchProducts.md +++ b/docs/Model/CreateUpdateBatchProducts.md @@ -1,11 +1,10 @@ -# CreateUpdateBatchProducts +# # CreateUpdateBatchProducts ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**products** | [**\Brevo\Client\Model\CreateUpdateProducts[]**](CreateUpdateProducts.md) | array of products objects | -**updateEnabled** | **bool** | Facilitate to update the existing categories in the same request (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) - +**products** | [**\Brevo\Client\Models\CreateUpdateProducts[]**](CreateUpdateProducts.md) | array of products objects | +**updateEnabled** | **bool** | Facilitate to update the existing categories in the same request (updateEnabled = true) | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateUpdateBatchProductsModel.md b/docs/Model/CreateUpdateBatchProductsModel.md index 7b9821c..bf0cffd 100644 --- a/docs/Model/CreateUpdateBatchProductsModel.md +++ b/docs/Model/CreateUpdateBatchProductsModel.md @@ -1,11 +1,10 @@ -# CreateUpdateBatchProductsModel +# # CreateUpdateBatchProductsModel ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**createdCount** | **int** | Number of the new created products | [optional] -**updatedCount** | **int** | Number of the existing products updated | [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) - +**createdCount** | **int** | Number of the new created products | [optional] +**updatedCount** | **int** | Number of the existing products updated | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateUpdateCategories.md b/docs/Model/CreateUpdateCategories.md index b08d1be..494bce4 100644 --- a/docs/Model/CreateUpdateCategories.md +++ b/docs/Model/CreateUpdateCategories.md @@ -1,13 +1,13 @@ -# CreateUpdateCategories +# # CreateUpdateCategories ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Unique Category ID as saved in the shop | -**name** | **string** | **Mandatory in case of creation**. Name of the Category, as displayed in the shop | [optional] -**url** | **string** | URL to the category | [optional] -**deletedAt** | **string** | UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the category deleted from the shop's database | [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) - +**id** | **string** | Unique Category ID as saved in the shop | +**name** | **string** | **Mandatory in case of creation**. Name of the Category, as displayed in the shop | [optional] +**url** | **string** | URL to the category | [optional] +**deletedAt** | **string** | UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the category deleted from the shop's database | [optional] +**isDeleted** | **bool** | category deleted from the shop's database | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateUpdateCategory.md b/docs/Model/CreateUpdateCategory.md index 244ba34..d59bbbf 100644 --- a/docs/Model/CreateUpdateCategory.md +++ b/docs/Model/CreateUpdateCategory.md @@ -1,14 +1,14 @@ -# CreateUpdateCategory +# # CreateUpdateCategory ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Unique Category ID as saved in the shop | -**name** | **string** | **Mandatory in case of creation**. Name of the Category, as displayed in the shop | [optional] -**url** | **string** | URL to the category | [optional] +**id** | **string** | Unique Category ID as saved in the shop | +**name** | **string** | **Mandatory in case of creation**. Name of the Category, as displayed in the shop | [optional] +**url** | **string** | URL to the category | [optional] **updateEnabled** | **bool** | Facilitate to update the existing category in the same request (updateEnabled = true) | [optional] [default to false] -**deletedAt** | **string** | UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the category deleted from the shop's database | [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) - +**deletedAt** | **string** | UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the category deleted from the shop's database | [optional] +**isDeleted** | **bool** | category deleted from the shop's database | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateUpdateContactModel.md b/docs/Model/CreateUpdateContactModel.md index 1fbb07c..8f5c10a 100644 --- a/docs/Model/CreateUpdateContactModel.md +++ b/docs/Model/CreateUpdateContactModel.md @@ -1,10 +1,9 @@ -# CreateUpdateContactModel +# # CreateUpdateContactModel ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | ID of the contact when a new contact is created | [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) - +**id** | **int** | ID of the contact when a new contact is created | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateUpdateFolder.md b/docs/Model/CreateUpdateFolder.md index 0a4d2e0..781e6c8 100644 --- a/docs/Model/CreateUpdateFolder.md +++ b/docs/Model/CreateUpdateFolder.md @@ -1,10 +1,9 @@ -# CreateUpdateFolder +# # CreateUpdateFolder ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | Name of the folder | [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) - +**name** | **string** | Name of the folder | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateUpdateProducts.md b/docs/Model/CreateUpdateProducts.md index 49b848b..1b69e01 100644 --- a/docs/Model/CreateUpdateProducts.md +++ b/docs/Model/CreateUpdateProducts.md @@ -1,19 +1,19 @@ -# CreateUpdateProducts +# # CreateUpdateProducts ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Product ID for which you requested the details | -**name** | **string** | Mandatory in case of creation**. Name of the product for which you requested the details | -**url** | **string** | URL to the product | [optional] -**imageUrl** | **string** | Absolute URL to the cover image of the product | [optional] -**sku** | **string** | Product identifier from the shop | [optional] -**price** | **float** | Price of the product | [optional] -**categories** | **string[]** | Category ID-s of the product | [optional] -**parentId** | **string** | Parent product id of the product | [optional] -**metaInfo** | **map[string,string]** | Meta data of product such as description, vendor, producer, stock level. The size of cumulative metaInfo shall not exceed **1000 KB**. Maximum length of metaInfo object can be 10. | [optional] -**deletedAt** | **string** | UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the product deleted from the shop's database | [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) - +**id** | **string** | Product ID for which you requested the details | +**name** | **string** | Mandatory in case of creation**. Name of the product for which you requested the details | +**url** | **string** | URL to the product | [optional] +**imageUrl** | **string** | Absolute URL to the cover image of the product | [optional] +**sku** | **string** | Product identifier from the shop | [optional] +**price** | **float** | Price of the product | [optional] +**categories** | **string[]** | Category ID-s of the product | [optional] +**parentId** | **string** | Parent product id of the product | [optional] +**metaInfo** | [**array**](GetContactInfoIdentifierParameter.md) | Meta data of product such as description, vendor, producer, stock level. The size of cumulative metaInfo shall not exceed **1000 KB**. Maximum length of metaInfo object can be 10. | [optional] +**deletedAt** | **string** | UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the product deleted from the shop's database | [optional] +**isDeleted** | **bool** | product deleted from the shop's database | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateUpdateproduct.md b/docs/Model/CreateUpdateproduct.md index 8890bf3..83937a3 100644 --- a/docs/Model/CreateUpdateproduct.md +++ b/docs/Model/CreateUpdateproduct.md @@ -1,20 +1,20 @@ -# CreateUpdateProduct +# # CreateUpdateProduct ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Product ID for which you requested the details | -**name** | **string** | Mandatory in case of creation**. Name of the product for which you requested the details | -**url** | **string** | URL to the product | [optional] -**imageUrl** | **string** | Absolute URL to the cover image of the product | [optional] -**sku** | **string** | Product identifier from the shop | [optional] -**price** | **float** | Price of the product | [optional] -**categories** | **string[]** | Category ID-s of the product | [optional] -**parentId** | **string** | Parent product id of the product | [optional] -**metaInfo** | **map[string,string]** | Meta data of product such as description, vendor, producer, stock level. The size of cumulative metaInfo shall not exceed **1000 KB**. Maximum length of metaInfo object can be 10. | [optional] +**id** | **string** | Product ID for which you requested the details | +**name** | **string** | Mandatory in case of creation**. Name of the product for which you requested the details | +**url** | **string** | URL to the product | [optional] +**imageUrl** | **string** | Absolute URL to the cover image of the product | [optional] +**sku** | **string** | Product identifier from the shop | [optional] +**price** | **float** | Price of the product | [optional] +**categories** | **string[]** | Category ID-s of the product | [optional] +**parentId** | **string** | Parent product id of the product | [optional] +**metaInfo** | [**array**](GetContactInfoIdentifierParameter.md) | Meta data of product such as description, vendor, producer, stock level. The size of cumulative metaInfo shall not exceed **1000 KB**. Maximum length of metaInfo object can be 10. | [optional] **updateEnabled** | **bool** | Facilitate to update the existing category in the same request (updateEnabled = true) | [optional] [default to false] -**deletedAt** | **string** | UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the product deleted from the shop's database | [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) - +**deletedAt** | **string** | UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the product deleted from the shop's database | [optional] +**isDeleted** | **bool** | product deleted from the shop's database | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateWebhook.md b/docs/Model/CreateWebhook.md index e2d77b9..2f86f2e 100644 --- a/docs/Model/CreateWebhook.md +++ b/docs/Model/CreateWebhook.md @@ -1,17 +1,16 @@ -# CreateWebhook +# # CreateWebhook ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**url** | **string** | URL of the webhook | -**description** | **string** | Description of the webhook | [optional] -**events** | **string[]** | - Events triggering the webhook. Possible values for **Transactional** type webhook: #### `sent` OR `request`, `delivered`, `hardBounce`, `softBounce`, `blocked`, `spam`, `invalid`, `deferred`, `click`, `opened`, `uniqueOpened` and `unsubscribed` - Possible values for **Marketing** type webhook: #### `spam`, `opened`, `click`, `hardBounce`, `softBounce`, `unsubscribed`, `listAddition` & `delivered` - Possible values for **Inbound** type webhook: #### `inboundEmailProcessed` | +**url** | **string** | URL of the webhook | +**events** | **string[]** | - Events triggering the webhook. Possible values for **Transactional** type webhook: #### `sent` OR `request`, `delivered`, `hardBounce`, `softBounce`, `blocked`, `spam`, `invalid`, `deferred`, `click`, `opened`, `uniqueOpened` and `unsubscribed` - Possible values for **Marketing** type webhook: #### `spam`, `opened`, `click`, `hardBounce`, `softBounce`, `unsubscribed`, `listAddition` & `delivered` - Possible values for **Inbound** type webhook: #### `inboundEmailProcessed` | +**description** | **string** | Description of the webhook | [optional] **type** | **string** | Type of the webhook | [optional] [default to 'transactional'] -**domain** | **string** | Inbound domain of webhook, required in case of event type `inbound` | [optional] -**batched** | **bool** | To send batched webhooks | [optional] -**auth** | [**\Brevo\Client\Model\GetWebhookAuth**](GetWebhookAuth.md) | | [optional] -**headers** | [**\Brevo\Client\Model\GetWebhookHeaders[]**](GetWebhookHeaders.md) | Custom headers to be send with webhooks | [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) - +**domain** | **string** | Inbound domain of webhook, required in case of event type `inbound` | [optional] +**batched** | **bool** | Batching configuration of the webhook, we send batched webhooks if its true | [optional] +**auth** | **object** | Authentication header to be send with the webhook requests | [optional] +**headers** | **object[]** | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateWhatsAppCampaign.md b/docs/Model/CreateWhatsAppCampaign.md index 75ea401..9a489d5 100644 --- a/docs/Model/CreateWhatsAppCampaign.md +++ b/docs/Model/CreateWhatsAppCampaign.md @@ -1,13 +1,12 @@ -# CreateWhatsAppCampaign +# # CreateWhatsAppCampaign ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | Name of the WhatsApp campaign creation | -**templateId** | **int** | Id of the WhatsApp template in **approved** state | -**scheduledAt** | **string** | Sending UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.For example: **2017-06-01T12:30:00+02:00** | -**recipients** | [**\Brevo\Client\Model\CreateWhatsAppCampaignRecipients**](CreateWhatsAppCampaignRecipients.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) - +**name** | **string** | Name of the WhatsApp campaign creation | +**templateId** | **int** | Id of the WhatsApp template in **approved** state | +**scheduledAt** | **string** | Sending UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.For example: **2017-06-01T12:30:00+02:00** | +**recipients** | [**\Brevo\Client\Models\CreateWhatsAppCampaignRecipients**](CreateWhatsAppCampaignRecipients.md) | | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateWhatsAppCampaignRecipients.md b/docs/Model/CreateWhatsAppCampaignRecipients.md index 95d274f..51e859c 100644 --- a/docs/Model/CreateWhatsAppCampaignRecipients.md +++ b/docs/Model/CreateWhatsAppCampaignRecipients.md @@ -1,12 +1,11 @@ -# CreateWhatsAppCampaignRecipients +# # CreateWhatsAppCampaignRecipients ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**excludedListIds** | **int[]** | List ids to exclude from the campaign | [optional] -**listIds** | **int[]** | **Mandatory if scheduledAt is not empty**. List Ids to send the campaign to | [optional] -**segments** | **int[]** | **Mandatory if listIds are not used**. Segment ids to send the campaign to. | [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) - +**excludedListIds** | **int[]** | List ids to exclude from the campaign | [optional] +**listIds** | **int[]** | **Mandatory if scheduledAt is not empty**. List Ids to send the campaign to | [optional] +**segments** | **int[]** | **Mandatory if listIds are not used**. Segment ids to send the campaign to. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateWhatsAppTemplate.md b/docs/Model/CreateWhatsAppTemplate.md index 5b14eae..b69397d 100644 --- a/docs/Model/CreateWhatsAppTemplate.md +++ b/docs/Model/CreateWhatsAppTemplate.md @@ -1,16 +1,15 @@ -# CreateWhatsAppTemplate +# # CreateWhatsAppTemplate ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | Name of the template | -**language** | **string** | Language of the template. For Example : **en** for English | -**category** | **string** | Category of the template | -**mediaUrl** | **string** | Absolute url of the media file **(no local file)** for the header. **Use this field in you want to add media in Template header and headerText is empty.** Allowed extensions for media files are: #### jpeg | png | mp4 | pdf | [optional] -**bodyText** | **string** | Body of the template. **Maximum allowed characters are 1024** | -**headerText** | **string** | Text content of the header in the template. **Maximum allowed characters are 45** **Use this field to add text content in template header and if mediaUrl is empty** | [optional] -**source** | **string** | source of the template | [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) - - +**name** | **string** | Name of the template | +**language** | **string** | Language of the template. For Example : **en** for English | +**category** | **string** | Category of the template | +**bodyText** | **string** | Body of the template. **Maximum allowed characters are 1024** | +**mediaUrl** | **string** | Absolute url of the media file **(no local file)** for the header. **Use this field in you want to add media in Template header and headerText is empty**. Allowed extensions for media files are: #### jpeg | png | mp4 | pdf | [optional] +**headerText** | **string** | Text content of the header in the template. **Maximum allowed characters are 45** **Use this field to add text content in template header and if mediaUrl is empty** | [optional] +**source** | **string** | source of the template | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreatedBatchId.md b/docs/Model/CreatedBatchId.md index 6007b70..4758aeb 100644 --- a/docs/Model/CreatedBatchId.md +++ b/docs/Model/CreatedBatchId.md @@ -1,10 +1,10 @@ -# CreatedBatchId +# # CreatedBatchId ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**batchId** | **float** | Batch ID of the request | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**batchId** | **float** | Batch ID of the request | +**count** | **int** | Number of orders | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreatedProcessId.md b/docs/Model/CreatedProcessId.md index 06151d3..c51b0f2 100644 --- a/docs/Model/CreatedProcessId.md +++ b/docs/Model/CreatedProcessId.md @@ -1,10 +1,9 @@ -# CreatedProcessId +# # CreatedProcessId ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**processId** | **int** | Id of the process 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) - +**processId** | **int** | Id of the process created | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CrmDealsIdPatchRequest.md b/docs/Model/CrmDealsIdPatchRequest.md new file mode 100644 index 0000000..3b94f7d --- /dev/null +++ b/docs/Model/CrmDealsIdPatchRequest.md @@ -0,0 +1,10 @@ +# # CrmDealsIdPatchRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of deal | [optional] +**attributes** | **object** | Attributes for deal update To assign owner of a Deal you can send attributes.deal_owner and utilize the account email or ID. If you wish to update the pipeline of a deal you need to provide the `pipeline` and the `deal_stage` Pipeline and deal_stage are ids you can fetch using this endpoint `/crm/pipeline/details/{pipelineID}` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Body7.md b/docs/Model/CrmDealsLinkUnlinkIdPatchRequest.md similarity index 55% rename from docs/Model/Body7.md rename to docs/Model/CrmDealsLinkUnlinkIdPatchRequest.md index 409dc33..2f3ac7f 100644 --- a/docs/Model/Body7.md +++ b/docs/Model/CrmDealsLinkUnlinkIdPatchRequest.md @@ -1,13 +1,12 @@ -# Body7 +# # CrmDealsLinkUnlinkIdPatchRequest ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**linkContactIds** | **int[]** | Contact ids for contacts to be linked with deal | [optional] -**unlinkContactIds** | **int[]** | Contact ids for contacts to be unlinked from deal | [optional] -**linkCompanyIds** | **string[]** | Company ids to be linked with deal | [optional] -**unlinkCompanyIds** | **string[]** | Company ids to be unlinked from deal | [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) - +**linkContactIds** | **int[]** | Contact ids for contacts to be linked with deal | [optional] +**unlinkContactIds** | **int[]** | Contact ids for contacts to be unlinked from deal | [optional] +**linkCompanyIds** | **string[]** | Company ids to be linked with deal | [optional] +**unlinkCompanyIds** | **string[]** | Company ids to be unlinked from deal | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CrmDealsPost201Response.md b/docs/Model/CrmDealsPost201Response.md new file mode 100644 index 0000000..343bf85 --- /dev/null +++ b/docs/Model/CrmDealsPost201Response.md @@ -0,0 +1,9 @@ +# # CrmDealsPost201Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique deal id | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CrmDealsPostRequest.md b/docs/Model/CrmDealsPostRequest.md new file mode 100644 index 0000000..09020e2 --- /dev/null +++ b/docs/Model/CrmDealsPostRequest.md @@ -0,0 +1,12 @@ +# # CrmDealsPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of deal | +**attributes** | **object** | Attributes for deal creation To assign owner of a Deal you can send attributes.deal_owner and utilize the account email or ID. If you want to create a deal on a specific pipeline and stage you can use the following attributes `pipeline` and `deal_stage`. Pipeline and deal_stage are ids you can fetch using this endpoint `/crm/pipeline/details/{pipelineID}` | [optional] +**linkedContactsIds** | **int[]** | Contact ids to be linked with deal | [optional] +**linkedCompaniesIds** | **string[]** | Company ids to be linked with deal | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CrmTasksIdPatchRequest.md b/docs/Model/CrmTasksIdPatchRequest.md new file mode 100644 index 0000000..22385a7 --- /dev/null +++ b/docs/Model/CrmTasksIdPatchRequest.md @@ -0,0 +1,19 @@ +# # CrmTasksIdPatchRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of task | [optional] +**duration** | **int** | Duration of task in milliseconds [1 minute = 60000 ms] | [optional] +**taskTypeId** | **string** | Id for type of task e.g Call / Email / Meeting etc. | [optional] +**date** | **\DateTime** | Task date/time | [optional] +**notes** | **string** | Notes added to a task | [optional] +**done** | **bool** | Task marked as done | [optional] +**assignToId** | **string** | To assign a task to a user you can use either the account email or ID. | [optional] +**contactsIds** | **int[]** | Contact ids for contacts linked to this task | [optional] +**dealsIds** | **string[]** | Deal ids for deals a task is linked to | [optional] +**companiesIds** | **string[]** | Companies ids for companies a task is linked to | [optional] +**reminder** | [**\Brevo\Client\Models\TaskReminder**](TaskReminder.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CrmTasksPost201Response.md b/docs/Model/CrmTasksPost201Response.md new file mode 100644 index 0000000..203ffc4 --- /dev/null +++ b/docs/Model/CrmTasksPost201Response.md @@ -0,0 +1,9 @@ +# # CrmTasksPost201Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique task id | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CrmTasksPostRequest.md b/docs/Model/CrmTasksPostRequest.md new file mode 100644 index 0000000..3522ebc --- /dev/null +++ b/docs/Model/CrmTasksPostRequest.md @@ -0,0 +1,19 @@ +# # CrmTasksPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of task | +**taskTypeId** | **string** | Id for type of task e.g Call / Email / Meeting etc. | +**date** | **\DateTime** | Task due date and time | +**duration** | **int** | Duration of task in milliseconds [1 minute = 60000 ms] | [optional] +**notes** | **string** | Notes added to a task | [optional] +**done** | **bool** | Task marked as done | [optional] +**assignToId** | **string** | To assign a task to a user you can use either the account email or ID. | [optional] +**contactsIds** | **int[]** | Contact ids for contacts linked to this task | [optional] +**dealsIds** | **string[]** | Deal ids for deals a task is linked to | [optional] +**companiesIds** | **string[]** | Companies ids for companies a task is linked to | [optional] +**reminder** | [**\Brevo\Client\Models\TaskReminder**](TaskReminder.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Deal.md b/docs/Model/Deal.md index 7900025..7d8428a 100644 --- a/docs/Model/Deal.md +++ b/docs/Model/Deal.md @@ -1,13 +1,12 @@ -# Deal +# # Deal ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Unique deal id | [optional] -**attributes** | **object** | Deal attributes with values | [optional] -**linkedContactsIds** | **int[]** | Contact ids for contacts linked to this deal | [optional] -**linkedCompaniesIds** | **string[]** | Companies ids for companies linked to this deal | [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) - +**id** | **string** | Unique deal id | [optional] +**attributes** | **object** | Deal attributes with values | [optional] +**linkedContactsIds** | **int[]** | Contact ids for contacts linked to this deal | [optional] +**linkedCompaniesIds** | **string[]** | Companies ids for companies linked to this deal | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/DealAttributes.md b/docs/Model/DealAttributes.md deleted file mode 100644 index f8ee78d..0000000 --- a/docs/Model/DealAttributes.md +++ /dev/null @@ -1,9 +0,0 @@ -# DealAttributes - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/DealAttributesInner.md b/docs/Model/DealAttributesInner.md index 5e8e2cb..eec6fa8 100644 --- a/docs/Model/DealAttributesInner.md +++ b/docs/Model/DealAttributesInner.md @@ -1,14 +1,13 @@ -# DealAttributesInner +# # DealAttributesInner ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**internalName** | **string** | | [optional] -**label** | **string** | | [optional] -**attributeTypeName** | **string** | | [optional] -**attributeOptions** | **object[]** | | [optional] -**isRequired** | **bool** | | [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) - +**internalName** | **string** | | [optional] +**label** | **string** | | [optional] +**attributeTypeName** | **string** | | [optional] +**attributeOptions** | **object[]** | | [optional] +**isRequired** | **bool** | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/DealsList.md b/docs/Model/DealsList.md index f76bcc1..49ada78 100644 --- a/docs/Model/DealsList.md +++ b/docs/Model/DealsList.md @@ -1,10 +1,9 @@ -# DealsList +# # DealsList ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**items** | [**\Brevo\Client\Model\Deal[]**](Deal.md) | List of deals | [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) - +**items** | [**\Brevo\Client\Models\Deal[]**](Deal.md) | List of deals | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/DeleteHardbounces.md b/docs/Model/DeleteHardbounces.md index e726299..13ade4c 100644 --- a/docs/Model/DeleteHardbounces.md +++ b/docs/Model/DeleteHardbounces.md @@ -1,12 +1,11 @@ -# DeleteHardbounces +# # DeleteHardbounces ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**startDate** | **string** | 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** | **string** | 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) - +**startDate** | **string** | 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** | **string** | 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#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/DeleteSubscriptionMemberPayload.md b/docs/Model/DeleteSubscriptionMemberPayload.md new file mode 100644 index 0000000..587ecc1 --- /dev/null +++ b/docs/Model/DeleteSubscriptionMemberPayload.md @@ -0,0 +1,10 @@ +# # DeleteSubscriptionMemberPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**contactId** | **int** | Contact Id | [default to 1] +**memberContactIds** | **int[]** | Member Contact Ids | [default to [2]] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response.md b/docs/Model/EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response.md new file mode 100644 index 0000000..d6c7c8e --- /dev/null +++ b/docs/Model/EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response.md @@ -0,0 +1,14 @@ +# # EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **float** | | +**conversionSource** | **string** | | +**ordersCount** | **float** | | +**revenue** | **float** | | +**averageBasket** | **float** | | +**newCustomersCount** | **float** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EcommerceAttributionMetricsGet200Response.md b/docs/Model/EcommerceAttributionMetricsGet200Response.md new file mode 100644 index 0000000..67c1c54 --- /dev/null +++ b/docs/Model/EcommerceAttributionMetricsGet200Response.md @@ -0,0 +1,10 @@ +# # EcommerceAttributionMetricsGet200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**results** | [**\Brevo\Client\Models\ConversionSourceMetrics[]**](ConversionSourceMetrics.md) | List of conversion attribution metrics | +**totals** | [**\Brevo\Client\Models\EcommerceAttributionMetricsGet200ResponseTotals**](EcommerceAttributionMetricsGet200ResponseTotals.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EcommerceAttributionMetricsGet200ResponseTotals.md b/docs/Model/EcommerceAttributionMetricsGet200ResponseTotals.md new file mode 100644 index 0000000..70bd8e6 --- /dev/null +++ b/docs/Model/EcommerceAttributionMetricsGet200ResponseTotals.md @@ -0,0 +1,11 @@ +# # EcommerceAttributionMetricsGet200ResponseTotals + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ordersCount** | **float** | | +**revenue** | **float** | | +**averageBasket** | **float** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response.md b/docs/Model/EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response.md new file mode 100644 index 0000000..1b72ceb --- /dev/null +++ b/docs/Model/EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response.md @@ -0,0 +1,9 @@ +# # EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**products** | [**\Brevo\Client\Models\ConversionSourceProduct[]**](ConversionSourceProduct.md) | List of attributed products | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EcommerceConfigDisplayCurrencyGet200Response.md b/docs/Model/EcommerceConfigDisplayCurrencyGet200Response.md new file mode 100644 index 0000000..80ec672 --- /dev/null +++ b/docs/Model/EcommerceConfigDisplayCurrencyGet200Response.md @@ -0,0 +1,9 @@ +# # EcommerceConfigDisplayCurrencyGet200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **string** | ISO 4217 compliant display currency code | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EmailExportRecipients.md b/docs/Model/EmailExportRecipients.md index c039748..b60cdd8 100644 --- a/docs/Model/EmailExportRecipients.md +++ b/docs/Model/EmailExportRecipients.md @@ -1,11 +1,10 @@ -# EmailExportRecipients +# # EmailExportRecipients ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**notifyURL** | **string** | Webhook called once the export process is finished. For reference, https://help.brevo.com/hc/en-us/articles/360007666479 | [optional] -**recipientsType** | **string** | Type of recipients to export for a 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) - +**recipientsType** | **string** | Type of recipients to export for a campaign | +**notifyURL** | **string** | Webhook called once the export process is finished. For reference, https://help.brevo.com/hc/en-us/articles/360007666479 | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorModel.md b/docs/Model/ErrorModel.md index 697c3ca..7f3da11 100644 --- a/docs/Model/ErrorModel.md +++ b/docs/Model/ErrorModel.md @@ -1,11 +1,10 @@ -# ErrorModel +# # ErrorModel ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**code** | **string** | Error code displayed in case of a failure | -**message** | **string** | Readable message associated to the failure | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**code** | **string** | Error code displayed in case of a failure | +**message** | **string** | Readable message associated to the failure | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorResponse.md b/docs/Model/ErrorResponse.md new file mode 100644 index 0000000..1febd47 --- /dev/null +++ b/docs/Model/ErrorResponse.md @@ -0,0 +1,9 @@ +# # ErrorResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | **string** | Error message indicating what went wrong | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Event.md b/docs/Model/Event.md index 959614d..c428d58 100644 --- a/docs/Model/Event.md +++ b/docs/Model/Event.md @@ -1,14 +1,13 @@ -# Event +# # Event ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**eventName** | **string** | The name of the event that occurred. This is how you will find your event in Brevo. Limited to 255 characters, alphanumerical characters and - _ only. | -**eventDate** | **string** | Timestamp of when the event occurred (e.g. \"2024-01-24T17:39:57+01:00\"). If no value is passed, the timestamp of the event creation is used. | [optional] -**identifiers** | [**\Brevo\Client\Model\EventIdentifiers**](EventIdentifiers.md) | | -**contactProperties** | **object** | Properties defining the state of the contact associated to this event. Useful to update contact attributes defined in your contacts database while passing the event. For example: **\"FIRSTNAME\": \"Jane\" , \"AGE\": 37** | [optional] -**eventProperties** | **object** | Properties of the event. Top level properties and nested properties can be used to better segment contacts and personalise workflow conditions. The following field type are supported: string, number, boolean (true/false), date (Timestamp e.g. \"2024-01-24T17:39:57+01:00\"). Keys are limited to 255 characters, alphanumerical characters and - _ only. Size is limited to 50Kb. | [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) - +**eventName** | **string** | The name of the event that occurred. This is how you will find your event in Brevo. Limited to 255 characters, alphanumerical characters and - _ only. | +**identifiers** | [**\Brevo\Client\Models\EventIdentifiers**](EventIdentifiers.md) | | +**eventDate** | **string** | Timestamp of when the event occurred (e.g. \"2024-01-24T17:39:57+01:00\"). If no value is passed, the timestamp of the event creation is used. | [optional] +**contactProperties** | [**array**](EventContactPropertiesValue.md) | Properties defining the state of the contact associated to this event. Useful to update contact attributes defined in your contacts database while passing the event. For example: **\"FIRSTNAME\": \"Jane\" , \"AGE\": 37** | [optional] +**eventProperties** | [**array**](EventEventPropertiesValue.md) | Properties of the event. Top level properties and nested properties can be used to better segment contacts and personalise workflow conditions. The following field type are supported: string, number, boolean (true/false), date (Timestamp e.g. \"2024-01-24T17:39:57+01:00\"). Keys are limited to 255 characters, alphanumerical characters and - _ only. Size is limited to 50Kb. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EventContactPropertiesValue.md b/docs/Model/EventContactPropertiesValue.md new file mode 100644 index 0000000..0e9ca93 --- /dev/null +++ b/docs/Model/EventContactPropertiesValue.md @@ -0,0 +1,8 @@ +# # EventContactPropertiesValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EventEventPropertiesValue.md b/docs/Model/EventEventPropertiesValue.md new file mode 100644 index 0000000..64be187 --- /dev/null +++ b/docs/Model/EventEventPropertiesValue.md @@ -0,0 +1,8 @@ +# # EventEventPropertiesValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EventIdentifiers.md b/docs/Model/EventIdentifiers.md index f515fb9..6beb5c7 100644 --- a/docs/Model/EventIdentifiers.md +++ b/docs/Model/EventIdentifiers.md @@ -1,14 +1,13 @@ -# EventIdentifiers +# # EventIdentifiers ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**emailId** | **string** | Email Id associated with the event | [optional] -**phoneId** | **string** | SMS associated with the event | [optional] -**whatsappId** | **string** | whatsapp associated with the event | [optional] -**landlineNumberId** | **string** | landline_number associated with the event | [optional] -**extId** | **string** | ext_id associated with the event | [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) - +**emailId** | **string** | Email Id associated with the event | [optional] +**phoneId** | **string** | SMS associated with the event | [optional] +**whatsappId** | **string** | whatsapp associated with the event | [optional] +**landlineNumberId** | **string** | landline_number associated with the event | [optional] +**extId** | **string** | ext_id associated with the event | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ExportWebhooksHistory.md b/docs/Model/ExportWebhooksHistory.md index c9b81fa..e5b7cbb 100644 --- a/docs/Model/ExportWebhooksHistory.md +++ b/docs/Model/ExportWebhooksHistory.md @@ -1,19 +1,18 @@ -# ExportWebhooksHistory +# # ExportWebhooksHistory ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**days** | **int** | Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ | [optional] -**startDate** | **string** | Mandatory if endDate is used. Starting date of the history (YYYY-MM-DD). Must be lower than equal to endDate | [optional] -**endDate** | **string** | Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate | [optional] -**sort** | **string** | Sorting order of records (asc or desc) | [optional] -**type** | **string** | Filter the history based on webhook type | -**event** | **string** | Filter the history for a specific event type | -**notifyURL** | **string** | Webhook URL to receive CSV file link | -**webhookId** | **int** | Filter the history for a specific webhook id | [optional] -**email** | **string** | Filter the history for a specific email | [optional] -**messageId** | **int** | Filter the history for a specific message id. Applicable only for transactional webhooks. | [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) - +**type** | **string** | Filter the history based on webhook type | +**event** | **string** | Filter the history for a specific event type | +**notifyURL** | **string** | Webhook URL to receive CSV file link | +**days** | **int** | Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ | [optional] +**startDate** | **string** | Mandatory if endDate is used. Starting date of the history (YYYY-MM-DD). Must be lower than equal to endDate | [optional] +**endDate** | **string** | Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate | [optional] +**sort** | **string** | Sorting order of records (asc or desc) | [optional] +**webhookId** | **int** | Filter the history for a specific webhook id | [optional] +**email** | **string** | Filter the history for a specific email | [optional] +**messageId** | **int** | Filter the history for a specific message id. Applicable only for transactional webhooks. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ExportWebhooksHistoryRequest.md b/docs/Model/ExportWebhooksHistoryRequest.md new file mode 100644 index 0000000..e0cc02c --- /dev/null +++ b/docs/Model/ExportWebhooksHistoryRequest.md @@ -0,0 +1,18 @@ +# # ExportWebhooksHistoryRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | Filter the history based on webhook type | +**event** | **string** | Filter the history for a specific event type | +**notifyURL** | **string** | Webhook URL to receive CSV file link | +**days** | **int** | Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ | [optional] +**startDate** | **string** | Mandatory if endDate is used. Starting date of the history (YYYY-MM-DD). Must be lower than equal to endDate | [optional] +**endDate** | **string** | Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate | [optional] +**sort** | **string** | Sorting order of records (asc or desc) | [optional] +**webhookId** | **int** | Filter the history for a specific webhook id | [optional] +**email** | **string** | Filter the history for a specific email | [optional] +**messageId** | **int** | Filter the history for a specific message id. Applicable only for transactional webhooks. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FileData.md b/docs/Model/FileData.md index 8e87a73..a36c3c0 100644 --- a/docs/Model/FileData.md +++ b/docs/Model/FileData.md @@ -1,19 +1,15 @@ -# FileData +# # FileData ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**url** | **string** | Url of uploaded file | [optional] -**id** | **string** | Id of uploaded file | [optional] -**name** | **string** | Name of uploaded file | [optional] -**authorId** | **string** | Account id of user which created the file | [optional] -**author** | **object** | Account details of user which created the file | [optional] -**contactId** | **int** | Contact id of contact on which file is uploaded | [optional] -**dealId** | **string** | Deal id linked to a file | [optional] -**companyId** | **string** | Company id linked to a file | [optional] -**size** | **int** | Size of file in bytes | [optional] -**createdAt** | [**\DateTime**] | File created date/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) - - +**name** | **string** | Name of uploaded file | [optional] +**authorId** | **string** | Account id of user which created the file | [optional] +**contactId** | **int** | Contact id of contact on which file is uploaded | [optional] +**dealId** | **string** | Deal id linked to a file | [optional] +**companyId** | **string** | Company id linked to a file | [optional] +**size** | **int** | Size of file in bytes | [optional] +**createdAt** | **\DateTime** | File created date/time | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FileDownloadableLink.md b/docs/Model/FileDownloadableLink.md index 5e30ce3..6e674d8 100644 --- a/docs/Model/FileDownloadableLink.md +++ b/docs/Model/FileDownloadableLink.md @@ -1,10 +1,9 @@ -# FileDownloadableLink +# # FileDownloadableLink ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**fileUrl** | **string** | A unique link to download the requested file. | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**fileUrl** | **string** | A unique link to download the requested file. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FileList.md b/docs/Model/FileList.md deleted file mode 100644 index beb2b81..0000000 --- a/docs/Model/FileList.md +++ /dev/null @@ -1,9 +0,0 @@ -# FileList - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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 7ab8a70..2873277 100644 --- a/docs/Model/GetAccount.md +++ b/docs/Model/GetAccount.md @@ -1,12 +1,16 @@ -# GetAccount +# # GetAccount ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**plan** | [**\Brevo\Client\Model\GetAccountPlan[]**](GetAccountPlan.md) | Information about your plans and credits | -**relay** | [**\Brevo\Client\Model\GetAccountRelay**](GetAccountRelay.md) | | -**marketingAutomation** | [**\Brevo\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) - +**email** | **string** | Login Email | +**firstName** | **string** | First Name | +**lastName** | **string** | Last Name | +**companyName** | **string** | Name of the company | +**address** | [**\Brevo\Client\Models\GetExtendedClientAllOfAddress**](GetExtendedClientAllOfAddress.md) | | +**plan** | [**\Brevo\Client\Models\GetAccountAllOfPlan[]**](GetAccountAllOfPlan.md) | Information about your plans and credits | +**relay** | [**\Brevo\Client\Models\GetAccountAllOfRelay**](GetAccountAllOfRelay.md) | | +**marketingAutomation** | [**\Brevo\Client\Models\GetAccountAllOfMarketingAutomation**](GetAccountAllOfMarketingAutomation.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetAccountActivity.md b/docs/Model/GetAccountActivity.md index 67b5955..7c82b8d 100644 --- a/docs/Model/GetAccountActivity.md +++ b/docs/Model/GetAccountActivity.md @@ -1,10 +1,9 @@ -# GetAccountActivity +# # GetAccountActivity ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**logs** | [**\Brevo\Client\Model\GetAccountActivityLogs[]**](GetAccountActivityLogs.md) | Get user activity logs | [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) - +**logs** | [**\Brevo\Client\Models\GetAccountActivityLogsInner[]**](GetAccountActivityLogsInner.md) | Get user activity logs | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetAccountActivityLogs.md b/docs/Model/GetAccountActivityLogs.md deleted file mode 100644 index 061aac8..0000000 --- a/docs/Model/GetAccountActivityLogs.md +++ /dev/null @@ -1,14 +0,0 @@ -# GetAccountActivityLogs - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**action** | **string** | Type of activity in the account. | -**date** | **string** | Time of the activity. | -**userEmail** | **string** | Email address of the user who performed activity in the account. | -**userIp** | **string** | IP address of the user who performed activity in the account. | -**userAgent** | **string** | Browser details of the user who performed the activity. | - -[[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/GetAccountActivityLogsInner.md b/docs/Model/GetAccountActivityLogsInner.md new file mode 100644 index 0000000..1bdd670 --- /dev/null +++ b/docs/Model/GetAccountActivityLogsInner.md @@ -0,0 +1,13 @@ +# # GetAccountActivityLogsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**action** | **string** | Type of activity in the account. | +**date** | **string** | Time of the activity. | +**userEmail** | **string** | Email address of the user who performed activity in the account. | +**userIp** | **string** | IP address of the user who performed activity in the account. | +**userAgent** | **string** | Browser details of the user who performed the activity. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetAccountMarketingAutomation.md b/docs/Model/GetAccountAllOfMarketingAutomation.md similarity index 58% rename from docs/Model/GetAccountMarketingAutomation.md rename to docs/Model/GetAccountAllOfMarketingAutomation.md index 7fc91c8..6053f4a 100644 --- a/docs/Model/GetAccountMarketingAutomation.md +++ b/docs/Model/GetAccountAllOfMarketingAutomation.md @@ -1,11 +1,10 @@ -# GetAccountMarketingAutomation +# # GetAccountAllOfMarketingAutomation ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**key** | **string** | Marketing Automation Tracker ID | [optional] -**enabled** | **bool** | Status of Marketing Automation Plateform activation for your account (true=enabled, false=disabled) | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**enabled** | **bool** | Status of Marketing Automation Plateform activation for your account (true=enabled, false=disabled) | +**key** | **string** | Marketing Automation Tracker ID | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetAccountAllOfPlan.md b/docs/Model/GetAccountAllOfPlan.md new file mode 100644 index 0000000..04ce274 --- /dev/null +++ b/docs/Model/GetAccountAllOfPlan.md @@ -0,0 +1,13 @@ +# # GetAccountAllOfPlan + +## Properties + +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\" plan type) | [optional] +**endDate** | **\DateTime** | Date of the period from which the plan will end (only available for \"subscription\" plan type) | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetAccountAllOfRelay.md b/docs/Model/GetAccountAllOfRelay.md new file mode 100644 index 0000000..f9ab417 --- /dev/null +++ b/docs/Model/GetAccountAllOfRelay.md @@ -0,0 +1,10 @@ +# # GetAccountAllOfRelay + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enabled** | **bool** | Status of your transactional email Account (true=Enabled, false=Disabled) | +**data** | [**\Brevo\Client\Models\GetAccountAllOfRelayData**](GetAccountAllOfRelayData.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetAccountAllOfRelayData.md b/docs/Model/GetAccountAllOfRelayData.md new file mode 100644 index 0000000..fec934a --- /dev/null +++ b/docs/Model/GetAccountAllOfRelayData.md @@ -0,0 +1,11 @@ +# # GetAccountAllOfRelayData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**userName** | **string** | Email to use as login on transactional platform | +**relay** | **string** | URL of the SMTP Relay | +**port** | **int** | Port used for SMTP Relay | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetAccountPlan.md b/docs/Model/GetAccountPlan.md deleted file mode 100644 index 1ea58ad..0000000 --- a/docs/Model/GetAccountPlan.md +++ /dev/null @@ -1,15 +0,0 @@ -# GetAccountPlan - -## Properties -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\" 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 deleted file mode 100644 index 5824073..0000000 --- a/docs/Model/GetAccountRelay.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetAccountRelay - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**enabled** | **bool** | Status of your transactional email Account (true=Enabled, false=Disabled) | -**data** | [**\Brevo\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/GetAccountRelayData.md b/docs/Model/GetAccountRelayData.md deleted file mode 100644 index ff92c00..0000000 --- a/docs/Model/GetAccountRelayData.md +++ /dev/null @@ -1,12 +0,0 @@ -# GetAccountRelayData - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**userName** | **string** | Email to use as login on transactional platform | -**relay** | **string** | URL of the SMTP Relay | -**port** | **int** | Port used for SMTP Relay | - -[[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/GetAggregatedReport.md b/docs/Model/GetAggregatedReport.md index e02ad03..28b9119 100644 --- a/docs/Model/GetAggregatedReport.md +++ b/docs/Model/GetAggregatedReport.md @@ -1,22 +1,21 @@ -# GetAggregatedReport +# # GetAggregatedReport ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**range** | **string** | Time frame of the report | [optional] -**requests** | **int** | Number of requests for the timeframe | [optional] -**delivered** | **int** | Number of delivered emails for the timeframe | [optional] -**hardBounces** | **int** | Number of hardbounces for the timeframe | [optional] -**softBounces** | **int** | Number of softbounces for the timeframe | [optional] -**clicks** | **int** | Number of clicks for the timeframe | [optional] -**uniqueClicks** | **int** | Number of unique clicks for the timeframe | [optional] -**opens** | **int** | Number of openings for the timeframe | [optional] -**uniqueOpens** | **int** | Number of unique openings for the timeframe | [optional] -**spamReports** | **int** | Number of complaint (spam report) for the timeframe | [optional] -**blocked** | **int** | Number of blocked contact emails for the timeframe | [optional] -**invalid** | **int** | Number of invalid emails for the timeframe | [optional] -**unsubscribed** | **int** | Number of unsubscribed emails for the timeframe | [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) - +**range** | **string** | Time frame of the report | [optional] +**requests** | **int** | Number of requests for the timeframe | [optional] +**delivered** | **int** | Number of delivered emails for the timeframe | [optional] +**hardBounces** | **int** | Number of hardbounces for the timeframe | [optional] +**softBounces** | **int** | Number of softbounces for the timeframe | [optional] +**clicks** | **int** | Number of clicks for the timeframe | [optional] +**uniqueClicks** | **int** | Number of unique clicks for the timeframe | [optional] +**opens** | **int** | Number of openings for the timeframe | [optional] +**uniqueOpens** | **int** | Number of unique openings for the timeframe | [optional] +**spamReports** | **int** | Number of complaint (spam report) for the timeframe | [optional] +**blocked** | **int** | Number of blocked contact emails for the timeframe | [optional] +**invalid** | **int** | Number of invalid emails for the timeframe | [optional] +**unsubscribed** | **int** | Number of unsubscribed emails for the timeframe | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetAllExternalFeeds.md b/docs/Model/GetAllExternalFeeds.md index 5e68eca..cd73f52 100644 --- a/docs/Model/GetAllExternalFeeds.md +++ b/docs/Model/GetAllExternalFeeds.md @@ -1,11 +1,10 @@ -# GetAllExternalFeeds +# # GetAllExternalFeeds ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**count** | **int** | Total number of batches | [optional] -**feeds** | [**\Brevo\Client\Model\GetAllExternalFeedsFeeds[]**](GetAllExternalFeedsFeeds.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) - +**count** | **int** | Total number of batches | [optional] +**feeds** | [**\Brevo\Client\Models\GetAllExternalFeedsFeedsInner[]**](GetAllExternalFeedsFeedsInner.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetAllExternalFeedsFeeds.md b/docs/Model/GetAllExternalFeedsFeeds.md deleted file mode 100644 index a4302b3..0000000 --- a/docs/Model/GetAllExternalFeedsFeeds.md +++ /dev/null @@ -1,21 +0,0 @@ -# GetAllExternalFeedsFeeds - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **string** | ID of the feed | -**name** | **string** | Name of the feed | -**url** | **string** | URL of the feed | -**authType** | **string** | Auth type of the feed: * `basic` * `token` * `noAuth` | -**username** | **string** | Username for authType `basic` | [optional] -**password** | **string** | Password for authType `basic` | [optional] -**token** | **string** | Token for authType `token` | [optional] -**headers** | [**\Brevo\Client\Model\GetExternalFeedByUUIDHeaders[]**](GetExternalFeedByUUIDHeaders.md) | Custom headers for the feed | -**maxRetries** | **int** | Maximum number of retries on the feed url | -**cache** | **bool** | Toggle caching of feed url response | -**createdAt** | [**\DateTime**] | Datetime on which the feed was created | -**modifiedAt** | [**\DateTime**] | Datetime on which the feed was modified | - -[[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/GetAllExternalFeedsFeedsInner.md b/docs/Model/GetAllExternalFeedsFeedsInner.md new file mode 100644 index 0000000..d678435 --- /dev/null +++ b/docs/Model/GetAllExternalFeedsFeedsInner.md @@ -0,0 +1,20 @@ +# # GetAllExternalFeedsFeedsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | ID of the feed | +**name** | **string** | Name of the feed | +**url** | **string** | URL of the feed | +**authType** | **string** | Auth type of the feed: * `basic` * `token` * `noAuth` | +**headers** | [**\Brevo\Client\Models\GetExternalFeedByUUIDHeadersInner[]**](GetExternalFeedByUUIDHeadersInner.md) | Custom headers for the feed | +**maxRetries** | **int** | Maximum number of retries on the feed url | [default to 5] +**cache** | **bool** | Toggle caching of feed url response | +**createdAt** | **\DateTime** | Datetime on which the feed was created | +**modifiedAt** | **\DateTime** | Datetime on which the feed was modified | +**username** | **string** | Username for authType `basic` | [optional] +**password** | **string** | Password for authType `basic` | [optional] +**token** | **string** | Token for authType `token` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetAttributes.md b/docs/Model/GetAttributes.md index 5c068df..54829d0 100644 --- a/docs/Model/GetAttributes.md +++ b/docs/Model/GetAttributes.md @@ -1,10 +1,9 @@ -# GetAttributes +# # GetAttributes ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**attributes** | [**\Brevo\Client\Model\GetAttributesAttributes[]**](GetAttributesAttributes.md) | Listing of available contact attributes in your account | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**attributes** | [**\Brevo\Client\Models\GetAttributesAttributesInner[]**](GetAttributesAttributesInner.md) | Listing of available contact attributes in your account | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetAttributesAttributes.md b/docs/Model/GetAttributesAttributes.md deleted file mode 100644 index 97d3e59..0000000 --- a/docs/Model/GetAttributesAttributes.md +++ /dev/null @@ -1,14 +0,0 @@ -# GetAttributesAttributes - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **string** | Name of the attribute | -**category** | **string** | Category of the attribute | -**type** | **string** | Type of the attribute | [optional] -**enumeration** | [**\Brevo\Client\Model\GetAttributesEnumeration[]**](GetAttributesEnumeration.md) | Parameter only available for \"category\" type attributes. | [optional] -**calculatedValue** | **string** | Calculated value formula | [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/GetAttributesAttributesInner.md b/docs/Model/GetAttributesAttributesInner.md new file mode 100644 index 0000000..0063767 --- /dev/null +++ b/docs/Model/GetAttributesAttributesInner.md @@ -0,0 +1,13 @@ +# # GetAttributesAttributesInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of the attribute | +**category** | **string** | Category of the attribute | +**type** | **string** | Type of the attribute | [optional] +**enumeration** | [**\Brevo\Client\Models\GetAttributesAttributesInnerEnumerationInner[]**](GetAttributesAttributesInnerEnumerationInner.md) | Parameter only available for \"category\" type attributes. | [optional] +**calculatedValue** | **string** | Calculated value formula | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetAttributesAttributesInnerEnumerationInner.md b/docs/Model/GetAttributesAttributesInnerEnumerationInner.md new file mode 100644 index 0000000..fb57e37 --- /dev/null +++ b/docs/Model/GetAttributesAttributesInnerEnumerationInner.md @@ -0,0 +1,10 @@ +# # GetAttributesAttributesInnerEnumerationInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | **int** | ID of Value of the \"category\" type attribute | +**label** | **string** | Label of the \"category\" type attribute | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetAttributesEnumeration.md b/docs/Model/GetAttributesEnumeration.md deleted file mode 100644 index 6407aab..0000000 --- a/docs/Model/GetAttributesEnumeration.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetAttributesEnumeration - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**value** | **int** | ID of Value of the \"category\" type attribute | -**label** | **string** | Label of the \"category\" type attribute | - -[[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/GetBlockedDomains.md b/docs/Model/GetBlockedDomains.md index 3098d0b..f3ed8b8 100644 --- a/docs/Model/GetBlockedDomains.md +++ b/docs/Model/GetBlockedDomains.md @@ -1,10 +1,9 @@ -# GetBlockedDomains +# # GetBlockedDomains ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**domains** | **string[]** | List of all blocked domains | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**domains** | **string[]** | List of all blocked domains | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetCampaignOverview.md b/docs/Model/GetCampaignOverview.md index 9e9d9e8..6381a86 100644 --- a/docs/Model/GetCampaignOverview.md +++ b/docs/Model/GetCampaignOverview.md @@ -1,23 +1,22 @@ -# GetCampaignOverview +# # GetCampaignOverview ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | ID of the campaign | -**name** | **string** | Name of the campaign | -**subject** | **string** | Subject of the campaign. Only available if `abTesting` flag of the campaign is `false` | [optional] -**previewText** | **string** | Preview text or preheader of the email campaign | [optional] -**type** | **string** | Type of campaign | -**status** | **string** | Status of the campaign | -**scheduledAt** | **string** | UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) | [optional] -**abTesting** | **bool** | Status of A/B Test for the campaign. abTesting = false means it is disabled, & abTesting = true means it is enabled. | [optional] -**subjectA** | **string** | Subject A of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` | [optional] -**subjectB** | **string** | Subject B of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` | [optional] -**splitRule** | **int** | The size of your ab-test groups. Only available if `abTesting` flag of the campaign is `true` | [optional] -**winnerCriteria** | **string** | Criteria for the winning version. Only available if `abTesting` flag of the campaign is `true` | [optional] -**winnerDelay** | **int** | The duration of the test in hours at the end of which the winning version will be sent. Only available if `abTesting` flag of the campaign is `true` | [optional] -**sendAtBestTime** | **bool** | It is true if you have chosen to send your campaign at best time, otherwise it is false | [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) - +**id** | **int** | ID of the campaign | +**name** | **string** | Name of the campaign | +**type** | **string** | Type of campaign | +**status** | **string** | Status of the campaign | +**subject** | **string** | Subject of the campaign. Only available if `abTesting` flag of the campaign is `false` | [optional] +**previewText** | **string** | Preview text or preheader of the email campaign | [optional] +**scheduledAt** | **string** | UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) | [optional] +**abTesting** | **bool** | Status of A/B Test for the campaign. abTesting = false means it is disabled, & abTesting = true means it is enabled. | [optional] +**subjectA** | **string** | Subject A of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` | [optional] +**subjectB** | **string** | Subject B of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` | [optional] +**splitRule** | **int** | The size of your ab-test groups. Only available if `abTesting` flag of the campaign is `true` | [optional] +**winnerCriteria** | **string** | Criteria for the winning version. Only available if `abTesting` flag of the campaign is `true` | [optional] +**winnerDelay** | **int** | The duration of the test in hours at the end of which the winning version will be sent. Only available if `abTesting` flag of the campaign is `true` | [optional] +**sendAtBestTime** | **bool** | It is true if you have chosen to send your campaign at best time, otherwise it is false | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetCampaignRecipients.md b/docs/Model/GetCampaignRecipients.md index 4dc68b4..70f4697 100644 --- a/docs/Model/GetCampaignRecipients.md +++ b/docs/Model/GetCampaignRecipients.md @@ -1,11 +1,10 @@ -# GetCampaignRecipients +# # GetCampaignRecipients ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**lists** | **int[]** | | -**exclusionLists** | **int[]** | | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**lists** | **int[]** | | +**exclusionLists** | **int[]** | | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetCampaignStats.md b/docs/Model/GetCampaignStats.md index 79c3a63..8dc94fd 100644 --- a/docs/Model/GetCampaignStats.md +++ b/docs/Model/GetCampaignStats.md @@ -1,25 +1,24 @@ -# GetCampaignStats +# # GetCampaignStats ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**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 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 | -**softBounces** | **int** | Number of softbounce for the campaign | -**hardBounces** | **int** | Number of harbounce for the campaign | -**uniqueViews** | **int** | Number of unique openings for the campaign | -**trackableViews** | **int** | Recipients without any privacy protection option enabled in their email client | -**trackableViewsRate** | **float** | Rate of recipients without any privacy protection option enabled in their email client | [optional] -**estimatedViews** | **int** | Rate of recipients without any privacy protection option enabled in their email client, applied to all delivered emails | [optional] -**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 | [optional] -**returnBounce** | **int** | Total number of non-delivered campaigns for a particular campaign 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) - +**uniqueClicks** | **int** | Number of unique 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 | +**softBounces** | **int** | Number of softbounce for the campaign | +**hardBounces** | **int** | Number of harbounce for the campaign | +**uniqueViews** | **int** | Number of unique openings for the campaign | +**trackableViews** | **int** | Recipients without any privacy protection option enabled in their email client | +**unsubscriptions** | **int** | Number of unsubscription for the campaign | +**viewed** | **int** | Number of openings for the campaign | +**listId** | **int** | List Id of email campaign (only in case of get email campaign(s)(not for global stats)) | [optional] +**trackableViewsRate** | **float** | Rate of recipients without any privacy protection option enabled in their email client | [optional] +**estimatedViews** | **int** | Rate of recipients without any privacy protection option enabled in their email client, applied to all delivered emails | [optional] +**deferred** | **int** | Number of deferred emails for the campaign | [optional] +**returnBounce** | **int** | Total number of non-delivered campaigns for a particular campaign id. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetCategories.md b/docs/Model/GetCategories.md index 3479e5b..153527c 100644 --- a/docs/Model/GetCategories.md +++ b/docs/Model/GetCategories.md @@ -1,11 +1,10 @@ -# GetCategories +# # GetCategories ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**categories** | **object[]** | | -**count** | **int** | Number of categories | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**categories** | [**GetCategoryDetails[]**](GetCategoryDetails.md) | | +**count** | **int** | Number of categories | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetCategoryDetails.md b/docs/Model/GetCategoryDetails.md index c9f2607..8229c4c 100644 --- a/docs/Model/GetCategoryDetails.md +++ b/docs/Model/GetCategoryDetails.md @@ -1,15 +1,14 @@ -# GetCategoryDetails +# # GetCategoryDetails ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Category ID for which you requested the details | -**name** | **string** | Name of the category for which you requested the details | -**createdAt** | **string** | Creation UTC date-time of the category (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**modifiedAt** | **string** | Last modification UTC date-time of the category (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**url** | **string** | URL to the category | [optional] -**isDeleted** | **bool** | category deleted from the shop's database | [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) - - +**id** | **string** | Category ID for which you requested the details | +**name** | **string** | Name of the category for which you requested the details | +**createdAt** | **string** | Creation UTC date-time of the category (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | **string** | Last modification UTC date-time of the category (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**url** | **string** | URL to the category | [optional] +**isDeleted** | **bool** | category deleted from the shop's database | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetChildAccountCreationStatus.md b/docs/Model/GetChildAccountCreationStatus.md deleted file mode 100644 index e8c6ca9..0000000 --- a/docs/Model/GetChildAccountCreationStatus.md +++ /dev/null @@ -1,10 +0,0 @@ -# GetChildAccountCreationStatus - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**childAccountCreated** | **bool** | Status of child account creation whether it is successfully created (exists) or not. | - -[[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/GetChildDomain.md b/docs/Model/GetChildDomain.md deleted file mode 100644 index 8cede17..0000000 --- a/docs/Model/GetChildDomain.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetChildDomain - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**domain** | **string** | Sender domain | [optional] -**active** | **bool** | indicates whether a domain is verified or not | [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/GetChildDomains.md b/docs/Model/GetChildDomains.md deleted file mode 100644 index 1021351..0000000 --- a/docs/Model/GetChildDomains.md +++ /dev/null @@ -1,9 +0,0 @@ -# GetChildDomains - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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 deleted file mode 100644 index cb381ae..0000000 --- a/docs/Model/GetChildInfo.md +++ /dev/null @@ -1,14 +0,0 @@ -# GetChildInfo - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**credits** | [**\Brevo\Client\Model\GetChildInfoCredits**](GetChildInfoCredits.md) | | [optional] -**statistics** | [**\Brevo\Client\Model\GetChildInfoStatistics**](GetChildInfoStatistics.md) | | [optional] -**password** | **string** | The encrypted password of child account | -**ips** | **string[]** | IP(s) associated to a child account user | [optional] -**apiKeys** | [**\Brevo\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 deleted file mode 100644 index d5537c8..0000000 --- a/docs/Model/GetChildInfoApiKeys.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetChildInfoApiKeys - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**v2** | [**\Brevo\Client\Model\GetChildInfoApiKeysV2[]**](GetChildInfoApiKeysV2.md) | | -**v3** | [**\Brevo\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/GetChildInfoApiKeysV2.md b/docs/Model/GetChildInfoApiKeysV2.md deleted file mode 100644 index 0034d6f..0000000 --- a/docs/Model/GetChildInfoApiKeysV2.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetChildInfoApiKeysV2 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **string** | Name of the key for version 2 | -**key** | **string** | API Key for version 2 | - -[[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/GetChildInfoApiKeysV3.md b/docs/Model/GetChildInfoApiKeysV3.md deleted file mode 100644 index 1efa20f..0000000 --- a/docs/Model/GetChildInfoApiKeysV3.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetChildInfoApiKeysV3 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **string** | Name of the key for version 3 | -**key** | **string** | API Key for version 3 | - -[[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/GetChildInfoCredits.md b/docs/Model/GetChildInfoCredits.md deleted file mode 100644 index 5d6cc5a..0000000 --- a/docs/Model/GetChildInfoCredits.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetChildInfoCredits - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**emailCredits** | **int** | Email credits available for your child | [optional] -**smsCredits** | **int** | SMS credits available for your child | [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/GetChildInfoStatistics.md b/docs/Model/GetChildInfoStatistics.md deleted file mode 100644 index b4e3e37..0000000 --- a/docs/Model/GetChildInfoStatistics.md +++ /dev/null @@ -1,12 +0,0 @@ -# GetChildInfoStatistics - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**previousMonthTotalSent** | **int** | Overall emails sent for the previous month | [optional] -**currentMonthTotalSent** | **int** | Overall emails sent for current month | [optional] -**totalSent** | **int** | Overall emails sent for since the account exists | [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/GetChildrenList.md b/docs/Model/GetChildrenList.md deleted file mode 100644 index f6ff2d6..0000000 --- a/docs/Model/GetChildrenList.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetChildrenList - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**children** | **object[]** | Your children's account information | [optional] -**count** | **int** | Number of child accounts | [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/GetClient.md b/docs/Model/GetClient.md index 0b99349..98ef9d4 100644 --- a/docs/Model/GetClient.md +++ b/docs/Model/GetClient.md @@ -1,13 +1,12 @@ -# GetClient +# # GetClient ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**email** | **string** | Login Email | -**firstName** | **string** | First Name | -**lastName** | **string** | Last Name | -**companyName** | **string** | Name of the company | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**email** | **string** | Login Email | +**firstName** | **string** | First Name | +**lastName** | **string** | Last Name | +**companyName** | **string** | Name of the company | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetContactCampaignStats.md b/docs/Model/GetContactCampaignStats.md index a79fab9..fb156a0 100644 --- a/docs/Model/GetContactCampaignStats.md +++ b/docs/Model/GetContactCampaignStats.md @@ -1,18 +1,17 @@ -# GetContactCampaignStats +# # GetContactCampaignStats ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**messagesSent** | [**\Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[]**](GetExtendedContactDetailsStatisticsMessagesSent.md) | | [optional] -**hardBounces** | [**\Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[]**](GetExtendedContactDetailsStatisticsMessagesSent.md) | | [optional] -**softBounces** | [**\Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[]**](GetExtendedContactDetailsStatisticsMessagesSent.md) | | [optional] -**complaints** | [**\Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[]**](GetExtendedContactDetailsStatisticsMessagesSent.md) | | [optional] -**unsubscriptions** | [**\Brevo\Client\Model\GetContactCampaignStatsUnsubscriptions**](GetContactCampaignStatsUnsubscriptions.md) | | [optional] -**opened** | [**\Brevo\Client\Model\GetContactCampaignStatsOpened[]**](GetContactCampaignStatsOpened.md) | | [optional] -**clicked** | [**\Brevo\Client\Model\GetContactCampaignStatsClicked[]**](GetContactCampaignStatsClicked.md) | | [optional] -**transacAttributes** | [**\Brevo\Client\Model\GetContactCampaignStatsTransacAttributes[]**](GetContactCampaignStatsTransacAttributes.md) | | [optional] -**delivered** | [**\Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[]**](GetExtendedContactDetailsStatisticsMessagesSent.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) - +**messagesSent** | [**\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]**](GetExtendedContactDetailsAllOfStatisticsMessagesSent.md) | | [optional] +**hardBounces** | [**\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]**](GetExtendedContactDetailsAllOfStatisticsMessagesSent.md) | | [optional] +**softBounces** | [**\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]**](GetExtendedContactDetailsAllOfStatisticsMessagesSent.md) | | [optional] +**complaints** | [**\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]**](GetExtendedContactDetailsAllOfStatisticsMessagesSent.md) | | [optional] +**unsubscriptions** | [**\Brevo\Client\Models\GetContactCampaignStatsUnsubscriptions**](GetContactCampaignStatsUnsubscriptions.md) | | [optional] +**opened** | [**\Brevo\Client\Models\GetContactCampaignStatsOpenedInner[]**](GetContactCampaignStatsOpenedInner.md) | | [optional] +**clicked** | [**\Brevo\Client\Models\GetContactCampaignStatsClickedInner[]**](GetContactCampaignStatsClickedInner.md) | | [optional] +**transacAttributes** | [**\Brevo\Client\Models\GetContactCampaignStatsTransacAttributesInner[]**](GetContactCampaignStatsTransacAttributesInner.md) | | [optional] +**delivered** | [**\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]**](GetExtendedContactDetailsAllOfStatisticsMessagesSent.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetContactCampaignStatsClicked.md b/docs/Model/GetContactCampaignStatsClicked.md deleted file mode 100644 index 06edf1f..0000000 --- a/docs/Model/GetContactCampaignStatsClicked.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetContactCampaignStatsClicked - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**campaignId** | **int** | ID of the campaign which generated the event | -**links** | [**\Brevo\Client\Model\GetExtendedContactDetailsStatisticsLinks[]**](GetExtendedContactDetailsStatisticsLinks.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/GetContactCampaignStatsClickedInner.md b/docs/Model/GetContactCampaignStatsClickedInner.md new file mode 100644 index 0000000..e67aca9 --- /dev/null +++ b/docs/Model/GetContactCampaignStatsClickedInner.md @@ -0,0 +1,10 @@ +# # GetContactCampaignStatsClickedInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaignId** | **int** | ID of the campaign which generated the event | +**links** | [**\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsLinks[]**](GetExtendedContactDetailsAllOfStatisticsLinks.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetContactCampaignStatsOpened.md b/docs/Model/GetContactCampaignStatsOpened.md deleted file mode 100644 index f34053f..0000000 --- a/docs/Model/GetContactCampaignStatsOpened.md +++ /dev/null @@ -1,13 +0,0 @@ -# GetContactCampaignStatsOpened - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**campaignId** | **int** | ID of the campaign which generated the event | -**count** | **int** | Number of openings of the campaign | -**eventTime** | **string** | 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/GetContactCampaignStatsOpenedInner.md b/docs/Model/GetContactCampaignStatsOpenedInner.md new file mode 100644 index 0000000..f769403 --- /dev/null +++ b/docs/Model/GetContactCampaignStatsOpenedInner.md @@ -0,0 +1,12 @@ +# # GetContactCampaignStatsOpenedInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaignId** | **int** | ID of the campaign which generated the event | +**count** | **int** | Number of openings of the campaign | +**eventTime** | **string** | UTC date-time of the event | +**ip** | **string** | IP from which the user has opened the campaign | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetContactCampaignStatsTransacAttributes.md b/docs/Model/GetContactCampaignStatsTransacAttributes.md deleted file mode 100644 index a23e752..0000000 --- a/docs/Model/GetContactCampaignStatsTransacAttributes.md +++ /dev/null @@ -1,12 +0,0 @@ -# GetContactCampaignStatsTransacAttributes - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**orderDate** | [**\DateTime**] | Date of the order | -**orderPrice** | **float** | Price of the order | -**orderId** | **int** | ID of the order | - -[[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/GetContactCampaignStatsTransacAttributesInner.md b/docs/Model/GetContactCampaignStatsTransacAttributesInner.md new file mode 100644 index 0000000..79045ec --- /dev/null +++ b/docs/Model/GetContactCampaignStatsTransacAttributesInner.md @@ -0,0 +1,11 @@ +# # GetContactCampaignStatsTransacAttributesInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**orderDate** | **\DateTime** | Date of the order | +**orderPrice** | **float** | Price of the order | +**orderId** | **int** | ID of the order | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetContactCampaignStatsUnsubscriptions.md b/docs/Model/GetContactCampaignStatsUnsubscriptions.md index 97a8f16..8b191cc 100644 --- a/docs/Model/GetContactCampaignStatsUnsubscriptions.md +++ b/docs/Model/GetContactCampaignStatsUnsubscriptions.md @@ -1,11 +1,10 @@ -# GetContactCampaignStatsUnsubscriptions +# # GetContactCampaignStatsUnsubscriptions ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**userUnsubscription** | [**\Brevo\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[]**](GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.md) | Contact has unsubscribed via the unsubscription link in the email | -**adminUnsubscription** | [**\Brevo\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[]**](GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.md) | Contact has been unsubscribed from the administrator | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**userUnsubscription** | [**\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription[]**](GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription.md) | Contact has unsubscribed via the unsubscription link in the email | +**adminUnsubscription** | [**\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription[]**](GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription.md) | Contact has been unsubscribed from the administrator | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetContactDetails.md b/docs/Model/GetContactDetails.md index 044d618..3d01433 100644 --- a/docs/Model/GetContactDetails.md +++ b/docs/Model/GetContactDetails.md @@ -1,18 +1,17 @@ -# GetContactDetails +# # GetContactDetails ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**email** | **string** | Email address of the contact for which you requested the details | [optional] -**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) | -**createdAt** | **string** | Creation UTC date-time of the contact (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**modifiedAt** | **string** | Last modification UTC date-time of the contact (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**listIds** | **int[]** | | -**listUnsubscribed** | **int[]** | | [optional] -**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) - +**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) | +**createdAt** | **string** | Creation UTC date-time of the contact (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | **string** | Last modification UTC date-time of the contact (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**listIds** | **int[]** | | +**attributes** | **object** | Set of attributes of the contact | +**email** | **string** | Email address of the contact for which you requested the details | [optional] +**listUnsubscribed** | **int[]** | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetContactInfoIdentifierParameter.md b/docs/Model/GetContactInfoIdentifierParameter.md new file mode 100644 index 0000000..4a59f84 --- /dev/null +++ b/docs/Model/GetContactInfoIdentifierParameter.md @@ -0,0 +1,8 @@ +# # GetContactInfoIdentifierParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetContacts.md b/docs/Model/GetContacts.md index 1411462..f5e1e6c 100644 --- a/docs/Model/GetContacts.md +++ b/docs/Model/GetContacts.md @@ -1,11 +1,10 @@ -# GetContacts +# # GetContacts ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**contacts** | **object[]** | | -**count** | **int** | Number of contacts | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**contacts** | [**GetContactDetails[]**](GetContactDetails.md) | | +**count** | **int** | Number of contacts | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetCorporateInvitedUsersList.md b/docs/Model/GetCorporateInvitedUsersList.md index d6c1cb0..afb4f95 100644 --- a/docs/Model/GetCorporateInvitedUsersList.md +++ b/docs/Model/GetCorporateInvitedUsersList.md @@ -1,10 +1,9 @@ -# GetCorporateInvitedUsersList +# # GetCorporateInvitedUsersList ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**users** | [**\Brevo\Client\Model\GetCorporateInvitedUsersListUsers[]**](GetCorporateInvitedUsersListUsers.md) | Get invited users 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) - +**users** | [**\Brevo\Client\Models\GetCorporateInvitedUsersListUsersInner[]**](GetCorporateInvitedUsersListUsersInner.md) | Get invited users list | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetCorporateInvitedUsersListFeatureAccess.md b/docs/Model/GetCorporateInvitedUsersListFeatureAccess.md deleted file mode 100644 index 80b0321..0000000 --- a/docs/Model/GetCorporateInvitedUsersListFeatureAccess.md +++ /dev/null @@ -1,13 +0,0 @@ -# GetCorporateInvitedUsersListFeatureAccess - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**userManagement** | **string[]** | User management accessiblity. | [optional] -**apiKeys** | **string[]** | Api keys accessiblity. | [optional] -**myPlan** | **string[]** | My plan accessiblity. | [optional] -**appsManagement** | **string[]** | Apps management accessiblity | Not available in ENTv2 | [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/GetCorporateInvitedUsersListGroups.md b/docs/Model/GetCorporateInvitedUsersListGroups.md deleted file mode 100644 index b28382b..0000000 --- a/docs/Model/GetCorporateInvitedUsersListGroups.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetCorporateInvitedUsersListGroups - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **string** | group id | [optional] -**name** | **string** | group name | [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/GetCorporateInvitedUsersListUsers.md b/docs/Model/GetCorporateInvitedUsersListUsers.md deleted file mode 100644 index 6268f26..0000000 --- a/docs/Model/GetCorporateInvitedUsersListUsers.md +++ /dev/null @@ -1,14 +0,0 @@ -# GetCorporateInvitedUsersListUsers - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**groups** | [**\Brevo\Client\Model\GetCorporateInvitedUsersListGroups**](GetCorporateInvitedUsersListGroups.md) | | -**email** | **string** | Email address of the user. | -**isOwner** | **string** | Flag for indicating is user owner of the organization. | -**status** | **string** | Status of the invited user. | -**featureAccess** | [**\Brevo\Client\Model\GetCorporateInvitedUsersListFeatureAccess**](GetCorporateInvitedUsersListFeatureAccess.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/GetCorporateInvitedUsersListUsersInner.md b/docs/Model/GetCorporateInvitedUsersListUsersInner.md new file mode 100644 index 0000000..7503d8c --- /dev/null +++ b/docs/Model/GetCorporateInvitedUsersListUsersInner.md @@ -0,0 +1,13 @@ +# # GetCorporateInvitedUsersListUsersInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email** | **string** | Email address of the user. | +**isOwner** | **string** | Flag for indicating is user owner of the organization. | +**status** | **string** | Status of the invited user. | +**featureAccess** | [**\Brevo\Client\Models\GetCorporateInvitedUsersListUsersInnerFeatureAccess**](GetCorporateInvitedUsersListUsersInnerFeatureAccess.md) | | +**groups** | [**\Brevo\Client\Models\GetCorporateInvitedUsersListUsersInnerGroups**](GetCorporateInvitedUsersListUsersInnerGroups.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetCorporateInvitedUsersListUsersInnerFeatureAccess.md b/docs/Model/GetCorporateInvitedUsersListUsersInnerFeatureAccess.md new file mode 100644 index 0000000..9ab9a42 --- /dev/null +++ b/docs/Model/GetCorporateInvitedUsersListUsersInnerFeatureAccess.md @@ -0,0 +1,17 @@ +# # GetCorporateInvitedUsersListUsersInnerFeatureAccess + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**userManagement** | **string[]** | User management accessiblity. | [optional] +**apiKeys** | **string[]** | Api keys accessiblity. | [optional] +**myPlan** | **string[]** | My plan accessiblity. | [optional] +**appsManagement** | **string[]** | Apps management accessiblity | Not available in ENTv2 | [optional] +**subOrganizationGroups** | **string[]** | Group creation, modification or deletion accessibility | [optional] +**createSubOrganizations** | **string[]** | Authorization to create sub-organization in the admin account. If the user creating the sub-organization, belongs to a group, the user must choose a group at the sub-organization creation. | [optional] +**manageSubOrganizations** | **string[]** | Authorization to manage and access sub-organizations in the admin account. | [optional] +**analytics** | **string[]** | Analytics dashboard accessibility | [optional] +**security** | **string[]** | Security page accessibility | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetCorporateInvitedUsersListUsersInnerGroups.md b/docs/Model/GetCorporateInvitedUsersListUsersInnerGroups.md new file mode 100644 index 0000000..3f4f914 --- /dev/null +++ b/docs/Model/GetCorporateInvitedUsersListUsersInnerGroups.md @@ -0,0 +1,10 @@ +# # GetCorporateInvitedUsersListUsersInnerGroups + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | group id | [optional] +**name** | **string** | group name | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetCorporateUserPermission.md b/docs/Model/GetCorporateUserPermission.md new file mode 100644 index 0000000..93ed495 --- /dev/null +++ b/docs/Model/GetCorporateUserPermission.md @@ -0,0 +1,12 @@ +# # GetCorporateUserPermission + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email** | **string** | Email address of the user. | +**status** | **string** | Status of the invited user. | +**groups** | [**\Brevo\Client\Models\GetCorporateUserPermissionGroupsInner[]**](GetCorporateUserPermissionGroupsInner.md) | | +**featureAccess** | [**\Brevo\Client\Models\GetCorporateUserPermissionFeatureAccess**](GetCorporateUserPermissionFeatureAccess.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetCorporateUserPermissionFeatureAccess.md b/docs/Model/GetCorporateUserPermissionFeatureAccess.md new file mode 100644 index 0000000..000c07d --- /dev/null +++ b/docs/Model/GetCorporateUserPermissionFeatureAccess.md @@ -0,0 +1,17 @@ +# # GetCorporateUserPermissionFeatureAccess + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**apiKeys** | **string[]** | Permission on api keys | [optional] +**myPlan** | **string[]** | Permission on my plan | [optional] +**userManagement** | **string[]** | Permission on user management | [optional] +**appsManagement** | **string[]** | Permission on apps management | [optional] +**subOrganizationGroups** | **string[]** | Permission on groups | [optional] +**createSubOrganizations** | **string[]** | Permission on create sub-accounts | [optional] +**manageSubOrganizations** | **string[]** | Permission on manage sub-accounts | [optional] +**analytics** | **string[]** | Permission on analytics | [optional] +**security** | **string[]** | Permission on security | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetCorporateUserPermissionGroupsInner.md b/docs/Model/GetCorporateUserPermissionGroupsInner.md new file mode 100644 index 0000000..0eac3d8 --- /dev/null +++ b/docs/Model/GetCorporateUserPermissionGroupsInner.md @@ -0,0 +1,10 @@ +# # GetCorporateUserPermissionGroupsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | group identifier | [optional] +**name** | **string** | Group name | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetCouponCollection.md b/docs/Model/GetCouponCollection.md index 9828cb1..75866cc 100644 --- a/docs/Model/GetCouponCollection.md +++ b/docs/Model/GetCouponCollection.md @@ -1,15 +1,17 @@ -# GetCouponCollection +# # GetCouponCollection ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | The id of the collection | -**name** | **string** | The name of the collection | -**defaultCoupon** | **string** | The default coupon of the collection | -**createdAt** | [**\DateTime**] | Datetime on which the collection was created | -**totalCoupons** | **int** | Total coupons in the collection | -**remainingCoupons** | **int** | Not sent coupons in the collection | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**id** | **string** | The id of the collection. | +**name** | **string** | The name of the collection. | +**defaultCoupon** | **string** | The default coupon of the collection. | +**createdAt** | **\DateTime** | Datetime on which the collection was created. | +**totalCoupons** | **int** | Total number of coupons in the collection. | +**remainingCoupons** | **int** | Number of coupons that have not been sent yet. | +**expirationDate** | **\DateTime** | Expiration date for the coupon collection in RFC3339 format. | [optional] +**remainingDaysAlert** | **int** | If present, an email notification is going to be sent the defined amount of days before to the expiration date. | [optional] +**remainingCouponsAlert** | **int** | If present, an email notification is going to be sent when the total number of available coupons falls below the defined threshold. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetDeviceBrowserStats.md b/docs/Model/GetDeviceBrowserStats.md index 630fd54..00f443e 100644 --- a/docs/Model/GetDeviceBrowserStats.md +++ b/docs/Model/GetDeviceBrowserStats.md @@ -1,13 +1,12 @@ -# GetDeviceBrowserStats +# # GetDeviceBrowserStats ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**clickers** | **int** | Number of total clicks for the campaign using the particular browser | -**uniqueClicks** | **int** | Number of unique clicks for the campaign using the particular browser | -**viewed** | **int** | Number of openings for the campaign using the particular browser | -**uniqueViews** | **int** | Number of unique openings for the campaign using the particular browser | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**clickers** | **int** | Number of total clicks for the campaign using the particular browser | +**uniqueClicks** | **int** | Number of unique clicks for the campaign using the particular browser | +**viewed** | **int** | Number of openings for the campaign using the particular browser | +**uniqueViews** | **int** | Number of unique openings for the campaign using the particular browser | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetDomainConfigurationModel.md b/docs/Model/GetDomainConfigurationModel.md index f3a1410..7382d22 100644 --- a/docs/Model/GetDomainConfigurationModel.md +++ b/docs/Model/GetDomainConfigurationModel.md @@ -1,13 +1,12 @@ -# GetDomainConfigurationModel +# # GetDomainConfigurationModel ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**domain** | **string** | Domain | -**verified** | **bool** | Status of domain verification (true=verified, false=non verified) | -**authenticated** | **bool** | Status of domain authentication (true=authenticated, false=non authenticated) | -**dnsRecords** | [**\Brevo\Client\Model\CreateDomainModelDnsRecords**](CreateDomainModelDnsRecords.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) - +**domain** | **string** | Domain | +**verified** | **bool** | Status of domain verification (true=verified, false=non verified) | +**authenticated** | **bool** | Status of domain authentication (true=authenticated, false=non authenticated) | +**dnsRecords** | [**\Brevo\Client\Models\CreateDomainModelDnsRecords**](CreateDomainModelDnsRecords.md) | | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetDomainsList.md b/docs/Model/GetDomainsList.md index ebaa190..9e9968b 100644 --- a/docs/Model/GetDomainsList.md +++ b/docs/Model/GetDomainsList.md @@ -1,10 +1,9 @@ -# GetDomainsList +# # GetDomainsList ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**domains** | [**\Brevo\Client\Model\GetDomainsListDomains[]**](GetDomainsListDomains.md) | List of the domains available in 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) - +**domains** | [**\Brevo\Client\Models\GetDomainsListDomainsInner[]**](GetDomainsListDomainsInner.md) | List of the domains available in your account | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetDomainsListDomains.md b/docs/Model/GetDomainsListDomains.md deleted file mode 100644 index 925ea14..0000000 --- a/docs/Model/GetDomainsListDomains.md +++ /dev/null @@ -1,14 +0,0 @@ -# GetDomainsListDomains - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | Id of the domain | -**domainName** | **string** | Domain name | -**authenticated** | **bool** | Status of domain authentication (true=authenticated, false=non authenticated) | -**verified** | **bool** | Status of domain verification (true=verified, false=non verified) | -**ip** | **string** | Dedicated IP associated with domain | [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/GetDomainsListDomainsInner.md b/docs/Model/GetDomainsListDomainsInner.md new file mode 100644 index 0000000..c2b4cae --- /dev/null +++ b/docs/Model/GetDomainsListDomainsInner.md @@ -0,0 +1,13 @@ +# # GetDomainsListDomainsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Id of the domain | +**domainName** | **string** | Domain name | +**authenticated** | **bool** | Status of domain authentication (true=authenticated, false=non authenticated) | +**verified** | **bool** | Status of domain verification (true=verified, false=non verified) | +**ip** | **string** | Dedicated IP associated with domain | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetEmailCampaign.md b/docs/Model/GetEmailCampaign.md index afb9f8b..49fdf35 100644 --- a/docs/Model/GetEmailCampaign.md +++ b/docs/Model/GetEmailCampaign.md @@ -1,40 +1,44 @@ -# GetEmailCampaign +# # GetEmailCampaign ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | ID of the campaign | -**name** | **string** | Name of the campaign | -**subject** | **string** | Subject of the campaign. Only available if `abTesting` flag of the campaign is `false` | [optional] -**type** | **string** | Type of campaign | -**status** | **string** | Status of the campaign | -**scheduledAt** | **string** | UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) | [optional] -**abTesting** | **bool** | Status of A/B Test for the campaign. abTesting = false means it is disabled, & abTesting = true means it is enabled. | [optional] -**subjectA** | **string** | Subject A of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` | [optional] -**subjectB** | **string** | Subject B of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` | [optional] -**splitRule** | **int** | The size of your ab-test groups. Only available if `abTesting` flag of the campaign is `true` | [optional] -**winnerCriteria** | **string** | Criteria for the winning version. Only available if `abTesting` flag of the campaign is `true` | [optional] -**winnerDelay** | **int** | The duration of the test in hours at the end of which the winning version will be sent. Only available if `abTesting` flag of the campaign is `true` | [optional] -**sendAtBestTime** | **bool** | It is true if you have chosen to send your campaign at best time, otherwise it is false | [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** | [**\Brevo\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 | [optional] -**htmlContent** | **string** | HTML content of the campaign | -**shareLink** | **string** | Link to share the campaign on social medias | [optional] -**tag** | **string** | Tag of the campaign | [optional] -**createdAt** | **string** | Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**modifiedAt** | **string** | 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] -**sentDate** | **string** | Sent UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ). Only available if 'status' of the campaign is 'sent' | [optional] -**returnBounce** | **int** | Total number of non-delivered campaigns for a particular campaign id. | [optional] -**recipients** | **object** | | -**statistics** | **object** | | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**id** | **int** | ID of the campaign | +**name** | **string** | Name of the campaign | +**type** | **string** | Type of campaign | +**status** | **string** | Status of the campaign | +**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** | [**\Brevo\Client\Models\GetExtendedCampaignOverviewAllOfSender**](GetExtendedCampaignOverviewAllOfSender.md) | | +**replyTo** | **string** | Email defined as the \"Reply to\" of the campaign | +**htmlContent** | **string** | HTML content of the campaign | +**createdAt** | **string** | Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | **string** | UTC date-time of last modification of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**recipients** | **object** | | +**statistics** | **object** | | +**subject** | **string** | Subject of the campaign. Only available if `abTesting` flag of the campaign is `false` | [optional] +**previewText** | **string** | Preview text or preheader of the email campaign | [optional] +**scheduledAt** | **string** | UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) | [optional] +**abTesting** | **bool** | Status of A/B Test for the campaign. abTesting = false means it is disabled, & abTesting = true means it is enabled. | [optional] +**subjectA** | **string** | Subject A of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` | [optional] +**subjectB** | **string** | Subject B of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` | [optional] +**splitRule** | **int** | The size of your ab-test groups. Only available if `abTesting` flag of the campaign is `true` | [optional] +**winnerCriteria** | **string** | Criteria for the winning version. Only available if `abTesting` flag of the campaign is `true` | [optional] +**winnerDelay** | **int** | The duration of the test in hours at the end of which the winning version will be sent. Only available if `abTesting` flag of the campaign is `true` | [optional] +**sendAtBestTime** | **bool** | It is true if you have chosen to send your campaign at best time, otherwise it is false | [optional] +**utmCampaignValue** | **string** | utm parameter associated with campaign | [optional] +**utmSource** | **string** | | [optional] +**utmMedium** | **string** | | [optional] +**utmIDActive** | **bool** | utm id activate | [optional] +**toField** | **string** | Customisation of the \"to\" field of the campaign | [optional] +**shareLink** | **string** | Link to share the campaign on social medias | [optional] +**tag** | **string** | Tag of the campaign | [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. | [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] +**sentDate** | **string** | Sent UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ). Only available if 'status' of the campaign is 'sent' | [optional] +**returnBounce** | **int** | Total number of non-delivered campaigns for a particular campaign id. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetEmailCampaigns.md b/docs/Model/GetEmailCampaigns.md index 945dd56..7c91a42 100644 --- a/docs/Model/GetEmailCampaigns.md +++ b/docs/Model/GetEmailCampaigns.md @@ -1,11 +1,10 @@ -# GetEmailCampaigns +# # GetEmailCampaigns ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**campaigns** | **object[]** | | [optional] -**count** | **int** | Number of Email campaigns retrieved | [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) - +**campaigns** | [**\Brevo\Client\Models\GetEmailCampaignsCampaignsInner[]**](GetEmailCampaignsCampaignsInner.md) | | [optional] +**count** | **int** | Number of Email campaigns retrieved | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetEmailCampaignsCampaignsInner.md b/docs/Model/GetEmailCampaignsCampaignsInner.md new file mode 100644 index 0000000..4298a0f --- /dev/null +++ b/docs/Model/GetEmailCampaignsCampaignsInner.md @@ -0,0 +1,44 @@ +# # GetEmailCampaignsCampaignsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | ID of the campaign | +**name** | **string** | Name of the campaign | +**type** | **string** | Type of campaign | +**status** | **string** | Status of the campaign | +**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** | [**\Brevo\Client\Models\GetExtendedCampaignOverviewAllOfSender**](GetExtendedCampaignOverviewAllOfSender.md) | | +**replyTo** | **string** | Email defined as the \"Reply to\" of the campaign | +**htmlContent** | **string** | HTML content of the campaign | +**createdAt** | **string** | Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | **string** | UTC date-time of last modification of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**recipients** | [**\Brevo\Client\Models\GetCampaignRecipients**](GetCampaignRecipients.md) | | +**statistics** | [**\Brevo\Client\Models\GetExtendedCampaignStats**](GetExtendedCampaignStats.md) | | +**subject** | **string** | Subject of the campaign. Only available if `abTesting` flag of the campaign is `false` | [optional] +**previewText** | **string** | Preview text or preheader of the email campaign | [optional] +**scheduledAt** | **string** | UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) | [optional] +**abTesting** | **bool** | Status of A/B Test for the campaign. abTesting = false means it is disabled, & abTesting = true means it is enabled. | [optional] +**subjectA** | **string** | Subject A of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` | [optional] +**subjectB** | **string** | Subject B of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` | [optional] +**splitRule** | **int** | The size of your ab-test groups. Only available if `abTesting` flag of the campaign is `true` | [optional] +**winnerCriteria** | **string** | Criteria for the winning version. Only available if `abTesting` flag of the campaign is `true` | [optional] +**winnerDelay** | **int** | The duration of the test in hours at the end of which the winning version will be sent. Only available if `abTesting` flag of the campaign is `true` | [optional] +**sendAtBestTime** | **bool** | It is true if you have chosen to send your campaign at best time, otherwise it is false | [optional] +**utmCampaignValue** | **string** | utm parameter associated with campaign | [optional] +**utmSource** | **string** | | [optional] +**utmMedium** | **string** | | [optional] +**utmIDActive** | **bool** | utm id activate | [optional] +**toField** | **string** | Customisation of the \"to\" field of the campaign | [optional] +**shareLink** | **string** | Link to share the campaign on social medias | [optional] +**tag** | **string** | Tag of the campaign | [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. | [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] +**sentDate** | **string** | Sent UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ). Only available if 'status' of the campaign is 'sent' | [optional] +**returnBounce** | **int** | Total number of non-delivered campaigns for a particular campaign id. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetEmailEventReport.md b/docs/Model/GetEmailEventReport.md index f3a2a49..90671f1 100644 --- a/docs/Model/GetEmailEventReport.md +++ b/docs/Model/GetEmailEventReport.md @@ -1,10 +1,9 @@ -# GetEmailEventReport +# # GetEmailEventReport ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**events** | [**\Brevo\Client\Model\GetEmailEventReportEvents[]**](GetEmailEventReportEvents.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) - +**events** | [**\Brevo\Client\Models\GetEmailEventReportEventsInner[]**](GetEmailEventReportEventsInner.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetEmailEventReportEvents.md b/docs/Model/GetEmailEventReportEventsInner.md similarity index 62% rename from docs/Model/GetEmailEventReportEvents.md rename to docs/Model/GetEmailEventReportEventsInner.md index 260e26b..8575b3b 100644 --- a/docs/Model/GetEmailEventReportEvents.md +++ b/docs/Model/GetEmailEventReportEventsInner.md @@ -1,20 +1,19 @@ -# GetEmailEventReportEvents +# # GetEmailEventReportEventsInner ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**email** | **string** | Email address which generates the event | -**date** | **string** | 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 | [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 | [optional] -**templateId** | **int** | ID of the template (only available if the email is template based) | [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) - +**email** | **string** | Email address which generates the event | +**date** | **string** | UTC date-time on which the event has been generated | +**messageId** | **string** | Message ID which generated the event | +**event** | **string** | Event which occurred | +**subject** | **string** | Subject of the event | [optional] +**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 | [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 | [optional] +**templateId** | **int** | ID of the template (only available if the email is template based) | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedCampaignOverview.md b/docs/Model/GetExtendedCampaignOverview.md index 4a14d09..77b0318 100644 --- a/docs/Model/GetExtendedCampaignOverview.md +++ b/docs/Model/GetExtendedCampaignOverview.md @@ -1,35 +1,42 @@ -# GetExtendedCampaignOverview +# # GetExtendedCampaignOverview ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | ID of the campaign | -**name** | **string** | Name of the campaign | -**subject** | **string** | Subject of the campaign. Only available if `abTesting` flag of the campaign is `false` | [optional] -**type** | **string** | Type of campaign | -**status** | **string** | Status of the campaign | -**scheduledAt** | **string** | UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) | [optional] -**abTesting** | **bool** | Status of A/B Test for the campaign. abTesting = false means it is disabled, & abTesting = true means it is enabled. | [optional] -**subjectA** | **string** | Subject A of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` | [optional] -**subjectB** | **string** | Subject B of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` | [optional] -**splitRule** | **int** | The size of your ab-test groups. Only available if `abTesting` flag of the campaign is `true` | [optional] -**winnerCriteria** | **string** | Criteria for the winning version. Only available if `abTesting` flag of the campaign is `true` | [optional] -**winnerDelay** | **int** | The duration of the test in hours at the end of which the winning version will be sent. Only available if `abTesting` flag of the campaign is `true` | [optional] -**sendAtBestTime** | **bool** | It is true if you have chosen to send your campaign at best time, otherwise it is false | [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** | [**\Brevo\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 | [optional] -**htmlContent** | **string** | HTML content of the campaign | -**shareLink** | **string** | Link to share the campaign on social medias | [optional] -**tag** | **string** | Tag of the campaign | [optional] -**createdAt** | **string** | Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**modifiedAt** | **string** | 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] -**sentDate** | **string** | Sent UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ). Only available if 'status' of the campaign is 'sent' | [optional] -**returnBounce** | **int** | Total number of non-delivered campaigns for a particular campaign 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) +**id** | **int** | ID of the campaign | +**name** | **string** | Name of the campaign | +**type** | **string** | Type of campaign | +**status** | **string** | Status of the campaign | +**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** | [**\Brevo\Client\Models\GetExtendedCampaignOverviewAllOfSender**](GetExtendedCampaignOverviewAllOfSender.md) | | +**replyTo** | **string** | Email defined as the \"Reply to\" of the campaign | +**htmlContent** | **string** | HTML content of the campaign | +**createdAt** | **string** | Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | **string** | UTC date-time of last modification of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**subject** | **string** | Subject of the campaign. Only available if `abTesting` flag of the campaign is `false` | [optional] +**previewText** | **string** | Preview text or preheader of the email campaign | [optional] +**scheduledAt** | **string** | UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) | [optional] +**abTesting** | **bool** | Status of A/B Test for the campaign. abTesting = false means it is disabled, & abTesting = true means it is enabled. | [optional] +**subjectA** | **string** | Subject A of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` | [optional] +**subjectB** | **string** | Subject B of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` | [optional] +**splitRule** | **int** | The size of your ab-test groups. Only available if `abTesting` flag of the campaign is `true` | [optional] +**winnerCriteria** | **string** | Criteria for the winning version. Only available if `abTesting` flag of the campaign is `true` | [optional] +**winnerDelay** | **int** | The duration of the test in hours at the end of which the winning version will be sent. Only available if `abTesting` flag of the campaign is `true` | [optional] +**sendAtBestTime** | **bool** | It is true if you have chosen to send your campaign at best time, otherwise it is false | [optional] +**utmCampaignValue** | **string** | utm parameter associated with campaign | [optional] +**utmSource** | **string** | | [optional] +**utmMedium** | **string** | | [optional] +**utmIDActive** | **bool** | utm id activate | [optional] +**toField** | **string** | Customisation of the \"to\" field of the campaign | [optional] +**shareLink** | **string** | Link to share the campaign on social medias | [optional] +**tag** | **string** | Tag of the campaign | [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. | [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] +**sentDate** | **string** | Sent UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ). Only available if 'status' of the campaign is 'sent' | [optional] +**returnBounce** | **int** | Total number of non-delivered campaigns for a particular campaign id. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedCampaignOverviewAllOfSender.md b/docs/Model/GetExtendedCampaignOverviewAllOfSender.md new file mode 100644 index 0000000..4f79987 --- /dev/null +++ b/docs/Model/GetExtendedCampaignOverviewAllOfSender.md @@ -0,0 +1,11 @@ +# # GetExtendedCampaignOverviewAllOfSender + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Sender name of the campaign | [optional] +**email** | **string** | Sender email of the campaign | [optional] +**id** | **int** | Sender id of the campaign | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedCampaignOverviewSender.md b/docs/Model/GetExtendedCampaignOverviewSender.md deleted file mode 100644 index 7ca0634..0000000 --- a/docs/Model/GetExtendedCampaignOverviewSender.md +++ /dev/null @@ -1,12 +0,0 @@ -# GetExtendedCampaignOverviewSender - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **string** | Sender name of the campaign | [optional] -**email** | **string** | Sender email of the campaign | [optional] -**id** | **int** | Sender id of 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/GetExtendedCampaignStats.md b/docs/Model/GetExtendedCampaignStats.md index a3cf455..d67c90d 100644 --- a/docs/Model/GetExtendedCampaignStats.md +++ b/docs/Model/GetExtendedCampaignStats.md @@ -1,17 +1,16 @@ -# GetExtendedCampaignStats +# # GetExtendedCampaignStats ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**globalStats** | [**\Brevo\Client\Model\GetExtendedCampaignStatsGlobalStats**](GetExtendedCampaignStatsGlobalStats.md) | | -**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** | **object** | Statistics about the number of clicks for the links | -**statsByDomain** | [**\Brevo\Client\Model\GetStatsByDomain**](GetStatsByDomain.md) | | -**statsByDevice** | [**\Brevo\Client\Model\GetStatsByDevice**](GetStatsByDevice.md) | Statistics about the campaign on the basis of various devices | -**statsByBrowser** | [**\Brevo\Client\Model\GetStatsByBrowser**](GetStatsByBrowser.md) | Statistics about the campaign on the basis of various browsers | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**globalStats** | [**\Brevo\Client\Models\GetCampaignStats**](GetCampaignStats.md) | Overall statistics of the campaign | +**campaignStats** | [**GetCampaignStats[]**](GetCampaignStats.md) | List-wise statistics of the campaign. | +**mirrorClick** | **int** | Number of clicks on mirror link | +**remaining** | **int** | Number of remaning emails to send | +**linksStats** | **object** | Statistics about the number of clicks for the links | +**statsByDomain** | [**array**](GetCampaignStats.md) | | +**statsByDevice** | [**\Brevo\Client\Models\GetStatsByDevice**](GetStatsByDevice.md) | | +**statsByBrowser** | [**array**](GetDeviceBrowserStats.md) | | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedCampaignStatsGlobalStats.md b/docs/Model/GetExtendedCampaignStatsGlobalStats.md deleted file mode 100644 index 47c4255..0000000 --- a/docs/Model/GetExtendedCampaignStatsGlobalStats.md +++ /dev/null @@ -1,9 +0,0 @@ -# GetExtendedCampaignStatsGlobalStats - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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 d779061..5c068cc 100644 --- a/docs/Model/GetExtendedClient.md +++ b/docs/Model/GetExtendedClient.md @@ -1,10 +1,13 @@ -# GetExtendedClient +# # GetExtendedClient ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**address** | [**\Brevo\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) - +**email** | **string** | Login Email | +**firstName** | **string** | First Name | +**lastName** | **string** | Last Name | +**companyName** | **string** | Name of the company | +**address** | [**\Brevo\Client\Models\GetExtendedClientAllOfAddress**](GetExtendedClientAllOfAddress.md) | | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedClientAddress.md b/docs/Model/GetExtendedClientAddress.md deleted file mode 100644 index 15c9b1b..0000000 --- a/docs/Model/GetExtendedClientAddress.md +++ /dev/null @@ -1,13 +0,0 @@ -# GetExtendedClientAddress - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**street** | **string** | Street information | -**city** | **string** | City information | -**zipCode** | **string** | Zip Code information | -**country** | **string** | Country information | - -[[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/GetExtendedClientAllOfAddress.md b/docs/Model/GetExtendedClientAllOfAddress.md new file mode 100644 index 0000000..9f7b7c7 --- /dev/null +++ b/docs/Model/GetExtendedClientAllOfAddress.md @@ -0,0 +1,12 @@ +# # GetExtendedClientAllOfAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**street** | **string** | Street information | +**city** | **string** | City information | +**zipCode** | **string** | Zip Code information | +**country** | **string** | Country information | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedContactDetails.md b/docs/Model/GetExtendedContactDetails.md index 1200c78..948e66a 100644 --- a/docs/Model/GetExtendedContactDetails.md +++ b/docs/Model/GetExtendedContactDetails.md @@ -1,17 +1,18 @@ -# GetExtendedContactDetails +# # GetExtendedContactDetails ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**email** | **string** | Email address of the contact for which you requested the details | -**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) | -**createdAt** | **string** | Creation UTC date-time of the contact (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**modifiedAt** | **string** | Last modification UTC date-time of the contact (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**listIds** | **int[]** | | -**listUnsubscribed** | **int[]** | | [optional] -**attributes** | **object** | Set of attributes of the contact | -**statistics** | [**\Brevo\Client\Model\GetExtendedContactDetailsStatistics**](GetExtendedContactDetailsStatistics.md) | | +**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) | +**createdAt** | **string** | Creation UTC date-time of the contact (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | **string** | Last modification UTC date-time of the contact (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**listIds** | **int[]** | | +**attributes** | **object** | Set of attributes of the contact | +**statistics** | [**\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatistics**](GetExtendedContactDetailsAllOfStatistics.md) | | +**email** | **string** | Email address of the contact for which you requested the details | [optional] +**listUnsubscribed** | **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) +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedContactDetailsAllOfStatistics.md b/docs/Model/GetExtendedContactDetailsAllOfStatistics.md new file mode 100644 index 0000000..8014562 --- /dev/null +++ b/docs/Model/GetExtendedContactDetailsAllOfStatistics.md @@ -0,0 +1,17 @@ +# # GetExtendedContactDetailsAllOfStatistics + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**messagesSent** | [**\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]**](GetExtendedContactDetailsAllOfStatisticsMessagesSent.md) | Listing of the sent campaign for the contact | [optional] +**hardBounces** | [**\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]**](GetExtendedContactDetailsAllOfStatisticsMessagesSent.md) | Listing of the hardbounes generated by the contact | [optional] +**softBounces** | [**\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]**](GetExtendedContactDetailsAllOfStatisticsMessagesSent.md) | Listing of the softbounes generated by the contact | [optional] +**complaints** | [**\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]**](GetExtendedContactDetailsAllOfStatisticsMessagesSent.md) | Listing of the complaints generated by the contact | [optional] +**unsubscriptions** | [**\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptions**](GetExtendedContactDetailsAllOfStatisticsUnsubscriptions.md) | | [optional] +**opened** | [**\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsOpened[]**](GetExtendedContactDetailsAllOfStatisticsOpened.md) | Listing of the openings generated by the contact | [optional] +**clicked** | [**\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsClicked[]**](GetExtendedContactDetailsAllOfStatisticsClicked.md) | Listing of the clicks generated by the contact | [optional] +**transacAttributes** | **object[]** | Listing of the transactional attributes for the contact | [optional] +**delivered** | [**\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]**](GetExtendedContactDetailsAllOfStatisticsMessagesSent.md) | Listing of the delivered campaign for the contact | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedContactDetailsAllOfStatisticsClicked.md b/docs/Model/GetExtendedContactDetailsAllOfStatisticsClicked.md new file mode 100644 index 0000000..1eb20c1 --- /dev/null +++ b/docs/Model/GetExtendedContactDetailsAllOfStatisticsClicked.md @@ -0,0 +1,10 @@ +# # GetExtendedContactDetailsAllOfStatisticsClicked + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaignId** | **int** | ID of the campaign which generated the event | +**links** | [**\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsLinks[]**](GetExtendedContactDetailsAllOfStatisticsLinks.md) | Listing of the clicked links for the campaign | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedContactDetailsAllOfStatisticsLinks.md b/docs/Model/GetExtendedContactDetailsAllOfStatisticsLinks.md new file mode 100644 index 0000000..6c9f904 --- /dev/null +++ b/docs/Model/GetExtendedContactDetailsAllOfStatisticsLinks.md @@ -0,0 +1,12 @@ +# # GetExtendedContactDetailsAllOfStatisticsLinks + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**count** | **int** | Number of clicks on this link for the campaign | +**eventTime** | **string** | 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 | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedContactDetailsAllOfStatisticsMessagesSent.md b/docs/Model/GetExtendedContactDetailsAllOfStatisticsMessagesSent.md new file mode 100644 index 0000000..0972f03 --- /dev/null +++ b/docs/Model/GetExtendedContactDetailsAllOfStatisticsMessagesSent.md @@ -0,0 +1,10 @@ +# # GetExtendedContactDetailsAllOfStatisticsMessagesSent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaignId** | **int** | ID of the campaign which generated the event | +**eventTime** | **string** | UTC date-time of the event | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedContactDetailsAllOfStatisticsOpened.md b/docs/Model/GetExtendedContactDetailsAllOfStatisticsOpened.md new file mode 100644 index 0000000..714ea94 --- /dev/null +++ b/docs/Model/GetExtendedContactDetailsAllOfStatisticsOpened.md @@ -0,0 +1,12 @@ +# # GetExtendedContactDetailsAllOfStatisticsOpened + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaignId** | **int** | ID of the campaign which generated the event | +**count** | **int** | Number of openings for the campaign | +**eventTime** | **string** | UTC date-time of the event | +**ip** | **string** | IP from which the user has opened the email | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedContactDetailsAllOfStatisticsUnsubscriptions.md b/docs/Model/GetExtendedContactDetailsAllOfStatisticsUnsubscriptions.md new file mode 100644 index 0000000..6dd095c --- /dev/null +++ b/docs/Model/GetExtendedContactDetailsAllOfStatisticsUnsubscriptions.md @@ -0,0 +1,10 @@ +# # GetExtendedContactDetailsAllOfStatisticsUnsubscriptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**userUnsubscription** | [**\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription[]**](GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription.md) | Contact unsubscribe via unsubscription link in a campaign | +**adminUnsubscription** | [**\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription[]**](GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription.md) | Contact has been unsubscribed from the administrator | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription.md b/docs/Model/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription.md new file mode 100644 index 0000000..dbb0272 --- /dev/null +++ b/docs/Model/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription.md @@ -0,0 +1,10 @@ +# # GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**eventTime** | **string** | UTC date-time of the event | +**ip** | **string** | IP from which the user has been unsubscribed | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription.md b/docs/Model/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription.md new file mode 100644 index 0000000..dee3f1f --- /dev/null +++ b/docs/Model/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription.md @@ -0,0 +1,11 @@ +# # GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaignId** | **int** | ID of the campaign which generated the event | +**eventTime** | **string** | UTC date-time of the event | +**ip** | **string** | IP from which the user has unsubscribed | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedContactDetailsStatistics.md b/docs/Model/GetExtendedContactDetailsStatistics.md deleted file mode 100644 index a8b7977..0000000 --- a/docs/Model/GetExtendedContactDetailsStatistics.md +++ /dev/null @@ -1,18 +0,0 @@ -# GetExtendedContactDetailsStatistics - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**messagesSent** | [**\Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[]**](GetExtendedContactDetailsStatisticsMessagesSent.md) | Listing of the sent campaign for the contact | [optional] -**hardBounces** | [**\Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[]**](GetExtendedContactDetailsStatisticsMessagesSent.md) | Listing of the hardbounes generated by the contact | [optional] -**softBounces** | [**\Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[]**](GetExtendedContactDetailsStatisticsMessagesSent.md) | Listing of the softbounes generated by the contact | [optional] -**complaints** | [**\Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[]**](GetExtendedContactDetailsStatisticsMessagesSent.md) | Listing of the complaints generated by the contact | [optional] -**unsubscriptions** | [**\Brevo\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptions**](GetExtendedContactDetailsStatisticsUnsubscriptions.md) | | [optional] -**opened** | [**\Brevo\Client\Model\GetExtendedContactDetailsStatisticsOpened[]**](GetExtendedContactDetailsStatisticsOpened.md) | Listing of the openings generated by the contact | [optional] -**clicked** | [**\Brevo\Client\Model\GetExtendedContactDetailsStatisticsClicked[]**](GetExtendedContactDetailsStatisticsClicked.md) | Listing of the clicks generated by the contact | [optional] -**transacAttributes** | **object[]** | Listing of the transactional attributes for the contact | [optional] -**delivered** | [**\Brevo\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[]**](GetExtendedContactDetailsStatisticsMessagesSent.md) | Listing of the delivered campaign for the contact | [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/GetExtendedContactDetailsStatisticsClicked.md b/docs/Model/GetExtendedContactDetailsStatisticsClicked.md deleted file mode 100644 index 9316f75..0000000 --- a/docs/Model/GetExtendedContactDetailsStatisticsClicked.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetExtendedContactDetailsStatisticsClicked - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**campaignId** | **int** | ID of the campaign which generated the event | -**links** | [**\Brevo\Client\Model\GetExtendedContactDetailsStatisticsLinks[]**](GetExtendedContactDetailsStatisticsLinks.md) | Listing of the clicked links for 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/GetExtendedContactDetailsStatisticsDelivered.md b/docs/Model/GetExtendedContactDetailsStatisticsDelivered.md deleted file mode 100644 index bab4f11..0000000 --- a/docs/Model/GetExtendedContactDetailsStatisticsDelivered.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetExtendedContactDetailsStatisticsDelivered - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**campaignId** | **int** | ID of the campaign which generated the event | -**eventTime** | **string** | 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/GetExtendedContactDetailsStatisticsLinks.md b/docs/Model/GetExtendedContactDetailsStatisticsLinks.md deleted file mode 100644 index 3baf33a..0000000 --- a/docs/Model/GetExtendedContactDetailsStatisticsLinks.md +++ /dev/null @@ -1,13 +0,0 @@ -# GetExtendedContactDetailsStatisticsLinks - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**count** | **int** | Number of clicks on this link for the campaign | -**eventTime** | **string** | 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 | - -[[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/GetExtendedContactDetailsStatisticsMessagesSent.md b/docs/Model/GetExtendedContactDetailsStatisticsMessagesSent.md deleted file mode 100644 index b7b14c0..0000000 --- a/docs/Model/GetExtendedContactDetailsStatisticsMessagesSent.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetExtendedContactDetailsStatisticsMessagesSent - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**campaignId** | **int** | ID of the campaign which generated the event | -**eventTime** | **string** | 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 deleted file mode 100644 index 9931b77..0000000 --- a/docs/Model/GetExtendedContactDetailsStatisticsOpened.md +++ /dev/null @@ -1,13 +0,0 @@ -# GetExtendedContactDetailsStatisticsOpened - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**campaignId** | **int** | ID of the campaign which generated the event | -**count** | **int** | Number of openings for the campaign | -**eventTime** | **string** | 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/GetExtendedContactDetailsStatisticsUnsubscriptions.md b/docs/Model/GetExtendedContactDetailsStatisticsUnsubscriptions.md deleted file mode 100644 index 86c348f..0000000 --- a/docs/Model/GetExtendedContactDetailsStatisticsUnsubscriptions.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetExtendedContactDetailsStatisticsUnsubscriptions - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**userUnsubscription** | [**\Brevo\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[]**](GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.md) | Contact unsubscribe via unsubscription link in a campaign | -**adminUnsubscription** | [**\Brevo\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[]**](GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.md) | Contact has been unsubscribed from the administrator | - -[[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 deleted file mode 100644 index 898c563..0000000 --- a/docs/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**eventTime** | **string** | UTC date-time of the event | -**ip** | **string** | IP from which the user has been unsubscribed | [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/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.md b/docs/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.md deleted file mode 100644 index 1167e0a..0000000 --- a/docs/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.md +++ /dev/null @@ -1,12 +0,0 @@ -# GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**campaignId** | **int** | ID of the campaign which generated the event | -**eventTime** | **string** | UTC date-time of the event | -**ip** | **string** | IP from which the user has unsubscribed | [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/GetExtendedList.md b/docs/Model/GetExtendedList.md index 05cae4e..1196b7a 100644 --- a/docs/Model/GetExtendedList.md +++ b/docs/Model/GetExtendedList.md @@ -1,13 +1,17 @@ -# GetExtendedList +# # GetExtendedList ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**folderId** | **int** | ID of the folder | -**createdAt** | **string** | Creation UTC date-time of the list (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**campaignStats** | [**\Brevo\Client\Model\GetExtendedListCampaignStats[]**](GetExtendedListCampaignStats.md) | | [optional] -**dynamicList** | **bool** | Status telling if the list is dynamic or not (true=dynamic, false=not dynamic) | [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) - +**id** | **int** | ID of the list | +**name** | **string** | Name of the list | +**totalBlacklisted** | **int** | Number of blacklisted contacts in the list | +**totalSubscribers** | **int** | Number of contacts in the list | +**uniqueSubscribers** | **int** | Number of unique contacts in the list | +**folderId** | **int** | ID of the folder | +**createdAt** | **string** | Creation UTC date-time of the list (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**campaignStats** | [**\Brevo\Client\Models\GetExtendedListAllOfCampaignStats[]**](GetExtendedListAllOfCampaignStats.md) | | [optional] +**dynamicList** | **bool** | Status telling if the list is dynamic or not (true=dynamic, false=not dynamic) | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedListAllOfCampaignStats.md b/docs/Model/GetExtendedListAllOfCampaignStats.md new file mode 100644 index 0000000..977eaca --- /dev/null +++ b/docs/Model/GetExtendedListAllOfCampaignStats.md @@ -0,0 +1,10 @@ +# # GetExtendedListAllOfCampaignStats + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaignId** | **int** | ID of the campaign | +**stats** | [**\Brevo\Client\Models\GetCampaignStats**](GetCampaignStats.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedListCampaignStats.md b/docs/Model/GetExtendedListCampaignStats.md deleted file mode 100644 index 5ea98e2..0000000 --- a/docs/Model/GetExtendedListCampaignStats.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetExtendedListCampaignStats - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**campaignId** | **int** | ID of the campaign | -**stats** | [**\Brevo\Client\Model\GetCampaignStats**](GetCampaignStats.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/GetExternalFeedByUUID.md b/docs/Model/GetExternalFeedByUUID.md index ecd3ca4..d4c2058 100644 --- a/docs/Model/GetExternalFeedByUUID.md +++ b/docs/Model/GetExternalFeedByUUID.md @@ -1,21 +1,20 @@ -# GetExternalFeedByUUID +# # GetExternalFeedByUUID ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | ID of the feed | -**name** | **string** | Name of the feed | -**url** | **string** | URL of the feed | -**authType** | **string** | Auth type of the feed: * `basic` * `token` * `noAuth` | -**username** | **string** | Username for authType `basic` | [optional] -**password** | **string** | Password for authType `basic` | [optional] -**token** | **string** | Token for authType `token` | [optional] -**headers** | [**\Brevo\Client\Model\GetExternalFeedByUUIDHeaders[]**](GetExternalFeedByUUIDHeaders.md) | Custom headers for the feed | -**maxRetries** | **int** | Maximum number of retries on the feed url | -**cache** | **bool** | Toggle caching of feed url response | -**createdAt** | [**\DateTime**] | Datetime on which the feed was created | -**modifiedAt** | [**\DateTime**] | Datetime on which the feed was modified | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**id** | **string** | ID of the feed | +**name** | **string** | Name of the feed | +**url** | **string** | URL of the feed | +**authType** | **string** | Auth type of the feed: * `basic` * `token` * `noAuth` | +**headers** | [**\Brevo\Client\Models\GetExternalFeedByUUIDHeadersInner[]**](GetExternalFeedByUUIDHeadersInner.md) | Custom headers for the feed | +**maxRetries** | **int** | Maximum number of retries on the feed url | [default to 5] +**cache** | **bool** | Toggle caching of feed url response | +**createdAt** | **\DateTime** | Datetime on which the feed was created | +**modifiedAt** | **\DateTime** | Datetime on which the feed was modified | +**username** | **string** | Username for authType `basic` | [optional] +**password** | **string** | Password for authType `basic` | [optional] +**token** | **string** | Token for authType `token` | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExternalFeedByUUIDHeaders.md b/docs/Model/GetExternalFeedByUUIDHeaders.md deleted file mode 100644 index 2b01f98..0000000 --- a/docs/Model/GetExternalFeedByUUIDHeaders.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetExternalFeedByUUIDHeaders - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **string** | Name of the header | [optional] -**value** | **string** | Value of the header | [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/GetExternalFeedByUUIDHeadersInner.md b/docs/Model/GetExternalFeedByUUIDHeadersInner.md new file mode 100644 index 0000000..fe99cc1 --- /dev/null +++ b/docs/Model/GetExternalFeedByUUIDHeadersInner.md @@ -0,0 +1,10 @@ +# # GetExternalFeedByUUIDHeadersInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of the header | [optional] +**value** | **string** | Value of the header | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetFolder.md b/docs/Model/GetFolder.md index 2043959..701927f 100644 --- a/docs/Model/GetFolder.md +++ b/docs/Model/GetFolder.md @@ -1,14 +1,13 @@ -# GetFolder +# # GetFolder ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | ID of the folder | -**name** | **string** | Name of the folder | -**totalBlacklisted** | **int** | Number of blacklisted contacts in the folder | -**totalSubscribers** | **int** | Number of contacts in the folder | -**uniqueSubscribers** | **int** | Number of unique contacts in the folder | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**id** | **int** | ID of the folder | +**name** | **string** | Name of the folder | +**totalBlacklisted** | **int** | Number of blacklisted contacts in the folder | +**totalSubscribers** | **int** | Number of contacts in the folder | +**uniqueSubscribers** | **int** | Number of unique contacts in the folder | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetFolderLists.md b/docs/Model/GetFolderLists.md index fcc8e7e..de30b4c 100644 --- a/docs/Model/GetFolderLists.md +++ b/docs/Model/GetFolderLists.md @@ -1,11 +1,10 @@ -# GetFolderLists +# # GetFolderLists ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**lists** | **object[]** | | [optional] -**count** | **int** | Number of lists in the folder | [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) - +**lists** | [**GetList[]**](GetList.md) | | [optional] +**count** | **int** | Number of lists in the folder | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetFolders.md b/docs/Model/GetFolders.md index efdfe2f..ca1f24d 100644 --- a/docs/Model/GetFolders.md +++ b/docs/Model/GetFolders.md @@ -1,11 +1,10 @@ -# GetFolders +# # GetFolders ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**folders** | **object[]** | | [optional] -**count** | **int** | Number of folders available in 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) - +**folders** | [**GetFolder[]**](GetFolder.md) | | [optional] +**count** | **int** | Number of folders available in your account | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetInboundEmailEvents.md b/docs/Model/GetInboundEmailEvents.md index f2628e1..921b413 100644 --- a/docs/Model/GetInboundEmailEvents.md +++ b/docs/Model/GetInboundEmailEvents.md @@ -1,10 +1,9 @@ -# GetInboundEmailEvents +# # GetInboundEmailEvents ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**events** | [**\Brevo\Client\Model\GetInboundEmailEventsEvents[]**](GetInboundEmailEventsEvents.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) - +**events** | [**\Brevo\Client\Models\GetInboundEmailEventsEventsInner[]**](GetInboundEmailEventsEventsInner.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetInboundEmailEventsByUuid.md b/docs/Model/GetInboundEmailEventsByUuid.md index 6b4640b..a8fff0b 100644 --- a/docs/Model/GetInboundEmailEventsByUuid.md +++ b/docs/Model/GetInboundEmailEventsByUuid.md @@ -1,17 +1,16 @@ -# GetInboundEmailEventsByUuid +# # GetInboundEmailEventsByUuid ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**receivedAt** | [**\DateTime**] | Date when email was received on SMTP relay | [optional] -**deliveredAt** | [**\DateTime**] | Date when email was delivered successfully to client’s webhook | [optional] -**recipient** | **string** | Recipient’s email address | [optional] -**sender** | **string** | Sender’s email address | [optional] -**messageId** | **string** | Value of the Message-ID header. This will be present only after the processing is done. | [optional] -**subject** | **string** | Value of the Subject header. This will be present only after the processing is done. | [optional] -**attachments** | [**\Brevo\Client\Model\GetInboundEmailEventsByUuidAttachments[]**](GetInboundEmailEventsByUuidAttachments.md) | List of attachments of the email. This will be present only after the processing is done. | [optional] -**logs** | [**\Brevo\Client\Model\GetInboundEmailEventsByUuidLogs[]**](GetInboundEmailEventsByUuidLogs.md) | List of events/logs that describe the lifecycle of the email on SIB platform | [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) - +**receivedAt** | **\DateTime** | Date when email was received on SMTP relay | [optional] +**deliveredAt** | **\DateTime** | Date when email was delivered successfully to client’s webhook | [optional] +**recipient** | **string** | Recipient’s email address | [optional] +**sender** | **string** | Sender’s email address | [optional] +**messageId** | **string** | Value of the Message-ID header. This will be present only after the processing is done. | [optional] +**subject** | **string** | Value of the Subject header. This will be present only after the processing is done. | [optional] +**attachments** | [**\Brevo\Client\Models\GetInboundEmailEventsByUuidAttachmentsInner[]**](GetInboundEmailEventsByUuidAttachmentsInner.md) | List of attachments of the email. This will be present only after the processing is done. | [optional] +**logs** | [**\Brevo\Client\Models\GetInboundEmailEventsByUuidLogsInner[]**](GetInboundEmailEventsByUuidLogsInner.md) | List of events/logs that describe the lifecycle of the email on SIB platform | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetInboundEmailEventsByUuidAttachments.md b/docs/Model/GetInboundEmailEventsByUuidAttachmentsInner.md similarity index 52% rename from docs/Model/GetInboundEmailEventsByUuidAttachments.md rename to docs/Model/GetInboundEmailEventsByUuidAttachmentsInner.md index f1af599..fc06f96 100644 --- a/docs/Model/GetInboundEmailEventsByUuidAttachments.md +++ b/docs/Model/GetInboundEmailEventsByUuidAttachmentsInner.md @@ -1,13 +1,12 @@ -# GetInboundEmailEventsByUuidAttachments +# # GetInboundEmailEventsByUuidAttachmentsInner ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | filename specified in the Content-Disposition header of the attachment | [optional] -**contentType** | **string** | value of the Content-Type header of the attachment | [optional] -**contentId** | **string** | value of the Content-ID header of the attachment. | [optional] -**contentLength** | **int** | size of the attachment in bytes | [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) - +**name** | **string** | filename specified in the Content-Disposition header of the attachment | [optional] +**contentType** | **string** | value of the Content-Type header of the attachment | [optional] +**contentId** | **string** | value of the Content-ID header of the attachment. | [optional] +**contentLength** | **int** | size of the attachment in bytes | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetInboundEmailEventsByUuidLogs.md b/docs/Model/GetInboundEmailEventsByUuidLogs.md deleted file mode 100644 index 6325cc7..0000000 --- a/docs/Model/GetInboundEmailEventsByUuidLogs.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetInboundEmailEventsByUuidLogs - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**date** | [**\DateTime**] | Date of the event | [optional] -**type** | **string** | Type of the event | [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/GetInboundEmailEventsByUuidLogsInner.md b/docs/Model/GetInboundEmailEventsByUuidLogsInner.md new file mode 100644 index 0000000..cc000cd --- /dev/null +++ b/docs/Model/GetInboundEmailEventsByUuidLogsInner.md @@ -0,0 +1,10 @@ +# # GetInboundEmailEventsByUuidLogsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**date** | **\DateTime** | Date of the event | [optional] +**type** | **string** | Type of the event | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetInboundEmailEventsEvents.md b/docs/Model/GetInboundEmailEventsEvents.md deleted file mode 100644 index 4804fc4..0000000 --- a/docs/Model/GetInboundEmailEventsEvents.md +++ /dev/null @@ -1,13 +0,0 @@ -# GetInboundEmailEventsEvents - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**uuid** | **string** | UUID that can be used to fetch additional data | -**date** | [**\DateTime**] | Date when email was received on SMTP relay | -**sender** | **string** | Sender’s email address | -**recipient** | **string** | Recipient’s email address | - -[[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/GetInboundEmailEventsEventsInner.md b/docs/Model/GetInboundEmailEventsEventsInner.md new file mode 100644 index 0000000..7807a9c --- /dev/null +++ b/docs/Model/GetInboundEmailEventsEventsInner.md @@ -0,0 +1,12 @@ +# # GetInboundEmailEventsEventsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **string** | UUID that can be used to fetch additional data | +**date** | **\DateTime** | Date when email was received on SMTP relay | +**sender** | **string** | Sender’s email address | +**recipient** | **string** | Recipient’s email address | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetInvitedUsersList.md b/docs/Model/GetInvitedUsersList.md index 0766463..d6e1582 100644 --- a/docs/Model/GetInvitedUsersList.md +++ b/docs/Model/GetInvitedUsersList.md @@ -1,10 +1,9 @@ -# GetInvitedUsersList +# # GetInvitedUsersList ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**users** | [**\Brevo\Client\Model\GetInvitedUsersListUsers[]**](GetInvitedUsersListUsers.md) | Get invited users 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) - +**users** | [**\Brevo\Client\Models\GetInvitedUsersListUsersInner[]**](GetInvitedUsersListUsersInner.md) | Get invited users list | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetInvitedUsersListFeatureAccess.md b/docs/Model/GetInvitedUsersListFeatureAccess.md deleted file mode 100644 index f1f28e9..0000000 --- a/docs/Model/GetInvitedUsersListFeatureAccess.md +++ /dev/null @@ -1,12 +0,0 @@ -# GetInvitedUsersListFeatureAccess - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**marketing** | **object** | Marketing features accessiblity. | [optional] -**conversations** | **object** | Conversations features accessiblity. | [optional] -**crm** | **object** | CRM features accessiblity. | [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/GetInvitedUsersListUsers.md b/docs/Model/GetInvitedUsersListUsers.md deleted file mode 100644 index a965bb2..0000000 --- a/docs/Model/GetInvitedUsersListUsers.md +++ /dev/null @@ -1,13 +0,0 @@ -# GetInvitedUsersListUsers - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**email** | **string** | Email address of the user. | -**isOwner** | **string** | Flag for indicating is user owner of the organization. | -**status** | **string** | Status of the invited user. | -**featureAccess** | [**\Brevo\Client\Model\GetInvitedUsersListFeatureAccess**](GetInvitedUsersListFeatureAccess.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/GetInvitedUsersListUsersInner.md b/docs/Model/GetInvitedUsersListUsersInner.md new file mode 100644 index 0000000..4ea3b7c --- /dev/null +++ b/docs/Model/GetInvitedUsersListUsersInner.md @@ -0,0 +1,12 @@ +# # GetInvitedUsersListUsersInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email** | **string** | Email address of the user. | +**isOwner** | **string** | Flag for indicating is user owner of the organization. | +**status** | **string** | Status of the invited user. | +**featureAccess** | [**\Brevo\Client\Models\GetInvitedUsersListUsersInnerFeatureAccess**](GetInvitedUsersListUsersInnerFeatureAccess.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetInvitedUsersListUsersInnerFeatureAccess.md b/docs/Model/GetInvitedUsersListUsersInnerFeatureAccess.md new file mode 100644 index 0000000..a2505ab --- /dev/null +++ b/docs/Model/GetInvitedUsersListUsersInnerFeatureAccess.md @@ -0,0 +1,11 @@ +# # GetInvitedUsersListUsersInnerFeatureAccess + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**marketing** | **string** | Marketing features accessiblity. | [optional] +**conversations** | **string** | Conversations features accessiblity. | [optional] +**crm** | **string** | CRM features accessiblity. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetIp.md b/docs/Model/GetIp.md index efc77a8..2d00651 100644 --- a/docs/Model/GetIp.md +++ b/docs/Model/GetIp.md @@ -1,13 +1,12 @@ -# GetIp +# # GetIp ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | ID of the dedicated IP | -**ip** | **string** | Dedicated IP | -**active** | **bool** | Status of the IP (true=active, false=inactive) | -**domain** | **string** | Domain associated to the IP | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**id** | **int** | ID of the dedicated IP | +**ip** | **string** | Dedicated IP | +**active** | **bool** | Status of the IP (true=active, false=inactive) | +**domain** | **string** | Domain associated to the IP | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetIpFromSender.md b/docs/Model/GetIpFromSender.md index d9fc9cc..656f8f5 100644 --- a/docs/Model/GetIpFromSender.md +++ b/docs/Model/GetIpFromSender.md @@ -1,13 +1,12 @@ -# GetIpFromSender +# # GetIpFromSender ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | ID of the dedicated IP | -**ip** | **string** | Dedicated IP | -**domain** | **string** | Domain associated to the IP | -**weight** | **int** | Weight of the IP | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**id** | **int** | ID of the dedicated IP | +**ip** | **string** | Dedicated IP | +**domain** | **string** | Domain associated to the IP | +**weight** | **int** | Weight of the IP | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetIps.md b/docs/Model/GetIps.md index 0dfd783..babf29b 100644 --- a/docs/Model/GetIps.md +++ b/docs/Model/GetIps.md @@ -1,10 +1,9 @@ -# GetIps +# # GetIps ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ips** | [**\Brevo\Client\Model\GetIp[]**](GetIp.md) | Dedicated IP(s) available on your account | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**ips** | [**\Brevo\Client\Models\GetIp[]**](GetIp.md) | Dedicated IP(s) available on your account | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetIpsFromSender.md b/docs/Model/GetIpsFromSender.md index 4aa592f..22944b9 100644 --- a/docs/Model/GetIpsFromSender.md +++ b/docs/Model/GetIpsFromSender.md @@ -1,10 +1,9 @@ -# GetIpsFromSender +# # GetIpsFromSender ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ips** | [**\Brevo\Client\Model\GetIpFromSender[]**](GetIpFromSender.md) | Dedicated IP(s) linked to a sender | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**ips** | [**\Brevo\Client\Models\GetIpFromSender[]**](GetIpFromSender.md) | Dedicated IP(s) linked to a sender | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetList.md b/docs/Model/GetList.md index 483db1f..939d4da 100644 --- a/docs/Model/GetList.md +++ b/docs/Model/GetList.md @@ -1,14 +1,13 @@ -# GetList +# # GetList ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | ID of the list | -**name** | **string** | Name of the list | -**totalBlacklisted** | **int** | Number of blacklisted contacts in the list | -**totalSubscribers** | **int** | Number of contacts in the list | -**uniqueSubscribers** | **int** | Number of unique contacts in the list | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**id** | **int** | ID of the list | +**name** | **string** | Name of the list | +**totalBlacklisted** | **int** | Number of blacklisted contacts in the list | +**totalSubscribers** | **int** | Number of contacts in the list | +**uniqueSubscribers** | **int** | Number of unique contacts in the list | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetLists.md b/docs/Model/GetLists.md index c46253b..ca4cccb 100644 --- a/docs/Model/GetLists.md +++ b/docs/Model/GetLists.md @@ -1,11 +1,10 @@ -# GetLists +# # GetLists ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**lists** | **object[]** | Listing of all the lists available in your account | [optional] -**count** | **int** | Number of lists in 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) - +**lists** | [**\Brevo\Client\Models\GetListsListsInner[]**](GetListsListsInner.md) | Listing of all the lists available in your account | [optional] +**count** | **int** | Number of lists in your account | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetListsListsInner.md b/docs/Model/GetListsListsInner.md new file mode 100644 index 0000000..b6a1d24 --- /dev/null +++ b/docs/Model/GetListsListsInner.md @@ -0,0 +1,14 @@ +# # GetListsListsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | ID of the list | +**name** | **string** | Name of the list | +**totalBlacklisted** | **int** | Number of blacklisted contacts in the list | +**totalSubscribers** | **int** | Number of contacts in the list | +**uniqueSubscribers** | **int** | Number of unique contacts in the list | +**folderId** | **int** | ID of the folder | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetOrders.md b/docs/Model/GetOrders.md deleted file mode 100644 index d84c1ea..0000000 --- a/docs/Model/GetOrders.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetOrders - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**orders** | **object[]** | | [optional] -**count** | **int** | Number of orders | [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/GetPaymentRequest.md b/docs/Model/GetPaymentRequest.md new file mode 100644 index 0000000..d555234 --- /dev/null +++ b/docs/Model/GetPaymentRequest.md @@ -0,0 +1,15 @@ +# # GetPaymentRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**reference** | **string** | Reference of the payment request, it will appear on the payment page. | +**status** | **string** | Status of the payment request. | +**cart** | [**\Brevo\Client\Models\Cart**](Cart.md) | | +**notification** | [**\Brevo\Client\Models\Notification**](Notification.md) | | +**configuration** | [**\Brevo\Client\Models\Configuration**](Configuration.md) | | [optional] +**contactId** | **int** | Brevo ID of the contact requested to pay. | [optional] +**numberOfRemindersSent** | **int** | number of reminders sent. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetProcess.md b/docs/Model/GetProcess.md index 860892a..c3784b9 100644 --- a/docs/Model/GetProcess.md +++ b/docs/Model/GetProcess.md @@ -1,13 +1,12 @@ -# GetProcess +# # GetProcess ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | Id of the process | -**status** | **string** | Status of the process | -**name** | **string** | Process name | -**exportUrl** | **string** | URL on which send export the of contacts once the process is completed | [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) - +**id** | **int** | Id of the process | +**status** | **string** | Status of the process | +**name** | **string** | Process name | +**exportUrl** | **string** | URL on which send export the of contacts once the process is completed | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetProcesses.md b/docs/Model/GetProcesses.md index af62f02..edfdd87 100644 --- a/docs/Model/GetProcesses.md +++ b/docs/Model/GetProcesses.md @@ -1,11 +1,10 @@ -# GetProcesses +# # GetProcesses ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**processes** | [**\Brevo\Client\Model\GetProcess[]**](GetProcess.md) | List of processes available on your account | [optional] -**count** | **int** | Number of processes available on 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) - +**processes** | [**\Brevo\Client\Models\GetProcess[]**](GetProcess.md) | List of processes available on your account | [optional] +**count** | **int** | Number of processes available on your account | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetProductDetails.md b/docs/Model/GetProductDetails.md index 16e5654..e1362d3 100644 --- a/docs/Model/GetProductDetails.md +++ b/docs/Model/GetProductDetails.md @@ -1,24 +1,23 @@ -# GetProductDetails +# # GetProductDetails ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Product ID for which you requested the details | -**name** | **string** | Name of the product for which you requested the details | -**createdAt** | **string** | Creation UTC date-time of the product (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**modifiedAt** | **string** | Last modification UTC date-time of the product (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**url** | **string** | URL to the product | [optional] -**imageUrl** | **string** | Absolute URL to the cover image of the product | [optional] -**sku** | **string** | Product identifier from the shop | [optional] -**price** | **float** | Price of the product | [optional] -**categories** | **string[]** | Category ID-s of the product | [optional] -**parentId** | **string** | Parent product id of the product | [optional] -**s3Original** | **string** | S3 url of original image | [optional] -**s3ThumbAnalytics** | **string** | S3 thumbnail url of original image in 120x120 dimension for analytics section | -**metaInfo** | **object** | Meta data of product such as description, vendor, producer, stock level, etc. | [optional] -**s3ThumbEditor** | **string** | S3 thumbnail url of original image in 600x400 dimension for editor section | -**isDeleted** | **bool** | product deleted from the shop's database | [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) - +**id** | **string** | Product ID for which you requested the details | +**name** | **string** | Name of the product for which you requested the details | +**createdAt** | **string** | Creation UTC date-time of the product (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | **string** | Last modification UTC date-time of the product (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**s3ThumbAnalytics** | **string** | S3 thumbnail url of original image in 120x120 dimension for analytics section | +**s3ThumbEditor** | **string** | S3 thumbnail url of original image in 600x400 dimension for editor section | +**url** | **string** | URL to the product | [optional] +**imageUrl** | **string** | Absolute URL to the cover image of the product | [optional] +**sku** | **string** | Product identifier from the shop | [optional] +**price** | **float** | Price of the product | [optional] +**categories** | **string[]** | Category ID-s of the product | [optional] +**parentId** | **string** | Parent product id of the product | [optional] +**s3Original** | **string** | S3 url of original image | [optional] +**metaInfo** | **object** | Meta data of product such as description, vendor, producer, stock level, etc. | [optional] +**isDeleted** | **bool** | product deleted from the shop's database | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetProducts.md b/docs/Model/GetProducts.md index 48512f0..3818b0d 100644 --- a/docs/Model/GetProducts.md +++ b/docs/Model/GetProducts.md @@ -1,11 +1,10 @@ -# GetProducts +# # GetProducts ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**products** | **object[]** | | -**count** | **int** | Number of products | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**products** | [**GetProductDetails[]**](GetProductDetails.md) | | +**count** | **int** | Number of products | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetReports.md b/docs/Model/GetReports.md index 9e44db8..31b1dfc 100644 --- a/docs/Model/GetReports.md +++ b/docs/Model/GetReports.md @@ -1,10 +1,9 @@ -# GetReports +# # GetReports ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**reports** | [**\Brevo\Client\Model\GetReportsReports[]**](GetReportsReports.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) - +**reports** | [**\Brevo\Client\Models\GetReportsReportsInner[]**](GetReportsReportsInner.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetReportsReports.md b/docs/Model/GetReportsReports.md deleted file mode 100644 index 015ddca..0000000 --- a/docs/Model/GetReportsReports.md +++ /dev/null @@ -1,22 +0,0 @@ -# GetReportsReports - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**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 | -**softBounces** | **int** | Number of softbounces for the date | -**clicks** | **int** | Number of clicks for the date | -**uniqueClicks** | **int** | Number of unique clicks for the date | -**opens** | **int** | Number of openings for the date | -**uniqueOpens** | **int** | Number of unique openings for the date | -**spamReports** | **int** | Number of complaints (spam reports) for the date | -**blocked** | **int** | Number of blocked emails for the date | -**invalid** | **int** | Number of invalid emails for the date | -**unsubscribed** | **int** | Number of unsubscribed emails for the date | - -[[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/GetReportsReportsInner.md b/docs/Model/GetReportsReportsInner.md new file mode 100644 index 0000000..7779b5f --- /dev/null +++ b/docs/Model/GetReportsReportsInner.md @@ -0,0 +1,21 @@ +# # GetReportsReportsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**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 | +**softBounces** | **int** | Number of softbounces for the date | +**clicks** | **int** | Number of clicks for the date | +**uniqueClicks** | **int** | Number of unique clicks for the date | +**opens** | **int** | Number of openings for the date | +**uniqueOpens** | **int** | Number of unique openings for the date | +**spamReports** | **int** | Number of complaints (spam reports) for the date | +**blocked** | **int** | Number of blocked emails for the date | +**invalid** | **int** | Number of invalid emails for the date | +**unsubscribed** | **int** | Number of unsubscribed emails for the date | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetScheduledEmailByBatchId.md b/docs/Model/GetScheduledEmailByBatchId.md index 72bc67a..85ac34d 100644 --- a/docs/Model/GetScheduledEmailByBatchId.md +++ b/docs/Model/GetScheduledEmailByBatchId.md @@ -1,10 +1,10 @@ -# GetScheduledEmailByBatchId +# # GetScheduledEmailByBatchId ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**count** | **int** | Total number of batches | [optional] -**batches** | [**\Brevo\Client\Model\GetScheduledEmailByBatchIdBatches[]**](GetScheduledEmailByBatchIdBatches.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) +**count** | **int** | Total number of batches | [optional] +**batches** | [**\Brevo\Client\Models\GetScheduledEmailByBatchIdBatchesInner[]**](GetScheduledEmailByBatchIdBatchesInner.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetScheduledEmailByBatchIdBatches.md b/docs/Model/GetScheduledEmailByBatchIdBatches.md deleted file mode 100644 index 2859003..0000000 --- a/docs/Model/GetScheduledEmailByBatchIdBatches.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetScheduledEmailByBatchIdBatches - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**scheduledAt** | [**\DateTime**] | Datetime for which the batch was scheduled | -**createdAt** | [**\DateTime**] | Datetime on which the batch was scheduled | -**status** | **string** | Current status of the scheduled batch | - -[[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/GetScheduledEmailByBatchIdBatchesInner.md b/docs/Model/GetScheduledEmailByBatchIdBatchesInner.md new file mode 100644 index 0000000..10f0150 --- /dev/null +++ b/docs/Model/GetScheduledEmailByBatchIdBatchesInner.md @@ -0,0 +1,11 @@ +# # GetScheduledEmailByBatchIdBatchesInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**scheduledAt** | **\DateTime** | Datetime for which the batch was scheduled | +**createdAt** | **\DateTime** | Datetime on which the batch was scheduled | +**status** | **string** | Current status of the scheduled batch | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetScheduledEmailById200Response.md b/docs/Model/GetScheduledEmailById200Response.md new file mode 100644 index 0000000..8d02677 --- /dev/null +++ b/docs/Model/GetScheduledEmailById200Response.md @@ -0,0 +1,13 @@ +# # GetScheduledEmailById200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**scheduledAt** | **\DateTime** | Datetime for which the email was scheduled | +**createdAt** | **\DateTime** | Datetime on which the email was scheduled | +**status** | **string** | Current status of the scheduled email | +**count** | **int** | Total number of batches | [optional] +**batches** | [**\Brevo\Client\Models\GetScheduledEmailByBatchIdBatchesInner[]**](GetScheduledEmailByBatchIdBatchesInner.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetScheduledEmailByMessageId.md b/docs/Model/GetScheduledEmailByMessageId.md index c81749c..f9e2b55 100644 --- a/docs/Model/GetScheduledEmailByMessageId.md +++ b/docs/Model/GetScheduledEmailByMessageId.md @@ -1,11 +1,11 @@ -# GetScheduledEmailByMessageId +# # GetScheduledEmailByMessageId ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**scheduledAt** | [**\DateTime**] | Datetime for which the email was scheduled | -**createdAt** | [**\DateTime**] | Datetime on which the email was scheduled | -**status** | **string** | Current status of the scheduled 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) +**scheduledAt** | **\DateTime** | Datetime for which the email was scheduled | +**createdAt** | **\DateTime** | Datetime on which the email was scheduled | +**status** | **string** | Current status of the scheduled email | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSegments.md b/docs/Model/GetSegments.md index 4292fd5..2c9c3fa 100644 --- a/docs/Model/GetSegments.md +++ b/docs/Model/GetSegments.md @@ -1,11 +1,10 @@ -# GetSegments +# # GetSegments ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**segments** | [**\Brevo\Client\Model\GetSegmentsSegments**](GetSegmentsSegments.md) | | [optional] -**count** | **int** | Number of Segments available in 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) - +**segments** | [**Segment[]**](Segment.md) | Listing of all the segments available in your account | [optional] +**count** | **int** | Number of Segments in your account | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSegmentsSegments.md b/docs/Model/GetSegmentsSegments.md deleted file mode 100644 index 97bea65..0000000 --- a/docs/Model/GetSegmentsSegments.md +++ /dev/null @@ -1,13 +0,0 @@ -# GetSegmentsSegments - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | ID of the list | [optional] -**segmentName** | **string** | Name of the Segment | [optional] -**categoryName** | **string** | Name of the Segment Category | [optional] -**updatedAt** | **string** | Updation UTC date-time of the segment (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/GetSendersList.md b/docs/Model/GetSendersList.md index 497cb2c..0b78551 100644 --- a/docs/Model/GetSendersList.md +++ b/docs/Model/GetSendersList.md @@ -1,10 +1,9 @@ -# GetSendersList +# # GetSendersList ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**senders** | [**\Brevo\Client\Model\GetSendersListSenders[]**](GetSendersListSenders.md) | List of the senders available in 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) - +**senders** | [**\Brevo\Client\Models\GetSendersListSendersInner[]**](GetSendersListSendersInner.md) | List of the senders available in your account | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSendersListIps.md b/docs/Model/GetSendersListIps.md deleted file mode 100644 index 54b586d..0000000 --- a/docs/Model/GetSendersListIps.md +++ /dev/null @@ -1,12 +0,0 @@ -# GetSendersListIps - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ip** | **string** | Dedicated IP available in your account | -**domain** | **string** | Domain of the IP | -**weight** | **int** | Weight of the IP for this sender | - -[[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/GetSendersListSenders.md b/docs/Model/GetSendersListSenders.md deleted file mode 100644 index 87c7bc1..0000000 --- a/docs/Model/GetSendersListSenders.md +++ /dev/null @@ -1,14 +0,0 @@ -# GetSendersListSenders - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | Id of the sender | -**name** | **string** | From Name associated to the sender | -**email** | **string** | From Email associated to the sender | -**active** | **bool** | Status of sender (true=activated, false=deactivated) | -**ips** | [**\Brevo\Client\Model\GetSendersListIps[]**](GetSendersListIps.md) | List of dedicated IP(s) available in the account. This data is displayed only for dedicated IPs | [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/GetSendersListSendersInner.md b/docs/Model/GetSendersListSendersInner.md new file mode 100644 index 0000000..03014f0 --- /dev/null +++ b/docs/Model/GetSendersListSendersInner.md @@ -0,0 +1,13 @@ +# # GetSendersListSendersInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Id of the sender | +**name** | **string** | From Name associated to the sender | +**email** | **string** | From Email associated to the sender | +**active** | **bool** | Status of sender (true=activated, false=deactivated) | +**ips** | [**\Brevo\Client\Models\GetSendersListSendersInnerIpsInner[]**](GetSendersListSendersInnerIpsInner.md) | List of dedicated IP(s) available in the account. This data is displayed only for dedicated IPs | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSendersListSendersInnerIpsInner.md b/docs/Model/GetSendersListSendersInnerIpsInner.md new file mode 100644 index 0000000..27071a4 --- /dev/null +++ b/docs/Model/GetSendersListSendersInnerIpsInner.md @@ -0,0 +1,11 @@ +# # GetSendersListSendersInnerIpsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ip** | **string** | Dedicated IP available in your account | +**domain** | **string** | Domain of the IP | +**weight** | **int** | Weight of the IP for this sender | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSharedTemplateUrl.md b/docs/Model/GetSharedTemplateUrl.md index 5c2fba7..93c12f0 100644 --- a/docs/Model/GetSharedTemplateUrl.md +++ b/docs/Model/GetSharedTemplateUrl.md @@ -1,10 +1,9 @@ -# GetSharedTemplateUrl +# # GetSharedTemplateUrl ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**sharedUrl** | **string** | A unique URL for the email campaign or transactional template. This URL can be shared with other Brevo users. | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**sharedUrl** | **string** | A unique URL for the email campaign or transactional template. This URL can be shared with other Brevo users. | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSmsCampaign.md b/docs/Model/GetSmsCampaign.md index 0564562..ddff123 100644 --- a/docs/Model/GetSmsCampaign.md +++ b/docs/Model/GetSmsCampaign.md @@ -1,17 +1,18 @@ -# GetSmsCampaign +# # GetSmsCampaign ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | ID of the SMS Campaign | -**name** | **string** | Name of the SMS Campaign | -**status** | **string** | Status of the SMS Campaign | -**content** | **string** | Content of the SMS Campaign | -**scheduledAt** | **string** | UTC date-time on which SMS campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format | [optional] -**sender** | **string** | Sender of the SMS Campaign | -**createdAt** | **string** | Creation UTC date-time of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**modifiedAt** | **string** | UTC date-time of last modification of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**recipients** | **object** | | -**statistics** | **object** | | +**id** | **int** | ID of the SMS Campaign | +**name** | **string** | Name of the SMS Campaign | +**status** | **string** | Status of the SMS Campaign | +**content** | **string** | Content of the SMS Campaign | +**sender** | **string** | Sender of the SMS Campaign | +**createdAt** | **string** | Creation UTC date-time of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | **string** | UTC date-time of last modification of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**recipients** | **object** | | +**statistics** | **object** | | +**scheduledAt** | **string** | UTC date-time on which SMS campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format | [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) +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSmsCampaignOverview.md b/docs/Model/GetSmsCampaignOverview.md index 7ad98cd..5cc5d55 100644 --- a/docs/Model/GetSmsCampaignOverview.md +++ b/docs/Model/GetSmsCampaignOverview.md @@ -1,17 +1,16 @@ -# GetSmsCampaignOverview +# # GetSmsCampaignOverview ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | ID of the SMS Campaign | -**name** | **string** | Name of the SMS Campaign | -**status** | **string** | Status of the SMS Campaign | -**content** | **string** | Content of the SMS Campaign | -**scheduledAt** | **string** | UTC date-time on which SMS campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format | [optional] -**sender** | **string** | Sender of the SMS Campaign | -**createdAt** | **string** | Creation UTC date-time of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**modifiedAt** | **string** | 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) - +**id** | **int** | ID of the SMS Campaign | +**name** | **string** | Name of the SMS Campaign | +**status** | **string** | Status of the SMS Campaign | +**content** | **string** | Content of the SMS Campaign | +**sender** | **string** | Sender of the SMS Campaign | +**createdAt** | **string** | Creation UTC date-time of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | **string** | UTC date-time of last modification of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**scheduledAt** | **string** | UTC date-time on which SMS campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSmsCampaignRecipients.md b/docs/Model/GetSmsCampaignRecipients.md deleted file mode 100644 index e7b5984..0000000 --- a/docs/Model/GetSmsCampaignRecipients.md +++ /dev/null @@ -1,9 +0,0 @@ -# GetSmsCampaignRecipients - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/GetSmsCampaignStats.md b/docs/Model/GetSmsCampaignStats.md index 9eac775..708d80e 100644 --- a/docs/Model/GetSmsCampaignStats.md +++ b/docs/Model/GetSmsCampaignStats.md @@ -1,16 +1,15 @@ -# GetSmsCampaignStats +# # GetSmsCampaignStats ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**delivered** | **int** | Number of delivered SMS | -**sent** | **int** | Number of sent SMS | -**processing** | **int** | Number of processing SMS | -**softBounces** | **int** | Number of softbounced SMS | -**hardBounces** | **int** | Number of hardbounced SMS | -**unsubscriptions** | **int** | Number of unsubscription SMS | -**answered** | **int** | Number of replies to the SMS | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - - +**delivered** | **int** | Number of delivered SMS | +**sent** | **int** | Number of sent SMS | +**processing** | **int** | Number of processing SMS | +**softBounces** | **int** | Number of softbounced SMS | +**hardBounces** | **int** | Number of hardbounced SMS | +**unsubscriptions** | **int** | Number of unsubscription SMS | +**answered** | **int** | Number of replies to the SMS | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSmsCampaigns.md b/docs/Model/GetSmsCampaigns.md index 4c7fe83..f49cfff 100644 --- a/docs/Model/GetSmsCampaigns.md +++ b/docs/Model/GetSmsCampaigns.md @@ -1,11 +1,10 @@ -# GetSmsCampaigns +# # GetSmsCampaigns ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**campaigns** | **object[]** | | [optional] -**count** | **int** | Number of SMS campaigns retrieved | [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) - +**campaigns** | [**\Brevo\Client\Models\GetSmsCampaignsCampaignsInner[]**](GetSmsCampaignsCampaignsInner.md) | | [optional] +**count** | **int** | Number of SMS campaigns retrieved | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSmsCampaignsCampaignsInner.md b/docs/Model/GetSmsCampaignsCampaignsInner.md new file mode 100644 index 0000000..0cd8448 --- /dev/null +++ b/docs/Model/GetSmsCampaignsCampaignsInner.md @@ -0,0 +1,18 @@ +# # GetSmsCampaignsCampaignsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | ID of the SMS Campaign | +**name** | **string** | Name of the SMS Campaign | +**status** | **string** | Status of the SMS Campaign | +**content** | **string** | Content of the SMS Campaign | +**sender** | **string** | Sender of the SMS Campaign | +**createdAt** | **string** | Creation UTC date-time of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | **string** | UTC date-time of last modification of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**recipients** | [**\Brevo\Client\Models\GetCampaignRecipients**](GetCampaignRecipients.md) | | +**statistics** | [**\Brevo\Client\Models\GetSmsCampaignStats**](GetSmsCampaignStats.md) | | +**scheduledAt** | **string** | UTC date-time on which SMS campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSmsEventReport.md b/docs/Model/GetSmsEventReport.md index 22ed510..1d71c70 100644 --- a/docs/Model/GetSmsEventReport.md +++ b/docs/Model/GetSmsEventReport.md @@ -1,10 +1,9 @@ -# GetSmsEventReport +# # GetSmsEventReport ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**events** | [**\Brevo\Client\Model\GetSmsEventReportEvents[]**](GetSmsEventReportEvents.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) - +**events** | [**\Brevo\Client\Models\GetSmsEventReportEventsInner[]**](GetSmsEventReportEventsInner.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSmsEventReportEvents.md b/docs/Model/GetSmsEventReportEventsInner.md similarity index 50% rename from docs/Model/GetSmsEventReportEvents.md rename to docs/Model/GetSmsEventReportEventsInner.md index 7f39afe..62e6025 100644 --- a/docs/Model/GetSmsEventReportEvents.md +++ b/docs/Model/GetSmsEventReportEventsInner.md @@ -1,16 +1,15 @@ -# GetSmsEventReportEvents +# # GetSmsEventReportEventsInner ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**phoneNumber** | **string** | Phone number which has generated the event | [optional] -**date** | **string** | UTC date-time on which the event has been generated | [optional] -**messageId** | **string** | Message ID which generated the event | [optional] -**event** | **string** | Event which occurred | [optional] -**reason** | **string** | Reason of bounce (only available if the event is hardbounce or softbounce) | [optional] -**reply** | **string** | | [optional] -**tag** | **string** | Tag of the SMS which generated the event | [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) - - +**phoneNumber** | **string** | Phone number which has generated the event | [optional] +**date** | **string** | UTC date-time on which the event has been generated | [optional] +**messageId** | **string** | Message ID which generated the event | [optional] +**event** | **string** | Event which occurred | [optional] +**reason** | **string** | Reason of bounce (only available if the event is hardbounce or softbounce) | [optional] +**reply** | **string** | | [optional] +**tag** | **string** | Tag of the SMS which generated the event | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSmtpTemplateOverview.md b/docs/Model/GetSmtpTemplateOverview.md index c36df71..66560e6 100644 --- a/docs/Model/GetSmtpTemplateOverview.md +++ b/docs/Model/GetSmtpTemplateOverview.md @@ -1,22 +1,21 @@ -# GetSmtpTemplateOverview +# # GetSmtpTemplateOverview ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | ID of the template | -**name** | **string** | Name of the template | -**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** | [**\Brevo\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** | **string** | Creation UTC date-time of the template (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**modifiedAt** | **string** | Last modification UTC date-time of the template (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**doiTemplate** | **bool** | It is true if template is a valid Double opt-in (DOI) template, otherwise it is false. This field will be available only in case of single template detail call. | [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) - +**id** | **int** | ID of the template | +**name** | **string** | Name of the template | +**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** | [**\Brevo\Client\Models\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** | **string** | Creation UTC date-time of the template (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | **string** | Last modification UTC date-time of the template (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**doiTemplate** | **bool** | It is true if template is a valid Double opt-in (DOI) template, otherwise it is false. This field will be available only in case of single template detail call. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSmtpTemplateOverviewSender.md b/docs/Model/GetSmtpTemplateOverviewSender.md index 0697d2d..04f1b93 100644 --- a/docs/Model/GetSmtpTemplateOverviewSender.md +++ b/docs/Model/GetSmtpTemplateOverviewSender.md @@ -1,12 +1,11 @@ -# GetSmtpTemplateOverviewSender +# # GetSmtpTemplateOverviewSender ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | From email for the template | [optional] -**email** | **string** | From email for the template | [optional] -**id** | **string** | Sender id of the template | [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) - +**name** | **string** | From email for the template | [optional] +**email** | **string** | From email for the template | [optional] +**id** | **string** | Sender id of the template | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSmtpTemplates.md b/docs/Model/GetSmtpTemplates.md index 2e0768f..3217aa1 100644 --- a/docs/Model/GetSmtpTemplates.md +++ b/docs/Model/GetSmtpTemplates.md @@ -1,11 +1,10 @@ -# GetSmtpTemplates +# # GetSmtpTemplates ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**count** | **int** | Count of transactional email templates | [optional] -**templates** | [**\Brevo\Client\Model\GetSmtpTemplateOverview[]**](GetSmtpTemplateOverview.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) - +**count** | **int** | Count of transactional email templates | [optional] +**templates** | [**\Brevo\Client\Models\GetSmtpTemplateOverview[]**](GetSmtpTemplateOverview.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSsoToken.md b/docs/Model/GetSsoToken.md index fba745a..3b6e9e9 100644 --- a/docs/Model/GetSsoToken.md +++ b/docs/Model/GetSsoToken.md @@ -1,10 +1,9 @@ -# GetSsoToken +# # GetSsoToken ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**token** | **string** | Session token, it will remain valid for 15 days. | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**token** | **string** | Session token, it will remain valid for 15 days. | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetStatsByBrowser.md b/docs/Model/GetStatsByBrowser.md deleted file mode 100644 index 0a34adc..0000000 --- a/docs/Model/GetStatsByBrowser.md +++ /dev/null @@ -1,9 +0,0 @@ -# GetStatsByBrowser - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/GetStatsByDevice.md b/docs/Model/GetStatsByDevice.md index d773be8..d3d447d 100644 --- a/docs/Model/GetStatsByDevice.md +++ b/docs/Model/GetStatsByDevice.md @@ -1,13 +1,12 @@ -# GetStatsByDevice +# # GetStatsByDevice ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**desktop** | [**map[string,\Brevo\Client\Model\GetDeviceBrowserStats]**](GetDeviceBrowserStats.md) | Statistics of the campaign on the basis of desktop devices | [optional] -**mobile** | [**map[string,\Brevo\Client\Model\GetDeviceBrowserStats]**](GetDeviceBrowserStats.md) | Statistics of the campaign on the basis of mobile devices | [optional] -**tablet** | [**map[string,\Brevo\Client\Model\GetDeviceBrowserStats]**](GetDeviceBrowserStats.md) | Statistics of the campaign on the basis of tablet devices | [optional] -**unknown** | [**map[string,\Brevo\Client\Model\GetDeviceBrowserStats]**](GetDeviceBrowserStats.md) | Statistics of the campaign on the basis of unknown devices | [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) - +**desktop** | [**array**](GetDeviceBrowserStats.md) | Statistics of the campaign on the basis of desktop devices | [optional] +**mobile** | [**array**](GetDeviceBrowserStats.md) | Statistics of the campaign on the basis of mobile devices | [optional] +**tablet** | [**array**](GetDeviceBrowserStats.md) | Statistics of the campaign on the basis of tablet devices | [optional] +**unknown** | [**array**](GetDeviceBrowserStats.md) | Statistics of the campaign on the basis of unknown devices | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetStatsByDomain.md b/docs/Model/GetStatsByDomain.md deleted file mode 100644 index e43475a..0000000 --- a/docs/Model/GetStatsByDomain.md +++ /dev/null @@ -1,9 +0,0 @@ -# GetStatsByDomain - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/GetSubAccountGroups200ResponseInner.md b/docs/Model/GetSubAccountGroups200ResponseInner.md new file mode 100644 index 0000000..9ecb1a5 --- /dev/null +++ b/docs/Model/GetSubAccountGroups200ResponseInner.md @@ -0,0 +1,10 @@ +# # GetSubAccountGroups200ResponseInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique id of the group | [optional] +**groupName** | **string** | The name of the group of sub-accounts | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSubscriptionInfoResponse.md b/docs/Model/GetSubscriptionInfoResponse.md new file mode 100644 index 0000000..7afaaba --- /dev/null +++ b/docs/Model/GetSubscriptionInfoResponse.md @@ -0,0 +1,12 @@ +# # GetSubscriptionInfoResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**balance** | [**\Brevo\Client\Models\GetSubscriptionInfoResponseBalance**](GetSubscriptionInfoResponseBalance.md) | | [optional] +**tier** | [**\Brevo\Client\Models\GetSubscriptionInfoResponseTierInner[]**](GetSubscriptionInfoResponseTierInner.md) | Tier Information | [optional] +**members** | [**\Brevo\Client\Models\GetSubscriptionInfoResponseMembersInner[]**](GetSubscriptionInfoResponseMembersInner.md) | Subscription Member Information | [optional] +**reward** | [**\Brevo\Client\Models\GetSubscriptionInfoResponseRewardInner[]**](GetSubscriptionInfoResponseRewardInner.md) | Reward Information | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSubscriptionInfoResponseBalance.md b/docs/Model/GetSubscriptionInfoResponseBalance.md new file mode 100644 index 0000000..2e02f38 --- /dev/null +++ b/docs/Model/GetSubscriptionInfoResponseBalance.md @@ -0,0 +1,11 @@ +# # GetSubscriptionInfoResponseBalance + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyaltyProgramId** | **string** | Loyalty Program Id | [optional] +**contactId** | **int** | one of contact id or loyalty subscription id is required | [optional] +**balances** | [**\Brevo\Client\Models\GetSubscriptionInfoResponseBalanceBalancesInner[]**](GetSubscriptionInfoResponseBalanceBalancesInner.md) | Balances | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSubscriptionInfoResponseBalanceBalancesInner.md b/docs/Model/GetSubscriptionInfoResponseBalanceBalancesInner.md new file mode 100644 index 0000000..89241e4 --- /dev/null +++ b/docs/Model/GetSubscriptionInfoResponseBalanceBalancesInner.md @@ -0,0 +1,10 @@ +# # GetSubscriptionInfoResponseBalanceBalancesInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**balanceDefinitionId** | **string** | Balance Definition Id | [optional] +**value** | **int** | Value | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSubscriptionInfoResponseMembersInner.md b/docs/Model/GetSubscriptionInfoResponseMembersInner.md new file mode 100644 index 0000000..22f1037 --- /dev/null +++ b/docs/Model/GetSubscriptionInfoResponseMembersInner.md @@ -0,0 +1,11 @@ +# # GetSubscriptionInfoResponseMembersInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**memberContactId** | **int** | Member Contact Id | [optional] +**createdAt** | **\DateTime** | Member creation date | [optional] +**updatedAt** | **\DateTime** | Member last modification date | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSubscriptionInfoResponseRewardInner.md b/docs/Model/GetSubscriptionInfoResponseRewardInner.md new file mode 100644 index 0000000..31e13b3 --- /dev/null +++ b/docs/Model/GetSubscriptionInfoResponseRewardInner.md @@ -0,0 +1,14 @@ +# # GetSubscriptionInfoResponseRewardInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Reward Id | [optional] +**rewardId** | **string** | Reward Id | [optional] +**loyaltyProgramId** | **string** | Loyalty Program Id | [optional] +**contactId** | **int** | Contact Id | [optional] +**code** | **string** | Reward Code | [optional] +**expirationDate** | **\DateTime** | Reward expiration date | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSubscriptionInfoResponseTierInner.md b/docs/Model/GetSubscriptionInfoResponseTierInner.md new file mode 100644 index 0000000..3edb0ab --- /dev/null +++ b/docs/Model/GetSubscriptionInfoResponseTierInner.md @@ -0,0 +1,14 @@ +# # GetSubscriptionInfoResponseTierInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tierId** | **string** | Tier Id | [optional] +**loyaltyProgramId** | **string** | Loyalty Program Id | [optional] +**contactId** | **int** | Contact Id | [optional] +**groupId** | **string** | Group Id | [optional] +**createdAt** | **\DateTime** | Tier creation date | [optional] +**updatedAt** | **\DateTime** | Tier last modification date | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSubscriptionMemberResponse.md b/docs/Model/GetSubscriptionMemberResponse.md new file mode 100644 index 0000000..55c8703 --- /dev/null +++ b/docs/Model/GetSubscriptionMemberResponse.md @@ -0,0 +1,15 @@ +# # GetSubscriptionMemberResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**organizationId** | **int** | Organization Id | [optional] +**loyaltyProgramId** | **string** | Loyalty Program Id | [optional] +**versionId** | **int** | Version Id | [optional] +**memberContactId** | [**\Brevo\Client\Models\GetSubscriptionMemberResponseMemberContactIdInner[]**](GetSubscriptionMemberResponseMemberContactIdInner.md) | | [optional] +**loyaltySubscriptionId** | **string** | Client Reference | [optional] +**createdAt** | **\DateTime** | Subscription creation date | [optional] +**updatedAt** | **\DateTime** | Subscription last modification date | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSubscriptionMemberResponseMemberContactIdInner.md b/docs/Model/GetSubscriptionMemberResponseMemberContactIdInner.md new file mode 100644 index 0000000..54426b3 --- /dev/null +++ b/docs/Model/GetSubscriptionMemberResponseMemberContactIdInner.md @@ -0,0 +1,11 @@ +# # GetSubscriptionMemberResponseMemberContactIdInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**memberContactId** | **string[]** | | [optional] +**createdAt** | **\DateTime** | | [optional] +**updatedAt** | **\DateTime** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetTransacAggregatedSmsReport.md b/docs/Model/GetTransacAggregatedSmsReport.md index 6340c97..5c949de 100644 --- a/docs/Model/GetTransacAggregatedSmsReport.md +++ b/docs/Model/GetTransacAggregatedSmsReport.md @@ -1,19 +1,19 @@ -# GetTransacAggregatedSmsReport +# # GetTransacAggregatedSmsReport ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**range** | **string** | Time frame of the report | [optional] -**requests** | **int** | Number of requests for the timeframe | [optional] -**delivered** | **int** | Number of delivered SMS for the timeframe | [optional] -**hardBounces** | **int** | Number of hardbounces for the timeframe | [optional] -**softBounces** | **int** | Number of softbounces for the timeframe | [optional] -**blocked** | **int** | Number of blocked contact for the timeframe | [optional] -**unsubscribed** | **int** | Number of unsubscription for the timeframe | [optional] -**replied** | **int** | Number of answered SMS for the timeframe | [optional] -**accepted** | **int** | Number of accepted for the timeframe | [optional] -**rejected** | **int** | Number of rejected for the timeframe | [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) - +**range** | **string** | Time frame of the report | [optional] +**requests** | **int** | Number of requests for the timeframe | [optional] +**delivered** | **int** | Number of delivered SMS for the timeframe | [optional] +**hardBounces** | **int** | Number of hardbounces for the timeframe | [optional] +**softBounces** | **int** | Number of softbounces for the timeframe | [optional] +**blocked** | **int** | Number of blocked contact for the timeframe | [optional] +**unsubscribed** | **int** | Number of unsubscription for the timeframe | [optional] +**replied** | **int** | Number of answered SMS for the timeframe | [optional] +**accepted** | **int** | Number of accepted SMS for the timeframe | [optional] +**rejected** | **int** | Number of rejected SMS for the timeframe | [optional] +**skipped** | **int** | Number of skipped SMS for the timeframe | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetTransacBlockedContacts.md b/docs/Model/GetTransacBlockedContacts.md index 6992b2e..138f084 100644 --- a/docs/Model/GetTransacBlockedContacts.md +++ b/docs/Model/GetTransacBlockedContacts.md @@ -1,11 +1,10 @@ -# GetTransacBlockedContacts +# # GetTransacBlockedContacts ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**count** | **int** | Count of blocked or unsubscribed contact | [optional] -**contacts** | [**\Brevo\Client\Model\GetTransacBlockedContactsContacts[]**](GetTransacBlockedContactsContacts.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) - +**count** | **int** | Count of blocked or unsubscribed contact | [optional] +**contacts** | [**\Brevo\Client\Models\GetTransacBlockedContactsContactsInner[]**](GetTransacBlockedContactsContactsInner.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetTransacBlockedContactsContacts.md b/docs/Model/GetTransacBlockedContactsContacts.md deleted file mode 100644 index 7973ffd..0000000 --- a/docs/Model/GetTransacBlockedContactsContacts.md +++ /dev/null @@ -1,13 +0,0 @@ -# GetTransacBlockedContactsContacts - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**email** | **string** | Email address of the blocked or unsubscribed contact | -**senderEmail** | **string** | Sender email address of the blocked or unsubscribed contact | -**reason** | [**\Brevo\Client\Model\GetTransacBlockedContactsReason**](GetTransacBlockedContactsReason.md) | | -**blockedAt** | **string** | Date when the contact was blocked or unsubscribed on | - -[[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/GetTransacBlockedContactsContactsInner.md b/docs/Model/GetTransacBlockedContactsContactsInner.md new file mode 100644 index 0000000..1dd4dfc --- /dev/null +++ b/docs/Model/GetTransacBlockedContactsContactsInner.md @@ -0,0 +1,12 @@ +# # GetTransacBlockedContactsContactsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email** | **string** | Email address of the blocked or unsubscribed contact | +**senderEmail** | **string** | Sender email address of the blocked or unsubscribed contact | +**reason** | [**\Brevo\Client\Models\GetTransacBlockedContactsContactsInnerReason**](GetTransacBlockedContactsContactsInnerReason.md) | | +**blockedAt** | **string** | Date when the contact was blocked or unsubscribed on | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetTransacBlockedContactsContactsInnerReason.md b/docs/Model/GetTransacBlockedContactsContactsInnerReason.md new file mode 100644 index 0000000..71c5336 --- /dev/null +++ b/docs/Model/GetTransacBlockedContactsContactsInnerReason.md @@ -0,0 +1,10 @@ +# # GetTransacBlockedContactsContactsInnerReason + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **string** | Reason code for blocking / unsubscribing (This code is safe for comparison) | [optional] +**message** | **string** | Reason for blocking / unsubscribing (This string is not safe for comparison) | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetTransacBlockedContactsReason.md b/docs/Model/GetTransacBlockedContactsReason.md deleted file mode 100644 index c525de4..0000000 --- a/docs/Model/GetTransacBlockedContactsReason.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetTransacBlockedContactsReason - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**code** | **string** | Reason code for blocking / unsubscribing (This code is safe for comparison) | [optional] -**message** | **string** | Reason for blocking / unsubscribing (This string is not safe for comparison) | [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/GetTransacEmailContent.md b/docs/Model/GetTransacEmailContent.md index 1a8e032..9041dbe 100644 --- a/docs/Model/GetTransacEmailContent.md +++ b/docs/Model/GetTransacEmailContent.md @@ -1,16 +1,15 @@ -# GetTransacEmailContent +# # GetTransacEmailContent ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**email** | **string** | Email address to which transactional email has been sent | -**subject** | **string** | Subject of the sent email | -**templateId** | **int** | Id of the template | [optional] -**date** | **string** | Date on which transactional email was sent | -**events** | [**\Brevo\Client\Model\GetTransacEmailContentEvents[]**](GetTransacEmailContentEvents.md) | Series of events which occurred on the transactional email | -**body** | **string** | Actual content of the transactional email that has been sent | -**attachmentCount** | **int** | Count of the attachments that were sent in 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) - - +**email** | **string** | Email address to which transactional email has been sent | +**subject** | **string** | Subject of the sent email | +**date** | **string** | Date on which transactional email was sent | +**events** | [**\Brevo\Client\Models\GetTransacEmailContentEventsInner[]**](GetTransacEmailContentEventsInner.md) | Series of events which occurred on the transactional email | +**body** | **string** | Actual content of the transactional email that has been sent | +**attachmentCount** | **int** | Count of the attachments that were sent in the email | +**templateId** | **int** | Id of the template | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetTransacEmailContentEvents.md b/docs/Model/GetTransacEmailContentEvents.md deleted file mode 100644 index 482ee09..0000000 --- a/docs/Model/GetTransacEmailContentEvents.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetTransacEmailContentEvents - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **string** | Name of the event that occurred on the sent email | -**time** | **string** | Time at which the event occurred | - -[[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/GetTransacEmailContentEventsInner.md b/docs/Model/GetTransacEmailContentEventsInner.md new file mode 100644 index 0000000..f31ffe5 --- /dev/null +++ b/docs/Model/GetTransacEmailContentEventsInner.md @@ -0,0 +1,10 @@ +# # GetTransacEmailContentEventsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of the event that occurred on the sent email | +**time** | **string** | Time at which the event occurred | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetTransacEmailsList.md b/docs/Model/GetTransacEmailsList.md index d84f4c5..9092ceb 100644 --- a/docs/Model/GetTransacEmailsList.md +++ b/docs/Model/GetTransacEmailsList.md @@ -1,11 +1,10 @@ -# GetTransacEmailsList +# # GetTransacEmailsList ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**count** | **int** | Total number of transactional emails available on your account according to the passed filter | [optional] -**transactionalEmails** | [**\Brevo\Client\Model\GetTransacEmailsListTransactionalEmails[]**](GetTransacEmailsListTransactionalEmails.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) - +**count** | **int** | Total number of transactional emails available on your account according to the passed filter | [optional] +**transactionalEmails** | [**\Brevo\Client\Models\GetTransacEmailsListTransactionalEmailsInner[]**](GetTransacEmailsListTransactionalEmailsInner.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetTransacEmailsListTransactionalEmails.md b/docs/Model/GetTransacEmailsListTransactionalEmails.md deleted file mode 100644 index e6c736a..0000000 --- a/docs/Model/GetTransacEmailsListTransactionalEmails.md +++ /dev/null @@ -1,17 +0,0 @@ -# GetTransacEmailsListTransactionalEmails - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**email** | **string** | Email address to which transactional email has been sent | -**subject** | **string** | Subject of the sent email | -**templateId** | **int** | Id of the template | [optional] -**messageId** | **string** | Message Id of the sent email | -**uuid** | **string** | Unique id of the email sent to a particular contact | -**date** | **string** | Date on which transactional email was sent | -**from** | **string** | Email address of the sender from which the email was sent | [optional] -**tags** | **string[]** | Tags used for your email | [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/GetTransacEmailsListTransactionalEmailsInner.md b/docs/Model/GetTransacEmailsListTransactionalEmailsInner.md new file mode 100644 index 0000000..9fdff11 --- /dev/null +++ b/docs/Model/GetTransacEmailsListTransactionalEmailsInner.md @@ -0,0 +1,16 @@ +# # GetTransacEmailsListTransactionalEmailsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email** | **string** | Email address to which transactional email has been sent | +**subject** | **string** | Subject of the sent email | +**messageId** | **string** | Message Id of the sent email | +**uuid** | **string** | Unique id of the email sent to a particular contact | +**date** | **string** | Date on which transactional email was sent | +**templateId** | **int** | Id of the template | [optional] +**from** | **string** | Email address of the sender from which the email was sent | [optional] +**tags** | **string[]** | Tags used for your email | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetTransacSmsReport.md b/docs/Model/GetTransacSmsReport.md index 4d183ef..610e195 100644 --- a/docs/Model/GetTransacSmsReport.md +++ b/docs/Model/GetTransacSmsReport.md @@ -1,10 +1,9 @@ -# GetTransacSmsReport +# # GetTransacSmsReport ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**reports** | [**\Brevo\Client\Model\GetTransacSmsReportReports[]**](GetTransacSmsReportReports.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) - +**reports** | [**\Brevo\Client\Models\GetTransacSmsReportReportsInner[]**](GetTransacSmsReportReportsInner.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetTransacSmsReportReports.md b/docs/Model/GetTransacSmsReportReportsInner.md similarity index 50% rename from docs/Model/GetTransacSmsReportReports.md rename to docs/Model/GetTransacSmsReportReportsInner.md index 2dc03a5..17c0691 100644 --- a/docs/Model/GetTransacSmsReportReports.md +++ b/docs/Model/GetTransacSmsReportReportsInner.md @@ -1,19 +1,19 @@ -# GetTransacSmsReportReports +# # GetTransacSmsReportReportsInner ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**date** | [**\DateTime**] | Date for which statistics are retrieved | [optional] -**requests** | **int** | Number of requests for the date | [optional] -**delivered** | **int** | Number of delivered SMS for the date | [optional] -**hardBounces** | **int** | Number of hardbounces for the date | [optional] -**softBounces** | **int** | Number of softbounces for the date | [optional] -**blocked** | **int** | Number of blocked contact for the date | [optional] -**unsubscribed** | **int** | Number of unsubscription for the date | [optional] -**replied** | **int** | Number of answered SMS for the date | [optional] -**accepted** | **int** | Number of accepted for the date | [optional] -**rejected** | **int** | Number of rejected for the date | [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) - +**date** | **\DateTime** | Date for which statistics are retrieved | [optional] +**requests** | **int** | Number of requests for the date | [optional] +**delivered** | **int** | Number of delivered SMS for the date | [optional] +**hardBounces** | **int** | Number of hardbounces for the date | [optional] +**softBounces** | **int** | Number of softbounces for the date | [optional] +**blocked** | **int** | Number of blocked contact for the date | [optional] +**unsubscribed** | **int** | Number of unsubscription for the date | [optional] +**replied** | **int** | Number of answered SMS for the date | [optional] +**accepted** | **int** | Number of accepted SMS for the date | [optional] +**rejected** | **int** | Number of rejected SMS for the date | [optional] +**skipped** | **int** | Number of skipped SMS for the date | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetUserPermission.md b/docs/Model/GetUserPermission.md index 1c12c00..4f7fce1 100644 --- a/docs/Model/GetUserPermission.md +++ b/docs/Model/GetUserPermission.md @@ -1,12 +1,11 @@ -# GetUserPermission +# # GetUserPermission ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**email** | **string** | Email address of the user. | -**status** | **string** | Status of the invited user. | -**privileges** | [**\Brevo\Client\Model\GetUserPermissionPrivileges[]**](GetUserPermissionPrivileges.md) | Granular feature permissions given to the user. | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**email** | **string** | Email address of the user. | +**status** | **string** | Status of the invited user. | +**privileges** | [**\Brevo\Client\Models\GetUserPermissionPrivilegesInner[]**](GetUserPermissionPrivilegesInner.md) | Granular feature permissions given to the user. | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetUserPermissionPrivileges.md b/docs/Model/GetUserPermissionPrivileges.md deleted file mode 100644 index fec8fa9..0000000 --- a/docs/Model/GetUserPermissionPrivileges.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetUserPermissionPrivileges - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**feature** | **string** | | -**permissions** | **string[]** | | - -[[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/GetUserPermissionPrivilegesInner.md b/docs/Model/GetUserPermissionPrivilegesInner.md new file mode 100644 index 0000000..f98fb41 --- /dev/null +++ b/docs/Model/GetUserPermissionPrivilegesInner.md @@ -0,0 +1,10 @@ +# # GetUserPermissionPrivilegesInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**feature** | **string** | | +**permissions** | **string[]** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetVersionInfoResponse.md b/docs/Model/GetVersionInfoResponse.md new file mode 100644 index 0000000..fc14eed --- /dev/null +++ b/docs/Model/GetVersionInfoResponse.md @@ -0,0 +1,11 @@ +# # GetVersionInfoResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**active** | [**\Brevo\Client\Models\VersionInfo[]**](VersionInfo.md) | Active Version Information | [optional] +**draft** | [**\Brevo\Client\Models\VersionInfo[]**](VersionInfo.md) | Draft Version Information | [optional] +**inactive** | [**\Brevo\Client\Models\VersionInfo[]**](VersionInfo.md) | Inactive Version Information | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetWATemplates.md b/docs/Model/GetWATemplates.md deleted file mode 100644 index 4bca939..0000000 --- a/docs/Model/GetWATemplates.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetWATemplates - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**templates** | [**\Brevo\Client\Model\GetWATemplatesTemplates[]**](GetWATemplatesTemplates.md) | | -**count** | **int** | Number of whatsApp templates retrived | - -[[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/GetWATemplatesTemplates.md b/docs/Model/GetWATemplatesTemplates.md deleted file mode 100644 index c088064..0000000 --- a/docs/Model/GetWATemplatesTemplates.md +++ /dev/null @@ -1,17 +0,0 @@ -# GetWATemplatesTemplates - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **string** | id of the template | -**name** | **string** | Name of the WhatsApp template | -**status** | **string** | Status of the WhatsApp template | -**language** | **string** | Language in which template exists | -**category** | **string** | category of the template | -**errorReason** | **string** | Error reason in the template creation | [optional] -**createdAt** | **string** | Creation UTC date-time of the whatsApp template (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**modifiedAt** | **string** | UTC date-time of last modification of the whatsApp 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/GetWebhook.md b/docs/Model/GetWebhook.md index 883bc89..1eda5b9 100644 --- a/docs/Model/GetWebhook.md +++ b/docs/Model/GetWebhook.md @@ -1,19 +1,18 @@ -# GetWebhook +# # GetWebhook ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**url** | **string** | URL of the webhook | -**id** | **int** | ID of the webhook | -**description** | **string** | Description of the webhook | -**events** | **string[]** | | -**type** | **string** | Type of webhook (marketing or transactional) | -**createdAt** | **string** | Creation UTC date-time of the webhook (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**modifiedAt** | **string** | Last modification UTC date-time of the webhook (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**batched** | **bool** | To send batched webhooks | [optional] -**auth** | [**\Brevo\Client\Model\GetWebhookAuth**](GetWebhookAuth.md) | | [optional] -**headers** | [**\Brevo\Client\Model\GetWebhookHeaders[]**](GetWebhookHeaders.md) | Custom headers to be send with webhooks | [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) - +**url** | **string** | URL of the webhook | +**id** | **int** | ID of the webhook | +**description** | **string** | Description of the webhook | +**events** | **string[]** | | +**type** | **string** | Type of webhook (marketing or transactional) | +**createdAt** | **string** | Creation UTC date-time of the webhook (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | **string** | Last modification UTC date-time of the webhook (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**batched** | **bool** | Batching configuration of the webhook, we send batched webhooks if its true | [optional] +**auth** | **object** | Authentication header to be send with the webhook requests | [optional] +**headers** | **object[]** | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetWebhookAuth.md b/docs/Model/GetWebhookAuth.md deleted file mode 100644 index e7d208e..0000000 --- a/docs/Model/GetWebhookAuth.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetWebhookAuth - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**type** | **string** | Type of authentication | [optional] -**token** | **string** | Webhook authentication token | [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/GetWebhookHeaders.md b/docs/Model/GetWebhookHeaders.md deleted file mode 100644 index 29a524c..0000000 --- a/docs/Model/GetWebhookHeaders.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetWebhookHeaders - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**key** | **string** | Header key name | [optional] -**value** | **string** | Header value | [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/GetWebhooks.md b/docs/Model/GetWebhooks.md index e5d8eb5..b94abe7 100644 --- a/docs/Model/GetWebhooks.md +++ b/docs/Model/GetWebhooks.md @@ -1,10 +1,9 @@ -# GetWebhooks +# # GetWebhooks ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**webhooks** | **object[]** | | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**webhooks** | [**GetWebhook[]**](GetWebhook.md) | | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetWhatsAppConfig.md b/docs/Model/GetWhatsAppConfig.md index af90628..14a9e7f 100644 --- a/docs/Model/GetWhatsAppConfig.md +++ b/docs/Model/GetWhatsAppConfig.md @@ -1,15 +1,14 @@ -# GetWhatsAppConfig +# # GetWhatsAppConfig ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**whatsappBusinessAccountId** | **string** | Id of the WhatsApp business account | [optional] -**sendingLimit** | **string** | Sending limit Information of the WhatsApp API account | [optional] -**phoneNumberQuality** | **string** | Quality status of phone number associated with WhatsApp account. There are three quality ratings. example - **High (GREEN) , Medium (YELLOW) and Low(RED)** | [optional] -**whatsappBusinessAccountStatus** | **string** | Status information related to WhatsApp Api account | [optional] -**businessStatus** | **string** | Verification status information of the Business account | [optional] -**phoneNumberNameStatus** | **string** | Status of the name associated with WhatsApp Phone number | [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) - - +**whatsappBusinessAccountId** | **string** | Id of the WhatsApp business account | [optional] +**sendingLimit** | **string** | Sending limit Information of the WhatsApp API account | [optional] +**phoneNumberQuality** | **string** | Quality status of phone number associated with WhatsApp account. There are three quality ratings. example - **High (GREEN) , Medium (YELLOW) and Low(RED)** | [optional] +**whatsappBusinessAccountStatus** | **string** | Status information related to WhatsApp API account | [optional] +**businessStatus** | **string** | Verification status information of the Business account | [optional] +**phoneNumberNameStatus** | **string** | Status of the name associated with WhatsApp Phone number | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetWhatsappCampaignOverview.md b/docs/Model/GetWhatsappCampaignOverview.md index 9251b7d..86be2ca 100644 --- a/docs/Model/GetWhatsappCampaignOverview.md +++ b/docs/Model/GetWhatsappCampaignOverview.md @@ -1,18 +1,17 @@ -# GetWhatsappCampaignOverview +# # GetWhatsappCampaignOverview ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | ID of the WhatsApp Campaign | -**campaignName** | **string** | Name of the WhatsApp Campaign | -**campaignStatus** | **string** | Status of the WhatsApp Campaign | -**scheduledAt** | **string** | UTC date-time on which WhatsApp campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format | [optional] -**senderNumber** | **string** | Sender of the WhatsApp Campaign | -**stats** | [**\Brevo\Client\Model\WhatsappCampStats**](WhatsappCampStats.md) | | [optional] -**template** | [**\Brevo\Client\Model\WhatsappCampTemplate**](WhatsappCampTemplate.md) | | -**createdAt** | **string** | Creation UTC date-time of the WhatsApp campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**modifiedAt** | **string** | UTC date-time of last modification of the WhatsApp 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) - +**id** | **int** | ID of the WhatsApp Campaign | +**campaignName** | **string** | Name of the WhatsApp Campaign | +**campaignStatus** | **string** | Status of the WhatsApp Campaign | +**senderNumber** | **string** | Sender of the WhatsApp Campaign | +**template** | [**\Brevo\Client\Models\WhatsappCampTemplate**](WhatsappCampTemplate.md) | | +**createdAt** | **string** | Creation UTC date-time of the WhatsApp campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | **string** | UTC date-time of last modification of the WhatsApp campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**scheduledAt** | **string** | UTC date-time on which WhatsApp campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format | [optional] +**stats** | [**\Brevo\Client\Models\WhatsappCampStats**](WhatsappCampStats.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetWhatsappCampaigns.md b/docs/Model/GetWhatsappCampaigns.md index b9cf310..9f84cce 100644 --- a/docs/Model/GetWhatsappCampaigns.md +++ b/docs/Model/GetWhatsappCampaigns.md @@ -1,11 +1,10 @@ -# GetWhatsappCampaigns +# # GetWhatsappCampaigns ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**campaigns** | [**\Brevo\Client\Model\GetWhatsappCampaignsCampaigns[]**](GetWhatsappCampaignsCampaigns.md) | | [optional] -**count** | **int** | Number of WhatsApp campaigns retrived | [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) - +**campaigns** | [**\Brevo\Client\Models\GetWhatsappCampaignsCampaignsInner[]**](GetWhatsappCampaignsCampaignsInner.md) | | [optional] +**count** | **int** | Number of WhatsApp campaigns retrieved | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetWhatsappCampaignsCampaigns.md b/docs/Model/GetWhatsappCampaignsCampaigns.md deleted file mode 100644 index c1a7421..0000000 --- a/docs/Model/GetWhatsappCampaignsCampaigns.md +++ /dev/null @@ -1,20 +0,0 @@ -# GetWhatsappCampaignsCampaigns - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | ID of the WhatsApp Campaign | -**campaignName** | **string** | Name of the WhatsApp Campaign | -**templateId** | **string** | Id of the WhatsApp template | -**campaignStatus** | **string** | Status of the WhatsApp Campaign | -**scheduledAt** | **string** | UTC date-time on which WhatsApp campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format | -**errorReason** | **string** | Error reason in the campaign creation | [optional] -**invalidatedContacts** | **int** | Count of invalidated contacts | [optional] -**readPercentage** | **float** | Read percentage of the the WhatsApp campaign created | [optional] -**stats** | [**\Brevo\Client\Model\WhatsappCampStats**](WhatsappCampStats.md) | | [optional] -**createdAt** | **string** | Creation UTC date-time of the WhatsApp campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**modifiedAt** | **string** | UTC date-time of last modification of the whatsapp 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/GetWhatsappCampaignsCampaignsInner.md b/docs/Model/GetWhatsappCampaignsCampaignsInner.md new file mode 100644 index 0000000..ae8e5a7 --- /dev/null +++ b/docs/Model/GetWhatsappCampaignsCampaignsInner.md @@ -0,0 +1,19 @@ +# # GetWhatsappCampaignsCampaignsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | ID of the WhatsApp Campaign | +**campaignName** | **string** | Name of the WhatsApp Campaign | +**templateId** | **string** | Id of the WhatsApp template | +**campaignStatus** | **string** | Status of the WhatsApp Campaign | +**scheduledAt** | **string** | UTC date-time on which WhatsApp campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format | +**createdAt** | **string** | Creation UTC date-time of the WhatsApp template (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | **string** | UTC date-time of last modification of the WhatsApp template (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**errorReason** | **string** | Error Reason associated with the WhatsApp campaign sending | [optional] +**invalidatedContacts** | **int** | Count of invalidated contacts | [optional] +**readPercentage** | **float** | Read percentage of the the WhatsApp campaign created | [optional] +**stats** | [**\Brevo\Client\Models\WhatsappCampStats**](WhatsappCampStats.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetWhatsappEventReport.md b/docs/Model/GetWhatsappEventReport.md index f99423c..27c081b 100644 --- a/docs/Model/GetWhatsappEventReport.md +++ b/docs/Model/GetWhatsappEventReport.md @@ -1,10 +1,9 @@ -# GetWhatsappEventReport +# # GetWhatsappEventReport ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**events** | [**\Brevo\Client\Model\GetWhatsappEventReportEvents[]**](GetWhatsappEventReportEvents.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) - +**events** | [**\Brevo\Client\Models\GetWhatsappEventReportEventsInner[]**](GetWhatsappEventReportEventsInner.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetWhatsappEventReportEvents.md b/docs/Model/GetWhatsappEventReportEventsInner.md similarity index 63% rename from docs/Model/GetWhatsappEventReportEvents.md rename to docs/Model/GetWhatsappEventReportEventsInner.md index 5474772..d8a481e 100644 --- a/docs/Model/GetWhatsappEventReportEvents.md +++ b/docs/Model/GetWhatsappEventReportEventsInner.md @@ -1,17 +1,16 @@ -# GetWhatsappEventReportEvents +# # GetWhatsappEventReportEventsInner ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**contactNumber** | **string** | WhatsApp Number with country code. Example, 85264318721 | -**date** | **string** | UTC date-time on which the event has been generated | -**messageId** | **string** | Message ID which generated the event | -**event** | **string** | Event which occurred | -**reason** | **string** | Reason for the event (will be there in case of `error` and `soft-bounce` events) | [optional] -**body** | **string** | Text of the reply (will be there only in case of `reply` event with text) | [optional] -**mediaUrl** | **string** | Url of the media reply (will be there only in case of `reply` event with media) | [optional] -**senderNumber** | **string** | WhatsApp Number with country code. Example, 85264318721 | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**contactNumber** | **string** | WhatsApp Number with country code. Example, 85264318721 | +**date** | **string** | UTC date-time on which the event has been generated | +**messageId** | **string** | Message ID which generated the event | +**event** | **string** | Event which occurred | +**senderNumber** | **string** | WhatsApp Number with country code. Example, 85264318721 | +**reason** | **string** | Reason for the event (will be there in case of `error` and `soft-bounce` events) | [optional] +**body** | **string** | Text of the reply (will be there only in case of `reply` event with text) | [optional] +**mediaUrl** | **string** | Url of the media reply (will be there only in case of `reply` event with media) | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetWhatsappTemplates.md b/docs/Model/GetWhatsappTemplates.md new file mode 100644 index 0000000..54388d3 --- /dev/null +++ b/docs/Model/GetWhatsappTemplates.md @@ -0,0 +1,10 @@ +# # GetWhatsappTemplates + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**templates** | [**\Brevo\Client\Models\GetWhatsappTemplatesTemplatesInner[]**](GetWhatsappTemplatesTemplatesInner.md) | | [optional] +**count** | **int** | Number of WhatsApp templates retrieved | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetWhatsappTemplatesTemplatesInner.md b/docs/Model/GetWhatsappTemplatesTemplatesInner.md new file mode 100644 index 0000000..634d199 --- /dev/null +++ b/docs/Model/GetWhatsappTemplatesTemplatesInner.md @@ -0,0 +1,16 @@ +# # GetWhatsappTemplatesTemplatesInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | ID of the WhatsApp template | +**name** | **string** | Name of the WhatsApp template | +**status** | **string** | Status of the WhatsApp template | +**language** | **string** | Language in which template exists | +**category** | **string** | category of the template | +**createdAt** | **string** | Creation UTC date-time of the WhatsApp template (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | **string** | UTC date-time of last modification of the WhatsApp template (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**errorReason** | **string** | Error reason in the template creation | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/InlineResponse200.md b/docs/Model/InlineResponse200.md deleted file mode 100644 index 5990843..0000000 --- a/docs/Model/InlineResponse200.md +++ /dev/null @@ -1,11 +0,0 @@ -# InlineResponse200 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **string** | Unique id of the group | [optional] -**groupName** | **string** | The name of the group of sub-accounts | [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/InlineResponse2001.md b/docs/Model/InlineResponse2001.md deleted file mode 100644 index 47f3681..0000000 --- a/docs/Model/InlineResponse2001.md +++ /dev/null @@ -1,10 +0,0 @@ -# InlineResponse2001 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **string** | Unique company id | - -[[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/InlineResponse2002.md b/docs/Model/InlineResponse2002.md deleted file mode 100644 index c9b0393..0000000 --- a/docs/Model/InlineResponse2002.md +++ /dev/null @@ -1,12 +0,0 @@ -# InlineResponse2002 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **string** | The id of the collection | -**name** | **string** | The name of the collection | -**defaultCoupon** | **string** | The default coupon of the collection | - -[[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/InlineResponse201.md b/docs/Model/InlineResponse201.md deleted file mode 100644 index f9e19de..0000000 --- a/docs/Model/InlineResponse201.md +++ /dev/null @@ -1,10 +0,0 @@ -# InlineResponse201 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **string** | | [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/InlineResponse2011.md b/docs/Model/InlineResponse2011.md deleted file mode 100644 index b3ac15c..0000000 --- a/docs/Model/InlineResponse2011.md +++ /dev/null @@ -1,10 +0,0 @@ -# InlineResponse2011 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **string** | Unique deal id | - -[[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/InlineResponse2012.md b/docs/Model/InlineResponse2012.md deleted file mode 100644 index d62c7f5..0000000 --- a/docs/Model/InlineResponse2012.md +++ /dev/null @@ -1,10 +0,0 @@ -# InlineResponse2012 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **string** | Unique task id | - -[[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/InlineResponse2013.md b/docs/Model/InlineResponse2013.md deleted file mode 100644 index 699a3d9..0000000 --- a/docs/Model/InlineResponse2013.md +++ /dev/null @@ -1,10 +0,0 @@ -# InlineResponse2013 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **string** | The id of the created collection | - -[[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/InlineResponse2014.md b/docs/Model/InlineResponse2014.md deleted file mode 100644 index 173807b..0000000 --- a/docs/Model/InlineResponse2014.md +++ /dev/null @@ -1,10 +0,0 @@ -# InlineResponse2014 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**messageId** | **string** | messageId of sent message | - -[[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/InlineResponse2015.md b/docs/Model/InlineResponse2015.md deleted file mode 100644 index 4cdec9f..0000000 --- a/docs/Model/InlineResponse2015.md +++ /dev/null @@ -1,10 +0,0 @@ -# InlineResponse2015 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **string** | ID of the object 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/InviteAdminUser.md b/docs/Model/InviteAdminUser.md index cbcf531..0845eb2 100644 --- a/docs/Model/InviteAdminUser.md +++ b/docs/Model/InviteAdminUser.md @@ -1,13 +1,12 @@ -# InviteAdminUser +# # InviteAdminUser ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**email** | **string** | Email address for the organization | -**allFeaturesAccess** | **bool** | All access to the features | -**groupIds** | **string[]** | Ids of Group | [optional] -**privileges** | [**\Brevo\Client\Model\InviteAdminUserPrivileges[]**](InviteAdminUserPrivileges.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) - +**email** | **string** | Email address for the organization | +**allFeaturesAccess** | **bool** | All access to the features | +**privileges** | [**\Brevo\Client\Models\InviteAdminUserPrivilegesInner[]**](InviteAdminUserPrivilegesInner.md) | | +**groupIds** | **string[]** | Ids of Group | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/InviteAdminUserPrivileges.md b/docs/Model/InviteAdminUserPrivileges.md deleted file mode 100644 index 9d87b19..0000000 --- a/docs/Model/InviteAdminUserPrivileges.md +++ /dev/null @@ -1,11 +0,0 @@ -# InviteAdminUserPrivileges - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**feature** | **string** | Feature name | [optional] -**permissions** | **string[]** | Permissions for a given feature | [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/InviteAdminUserPrivilegesInner.md b/docs/Model/InviteAdminUserPrivilegesInner.md new file mode 100644 index 0000000..94f3b45 --- /dev/null +++ b/docs/Model/InviteAdminUserPrivilegesInner.md @@ -0,0 +1,10 @@ +# # InviteAdminUserPrivilegesInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**feature** | **string** | Feature name | [optional] +**permissions** | **string[]** | Permissions for a given feature | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Inviteuser.md b/docs/Model/Inviteuser.md index 4589434..776de85 100644 --- a/docs/Model/Inviteuser.md +++ b/docs/Model/Inviteuser.md @@ -1,12 +1,11 @@ -# Inviteuser +# # Inviteuser ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**email** | **string** | Email address for the organization | -**allFeaturesAccess** | **bool** | All access to the features | -**privileges** | [**\Brevo\Client\Model\InviteuserPrivileges[]**](InviteuserPrivileges.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) - +**email** | **string** | Email address for the organization | +**allFeaturesAccess** | **bool** | All access to the features | +**privileges** | [**\Brevo\Client\Models\InviteuserPrivilegesInner[]**](InviteuserPrivilegesInner.md) | | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/InviteuserPrivileges.md b/docs/Model/InviteuserPrivileges.md deleted file mode 100644 index 5d3a38a..0000000 --- a/docs/Model/InviteuserPrivileges.md +++ /dev/null @@ -1,11 +0,0 @@ -# InviteuserPrivileges - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**feature** | **string** | Feature name | [optional] -**permissions** | **string[]** | Permissions for a given feature | [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/InviteuserPrivilegesInner.md b/docs/Model/InviteuserPrivilegesInner.md new file mode 100644 index 0000000..96a8580 --- /dev/null +++ b/docs/Model/InviteuserPrivilegesInner.md @@ -0,0 +1,10 @@ +# # InviteuserPrivilegesInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**feature** | **string** | Feature name | [optional] +**permissions** | **string[]** | Permissions for a given feature | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/InviteuserResponse.md b/docs/Model/InviteuserResponse.md new file mode 100644 index 0000000..e9ea6cf --- /dev/null +++ b/docs/Model/InviteuserResponse.md @@ -0,0 +1,10 @@ +# # InviteuserResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **string** | Status of the API operation. | +**invoiceId** | **string[]** | Invoice id | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltyProgram.md b/docs/Model/LoyaltyProgram.md new file mode 100644 index 0000000..697ce7b --- /dev/null +++ b/docs/Model/LoyaltyProgram.md @@ -0,0 +1,15 @@ +# # LoyaltyProgram + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Loyalty Program ID | [optional] +**name** | **string** | Loyalty Program name | [optional] +**description** | **string** | Loyalty Program description | [optional] +**meta** | **object** | Loyalty Program meta data | [optional] +**createdAt** | **\DateTime** | Loyalty Program creation date | [optional] +**updatedAt** | **\DateTime** | Loyalty Program last modification date | [optional] +**state** | **string** | Loyalty Program state | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltyProgramPage.md b/docs/Model/LoyaltyProgramPage.md new file mode 100644 index 0000000..54f7707 --- /dev/null +++ b/docs/Model/LoyaltyProgramPage.md @@ -0,0 +1,9 @@ +# # LoyaltyProgramPage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**items** | [**\Brevo\Client\Models\LoyaltyProgram[]**](LoyaltyProgram.md) | Loyalty Program list | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltyProgramValidationError.md b/docs/Model/LoyaltyProgramValidationError.md new file mode 100644 index 0000000..2aa47cc --- /dev/null +++ b/docs/Model/LoyaltyProgramValidationError.md @@ -0,0 +1,11 @@ +# # LoyaltyProgramValidationError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**path** | **string** | Path of data that failed validation | [optional] +**rule** | **string** | Rule that failed validation | [optional] +**error** | **string** | Validation error message | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltyTierPage.md b/docs/Model/LoyaltyTierPage.md new file mode 100644 index 0000000..4b5d3cf --- /dev/null +++ b/docs/Model/LoyaltyTierPage.md @@ -0,0 +1,9 @@ +# # LoyaltyTierPage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**items** | [**\Brevo\Client\Models\Tier[]**](Tier.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ManageIp.md b/docs/Model/ManageIp.md deleted file mode 100644 index 797f01c..0000000 --- a/docs/Model/ManageIp.md +++ /dev/null @@ -1,10 +0,0 @@ -# ManageIp - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**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/MasterDetailsResponse.md b/docs/Model/MasterDetailsResponse.md index 69f0cdf..9e705be 100644 --- a/docs/Model/MasterDetailsResponse.md +++ b/docs/Model/MasterDetailsResponse.md @@ -1,16 +1,15 @@ -# MasterDetailsResponse +# # MasterDetailsResponse ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**email** | **string** | Email id of master account | [optional] -**companyName** | **string** | Company name of master account organization | [optional] -**id** | **int** | Unique identifier of the master account organization | [optional] -**currencyCode** | **string** | Currency code of the master account organization | [optional] -**timezone** | **string** | Timezone of the master account organization | [optional] -**billingInfo** | [**\Brevo\Client\Model\MasterDetailsResponseBillingInfo**](MasterDetailsResponseBillingInfo.md) | | [optional] -**planInfo** | [**\Brevo\Client\Model\MasterDetailsResponsePlanInfo**](MasterDetailsResponsePlanInfo.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) - - +**email** | **string** | Email id of master account | [optional] +**companyName** | **string** | Company name of master account organization | [optional] +**id** | **int** | Unique identifier of the master account organization | [optional] +**currencyCode** | **string** | Currency code of the master account organization | [optional] +**timezone** | **string** | Timezone of the master account organization | [optional] +**billingInfo** | [**\Brevo\Client\Models\MasterDetailsResponseBillingInfo**](MasterDetailsResponseBillingInfo.md) | | [optional] +**planInfo** | [**\Brevo\Client\Models\MasterDetailsResponsePlanInfo**](MasterDetailsResponsePlanInfo.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MasterDetailsResponseBillingInfo.md b/docs/Model/MasterDetailsResponseBillingInfo.md index a131c7a..454fabe 100644 --- a/docs/Model/MasterDetailsResponseBillingInfo.md +++ b/docs/Model/MasterDetailsResponseBillingInfo.md @@ -1,13 +1,12 @@ -# MasterDetailsResponseBillingInfo +# # MasterDetailsResponseBillingInfo ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**email** | **string** | Billing email id of master account | [optional] -**companyName** | **string** | Company name of master account | [optional] -**name** | [**\Brevo\Client\Model\MasterDetailsResponseBillingInfoName**](MasterDetailsResponseBillingInfoName.md) | | [optional] -**address** | [**\Brevo\Client\Model\MasterDetailsResponseBillingInfoAddress**](MasterDetailsResponseBillingInfoAddress.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) - +**email** | **string** | Billing email id of master account | [optional] +**companyName** | **string** | Company name of master account | [optional] +**name** | [**\Brevo\Client\Models\MasterDetailsResponseBillingInfoName**](MasterDetailsResponseBillingInfoName.md) | | [optional] +**address** | [**\Brevo\Client\Models\MasterDetailsResponseBillingInfoAddress**](MasterDetailsResponseBillingInfoAddress.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MasterDetailsResponseBillingInfoAddress.md b/docs/Model/MasterDetailsResponseBillingInfoAddress.md index 3c8cc31..a82747d 100644 --- a/docs/Model/MasterDetailsResponseBillingInfoAddress.md +++ b/docs/Model/MasterDetailsResponseBillingInfoAddress.md @@ -1,14 +1,13 @@ -# MasterDetailsResponseBillingInfoAddress +# # MasterDetailsResponseBillingInfoAddress ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**streetAddress** | **string** | Street address | [optional] -**locality** | **string** | Locality | [optional] -**postalCode** | **string** | Postal code | [optional] -**stateCode** | **string** | State code | [optional] -**countryCode** | **string** | Country code | [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) - +**streetAddress** | **string** | Street address | [optional] +**locality** | **string** | Locality | [optional] +**postalCode** | **string** | Postal code | [optional] +**stateCode** | **string** | State code | [optional] +**countryCode** | **string** | Country code | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MasterDetailsResponseBillingInfoName.md b/docs/Model/MasterDetailsResponseBillingInfoName.md index 0e038fc..7e2a701 100644 --- a/docs/Model/MasterDetailsResponseBillingInfoName.md +++ b/docs/Model/MasterDetailsResponseBillingInfoName.md @@ -1,11 +1,10 @@ -# MasterDetailsResponseBillingInfoName +# # MasterDetailsResponseBillingInfoName ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**givenName** | **string** | First name for billing | [optional] -**familyName** | **string** | Last name for billing | [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) - +**givenName** | **string** | First name for billing | [optional] +**familyName** | **string** | Last name for billing | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MasterDetailsResponsePlanInfo.md b/docs/Model/MasterDetailsResponsePlanInfo.md index 3131ad9..e00bdd9 100644 --- a/docs/Model/MasterDetailsResponsePlanInfo.md +++ b/docs/Model/MasterDetailsResponsePlanInfo.md @@ -1,15 +1,14 @@ -# MasterDetailsResponsePlanInfo +# # MasterDetailsResponsePlanInfo ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**currencyCode** | **string** | Plan currency | [optional] -**nextBillingAt** | **int** | Timestamp of next billing date | [optional] -**price** | **float** | Plan amount | [optional] -**planPeriod** | **string** | Plan period type | [optional] -**subAccounts** | **int** | Number of sub-accounts | [optional] -**features** | [**\Brevo\Client\Model\MasterDetailsResponsePlanInfoFeatures[]**](MasterDetailsResponsePlanInfoFeatures.md) | List of provided features in the plan | [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) - - +**currencyCode** | **string** | Plan currency | [optional] +**nextBillingAt** | **int** | Timestamp of next billing date | [optional] +**price** | **float** | Plan amount | [optional] +**planPeriod** | **string** | Plan period type | [optional] +**subAccounts** | **int** | Number of sub-accounts | [optional] +**features** | [**\Brevo\Client\Models\MasterDetailsResponsePlanInfoFeaturesInner[]**](MasterDetailsResponsePlanInfoFeaturesInner.md) | List of provided features in the plan | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MasterDetailsResponsePlanInfoFeatures.md b/docs/Model/MasterDetailsResponsePlanInfoFeaturesInner.md similarity index 54% rename from docs/Model/MasterDetailsResponsePlanInfoFeatures.md rename to docs/Model/MasterDetailsResponsePlanInfoFeaturesInner.md index c39d52b..154c82e 100644 --- a/docs/Model/MasterDetailsResponsePlanInfoFeatures.md +++ b/docs/Model/MasterDetailsResponsePlanInfoFeaturesInner.md @@ -1,16 +1,15 @@ -# MasterDetailsResponsePlanInfoFeatures +# # MasterDetailsResponsePlanInfoFeaturesInner ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | Name of the feature | [optional] -**unitValue** | **string** | Unit value of the feature | [optional] -**quantity** | **int** | Quantity provided in the plan | [optional] -**quantityWithOverages** | **int** | Quantity with overages provided in the plan (only applicable on ENTv2) | [optional] -**used** | **int** | Quantity consumed by master | [optional] -**usedOverages** | **int** | Quantity consumed by sub-organizations over the admin plan limit (only applicable on ENTv2) | [optional] -**remaining** | **int** | Quantity remaining in the plan | [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) - - +**name** | **string** | Name of the feature | [optional] +**unitValue** | **string** | Unit value of the feature | [optional] +**quantity** | **int** | Quantity provided in the plan | [optional] +**quantityWithOverages** | **int** | Quantity with overages provided in the plan (only applicable on ENTv2) | [optional] +**used** | **int** | Quantity consumed by master | [optional] +**usedOverages** | **int** | Quantity consumed by sub-organizations over the admin plan limit (only applicable on ENTv2) | [optional] +**remaining** | **int** | Quantity remaining in the plan | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Note.md b/docs/Model/Note.md index 1269471..4af8d10 100644 --- a/docs/Model/Note.md +++ b/docs/Model/Note.md @@ -1,16 +1,15 @@ -# Note +# # Note ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Unique note Id | [optional] -**text** | **string** | Text content of a note | -**contactIds** | **int[]** | Contact ids linked to a note | [optional] -**dealIds** | **string[]** | Deal ids linked to a note | [optional] -**authorId** | **object** | Account details of user which created the note | [optional] -**createdAt** | [**\DateTime**] | Note created date/time | [optional] -**updatedAt** | [**\DateTime**] | Note updated date/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) - - +**text** | **string** | Text content of a note | +**id** | **string** | Unique note Id | [optional] +**contactIds** | **int[]** | Contact ids linked to a note | [optional] +**dealIds** | **string[]** | Deal ids linked to a note | [optional] +**authorId** | **object** | Account details of user which created the note | [optional] +**createdAt** | **\DateTime** | Note created date/time | [optional] +**updatedAt** | **\DateTime** | Note updated date/time | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/NoteData.md b/docs/Model/NoteData.md index e70cbc7..602cebe 100644 --- a/docs/Model/NoteData.md +++ b/docs/Model/NoteData.md @@ -1,13 +1,12 @@ -# NoteData +# # NoteData ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**text** | **string** | Text content of a note | -**contactIds** | **int[]** | Contact Ids linked to a note | [optional] -**dealIds** | **string[]** | Deal Ids linked to a note | [optional] -**companyIds** | **string[]** | Company Ids linked to a note | [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) - +**text** | **string** | Text content of a note | +**contactIds** | **int[]** | Contact Ids linked to a note | [optional] +**dealIds** | **string[]** | Deal Ids linked to a note | [optional] +**companyIds** | **string[]** | Company Ids linked to a note | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/NoteId.md b/docs/Model/NoteId.md index 84ee593..5e1097a 100644 --- a/docs/Model/NoteId.md +++ b/docs/Model/NoteId.md @@ -1,10 +1,9 @@ -# NoteId +# # NoteId ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Unique note 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) - +**id** | **string** | Unique note Id | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/NoteList.md b/docs/Model/NoteList.md deleted file mode 100644 index 81fc0fa..0000000 --- a/docs/Model/NoteList.md +++ /dev/null @@ -1,9 +0,0 @@ -# NoteList - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/Notification.md b/docs/Model/Notification.md new file mode 100644 index 0000000..38a7b95 --- /dev/null +++ b/docs/Model/Notification.md @@ -0,0 +1,10 @@ +# # Notification + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**channel** | **string** | Channel used to send the notifications. | +**text** | **string** | Use this field if you want to give more context to your contact about the payment request. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Offer.md b/docs/Model/Offer.md new file mode 100644 index 0000000..227dbc5 --- /dev/null +++ b/docs/Model/Offer.md @@ -0,0 +1,15 @@ +# # Offer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Offer id | [optional] +**loyaltyProgramId** | **string** | Loyalty program id | [optional] +**name** | **string** | Offer name | [optional] +**state** | **string** | Offer state | [optional] +**publicImageUrl** | **string** | Offer image url | [optional] +**createdAt** | **\DateTime** | Offer creation date | [optional] +**updatedAt** | **\DateTime** | Offer update date | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OfferList.md b/docs/Model/OfferList.md new file mode 100644 index 0000000..efb40a3 --- /dev/null +++ b/docs/Model/OfferList.md @@ -0,0 +1,9 @@ +# # OfferList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**items** | [**\Brevo\Client\Models\Offer[]**](Offer.md) | List of offers | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OffersListResponse.md b/docs/Model/OffersListResponse.md new file mode 100644 index 0000000..8865292 --- /dev/null +++ b/docs/Model/OffersListResponse.md @@ -0,0 +1,10 @@ +# # OffersListResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalCount** | **int** | Total count of offers | [optional] +**items** | [**\Brevo\Client\Models\Offer[]**](Offer.md) | List of offers | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Order.md b/docs/Model/Order.md index fb444ce..dff0ad4 100644 --- a/docs/Model/Order.md +++ b/docs/Model/Order.md @@ -1,18 +1,18 @@ -# Order +# # Order ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Unique ID of the order. | -**createdAt** | **string** | Event occurrence UTC date-time (YYYY-MM-DDTHH:mm:ssZ), when order is actually created. | -**updatedAt** | **string** | Event updated UTC date-time (YYYY-MM-DDTHH:mm:ssZ), when the status of the order is actually changed/updated. | -**status** | **string** | State of the order. | -**amount** | **float** | Total amount of the order, including all shipping expenses, tax and the price of items. | -**products** | [**\Brevo\Client\Model\OrderProducts[]**](OrderProducts.md) | | -**email** | **string** | Email of the contact, Mandatory if \"phone\" field is not passed in \"billing\" parameter. | [optional] -**billing** | [**\Brevo\Client\Model\OrderBilling**](OrderBilling.md) | | [optional] -**coupons** | **string[]** | Coupons applied to the order. Stored case insensitive. | [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) - +**id** | **string** | Unique ID of the order. | +**createdAt** | **string** | Event occurrence UTC date-time (YYYY-MM-DDTHH:mm:ssZ), when order is actually created. | +**updatedAt** | **string** | Event updated UTC date-time (YYYY-MM-DDTHH:mm:ssZ), when the status of the order is actually changed/updated. | +**status** | **string** | State of the order. | +**amount** | **float** | Total amount of the order, including all shipping expenses, tax and the price of items. | +**products** | [**\Brevo\Client\Models\OrderProductsInner[]**](OrderProductsInner.md) | | +**storeId** | **string** | ID of store where the order is placed | [optional] +**identifiers** | [**\Brevo\Client\Models\OrderIdentifiers**](OrderIdentifiers.md) | | [optional] +**billing** | [**\Brevo\Client\Models\OrderBilling**](OrderBilling.md) | | [optional] +**coupons** | **string[]** | Coupons applied to the order. Stored case insensitive. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderBatch.md b/docs/Model/OrderBatch.md index e2fe2d1..3e88468 100644 --- a/docs/Model/OrderBatch.md +++ b/docs/Model/OrderBatch.md @@ -1,12 +1,11 @@ -# OrderBatch +# # OrderBatch ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**orders** | [**\Brevo\Client\Model\Order[]**](Order.md) | array of order objects | -**notifyUrl** | **string** | Notify Url provided by client to get the status of batch request | [optional] +**orders** | [**\Brevo\Client\Models\Order[]**](Order.md) | array of order objects | +**notifyUrl** | **string** | Notify Url provided by client to get the status of batch request | [optional] **historical** | **bool** | Defines wether you want your orders to be considered as live data or as historical data (import of past data, synchronising data). True: orders will not trigger any automation workflows. False: orders will trigger workflows as usual. | [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) - - +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderBilling.md b/docs/Model/OrderBilling.md index 0abf39e..77bbf9a 100644 --- a/docs/Model/OrderBilling.md +++ b/docs/Model/OrderBilling.md @@ -1,16 +1,16 @@ -# OrderBilling +# # OrderBilling ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**address** | **string** | Full billing address. | [optional] -**city** | **string** | Exact city of the address. | [optional] -**countryCode** | **string** | Billing country 2-letter ISO code. | [optional] -**phone** | **string** | Phone number to contact for further details about the order, Mandatory if \"email\" field is not passed. | [optional] -**postCode** | **string** | Postcode for delivery and billing. | [optional] -**paymentMethod** | **string** | How the visitor will pay for the item(s), e.g. paypal, check, etc. | [optional] -**region** | **string** | Exact region (state/province) for delivery and billing. | [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) - +**address** | **string** | Full billing address. | [optional] +**city** | **string** | Exact city of the address. | [optional] +**countryCode** | **string** | Billing country 2-letter ISO code. | [optional] +**country** | **string** | Billing country name. | [optional] +**phone** | **string** | Billing phone number. | [optional] +**postCode** | **string** | Postcode for delivery and billing. | [optional] +**paymentMethod** | **string** | How the visitor will pay for the item(s), e.g. paypal, check, etc. | [optional] +**region** | **string** | Exact region (state/province) for delivery and billing. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderIdentifiers.md b/docs/Model/OrderIdentifiers.md new file mode 100644 index 0000000..59dcd75 --- /dev/null +++ b/docs/Model/OrderIdentifiers.md @@ -0,0 +1,12 @@ +# # OrderIdentifiers + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**extId** | **string** | ext_id associated with the order | [optional] +**loyaltySubscriptionId** | **string** | loyalty_subscription_id associated with the order | [optional] +**phoneId** | **string** | Phone number of the contact associated with the order | [optional] +**emailId** | **string** | Email of the contact associated with the order | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderProducts.md b/docs/Model/OrderProducts.md deleted file mode 100644 index 9e1b2f0..0000000 --- a/docs/Model/OrderProducts.md +++ /dev/null @@ -1,13 +0,0 @@ -# OrderProducts - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**productId** | **string** | ID of the product. | -**quantity** | **float** | How many pieces of the product the visitor has added to the cart. | -**variantId** | **string** | Product ID of the red color shirts. | [optional] -**price** | **float** | The price of a unit of product | - -[[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/OrderProductsInner.md b/docs/Model/OrderProductsInner.md new file mode 100644 index 0000000..614f9fa --- /dev/null +++ b/docs/Model/OrderProductsInner.md @@ -0,0 +1,12 @@ +# # OrderProductsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**productId** | **string** | ID of the product. | +**quantity** | **float** | How many pieces of the product the visitor has added to the cart. | +**price** | **float** | The price of a unit of product | +**variantId** | **string** | Product ID of the red color shirts. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Otp.md b/docs/Model/Otp.md index d1e6191..c26f5a5 100644 --- a/docs/Model/Otp.md +++ b/docs/Model/Otp.md @@ -1,10 +1,9 @@ -# Otp +# # Otp ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **int** | 6 digit OTP received on email | [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) - +**otp** | **int** | 6 digit OTP received on email | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PatchLoyaltyProgramPayload.md b/docs/Model/PatchLoyaltyProgramPayload.md new file mode 100644 index 0000000..5278d28 --- /dev/null +++ b/docs/Model/PatchLoyaltyProgramPayload.md @@ -0,0 +1,11 @@ +# # PatchLoyaltyProgramPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Loyalty Program name | [optional] +**description** | **string** | Loyalty Program description | [optional] +**meta** | **object** | Loyalty Program meta data | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Pipeline.md b/docs/Model/Pipeline.md index b7d428b..2271e2e 100644 --- a/docs/Model/Pipeline.md +++ b/docs/Model/Pipeline.md @@ -1,12 +1,11 @@ -# Pipeline +# # Pipeline ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**pipeline** | **string** | Pipeline id | [optional] -**pipelineName** | **string** | Pipeline Name | [optional] -**stages** | [**\Brevo\Client\Model\PipelineStage[]**](PipelineStage.md) | List of stages | [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) - +**pipelineName** | **string** | Pipeline name | [optional] +**pipeline** | **string** | Pipeline id | [optional] +**stages** | [**\Brevo\Client\Models\PipelineStage[]**](PipelineStage.md) | List of stages | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PipelineStage.md b/docs/Model/PipelineStage.md index 84645f8..cf4ae57 100644 --- a/docs/Model/PipelineStage.md +++ b/docs/Model/PipelineStage.md @@ -1,11 +1,10 @@ -# PipelineStage +# # PipelineStage ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Stage id | [optional] -**name** | **string** | Stage name | [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) - +**id** | **string** | Stage id | [optional] +**name** | **string** | Stage name | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Pipelines.md b/docs/Model/Pipelines.md deleted file mode 100644 index 948d3d9..0000000 --- a/docs/Model/Pipelines.md +++ /dev/null @@ -1,9 +0,0 @@ -# Pipelines - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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 351fa34..f7ea797 100644 --- a/docs/Model/PostContactInfo.md +++ b/docs/Model/PostContactInfo.md @@ -1,10 +1,9 @@ -# PostContactInfo +# # PostContactInfo ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**contacts** | [**\Brevo\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) - +**contacts** | [**\Brevo\Client\Models\PostContactInfoContacts**](PostContactInfoContacts.md) | | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PostContactInfoContacts.md b/docs/Model/PostContactInfoContacts.md index 3c28eff..6cca483 100644 --- a/docs/Model/PostContactInfoContacts.md +++ b/docs/Model/PostContactInfoContacts.md @@ -1,13 +1,12 @@ -# PostContactInfoContacts +# # PostContactInfoContacts ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**success** | **string[]** | | [optional] -**failure** | **string[]** | | [optional] -**total** | **int** | Displays the count of total number of contacts removed from list when user opts for \"all\" option. | [optional] -**processId** | **int** | Id of the process created to remove contacts from list when user opts for \"all\" option. | [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) - +**success** | [**\Brevo\Client\Models\PostContactInfoContactsSuccess**](PostContactInfoContactsSuccess.md) | | [optional] +**failure** | [**\Brevo\Client\Models\PostContactInfoContactsFailure**](PostContactInfoContactsFailure.md) | | [optional] +**total** | **int** | Displays the count of total number of contacts removed from list when user opts for \"all\" option. | [optional] +**processId** | **int** | Id of the process created to remove contacts from list when user opts for \"all\" option. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PostContactInfoContactsFailure.md b/docs/Model/PostContactInfoContactsFailure.md new file mode 100644 index 0000000..d672faa --- /dev/null +++ b/docs/Model/PostContactInfoContactsFailure.md @@ -0,0 +1,8 @@ +# # PostContactInfoContactsFailure + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PostContactInfoContactsSuccess.md b/docs/Model/PostContactInfoContactsSuccess.md new file mode 100644 index 0000000..60bb668 --- /dev/null +++ b/docs/Model/PostContactInfoContactsSuccess.md @@ -0,0 +1,8 @@ +# # PostContactInfoContactsSuccess + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PostSendFailed.md b/docs/Model/PostSendFailed.md index a7d6069..df6ab95 100644 --- a/docs/Model/PostSendFailed.md +++ b/docs/Model/PostSendFailed.md @@ -1,14 +1,13 @@ -# PostSendFailed +# # PostSendFailed ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**code** | **int** | Response code | -**message** | **string** | Response message | -**unexistingEmails** | **string[]** | | [optional] -**withoutListEmails** | **string[]** | | [optional] -**blackListedEmails** | **string[]** | | [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) - +**code** | **string** | Response code | +**message** | **string** | Response message | +**unexistingEmails** | **string[]** | | [optional] +**withoutListEmails** | **string[]** | | [optional] +**blackListedEmails** | **string[]** | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PostSendSmsTestFailed.md b/docs/Model/PostSendSmsTestFailed.md index 8d414d6..8bb8a9f 100644 --- a/docs/Model/PostSendSmsTestFailed.md +++ b/docs/Model/PostSendSmsTestFailed.md @@ -1,13 +1,12 @@ -# PostSendSmsTestFailed +# # PostSendSmsTestFailed ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**code** | **int** | Response code | -**message** | **string** | Response message | -**unexistingSms** | **string[]** | | [optional] -**withoutListSms** | **string[]** | | [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) - +**code** | **string** | Response code | +**message** | **string** | Response message | +**unexistingSms** | **string[]** | | [optional] +**withoutListSms** | **string[]** | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PutRevokeUserPermission.md b/docs/Model/PutRevokeUserPermission.md index 43b7b81..bad55a2 100644 --- a/docs/Model/PutRevokeUserPermission.md +++ b/docs/Model/PutRevokeUserPermission.md @@ -1,10 +1,9 @@ -# PutRevokeUserPermission +# # PutRevokeUserPermission ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**email** | **string** | Email address of the user. | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**email** | **string** | Email address of the user. | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PutRevokeUserPermissionResponse.md b/docs/Model/PutRevokeUserPermissionResponse.md new file mode 100644 index 0000000..058fcd4 --- /dev/null +++ b/docs/Model/PutRevokeUserPermissionResponse.md @@ -0,0 +1,10 @@ +# # PutRevokeUserPermissionResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **string** | Status of the API operation. | +**creditNotes** | **string[]** | Credit note | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Putresendcancelinvitation.md b/docs/Model/Putresendcancelinvitation.md index a35bfff..dcc40db 100644 --- a/docs/Model/Putresendcancelinvitation.md +++ b/docs/Model/Putresendcancelinvitation.md @@ -1,10 +1,9 @@ -# Putresendcancelinvitation +# # Putresendcancelinvitation ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**email** | **string** | Email address of the user. | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**email** | **string** | Email address of the user. | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PutresendcancelinvitationResponse.md b/docs/Model/PutresendcancelinvitationResponse.md new file mode 100644 index 0000000..d1b7e94 --- /dev/null +++ b/docs/Model/PutresendcancelinvitationResponse.md @@ -0,0 +1,10 @@ +# # PutresendcancelinvitationResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **string** | Status of the API operation. | +**creditNotes** | **string[]** | Credit note | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedeemRewardPayload.md b/docs/Model/RedeemRewardPayload.md new file mode 100644 index 0000000..ae5bdb5 --- /dev/null +++ b/docs/Model/RedeemRewardPayload.md @@ -0,0 +1,13 @@ +# # RedeemRewardPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **string** | Code to validate | [optional] +**attributedRewardId** | **string** | One of code or attributed reward id is required | [optional] +**posId** | **string** | Point of sale reward id | [optional] +**contactId** | **float** | Contact to attribute the reward | [optional] +**loyaltySubscriptionId** | **string** | One of contactId or loyaltySubscriptionId is required | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedeemedRewardFailedConditionErrorResponse.md b/docs/Model/RedeemedRewardFailedConditionErrorResponse.md new file mode 100644 index 0000000..fb5a3b3 --- /dev/null +++ b/docs/Model/RedeemedRewardFailedConditionErrorResponse.md @@ -0,0 +1,9 @@ +# # RedeemedRewardFailedConditionErrorResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RemainingCreditModel.md b/docs/Model/RemainingCreditModel.md deleted file mode 100644 index c97c2b8..0000000 --- a/docs/Model/RemainingCreditModel.md +++ /dev/null @@ -1,11 +0,0 @@ -# RemainingCreditModel - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**child** | [**\Brevo\Client\Model\RemainingCreditModelChild**](RemainingCreditModelChild.md) | | -**reseller** | [**\Brevo\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/RemainingCreditModelChild.md b/docs/Model/RemainingCreditModelChild.md deleted file mode 100644 index b3c6140..0000000 --- a/docs/Model/RemainingCreditModelChild.md +++ /dev/null @@ -1,11 +0,0 @@ -# RemainingCreditModelChild - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**sms** | **double** | SMS Credits remaining for child account | -**email** | **double** | Email Credits remaining for child account | - -[[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/RemainingCreditModelReseller.md b/docs/Model/RemainingCreditModelReseller.md deleted file mode 100644 index e447a82..0000000 --- a/docs/Model/RemainingCreditModelReseller.md +++ /dev/null @@ -1,11 +0,0 @@ -# RemainingCreditModelReseller - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**sms** | **double** | SMS Credits remaining for reseller account | -**email** | **double** | Email Credits remaining for reseller account | - -[[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/RemoveContactFromList.md b/docs/Model/RemoveContactFromList.md deleted file mode 100644 index 9677d35..0000000 --- a/docs/Model/RemoveContactFromList.md +++ /dev/null @@ -1,12 +0,0 @@ -# RemoveContactFromList - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**emails** | **string[]** | Required if 'all' is false. Emails to remove from a list. You can pass a maximum of 150 emails for removal in one request. | [optional] -**ids** | **int[]** | Mandatory if Emails are not passed, ignored otherwise. Emails to add to a list. You can pass a maximum of 150 emails for addition in one request. If you need to add the emails in bulk, please prefer /contacts/import api. | [optional] -**all** | **bool** | Required if none of 'emails' or 'ids' are passed. Remove all existing contacts from a list. A process will be created in this scenario. You can fetch the process details to know about the progress | [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/RemoveContactFromListByAll.md b/docs/Model/RemoveContactFromListByAll.md new file mode 100644 index 0000000..3b46cd6 --- /dev/null +++ b/docs/Model/RemoveContactFromListByAll.md @@ -0,0 +1,9 @@ +# # RemoveContactFromListByAll + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**all** | **bool** | **Required if 'emails', 'extIds' and 'ids' are empty.** Remove all existing contacts from a list. A process will be created in this scenario. You can fetch the process details to know about the progress | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RemoveContactFromListByEmails.md b/docs/Model/RemoveContactFromListByEmails.md new file mode 100644 index 0000000..1c67c2c --- /dev/null +++ b/docs/Model/RemoveContactFromListByEmails.md @@ -0,0 +1,9 @@ +# # RemoveContactFromListByEmails + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**emails** | **string[]** | **Required if 'all' is false and 'ids', 'extIds' are empty.** Emails to remove from a list. You can pass a **maximum of 150 emails** for removal in one request. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RemoveContactFromListByExtIDs.md b/docs/Model/RemoveContactFromListByExtIDs.md new file mode 100644 index 0000000..ff3980a --- /dev/null +++ b/docs/Model/RemoveContactFromListByExtIDs.md @@ -0,0 +1,9 @@ +# # RemoveContactFromListByExtIDs + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**extIds** | **string[]** | **Required if 'all' is false, 'ids' and 'emails' are empty.** EXT_ID attributes to remove from a list. You can pass a **maximum of 150 EXT_ID attributes** for removal in one request. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RemoveContactFromListByIDs.md b/docs/Model/RemoveContactFromListByIDs.md new file mode 100644 index 0000000..16ed460 --- /dev/null +++ b/docs/Model/RemoveContactFromListByIDs.md @@ -0,0 +1,9 @@ +# # RemoveContactFromListByIDs + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | **int[]** | **Required if 'all' is false and 'emails', 'extIds' are empty.** IDs to remove from a list. You can pass a **maximum of 150 IDs** for removal in one request. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RemoveContactFromListRequest.md b/docs/Model/RemoveContactFromListRequest.md new file mode 100644 index 0000000..0f98549 --- /dev/null +++ b/docs/Model/RemoveContactFromListRequest.md @@ -0,0 +1,12 @@ +# # RemoveContactFromListRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**emails** | **string[]** | **Required if 'all' is false and 'ids', 'extIds' are empty.** Emails to remove from a list. You can pass a **maximum of 150 emails** for removal in one request. | [optional] +**ids** | **int[]** | **Required if 'all' is false and 'emails', 'extIds' are empty.** IDs to remove from a list. You can pass a **maximum of 150 IDs** for removal in one request. | [optional] +**all** | **bool** | **Required if 'emails', 'extIds' and 'ids' are empty.** Remove all existing contacts from a list. A process will be created in this scenario. You can fetch the process details to know about the progress | [optional] +**extIds** | **string[]** | **Required if 'all' is false, 'ids' and 'emails' are empty.** EXT_ID attributes to remove from a list. You can pass a **maximum of 150 EXT_ID attributes** for removal in one request. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RemoveCredits.md b/docs/Model/RemoveCredits.md deleted file mode 100644 index 3cbac52..0000000 --- a/docs/Model/RemoveCredits.md +++ /dev/null @@ -1,11 +0,0 @@ -# RemoveCredits - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**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 ac02086..1b27882 100644 --- a/docs/Model/RequestContactExport.md +++ b/docs/Model/RequestContactExport.md @@ -1,12 +1,11 @@ -# RequestContactExport +# # RequestContactExport ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**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] -**customContactFilter** | [**\Brevo\Client\Model\RequestContactExportCustomContactFilter**](RequestContactExportCustomContactFilter.md) | | -**notifyUrl** | **string** | Webhook that will be called once the export process is finished. For reference, https://help.brevo.com/hc/en-us/articles/360007666479 | [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) - +**customContactFilter** | [**\Brevo\Client\Models\RequestContactExportCustomContactFilter**](RequestContactExportCustomContactFilter.md) | | +**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] +**notifyUrl** | **string** | Webhook that will be called once the export process is finished. For reference, https://help.brevo.com/hc/en-us/articles/360007666479 | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RequestContactExportCustomContactFilter.md b/docs/Model/RequestContactExportCustomContactFilter.md index 66079ef..a03807a 100644 --- a/docs/Model/RequestContactExportCustomContactFilter.md +++ b/docs/Model/RequestContactExportCustomContactFilter.md @@ -1,15 +1,14 @@ -# RequestContactExportCustomContactFilter +# # RequestContactExportCustomContactFilter ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**actionForContacts** | **string** | Mandatory if neither actionForEmailCampaigns nor actionForSmsCampaigns is passed. This will export the contacts on the basis of provided action applied on contacts as per the list id. * allContacts - Fetch the list of all contacts for a particular list. * subscribed & unsubscribed - Fetch the list of subscribed / unsubscribed (blacklisted via any means) contacts for a particular list. * unsubscribedPerList - Fetch the list of contacts that are unsubscribed from a particular list only. | [optional] -**actionForEmailCampaigns** | **string** | Mandatory if neither actionForContacts nor actionForSmsCampaigns is passed. This will export the contacts on the basis of provided action applied on email campaigns. * openers & nonOpeners - emailCampaignId is mandatory. Fetch the list of readers / non-readers for a particular email campaign. * clickers & nonClickers - emailCampaignId is mandatory. Fetch the list of clickers / non-clickers for a particular email campaign. * unsubscribed - emailCampaignId is mandatory. Fetch the list of all unsubscribed (blacklisted via any means) contacts for a particular email campaign. * hardBounces & softBounces - emailCampaignId is optional. Fetch the list of hard bounces / soft bounces for a particular / all email campaign(s). | [optional] -**actionForSmsCampaigns** | **string** | Mandatory if neither actionForContacts nor actionForEmailCampaigns is passed. This will export the contacts on the basis of provided action applied on sms campaigns. * unsubscribed - Fetch the list of all unsubscribed (blacklisted via any means) contacts for all / particular sms campaigns. * hardBounces & softBounces - Fetch the list of hard bounces / soft bounces for all / particular sms campaigns. | [optional] -**listId** | **int** | Mandatory if actionForContacts is passed, ignored otherwise. Id of the list for which the corresponding action shall be applied in the filter. | [optional] -**emailCampaignId** | **int** | Considered only if actionForEmailCampaigns is passed, ignored otherwise. Mandatory if action is one of the following - openers, nonOpeners, clickers, nonClickers, unsubscribed. The id of the email campaign for which the corresponding action shall be applied in the filter. | [optional] -**smsCampaignId** | **int** | Considered only if actionForSmsCampaigns is passed, ignored otherwise. The id of sms campaign for which the corresponding action shall be applied in the filter. | [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) - - +**actionForContacts** | **string** | **Mandatory if neither actionForEmailCampaigns nor actionForSmsCampaigns is passed.** This will export the contacts on the basis of provided action applied on contacts as per the list id. * **allContacts** - Fetch the list of all contacts for a particular list. * **subscribed & unsubscribed** - Fetch the list of subscribed / unsubscribed (blacklisted via any means) contacts for a particular list. * **unsubscribedPerList** - Fetch the list of contacts that are unsubscribed from a particular list only. | [optional] +**actionForEmailCampaigns** | **string** | **Mandatory if neither actionForContacts nor actionForSmsCampaigns is passed.** This will export the contacts on the basis of provided action applied on email campaigns. * **openers & nonOpeners** - emailCampaignId is mandatory. Fetch the list of readers / non-readers for a particular email campaign. * **clickers & nonClickers** - emailCampaignId is mandatory. Fetch the list of clickers / non-clickers for a particular email campaign. * **unsubscribed** - emailCampaignId is mandatory. Fetch the list of all unsubscribed (blacklisted via any means) contacts for a particular email campaign. * **hardBounces & softBounces** - emailCampaignId is optional. Fetch the list of hard bounces / soft bounces for a particular / all email campaign(s). | [optional] +**actionForSmsCampaigns** | **string** | **Mandatory if neither actionForContacts nor actionForEmailCampaigns is passed.** This will export the contacts on the basis of provided action applied on sms campaigns. * **unsubscribed** - Fetch the list of all unsubscribed (blacklisted via any means) contacts for all / particular sms campaigns. * **hardBounces & softBounces** - Fetch the list of hard bounces / soft bounces for all / particular sms campaigns. | [optional] +**listId** | **int** | **Mandatory if actionForContacts is passed, ignored otherwise.** Id of the list for which the corresponding action shall be applied in the filter. | [optional] +**emailCampaignId** | **int** | Considered only if **actionForEmailCampaigns** is passed, ignored otherwise. **Mandatory if action is one of the following - openers, nonOpeners, clickers, nonClickers, unsubscribed.** The id of the email campaign for which the corresponding action shall be applied in the filter. | [optional] +**smsCampaignId** | **int** | Considered only if **actionForSmsCampaigns** is passed, ignored otherwise. The id of sms campaign for which the corresponding action shall be applied in the filter. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RequestContactImport.md b/docs/Model/RequestContactImport.md index d145d9b..1ecd3ef 100644 --- a/docs/Model/RequestContactImport.md +++ b/docs/Model/RequestContactImport.md @@ -1,20 +1,19 @@ -# RequestContactImport +# # RequestContactImport ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**fileUrl** | **string** | Mandatory if fileBody or jsonBody is not defined. URL of the file to be imported (no local file). Possible file formats: .txt, .csv, .json | [optional] -**fileBody** | **string** | Mandatory if fileUrl and jsonBody is not defined. CSV content to be imported. Use semicolon to separate multiple attributes. Maximum allowed file body size is 10MB . However we recommend a safe limit of around 8 MB to avoid the issues caused due to increase of file body size while parsing. Please use fileUrl instead to import bigger files. | [optional] -**jsonBody** | [**\Brevo\Client\Model\RequestContactImportJsonBody[]**](RequestContactImportJsonBody.md) | **Mandatory if fileUrl and fileBody is not defined.** JSON content to be imported. **Maximum allowed json body size is 10MB** . However we recommend a safe limit of around 8 MB to avoid the issues caused due to increase of json body size while parsing. Please use fileUrl instead to import bigger files. | [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 import process is finished. For reference, https://help.brevo.com/hc/en-us/articles/360007666479 | [optional] -**newList** | [**\Brevo\Client\Model\RequestContactImportNewList**](RequestContactImportNewList.md) | | [optional] +**fileUrl** | **string** | **Mandatory if fileBody and jsonBody is not defined.** URL of the file to be imported (**no local file**). Possible file formats: #### .txt, .csv, .json | [optional] +**fileBody** | **string** | **Mandatory if fileUrl and jsonBody is not defined.** CSV content to be imported. Use semicolon to separate multiple attributes. **Maximum allowed file body size is 10MB** . However we recommend a safe limit of around 8 MB to avoid the issues caused due to increase of file body size while parsing. Please use fileUrl instead to import bigger files. | [optional] +**jsonBody** | [**\Brevo\Client\Models\RequestContactImportJsonBodyInner[]**](RequestContactImportJsonBodyInner.md) | **Mandatory if fileUrl and fileBody is not defined.** JSON content to be imported. **Maximum allowed json body size is 10MB** . However we recommend a safe limit of around 8 MB to avoid the issues caused due to increase of json body size while parsing. Please use fileUrl instead to import bigger files. | [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 import process is finished. For reference, https://help.brevo.com/hc/en-us/articles/360007666479 | [optional] +**newList** | [**\Brevo\Client\Models\RequestContactImportNewList**](RequestContactImportNewList.md) | | [optional] **emailBlacklist** | **bool** | To blacklist all the contacts for email | [optional] [default to false] **disableNotification** | **bool** | To disable email notification | [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] -**emptyContactsAttributes** | **bool** | To facilitate the choice to erase any attribute of the existing contacts with empty value. emptyContactsAttributes = true means the empty fields in your import will erase any attribute that currently contain data in Brevo, & emptyContactsAttributes = false means the empty fields will not affect your existing data ( only available if `updateExistingContacts` set to true ) | [optional] [default to false] - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**emptyContactsAttributes** | **bool** | To facilitate the choice to erase any attribute of the existing contacts with empty value. emptyContactsAttributes = true means the empty fields in your import will erase any attribute that currently contain data in Brevo, & emptyContactsAttributes = false means the empty fields will not affect your existing data ( **only available if `updateExistingContacts` set to true **) | [optional] [default to false] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RequestContactImportJsonBody.md b/docs/Model/RequestContactImportJsonBody.md deleted file mode 100644 index 4dcb144..0000000 --- a/docs/Model/RequestContactImportJsonBody.md +++ /dev/null @@ -1,11 +0,0 @@ -# RequestContactImportJsonBody - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**email** | **string** | | [optional] -**attributes** | **object** | List of attributes to be imported | [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/RequestContactImportJsonBodyInner.md b/docs/Model/RequestContactImportJsonBodyInner.md new file mode 100644 index 0000000..5660128 --- /dev/null +++ b/docs/Model/RequestContactImportJsonBodyInner.md @@ -0,0 +1,10 @@ +# # RequestContactImportJsonBodyInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email** | **string** | | [optional] +**attributes** | **array** | List of attributes to be imported | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RequestContactImportNewList.md b/docs/Model/RequestContactImportNewList.md index 049ee8f..fa8175d 100644 --- a/docs/Model/RequestContactImportNewList.md +++ b/docs/Model/RequestContactImportNewList.md @@ -1,11 +1,10 @@ -# RequestContactImportNewList +# # RequestContactImportNewList ## Properties + 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** | 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) - +**listName** | **string** | List with listName will be created first and users will be imported in it. **Mandatory if listIds is 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#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RequestSmsRecipientExport.md b/docs/Model/RequestSmsRecipientExport.md index 5d7d7d2..501ae6b 100644 --- a/docs/Model/RequestSmsRecipientExport.md +++ b/docs/Model/RequestSmsRecipientExport.md @@ -1,11 +1,10 @@ -# RequestSmsRecipientExport +# # RequestSmsRecipientExport ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**notifyURL** | **string** | URL that will be called once the export process is finished. For reference, https://help.brevo.com/hc/en-us/articles/360007666479 | [optional] -**recipientsType** | **string** | Filter the recipients based on how they interacted with 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) - +**recipientsType** | **string** | Filter the recipients based on how they interacted with the campaign | +**notifyURL** | **string** | URL that will be called once the export process is finished. For reference, https://help.brevo.com/hc/en-us/articles/360007666479 | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RewardAttributionResponse.md b/docs/Model/RewardAttributionResponse.md new file mode 100644 index 0000000..294eaac --- /dev/null +++ b/docs/Model/RewardAttributionResponse.md @@ -0,0 +1,17 @@ +# # RewardAttributionResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Attributed reward Id | [optional] +**rewardId** | **string** | Reward id which ias attributed | [optional] +**loyaltyProgramId** | **string** | Loyalty program id | [optional] +**contactId** | **float** | Contact to which reward is attributed | [optional] +**code** | **string** | code associated to the attributed reward | [optional] +**expirationDate** | **\DateTime** | | [optional] +**consumedAt** | **\DateTime** | | [optional] +**createdAt** | **\DateTime** | | [optional] +**updatedAt** | **\DateTime** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RewardRedeemResponse.md b/docs/Model/RewardRedeemResponse.md new file mode 100644 index 0000000..5a8611c --- /dev/null +++ b/docs/Model/RewardRedeemResponse.md @@ -0,0 +1,17 @@ +# # RewardRedeemResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Attributed reward Id | [optional] +**rewardId** | **string** | Reward id which ias attributed | [optional] +**loyaltyProgramId** | **string** | Loyalty program id | [optional] +**contactId** | **float** | Contact to which reward is attributed | [optional] +**code** | **string** | code associated to the attributed reward | [optional] +**consumedAt** | **\DateTime** | | [optional] +**expirationDate** | **\DateTime** | | [optional] +**createdAt** | **\DateTime** | | [optional] +**updatedAt** | **\DateTime** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ScheduleSmtpEmail.md b/docs/Model/ScheduleSmtpEmail.md index a707441..5360897 100644 --- a/docs/Model/ScheduleSmtpEmail.md +++ b/docs/Model/ScheduleSmtpEmail.md @@ -1,12 +1,11 @@ -# ScheduleSmtpEmail +# # ScheduleSmtpEmail ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**messageId** | **string** | Message ID of the transactional email scheduled | [optional] -**messageIds** | **string[]** | | [optional] -**batchId** | **string** | Batch ID of the batch transactional email scheduled | [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) - +**messageId** | **string** | Message ID of the transactional email scheduled | [optional] +**messageIds** | **string[]** | | [optional] +**batchId** | **string** | Batch ID of the batch transactional email scheduled | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Segment.md b/docs/Model/Segment.md new file mode 100644 index 0000000..1417cad --- /dev/null +++ b/docs/Model/Segment.md @@ -0,0 +1,12 @@ +# # Segment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | ID of the list | +**segmentName** | **string** | Name of the Segment | +**categoryName** | **string** | Name of the Segment Category | +**updatedAt** | **string** | Updation UTC date-time of the segment (YYYY-MM-DDTHH:mm:ss.SSSZ) | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendReport.md b/docs/Model/SendReport.md index c16702a..755ea40 100644 --- a/docs/Model/SendReport.md +++ b/docs/Model/SendReport.md @@ -1,11 +1,10 @@ -# SendReport +# # SendReport ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**email** | [**\Brevo\Client\Models\SendReportEmail**](SendReportEmail.md) | | **language** | **string** | Language of email content for campaign report sending. | [optional] [default to 'fr'] -**email** | [**\Brevo\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) - +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendReportEmail.md b/docs/Model/SendReportEmail.md index 0485128..c182dd6 100644 --- a/docs/Model/SendReportEmail.md +++ b/docs/Model/SendReportEmail.md @@ -1,11 +1,10 @@ -# SendReportEmail +# # SendReportEmail ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**to** | **string[]** | Email addresses of the recipients | -**body** | **string** | Custom text message to be presented in the report 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) - +**to** | **string[]** | Email addresses of the recipients | +**body** | **string** | Custom text message to be presented in the report email. | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendSms.md b/docs/Model/SendSms.md index dc51cd6..e88c1ea 100644 --- a/docs/Model/SendSms.md +++ b/docs/Model/SendSms.md @@ -1,14 +1,13 @@ -# SendSms +# # SendSms ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**reference** | **string** | | -**messageId** | **int** | | -**smsCount** | **int** | Count of SMS's to send multiple text messages | [optional] -**usedCredits** | **float** | SMS credits used per text message | [optional] -**remainingCredits** | **float** | Remaining SMS credits of the user | [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) - +**reference** | **string** | | +**messageId** | **int** | | +**smsCount** | **int** | Count of SMS's to send multiple text messages | [optional] +**usedCredits** | **float** | SMS credits used per text message | [optional] +**remainingCredits** | **float** | Remaining SMS credits of the user | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendSmtpEmail.md b/docs/Model/SendSmtpEmail.md index 8c6d539..3b17447 100644 --- a/docs/Model/SendSmtpEmail.md +++ b/docs/Model/SendSmtpEmail.md @@ -1,25 +1,24 @@ -# SendSmtpEmail +# # SendSmtpEmail ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**sender** | [**\Brevo\Client\Model\SendSmtpEmailSender**](SendSmtpEmailSender.md) | | [optional] -**to** | [**\Brevo\Client\Model\SendSmtpEmailTo[]**](SendSmtpEmailTo.md) | Mandatory if messageVersions are not passed, ignored if messageVersions are passed. List of email addresses and names (optional) of the recipients. For example, [{\"name\":\"Jimmy\", \"email\":\"jimmy98@example.com\"}, {\"name\":\"Joe\", \"email\":\"joe@example.com\"}] | [optional] -**bcc** | [**\Brevo\Client\Model\SendSmtpEmailBcc[]**](SendSmtpEmailBcc.md) | List of email addresses and names (optional) of the recipients in bcc | [optional] -**cc** | [**\Brevo\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** | [**\Brevo\Client\Model\SendSmtpEmailReplyTo**](SendSmtpEmailReplyTo.md) | | [optional] -**attachment** | [**\Brevo\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\":\"myAttachmentFromUrl.jpg\"}, {\"content\":\"base64 example content\", \"name\":\"myAttachmentFromBase64.jpg\"}]`. 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, eps, odt, mp3, m4a, m4v, wma, ogg, flac, wav, aif, aifc, aiff, mp4, mov, avi, mkv, mpeg, mpg, wmv, pkpass and xlsm ( If 'templateId' is passed and is in New Template Language format then both attachment url and content are accepted. If template is in Old template Language format, then 'attachment' is ignored ) | [optional] -**headers** | **object** | Pass the set of custom headers (not the standard headers) that shall be sent along the mail headers in the original email. 'sender.ip' header can be set (only for dedicated ip users) to mention the IP to be used for sending transactional emails. Headers are allowed in `This-Case-Only` (i.e. words separated by hyphen with first letter of each word in capital letter), they will be converted to such case styling if not in this format in the request payload. For example, `{\"sender.ip\":\"1.2.3.4\", \"X-Mailin-custom\":\"some_custom_header\",\"idempotencyKey\":\"abc-123\"}`. | [optional] -**templateId** | **int** | Id of the template. | [optional] -**params** | **object** | Pass the set of attributes to customize the template. For example, {\"FNAME\":\"Joe\", \"LNAME\":\"Doe\"}. It's considered only if template is in New Template Language format. | [optional] -**messageVersions** | [**\Brevo\Client\Model\SendSmtpEmailMessageVersions[]**](SendSmtpEmailMessageVersions.md) | You can customize and send out multiple versions of a mail. templateId can be customized only if global parameter contains templateId. htmlContent and textContent can be customized only if any of the two, htmlContent or textContent, is present in global parameters. Some global parameters such as **to(mandatory), bcc, cc, replyTo, subject** can also be customized specific to each version. Total number of recipients in one API request must not exceed 2000. However, you can still pass upto 99 recipients maximum in one message version. The size of individual params in all the messageVersions shall not exceed 100 KB limit and that of cumulative params shall not exceed 1000 KB. You can follow this **step-by-step guide** on how to use **messageVersions** to batch send emails - https://developers.brevo.com/docs/batch-send-transactional-emails | [optional] -**tags** | **string[]** | Tag your emails to find them more easily | [optional] -**scheduledAt** | [**\DateTime**] | UTC date-time on which the email has to schedule (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for scheduling. There can be an expected delay of +5 minutes in scheduled email delivery. **Please note this feature is currently a public beta**. | [optional] -**batchId** | **string** | Valid UUIDv4 batch id to identify the scheduled batches transactional email. If not passed we will create a valid UUIDv4 batch id at our end. | [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) - +**sender** | [**\Brevo\Client\Models\SendSmtpEmailSender**](SendSmtpEmailSender.md) | | [optional] +**to** | [**\Brevo\Client\Models\SendSmtpEmailToInner[]**](SendSmtpEmailToInner.md) | **Mandatory if messageVersions are not passed, ignored if messageVersions are passed** List of email addresses and names (_optional_) of the recipients. For example, **[{\"name\":\"Jimmy\", \"email\":\"jimmy98@example.com\"}, {\"name\":\"Joe\", \"email\":\"joe@example.com\"}]** | [optional] +**bcc** | [**\Brevo\Client\Models\SendSmtpEmailBccInner[]**](SendSmtpEmailBccInner.md) | List of email addresses and names (_optional_) of the recipients in bcc | [optional] +**cc** | [**\Brevo\Client\Models\SendSmtpEmailCcInner[]**](SendSmtpEmailCcInner.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** | [**\Brevo\Client\Models\SendSmtpEmailReplyTo**](SendSmtpEmailReplyTo.md) | | [optional] +**attachment** | [**\Brevo\Client\Models\SendSmtpEmailAttachmentInner[]**](SendSmtpEmailAttachmentInner.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\":\"myAttachmentFromUrl.jpg\"}, {\"content\":\"base64 example content\", \"name\":\"myAttachmentFromBase64.jpg\"}]**. 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, eps, odt, mp3, m4a, m4v, wma, ogg, flac, wav, aif, aifc, aiff, mp4, mov, avi, mkv, mpeg, mpg, wmv, pkpass and xlsm. If `templateId` is passed and is in New Template Language format then both attachment url and content are accepted. If template is in Old template Language format, then `attachment` is ignored | [optional] +**headers** | **array** | Pass the set of custom headers (_not the standard headers_) that shall be sent along the mail headers in the original email. **'sender.ip'** header can be set (**only for dedicated ip users**) to mention the IP to be used for sending transactional emails. Headers are allowed in `This-Case-Only` (i.e. words separated by hyphen with first letter of each word in capital letter), they will be converted to such case styling if not in this format in the request payload. For example, **{\"sender.ip\":\"1.2.3.4\", \"X-Mailin-custom\":\"some_custom_header\", \"idempotencyKey\":\"abc-123\"}**. | [optional] +**templateId** | **int** | Id of the template. | [optional] +**params** | **array** | Pass the set of attributes to customize the template. For example, **{\"FNAME\":\"Joe\", \"LNAME\":\"Doe\"}**. It's **considered only if template is in New Template Language format**. | [optional] +**messageVersions** | [**\Brevo\Client\Models\SendSmtpEmailMessageVersionsInner[]**](SendSmtpEmailMessageVersionsInner.md) | You can customize and send out multiple versions of a mail. **templateId** can be customized only if global parameter contains templateId. **htmlContent and textContent** can be customized only if any of the two, htmlContent or textContent, is present in global parameters. Some global parameters such as **to(mandatory), bcc, cc, replyTo, subject** can also be customized specific to each version. Total number of recipients in one API request must not exceed 2000. However, you can still pass upto 99 recipients maximum in one message version. The size of individual params in all the messageVersions shall not exceed **100 KB** limit and that of cumulative params shall not exceed **1000 KB**. You can follow this **step-by-step guide** on how to use **messageVersions** to batch send emails - **https://developers.brevo.com/docs/batch-send-transactional-emails** | [optional] +**tags** | **string[]** | Tag your emails to find them more easily | [optional] +**scheduledAt** | **\DateTime** | UTC date-time on which the email has to schedule (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for scheduling. There can be an expected delay of +5 minutes in scheduled email delivery. | [optional] +**batchId** | **string** | Valid UUIDv4 batch id to identify the scheduled batches transactional email. If not passed we will create a valid UUIDv4 batch id at our end. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendSmtpEmailAttachment.md b/docs/Model/SendSmtpEmailAttachment.md deleted file mode 100644 index 713d2cf..0000000 --- a/docs/Model/SendSmtpEmailAttachment.md +++ /dev/null @@ -1,12 +0,0 @@ -# SendSmtpEmailAttachment - -## Properties -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 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/SendSmtpEmailAttachmentInner.md b/docs/Model/SendSmtpEmailAttachmentInner.md new file mode 100644 index 0000000..6eb8e0f --- /dev/null +++ b/docs/Model/SendSmtpEmailAttachmentInner.md @@ -0,0 +1,11 @@ +# # SendSmtpEmailAttachmentInner + +## Properties + +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 if content is passed**. Name of the attachment | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendSmtpEmailBcc.md b/docs/Model/SendSmtpEmailBcc.md deleted file mode 100644 index 3804644..0000000 --- a/docs/Model/SendSmtpEmailBcc.md +++ /dev/null @@ -1,11 +0,0 @@ -# SendSmtpEmailBcc - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**email** | **string** | Email address of the recipient in bcc | -**name** | **string** | Name of the recipient in bcc. Maximum allowed characters are 70. | [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/SendSmtpEmailBccInner.md b/docs/Model/SendSmtpEmailBccInner.md new file mode 100644 index 0000000..e924bd5 --- /dev/null +++ b/docs/Model/SendSmtpEmailBccInner.md @@ -0,0 +1,10 @@ +# # SendSmtpEmailBccInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email** | **string** | Email address of the recipient in bcc | +**name** | **string** | Name of the recipient in bcc. **Maximum allowed characters are 70**. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendSmtpEmailCc.md b/docs/Model/SendSmtpEmailCc.md deleted file mode 100644 index a36ff0d..0000000 --- a/docs/Model/SendSmtpEmailCc.md +++ /dev/null @@ -1,11 +0,0 @@ -# SendSmtpEmailCc - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**email** | **string** | Email address of the recipient in cc | -**name** | **string** | Name of the recipient in cc. Maximum allowed characters are 70. | [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/SendSmtpEmailCcInner.md b/docs/Model/SendSmtpEmailCcInner.md new file mode 100644 index 0000000..5546a00 --- /dev/null +++ b/docs/Model/SendSmtpEmailCcInner.md @@ -0,0 +1,10 @@ +# # SendSmtpEmailCcInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email** | **string** | Email address of the recipient in cc | +**name** | **string** | Name of the recipient in cc. **Maximum allowed characters are 70**. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendSmtpEmailMessageVersions.md b/docs/Model/SendSmtpEmailMessageVersions.md deleted file mode 100644 index 7f024e8..0000000 --- a/docs/Model/SendSmtpEmailMessageVersions.md +++ /dev/null @@ -1,15 +0,0 @@ -# SendSmtpEmailMessageVersions - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**to** | [**\Brevo\Client\Model\SendSmtpEmailTo1[]**](SendSmtpEmailTo1.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\"}] | -**params** | **map[string,object]** | Pass the set of attributes to customize the template. For example, {\"FNAME\":\"Joe\", \"LNAME\":\"Doe\"}. It's considered only if template is in New Template Language format. | [optional] -**bcc** | [**\Brevo\Client\Model\SendSmtpEmailBcc[]**](SendSmtpEmailBcc.md) | List of email addresses and names (optional) of the recipients in bcc | [optional] -**cc** | [**\Brevo\Client\Model\SendSmtpEmailCc[]**](SendSmtpEmailCc.md) | List of email addresses and names (optional) of the recipients in cc | [optional] -**replyTo** | [**\Brevo\Client\Model\SendSmtpEmailReplyTo1**](SendSmtpEmailReplyTo1.md) | | [optional] -**subject** | **string** | Custom subject specific to message version | [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/SendSmtpEmailMessageVersionsInner.md b/docs/Model/SendSmtpEmailMessageVersionsInner.md new file mode 100644 index 0000000..7f0fd32 --- /dev/null +++ b/docs/Model/SendSmtpEmailMessageVersionsInner.md @@ -0,0 +1,16 @@ +# # SendSmtpEmailMessageVersionsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**to** | [**\Brevo\Client\Models\SendSmtpEmailToInner[]**](SendSmtpEmailToInner.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\"}]** | +**params** | **array** | Pass the set of attributes to customize the template. For example, **{\"FNAME\":\"Joe\", \"LNAME\":\"Doe\"}**. It's **considered only if template is in New Template Language format**. | [optional] +**bcc** | [**\Brevo\Client\Models\SendSmtpEmailBccInner[]**](SendSmtpEmailBccInner.md) | List of email addresses and names (_optional_) of the recipients in bcc | [optional] +**cc** | [**\Brevo\Client\Models\SendSmtpEmailCcInner[]**](SendSmtpEmailCcInner.md) | List of email addresses and names (_optional_) of the recipients in cc | [optional] +**replyTo** | [**\Brevo\Client\Models\SendSmtpEmailReplyTo**](SendSmtpEmailReplyTo.md) | | [optional] +**subject** | **string** | Custom subject specific to message version | [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] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendSmtpEmailReplyTo.md b/docs/Model/SendSmtpEmailReplyTo.md index 1dc896b..72695ce 100644 --- a/docs/Model/SendSmtpEmailReplyTo.md +++ b/docs/Model/SendSmtpEmailReplyTo.md @@ -1,11 +1,10 @@ -# SendSmtpEmailReplyTo +# # SendSmtpEmailReplyTo ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**email** | **string** | Email address in reply to | -**name** | **string** | Name in reply to. Maximum allowed characters are 70. | [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) - +**email** | **string** | Email address in reply to | +**name** | **string** | Name in reply to. **Maximum allowed characters are 70**. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendSmtpEmailReplyTo1.md b/docs/Model/SendSmtpEmailReplyTo1.md deleted file mode 100644 index f00cae6..0000000 --- a/docs/Model/SendSmtpEmailReplyTo1.md +++ /dev/null @@ -1,11 +0,0 @@ -# SendSmtpEmailReplyTo1 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**email** | **string** | Email address in reply to | -**name** | **string** | Name in reply to. Maximum allowed characters are 70. | [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 e719f84..4ba7bb7 100644 --- a/docs/Model/SendSmtpEmailSender.md +++ b/docs/Model/SendSmtpEmailSender.md @@ -1,12 +1,11 @@ -# SendSmtpEmailSender +# # SendSmtpEmailSender ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | Name of the sender from which the emails will be sent. Maximum allowed characters are 70. Applicable only when email is passed. | [optional] -**email** | **string** | Email of the sender from which the emails will be sent. Mandatory if sender id is not passed. | [optional] -**id** | **int** | Id of the sender from which the emails will be sent. In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email). Mandatory if email is not passed. | [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) - +**name** | **string** | description: Name of the sender from which the emails will be sent. **Maximum allowed characters are 70**. Applicable only when email is passed. | [optional] +**email** | **string** | Email of the sender from which the emails will be sent. Mandatory if sender id is not passed. | [optional] +**id** | **int** | Id of the sender from which the emails will be sent. In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email). Mandatory if email is not passed. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendSmtpEmailTo.md b/docs/Model/SendSmtpEmailTo.md deleted file mode 100644 index bbba303..0000000 --- a/docs/Model/SendSmtpEmailTo.md +++ /dev/null @@ -1,11 +0,0 @@ -# SendSmtpEmailTo - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**email** | **string** | Email address of the recipient | -**name** | **string** | Name of the recipient. Maximum allowed characters are 70. | [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/SendSmtpEmailTo1.md b/docs/Model/SendSmtpEmailTo1.md deleted file mode 100644 index 0a90e7d..0000000 --- a/docs/Model/SendSmtpEmailTo1.md +++ /dev/null @@ -1,11 +0,0 @@ -# SendSmtpEmailTo1 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**email** | **string** | Email address of the recipient | -**name** | **string** | Name of the recipient. **Maximum allowed characters are 70**. | [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/SendSmtpEmailToInner.md b/docs/Model/SendSmtpEmailToInner.md new file mode 100644 index 0000000..86a56af --- /dev/null +++ b/docs/Model/SendSmtpEmailToInner.md @@ -0,0 +1,10 @@ +# # SendSmtpEmailToInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email** | **string** | Email address of the recipient | +**name** | **string** | Name of the recipient. **Maximum allowed characters are 70**. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendTestEmail.md b/docs/Model/SendTestEmail.md index ed3e02b..3ed64b7 100644 --- a/docs/Model/SendTestEmail.md +++ b/docs/Model/SendTestEmail.md @@ -1,10 +1,9 @@ -# SendTestEmail +# # SendTestEmail ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**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. You can not send more than 50 test emails per day. | [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) - +**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. You can not send more than 50 test emails per day_. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendTestSms.md b/docs/Model/SendTestSms.md index 0cd00d7..31c86ba 100644 --- a/docs/Model/SendTestSms.md +++ b/docs/Model/SendTestSms.md @@ -1,10 +1,9 @@ -# SendTestSms +# # SendTestSms ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**phoneNumber** | **string** | Mobile number of the recipient with the country code. This number must belong to one of your contacts in Brevo account and must not be blacklisted | [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) - +**phoneNumber** | **string** | Mobile number of the recipient with the country code. This number **must belong to one of your contacts in Brevo account and must not be blacklisted** | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendTransacSms.md b/docs/Model/SendTransacSms.md index f1bddc2..2bef017 100644 --- a/docs/Model/SendTransacSms.md +++ b/docs/Model/SendTransacSms.md @@ -1,17 +1,16 @@ -# SendTransacSms +# # SendTransacSms ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**sender** | **string** | Name of the sender. **The number of characters is limited to 11 for alphanumeric characters and 15 for numeric characters** | -**recipient** | **string** | Mobile number to send SMS with the country code | -**content** | **string** | Content of the message. If more than 160 characters long, will be sent as multiple text messages | +**sender** | **string** | Name of the sender. **The number of characters is limited to 11 for alphanumeric characters and 15 for numeric characters** | +**recipient** | **string** | Mobile number to send SMS with the country code | +**content** | **string** | Content of the message. If more than **160 characters** long, will be sent as multiple text messages | **type** | **string** | Type of the SMS. Marketing SMS messages are those sent typically with marketing content. Transactional SMS messages are sent to individuals and are triggered in response to some action, such as a sign-up, purchase, etc. | [optional] [default to 'transactional'] -**tag** | **string** | Tag of the message | [optional] -**webUrl** | **string** | Webhook to call for each event triggered by the message (delivered etc.) | [optional] +**tag** | **string** | Tag of the message | [optional] +**webUrl** | **string** | Webhook to call for each event triggered by the message (delivered etc.) | [optional] **unicodeEnabled** | **bool** | Format of the message. It indicates whether the content should be treated as unicode or not. | [optional] [default to false] -**organisationPrefix** | **string** | A recognizable prefix will ensure your audience knows who you are. Recommended by U.S. carriers. This will be added as your Brand Name before the message content. **Prefer verifying maximum length of 160 characters including this prefix in message content to avoid multiple sending of same sms.** | [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) - +**organisationPrefix** | **string** | A recognizable prefix will ensure your audience knows who you are. Recommended by U.S. carriers. This will be added as your Brand Name before the message content. **Prefer verifying maximum length of 160 characters including this prefix in message content to avoid multiple sending of same sms.** | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendWhatsappMessage201Response.md b/docs/Model/SendWhatsappMessage201Response.md new file mode 100644 index 0000000..b8d9301 --- /dev/null +++ b/docs/Model/SendWhatsappMessage201Response.md @@ -0,0 +1,9 @@ +# # SendWhatsappMessage201Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**messageId** | **string** | messageId of sent message | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendWhatsappMessage.md b/docs/Model/SendWhatsappMessageRequest.md similarity index 50% rename from docs/Model/SendWhatsappMessage.md rename to docs/Model/SendWhatsappMessageRequest.md index 3d27a53..3c56564 100644 --- a/docs/Model/SendWhatsappMessage.md +++ b/docs/Model/SendWhatsappMessageRequest.md @@ -1,14 +1,13 @@ -# SendWhatsappMessage +# # SendWhatsappMessageRequest ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**templateId** | **int** | ID of the template to send | [optional] -**text** | **string** | Text to be sent as message body (will be overridden if templateId is passed in the same request) | [optional] -**senderNumber** | **string** | WhatsApp Number with country code. Example, 85264318721 | -**params** | **object** | Pass the set of attributes to customize the template. For example, {\"FNAME\":\"Joe\", \"LNAME\":\"Doe\"}. | [optional] -**contactNumbers** | **string[]** | List of phone numbers of the contacts | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**templateId** | **int** | ID of the template to send | +**senderNumber** | **string** | WhatsApp Number with country code. Example, 85264318721 | +**contactNumbers** | **string[]** | List of phone numbers of the contacts | +**text** | **string** | Text to be sent as message body (will be overridden if templateId is passed in the same request) | +**params** | **object** | Pass the set of attributes to customize the template. For example, {\"FNAME\":\"Joe\", \"LNAME\":\"Doe\"}. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendWhatsappMessageTemplate.md b/docs/Model/SendWhatsappMessageTemplate.md new file mode 100644 index 0000000..191156b --- /dev/null +++ b/docs/Model/SendWhatsappMessageTemplate.md @@ -0,0 +1,12 @@ +# # SendWhatsappMessageTemplate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**templateId** | **int** | ID of the template to send | +**senderNumber** | **string** | WhatsApp Number with country code. Example, 85264318721 | +**contactNumbers** | **string[]** | List of phone numbers of the contacts | +**params** | **object** | Pass the set of attributes to customize the template. For example, {\"FNAME\":\"Joe\", \"LNAME\":\"Doe\"}. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendWhatsappMessageText.md b/docs/Model/SendWhatsappMessageText.md new file mode 100644 index 0000000..29f429f --- /dev/null +++ b/docs/Model/SendWhatsappMessageText.md @@ -0,0 +1,11 @@ +# # SendWhatsappMessageText + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**senderNumber** | **string** | WhatsApp Number with country code. Example, 85264318721 | +**text** | **string** | Text to be sent as message body (will be overridden if templateId is passed in the same request) | +**contactNumbers** | **string[]** | List of phone numbers of the contacts | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SsoTokenRequest.md b/docs/Model/SsoTokenRequest.md deleted file mode 100644 index b13114b..0000000 --- a/docs/Model/SsoTokenRequest.md +++ /dev/null @@ -1,13 +0,0 @@ -# SsoTokenRequest - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | Id of the sub-account organization | -**email** | **string** | User email of sub-account organization | [optional] -**target** | **string** | Set target after login success * automation - Redirect to Automation after login * email_campaign - Redirect to Email Campaign after login * contacts - Redirect to Contacts after login * landing_pages - Redirect to Landing Pages after login * email_transactional - Redirect to Email Transactional after login * senders - Redirect to Contacts after login * sms_campaign - Redirect to Sms Campaign after login * sms_transactional - Redirect to Sms Transactional after login | [optional] -**url** | **string** | Set the full target URL after login success. The user will land directly on this target URL after login | [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/SubAccountAppsToggleRequest.md b/docs/Model/SubAccountAppsToggleRequest.md index edff60b..4f44cc7 100644 --- a/docs/Model/SubAccountAppsToggleRequest.md +++ b/docs/Model/SubAccountAppsToggleRequest.md @@ -1,22 +1,21 @@ -# SubAccountAppsToggleRequest +# # SubAccountAppsToggleRequest ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**inbox** | **bool** | Set this field to enable or disable Inbox on the sub-account / Not applicable on ENTv2 | [optional] -**whatsapp** | **bool** | Set this field to enable or disable Whatsapp campaigns on the sub-account | [optional] -**automation** | **bool** | Set this field to enable or disable Automation on the sub-account | [optional] -**emailCampaigns** | **bool** | Set this field to enable or disable Email Campaigns on the sub-account | [optional] -**smsCampaigns** | **bool** | Set this field to enable or disable SMS Marketing on the sub-account | [optional] -**landingPages** | **bool** | Set this field to enable or disable Landing pages on the sub-account | [optional] -**transactionalEmails** | **bool** | Set this field to enable or disable Transactional Email on the sub-account | [optional] -**transactionalSms** | **bool** | Set this field to enable or disable Transactional SMS on the sub-account | [optional] -**facebookAds** | **bool** | Set this field to enable or disable Facebook ads on the sub-account | [optional] -**webPush** | **bool** | Set this field to enable or disable Web Push on the sub-account | [optional] -**meetings** | **bool** | Set this field to enable or disable Meetings on the sub-account | [optional] -**conversations** | **bool** | Set this field to enable or disable Conversations on the sub-account | [optional] -**crm** | **bool** | Set this field to enable or disable Sales CRM on the sub-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) - +**inbox** | **bool** | Set this field to enable or disable Inbox on the sub-account / Not applicable on ENTv2 | [optional] +**whatsapp** | **bool** | Set this field to enable or disable Whatsapp campaigns on the sub-account | [optional] +**automation** | **bool** | Set this field to enable or disable Automation on the sub-account | [optional] +**emailCampaigns** | **bool** | Set this field to enable or disable Email Campaigns on the sub-account | [optional] +**smsCampaigns** | **bool** | Set this field to enable or disable SMS Marketing on the sub-account | [optional] +**landingPages** | **bool** | Set this field to enable or disable Landing pages on the sub-account | [optional] +**transactionalEmails** | **bool** | Set this field to enable or disable Transactional Email on the sub-account | [optional] +**transactionalSms** | **bool** | Set this field to enable or disable Transactional SMS on the sub-account | [optional] +**facebookAds** | **bool** | Set this field to enable or disable Facebook ads on the sub-account | [optional] +**webPush** | **bool** | Set this field to enable or disable Web Push on the sub-account | [optional] +**meetings** | **bool** | Set this field to enable or disable Meetings on the sub-account | [optional] +**conversations** | **bool** | Set this field to enable or disable Conversations on the sub-account | [optional] +**crm** | **bool** | Set this field to enable or disable Sales CRM on the sub-account | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountDetailsResponse.md b/docs/Model/SubAccountDetailsResponse.md index 8f4a48b..5badc06 100644 --- a/docs/Model/SubAccountDetailsResponse.md +++ b/docs/Model/SubAccountDetailsResponse.md @@ -1,13 +1,13 @@ -# SubAccountDetailsResponse +# # SubAccountDetailsResponse ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | Name of the sub-account user | [optional] -**email** | **string** | Email id of the sub-account organization | [optional] -**companyName** | **string** | Sub-account company name | [optional] -**planInfo** | [**\Brevo\Client\Model\SubAccountDetailsResponsePlanInfo**](SubAccountDetailsResponsePlanInfo.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) - +**name** | **string** | Name of the sub-account user | [optional] +**email** | **string** | Email id of the sub-account organization | [optional] +**companyName** | **string** | Sub-account company name | [optional] +**groups** | [**\Brevo\Client\Models\SubAccountDetailsResponseGroupsInner[]**](SubAccountDetailsResponseGroupsInner.md) | | [optional] +**planInfo** | [**\Brevo\Client\Models\SubAccountDetailsResponsePlanInfo**](SubAccountDetailsResponsePlanInfo.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountDetailsResponseGroupsInner.md b/docs/Model/SubAccountDetailsResponseGroupsInner.md new file mode 100644 index 0000000..f7a9257 --- /dev/null +++ b/docs/Model/SubAccountDetailsResponseGroupsInner.md @@ -0,0 +1,10 @@ +# # SubAccountDetailsResponseGroupsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Group id | [optional] +**name** | **string** | Name of the group | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountDetailsResponsePlanInfo.md b/docs/Model/SubAccountDetailsResponsePlanInfo.md index b869352..35e94f1 100644 --- a/docs/Model/SubAccountDetailsResponsePlanInfo.md +++ b/docs/Model/SubAccountDetailsResponsePlanInfo.md @@ -1,12 +1,11 @@ -# SubAccountDetailsResponsePlanInfo +# # SubAccountDetailsResponsePlanInfo ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**credits** | [**\Brevo\Client\Model\SubAccountDetailsResponsePlanInfoCredits**](SubAccountDetailsResponsePlanInfoCredits.md) | | [optional] -**features** | [**\Brevo\Client\Model\SubAccountDetailsResponsePlanInfoFeatures**](SubAccountDetailsResponsePlanInfoFeatures.md) | | [optional] -**planType** | **string** | type of the plan | [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) - +**credits** | [**\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCredits**](SubAccountDetailsResponsePlanInfoCredits.md) | | [optional] +**features** | [**\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeatures**](SubAccountDetailsResponsePlanInfoFeatures.md) | | [optional] +**planType** | **string** | type of the plan | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountDetailsResponsePlanInfoCredits.md b/docs/Model/SubAccountDetailsResponsePlanInfoCredits.md index 6104939..587a19e 100644 --- a/docs/Model/SubAccountDetailsResponsePlanInfoCredits.md +++ b/docs/Model/SubAccountDetailsResponsePlanInfoCredits.md @@ -1,11 +1,13 @@ -# SubAccountDetailsResponsePlanInfoCredits +# # SubAccountDetailsResponsePlanInfoCredits ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**sms** | **int** | SMS credits remaining on the sub-account | [optional] -**emails** | [**\Brevo\Client\Model\SubAccountDetailsResponsePlanInfoCreditsEmails**](SubAccountDetailsResponsePlanInfoCreditsEmails.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) - +**emails** | [**\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsEmails**](SubAccountDetailsResponsePlanInfoCreditsEmails.md) | | [optional] +**sms** | [**\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsSms**](SubAccountDetailsResponsePlanInfoCreditsSms.md) | | [optional] +**wpSubscribers** | [**\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsWpSubscribers**](SubAccountDetailsResponsePlanInfoCreditsWpSubscribers.md) | | [optional] +**whatsapp** | [**\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsWhatsapp**](SubAccountDetailsResponsePlanInfoCreditsWhatsapp.md) | | [optional] +**externalFeeds** | [**\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsExternalFeeds**](SubAccountDetailsResponsePlanInfoCreditsExternalFeeds.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountDetailsResponsePlanInfoCreditsEmails.md b/docs/Model/SubAccountDetailsResponsePlanInfoCreditsEmails.md index 2ce9e82..a6f1224 100644 --- a/docs/Model/SubAccountDetailsResponsePlanInfoCreditsEmails.md +++ b/docs/Model/SubAccountDetailsResponsePlanInfoCreditsEmails.md @@ -1,11 +1,10 @@ -# SubAccountDetailsResponsePlanInfoCreditsEmails +# # SubAccountDetailsResponsePlanInfoCreditsEmails ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**quantity** | **int** | Quantity of email messaging limits provided | [optional] -**remaining** | **int** | Available email messaging limits for use | [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) - +**quantity** | **int** | Quantity of email messaging limits provided | [optional] +**remaining** | **int** | Available email messaging limits for use | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountDetailsResponsePlanInfoCreditsExternalFeeds.md b/docs/Model/SubAccountDetailsResponsePlanInfoCreditsExternalFeeds.md new file mode 100644 index 0000000..7086a45 --- /dev/null +++ b/docs/Model/SubAccountDetailsResponsePlanInfoCreditsExternalFeeds.md @@ -0,0 +1,10 @@ +# # SubAccountDetailsResponsePlanInfoCreditsExternalFeeds + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | Quantity of externalFeeds messaging limits provided | [optional] +**remaining** | **int** | Available externalFeeds messaging limits for use | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountDetailsResponsePlanInfoCreditsSms.md b/docs/Model/SubAccountDetailsResponsePlanInfoCreditsSms.md new file mode 100644 index 0000000..ea1d2c6 --- /dev/null +++ b/docs/Model/SubAccountDetailsResponsePlanInfoCreditsSms.md @@ -0,0 +1,10 @@ +# # SubAccountDetailsResponsePlanInfoCreditsSms + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | Quantity of SMS messaging limits provided | [optional] +**remaining** | **int** | Available SMS messaging limits for use | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountDetailsResponsePlanInfoCreditsWhatsapp.md b/docs/Model/SubAccountDetailsResponsePlanInfoCreditsWhatsapp.md new file mode 100644 index 0000000..75fe2ec --- /dev/null +++ b/docs/Model/SubAccountDetailsResponsePlanInfoCreditsWhatsapp.md @@ -0,0 +1,10 @@ +# # SubAccountDetailsResponsePlanInfoCreditsWhatsapp + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | Quantity of whatsapp messaging limits provided | [optional] +**remaining** | **int** | Available whatsapp messaging limits for use | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountDetailsResponsePlanInfoCreditsWpSubscribers.md b/docs/Model/SubAccountDetailsResponsePlanInfoCreditsWpSubscribers.md new file mode 100644 index 0000000..52b773c --- /dev/null +++ b/docs/Model/SubAccountDetailsResponsePlanInfoCreditsWpSubscribers.md @@ -0,0 +1,10 @@ +# # SubAccountDetailsResponsePlanInfoCreditsWpSubscribers + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | Quantity of Push sending limits provided | [optional] +**remaining** | **int** | Available Push sending limits for use | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountDetailsResponsePlanInfoFeatures.md b/docs/Model/SubAccountDetailsResponsePlanInfoFeatures.md index 1fa47e8..54ea8f1 100644 --- a/docs/Model/SubAccountDetailsResponsePlanInfoFeatures.md +++ b/docs/Model/SubAccountDetailsResponsePlanInfoFeatures.md @@ -1,12 +1,11 @@ -# SubAccountDetailsResponsePlanInfoFeatures +# # SubAccountDetailsResponsePlanInfoFeatures ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**inbox** | [**\Brevo\Client\Model\SubAccountDetailsResponsePlanInfoFeaturesInbox**](SubAccountDetailsResponsePlanInfoFeaturesInbox.md) | | [optional] -**landingPage** | [**\Brevo\Client\Model\SubAccountDetailsResponsePlanInfoFeaturesLandingPage**](SubAccountDetailsResponsePlanInfoFeaturesLandingPage.md) | | [optional] -**users** | [**\Brevo\Client\Model\SubAccountDetailsResponsePlanInfoFeaturesUsers**](SubAccountDetailsResponsePlanInfoFeaturesUsers.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) - +**inbox** | [**\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesInbox**](SubAccountDetailsResponsePlanInfoFeaturesInbox.md) | | [optional] +**landingPage** | [**\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesLandingPage**](SubAccountDetailsResponsePlanInfoFeaturesLandingPage.md) | | [optional] +**users** | [**\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesUsers**](SubAccountDetailsResponsePlanInfoFeaturesUsers.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountDetailsResponsePlanInfoFeaturesInbox.md b/docs/Model/SubAccountDetailsResponsePlanInfoFeaturesInbox.md index be780d5..8c86db2 100644 --- a/docs/Model/SubAccountDetailsResponsePlanInfoFeaturesInbox.md +++ b/docs/Model/SubAccountDetailsResponsePlanInfoFeaturesInbox.md @@ -1,11 +1,10 @@ -# SubAccountDetailsResponsePlanInfoFeaturesInbox +# # SubAccountDetailsResponsePlanInfoFeaturesInbox ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**quantity** | **int** | Quantity of inbox provided | [optional] -**remaining** | **int** | Available inboxes for use | [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) - +**quantity** | **int** | Quantity of inbox provided | [optional] +**remaining** | **int** | Available inboxes for use | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountDetailsResponsePlanInfoFeaturesLandingPage.md b/docs/Model/SubAccountDetailsResponsePlanInfoFeaturesLandingPage.md index 1a3cf32..85f14b7 100644 --- a/docs/Model/SubAccountDetailsResponsePlanInfoFeaturesLandingPage.md +++ b/docs/Model/SubAccountDetailsResponsePlanInfoFeaturesLandingPage.md @@ -1,11 +1,10 @@ -# SubAccountDetailsResponsePlanInfoFeaturesLandingPage +# # SubAccountDetailsResponsePlanInfoFeaturesLandingPage ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**quantity** | **int** | Quantity of landing pages provided | [optional] -**remaining** | **int** | Available landing pages for use | [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) - +**quantity** | **int** | Quantity of landing pages provided | [optional] +**remaining** | **int** | Available landing pages for use | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountDetailsResponsePlanInfoFeaturesUsers.md b/docs/Model/SubAccountDetailsResponsePlanInfoFeaturesUsers.md index d10857f..a45aa34 100644 --- a/docs/Model/SubAccountDetailsResponsePlanInfoFeaturesUsers.md +++ b/docs/Model/SubAccountDetailsResponsePlanInfoFeaturesUsers.md @@ -1,11 +1,10 @@ -# SubAccountDetailsResponsePlanInfoFeaturesUsers +# # SubAccountDetailsResponsePlanInfoFeaturesUsers ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**quantity** | **int** | Quantity of multi-account's provided | [optional] -**remaining** | **int** | Available multi-accounts for use | [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) - +**quantity** | **int** | Quantity of multi-account's provided | [optional] +**remaining** | **int** | Available multi-accounts for use | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountUpdatePlanRequest.md b/docs/Model/SubAccountUpdatePlanRequest.md index 4c31118..cda10a0 100644 --- a/docs/Model/SubAccountUpdatePlanRequest.md +++ b/docs/Model/SubAccountUpdatePlanRequest.md @@ -1,11 +1,10 @@ -# SubAccountUpdatePlanRequest +# # SubAccountUpdatePlanRequest ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**credits** | [**\Brevo\Client\Model\SubAccountUpdatePlanRequestCredits**](SubAccountUpdatePlanRequestCredits.md) | | [optional] -**features** | [**\Brevo\Client\Model\SubAccountUpdatePlanRequestFeatures**](SubAccountUpdatePlanRequestFeatures.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) - +**credits** | [**\Brevo\Client\Models\SubAccountUpdatePlanRequestCredits**](SubAccountUpdatePlanRequestCredits.md) | | [optional] +**features** | [**\Brevo\Client\Models\SubAccountUpdatePlanRequestFeatures**](SubAccountUpdatePlanRequestFeatures.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountUpdatePlanRequestCredits.md b/docs/Model/SubAccountUpdatePlanRequestCredits.md index 24423c2..169ed1c 100644 --- a/docs/Model/SubAccountUpdatePlanRequestCredits.md +++ b/docs/Model/SubAccountUpdatePlanRequestCredits.md @@ -1,10 +1,13 @@ -# SubAccountUpdatePlanRequestCredits +# # SubAccountUpdatePlanRequestCredits ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**email** | **int** | Number of email credits | [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) - +**email** | **int** | Number of email credits | Pass the value -1 for unlimited emails in ENTv2 only | [optional] +**sms** | **float** | Number of SMS credits | Pass the value -1 for unlimited SMS in ENTv2 only | [optional] +**wpSubscribers** | **int** | Number of Push credits, possible value is 0 and -1 | available in ENT-v2 only | [optional] +**externalFeeds** | **float** | Number of externalFeeds credits, possible values are 0 or 1 |available in ENTv2 only | [optional] +**whatsapp** | **float** | Number of whatsapp credits | Pass the value -1 for unlimited whatsapp in ENTv2 only | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountUpdatePlanRequestFeatures.md b/docs/Model/SubAccountUpdatePlanRequestFeatures.md index 41eb9f3..45160b0 100644 --- a/docs/Model/SubAccountUpdatePlanRequestFeatures.md +++ b/docs/Model/SubAccountUpdatePlanRequestFeatures.md @@ -1,12 +1,11 @@ -# SubAccountUpdatePlanRequestFeatures +# # SubAccountUpdatePlanRequestFeatures ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**users** | **int** | Number of multi-users | [optional] -**landingPage** | **int** | Number of landing pages / Not required on ENTv2 | [optional] -**inbox** | **int** | Number of inboxes / Not required on ENTv2 | [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) - +**users** | **int** | Number of multi-users | [optional] +**landingPage** | **int** | Number of landing pages | [optional] +**inbox** | **int** | Number of inboxes / Not required on ENTv2 | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountsResponse.md b/docs/Model/SubAccountsResponse.md index 81487f8..c26e511 100644 --- a/docs/Model/SubAccountsResponse.md +++ b/docs/Model/SubAccountsResponse.md @@ -1,11 +1,10 @@ -# SubAccountsResponse +# # SubAccountsResponse ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**count** | **int** | Total number of subaccounts | [optional] -**subAccounts** | [**\Brevo\Client\Model\SubAccountsResponseSubAccounts[]**](SubAccountsResponseSubAccounts.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) - +**count** | **int** | Total number of subaccounts | [optional] +**subAccounts** | [**\Brevo\Client\Models\SubAccountsResponseSubAccountsInner[]**](SubAccountsResponseSubAccountsInner.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountsResponseSubAccounts.md b/docs/Model/SubAccountsResponseSubAccounts.md deleted file mode 100644 index a801490..0000000 --- a/docs/Model/SubAccountsResponseSubAccounts.md +++ /dev/null @@ -1,13 +0,0 @@ -# SubAccountsResponseSubAccounts - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | id of the sub-account | -**companyName** | **string** | Name of the sub-account company | -**active** | **bool** | Whether the sub-account is active or not | -**createdAt** | **int** | Timestamp when the sub-account was 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/SubAccountsResponseSubAccountsInner.md b/docs/Model/SubAccountsResponseSubAccountsInner.md new file mode 100644 index 0000000..505dc67 --- /dev/null +++ b/docs/Model/SubAccountsResponseSubAccountsInner.md @@ -0,0 +1,13 @@ +# # SubAccountsResponseSubAccountsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | id of the sub-account | +**companyName** | **string** | Name of the sub-account company | +**active** | **bool** | Whether the sub-account is active or not | +**createdAt** | **int** | Timestamp when the sub-account was created | +**groups** | [**\Brevo\Client\Models\SubAccountsResponseSubAccountsInnerGroupsInner[]**](SubAccountsResponseSubAccountsInnerGroupsInner.md) | Group details | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountsResponseSubAccountsInnerGroupsInner.md b/docs/Model/SubAccountsResponseSubAccountsInnerGroupsInner.md new file mode 100644 index 0000000..5a3288a --- /dev/null +++ b/docs/Model/SubAccountsResponseSubAccountsInnerGroupsInner.md @@ -0,0 +1,10 @@ +# # SubAccountsResponseSubAccountsInnerGroupsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Group identifier | [optional] +**name** | **string** | Name of the group | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubscriptionNotFoundErrorResponse.md b/docs/Model/SubscriptionNotFoundErrorResponse.md new file mode 100644 index 0000000..bae15c4 --- /dev/null +++ b/docs/Model/SubscriptionNotFoundErrorResponse.md @@ -0,0 +1,9 @@ +# # SubscriptionNotFoundErrorResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | **string** | | [optional] [default to 'subscription not found'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Task.md b/docs/Model/Task.md index 5ad779e..35678c2 100644 --- a/docs/Model/Task.md +++ b/docs/Model/Task.md @@ -1,15 +1,14 @@ -# Task +# # Task ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Unique task id | [optional] -**taskTypeId** | **string** | Id for type of task e.g Call / Email / Meeting etc. | -**name** | **string** | Name of task | -**contactsIds** | **int[]** | Contact ids for contacts linked to this task | [optional] -**dealsIds** | **string[]** | Deal ids for deals a task is linked to | [optional] -**companiesIds** | **string[]** | Companies ids for companies a task is linked to | [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) - - +**taskTypeId** | **string** | Id for type of task e.g Call / Email / Meeting etc. | +**name** | **string** | Name of task | +**id** | **string** | Unique task id | [optional] +**contactsIds** | **int[]** | Contact ids for contacts linked to this task | [optional] +**dealsIds** | **string[]** | Deal ids for deals a task is linked to | [optional] +**companiesIds** | **string[]** | Companies ids for companies a task is linked to | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TaskList.md b/docs/Model/TaskList.md index 1f94acc..74aef66 100644 --- a/docs/Model/TaskList.md +++ b/docs/Model/TaskList.md @@ -1,10 +1,9 @@ -# TaskList +# # TaskList ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**items** | [**\Brevo\Client\Model\Task[]**](Task.md) | List of tasks | [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) - +**items** | [**\Brevo\Client\Models\Task[]**](Task.md) | List of tasks | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TaskReminder.md b/docs/Model/TaskReminder.md index f451c08..cebec5f 100644 --- a/docs/Model/TaskReminder.md +++ b/docs/Model/TaskReminder.md @@ -1,12 +1,11 @@ -# TaskReminder +# # TaskReminder ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**value** | **int** | Value of time unit before reminder is to be sent | -**unit** | **string** | Unit of time before reminder is to be sent | -**types** | **string[]** | Type of task reminder e.g email, push | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**value** | **int** | Value of time unit before reminder is to be sent | +**unit** | **string** | Unit of time before reminder is to be sent | +**types** | **string[]** | Type of task reminder e.g email, push | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TaskTypes.md b/docs/Model/TaskTypes.md index 2ef046d..ca7e4cb 100644 --- a/docs/Model/TaskTypes.md +++ b/docs/Model/TaskTypes.md @@ -1,11 +1,10 @@ -# TaskTypes +# # TaskTypes ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Id of task type | [optional] -**title** | **string** | Title of task type | [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) - +**id** | **string** | Id of task type | [optional] +**title** | **string** | Title of task type | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Tier.md b/docs/Model/Tier.md new file mode 100644 index 0000000..8b71165 --- /dev/null +++ b/docs/Model/Tier.md @@ -0,0 +1,17 @@ +# # Tier + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tierId** | **string** | Tier id | [optional] +**name** | **string** | Tier name | [optional] +**imageRef** | **string** | Tier image reference | [optional] +**loyaltyProgramId** | **string** | Associated loyalty program Id | [optional] +**groupId** | **string** | Associated group Id | [optional] +**createdAt** | **\DateTime** | | [optional] +**updatedAt** | **\DateTime** | | [optional] +**accessConditions** | [**\Brevo\Client\Models\TierAccessConditionsInner[]**](TierAccessConditionsInner.md) | Conditions required to access this tier | [optional] +**tierRewards** | [**\Brevo\Client\Models\TierTierRewardsInner[]**](TierTierRewardsInner.md) | Rewards associated with this tier | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TierAccessConditionsInner.md b/docs/Model/TierAccessConditionsInner.md new file mode 100644 index 0000000..b8d5ea4 --- /dev/null +++ b/docs/Model/TierAccessConditionsInner.md @@ -0,0 +1,12 @@ +# # TierAccessConditionsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**balanceDefinitionId** | **string** | Balance definition identifier | [optional] +**minimumValue** | **int** | Minimum value required to access this tier | [optional] +**createdAt** | **\DateTime** | | [optional] +**updatedAt** | **\DateTime** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TierForContact.md b/docs/Model/TierForContact.md new file mode 100644 index 0000000..a144c8f --- /dev/null +++ b/docs/Model/TierForContact.md @@ -0,0 +1,14 @@ +# # TierForContact + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tierId** | **string** | Unique identifier for the assigned tier | [optional] +**loyaltyProgramId** | **string** | Associated loyalty program Id | [optional] +**groupId** | **string** | Group Id to which the tier is associated | [optional] +**contactId** | **int** | Contact to which the tier is assigned | [optional] +**createdAt** | **\DateTime** | | [optional] +**updatedAt** | **\DateTime** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TierGroup.md b/docs/Model/TierGroup.md new file mode 100644 index 0000000..8fc119f --- /dev/null +++ b/docs/Model/TierGroup.md @@ -0,0 +1,16 @@ +# # TierGroup + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Tier group unique identifier | [optional] +**name** | **string** | Tier group name | [optional] +**tierOrder** | **string[]** | Order of the tiers in the group in ascending order | [optional] +**loyaltyProgramId** | **string** | Associated loyalty program Id | [optional] +**upgradeStrategy** | **string** | Select real_time to upgrade tier on real time balance updates. Select anniversary to upgrade tier on subscription anniversary. | [optional] [default to 'real_time'] +**downgradeStrategy** | **string** | Select real_time to downgrade tier on real time balance updates. Select anniversary to downgrade tier on subscription anniversary. | [optional] [default to 'real_time'] +**createdAt** | **\DateTime** | Timestamp when the tier group was created | [optional] +**updatedAt** | **\DateTime** | Timestamp when the tier group was last updated | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TierGroupPage.md b/docs/Model/TierGroupPage.md new file mode 100644 index 0000000..24031e9 --- /dev/null +++ b/docs/Model/TierGroupPage.md @@ -0,0 +1,9 @@ +# # TierGroupPage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**items** | [**\Brevo\Client\Models\TierGroup[]**](TierGroup.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TierRequest.md b/docs/Model/TierRequest.md new file mode 100644 index 0000000..e3ed1f5 --- /dev/null +++ b/docs/Model/TierRequest.md @@ -0,0 +1,11 @@ +# # TierRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of the tier to be created | +**accessConditions** | [**\Brevo\Client\Models\TierRequestAccessConditionsInner[]**](TierRequestAccessConditionsInner.md) | | +**tierRewards** | [**\Brevo\Client\Models\TierRequestTierRewardsInner[]**](TierRequestTierRewardsInner.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TierRequestAccessConditionsInner.md b/docs/Model/TierRequestAccessConditionsInner.md new file mode 100644 index 0000000..5473f08 --- /dev/null +++ b/docs/Model/TierRequestAccessConditionsInner.md @@ -0,0 +1,10 @@ +# # TierRequestAccessConditionsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**balanceDefinitionId** | **string** | Balance definition identifier for accessing the tier | [optional] +**minimumValue** | **int** | Minimum value required to access the tier | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TierRequestTierRewardsInner.md b/docs/Model/TierRequestTierRewardsInner.md new file mode 100644 index 0000000..25dbd66 --- /dev/null +++ b/docs/Model/TierRequestTierRewardsInner.md @@ -0,0 +1,9 @@ +# # TierRequestTierRewardsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rewardId** | **string** | Reward unique identifier | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TierTierRewardsInner.md b/docs/Model/TierTierRewardsInner.md new file mode 100644 index 0000000..cd436a2 --- /dev/null +++ b/docs/Model/TierTierRewardsInner.md @@ -0,0 +1,11 @@ +# # TierTierRewardsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rewardId** | **string** | Reward to be attributed on tier assignment | [optional] +**createdAt** | **\DateTime** | | [optional] +**updatedAt** | **\DateTime** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Transaction.md b/docs/Model/Transaction.md new file mode 100644 index 0000000..eed01bb --- /dev/null +++ b/docs/Model/Transaction.md @@ -0,0 +1,19 @@ +# # Transaction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier for the transaction. | [optional] +**status** | **string** | Current status of the transaction, indicating its state (draft/complete/cancelled/rejected/expired) | [optional] +**amount** | **float** | The monetary value of the transaction. | [optional] +**meta** | **object** | Additional metadata related to the transaction. | [optional] +**rejectedAt** | **\DateTime** | Timestamp indicating when the transaction was rejected | [optional] +**rejectReason** | **string** | Reason for rejecting the transaction | [optional] +**expirationDate** | **\DateTime** | Date when the transaction expires if not completed. | [optional] +**completedAt** | **\DateTime** | | [optional] +**cancelledAt** | **\DateTime** | | [optional] +**createdAt** | **\DateTime** | | [optional] +**updatedAt** | **\DateTime** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UnauthorizedResponse.md b/docs/Model/UnauthorizedResponse.md new file mode 100644 index 0000000..fba2a6d --- /dev/null +++ b/docs/Model/UnauthorizedResponse.md @@ -0,0 +1,9 @@ +# # UnauthorizedResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | **string** | Request Authentication Failed | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateAttribute.md b/docs/Model/UpdateAttribute.md index d6b270d..e53a5a5 100644 --- a/docs/Model/UpdateAttribute.md +++ b/docs/Model/UpdateAttribute.md @@ -1,11 +1,11 @@ -# UpdateAttribute +# # UpdateAttribute ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**value** | **string** | Value of the attribute to update. Use only if the attribute's category is 'calculated' or 'global' | [optional] -**enumeration** | [**\Brevo\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) - +**value** | **string** | Value of the attribute to update. **Use only if the attribute's category is 'calculated' or 'global'** | [optional] +**enumeration** | [**\Brevo\Client\Models\UpdateAttributeEnumerationInner[]**](UpdateAttributeEnumerationInner.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] +**multiCategoryOptions** | **string[]** | Use this option to add multiple-choice attributes options only if the attribute's category is \"normal\". **This option is specifically designed for updating multiple-choice attributes**. For example: **[\"USA\",\"INDIA\"]** | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateAttributeEnumeration.md b/docs/Model/UpdateAttributeEnumeration.md deleted file mode 100644 index e5d734d..0000000 --- a/docs/Model/UpdateAttributeEnumeration.md +++ /dev/null @@ -1,11 +0,0 @@ -# UpdateAttributeEnumeration - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**value** | **int** | Id of the value | -**label** | **string** | Label of the value | - -[[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/UpdateAttributeEnumerationInner.md b/docs/Model/UpdateAttributeEnumerationInner.md new file mode 100644 index 0000000..a270d0a --- /dev/null +++ b/docs/Model/UpdateAttributeEnumerationInner.md @@ -0,0 +1,10 @@ +# # UpdateAttributeEnumerationInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | **int** | Id of the value | +**label** | **string** | Label of the value | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateBalanceDefinitionPayload.md b/docs/Model/UpdateBalanceDefinitionPayload.md new file mode 100644 index 0000000..83619f9 --- /dev/null +++ b/docs/Model/UpdateBalanceDefinitionPayload.md @@ -0,0 +1,23 @@ +# # UpdateBalanceDefinitionPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name for the balance definition | +**unit** | **string** | The unit for this balance definition. | +**description** | **string** | Description for the balance definition | [optional] +**meta** | **object** | Additional metadata related to the balance definition. | [optional] +**minAmount** | **float** | Minimum possible amount for balance | [optional] +**maxAmount** | **float** | Maximum possible amount for balance | [optional] +**maxCreditAmountLimit** | **float** | Maximum credit amount limit per operation | [optional] +**maxDebitAmountLimit** | **float** | Maximum debit amount limit per operation | [optional] +**balanceOptionAmountOvertakingStrategy** | **string** | Select partial to enable partial credit of balance if maximum balance limit is reaching. Select strict to reject the transaction if it will breach the max credit amount limit. | [optional] [default to 'strict'] +**balanceOptionCreditRounding** | **string** | Select natural to round to nearest integer. Select upper to round up . Select lower to round down | [optional] [default to 'natural'] +**balanceOptionDebitRounding** | **string** | Select natural to round to nearest integer. Select upper to round up . Select lower to round down | [optional] [default to 'natural'] +**balanceAvailabilityDurationValue** | **float** | Number of days/weeks/month/year for balance expiry | [optional] +**balanceAvailabilityDurationUnit** | **string** | Unit of time for the balance's availability (e.g., day/week/month/year). | [optional] [default to 'day'] +**balanceAvailabilityDurationModifier** | **string** | Select startOfPeriod to configure balance expiry on start of day/week/month/year. Select endOfPeriod to configure balance expiry on end of day/week/month/year, else select noModification | [optional] [default to 'noModification'] +**balanceExpirationDate** | **string** | Date when the balance expires and can no longer be used, in dd/mm format. The balance will be expired when this date appears next in the calendar and only one of balanceExpirationDate or balance availability fields can be used. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateBatchContacts.md b/docs/Model/UpdateBatchContacts.md index 68cac97..b42530f 100644 --- a/docs/Model/UpdateBatchContacts.md +++ b/docs/Model/UpdateBatchContacts.md @@ -1,10 +1,9 @@ -# UpdateBatchContacts +# # UpdateBatchContacts ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**contacts** | [**\Brevo\Client\Model\UpdateBatchContactsContacts[]**](UpdateBatchContactsContacts.md) | List of contacts to be updated | [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) - +**contacts** | [**\Brevo\Client\Models\UpdateBatchContactsContactsInner[]**](UpdateBatchContactsContactsInner.md) | List of contacts to be updated | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateBatchContactsContacts.md b/docs/Model/UpdateBatchContactsContactsInner.md similarity index 50% rename from docs/Model/UpdateBatchContactsContacts.md rename to docs/Model/UpdateBatchContactsContactsInner.md index 303cf09..36d79f0 100644 --- a/docs/Model/UpdateBatchContactsContacts.md +++ b/docs/Model/UpdateBatchContactsContactsInner.md @@ -1,19 +1,18 @@ -# UpdateBatchContactsContacts +# # UpdateBatchContactsContactsInner ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**email** | **string** | Email address of the user to be updated (For each operation only pass one of the supported contact identifiers. Email, id or sms) | [optional] -**id** | **int** | id of the user to be updated (For each operation only pass one of the supported contact identifiers. Email, id or sms) | [optional] -**sms** | **string** | SMS of the user to be updated (For each operation only pass one of the supported contact identifiers. Email, id or sms) | [optional] -**extId** | **string** | Pass your own Id to update ext_id of a contact. | [optional] -**attributes** | **map[string,object]** | Pass the set of attributes to be updated. **These attributes must be present in your account**. To update existing email address of a contact with the new one please pass EMAIL in attribtes. For example, **{ \"EMAIL\":\"newemail@domain.com\", \"FNAME\":\"Ellie\", \"LNAME\":\"Roger\"}**. Keep in mind transactional attributes can be updated the same way as normal attributes. Mobile Number in **SMS** field should be passed with proper country code. For example: **{\"SMS\":\"+91xxxxxxxxxx\"} or {\"SMS\":\"0091xxxxxxxxxx\"}** | [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[]** | transactional email forbidden sender for contact. Use only for email Contact | [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) - +**email** | **string** | Email address of the user to be updated (For each operation only pass one of the supported contact identifiers. Email, id or sms) | [optional] +**id** | **int** | id of the user to be updated (For each operation only pass one of the supported contact identifiers. Email, id or sms) | [optional] +**sms** | **string** | SMS of the user to be updated (For each operation only pass one of the supported contact identifiers. Email, id or sms) | [optional] +**extId** | **string** | Pass your own Id to update ext_id of a contact. | [optional] +**attributes** | **array** | Pass the set of attributes to be updated. **These attributes must be present in your account**. To update existing email address of a contact with the new one please pass EMAIL in attribtes. For example, **{ \"EMAIL\":\"newemail@domain.com\", \"FNAME\":\"Ellie\", \"LNAME\":\"Roger\"}**. Keep in mind transactional attributes can be updated the same way as normal attributes. Mobile Number in **SMS** field should be passed with proper country code. For example: **{\"SMS\":\"+91xxxxxxxxxx\"} or {\"SMS\":\"0091xxxxxxxxxx\"}** | [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[]** | transactional email forbidden sender for contact. Use only for email Contact | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateBatchContactsModel.md b/docs/Model/UpdateBatchContactsModel.md index 08c30c1..0e81b1e 100644 --- a/docs/Model/UpdateBatchContactsModel.md +++ b/docs/Model/UpdateBatchContactsModel.md @@ -1,11 +1,10 @@ -# UpdateBatchContactsModel +# # UpdateBatchContactsModel ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**successIds** | **int[]** | | [optional] -**failureIds** | **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) - +**successIds** | **int[]** | | [optional] +**failureIds** | **int[]** | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateCampaignStatus.md b/docs/Model/UpdateCampaignStatus.md index a571f47..a1235ab 100644 --- a/docs/Model/UpdateCampaignStatus.md +++ b/docs/Model/UpdateCampaignStatus.md @@ -1,10 +1,9 @@ -# UpdateCampaignStatus +# # UpdateCampaignStatus ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**status** | **string** | Note:- replicateTemplate status will be available only for template type campaigns. | [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) - +**status** | **string** | Note:- **replicateTemplate** status will be available **only for template type campaigns.** | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateChild.md b/docs/Model/UpdateChild.md deleted file mode 100644 index ef478b5..0000000 --- a/docs/Model/UpdateChild.md +++ /dev/null @@ -1,14 +0,0 @@ -# UpdateChild - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**email** | **string** | New Email address to update the child account | [optional] -**firstName** | **string** | New First name to use to update the child account | [optional] -**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] - -[[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/UpdateChildAccountStatus.md b/docs/Model/UpdateChildAccountStatus.md deleted file mode 100644 index 76b3156..0000000 --- a/docs/Model/UpdateChildAccountStatus.md +++ /dev/null @@ -1,13 +0,0 @@ -# UpdateChildAccountStatus - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**transactionalEmail** | **bool** | Status of Transactional Email Platform activation for your account (true=enabled, false=disabled) | [optional] -**transactionalSms** | **bool** | Status of Transactional SMS Platform activation for your account (true=enabled, false=disabled) | [optional] -**marketingAutomation** | **bool** | Status of Marketing Automation Platform activation for your account (true=enabled, false=disabled) | [optional] -**smsCampaign** | **bool** | Status of SMS Campaign Platform activation for your account (true=enabled, false=disabled) | [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/UpdateChildDomain.md b/docs/Model/UpdateChildDomain.md deleted file mode 100644 index a22b5d2..0000000 --- a/docs/Model/UpdateChildDomain.md +++ /dev/null @@ -1,10 +0,0 @@ -# UpdateChildDomain - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**domain** | **string** | Value for the sender domain that will replace the existing domain | [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 6bdbe30..fbc135d 100644 --- a/docs/Model/UpdateContact.md +++ b/docs/Model/UpdateContact.md @@ -1,16 +1,15 @@ -# UpdateContact +# # UpdateContact ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**attributes** | **object** | Pass the set of attributes to be updated. These attributes must be present in your account. Values that don't match the attribute type (e.g. text or string in a date attribute) will be ignored.To update existing email address of a contact with the new one please pass EMAIL in attributes. For example, `{ \"EMAIL\":\"newemail@domain.com\", \"FNAME\":\"Ellie\", \"LNAME\":\"Roger\"}`. The attribute's parameter should be passed in capital letter while updating a contact. Keep in mind transactional attributes can be updated the same way as normal attributes. Mobile Number in \"SMS\" field should be passed with proper country code. For example {\"SMS\":\"+91xxxxxxxxxx\"} or {\"SMS\":\"0091xxxxxxxxxx\"} | [optional] -**extId** | **string** | Pass your own Id to update ext_id of a contact. | [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[]** | transactional email forbidden sender for contact. Use only for email Contact | [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) - - +**attributes** | [**array**](CreateDoiContactAttributesValue.md) | Pass the set of attributes to be updated. **These attributes must be present in your account**. To update existing email address of a contact with the new one please pass EMAIL in attributes. For example, **{ \"EMAIL\":\"newemail@domain.com\", \"FNAME\":\"Ellie\", \"LNAME\":\"Roger\", \"COUNTRIES\":[\"India\",\"China\"]}**. The attribute's parameter should be passed in capital letter while updating a contact. Values that don't match the attribute type (e.g. text or string in a date attribute) will be ignored. Keep in mind transactional attributes can be updated the same way as normal attributes. Mobile Number in **SMS** field should be passed with proper country code. For example: **{\"SMS\":\"+91xxxxxxxxxx\"} or {\"SMS\":\"0091xxxxxxxxxx\"}** | [optional] +**extId** | **string** | Pass your own Id to update ext_id of a contact. | [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[]** | transactional email forbidden sender for contact. Use only for email Contact | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateCouponCollection.md b/docs/Model/UpdateCouponCollection.md deleted file mode 100644 index 9d99045..0000000 --- a/docs/Model/UpdateCouponCollection.md +++ /dev/null @@ -1,10 +0,0 @@ -# UpdateCouponCollection - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**defaultCoupon** | **string** | A default coupon to be used in case there are no coupons left | - -[[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/UpdateCouponCollection200Response.md b/docs/Model/UpdateCouponCollection200Response.md new file mode 100644 index 0000000..0f2d127 --- /dev/null +++ b/docs/Model/UpdateCouponCollection200Response.md @@ -0,0 +1,11 @@ +# # UpdateCouponCollection200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The id of the collection | +**name** | **string** | The name of the collection | +**defaultCoupon** | **string** | The default coupon of the collection | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateCouponCollectionRequest.md b/docs/Model/UpdateCouponCollectionRequest.md new file mode 100644 index 0000000..b108674 --- /dev/null +++ b/docs/Model/UpdateCouponCollectionRequest.md @@ -0,0 +1,12 @@ +# # UpdateCouponCollectionRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**defaultCoupon** | **string** | A default coupon to be used in case there are no coupons left | [optional] +**expirationDate** | **\DateTime** | Specify an expiration date for the coupon collection in RFC3339 format. Use null to remove the expiration date. | [optional] +**remainingDaysAlert** | **int** | Send a notification alert (email) when the remaining days until the expiration date are equal or fall bellow this number. Use null to disable alerts. | [optional] +**remainingCouponsAlert** | **int** | Send a notification alert (email) when the remaining coupons count is equal or fall bellow this number. Use null to disable alerts. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateEmailCampaign.md b/docs/Model/UpdateEmailCampaign.md index a7e49ea..e7068e6 100644 --- a/docs/Model/UpdateEmailCampaign.md +++ b/docs/Model/UpdateEmailCampaign.md @@ -1,40 +1,40 @@ -# UpdateEmailCampaign +# # UpdateEmailCampaign ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**tag** | **string** | Tag of the campaign | [optional] -**sender** | [**\Brevo\Client\Model\UpdateEmailCampaignSender**](UpdateEmailCampaignSender.md) | | [optional] -**name** | **string** | Name of the campaign | [optional] -**htmlContent** | **string** | Body of the message (HTML version). If the campaign is designed using Drag & Drop editor via HTML content, then the design page will not have Drag & Drop editor access for that campaign. REQUIRED if htmlUrl is empty | [optional] -**htmlUrl** | **string** | Url which contents the body of the email message. REQUIRED if htmlContent is empty | [optional] -**scheduledAt** | **string** | 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. If sendAtBestTime is set to true, your campaign will be sent according to the date passed (ignoring the time part). | [optional] -**subject** | **string** | Subject of the campaign | [optional] -**previewText** | **string** | Preview text or preheader of the email campaign | [optional] -**replyTo** | **string** | Email on which campaign recipients will be able to reply to | [optional] -**toField** | **string** | To personalize the «To» Field. If you want to include the first name and last name of your recipient, add {FNAME} {LNAME}. These contact attributes must already exist in your Brevo account. If input parameter 'params' used please use {{contact.FNAME}} {{contact.LNAME}} for personalization | [optional] -**recipients** | [**\Brevo\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] -**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] [default to false] -**footer** | **string** | Footer of the email campaign | [optional] -**header** | **string** | Header of the email campaign | [optional] -**utmCampaign** | **string** | Customize the utm_campaign value. If this field is empty, the campaign name will be used. Only alphanumeric characters and spaces are allowed | [optional] -**params** | **object** | Pass the set of attributes to customize the type 'classic' campaign. For example, `{\"FNAME\":\"Joe\", \"LNAME\":\"Doe\"}`. The 'params' field will get updated, only if the campaign is in New Template Language, else ignored. The New Template Language is dependent on the values of 'subject', 'htmlContent/htmlUrl', 'sender.name' & 'toField' | [optional] -**sendAtBestTime** | **bool** | Set this to true if you want to send your campaign at best time. Note:- if true, warmup ip will be disabled. | [optional] -**abTesting** | **bool** | Status of A/B Test. abTesting = false means it is disabled, & abTesting = true means it is enabled. 'subjectA', 'subjectB', 'splitRule', 'winnerCriteria' & 'winnerDelay' will be considered if abTesting is set to true. 'subject' if passed is ignored. Can be set to true only if 'sendAtBestTime' is 'false'. You will be able to set up two subject lines for your campaign and send them to a random sample of your total recipients. Half of the test group will receive version A, and the other half will receive version B | [optional] [default to false] -**subjectA** | **string** | Subject A of the campaign. Considered if abTesting = true. subjectA & subjectB should have unique value | [optional] -**subjectB** | **string** | Subject B of the campaign. Considered if abTesting = true. subjectA & subjectB should have unique value | [optional] -**splitRule** | **int** | Add the size of your test groups. Considered if abTesting = true. We'll send version A and B to a random sample of recipients, and then the winning version to everyone else | [optional] -**winnerCriteria** | **string** | Choose the metrics that will determinate the winning version. Considered if 'splitRule' >= 1 and < 50. If splitRule = 50, 'winnerCriteria' is ignored if passed or alreday exist in record | [optional] -**winnerDelay** | **int** | Choose the duration of the test in hours. Maximum is 7 days, pass 24*7 = 168 hours. The winning version will be sent at the end of the test. Considered if 'splitRule' >= 1 and < 50. If splitRule = 50, 'winnerDelay' is ignored if passed or alreday exist in record | [optional] -**ipWarmupEnable** | **bool** | Available for dedicated ip clients. Set this to true if you wish to warm up your ip. | [optional] [default to false] -**initialQuota** | **int** | Set an initial quota greater than 1 for warming up your ip. We recommend you set a value of 3000. | [optional] -**increaseRate** | **int** | Set a percentage increase rate for warming up your ip. We recommend you set the increase rate to 30% per day. If you want to send the same number of emails every day, set the daily increase value to 0%. | [optional] -**unsubscriptionPageId** | **string** | Enter an unsubscription page id. The page id is a 24 digit alphanumeric id that can be found in the URL when editing the page. | [optional] -**updateFormId** | **string** | Mandatory if templateId is used containing the {{ update_profile }} tag. Enter an update profile form id. The form id is a 24 digit alphanumeric id that can be found in the URL when editing the form. | [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) - +**tag** | **string** | Tag of the campaign | [optional] +**sender** | [**\Brevo\Client\Models\UpdateEmailCampaignSender**](UpdateEmailCampaignSender.md) | | [optional] +**name** | **string** | Name of the campaign | [optional] +**htmlContent** | **string** | Body of the message (HTML version). If the campaign is designed using Drag & Drop editor via HTML content, then the design page will not have Drag & Drop editor access for that campaign. **REQUIRED if htmlUrl is empty** | [optional] +**htmlUrl** | **string** | Url which contents the body of the email message. **REQUIRED if htmlContent is empty** | [optional] +**scheduledAt** | **string** | 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.** If sendAtBestTime is set to true, your campaign will be sent according to the date passed (ignoring the time part). | [optional] +**subject** | **string** | Subject of the campaign | [optional] +**previewText** | **string** | Preview text or preheader of the email campaign | [optional] +**replyTo** | **string** | Email on which campaign recipients will be able to reply to | [optional] +**toField** | **string** | To personalize the **To** Field. If you want to include the first name and last name of your recipient, add **{FNAME} {LNAME}**. These contact attributes must already exist in your Brevo account. If input parameter **params** used please use **{{contact.FNAME}} {{contact.LNAME}}** for personalization | [optional] +**recipients** | [**\Brevo\Client\Models\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] +**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] [default to false] +**footer** | **string** | Footer of the email campaign | [optional] +**header** | **string** | Header of the email campaign | [optional] +**utmCampaign** | **string** | Customize the utm_campaign value. If this field is empty, the campaign name will be used. Only alphanumeric characters and spaces are allowed | [optional] +**params** | **array** | Pass the set of attributes to customize the type classic campaign. For example: **{\"FNAME\":\"Joe\", \"LNAME\":\"Doe\"}**. Only available if **type** is **classic**. It's considered only if campaign is in _New Template Language format_. The New Template Language is dependent on the values of **subject, htmlContent/htmlUrl, sender.name & toField** | [optional] +**sendAtBestTime** | **bool** | Set this to true if you want to send your campaign at best time. Note:- **if true, warmup ip will be disabled.** | [optional] +**abTesting** | **bool** | Status of A/B Test. abTesting = false means it is disabled & abTesting = true means it is enabled. **subjectA, subjectB, splitRule, winnerCriteria & winnerDelay** will be considered when abTesting is set to true. subjectA & subjectB are mandatory together & subject if passed is ignored. **Can be set to true only if sendAtBestTime is false**. You will be able to set up two subject lines for your campaign and send them to a random sample of your total recipients. Half of the test group will receive version A, and the other half will receive version B | [optional] [default to false] +**subjectA** | **string** | Subject A of the campaign. **Mandatory if abTesting = true**. subjectA & subjectB should have unique value | [optional] +**subjectB** | **string** | Subject B of the campaign. **Mandatory if abTesting = true**. subjectA & subjectB should have unique value | [optional] +**splitRule** | **int** | Add the size of your test groups. **Mandatory if abTesting = true & 'recipients' is passed**. We'll send version A and B to a random sample of recipients, and then the winning version to everyone else | [optional] +**winnerCriteria** | **string** | Choose the metrics that will determinate the winning version. **Mandatory if _splitRule_ >= 1 and < 50**. If splitRule = 50, `winnerCriteria` is ignored if passed | [optional] +**winnerDelay** | **int** | Choose the duration of the test in hours. Maximum is 7 days, pass 24*7 = 168 hours. The winning version will be sent at the end of the test. **Mandatory if _splitRule_ >= 1 and < 50**. If splitRule = 50, `winnerDelay` is ignored if passed | [optional] +**ipWarmupEnable** | **bool** | **Available for dedicated ip clients**. Set this to true if you wish to warm up your ip. | [optional] [default to false] +**initialQuota** | **int** | Set an initial quota greater than 1 for warming up your ip. We recommend you set a value of 3000. | [optional] +**increaseRate** | **int** | Set a percentage increase rate for warming up your ip. We recommend you set the increase rate to 30% per day. If you want to send the same number of emails every day, set the daily increase value to 0%. | [optional] +**unsubscriptionPageId** | **string** | Enter an unsubscription page id. The page id is a 24 digit alphanumeric id that can be found in the URL when editing the page. | [optional] +**updateFormId** | **string** | **Mandatory if templateId is used containing the {{ update_profile }} tag**. Enter an update profile form id. The form id is a 24 digit alphanumeric id that can be found in the URL when editing the form. | [optional] +**emailExpirationDate** | [**\Brevo\Client\Models\UpdateEmailCampaignEmailExpirationDate**](UpdateEmailCampaignEmailExpirationDate.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateEmailCampaignEmailExpirationDate.md b/docs/Model/UpdateEmailCampaignEmailExpirationDate.md new file mode 100644 index 0000000..5033768 --- /dev/null +++ b/docs/Model/UpdateEmailCampaignEmailExpirationDate.md @@ -0,0 +1,10 @@ +# # UpdateEmailCampaignEmailExpirationDate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**duration** | **int** | Duration of the email expiry. maximum duration can be 3600 days or 480 weeks or 120 months. | [optional] +**unit** | **string** | unit of the duration | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateEmailCampaignRecipients.md b/docs/Model/UpdateEmailCampaignRecipients.md index 6ed00b1..177321f 100644 --- a/docs/Model/UpdateEmailCampaignRecipients.md +++ b/docs/Model/UpdateEmailCampaignRecipients.md @@ -1,12 +1,11 @@ -# UpdateEmailCampaignRecipients +# # UpdateEmailCampaignRecipients ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**exclusionListIds** | **int[]** | List ids which have to be excluded from a campaign | [optional] -**listIds** | **int[]** | Lists Ids to send the campaign to. Campaign should only be updated with listIds if listIds were used to create it. REQUIRED if already not present in campaign and scheduledAt is not empty | [optional] -**segmentIds** | **int[]** | Mandatory if listIds are not used. Campaign should only be updated with segmentIds if segmentIds were used to create it. Segment ids to send the campaign to. | [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) - +**exclusionListIds** | **int[]** | List ids which have to be excluded from a campaign | [optional] +**listIds** | **int[]** | Lists Ids to send the campaign to. **Campaign should only be updated with listIds if listIds were used to create it. REQUIRED if already not present in campaign and scheduledAt is not empty** | [optional] +**segmentIds** | **int[]** | **Mandatory if listIds are not used. Campaign should only be updated with segmentIds if segmentIds were used to create it.** Segment ids to send the campaign to. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateEmailCampaignSender.md b/docs/Model/UpdateEmailCampaignSender.md index 4ebcd4e..e0ef53d 100644 --- a/docs/Model/UpdateEmailCampaignSender.md +++ b/docs/Model/UpdateEmailCampaignSender.md @@ -1,12 +1,11 @@ -# UpdateEmailCampaignSender +# # UpdateEmailCampaignSender ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | Sender Name from which the campaign emails are sent | [optional] -**email** | **string** | Sender email from which the campaign emails are sent | [optional] -**id** | **int** | Select the sender for the campaign on the basis of sender id. In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email). | [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) - +**name** | **string** | Sender Name from which the campaign emails are sent | [optional] +**email** | **string** | Sender email from which the campaign emails are sent | [optional] +**id** | **int** | Select the sender for the campaign on the basis of sender id. **In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email)**. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateExternalFeed.md b/docs/Model/UpdateExternalFeed.md index c8ff876..d54d094 100644 --- a/docs/Model/UpdateExternalFeed.md +++ b/docs/Model/UpdateExternalFeed.md @@ -1,18 +1,17 @@ -# UpdateExternalFeed +# # UpdateExternalFeed ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | Name of the feed | [optional] -**url** | **string** | URL of the feed | [optional] -**authType** | **string** | Auth type of the feed: * `basic` * `token` * `noAuth` | [optional] -**username** | **string** | Username for authType `basic` | [optional] -**password** | **string** | Password for authType `basic` | [optional] -**token** | **string** | Token for authType `token` | [optional] -**headers** | [**\Brevo\Client\Model\GetExternalFeedByUUIDHeaders[]**](GetExternalFeedByUUIDHeaders.md) | Custom headers for the feed | [optional] -**maxRetries** | **int** | Maximum number of retries on the feed url | [optional] +**name** | **string** | Name of the feed | [optional] +**url** | **string** | URL of the feed | [optional] +**authType** | **string** | Auth type of the feed: * `basic` * `token` * `noAuth` | [optional] +**username** | **string** | Username for authType `basic` | [optional] +**password** | **string** | Password for authType `basic` | [optional] +**token** | **string** | Token for authType `token` | [optional] +**headers** | [**\Brevo\Client\Models\GetExternalFeedByUUIDHeadersInner[]**](GetExternalFeedByUUIDHeadersInner.md) | Custom headers for the feed | [optional] +**maxRetries** | **int** | Maximum number of retries on the feed url | [optional] [default to 5] **cache** | **bool** | Toggle caching of feed url response | [optional] [default to false] -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - - +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateList.md b/docs/Model/UpdateList.md index de3f2c8..04650b6 100644 --- a/docs/Model/UpdateList.md +++ b/docs/Model/UpdateList.md @@ -1,11 +1,10 @@ -# UpdateList +# # UpdateList ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**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) - +**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#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateLoyaltyProgramPayload.md b/docs/Model/UpdateLoyaltyProgramPayload.md new file mode 100644 index 0000000..9a13f6d --- /dev/null +++ b/docs/Model/UpdateLoyaltyProgramPayload.md @@ -0,0 +1,11 @@ +# # UpdateLoyaltyProgramPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Loyalty Program name | +**description** | **string** | Loyalty Program description | [optional] +**meta** | **object** | Loyalty Program meta data | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateSender.md b/docs/Model/UpdateSender.md index 8ce034b..1ba4646 100644 --- a/docs/Model/UpdateSender.md +++ b/docs/Model/UpdateSender.md @@ -1,12 +1,11 @@ -# UpdateSender +# # UpdateSender ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | From Name to update the sender | [optional] -**email** | **string** | From Email to update the sender | [optional] -**ips** | [**\Brevo\Client\Model\CreateSenderIps[]**](CreateSenderIps.md) | Only in case of dedicated IP, IPs to associate to the sender. If passed, will replace all the existing IPs. | [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) - +**name** | **string** | From Name to update the sender | [optional] +**email** | **string** | From Email to update the sender | [optional] +**ips** | [**\Brevo\Client\Models\CreateSenderIpsInner[]**](CreateSenderIpsInner.md) | **Only in case of dedicated IP**. IPs to associate to the sender. If passed, will replace all the existing IPs. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateSmsCampaign.md b/docs/Model/UpdateSmsCampaign.md index 7d97c27..8715b5d 100644 --- a/docs/Model/UpdateSmsCampaign.md +++ b/docs/Model/UpdateSmsCampaign.md @@ -1,17 +1,16 @@ -# UpdateSmsCampaign +# # UpdateSmsCampaign ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | Name of the campaign | [optional] -**sender** | **string** | Name of the sender. **The number of characters is limited to 11 for alphanumeric characters and 15 for numeric characters** | [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** | [**\Brevo\Client\Model\CreateSmsCampaignRecipients**](CreateSmsCampaignRecipients.md) | | [optional] -**scheduledAt** | **string** | 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] +**name** | **string** | Name of the campaign | [optional] +**sender** | **string** | Name of the sender. **The number of characters is limited to 11 for alphanumeric characters and 15 for numeric characters** | [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** | [**\Brevo\Client\Models\CreateSmsCampaignRecipients**](CreateSmsCampaignRecipients.md) | | [optional] +**scheduledAt** | **string** | 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] **unicodeEnabled** | **bool** | Format of the message. It indicates whether the content should be treated as unicode or not. | [optional] [default to false] -**organisationPrefix** | **string** | A recognizable prefix will ensure your audience knows who you are. Recommended by U.S. carriers. This will be added as your Brand Name before the message content. **Prefer verifying maximum length of 160 characters including this prefix in message content to avoid multiple sending of same sms.** | [optional] -**unsubscribeInstruction** | **string** | Instructions to unsubscribe from future communications. Recommended by U.S. carriers. Must include **STOP** keyword. This will be added as instructions after the end of message content. **Prefer verifying maximum length of 160 characters including this instructions in message content to avoid multiple sending of same sms.** | [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) - +**organisationPrefix** | **string** | A recognizable prefix will ensure your audience knows who you are. Recommended by U.S. carriers. This will be added as your Brand Name before the message content. **Prefer verifying maximum length of 160 characters including this prefix in message content to avoid multiple sending of same sms.** | [optional] +**unsubscribeInstruction** | **string** | Instructions to unsubscribe from future communications. Recommended by U.S. carriers. Must include **STOP** keyword. This will be added as instructions after the end of message content. **Prefer verifying maximum length of 160 characters including this instructions in message content to avoid multiple sending of same sms.** | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateSmtpTemplate.md b/docs/Model/UpdateSmtpTemplate.md index a605151..14524ae 100644 --- a/docs/Model/UpdateSmtpTemplate.md +++ b/docs/Model/UpdateSmtpTemplate.md @@ -1,19 +1,18 @@ -# UpdateSmtpTemplate +# # UpdateSmtpTemplate ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**tag** | **string** | Tag of the template | [optional] -**sender** | [**\Brevo\Client\Model\UpdateSmtpTemplateSender**](UpdateSmtpTemplateSender.md) | | [optional] -**templateName** | **string** | Name of the template | [optional] -**htmlContent** | **string** | Required if htmlUrl is empty. If the template is designed using Drag & Drop editor via HTML content, then the design page will not have Drag & Drop editor access for that template. Body of the message (HTML must have more than 10 characters) | [optional] -**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. If you want to include the first name and last name of your recipient, add {FNAME} {LNAME}. These contact attributes must already exist in your Brevo account. If input parameter 'params' used please use {{contact.FNAME}} {{contact.LNAME}} for personalization | [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] - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**tag** | **string** | Tag of the template | [optional] +**sender** | [**\Brevo\Client\Models\UpdateSmtpTemplateSender**](UpdateSmtpTemplateSender.md) | | [optional] +**templateName** | **string** | Name of the template | [optional] +**htmlContent** | **string** | **Required if htmlUrl is empty**. If the template is designed using Drag & Drop editor via HTML content, then the design page will not have Drag & Drop editor access for that template. Body of the message (HTML must have more than 10 characters) | [optional] +**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. If you want to include the first name and last name of your recipient, add **{FNAME} {LNAME}**. These contact attributes must already exist in your Brevo account. If input parameter **params** used please use **{{contact.FNAME}} {{contact.LNAME}}** for personalization | [optional] +**attachmentUrl** | **string** | Absolute url of the attachment (**no local file**). Extensions 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] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateSmtpTemplateSender.md b/docs/Model/UpdateSmtpTemplateSender.md index 267f6f7..c658cdc 100644 --- a/docs/Model/UpdateSmtpTemplateSender.md +++ b/docs/Model/UpdateSmtpTemplateSender.md @@ -1,12 +1,11 @@ -# UpdateSmtpTemplateSender +# # UpdateSmtpTemplateSender ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | Name of the sender | [optional] -**email** | **string** | Email of the sender | [optional] -**id** | **int** | Select the sender for the template on the basis of sender id. In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email). | [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) - +**name** | **string** | Name of the sender | [optional] +**email** | **string** | Email of the sender | [optional] +**id** | **int** | Select the sender for the template on the basis of sender id. _In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email)_. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateTierGroup404Response.md b/docs/Model/UpdateTierGroup404Response.md new file mode 100644 index 0000000..73408c5 --- /dev/null +++ b/docs/Model/UpdateTierGroup404Response.md @@ -0,0 +1,9 @@ +# # UpdateTierGroup404Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateTierGroupRequest.md b/docs/Model/UpdateTierGroupRequest.md new file mode 100644 index 0000000..dc3d5ea --- /dev/null +++ b/docs/Model/UpdateTierGroupRequest.md @@ -0,0 +1,12 @@ +# # UpdateTierGroupRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of the tier group | [optional] +**tierOrder** | **string** | Order of the tiers in the group in ascending order | [optional] +**upgradeStrategy** | **string** | Select real_time to upgrade tier on real time balance updates. Select anniversary to upgrade tier on subscription anniversary. | [optional] [default to 'real_time'] +**downgradeStrategy** | **string** | Select real_time to downgrade tier on real time balance updates. Select anniversary to downgrade tier on subscription anniversary. | [optional] [default to 'real_time'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateUserResponse.md b/docs/Model/UpdateUserResponse.md new file mode 100644 index 0000000..3a5f628 --- /dev/null +++ b/docs/Model/UpdateUserResponse.md @@ -0,0 +1,11 @@ +# # UpdateUserResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **string** | Status of the API operation. | +**creditNotes** | **string[]** | Credit note | [optional] +**invoiceId** | **string[]** | Invoice id | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateWebhook.md b/docs/Model/UpdateWebhook.md index ed4ccf6..98687f0 100644 --- a/docs/Model/UpdateWebhook.md +++ b/docs/Model/UpdateWebhook.md @@ -1,16 +1,15 @@ -# UpdateWebhook +# # UpdateWebhook ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**url** | **string** | URL of the webhook | [optional] -**description** | **string** | Description of the webhook | [optional] -**events** | **string[]** | - Events triggering the webhook. Possible values for **Transactional** type webhook: #### `sent` OR `request`, `delivered`, `hardBounce`, `softBounce`, `blocked`, `spam`, `invalid`, `deferred`, `click`, `opened`, `uniqueOpened` and `unsubscribed` - Possible values for **Marketing** type webhook: #### `spam`, `opened`, `click`, `hardBounce`, `softBounce`, `unsubscribed`, `listAddition` & `delivered` - Possible values for **Inbound** type webhook: #### `inboundEmailProcessed` | [optional] -**domain** | **string** | Inbound domain of webhook, used in case of event type `inbound` | [optional] -**batched** | **bool** | To send batched webhooks | [optional] -**auth** | [**\Brevo\Client\Model\GetWebhookAuth**](GetWebhookAuth.md) | | [optional] -**headers** | [**\Brevo\Client\Model\GetWebhookHeaders[]**](GetWebhookHeaders.md) | Custom headers to be send with webhooks | [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) - - +**url** | **string** | URL of the webhook | [optional] +**description** | **string** | Description of the webhook | [optional] +**events** | **string[]** | - Events triggering the webhook. Possible values for **Transactional** type webhook: #### `sent` OR `request`, `delivered`, `hardBounce`, `softBounce`, `blocked`, `spam`, `invalid`, `deferred`, `click`, `opened`, `uniqueOpened` and `unsubscribed` - Possible values for **Marketing** type webhook: #### `spam`, `opened`, `click`, `hardBounce`, `softBounce`, `unsubscribed`, `listAddition` & `delivered` - Possible values for **Inbound** type webhook: #### `inboundEmailProcessed` | [optional] +**domain** | **string** | Inbound domain of webhook, used in case of event type `inbound` | [optional] +**batched** | **bool** | Batching configuration of the webhook, we send batched webhooks if its true | [optional] +**auth** | **object** | Authentication header to be send with the webhook requests | [optional] +**headers** | **object[]** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateWhatsAppCampaign.md b/docs/Model/UpdateWhatsAppCampaign.md index 3685191..999cb6c 100644 --- a/docs/Model/UpdateWhatsAppCampaign.md +++ b/docs/Model/UpdateWhatsAppCampaign.md @@ -1,13 +1,12 @@ -# UpdateWhatsAppCampaign +# # UpdateWhatsAppCampaign ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**campaignName** | **string** | Name of the campaign | [optional] +**campaignName** | **string** | Name of the campaign | [optional] **campaignStatus** | **string** | Status of the campaign | [optional] [default to 'scheduled'] -**rescheduleFor** | **string** | Reschedule the sending UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of campaign. **Prefer to pass your timezone in date-time format for accurate result.For example: **2017-06-01T12:30:00+02:00** Use this field to update the scheduledAt of any existing draft or scheduled WhatsApp campaign. | [optional] -**recipients** | [**\Brevo\Client\Model\CreateWhatsAppCampaignRecipients**](CreateWhatsAppCampaignRecipients.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) - +**rescheduleFor** | **string** | Reschedule the sending UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of campaign. **Prefer to pass your timezone in date-time format for accurate result.For example: **2017-06-01T12:30:00+02:00** Use this field to update the scheduledAt of any existing draft or scheduled WhatsApp campaign. | [optional] +**recipients** | [**\Brevo\Client\Models\CreateWhatsAppCampaignRecipients**](CreateWhatsAppCampaignRecipients.md) | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UploadImageModel.md b/docs/Model/UploadImageModel.md index 4973300..6bb89f3 100644 --- a/docs/Model/UploadImageModel.md +++ b/docs/Model/UploadImageModel.md @@ -1,10 +1,9 @@ -# UploadImageModel +# # UploadImageModel ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**url** | **string** | URL of the image uploaded | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**url** | **string** | URL of the image uploaded | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UploadImageToGallery.md b/docs/Model/UploadImageToGallery.md index 50b5f2a..3e4a463 100644 --- a/docs/Model/UploadImageToGallery.md +++ b/docs/Model/UploadImageToGallery.md @@ -1,11 +1,10 @@ -# UploadImageToGallery +# # UploadImageToGallery ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**imageUrl** | **string** | The absolute url of the image (no local file). Maximum allowed size for image is 2MB. Allowed extensions for images are - jpeg, jpg, png, bmp, gif. | -**name** | **string** | Name of the image. | [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) - +**imageUrl** | **string** | The absolute url of the image (**no local file**). Maximum allowed size for image is **2MB**. Allowed extensions for images are: #### jpeg, jpg, png, bmp, gif. | +**name** | **string** | Name of the image. | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidateRewardPayload.md b/docs/Model/ValidateRewardPayload.md new file mode 100644 index 0000000..7e36920 --- /dev/null +++ b/docs/Model/ValidateRewardPayload.md @@ -0,0 +1,12 @@ +# # ValidateRewardPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**contactId** | **float** | Contact to attribute the reward | [optional] +**loyaltySubscriptionId** | **string** | One of contactId or loyaltySubscriptionId is required | [optional] +**code** | **string** | Code to validate | [optional] +**attributedRewardId** | **string** | One of code or attributed reward id is required | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidatedRewardResponse.md b/docs/Model/ValidatedRewardResponse.md new file mode 100644 index 0000000..d2842df --- /dev/null +++ b/docs/Model/ValidatedRewardResponse.md @@ -0,0 +1,9 @@ +# # ValidatedRewardResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**authorize** | **bool** | Validated reward respone | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidationError.md b/docs/Model/ValidationError.md new file mode 100644 index 0000000..da92655 --- /dev/null +++ b/docs/Model/ValidationError.md @@ -0,0 +1,9 @@ +# # ValidationError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | **string** | Validation error message | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VariablesItems.md b/docs/Model/VariablesItems.md index 1eca6db..5ca7f07 100644 --- a/docs/Model/VariablesItems.md +++ b/docs/Model/VariablesItems.md @@ -1,12 +1,11 @@ -# VariablesItems +# # VariablesItems ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | | [optional] -**default** | **string** | | [optional] -**datatype** | **string** | | [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) - +**name** | **string** | | [optional] +**default** | **string** | | [optional] +**datatype** | **string** | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VersionInfo.md b/docs/Model/VersionInfo.md new file mode 100644 index 0000000..649ee41 --- /dev/null +++ b/docs/Model/VersionInfo.md @@ -0,0 +1,16 @@ +# # VersionInfo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Version Name | [optional] +**loyaltyProgramId** | **string** | Loyalty Program Id | [optional] +**loyaltyVersionId** | **int** | Loyalty Version Id | [optional] +**parentVersionId** | **int** | Parent Version Id | [optional] +**state** | **string** | Version State | [optional] +**publishedAt** | **\DateTime** | Version Publish date | [optional] +**createdAt** | **\DateTime** | Version creation date | [optional] +**updatedAt** | **\DateTime** | Version last modification date | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsappCampStats.md b/docs/Model/WhatsappCampStats.md index b764ed2..6763dcf 100644 --- a/docs/Model/WhatsappCampStats.md +++ b/docs/Model/WhatsappCampStats.md @@ -1,14 +1,13 @@ -# WhatsappCampStats +# # WhatsappCampStats ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**sent** | **int** | | -**delivered** | **int** | | -**read** | **int** | | -**unsubscribe** | **int** | | -**notSent** | **int** | | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - +**sent** | **int** | | +**delivered** | **int** | | +**read** | **int** | | +**unsubscribe** | **int** | | +**notSent** | **int** | | +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsappCampTemplate.md b/docs/Model/WhatsappCampTemplate.md index 3e929a1..bf9185c 100644 --- a/docs/Model/WhatsappCampTemplate.md +++ b/docs/Model/WhatsappCampTemplate.md @@ -1,20 +1,19 @@ -# WhatsappCampTemplate +# # WhatsappCampTemplate ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | name of the template | [optional] -**category** | **string** | description of the template | [optional] -**language** | **string** | language of the template | [optional] -**containsButton** | **bool** | | [optional] -**displayHeader** | **bool** | | [optional] -**headerType** | **string** | type of header | [optional] -**components** | [**\Brevo\Client\Model\ComponentItems[]**](ComponentItems.md) | array of component item objects | [optional] -**headerVariables** | [**\Brevo\Client\Model\VariablesItems[]**](VariablesItems.md) | array of variables item object | [optional] -**bodyVariables** | [**\Brevo\Client\Model\VariablesItems[]**](VariablesItems.md) | array of variables item variables | [optional] -**buttonType** | **string** | | [optional] -**hideFooter** | **bool** | | [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) - +**name** | **string** | name of the template | [optional] +**category** | **string** | description of the template | [optional] +**language** | **string** | language of the template | [optional] +**containsButton** | **bool** | | [optional] +**displayHeader** | **bool** | | [optional] +**headerType** | **string** | type of header | [optional] +**components** | [**\Brevo\Client\Models\ComponentItems[]**](ComponentItems.md) | array of component item objects | [optional] +**headerVariables** | [**\Brevo\Client\Models\VariablesItems[]**](VariablesItems.md) | array of variables item object | [optional] +**bodyVariables** | [**\Brevo\Client\Models\VariablesItems[]**](VariablesItems.md) | array of variables item variables | [optional] +**buttonType** | **string** | | [optional] +**hideFooter** | **bool** | | [optional] +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/git_push.sh b/git_push.sh new file mode 100644 index 0000000..8d599e2 --- /dev/null +++ b/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="getbrevo" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="brevo-php" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/lib/Api/AccountApi.php b/lib/Api/AccountApi.php index 920e3fe..3cc87af 100644 --- a/lib/Api/AccountApi.php +++ b/lib/Api/AccountApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'getAccountActivity' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -92,14 +131,17 @@ public function getConfig() * * Get your account information, plan and credits details * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccount'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetAccount + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetAccount */ - public function getAccount() + public function getAccount( + string $contentType = self::contentTypes['getAccount'][0] + ): \Brevo\Client\Models\GetAccount { - list($response) = $this->getAccountWithHttpInfo(); + list($response) = $this->getAccountWithHttpInfo($contentType); return $response; } @@ -108,15 +150,17 @@ public function getAccount() * * Get your account information, plan and credits details * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccount'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetAccount, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetAccount, HTTP status code, HTTP response headers (array of strings) */ - public function getAccountWithHttpInfo() + public function getAccountWithHttpInfo( + string $contentType = self::contentTypes['getAccount'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetAccount'; - $request = $this->getAccountRequest(); + $request = $this->getAccountRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -125,34 +169,84 @@ public function getAccountWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetAccount', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetAccount' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetAccount', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetAccount'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -167,7 +261,7 @@ public function getAccountWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetAccount', + '\Brevo\Client\Models\GetAccount', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -182,13 +276,16 @@ public function getAccountWithHttpInfo() * * Get your account information, plan and credits details * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccount'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getAccountAsync() + public function getAccountAsync( + string $contentType = self::contentTypes['getAccount'][0] + ): PromiseInterface { - return $this->getAccountAsyncWithHttpInfo() + return $this->getAccountAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -201,24 +298,27 @@ function ($response) { * * Get your account information, plan and credits details * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccount'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getAccountAsyncWithHttpInfo() + public function getAccountAsyncWithHttpInfo( + string $contentType = self::contentTypes['getAccount'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetAccount'; - $request = $this->getAccountRequest(); + $returnType = '\Brevo\Client\Models\GetAccount'; + $request = $this->getAccountRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -241,7 +341,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -250,13 +350,17 @@ function ($exception) { /** * Create request for operation 'getAccount' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccount'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getAccountRequest() + public function getAccountRequest( + string $contentType = self::contentTypes['getAccount'][0] + ): Request { + $resourcePath = '/account'; $formParams = []; $queryParams = []; @@ -266,53 +370,36 @@ protected function getAccountRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -338,10 +425,11 @@ protected function getAccountRequest() $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -352,18 +440,25 @@ protected function getAccountRequest() * * Get user activity logs * - * @param string $startDate Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. (optional) - * @param string $endDate Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. (optional) - * @param int $limit Number of documents per page (optional, default to 10) - * @param int $offset Index of the first document in the page. (optional, default to 0) + * @param string|null $startDate Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. (optional) + * @param string|null $endDate Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. (optional) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document in the page. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccountActivity'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetAccountActivity + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetAccountActivity|\Brevo\Client\Models\ErrorModel */ - public function getAccountActivity($startDate = null, $endDate = null, $limit = '10', $offset = '0') + public function getAccountActivity( + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 10, + ?int $offset = 0, + string $contentType = self::contentTypes['getAccountActivity'][0] + ): \Brevo\Client\Models\GetAccountActivity { - list($response) = $this->getAccountActivityWithHttpInfo($startDate, $endDate, $limit, $offset); + list($response) = $this->getAccountActivityWithHttpInfo($startDate, $endDate, $limit, $offset, $contentType); return $response; } @@ -372,19 +467,25 @@ public function getAccountActivity($startDate = null, $endDate = null, $limit = * * Get user activity logs * - * @param string $startDate Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. (optional) - * @param string $endDate Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. (optional) - * @param int $limit Number of documents per page (optional, default to 10) - * @param int $offset Index of the first document in the page. (optional, default to 0) + * @param string|null $startDate Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. (optional) + * @param string|null $endDate Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. (optional) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document in the page. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccountActivity'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetAccountActivity, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetAccountActivity|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getAccountActivityWithHttpInfo($startDate = null, $endDate = null, $limit = '10', $offset = '0') + public function getAccountActivityWithHttpInfo( + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 10, + ?int $offset = 0, + string $contentType = self::contentTypes['getAccountActivity'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetAccountActivity'; - $request = $this->getAccountActivityRequest($startDate, $endDate, $limit, $offset); + $request = $this->getAccountActivityRequest($startDate, $endDate, $limit, $offset, $contentType); try { $options = $this->createHttpClientOption(); @@ -393,34 +494,111 @@ public function getAccountActivityWithHttpInfo($startDate = null, $endDate = nul } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetAccountActivity', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetAccountActivity' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetAccountActivity', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetAccountActivity'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -435,7 +613,7 @@ public function getAccountActivityWithHttpInfo($startDate = null, $endDate = nul case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetAccountActivity', + '\Brevo\Client\Models\GetAccountActivity', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -443,7 +621,7 @@ public function getAccountActivityWithHttpInfo($startDate = null, $endDate = nul case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -458,17 +636,24 @@ public function getAccountActivityWithHttpInfo($startDate = null, $endDate = nul * * Get user activity logs * - * @param string $startDate Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. (optional) - * @param string $endDate Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. (optional) - * @param int $limit Number of documents per page (optional, default to 10) - * @param int $offset Index of the first document in the page. (optional, default to 0) + * @param string|null $startDate Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. (optional) + * @param string|null $endDate Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. (optional) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document in the page. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccountActivity'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getAccountActivityAsync($startDate = null, $endDate = null, $limit = '10', $offset = '0') + public function getAccountActivityAsync( + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 10, + ?int $offset = 0, + string $contentType = self::contentTypes['getAccountActivity'][0] + ): PromiseInterface { - return $this->getAccountActivityAsyncWithHttpInfo($startDate, $endDate, $limit, $offset) + return $this->getAccountActivityAsyncWithHttpInfo($startDate, $endDate, $limit, $offset, $contentType) ->then( function ($response) { return $response[0]; @@ -481,28 +666,35 @@ function ($response) { * * Get user activity logs * - * @param string $startDate Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. (optional) - * @param string $endDate Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. (optional) - * @param int $limit Number of documents per page (optional, default to 10) - * @param int $offset Index of the first document in the page. (optional, default to 0) + * @param string|null $startDate Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. (optional) + * @param string|null $endDate Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. (optional) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document in the page. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccountActivity'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getAccountActivityAsyncWithHttpInfo($startDate = null, $endDate = null, $limit = '10', $offset = '0') + public function getAccountActivityAsyncWithHttpInfo( + $startDate = null, + $endDate = null, + $limit = 10, + $offset = 0, + string $contentType = self::contentTypes['getAccountActivity'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetAccountActivity'; - $request = $this->getAccountActivityRequest($startDate, $endDate, $limit, $offset); + $returnType = '\Brevo\Client\Models\GetAccountActivity'; + $request = $this->getAccountActivityRequest($startDate, $endDate, $limit, $offset, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -525,7 +717,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -534,22 +726,33 @@ function ($exception) { /** * Create request for operation 'getAccountActivity' * - * @param string $startDate Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. (optional) - * @param string $endDate Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. (optional) - * @param int $limit Number of documents per page (optional, default to 10) - * @param int $offset Index of the first document in the page. (optional, default to 0) + * @param string|null $startDate Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. (optional) + * @param string|null $endDate Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. (optional) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document in the page. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccountActivity'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getAccountActivityRequest($startDate = null, $endDate = null, $limit = '10', $offset = '0') + public function getAccountActivityRequest( + $startDate = null, + $endDate = null, + $limit = 10, + $offset = 0, + string $contentType = self::contentTypes['getAccountActivity'][0] + ): Request { + + + if ($limit !== null && $limit > 100) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling AccountApi.getAccountActivity, must be smaller than or equal to 100.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling AccountApi.getAccountActivity, must be smaller than or equal to 100.'); } if ($limit !== null && $limit < 1) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling AccountApi.getAccountActivity, must be bigger than or equal to 1.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling AccountApi.getAccountActivity, must be bigger than or equal to 1.'); } + $resourcePath = '/organization/activities'; @@ -560,70 +763,73 @@ protected function getAccountActivityRequest($startDate = null, $endDate = null, $multipart = false; // query params - if ($startDate !== null) { - $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($endDate !== null) { - $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -649,10 +855,11 @@ protected function getAccountActivityRequest($startDate = null, $endDate = null, $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -664,7 +871,7 @@ protected function getAccountActivityRequest($startDate = null, $endDate = null, * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/AttributesApi.php b/lib/Api/AttributesApi.php deleted file mode 100644 index add93cd..0000000 --- a/lib/Api/AttributesApi.php +++ /dev/null @@ -1,1219 +0,0 @@ -client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation createAttribute - * - * Create contact attribute - * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the attribute (required) - * @param \Brevo\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function createAttribute($attributeCategory, $attributeName, $createAttribute) - { - $this->createAttributeWithHttpInfo($attributeCategory, $attributeName, $createAttribute); - } - - /** - * Operation createAttributeWithHttpInfo - * - * Create contact attribute - * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the attribute (required) - * @param \Brevo\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required) - * - * @throws \Brevo\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(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation createAttributeAsync - * - * Create contact attribute - * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the attribute (required) - * @param \Brevo\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 - * - * Create contact attribute - * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the attribute (required) - * @param \Brevo\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 \Brevo\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 || (is_array($attributeCategory) && count($attributeCategory) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $attributeCategory when calling createAttribute' - ); - } - // verify the required parameter 'attributeName' is set - if ($attributeName === null || (is_array($attributeName) && count($attributeName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $attributeName when calling createAttribute' - ); - } - // verify the required parameter 'createAttribute' is set - if ($createAttribute === null || (is_array($createAttribute) && count($createAttribute) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $createAttribute when calling createAttribute' - ); - } - - $resourcePath = '/contacts/attributes/{attributeCategory}/{attributeName}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($attributeCategory !== null) { - $resourcePath = str_replace( - '{' . 'attributeCategory' . '}', - ObjectSerializer::toPathValue($attributeCategory), - $resourcePath - ); - } - // path params - if ($attributeName !== null) { - $resourcePath = str_replace( - '{' . '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)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation deleteAttribute - * - * Delete an attribute - * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the existing attribute (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function deleteAttribute($attributeCategory, $attributeName) - { - $this->deleteAttributeWithHttpInfo($attributeCategory, $attributeName); - } - - /** - * Operation deleteAttributeWithHttpInfo - * - * Delete an attribute - * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the existing attribute (required) - * - * @throws \Brevo\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(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deleteAttributeAsync - * - * Delete 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 - * - * Delete 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 || (is_array($attributeCategory) && count($attributeCategory) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $attributeCategory when calling deleteAttribute' - ); - } - // verify the required parameter 'attributeName' is set - if ($attributeName === null || (is_array($attributeName) && count($attributeName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $attributeName when calling deleteAttribute' - ); - } - - $resourcePath = '/contacts/attributes/{attributeCategory}/{attributeName}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($attributeCategory !== null) { - $resourcePath = str_replace( - '{' . 'attributeCategory' . '}', - ObjectSerializer::toPathValue($attributeCategory), - $resourcePath - ); - } - // path params - if ($attributeName !== null) { - $resourcePath = str_replace( - '{' . '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)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getAttributes - * - * List all attributes - * - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetAttributes - */ - public function getAttributes() - { - list($response) = $this->getAttributesWithHttpInfo(); - return $response; - } - - /** - * Operation getAttributesWithHttpInfo - * - * List all attributes - * - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetAttributes, HTTP status code, HTTP response headers (array of strings) - */ - public function getAttributesWithHttpInfo() - { - $returnType = '\Brevo\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(), - '\Brevo\Client\Model\GetAttributes', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getAttributesAsync - * - * List all attributes - * - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAttributesAsync() - { - return $this->getAttributesAsyncWithHttpInfo() - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getAttributesAsyncWithHttpInfo - * - * List all attributes - * - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAttributesAsyncWithHttpInfo() - { - $returnType = '\Brevo\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 = []; - $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)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation updateAttribute - * - * Update contact attribute - * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the existing attribute (required) - * @param \Brevo\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function updateAttribute($attributeCategory, $attributeName, $updateAttribute) - { - $this->updateAttributeWithHttpInfo($attributeCategory, $attributeName, $updateAttribute); - } - - /** - * Operation updateAttributeWithHttpInfo - * - * Update contact attribute - * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the existing attribute (required) - * @param \Brevo\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required) - * - * @throws \Brevo\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(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation updateAttributeAsync - * - * Update contact attribute - * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the existing attribute (required) - * @param \Brevo\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 - * - * Update contact attribute - * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the existing attribute (required) - * @param \Brevo\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 \Brevo\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 || (is_array($attributeCategory) && count($attributeCategory) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $attributeCategory when calling updateAttribute' - ); - } - // verify the required parameter 'attributeName' is set - if ($attributeName === null || (is_array($attributeName) && count($attributeName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $attributeName when calling updateAttribute' - ); - } - // verify the required parameter 'updateAttribute' is set - if ($updateAttribute === null || (is_array($updateAttribute) && count($updateAttribute) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $updateAttribute when calling updateAttribute' - ); - } - - $resourcePath = '/contacts/attributes/{attributeCategory}/{attributeName}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($attributeCategory !== null) { - $resourcePath = str_replace( - '{' . 'attributeCategory' . '}', - ObjectSerializer::toPathValue($attributeCategory), - $resourcePath - ); - } - // path params - if ($attributeName !== null) { - $resourcePath = str_replace( - '{' . '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)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($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/BalanceApi.php b/lib/Api/BalanceApi.php new file mode 100644 index 0000000..c44038d --- /dev/null +++ b/lib/Api/BalanceApi.php @@ -0,0 +1,6579 @@ + [ + 'application/json', + ], + 'cancelTransaction' => [ + 'application/json', + ], + 'completeTransaction' => [ + 'application/json', + ], + 'createBalanceOrder' => [ + 'application/json', + ], + 'getBalanceDefinitionList' => [ + 'application/json', + ], + 'getContactBalances' => [ + 'application/json', + ], + 'getSubscriptionBalances' => [ + 'application/json', + ], + 'loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete' => [ + 'application/json', + ], + 'loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet' => [ + 'application/json', + ], + 'loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete' => [ + 'application/json', + ], + 'loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet' => [ + 'application/json', + ], + 'loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut' => [ + 'application/json', + ], + 'loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost' => [ + 'application/json', + ], + 'loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut' => [ + 'application/json', + ], + 'loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation beginTransaction + * + * Create new transaction + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateTransactionPayload|null $createTransactionPayload Transaction information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['beginTransaction'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\Transaction|\Brevo\Client\Models\BadRequestPayload + */ + public function beginTransaction( + string $loyaltyProgramId, + ?\Brevo\Client\Models\CreateTransactionPayload $createTransactionPayload = null, + string $contentType = self::contentTypes['beginTransaction'][0] + ): \Brevo\Client\Models\Transaction + { + list($response) = $this->beginTransactionWithHttpInfo($loyaltyProgramId, $createTransactionPayload, $contentType); + return $response; + } + + /** + * Operation beginTransactionWithHttpInfo + * + * Create new transaction + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateTransactionPayload|null $createTransactionPayload Transaction information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['beginTransaction'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\Transaction|\Brevo\Client\Models\BadRequestPayload, HTTP status code, HTTP response headers (array of strings) + */ + public function beginTransactionWithHttpInfo( + string $loyaltyProgramId, + ?\Brevo\Client\Models\CreateTransactionPayload $createTransactionPayload = null, + string $contentType = self::contentTypes['beginTransaction'][0] + ): array + { + $request = $this->beginTransactionRequest($loyaltyProgramId, $createTransactionPayload, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\Transaction', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\Transaction' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\Transaction', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\Transaction'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\Transaction', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation beginTransactionAsync + * + * Create new transaction + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateTransactionPayload|null $createTransactionPayload Transaction information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['beginTransaction'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function beginTransactionAsync( + string $loyaltyProgramId, + ?\Brevo\Client\Models\CreateTransactionPayload $createTransactionPayload = null, + string $contentType = self::contentTypes['beginTransaction'][0] + ): PromiseInterface + { + return $this->beginTransactionAsyncWithHttpInfo($loyaltyProgramId, $createTransactionPayload, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation beginTransactionAsyncWithHttpInfo + * + * Create new transaction + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateTransactionPayload|null $createTransactionPayload Transaction information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['beginTransaction'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function beginTransactionAsyncWithHttpInfo( + $loyaltyProgramId, + $createTransactionPayload = null, + string $contentType = self::contentTypes['beginTransaction'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\Transaction'; + $request = $this->beginTransactionRequest($loyaltyProgramId, $createTransactionPayload, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'beginTransaction' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateTransactionPayload|null $createTransactionPayload Transaction information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['beginTransaction'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function beginTransactionRequest( + $loyaltyProgramId, + $createTransactionPayload = null, + string $contentType = self::contentTypes['beginTransaction'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling beginTransaction' + ); + } + + + + $resourcePath = '/loyalty/balance/programs/{loyaltyProgramId}/transactions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($createTransactionPayload)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createTransactionPayload)); + } else { + $httpBody = $createTransactionPayload; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation cancelTransaction + * + * Cancel transaction + * + * @param string $loyaltyProgramId Loyalty program Id (required) + * @param string $transactionId Transaction Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelTransaction'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CancelledTransaction|\Brevo\Client\Models\BadRequestPayload + */ + public function cancelTransaction( + string $loyaltyProgramId, + string $transactionId, + string $contentType = self::contentTypes['cancelTransaction'][0] + ): \Brevo\Client\Models\CancelledTransaction + { + list($response) = $this->cancelTransactionWithHttpInfo($loyaltyProgramId, $transactionId, $contentType); + return $response; + } + + /** + * Operation cancelTransactionWithHttpInfo + * + * Cancel transaction + * + * @param string $loyaltyProgramId Loyalty program Id (required) + * @param string $transactionId Transaction Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelTransaction'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CancelledTransaction|\Brevo\Client\Models\BadRequestPayload, HTTP status code, HTTP response headers (array of strings) + */ + public function cancelTransactionWithHttpInfo( + string $loyaltyProgramId, + string $transactionId, + string $contentType = self::contentTypes['cancelTransaction'][0] + ): array + { + $request = $this->cancelTransactionRequest($loyaltyProgramId, $transactionId, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\CancelledTransaction', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CancelledTransaction' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CancelledTransaction', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\CancelledTransaction'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\CancelledTransaction', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation cancelTransactionAsync + * + * Cancel transaction + * + * @param string $loyaltyProgramId Loyalty program Id (required) + * @param string $transactionId Transaction Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelTransaction'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function cancelTransactionAsync( + string $loyaltyProgramId, + string $transactionId, + string $contentType = self::contentTypes['cancelTransaction'][0] + ): PromiseInterface + { + return $this->cancelTransactionAsyncWithHttpInfo($loyaltyProgramId, $transactionId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation cancelTransactionAsyncWithHttpInfo + * + * Cancel transaction + * + * @param string $loyaltyProgramId Loyalty program Id (required) + * @param string $transactionId Transaction Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelTransaction'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function cancelTransactionAsyncWithHttpInfo( + $loyaltyProgramId, + $transactionId, + string $contentType = self::contentTypes['cancelTransaction'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\CancelledTransaction'; + $request = $this->cancelTransactionRequest($loyaltyProgramId, $transactionId, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'cancelTransaction' + * + * @param string $loyaltyProgramId Loyalty program Id (required) + * @param string $transactionId Transaction Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelTransaction'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function cancelTransactionRequest( + $loyaltyProgramId, + $transactionId, + string $contentType = self::contentTypes['cancelTransaction'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling cancelTransaction' + ); + } + + // verify the required parameter 'transactionId' is set + if ($transactionId === null || (is_array($transactionId) && count($transactionId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $transactionId when calling cancelTransaction' + ); + } + + + $resourcePath = '/loyalty/balance/programs/{loyaltyProgramId}/transactions/{transactionId}/cancel'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + // path params + if ($transactionId !== null) { + $resourcePath = str_replace( + '{' . 'transactionId' . '}', + ObjectSerializer::toPathValue($transactionId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation completeTransaction + * + * Complete transaction + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $transactionId Transaction Id (required) + * @param \Brevo\Client\Models\CompleteTransactionPayload|null $completeTransactionPayload Transaction information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['completeTransaction'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CompletedTransaction|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError + */ + public function completeTransaction( + string $loyaltyProgramId, + string $transactionId, + ?\Brevo\Client\Models\CompleteTransactionPayload $completeTransactionPayload = null, + string $contentType = self::contentTypes['completeTransaction'][0] + ): \Brevo\Client\Models\CompletedTransaction + { + list($response) = $this->completeTransactionWithHttpInfo($loyaltyProgramId, $transactionId, $completeTransactionPayload, $contentType); + return $response; + } + + /** + * Operation completeTransactionWithHttpInfo + * + * Complete transaction + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $transactionId Transaction Id (required) + * @param \Brevo\Client\Models\CompleteTransactionPayload|null $completeTransactionPayload Transaction information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['completeTransaction'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CompletedTransaction|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError, HTTP status code, HTTP response headers (array of strings) + */ + public function completeTransactionWithHttpInfo( + string $loyaltyProgramId, + string $transactionId, + ?\Brevo\Client\Models\CompleteTransactionPayload $completeTransactionPayload = null, + string $contentType = self::contentTypes['completeTransaction'][0] + ): array + { + $request = $this->completeTransactionRequest($loyaltyProgramId, $transactionId, $completeTransactionPayload, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\CompletedTransaction', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CompletedTransaction' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CompletedTransaction', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ValidationError', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ValidationError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ValidationError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\CompletedTransaction'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\CompletedTransaction', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ValidationError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation completeTransactionAsync + * + * Complete transaction + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $transactionId Transaction Id (required) + * @param \Brevo\Client\Models\CompleteTransactionPayload|null $completeTransactionPayload Transaction information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['completeTransaction'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function completeTransactionAsync( + string $loyaltyProgramId, + string $transactionId, + ?\Brevo\Client\Models\CompleteTransactionPayload $completeTransactionPayload = null, + string $contentType = self::contentTypes['completeTransaction'][0] + ): PromiseInterface + { + return $this->completeTransactionAsyncWithHttpInfo($loyaltyProgramId, $transactionId, $completeTransactionPayload, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation completeTransactionAsyncWithHttpInfo + * + * Complete transaction + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $transactionId Transaction Id (required) + * @param \Brevo\Client\Models\CompleteTransactionPayload|null $completeTransactionPayload Transaction information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['completeTransaction'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function completeTransactionAsyncWithHttpInfo( + $loyaltyProgramId, + $transactionId, + $completeTransactionPayload = null, + string $contentType = self::contentTypes['completeTransaction'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\CompletedTransaction'; + $request = $this->completeTransactionRequest($loyaltyProgramId, $transactionId, $completeTransactionPayload, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'completeTransaction' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $transactionId Transaction Id (required) + * @param \Brevo\Client\Models\CompleteTransactionPayload|null $completeTransactionPayload Transaction information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['completeTransaction'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function completeTransactionRequest( + $loyaltyProgramId, + $transactionId, + $completeTransactionPayload = null, + string $contentType = self::contentTypes['completeTransaction'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling completeTransaction' + ); + } + + // verify the required parameter 'transactionId' is set + if ($transactionId === null || (is_array($transactionId) && count($transactionId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $transactionId when calling completeTransaction' + ); + } + + + + $resourcePath = '/loyalty/balance/programs/{loyaltyProgramId}/transactions/{transactionId}/complete'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + // path params + if ($transactionId !== null) { + $resourcePath = str_replace( + '{' . 'transactionId' . '}', + ObjectSerializer::toPathValue($transactionId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($completeTransactionPayload)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($completeTransactionPayload)); + } else { + $httpBody = $completeTransactionPayload; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createBalanceOrder + * + * Create balance order + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateOrderPayload|null $createOrderPayload Create order information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBalanceOrder'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateOrderPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError + */ + public function createBalanceOrder( + string $loyaltyProgramId, + ?\Brevo\Client\Models\CreateOrderPayload $createOrderPayload = null, + string $contentType = self::contentTypes['createBalanceOrder'][0] + ): \Brevo\Client\Models\CreateOrderPayload + { + list($response) = $this->createBalanceOrderWithHttpInfo($loyaltyProgramId, $createOrderPayload, $contentType); + return $response; + } + + /** + * Operation createBalanceOrderWithHttpInfo + * + * Create balance order + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateOrderPayload|null $createOrderPayload Create order information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBalanceOrder'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateOrderPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError, HTTP status code, HTTP response headers (array of strings) + */ + public function createBalanceOrderWithHttpInfo( + string $loyaltyProgramId, + ?\Brevo\Client\Models\CreateOrderPayload $createOrderPayload = null, + string $contentType = self::contentTypes['createBalanceOrder'][0] + ): array + { + $request = $this->createBalanceOrderRequest($loyaltyProgramId, $createOrderPayload, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreateOrderPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateOrderPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateOrderPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ValidationError', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ValidationError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ValidationError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\CreateOrderPayload'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\CreateOrderPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ValidationError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createBalanceOrderAsync + * + * Create balance order + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateOrderPayload|null $createOrderPayload Create order information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBalanceOrder'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createBalanceOrderAsync( + string $loyaltyProgramId, + ?\Brevo\Client\Models\CreateOrderPayload $createOrderPayload = null, + string $contentType = self::contentTypes['createBalanceOrder'][0] + ): PromiseInterface + { + return $this->createBalanceOrderAsyncWithHttpInfo($loyaltyProgramId, $createOrderPayload, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createBalanceOrderAsyncWithHttpInfo + * + * Create balance order + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateOrderPayload|null $createOrderPayload Create order information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBalanceOrder'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createBalanceOrderAsyncWithHttpInfo( + $loyaltyProgramId, + $createOrderPayload = null, + string $contentType = self::contentTypes['createBalanceOrder'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\CreateOrderPayload'; + $request = $this->createBalanceOrderRequest($loyaltyProgramId, $createOrderPayload, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createBalanceOrder' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateOrderPayload|null $createOrderPayload Create order information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBalanceOrder'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createBalanceOrderRequest( + $loyaltyProgramId, + $createOrderPayload = null, + string $contentType = self::contentTypes['createBalanceOrder'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling createBalanceOrder' + ); + } + + + + $resourcePath = '/loyalty/balance/programs/{loyaltyProgramId}/create-order'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($createOrderPayload)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createOrderPayload)); + } else { + $httpBody = $createOrderPayload; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getBalanceDefinitionList + * + * Get balance definition list + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sortField Sort documents by field (optional, default to 'name') + * @param string|null $sort Sort the documents in the ascending or descending order (optional, default to 'desc') + * @param string|null $version Select 'active' to retrieve list of all balances which are live for clients. Select draft to retrieve list of all non deleted balances. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBalanceDefinitionList'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\BalanceDefinitionPage|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError + */ + public function getBalanceDefinitionList( + string $loyaltyProgramId, + ?int $limit = 50, + ?int $offset = 0, + ?string $sortField = 'name', + ?string $sort = 'desc', + ?string $version = 'draft', + string $contentType = self::contentTypes['getBalanceDefinitionList'][0] + ): \Brevo\Client\Models\BalanceDefinitionPage + { + list($response) = $this->getBalanceDefinitionListWithHttpInfo($loyaltyProgramId, $limit, $offset, $sortField, $sort, $version, $contentType); + return $response; + } + + /** + * Operation getBalanceDefinitionListWithHttpInfo + * + * Get balance definition list + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sortField Sort documents by field (optional, default to 'name') + * @param string|null $sort Sort the documents in the ascending or descending order (optional, default to 'desc') + * @param string|null $version Select 'active' to retrieve list of all balances which are live for clients. Select draft to retrieve list of all non deleted balances. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBalanceDefinitionList'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\BalanceDefinitionPage|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError, HTTP status code, HTTP response headers (array of strings) + */ + public function getBalanceDefinitionListWithHttpInfo( + string $loyaltyProgramId, + ?int $limit = 50, + ?int $offset = 0, + ?string $sortField = 'name', + ?string $sort = 'desc', + ?string $version = 'draft', + string $contentType = self::contentTypes['getBalanceDefinitionList'][0] + ): array + { + $request = $this->getBalanceDefinitionListRequest($loyaltyProgramId, $limit, $offset, $sortField, $sort, $version, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\BalanceDefinitionPage', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BalanceDefinitionPage' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BalanceDefinitionPage', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ValidationError', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ValidationError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ValidationError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\BalanceDefinitionPage'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BalanceDefinitionPage', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ValidationError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getBalanceDefinitionListAsync + * + * Get balance definition list + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sortField Sort documents by field (optional, default to 'name') + * @param string|null $sort Sort the documents in the ascending or descending order (optional, default to 'desc') + * @param string|null $version Select 'active' to retrieve list of all balances which are live for clients. Select draft to retrieve list of all non deleted balances. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBalanceDefinitionList'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getBalanceDefinitionListAsync( + string $loyaltyProgramId, + ?int $limit = 50, + ?int $offset = 0, + ?string $sortField = 'name', + ?string $sort = 'desc', + ?string $version = 'draft', + string $contentType = self::contentTypes['getBalanceDefinitionList'][0] + ): PromiseInterface + { + return $this->getBalanceDefinitionListAsyncWithHttpInfo($loyaltyProgramId, $limit, $offset, $sortField, $sort, $version, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getBalanceDefinitionListAsyncWithHttpInfo + * + * Get balance definition list + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sortField Sort documents by field (optional, default to 'name') + * @param string|null $sort Sort the documents in the ascending or descending order (optional, default to 'desc') + * @param string|null $version Select 'active' to retrieve list of all balances which are live for clients. Select draft to retrieve list of all non deleted balances. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBalanceDefinitionList'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getBalanceDefinitionListAsyncWithHttpInfo( + $loyaltyProgramId, + $limit = 50, + $offset = 0, + $sortField = 'name', + $sort = 'desc', + $version = 'draft', + string $contentType = self::contentTypes['getBalanceDefinitionList'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\BalanceDefinitionPage'; + $request = $this->getBalanceDefinitionListRequest($loyaltyProgramId, $limit, $offset, $sortField, $sort, $version, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getBalanceDefinitionList' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sortField Sort documents by field (optional, default to 'name') + * @param string|null $sort Sort the documents in the ascending or descending order (optional, default to 'desc') + * @param string|null $version Select 'active' to retrieve list of all balances which are live for clients. Select draft to retrieve list of all non deleted balances. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBalanceDefinitionList'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getBalanceDefinitionListRequest( + $loyaltyProgramId, + $limit = 50, + $offset = 0, + $sortField = 'name', + $sort = 'desc', + $version = 'draft', + string $contentType = self::contentTypes['getBalanceDefinitionList'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling getBalanceDefinitionList' + ); + } + + + + + + + + $resourcePath = '/loyalty/balance/programs/{loyaltyProgramId}/balance-definitions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sortField, + 'sortField', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $version, + 'version', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getContactBalances + * + * Get balance list + * + * @param string $loyaltyProgramId Loyalty program id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param int|null $limit Number of documents per page (optional, default to 100) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the documents in the ascending or descending order (optional, default to 'desc') + * @param string|null $sortField Sort documents by field (optional, default to 'updatedAt') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactBalances'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\ContactBalances|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BalanceDefinitionIdDoesNotExist|\Brevo\Client\Models\ValidationError + */ + public function getContactBalances( + string $loyaltyProgramId, + string $balanceDefinitionId, + ?int $limit = 100, + ?int $offset = 0, + ?string $sort = 'desc', + ?string $sortField = 'updatedAt', + string $contentType = self::contentTypes['getContactBalances'][0] + ): \Brevo\Client\Models\ContactBalances + { + list($response) = $this->getContactBalancesWithHttpInfo($loyaltyProgramId, $balanceDefinitionId, $limit, $offset, $sort, $sortField, $contentType); + return $response; + } + + /** + * Operation getContactBalancesWithHttpInfo + * + * Get balance list + * + * @param string $loyaltyProgramId Loyalty program id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param int|null $limit Number of documents per page (optional, default to 100) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the documents in the ascending or descending order (optional, default to 'desc') + * @param string|null $sortField Sort documents by field (optional, default to 'updatedAt') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactBalances'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\ContactBalances|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BalanceDefinitionIdDoesNotExist|\Brevo\Client\Models\ValidationError, HTTP status code, HTTP response headers (array of strings) + */ + public function getContactBalancesWithHttpInfo( + string $loyaltyProgramId, + string $balanceDefinitionId, + ?int $limit = 100, + ?int $offset = 0, + ?string $sort = 'desc', + ?string $sortField = 'updatedAt', + string $contentType = self::contentTypes['getContactBalances'][0] + ): array + { + $request = $this->getContactBalancesRequest($loyaltyProgramId, $balanceDefinitionId, $limit, $offset, $sort, $sortField, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\ContactBalances', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ContactBalances' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ContactBalances', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\BalanceDefinitionIdDoesNotExist', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BalanceDefinitionIdDoesNotExist' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BalanceDefinitionIdDoesNotExist', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ValidationError', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ValidationError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ValidationError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\ContactBalances'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactBalances', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BalanceDefinitionIdDoesNotExist', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ValidationError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getContactBalancesAsync + * + * Get balance list + * + * @param string $loyaltyProgramId Loyalty program id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param int|null $limit Number of documents per page (optional, default to 100) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the documents in the ascending or descending order (optional, default to 'desc') + * @param string|null $sortField Sort documents by field (optional, default to 'updatedAt') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactBalances'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getContactBalancesAsync( + string $loyaltyProgramId, + string $balanceDefinitionId, + ?int $limit = 100, + ?int $offset = 0, + ?string $sort = 'desc', + ?string $sortField = 'updatedAt', + string $contentType = self::contentTypes['getContactBalances'][0] + ): PromiseInterface + { + return $this->getContactBalancesAsyncWithHttpInfo($loyaltyProgramId, $balanceDefinitionId, $limit, $offset, $sort, $sortField, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getContactBalancesAsyncWithHttpInfo + * + * Get balance list + * + * @param string $loyaltyProgramId Loyalty program id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param int|null $limit Number of documents per page (optional, default to 100) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the documents in the ascending or descending order (optional, default to 'desc') + * @param string|null $sortField Sort documents by field (optional, default to 'updatedAt') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactBalances'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getContactBalancesAsyncWithHttpInfo( + $loyaltyProgramId, + $balanceDefinitionId, + $limit = 100, + $offset = 0, + $sort = 'desc', + $sortField = 'updatedAt', + string $contentType = self::contentTypes['getContactBalances'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\ContactBalances'; + $request = $this->getContactBalancesRequest($loyaltyProgramId, $balanceDefinitionId, $limit, $offset, $sort, $sortField, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getContactBalances' + * + * @param string $loyaltyProgramId Loyalty program id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param int|null $limit Number of documents per page (optional, default to 100) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the documents in the ascending or descending order (optional, default to 'desc') + * @param string|null $sortField Sort documents by field (optional, default to 'updatedAt') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactBalances'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getContactBalancesRequest( + $loyaltyProgramId, + $balanceDefinitionId, + $limit = 100, + $offset = 0, + $sort = 'desc', + $sortField = 'updatedAt', + string $contentType = self::contentTypes['getContactBalances'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling getContactBalances' + ); + } + + // verify the required parameter 'balanceDefinitionId' is set + if ($balanceDefinitionId === null || (is_array($balanceDefinitionId) && count($balanceDefinitionId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $balanceDefinitionId when calling getContactBalances' + ); + } + + if ($limit !== null && $limit > 500) { + throw new InvalidArgumentException('invalid value for "$limit" when calling BalanceApi.getContactBalances, must be smaller than or equal to 500.'); + } + if ($limit !== null && $limit < 1) { + throw new InvalidArgumentException('invalid value for "$limit" when calling BalanceApi.getContactBalances, must be bigger than or equal to 1.'); + } + + + + + + $resourcePath = '/loyalty/balance/programs/{loyaltyProgramId}/contact-balances'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $balanceDefinitionId, + 'balanceDefinitionId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sortField, + 'sortField', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSubscriptionBalances + * + * Get subscription balances + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contactId Contact id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubscriptionBalances'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\BalancePage|\Brevo\Client\Models\BadRequestPayload + */ + public function getSubscriptionBalances( + string $loyaltyProgramId, + string $contactId, + string $contentType = self::contentTypes['getSubscriptionBalances'][0] + ): \Brevo\Client\Models\BalancePage + { + list($response) = $this->getSubscriptionBalancesWithHttpInfo($loyaltyProgramId, $contactId, $contentType); + return $response; + } + + /** + * Operation getSubscriptionBalancesWithHttpInfo + * + * Get subscription balances + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contactId Contact id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubscriptionBalances'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\BalancePage|\Brevo\Client\Models\BadRequestPayload, HTTP status code, HTTP response headers (array of strings) + */ + public function getSubscriptionBalancesWithHttpInfo( + string $loyaltyProgramId, + string $contactId, + string $contentType = self::contentTypes['getSubscriptionBalances'][0] + ): array + { + $request = $this->getSubscriptionBalancesRequest($loyaltyProgramId, $contactId, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\BalancePage', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BalancePage' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BalancePage', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\BalancePage'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BalancePage', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSubscriptionBalancesAsync + * + * Get subscription balances + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contactId Contact id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubscriptionBalances'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getSubscriptionBalancesAsync( + string $loyaltyProgramId, + string $contactId, + string $contentType = self::contentTypes['getSubscriptionBalances'][0] + ): PromiseInterface + { + return $this->getSubscriptionBalancesAsyncWithHttpInfo($loyaltyProgramId, $contactId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSubscriptionBalancesAsyncWithHttpInfo + * + * Get subscription balances + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contactId Contact id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubscriptionBalances'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getSubscriptionBalancesAsyncWithHttpInfo( + $loyaltyProgramId, + $contactId, + string $contentType = self::contentTypes['getSubscriptionBalances'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\BalancePage'; + $request = $this->getSubscriptionBalancesRequest($loyaltyProgramId, $contactId, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSubscriptionBalances' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contactId Contact id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubscriptionBalances'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSubscriptionBalancesRequest( + $loyaltyProgramId, + $contactId, + string $contentType = self::contentTypes['getSubscriptionBalances'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling getSubscriptionBalances' + ); + } + + // verify the required parameter 'contactId' is set + if ($contactId === null || (is_array($contactId) && count($contactId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $contactId when calling getSubscriptionBalances' + ); + } + + + $resourcePath = '/loyalty/balance/programs/{loyaltyProgramId}/subscriptions/{contactId}/balances'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + // path params + if ($contactId !== null) { + $resourcePath = str_replace( + '{' . 'contactId' . '}', + ObjectSerializer::toPathValue($contactId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete + * + * Delete balance definition + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return void + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete( + string $loyaltyProgramId, + string $balanceDefinitionId, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete'][0] + ): void + { + $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDeleteWithHttpInfo($loyaltyProgramId, $balanceDefinitionId, $contentType); + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDeleteWithHttpInfo + * + * Delete balance definition + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDeleteWithHttpInfo( + string $loyaltyProgramId, + string $balanceDefinitionId, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete'][0] + ): array + { + $request = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDeleteRequest($loyaltyProgramId, $balanceDefinitionId, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDeleteAsync + * + * Delete balance definition + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDeleteAsync( + string $loyaltyProgramId, + string $balanceDefinitionId, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete'][0] + ): PromiseInterface + { + return $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDeleteAsyncWithHttpInfo($loyaltyProgramId, $balanceDefinitionId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDeleteAsyncWithHttpInfo + * + * Delete balance definition + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDeleteAsyncWithHttpInfo( + $loyaltyProgramId, + $balanceDefinitionId, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDeleteRequest($loyaltyProgramId, $balanceDefinitionId, $contentType); + + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDeleteRequest( + $loyaltyProgramId, + $balanceDefinitionId, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete' + ); + } + + // verify the required parameter 'balanceDefinitionId' is set + if ($balanceDefinitionId === null || (is_array($balanceDefinitionId) && count($balanceDefinitionId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $balanceDefinitionId when calling loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdDelete' + ); + } + + + $resourcePath = '/loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + // path params + if ($balanceDefinitionId !== null) { + $resourcePath = str_replace( + '{' . 'balanceDefinitionId' . '}', + ObjectSerializer::toPathValue($balanceDefinitionId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet + * + * Get balance definition + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param string|null $version Select active to get balance definition configuration which is live for the clients. Select draft to retrieve balance definition configuration with the recent edits (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\BalanceDefinition|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet( + string $loyaltyProgramId, + string $balanceDefinitionId, + ?string $version = 'draft', + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet'][0] + ): \Brevo\Client\Models\BalanceDefinition + { + list($response) = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGetWithHttpInfo($loyaltyProgramId, $balanceDefinitionId, $version, $contentType); + return $response; + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGetWithHttpInfo + * + * Get balance definition + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param string|null $version Select active to get balance definition configuration which is live for the clients. Select draft to retrieve balance definition configuration with the recent edits (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\BalanceDefinition|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError, HTTP status code, HTTP response headers (array of strings) + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGetWithHttpInfo( + string $loyaltyProgramId, + string $balanceDefinitionId, + ?string $version = 'draft', + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet'][0] + ): array + { + $request = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGetRequest($loyaltyProgramId, $balanceDefinitionId, $version, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\BalanceDefinition', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BalanceDefinition' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BalanceDefinition', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ValidationError', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ValidationError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ValidationError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\BalanceDefinition'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BalanceDefinition', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ValidationError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGetAsync + * + * Get balance definition + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param string|null $version Select active to get balance definition configuration which is live for the clients. Select draft to retrieve balance definition configuration with the recent edits (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGetAsync( + string $loyaltyProgramId, + string $balanceDefinitionId, + ?string $version = 'draft', + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet'][0] + ): PromiseInterface + { + return $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGetAsyncWithHttpInfo($loyaltyProgramId, $balanceDefinitionId, $version, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGetAsyncWithHttpInfo + * + * Get balance definition + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param string|null $version Select active to get balance definition configuration which is live for the clients. Select draft to retrieve balance definition configuration with the recent edits (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGetAsyncWithHttpInfo( + $loyaltyProgramId, + $balanceDefinitionId, + $version = 'draft', + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\BalanceDefinition'; + $request = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGetRequest($loyaltyProgramId, $balanceDefinitionId, $version, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param string|null $version Select active to get balance definition configuration which is live for the clients. Select draft to retrieve balance definition configuration with the recent edits (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGetRequest( + $loyaltyProgramId, + $balanceDefinitionId, + $version = 'draft', + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet' + ); + } + + // verify the required parameter 'balanceDefinitionId' is set + if ($balanceDefinitionId === null || (is_array($balanceDefinitionId) && count($balanceDefinitionId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $balanceDefinitionId when calling loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdGet' + ); + } + + + + $resourcePath = '/loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $version, + 'version', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + // path params + if ($balanceDefinitionId !== null) { + $resourcePath = str_replace( + '{' . 'balanceDefinitionId' . '}', + ObjectSerializer::toPathValue($balanceDefinitionId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete + * + * Delete balance limit + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param string $balanceLimitId Id of the limit to be deleted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return void + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete( + string $loyaltyProgramId, + string $balanceDefinitionId, + string $balanceLimitId, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete'][0] + ): void + { + $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDeleteWithHttpInfo($loyaltyProgramId, $balanceDefinitionId, $balanceLimitId, $contentType); + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDeleteWithHttpInfo + * + * Delete balance limit + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param string $balanceLimitId Id of the limit to be deleted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDeleteWithHttpInfo( + string $loyaltyProgramId, + string $balanceDefinitionId, + string $balanceLimitId, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete'][0] + ): array + { + $request = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDeleteRequest($loyaltyProgramId, $balanceDefinitionId, $balanceLimitId, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDeleteAsync + * + * Delete balance limit + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param string $balanceLimitId Id of the limit to be deleted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDeleteAsync( + string $loyaltyProgramId, + string $balanceDefinitionId, + string $balanceLimitId, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete'][0] + ): PromiseInterface + { + return $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDeleteAsyncWithHttpInfo($loyaltyProgramId, $balanceDefinitionId, $balanceLimitId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDeleteAsyncWithHttpInfo + * + * Delete balance limit + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param string $balanceLimitId Id of the limit to be deleted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDeleteAsyncWithHttpInfo( + $loyaltyProgramId, + $balanceDefinitionId, + $balanceLimitId, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDeleteRequest($loyaltyProgramId, $balanceDefinitionId, $balanceLimitId, $contentType); + + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param string $balanceLimitId Id of the limit to be deleted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDeleteRequest( + $loyaltyProgramId, + $balanceDefinitionId, + $balanceLimitId, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete' + ); + } + + // verify the required parameter 'balanceDefinitionId' is set + if ($balanceDefinitionId === null || (is_array($balanceDefinitionId) && count($balanceDefinitionId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $balanceDefinitionId when calling loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete' + ); + } + + // verify the required parameter 'balanceLimitId' is set + if ($balanceLimitId === null || (is_array($balanceLimitId) && count($balanceLimitId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $balanceLimitId when calling loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdDelete' + ); + } + + + $resourcePath = '/loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId}/limits/{balanceLimitId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + // path params + if ($balanceDefinitionId !== null) { + $resourcePath = str_replace( + '{' . 'balanceDefinitionId' . '}', + ObjectSerializer::toPathValue($balanceDefinitionId), + $resourcePath + ); + } + // path params + if ($balanceLimitId !== null) { + $resourcePath = str_replace( + '{' . 'balanceLimitId' . '}', + ObjectSerializer::toPathValue($balanceLimitId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet + * + * Get balance limits + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance definition id (required) + * @param string $balanceLimitId Balance limit id (required) + * @param string|null $version Select active to get balance definition configuration which is live for the clients. Select draft to retrieve balance definition configuration with the recent edits (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\BalanceLimitPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet( + string $loyaltyProgramId, + string $balanceDefinitionId, + string $balanceLimitId, + ?string $version = 'draft', + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet'][0] + ): \Brevo\Client\Models\BalanceLimitPayload + { + list($response) = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGetWithHttpInfo($loyaltyProgramId, $balanceDefinitionId, $balanceLimitId, $version, $contentType); + return $response; + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGetWithHttpInfo + * + * Get balance limits + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance definition id (required) + * @param string $balanceLimitId Balance limit id (required) + * @param string|null $version Select active to get balance definition configuration which is live for the clients. Select draft to retrieve balance definition configuration with the recent edits (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\BalanceLimitPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError, HTTP status code, HTTP response headers (array of strings) + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGetWithHttpInfo( + string $loyaltyProgramId, + string $balanceDefinitionId, + string $balanceLimitId, + ?string $version = 'draft', + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet'][0] + ): array + { + $request = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGetRequest($loyaltyProgramId, $balanceDefinitionId, $balanceLimitId, $version, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\BalanceLimitPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BalanceLimitPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BalanceLimitPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ValidationError', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ValidationError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ValidationError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\BalanceLimitPayload'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BalanceLimitPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ValidationError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGetAsync + * + * Get balance limits + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance definition id (required) + * @param string $balanceLimitId Balance limit id (required) + * @param string|null $version Select active to get balance definition configuration which is live for the clients. Select draft to retrieve balance definition configuration with the recent edits (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGetAsync( + string $loyaltyProgramId, + string $balanceDefinitionId, + string $balanceLimitId, + ?string $version = 'draft', + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet'][0] + ): PromiseInterface + { + return $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGetAsyncWithHttpInfo($loyaltyProgramId, $balanceDefinitionId, $balanceLimitId, $version, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGetAsyncWithHttpInfo + * + * Get balance limits + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance definition id (required) + * @param string $balanceLimitId Balance limit id (required) + * @param string|null $version Select active to get balance definition configuration which is live for the clients. Select draft to retrieve balance definition configuration with the recent edits (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGetAsyncWithHttpInfo( + $loyaltyProgramId, + $balanceDefinitionId, + $balanceLimitId, + $version = 'draft', + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\BalanceLimitPayload'; + $request = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGetRequest($loyaltyProgramId, $balanceDefinitionId, $balanceLimitId, $version, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance definition id (required) + * @param string $balanceLimitId Balance limit id (required) + * @param string|null $version Select active to get balance definition configuration which is live for the clients. Select draft to retrieve balance definition configuration with the recent edits (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGetRequest( + $loyaltyProgramId, + $balanceDefinitionId, + $balanceLimitId, + $version = 'draft', + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet' + ); + } + + // verify the required parameter 'balanceDefinitionId' is set + if ($balanceDefinitionId === null || (is_array($balanceDefinitionId) && count($balanceDefinitionId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $balanceDefinitionId when calling loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet' + ); + } + + // verify the required parameter 'balanceLimitId' is set + if ($balanceLimitId === null || (is_array($balanceLimitId) && count($balanceLimitId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $balanceLimitId when calling loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdGet' + ); + } + + + + $resourcePath = '/loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId}/limits/{balanceLimitId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $version, + 'version', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + // path params + if ($balanceDefinitionId !== null) { + $resourcePath = str_replace( + '{' . 'balanceDefinitionId' . '}', + ObjectSerializer::toPathValue($balanceDefinitionId), + $resourcePath + ); + } + // path params + if ($balanceLimitId !== null) { + $resourcePath = str_replace( + '{' . 'balanceLimitId' . '}', + ObjectSerializer::toPathValue($balanceLimitId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut + * + * Updates balance limit + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param string $balanceLimitId Balance Limit Id (required) + * @param \Brevo\Client\Models\BalanceLimit|null $balanceLimit Balance limit request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\BalanceLimitPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut( + string $loyaltyProgramId, + string $balanceDefinitionId, + string $balanceLimitId, + ?\Brevo\Client\Models\BalanceLimit $balanceLimit = null, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut'][0] + ): \Brevo\Client\Models\BalanceLimitPayload + { + list($response) = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPutWithHttpInfo($loyaltyProgramId, $balanceDefinitionId, $balanceLimitId, $balanceLimit, $contentType); + return $response; + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPutWithHttpInfo + * + * Updates balance limit + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param string $balanceLimitId Balance Limit Id (required) + * @param \Brevo\Client\Models\BalanceLimit|null $balanceLimit Balance limit request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\BalanceLimitPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError, HTTP status code, HTTP response headers (array of strings) + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPutWithHttpInfo( + string $loyaltyProgramId, + string $balanceDefinitionId, + string $balanceLimitId, + ?\Brevo\Client\Models\BalanceLimit $balanceLimit = null, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut'][0] + ): array + { + $request = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPutRequest($loyaltyProgramId, $balanceDefinitionId, $balanceLimitId, $balanceLimit, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\BalanceLimitPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BalanceLimitPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BalanceLimitPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ValidationError', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ValidationError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ValidationError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\BalanceLimitPayload'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BalanceLimitPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ValidationError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPutAsync + * + * Updates balance limit + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param string $balanceLimitId Balance Limit Id (required) + * @param \Brevo\Client\Models\BalanceLimit|null $balanceLimit Balance limit request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPutAsync( + string $loyaltyProgramId, + string $balanceDefinitionId, + string $balanceLimitId, + ?\Brevo\Client\Models\BalanceLimit $balanceLimit = null, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut'][0] + ): PromiseInterface + { + return $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPutAsyncWithHttpInfo($loyaltyProgramId, $balanceDefinitionId, $balanceLimitId, $balanceLimit, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPutAsyncWithHttpInfo + * + * Updates balance limit + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param string $balanceLimitId Balance Limit Id (required) + * @param \Brevo\Client\Models\BalanceLimit|null $balanceLimit Balance limit request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPutAsyncWithHttpInfo( + $loyaltyProgramId, + $balanceDefinitionId, + $balanceLimitId, + $balanceLimit = null, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\BalanceLimitPayload'; + $request = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPutRequest($loyaltyProgramId, $balanceDefinitionId, $balanceLimitId, $balanceLimit, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param string $balanceLimitId Balance Limit Id (required) + * @param \Brevo\Client\Models\BalanceLimit|null $balanceLimit Balance limit request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPutRequest( + $loyaltyProgramId, + $balanceDefinitionId, + $balanceLimitId, + $balanceLimit = null, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut' + ); + } + + // verify the required parameter 'balanceDefinitionId' is set + if ($balanceDefinitionId === null || (is_array($balanceDefinitionId) && count($balanceDefinitionId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $balanceDefinitionId when calling loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut' + ); + } + + // verify the required parameter 'balanceLimitId' is set + if ($balanceLimitId === null || (is_array($balanceLimitId) && count($balanceLimitId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $balanceLimitId when calling loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsBalanceLimitIdPut' + ); + } + + + + $resourcePath = '/loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId}/limits/{balanceLimitId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + // path params + if ($balanceDefinitionId !== null) { + $resourcePath = str_replace( + '{' . 'balanceDefinitionId' . '}', + ObjectSerializer::toPathValue($balanceDefinitionId), + $resourcePath + ); + } + // path params + if ($balanceLimitId !== null) { + $resourcePath = str_replace( + '{' . 'balanceLimitId' . '}', + ObjectSerializer::toPathValue($balanceLimitId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($balanceLimit)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($balanceLimit)); + } else { + $httpBody = $balanceLimit; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost + * + * Create balance limits + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param \Brevo\Client\Models\BalanceLimit|null $balanceLimit Balance definition information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\BalanceLimitPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost( + string $loyaltyProgramId, + string $balanceDefinitionId, + ?\Brevo\Client\Models\BalanceLimit $balanceLimit = null, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost'][0] + ): \Brevo\Client\Models\BalanceLimitPayload + { + list($response) = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPostWithHttpInfo($loyaltyProgramId, $balanceDefinitionId, $balanceLimit, $contentType); + return $response; + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPostWithHttpInfo + * + * Create balance limits + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param \Brevo\Client\Models\BalanceLimit|null $balanceLimit Balance definition information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\BalanceLimitPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError, HTTP status code, HTTP response headers (array of strings) + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPostWithHttpInfo( + string $loyaltyProgramId, + string $balanceDefinitionId, + ?\Brevo\Client\Models\BalanceLimit $balanceLimit = null, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost'][0] + ): array + { + $request = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPostRequest($loyaltyProgramId, $balanceDefinitionId, $balanceLimit, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\BalanceLimitPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BalanceLimitPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BalanceLimitPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ValidationError', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ValidationError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ValidationError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\BalanceLimitPayload'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BalanceLimitPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ValidationError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPostAsync + * + * Create balance limits + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param \Brevo\Client\Models\BalanceLimit|null $balanceLimit Balance definition information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPostAsync( + string $loyaltyProgramId, + string $balanceDefinitionId, + ?\Brevo\Client\Models\BalanceLimit $balanceLimit = null, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost'][0] + ): PromiseInterface + { + return $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPostAsyncWithHttpInfo($loyaltyProgramId, $balanceDefinitionId, $balanceLimit, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPostAsyncWithHttpInfo + * + * Create balance limits + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param \Brevo\Client\Models\BalanceLimit|null $balanceLimit Balance definition information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPostAsyncWithHttpInfo( + $loyaltyProgramId, + $balanceDefinitionId, + $balanceLimit = null, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\BalanceLimitPayload'; + $request = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPostRequest($loyaltyProgramId, $balanceDefinitionId, $balanceLimit, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param \Brevo\Client\Models\BalanceLimit|null $balanceLimit Balance definition information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPostRequest( + $loyaltyProgramId, + $balanceDefinitionId, + $balanceLimit = null, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost' + ); + } + + // verify the required parameter 'balanceDefinitionId' is set + if ($balanceDefinitionId === null || (is_array($balanceDefinitionId) && count($balanceDefinitionId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $balanceDefinitionId when calling loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdLimitsPost' + ); + } + + + + $resourcePath = '/loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId}/limits'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + // path params + if ($balanceDefinitionId !== null) { + $resourcePath = str_replace( + '{' . 'balanceDefinitionId' . '}', + ObjectSerializer::toPathValue($balanceDefinitionId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($balanceLimit)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($balanceLimit)); + } else { + $httpBody = $balanceLimit; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut + * + * Update balance definition + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param \Brevo\Client\Models\UpdateBalanceDefinitionPayload|null $updateBalanceDefinitionPayload Balance definition information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\BalanceDefinition|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut( + string $loyaltyProgramId, + string $balanceDefinitionId, + ?\Brevo\Client\Models\UpdateBalanceDefinitionPayload $updateBalanceDefinitionPayload = null, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut'][0] + ): \Brevo\Client\Models\BalanceDefinition + { + list($response) = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPutWithHttpInfo($loyaltyProgramId, $balanceDefinitionId, $updateBalanceDefinitionPayload, $contentType); + return $response; + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPutWithHttpInfo + * + * Update balance definition + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param \Brevo\Client\Models\UpdateBalanceDefinitionPayload|null $updateBalanceDefinitionPayload Balance definition information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\BalanceDefinition|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError, HTTP status code, HTTP response headers (array of strings) + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPutWithHttpInfo( + string $loyaltyProgramId, + string $balanceDefinitionId, + ?\Brevo\Client\Models\UpdateBalanceDefinitionPayload $updateBalanceDefinitionPayload = null, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut'][0] + ): array + { + $request = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPutRequest($loyaltyProgramId, $balanceDefinitionId, $updateBalanceDefinitionPayload, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\BalanceDefinition', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BalanceDefinition' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BalanceDefinition', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ValidationError', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ValidationError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ValidationError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\BalanceDefinition'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BalanceDefinition', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ValidationError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPutAsync + * + * Update balance definition + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param \Brevo\Client\Models\UpdateBalanceDefinitionPayload|null $updateBalanceDefinitionPayload Balance definition information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPutAsync( + string $loyaltyProgramId, + string $balanceDefinitionId, + ?\Brevo\Client\Models\UpdateBalanceDefinitionPayload $updateBalanceDefinitionPayload = null, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut'][0] + ): PromiseInterface + { + return $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPutAsyncWithHttpInfo($loyaltyProgramId, $balanceDefinitionId, $updateBalanceDefinitionPayload, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPutAsyncWithHttpInfo + * + * Update balance definition + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param \Brevo\Client\Models\UpdateBalanceDefinitionPayload|null $updateBalanceDefinitionPayload Balance definition information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPutAsyncWithHttpInfo( + $loyaltyProgramId, + $balanceDefinitionId, + $updateBalanceDefinitionPayload = null, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\BalanceDefinition'; + $request = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPutRequest($loyaltyProgramId, $balanceDefinitionId, $updateBalanceDefinitionPayload, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $balanceDefinitionId Balance Definition Id (required) + * @param \Brevo\Client\Models\UpdateBalanceDefinitionPayload|null $updateBalanceDefinitionPayload Balance definition information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPutRequest( + $loyaltyProgramId, + $balanceDefinitionId, + $updateBalanceDefinitionPayload = null, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut' + ); + } + + // verify the required parameter 'balanceDefinitionId' is set + if ($balanceDefinitionId === null || (is_array($balanceDefinitionId) && count($balanceDefinitionId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $balanceDefinitionId when calling loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsBalanceDefinitionIdPut' + ); + } + + + + $resourcePath = '/loyalty/balance/programs/{loyaltyProgramId}/balance-definitions/{balanceDefinitionId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + // path params + if ($balanceDefinitionId !== null) { + $resourcePath = str_replace( + '{' . 'balanceDefinitionId' . '}', + ObjectSerializer::toPathValue($balanceDefinitionId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($updateBalanceDefinitionPayload)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($updateBalanceDefinitionPayload)); + } else { + $httpBody = $updateBalanceDefinitionPayload; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost + * + * Create balance definition + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateBalanceDefinitionPayload $createBalanceDefinitionPayload Balance definition information (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\BalanceDefinition|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost( + string $loyaltyProgramId, + \Brevo\Client\Models\CreateBalanceDefinitionPayload $createBalanceDefinitionPayload, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost'][0] + ): \Brevo\Client\Models\BalanceDefinition + { + list($response) = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPostWithHttpInfo($loyaltyProgramId, $createBalanceDefinitionPayload, $contentType); + return $response; + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPostWithHttpInfo + * + * Create balance definition + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateBalanceDefinitionPayload $createBalanceDefinitionPayload Balance definition information (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\BalanceDefinition|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError, HTTP status code, HTTP response headers (array of strings) + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPostWithHttpInfo( + string $loyaltyProgramId, + \Brevo\Client\Models\CreateBalanceDefinitionPayload $createBalanceDefinitionPayload, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost'][0] + ): array + { + $request = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPostRequest($loyaltyProgramId, $createBalanceDefinitionPayload, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\BalanceDefinition', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BalanceDefinition' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BalanceDefinition', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ValidationError', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ValidationError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ValidationError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\BalanceDefinition'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BalanceDefinition', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ValidationError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPostAsync + * + * Create balance definition + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateBalanceDefinitionPayload $createBalanceDefinitionPayload Balance definition information (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPostAsync( + string $loyaltyProgramId, + \Brevo\Client\Models\CreateBalanceDefinitionPayload $createBalanceDefinitionPayload, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost'][0] + ): PromiseInterface + { + return $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPostAsyncWithHttpInfo($loyaltyProgramId, $createBalanceDefinitionPayload, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPostAsyncWithHttpInfo + * + * Create balance definition + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateBalanceDefinitionPayload $createBalanceDefinitionPayload Balance definition information (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPostAsyncWithHttpInfo( + $loyaltyProgramId, + $createBalanceDefinitionPayload, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\BalanceDefinition'; + $request = $this->loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPostRequest($loyaltyProgramId, $createBalanceDefinitionPayload, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateBalanceDefinitionPayload $createBalanceDefinitionPayload Balance definition information (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPostRequest( + $loyaltyProgramId, + $createBalanceDefinitionPayload, + string $contentType = self::contentTypes['loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost' + ); + } + + // verify the required parameter 'createBalanceDefinitionPayload' is set + if ($createBalanceDefinitionPayload === null || (is_array($createBalanceDefinitionPayload) && count($createBalanceDefinitionPayload) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $createBalanceDefinitionPayload when calling loyaltyBalanceProgramsLoyaltyProgramIdBalanceDefinitionsPost' + ); + } + + + $resourcePath = '/loyalty/balance/programs/{loyaltyProgramId}/balance-definitions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($createBalanceDefinitionPayload)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createBalanceDefinitionPayload)); + } else { + $httpBody = $createBalanceDefinitionPayload; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $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/CRMApi.php b/lib/Api/CRMApi.php deleted file mode 100644 index dd67b49..0000000 --- a/lib/Api/CRMApi.php +++ /dev/null @@ -1,3306 +0,0 @@ -client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation crmNotesGet - * - * Get all notes - * - * @param string $entity Filter by note entity type (optional) - * @param string $entityIds Filter by note entity IDs (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\NoteList - */ - public function crmNotesGet($entity = null, $entityIds = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null) - { - list($response) = $this->crmNotesGetWithHttpInfo($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort); - return $response; - } - - /** - * Operation crmNotesGetWithHttpInfo - * - * Get all notes - * - * @param string $entity Filter by note entity type (optional) - * @param string $entityIds Filter by note entity IDs (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\NoteList, HTTP status code, HTTP response headers (array of strings) - */ - public function crmNotesGetWithHttpInfo($entity = null, $entityIds = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null) - { - $returnType = '\Brevo\Client\Model\NoteList'; - $request = $this->crmNotesGetRequest($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort); - - 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(), - '\Brevo\Client\Model\NoteList', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation crmNotesGetAsync - * - * Get all notes - * - * @param string $entity Filter by note entity type (optional) - * @param string $entityIds Filter by note entity IDs (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmNotesGetAsync($entity = null, $entityIds = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null) - { - return $this->crmNotesGetAsyncWithHttpInfo($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation crmNotesGetAsyncWithHttpInfo - * - * Get all notes - * - * @param string $entity Filter by note entity type (optional) - * @param string $entityIds Filter by note entity IDs (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmNotesGetAsyncWithHttpInfo($entity = null, $entityIds = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null) - { - $returnType = '\Brevo\Client\Model\NoteList'; - $request = $this->crmNotesGetRequest($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort); - - 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 'crmNotesGet' - * - * @param string $entity Filter by note entity type (optional) - * @param string $entityIds Filter by note entity IDs (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function crmNotesGetRequest($entity = null, $entityIds = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null) - { - - $resourcePath = '/crm/notes'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($entity !== null) { - $queryParams['entity'] = ObjectSerializer::toQueryValue($entity); - } - // query params - if ($entityIds !== null) { - $queryParams['entityIds'] = ObjectSerializer::toQueryValue($entityIds); - } - // query params - if ($dateFrom !== null) { - $queryParams['dateFrom'] = ObjectSerializer::toQueryValue($dateFrom); - } - // query params - if ($dateTo !== null) { - $queryParams['dateTo'] = ObjectSerializer::toQueryValue($dateTo); - } - // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } - // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } - // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } - - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation crmNotesIdDelete - * - * Delete a note - * - * @param string $id Note ID to delete (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function crmNotesIdDelete($id) - { - $this->crmNotesIdDeleteWithHttpInfo($id); - } - - /** - * Operation crmNotesIdDeleteWithHttpInfo - * - * Delete a note - * - * @param string $id Note ID to delete (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function crmNotesIdDeleteWithHttpInfo($id) - { - $returnType = ''; - $request = $this->crmNotesIdDeleteRequest($id); - - 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(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation crmNotesIdDeleteAsync - * - * Delete a note - * - * @param string $id Note ID to delete (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmNotesIdDeleteAsync($id) - { - return $this->crmNotesIdDeleteAsyncWithHttpInfo($id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation crmNotesIdDeleteAsyncWithHttpInfo - * - * Delete a note - * - * @param string $id Note ID to delete (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmNotesIdDeleteAsyncWithHttpInfo($id) - { - $returnType = ''; - $request = $this->crmNotesIdDeleteRequest($id); - - 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 'crmNotesIdDelete' - * - * @param string $id Note ID to delete (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function crmNotesIdDeleteRequest($id) - { - // verify the required parameter 'id' is set - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling crmNotesIdDelete' - ); - } - - $resourcePath = '/crm/notes/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation crmNotesIdGet - * - * Get a note - * - * @param string $id Note ID to get (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\Note - */ - public function crmNotesIdGet($id) - { - list($response) = $this->crmNotesIdGetWithHttpInfo($id); - return $response; - } - - /** - * Operation crmNotesIdGetWithHttpInfo - * - * Get a note - * - * @param string $id Note ID to get (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\Note, HTTP status code, HTTP response headers (array of strings) - */ - public function crmNotesIdGetWithHttpInfo($id) - { - $returnType = '\Brevo\Client\Model\Note'; - $request = $this->crmNotesIdGetRequest($id); - - 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(), - '\Brevo\Client\Model\Note', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation crmNotesIdGetAsync - * - * Get a note - * - * @param string $id Note ID to get (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmNotesIdGetAsync($id) - { - return $this->crmNotesIdGetAsyncWithHttpInfo($id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation crmNotesIdGetAsyncWithHttpInfo - * - * Get a note - * - * @param string $id Note ID to get (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmNotesIdGetAsyncWithHttpInfo($id) - { - $returnType = '\Brevo\Client\Model\Note'; - $request = $this->crmNotesIdGetRequest($id); - - 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 'crmNotesIdGet' - * - * @param string $id Note ID to get (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function crmNotesIdGetRequest($id) - { - // verify the required parameter 'id' is set - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling crmNotesIdGet' - ); - } - - $resourcePath = '/crm/notes/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation crmNotesIdPatch - * - * Update a note - * - * @param string $id Note ID to update (required) - * @param \Brevo\Client\Model\NoteData $body Note data to update a note (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function crmNotesIdPatch($id, $body) - { - $this->crmNotesIdPatchWithHttpInfo($id, $body); - } - - /** - * Operation crmNotesIdPatchWithHttpInfo - * - * Update a note - * - * @param string $id Note ID to update (required) - * @param \Brevo\Client\Model\NoteData $body Note data to update a note (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function crmNotesIdPatchWithHttpInfo($id, $body) - { - $returnType = ''; - $request = $this->crmNotesIdPatchRequest($id, $body); - - 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(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 415: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation crmNotesIdPatchAsync - * - * Update a note - * - * @param string $id Note ID to update (required) - * @param \Brevo\Client\Model\NoteData $body Note data to update a note (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmNotesIdPatchAsync($id, $body) - { - return $this->crmNotesIdPatchAsyncWithHttpInfo($id, $body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation crmNotesIdPatchAsyncWithHttpInfo - * - * Update a note - * - * @param string $id Note ID to update (required) - * @param \Brevo\Client\Model\NoteData $body Note data to update a note (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmNotesIdPatchAsyncWithHttpInfo($id, $body) - { - $returnType = ''; - $request = $this->crmNotesIdPatchRequest($id, $body); - - 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 'crmNotesIdPatch' - * - * @param string $id Note ID to update (required) - * @param \Brevo\Client\Model\NoteData $body Note data to update a note (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function crmNotesIdPatchRequest($id, $body) - { - // verify the required parameter 'id' is set - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling crmNotesIdPatch' - ); - } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling crmNotesIdPatch' - ); - } - - $resourcePath = '/crm/notes/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'PATCH', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation crmNotesPost - * - * Create a note - * - * @param \Brevo\Client\Model\NoteData $body Note data to create a note. (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\NoteId - */ - public function crmNotesPost($body) - { - list($response) = $this->crmNotesPostWithHttpInfo($body); - return $response; - } - - /** - * Operation crmNotesPostWithHttpInfo - * - * Create a note - * - * @param \Brevo\Client\Model\NoteData $body Note data to create a note. (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\NoteId, HTTP status code, HTTP response headers (array of strings) - */ - public function crmNotesPostWithHttpInfo($body) - { - $returnType = '\Brevo\Client\Model\NoteId'; - $request = $this->crmNotesPostRequest($body); - - 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(), - '\Brevo\Client\Model\NoteId', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 415: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation crmNotesPostAsync - * - * Create a note - * - * @param \Brevo\Client\Model\NoteData $body Note data to create a note. (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmNotesPostAsync($body) - { - return $this->crmNotesPostAsyncWithHttpInfo($body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation crmNotesPostAsyncWithHttpInfo - * - * Create a note - * - * @param \Brevo\Client\Model\NoteData $body Note data to create a note. (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmNotesPostAsyncWithHttpInfo($body) - { - $returnType = '\Brevo\Client\Model\NoteId'; - $request = $this->crmNotesPostRequest($body); - - 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 'crmNotesPost' - * - * @param \Brevo\Client\Model\NoteData $body Note data to create a note. (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function crmNotesPostRequest($body) - { - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling crmNotesPost' - ); - } - - $resourcePath = '/crm/notes'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation crmTasksGet - * - * Get all tasks - * - * @param string $filterType Filter by task type (ID) (optional) - * @param string $filterStatus Filter by task status (optional) - * @param string $filterDate Filter by date (optional) - * @param string $filterAssignTo Filter by assignTo id (optional) - * @param string $filterContacts Filter by contact ids (optional) - * @param string $filterDeals Filter by deals ids (optional) - * @param string $filterCompanies Filter by companies ids (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * @param string $sortBy The field used to sort field names. (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\TaskList - */ - public function crmTasksGet($filterType = null, $filterStatus = null, $filterDate = null, $filterAssignTo = null, $filterContacts = null, $filterDeals = null, $filterCompanies = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null, $sortBy = null) - { - list($response) = $this->crmTasksGetWithHttpInfo($filterType, $filterStatus, $filterDate, $filterAssignTo, $filterContacts, $filterDeals, $filterCompanies, $dateFrom, $dateTo, $offset, $limit, $sort, $sortBy); - return $response; - } - - /** - * Operation crmTasksGetWithHttpInfo - * - * Get all tasks - * - * @param string $filterType Filter by task type (ID) (optional) - * @param string $filterStatus Filter by task status (optional) - * @param string $filterDate Filter by date (optional) - * @param string $filterAssignTo Filter by assignTo id (optional) - * @param string $filterContacts Filter by contact ids (optional) - * @param string $filterDeals Filter by deals ids (optional) - * @param string $filterCompanies Filter by companies ids (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * @param string $sortBy The field used to sort field names. (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\TaskList, HTTP status code, HTTP response headers (array of strings) - */ - public function crmTasksGetWithHttpInfo($filterType = null, $filterStatus = null, $filterDate = null, $filterAssignTo = null, $filterContacts = null, $filterDeals = null, $filterCompanies = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null, $sortBy = null) - { - $returnType = '\Brevo\Client\Model\TaskList'; - $request = $this->crmTasksGetRequest($filterType, $filterStatus, $filterDate, $filterAssignTo, $filterContacts, $filterDeals, $filterCompanies, $dateFrom, $dateTo, $offset, $limit, $sort, $sortBy); - - 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(), - '\Brevo\Client\Model\TaskList', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation crmTasksGetAsync - * - * Get all tasks - * - * @param string $filterType Filter by task type (ID) (optional) - * @param string $filterStatus Filter by task status (optional) - * @param string $filterDate Filter by date (optional) - * @param string $filterAssignTo Filter by assignTo id (optional) - * @param string $filterContacts Filter by contact ids (optional) - * @param string $filterDeals Filter by deals ids (optional) - * @param string $filterCompanies Filter by companies ids (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * @param string $sortBy The field used to sort field names. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmTasksGetAsync($filterType = null, $filterStatus = null, $filterDate = null, $filterAssignTo = null, $filterContacts = null, $filterDeals = null, $filterCompanies = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null, $sortBy = null) - { - return $this->crmTasksGetAsyncWithHttpInfo($filterType, $filterStatus, $filterDate, $filterAssignTo, $filterContacts, $filterDeals, $filterCompanies, $dateFrom, $dateTo, $offset, $limit, $sort, $sortBy) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation crmTasksGetAsyncWithHttpInfo - * - * Get all tasks - * - * @param string $filterType Filter by task type (ID) (optional) - * @param string $filterStatus Filter by task status (optional) - * @param string $filterDate Filter by date (optional) - * @param string $filterAssignTo Filter by assignTo id (optional) - * @param string $filterContacts Filter by contact ids (optional) - * @param string $filterDeals Filter by deals ids (optional) - * @param string $filterCompanies Filter by companies ids (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * @param string $sortBy The field used to sort field names. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmTasksGetAsyncWithHttpInfo($filterType = null, $filterStatus = null, $filterDate = null, $filterAssignTo = null, $filterContacts = null, $filterDeals = null, $filterCompanies = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null, $sortBy = null) - { - $returnType = '\Brevo\Client\Model\TaskList'; - $request = $this->crmTasksGetRequest($filterType, $filterStatus, $filterDate, $filterAssignTo, $filterContacts, $filterDeals, $filterCompanies, $dateFrom, $dateTo, $offset, $limit, $sort, $sortBy); - - 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 'crmTasksGet' - * - * @param string $filterType Filter by task type (ID) (optional) - * @param string $filterStatus Filter by task status (optional) - * @param string $filterDate Filter by date (optional) - * @param string $filterAssignTo Filter by assignTo id (optional) - * @param string $filterContacts Filter by contact ids (optional) - * @param string $filterDeals Filter by deals ids (optional) - * @param string $filterCompanies Filter by companies ids (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * @param string $sortBy The field used to sort field names. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function crmTasksGetRequest($filterType = null, $filterStatus = null, $filterDate = null, $filterAssignTo = null, $filterContacts = null, $filterDeals = null, $filterCompanies = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null, $sortBy = null) - { - - $resourcePath = '/crm/tasks'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($filterType !== null) { - $queryParams['filter[type]'] = ObjectSerializer::toQueryValue($filterType); - } - // query params - if ($filterStatus !== null) { - $queryParams['filter[status]'] = ObjectSerializer::toQueryValue($filterStatus); - } - // query params - if ($filterDate !== null) { - $queryParams['filter[date]'] = ObjectSerializer::toQueryValue($filterDate); - } - // query params - if ($filterAssignTo !== null) { - $queryParams['filter[assignTo]'] = ObjectSerializer::toQueryValue($filterAssignTo); - } - // query params - if ($filterContacts !== null) { - $queryParams['filter[contacts]'] = ObjectSerializer::toQueryValue($filterContacts); - } - // query params - if ($filterDeals !== null) { - $queryParams['filter[deals]'] = ObjectSerializer::toQueryValue($filterDeals); - } - // query params - if ($filterCompanies !== null) { - $queryParams['filter[companies]'] = ObjectSerializer::toQueryValue($filterCompanies); - } - // query params - if ($dateFrom !== null) { - $queryParams['dateFrom'] = ObjectSerializer::toQueryValue($dateFrom); - } - // query params - if ($dateTo !== null) { - $queryParams['dateTo'] = ObjectSerializer::toQueryValue($dateTo); - } - // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } - // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } - // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } - // query params - if ($sortBy !== null) { - $queryParams['sortBy'] = ObjectSerializer::toQueryValue($sortBy); - } - - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation crmTasksIdDelete - * - * Delete a task - * - * @param string $id id (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function crmTasksIdDelete($id) - { - $this->crmTasksIdDeleteWithHttpInfo($id); - } - - /** - * Operation crmTasksIdDeleteWithHttpInfo - * - * Delete a task - * - * @param string $id (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function crmTasksIdDeleteWithHttpInfo($id) - { - $returnType = ''; - $request = $this->crmTasksIdDeleteRequest($id); - - 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(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation crmTasksIdDeleteAsync - * - * Delete a task - * - * @param string $id (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmTasksIdDeleteAsync($id) - { - return $this->crmTasksIdDeleteAsyncWithHttpInfo($id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation crmTasksIdDeleteAsyncWithHttpInfo - * - * Delete a task - * - * @param string $id (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmTasksIdDeleteAsyncWithHttpInfo($id) - { - $returnType = ''; - $request = $this->crmTasksIdDeleteRequest($id); - - 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 'crmTasksIdDelete' - * - * @param string $id (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function crmTasksIdDeleteRequest($id) - { - // verify the required parameter 'id' is set - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling crmTasksIdDelete' - ); - } - - $resourcePath = '/crm/tasks/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation crmTasksIdGet - * - * Get a task - * - * @param string $id id (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\Task - */ - public function crmTasksIdGet($id) - { - list($response) = $this->crmTasksIdGetWithHttpInfo($id); - return $response; - } - - /** - * Operation crmTasksIdGetWithHttpInfo - * - * Get a task - * - * @param string $id (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\Task, HTTP status code, HTTP response headers (array of strings) - */ - public function crmTasksIdGetWithHttpInfo($id) - { - $returnType = '\Brevo\Client\Model\Task'; - $request = $this->crmTasksIdGetRequest($id); - - 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(), - '\Brevo\Client\Model\Task', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation crmTasksIdGetAsync - * - * Get a task - * - * @param string $id (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmTasksIdGetAsync($id) - { - return $this->crmTasksIdGetAsyncWithHttpInfo($id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation crmTasksIdGetAsyncWithHttpInfo - * - * Get a task - * - * @param string $id (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmTasksIdGetAsyncWithHttpInfo($id) - { - $returnType = '\Brevo\Client\Model\Task'; - $request = $this->crmTasksIdGetRequest($id); - - 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 'crmTasksIdGet' - * - * @param string $id (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function crmTasksIdGetRequest($id) - { - // verify the required parameter 'id' is set - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling crmTasksIdGet' - ); - } - - $resourcePath = '/crm/tasks/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation crmTasksIdPatch - * - * Update a task - * - * @param string $id id (required) - * @param \Brevo\Client\Model\Body1 $body Updated task details. (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function crmTasksIdPatch($id, $body) - { - $this->crmTasksIdPatchWithHttpInfo($id, $body); - } - - /** - * Operation crmTasksIdPatchWithHttpInfo - * - * Update a task - * - * @param string $id (required) - * @param \Brevo\Client\Model\Body1 $body Updated task details. (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function crmTasksIdPatchWithHttpInfo($id, $body) - { - $returnType = ''; - $request = $this->crmTasksIdPatchRequest($id, $body); - - 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(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation crmTasksIdPatchAsync - * - * Update a task - * - * @param string $id (required) - * @param \Brevo\Client\Model\Body1 $body Updated task details. (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmTasksIdPatchAsync($id, $body) - { - return $this->crmTasksIdPatchAsyncWithHttpInfo($id, $body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation crmTasksIdPatchAsyncWithHttpInfo - * - * Update a task - * - * @param string $id (required) - * @param \Brevo\Client\Model\Body1 $body Updated task details. (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmTasksIdPatchAsyncWithHttpInfo($id, $body) - { - $returnType = ''; - $request = $this->crmTasksIdPatchRequest($id, $body); - - 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 'crmTasksIdPatch' - * - * @param string $id (required) - * @param \Brevo\Client\Model\Body1 $body Updated task details. (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function crmTasksIdPatchRequest($id, $body) - { - // verify the required parameter 'id' is set - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling crmTasksIdPatch' - ); - } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling crmTasksIdPatch' - ); - } - - $resourcePath = '/crm/tasks/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'PATCH', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation crmTasksPost - * - * Create a task - * - * @param \Brevo\Client\Model\Body $body Task name. (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\InlineResponse201 - */ - public function crmTasksPost($body) - { - list($response) = $this->crmTasksPostWithHttpInfo($body); - return $response; - } - - /** - * Operation crmTasksPostWithHttpInfo - * - * Create a task - * - * @param \Brevo\Client\Model\Body $body Task name. (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\InlineResponse201, HTTP status code, HTTP response headers (array of strings) - */ - public function crmTasksPostWithHttpInfo($body) - { - $returnType = '\Brevo\Client\Model\InlineResponse201'; - $request = $this->crmTasksPostRequest($body); - - 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(), - '\Brevo\Client\Model\InlineResponse201', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation crmTasksPostAsync - * - * Create a task - * - * @param \Brevo\Client\Model\Body $body Task name. (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmTasksPostAsync($body) - { - return $this->crmTasksPostAsyncWithHttpInfo($body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation crmTasksPostAsyncWithHttpInfo - * - * Create a task - * - * @param \Brevo\Client\Model\Body $body Task name. (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmTasksPostAsyncWithHttpInfo($body) - { - $returnType = '\Brevo\Client\Model\InlineResponse201'; - $request = $this->crmTasksPostRequest($body); - - 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 'crmTasksPost' - * - * @param \Brevo\Client\Model\Body $body Task name. (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function crmTasksPostRequest($body) - { - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling crmTasksPost' - ); - } - - $resourcePath = '/crm/tasks'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation crmTasktypesGet - * - * Get all task types - * - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\TaskTypes - */ - public function crmTasktypesGet() - { - list($response) = $this->crmTasktypesGetWithHttpInfo(); - return $response; - } - - /** - * Operation crmTasktypesGetWithHttpInfo - * - * Get all task types - * - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\TaskTypes, HTTP status code, HTTP response headers (array of strings) - */ - public function crmTasktypesGetWithHttpInfo() - { - $returnType = '\Brevo\Client\Model\TaskTypes'; - $request = $this->crmTasktypesGetRequest(); - - 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(), - '\Brevo\Client\Model\TaskTypes', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation crmTasktypesGetAsync - * - * Get all task types - * - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmTasktypesGetAsync() - { - return $this->crmTasktypesGetAsyncWithHttpInfo() - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation crmTasktypesGetAsyncWithHttpInfo - * - * Get all task types - * - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function crmTasktypesGetAsyncWithHttpInfo() - { - $returnType = '\Brevo\Client\Model\TaskTypes'; - $request = $this->crmTasktypesGetRequest(); - - 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 'crmTasktypesGet' - * - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function crmTasktypesGetRequest() - { - - $resourcePath = '/crm/tasktypes'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $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)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($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/CompaniesApi.php b/lib/Api/CompaniesApi.php index e2216dd..4d0af6f 100644 --- a/lib/Api/CompaniesApi.php +++ b/lib/Api/CompaniesApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'companiesGet' => [ + 'application/json', + ], + 'companiesIdDelete' => [ + 'application/json', + ], + 'companiesIdGet' => [ + 'application/json', + ], + 'companiesIdPatch' => [ + 'application/json', + ], + 'companiesImportPost' => [ + 'multipart/form-data', + ], + 'companiesLinkUnlinkIdPatch' => [ + 'application/json', + ], + 'companiesPost' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -92,14 +149,17 @@ public function getConfig() * * Get company attributes * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesAttributesGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CompanyAttributes + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CompanyAttributesInner[] */ - public function companiesAttributesGet() + public function companiesAttributesGet( + string $contentType = self::contentTypes['companiesAttributesGet'][0] + ): array { - list($response) = $this->companiesAttributesGetWithHttpInfo(); + list($response) = $this->companiesAttributesGetWithHttpInfo($contentType); return $response; } @@ -108,15 +168,17 @@ public function companiesAttributesGet() * * Get company attributes * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesAttributesGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CompanyAttributes, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CompanyAttributesInner[], HTTP status code, HTTP response headers (array of strings) */ - public function companiesAttributesGetWithHttpInfo() + public function companiesAttributesGetWithHttpInfo( + string $contentType = self::contentTypes['companiesAttributesGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\CompanyAttributes'; - $request = $this->companiesAttributesGetRequest(); + $request = $this->companiesAttributesGetRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -125,34 +187,84 @@ public function companiesAttributesGetWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\CompanyAttributesInner[]', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CompanyAttributesInner[]' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CompanyAttributesInner[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CompanyAttributesInner[]'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -167,7 +279,7 @@ public function companiesAttributesGetWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CompanyAttributes', + '\Brevo\Client\Models\CompanyAttributesInner[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -182,13 +294,16 @@ public function companiesAttributesGetWithHttpInfo() * * Get company attributes * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesAttributesGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function companiesAttributesGetAsync() + public function companiesAttributesGetAsync( + string $contentType = self::contentTypes['companiesAttributesGet'][0] + ): PromiseInterface { - return $this->companiesAttributesGetAsyncWithHttpInfo() + return $this->companiesAttributesGetAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -201,24 +316,27 @@ function ($response) { * * Get company attributes * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesAttributesGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function companiesAttributesGetAsyncWithHttpInfo() + public function companiesAttributesGetAsyncWithHttpInfo( + string $contentType = self::contentTypes['companiesAttributesGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CompanyAttributes'; - $request = $this->companiesAttributesGetRequest(); + $returnType = '\Brevo\Client\Models\CompanyAttributesInner[]'; + $request = $this->companiesAttributesGetRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -241,7 +359,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -250,13 +368,17 @@ function ($exception) { /** * Create request for operation 'companiesAttributesGet' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesAttributesGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function companiesAttributesGetRequest() + public function companiesAttributesGetRequest( + string $contentType = self::contentTypes['companiesAttributesGet'][0] + ): Request { + $resourcePath = '/companies/attributes'; $formParams = []; $queryParams = []; @@ -266,53 +388,36 @@ protected function companiesAttributesGetRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -338,10 +443,11 @@ protected function companiesAttributesGetRequest() $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -350,47 +456,66 @@ protected function companiesAttributesGetRequest() /** * Operation companiesGet * - * Get all companies + * Get all Companies * - * @param string $filters Filter by attrbutes. If you have filter for owner on your side please send it as {\"attributes.owner\":\"5b1a17d914b73d35a76ca0c7\"} (optional) - * @param int $linkedContactsIds Filter by linked contacts ids (optional) - * @param string $linkedDealsIds Filter by linked deals ids (optional) - * @param int $page Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * @param string $sortBy The field used to sort field names. (optional) + * @param string|null $filters Filter by attrbutes. If you have filter for owner on your side please send it as {\"attributes.owner\":\"6299dcf3874a14eacbc65c46\"} (optional) + * @param int|null $linkedContactsIds Filter by linked contacts ids (optional) + * @param string|null $linkedDealsIds Filter by linked Deals ids (optional) + * @param int|null $page Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string|null $sortBy The field used to sort field names. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CompaniesList + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CompaniesList|\Brevo\Client\Models\ErrorModel */ - public function companiesGet($filters = null, $linkedContactsIds = null, $linkedDealsIds = null, $page = null, $limit = '50', $sort = null, $sortBy = null) + public function companiesGet( + ?string $filters = null, + ?int $linkedContactsIds = null, + ?string $linkedDealsIds = null, + ?int $page = null, + ?int $limit = null, + ?string $sort = null, + ?string $sortBy = null, + string $contentType = self::contentTypes['companiesGet'][0] + ): \Brevo\Client\Models\CompaniesList { - list($response) = $this->companiesGetWithHttpInfo($filters, $linkedContactsIds, $linkedDealsIds, $page, $limit, $sort, $sortBy); + list($response) = $this->companiesGetWithHttpInfo($filters, $linkedContactsIds, $linkedDealsIds, $page, $limit, $sort, $sortBy, $contentType); return $response; } /** * Operation companiesGetWithHttpInfo * - * Get all companies + * Get all Companies * - * @param string $filters Filter by attrbutes. If you have filter for owner on your side please send it as {\"attributes.owner\":\"5b1a17d914b73d35a76ca0c7\"} (optional) - * @param int $linkedContactsIds Filter by linked contacts ids (optional) - * @param string $linkedDealsIds Filter by linked deals ids (optional) - * @param int $page Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * @param string $sortBy The field used to sort field names. (optional) + * @param string|null $filters Filter by attrbutes. If you have filter for owner on your side please send it as {\"attributes.owner\":\"6299dcf3874a14eacbc65c46\"} (optional) + * @param int|null $linkedContactsIds Filter by linked contacts ids (optional) + * @param string|null $linkedDealsIds Filter by linked Deals ids (optional) + * @param int|null $page Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string|null $sortBy The field used to sort field names. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CompaniesList, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CompaniesList|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function companiesGetWithHttpInfo($filters = null, $linkedContactsIds = null, $linkedDealsIds = null, $page = null, $limit = '50', $sort = null, $sortBy = null) + public function companiesGetWithHttpInfo( + ?string $filters = null, + ?int $linkedContactsIds = null, + ?string $linkedDealsIds = null, + ?int $page = null, + ?int $limit = null, + ?string $sort = null, + ?string $sortBy = null, + string $contentType = self::contentTypes['companiesGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\CompaniesList'; - $request = $this->companiesGetRequest($filters, $linkedContactsIds, $linkedDealsIds, $page, $limit, $sort, $sortBy); + $request = $this->companiesGetRequest($filters, $linkedContactsIds, $linkedDealsIds, $page, $limit, $sort, $sortBy, $contentType); try { $options = $this->createHttpClientOption(); @@ -399,34 +524,111 @@ public function companiesGetWithHttpInfo($filters = null, $linkedContactsIds = n } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\CompaniesList', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CompaniesList' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CompaniesList', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CompaniesList'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -441,7 +643,7 @@ public function companiesGetWithHttpInfo($filters = null, $linkedContactsIds = n case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CompaniesList', + '\Brevo\Client\Models\CompaniesList', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -449,7 +651,7 @@ public function companiesGetWithHttpInfo($filters = null, $linkedContactsIds = n case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -462,22 +664,32 @@ public function companiesGetWithHttpInfo($filters = null, $linkedContactsIds = n /** * Operation companiesGetAsync * - * Get all companies + * Get all Companies * - * @param string $filters Filter by attrbutes. If you have filter for owner on your side please send it as {\"attributes.owner\":\"5b1a17d914b73d35a76ca0c7\"} (optional) - * @param int $linkedContactsIds Filter by linked contacts ids (optional) - * @param string $linkedDealsIds Filter by linked deals ids (optional) - * @param int $page Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * @param string $sortBy The field used to sort field names. (optional) + * @param string|null $filters Filter by attrbutes. If you have filter for owner on your side please send it as {\"attributes.owner\":\"6299dcf3874a14eacbc65c46\"} (optional) + * @param int|null $linkedContactsIds Filter by linked contacts ids (optional) + * @param string|null $linkedDealsIds Filter by linked Deals ids (optional) + * @param int|null $page Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string|null $sortBy The field used to sort field names. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function companiesGetAsync($filters = null, $linkedContactsIds = null, $linkedDealsIds = null, $page = null, $limit = '50', $sort = null, $sortBy = null) + public function companiesGetAsync( + ?string $filters = null, + ?int $linkedContactsIds = null, + ?string $linkedDealsIds = null, + ?int $page = null, + ?int $limit = null, + ?string $sort = null, + ?string $sortBy = null, + string $contentType = self::contentTypes['companiesGet'][0] + ): PromiseInterface { - return $this->companiesGetAsyncWithHttpInfo($filters, $linkedContactsIds, $linkedDealsIds, $page, $limit, $sort, $sortBy) + return $this->companiesGetAsyncWithHttpInfo($filters, $linkedContactsIds, $linkedDealsIds, $page, $limit, $sort, $sortBy, $contentType) ->then( function ($response) { return $response[0]; @@ -488,33 +700,43 @@ function ($response) { /** * Operation companiesGetAsyncWithHttpInfo * - * Get all companies + * Get all Companies * - * @param string $filters Filter by attrbutes. If you have filter for owner on your side please send it as {\"attributes.owner\":\"5b1a17d914b73d35a76ca0c7\"} (optional) - * @param int $linkedContactsIds Filter by linked contacts ids (optional) - * @param string $linkedDealsIds Filter by linked deals ids (optional) - * @param int $page Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * @param string $sortBy The field used to sort field names. (optional) + * @param string|null $filters Filter by attrbutes. If you have filter for owner on your side please send it as {\"attributes.owner\":\"6299dcf3874a14eacbc65c46\"} (optional) + * @param int|null $linkedContactsIds Filter by linked contacts ids (optional) + * @param string|null $linkedDealsIds Filter by linked Deals ids (optional) + * @param int|null $page Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string|null $sortBy The field used to sort field names. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function companiesGetAsyncWithHttpInfo($filters = null, $linkedContactsIds = null, $linkedDealsIds = null, $page = null, $limit = '50', $sort = null, $sortBy = null) + public function companiesGetAsyncWithHttpInfo( + $filters = null, + $linkedContactsIds = null, + $linkedDealsIds = null, + $page = null, + $limit = null, + $sort = null, + $sortBy = null, + string $contentType = self::contentTypes['companiesGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CompaniesList'; - $request = $this->companiesGetRequest($filters, $linkedContactsIds, $linkedDealsIds, $page, $limit, $sort, $sortBy); + $returnType = '\Brevo\Client\Models\CompaniesList'; + $request = $this->companiesGetRequest($filters, $linkedContactsIds, $linkedDealsIds, $page, $limit, $sort, $sortBy, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -537,7 +759,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -546,20 +768,38 @@ function ($exception) { /** * Create request for operation 'companiesGet' * - * @param string $filters Filter by attrbutes. If you have filter for owner on your side please send it as {\"attributes.owner\":\"5b1a17d914b73d35a76ca0c7\"} (optional) - * @param int $linkedContactsIds Filter by linked contacts ids (optional) - * @param string $linkedDealsIds Filter by linked deals ids (optional) - * @param int $page Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * @param string $sortBy The field used to sort field names. (optional) + * @param string|null $filters Filter by attrbutes. If you have filter for owner on your side please send it as {\"attributes.owner\":\"6299dcf3874a14eacbc65c46\"} (optional) + * @param int|null $linkedContactsIds Filter by linked contacts ids (optional) + * @param string|null $linkedDealsIds Filter by linked Deals ids (optional) + * @param int|null $page Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string|null $sortBy The field used to sort field names. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function companiesGetRequest($filters = null, $linkedContactsIds = null, $linkedDealsIds = null, $page = null, $limit = '50', $sort = null, $sortBy = null) + public function companiesGetRequest( + $filters = null, + $linkedContactsIds = null, + $linkedDealsIds = null, + $page = null, + $limit = null, + $sort = null, + $sortBy = null, + string $contentType = self::contentTypes['companiesGet'][0] + ): Request { + + + + + + + + $resourcePath = '/companies'; $formParams = []; $queryParams = []; @@ -568,82 +808,100 @@ protected function companiesGetRequest($filters = null, $linkedContactsIds = nul $multipart = false; // query params - if ($filters !== null) { - $queryParams['filters'] = ObjectSerializer::toQueryValue($filters); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filters, + 'filters', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($linkedContactsIds !== null) { - $queryParams['linkedContactsIds'] = ObjectSerializer::toQueryValue($linkedContactsIds); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $linkedContactsIds, + 'linkedContactsIds', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($linkedDealsIds !== null) { - $queryParams['linkedDealsIds'] = ObjectSerializer::toQueryValue($linkedDealsIds); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $linkedDealsIds, + 'linkedDealsIds', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($page !== null) { - $queryParams['page'] = ObjectSerializer::toQueryValue($page); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sortBy !== null) { - $queryParams['sortBy'] = ObjectSerializer::toQueryValue($sortBy); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sortBy, + 'sortBy', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -669,10 +927,11 @@ protected function companiesGetRequest($filters = null, $linkedContactsIds = nul $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -683,15 +942,19 @@ protected function companiesGetRequest($filters = null, $linkedContactsIds = nul * * Delete a company * - * @param string $id id (required) + * @param string $id Company ID to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesIdDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function companiesIdDelete($id) + public function companiesIdDelete( + string $id, + string $contentType = self::contentTypes['companiesIdDelete'][0] + ): void { - $this->companiesIdDeleteWithHttpInfo($id); + $this->companiesIdDeleteWithHttpInfo($id, $contentType); } /** @@ -699,16 +962,19 @@ public function companiesIdDelete($id) * * Delete a company * - * @param string $id (required) + * @param string $id Company ID to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesIdDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function companiesIdDeleteWithHttpInfo($id) + public function companiesIdDeleteWithHttpInfo( + string $id, + string $contentType = self::contentTypes['companiesIdDelete'][0] + ): array { - $returnType = ''; - $request = $this->companiesIdDeleteRequest($id); + $request = $this->companiesIdDeleteRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -717,26 +983,21 @@ public function companiesIdDeleteWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -745,7 +1006,7 @@ public function companiesIdDeleteWithHttpInfo($id) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -753,7 +1014,7 @@ public function companiesIdDeleteWithHttpInfo($id) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -768,14 +1029,18 @@ public function companiesIdDeleteWithHttpInfo($id) * * Delete a company * - * @param string $id (required) + * @param string $id Company ID to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function companiesIdDeleteAsync($id) + public function companiesIdDeleteAsync( + string $id, + string $contentType = self::contentTypes['companiesIdDelete'][0] + ): PromiseInterface { - return $this->companiesIdDeleteAsyncWithHttpInfo($id) + return $this->companiesIdDeleteAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -788,15 +1053,20 @@ function ($response) { * * Delete a company * - * @param string $id (required) + * @param string $id Company ID to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function companiesIdDeleteAsyncWithHttpInfo($id) + public function companiesIdDeleteAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['companiesIdDelete'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->companiesIdDeleteRequest($id); + $request = $this->companiesIdDeleteRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -815,7 +1085,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -824,20 +1094,26 @@ function ($exception) { /** * Create request for operation 'companiesIdDelete' * - * @param string $id (required) + * @param string $id Company ID to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function companiesIdDeleteRequest($id) + public function companiesIdDeleteRequest( + $id, + string $contentType = self::contentTypes['companiesIdDelete'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling companiesIdDelete' ); } + $resourcePath = '/companies/{id}'; $formParams = []; $queryParams = []; @@ -846,6 +1122,7 @@ protected function companiesIdDeleteRequest($id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -855,53 +1132,35 @@ protected function companiesIdDeleteRequest($id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -927,10 +1186,11 @@ protected function companiesIdDeleteRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -941,15 +1201,19 @@ protected function companiesIdDeleteRequest($id) * * Get a company * - * @param string $id id (required) + * @param string $id Get Company Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesIdGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\Company + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\Company|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function companiesIdGet($id) + public function companiesIdGet( + string $id, + string $contentType = self::contentTypes['companiesIdGet'][0] + ): \Brevo\Client\Models\Company { - list($response) = $this->companiesIdGetWithHttpInfo($id); + list($response) = $this->companiesIdGetWithHttpInfo($id, $contentType); return $response; } @@ -958,16 +1222,19 @@ public function companiesIdGet($id) * * Get a company * - * @param string $id (required) + * @param string $id Get Company Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesIdGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\Company, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\Company|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function companiesIdGetWithHttpInfo($id) + public function companiesIdGetWithHttpInfo( + string $id, + string $contentType = self::contentTypes['companiesIdGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\Company'; - $request = $this->companiesIdGetRequest($id); + $request = $this->companiesIdGetRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -976,34 +1243,138 @@ public function companiesIdGetWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\Company', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\Company' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\Company', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\Company'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1018,7 +1389,7 @@ public function companiesIdGetWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\Company', + '\Brevo\Client\Models\Company', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1026,7 +1397,7 @@ public function companiesIdGetWithHttpInfo($id) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1034,7 +1405,7 @@ public function companiesIdGetWithHttpInfo($id) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1049,14 +1420,18 @@ public function companiesIdGetWithHttpInfo($id) * * Get a company * - * @param string $id (required) + * @param string $id Get Company Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function companiesIdGetAsync($id) + public function companiesIdGetAsync( + string $id, + string $contentType = self::contentTypes['companiesIdGet'][0] + ): PromiseInterface { - return $this->companiesIdGetAsyncWithHttpInfo($id) + return $this->companiesIdGetAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -1069,25 +1444,29 @@ function ($response) { * * Get a company * - * @param string $id (required) + * @param string $id Get Company Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function companiesIdGetAsyncWithHttpInfo($id) + public function companiesIdGetAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['companiesIdGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\Company'; - $request = $this->companiesIdGetRequest($id); + $returnType = '\Brevo\Client\Models\Company'; + $request = $this->companiesIdGetRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1110,7 +1489,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1119,20 +1498,26 @@ function ($exception) { /** * Create request for operation 'companiesIdGet' * - * @param string $id (required) + * @param string $id Get Company Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function companiesIdGetRequest($id) + public function companiesIdGetRequest( + $id, + string $contentType = self::contentTypes['companiesIdGet'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling companiesIdGet' ); } + $resourcePath = '/companies/{id}'; $formParams = []; $queryParams = []; @@ -1141,6 +1526,7 @@ protected function companiesIdGetRequest($id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1150,53 +1536,35 @@ protected function companiesIdGetRequest($id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1222,10 +1590,11 @@ protected function companiesIdGetRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1237,15 +1606,20 @@ protected function companiesIdGetRequest($id) * Update a company * * @param string $id id (required) - * @param \Brevo\Client\Model\Body3 $body Updated company details. (required) + * @param \Brevo\Client\Models\CompaniesIdPatchRequest $companiesIdPatchRequest Updated company details. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesIdPatch'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\Company + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\Company|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function companiesIdPatch($id, $body) + public function companiesIdPatch( + string $id, + \Brevo\Client\Models\CompaniesIdPatchRequest $companiesIdPatchRequest, + string $contentType = self::contentTypes['companiesIdPatch'][0] + ): \Brevo\Client\Models\Company { - list($response) = $this->companiesIdPatchWithHttpInfo($id, $body); + list($response) = $this->companiesIdPatchWithHttpInfo($id, $companiesIdPatchRequest, $contentType); return $response; } @@ -1255,16 +1629,20 @@ public function companiesIdPatch($id, $body) * Update a company * * @param string $id (required) - * @param \Brevo\Client\Model\Body3 $body Updated company details. (required) + * @param \Brevo\Client\Models\CompaniesIdPatchRequest $companiesIdPatchRequest Updated company details. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesIdPatch'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\Company, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\Company|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function companiesIdPatchWithHttpInfo($id, $body) + public function companiesIdPatchWithHttpInfo( + string $id, + \Brevo\Client\Models\CompaniesIdPatchRequest $companiesIdPatchRequest, + string $contentType = self::contentTypes['companiesIdPatch'][0] + ): array { - $returnType = '\Brevo\Client\Model\Company'; - $request = $this->companiesIdPatchRequest($id, $body); + $request = $this->companiesIdPatchRequest($id, $companiesIdPatchRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -1273,34 +1651,138 @@ public function companiesIdPatchWithHttpInfo($id, $body) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\Company', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\Company' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\Company', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\Company'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1315,7 +1797,7 @@ public function companiesIdPatchWithHttpInfo($id, $body) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\Company', + '\Brevo\Client\Models\Company', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1323,7 +1805,7 @@ public function companiesIdPatchWithHttpInfo($id, $body) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1331,7 +1813,7 @@ public function companiesIdPatchWithHttpInfo($id, $body) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1347,14 +1829,19 @@ public function companiesIdPatchWithHttpInfo($id, $body) * Update a company * * @param string $id (required) - * @param \Brevo\Client\Model\Body3 $body Updated company details. (required) + * @param \Brevo\Client\Models\CompaniesIdPatchRequest $companiesIdPatchRequest Updated company details. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesIdPatch'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function companiesIdPatchAsync($id, $body) + public function companiesIdPatchAsync( + string $id, + \Brevo\Client\Models\CompaniesIdPatchRequest $companiesIdPatchRequest, + string $contentType = self::contentTypes['companiesIdPatch'][0] + ): PromiseInterface { - return $this->companiesIdPatchAsyncWithHttpInfo($id, $body) + return $this->companiesIdPatchAsyncWithHttpInfo($id, $companiesIdPatchRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -1368,25 +1855,30 @@ function ($response) { * Update a company * * @param string $id (required) - * @param \Brevo\Client\Model\Body3 $body Updated company details. (required) + * @param \Brevo\Client\Models\CompaniesIdPatchRequest $companiesIdPatchRequest Updated company details. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesIdPatch'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function companiesIdPatchAsyncWithHttpInfo($id, $body) + public function companiesIdPatchAsyncWithHttpInfo( + $id, + $companiesIdPatchRequest, + string $contentType = self::contentTypes['companiesIdPatch'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\Company'; - $request = $this->companiesIdPatchRequest($id, $body); + $returnType = '\Brevo\Client\Models\Company'; + $request = $this->companiesIdPatchRequest($id, $companiesIdPatchRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1409,7 +1901,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1419,26 +1911,34 @@ function ($exception) { * Create request for operation 'companiesIdPatch' * * @param string $id (required) - * @param \Brevo\Client\Model\Body3 $body Updated company details. (required) + * @param \Brevo\Client\Models\CompaniesIdPatchRequest $companiesIdPatchRequest Updated company details. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesIdPatch'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function companiesIdPatchRequest($id, $body) + public function companiesIdPatchRequest( + $id, + $companiesIdPatchRequest, + string $contentType = self::contentTypes['companiesIdPatch'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling companiesIdPatch' ); } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling companiesIdPatch' + + // verify the required parameter 'companiesIdPatchRequest' is set + if ($companiesIdPatchRequest === null || (is_array($companiesIdPatchRequest) && count($companiesIdPatchRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $companiesIdPatchRequest when calling companiesIdPatch' ); } + $resourcePath = '/companies/{id}'; $formParams = []; $queryParams = []; @@ -1447,6 +1947,7 @@ protected function companiesIdPatchRequest($id, $body) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1456,56 +1957,42 @@ protected function companiesIdPatchRequest($id, $body) ); } - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($companiesIdPatchRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($companiesIdPatchRequest)); + } else { + $httpBody = $companiesIdPatchRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1531,48 +2018,59 @@ protected function companiesIdPatchRequest($id, $body) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PATCH', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Operation companiesLinkUnlinkIdPatch + * Operation companiesImportPost * - * Link and Unlink company with contacts and deals + * Import companies(creation and updation) * - * @param string $id id (required) - * @param \Brevo\Client\Model\Body4 $body Linked / Unlinked contacts and deals ids. (required) + * @param \SplFileObject|null $file The CSV file to upload.The file should have the first row as the mapping attribute. Some default attribute names are (a) company_id [brevo mongoID to update deals] (b) associated_contact (c) associated_deal (f) any other attribute with internal name (optional) + * @param object|null $mapping The mapping options in JSON format. Here is an example of the JSON structure: ```json { \\\"link_entities\\\": true, // Determines whether to link related entities during the import process \\\"unlink_entities\\\": false, // Determines whether to unlink related entities during the import process \\\"update_existing_records\\\": true, // Determines whether to update based on company ID or treat every row as create \\\"unset_empty_attributes\\\": false // Determines whether to unset a specific attribute during update if the values input is blank } ``` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesImportPost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CompaniesImportPost200Response|\Brevo\Client\Models\CompaniesImportPost400Response */ - public function companiesLinkUnlinkIdPatch($id, $body) + public function companiesImportPost( + ?\SplFileObject $file = null, + ?array $mapping = null, + string $contentType = self::contentTypes['companiesImportPost'][0] + ): \Brevo\Client\Models\CompaniesImportPost200Response { - $this->companiesLinkUnlinkIdPatchWithHttpInfo($id, $body); + list($response) = $this->companiesImportPostWithHttpInfo($file, $mapping, $contentType); + return $response; } /** - * Operation companiesLinkUnlinkIdPatchWithHttpInfo + * Operation companiesImportPostWithHttpInfo * - * Link and Unlink company with contacts and deals + * Import companies(creation and updation) * - * @param string $id (required) - * @param \Brevo\Client\Model\Body4 $body Linked / Unlinked contacts and deals ids. (required) + * @param \SplFileObject|null $file The CSV file to upload.The file should have the first row as the mapping attribute. Some default attribute names are (a) company_id [brevo mongoID to update deals] (b) associated_contact (c) associated_deal (f) any other attribute with internal name (optional) + * @param object|null $mapping The mapping options in JSON format. Here is an example of the JSON structure: ```json { \\\"link_entities\\\": true, // Determines whether to link related entities during the import process \\\"unlink_entities\\\": false, // Determines whether to unlink related entities during the import process \\\"update_existing_records\\\": true, // Determines whether to update based on company ID or treat every row as create \\\"unset_empty_attributes\\\": false // Determines whether to unset a specific attribute during update if the values input is blank } ``` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesImportPost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CompaniesImportPost200Response|\Brevo\Client\Models\CompaniesImportPost400Response, HTTP status code, HTTP response headers (array of strings) */ - public function companiesLinkUnlinkIdPatchWithHttpInfo($id, $body) + public function companiesImportPostWithHttpInfo( + ?\SplFileObject $file = null, + ?array $mapping = null, + string $contentType = self::contentTypes['companiesImportPost'][0] + ): array { - $returnType = ''; - $request = $this->companiesLinkUnlinkIdPatchRequest($id, $body); + $request = $this->companiesImportPostRequest($file, $mapping, $contentType); try { $options = $this->createHttpClientOption(); @@ -1581,26 +2079,404 @@ public function companiesLinkUnlinkIdPatchWithHttpInfo($id, $body) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\CompaniesImportPost200Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CompaniesImportPost200Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CompaniesImportPost200Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\CompaniesImportPost400Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CompaniesImportPost400Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CompaniesImportPost400Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\CompaniesImportPost200Response'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\CompaniesImportPost200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\CompaniesImportPost400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation companiesImportPostAsync + * + * Import companies(creation and updation) + * + * @param \SplFileObject|null $file The CSV file to upload.The file should have the first row as the mapping attribute. Some default attribute names are (a) company_id [brevo mongoID to update deals] (b) associated_contact (c) associated_deal (f) any other attribute with internal name (optional) + * @param object|null $mapping The mapping options in JSON format. Here is an example of the JSON structure: ```json { \\\"link_entities\\\": true, // Determines whether to link related entities during the import process \\\"unlink_entities\\\": false, // Determines whether to unlink related entities during the import process \\\"update_existing_records\\\": true, // Determines whether to update based on company ID or treat every row as create \\\"unset_empty_attributes\\\": false // Determines whether to unset a specific attribute during update if the values input is blank } ``` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesImportPost'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function companiesImportPostAsync( + ?\SplFileObject $file = null, + ?array $mapping = null, + string $contentType = self::contentTypes['companiesImportPost'][0] + ): PromiseInterface + { + return $this->companiesImportPostAsyncWithHttpInfo($file, $mapping, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation companiesImportPostAsyncWithHttpInfo + * + * Import companies(creation and updation) + * + * @param \SplFileObject|null $file The CSV file to upload.The file should have the first row as the mapping attribute. Some default attribute names are (a) company_id [brevo mongoID to update deals] (b) associated_contact (c) associated_deal (f) any other attribute with internal name (optional) + * @param object|null $mapping The mapping options in JSON format. Here is an example of the JSON structure: ```json { \\\"link_entities\\\": true, // Determines whether to link related entities during the import process \\\"unlink_entities\\\": false, // Determines whether to unlink related entities during the import process \\\"update_existing_records\\\": true, // Determines whether to update based on company ID or treat every row as create \\\"unset_empty_attributes\\\": false // Determines whether to unset a specific attribute during update if the values input is blank } ``` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesImportPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function companiesImportPostAsyncWithHttpInfo( + $file = null, + $mapping = null, + string $contentType = self::contentTypes['companiesImportPost'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\CompaniesImportPost200Response'; + $request = $this->companiesImportPostRequest($file, $mapping, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'companiesImportPost' + * + * @param \SplFileObject|null $file The CSV file to upload.The file should have the first row as the mapping attribute. Some default attribute names are (a) company_id [brevo mongoID to update deals] (b) associated_contact (c) associated_deal (f) any other attribute with internal name (optional) + * @param object|null $mapping The mapping options in JSON format. Here is an example of the JSON structure: ```json { \\\"link_entities\\\": true, // Determines whether to link related entities during the import process \\\"unlink_entities\\\": false, // Determines whether to unlink related entities during the import process \\\"update_existing_records\\\": true, // Determines whether to update based on company ID or treat every row as create \\\"unset_empty_attributes\\\": false // Determines whether to unset a specific attribute during update if the values input is blank } ``` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesImportPost'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function companiesImportPostRequest( + $file = null, + $mapping = null, + string $contentType = self::contentTypes['companiesImportPost'][0] + ): Request + { + + + + + $resourcePath = '/companies/import'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + // form params + if ($file !== null) { + $multipart = true; + $formParams['file'] = []; + $paramFiles = is_array($file) ? $file : [$file]; + foreach ($paramFiles as $paramFile) { + $formParams['file'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface + ? $paramFile + : \GuzzleHttp\Psr7\Utils::tryFopen( + ObjectSerializer::toFormValue($paramFile), + 'rb' + ); + } + } + // form params + if ($mapping !== null) { + $formParams['mapping'] = ObjectSerializer::toFormValue($mapping); + } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation companiesLinkUnlinkIdPatch + * + * Link and Unlink company with contact and deal + * + * @param string $id id (required) + * @param \Brevo\Client\Models\CompaniesLinkUnlinkIdPatchRequest $companiesLinkUnlinkIdPatchRequest Linked / Unlinked contacts and deals ids. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesLinkUnlinkIdPatch'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return void + */ + public function companiesLinkUnlinkIdPatch( + string $id, + \Brevo\Client\Models\CompaniesLinkUnlinkIdPatchRequest $companiesLinkUnlinkIdPatchRequest, + string $contentType = self::contentTypes['companiesLinkUnlinkIdPatch'][0] + ): void + { + $this->companiesLinkUnlinkIdPatchWithHttpInfo($id, $companiesLinkUnlinkIdPatchRequest, $contentType); + } + + /** + * Operation companiesLinkUnlinkIdPatchWithHttpInfo + * + * Link and Unlink company with contact and deal + * + * @param string $id (required) + * @param \Brevo\Client\Models\CompaniesLinkUnlinkIdPatchRequest $companiesLinkUnlinkIdPatchRequest Linked / Unlinked contacts and deals ids. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesLinkUnlinkIdPatch'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function companiesLinkUnlinkIdPatchWithHttpInfo( + string $id, + \Brevo\Client\Models\CompaniesLinkUnlinkIdPatchRequest $companiesLinkUnlinkIdPatchRequest, + string $contentType = self::contentTypes['companiesLinkUnlinkIdPatch'][0] + ): array + { + $request = $this->companiesLinkUnlinkIdPatchRequest($id, $companiesLinkUnlinkIdPatchRequest, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -1609,7 +2485,7 @@ public function companiesLinkUnlinkIdPatchWithHttpInfo($id, $body) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1622,17 +2498,22 @@ public function companiesLinkUnlinkIdPatchWithHttpInfo($id, $body) /** * Operation companiesLinkUnlinkIdPatchAsync * - * Link and Unlink company with contacts and deals + * Link and Unlink company with contact and deal * * @param string $id (required) - * @param \Brevo\Client\Model\Body4 $body Linked / Unlinked contacts and deals ids. (required) + * @param \Brevo\Client\Models\CompaniesLinkUnlinkIdPatchRequest $companiesLinkUnlinkIdPatchRequest Linked / Unlinked contacts and deals ids. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesLinkUnlinkIdPatch'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function companiesLinkUnlinkIdPatchAsync($id, $body) + public function companiesLinkUnlinkIdPatchAsync( + string $id, + \Brevo\Client\Models\CompaniesLinkUnlinkIdPatchRequest $companiesLinkUnlinkIdPatchRequest, + string $contentType = self::contentTypes['companiesLinkUnlinkIdPatch'][0] + ): PromiseInterface { - return $this->companiesLinkUnlinkIdPatchAsyncWithHttpInfo($id, $body) + return $this->companiesLinkUnlinkIdPatchAsyncWithHttpInfo($id, $companiesLinkUnlinkIdPatchRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -1643,18 +2524,24 @@ function ($response) { /** * Operation companiesLinkUnlinkIdPatchAsyncWithHttpInfo * - * Link and Unlink company with contacts and deals + * Link and Unlink company with contact and deal * * @param string $id (required) - * @param \Brevo\Client\Model\Body4 $body Linked / Unlinked contacts and deals ids. (required) + * @param \Brevo\Client\Models\CompaniesLinkUnlinkIdPatchRequest $companiesLinkUnlinkIdPatchRequest Linked / Unlinked contacts and deals ids. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesLinkUnlinkIdPatch'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function companiesLinkUnlinkIdPatchAsyncWithHttpInfo($id, $body) + public function companiesLinkUnlinkIdPatchAsyncWithHttpInfo( + $id, + $companiesLinkUnlinkIdPatchRequest, + string $contentType = self::contentTypes['companiesLinkUnlinkIdPatch'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->companiesLinkUnlinkIdPatchRequest($id, $body); + $request = $this->companiesLinkUnlinkIdPatchRequest($id, $companiesLinkUnlinkIdPatchRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1673,7 +2560,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1683,26 +2570,34 @@ function ($exception) { * Create request for operation 'companiesLinkUnlinkIdPatch' * * @param string $id (required) - * @param \Brevo\Client\Model\Body4 $body Linked / Unlinked contacts and deals ids. (required) + * @param \Brevo\Client\Models\CompaniesLinkUnlinkIdPatchRequest $companiesLinkUnlinkIdPatchRequest Linked / Unlinked contacts and deals ids. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesLinkUnlinkIdPatch'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function companiesLinkUnlinkIdPatchRequest($id, $body) + public function companiesLinkUnlinkIdPatchRequest( + $id, + $companiesLinkUnlinkIdPatchRequest, + string $contentType = self::contentTypes['companiesLinkUnlinkIdPatch'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling companiesLinkUnlinkIdPatch' ); } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling companiesLinkUnlinkIdPatch' + + // verify the required parameter 'companiesLinkUnlinkIdPatchRequest' is set + if ($companiesLinkUnlinkIdPatchRequest === null || (is_array($companiesLinkUnlinkIdPatchRequest) && count($companiesLinkUnlinkIdPatchRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $companiesLinkUnlinkIdPatchRequest when calling companiesLinkUnlinkIdPatch' ); } + $resourcePath = '/companies/link-unlink/{id}'; $formParams = []; $queryParams = []; @@ -1711,6 +2606,7 @@ protected function companiesLinkUnlinkIdPatchRequest($id, $body) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1720,56 +2616,42 @@ protected function companiesLinkUnlinkIdPatchRequest($id, $body) ); } - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($companiesLinkUnlinkIdPatchRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($companiesLinkUnlinkIdPatchRequest)); + } else { + $httpBody = $companiesLinkUnlinkIdPatchRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1795,10 +2677,11 @@ protected function companiesLinkUnlinkIdPatchRequest($id, $body) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PATCH', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1809,15 +2692,19 @@ protected function companiesLinkUnlinkIdPatchRequest($id, $body) * * Create a company * - * @param \Brevo\Client\Model\Body2 $body Company create data. (required) + * @param \Brevo\Client\Models\CompaniesPostRequest $companiesPostRequest Company create data. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesPost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\InlineResponse2001 + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CompaniesPost200Response|\Brevo\Client\Models\ErrorModel */ - public function companiesPost($body) + public function companiesPost( + \Brevo\Client\Models\CompaniesPostRequest $companiesPostRequest, + string $contentType = self::contentTypes['companiesPost'][0] + ): \Brevo\Client\Models\CompaniesPost200Response { - list($response) = $this->companiesPostWithHttpInfo($body); + list($response) = $this->companiesPostWithHttpInfo($companiesPostRequest, $contentType); return $response; } @@ -1826,16 +2713,19 @@ public function companiesPost($body) * * Create a company * - * @param \Brevo\Client\Model\Body2 $body Company create data. (required) + * @param \Brevo\Client\Models\CompaniesPostRequest $companiesPostRequest Company create data. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesPost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\InlineResponse2001, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CompaniesPost200Response|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function companiesPostWithHttpInfo($body) + public function companiesPostWithHttpInfo( + \Brevo\Client\Models\CompaniesPostRequest $companiesPostRequest, + string $contentType = self::contentTypes['companiesPost'][0] + ): array { - $returnType = '\Brevo\Client\Model\InlineResponse2001'; - $request = $this->companiesPostRequest($body); + $request = $this->companiesPostRequest($companiesPostRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -1844,34 +2734,111 @@ public function companiesPostWithHttpInfo($body) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\CompaniesPost200Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CompaniesPost200Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CompaniesPost200Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CompaniesPost200Response'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1886,7 +2853,15 @@ public function companiesPostWithHttpInfo($body) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\InlineResponse2001', + '\Brevo\Client\Models\CompaniesPost200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1901,14 +2876,18 @@ public function companiesPostWithHttpInfo($body) * * Create a company * - * @param \Brevo\Client\Model\Body2 $body Company create data. (required) + * @param \Brevo\Client\Models\CompaniesPostRequest $companiesPostRequest Company create data. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function companiesPostAsync($body) + public function companiesPostAsync( + \Brevo\Client\Models\CompaniesPostRequest $companiesPostRequest, + string $contentType = self::contentTypes['companiesPost'][0] + ): PromiseInterface { - return $this->companiesPostAsyncWithHttpInfo($body) + return $this->companiesPostAsyncWithHttpInfo($companiesPostRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -1921,25 +2900,29 @@ function ($response) { * * Create a company * - * @param \Brevo\Client\Model\Body2 $body Company create data. (required) + * @param \Brevo\Client\Models\CompaniesPostRequest $companiesPostRequest Company create data. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function companiesPostAsyncWithHttpInfo($body) + public function companiesPostAsyncWithHttpInfo( + $companiesPostRequest, + string $contentType = self::contentTypes['companiesPost'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\InlineResponse2001'; - $request = $this->companiesPostRequest($body); + $returnType = '\Brevo\Client\Models\CompaniesPost200Response'; + $request = $this->companiesPostRequest($companiesPostRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1962,7 +2945,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1971,20 +2954,26 @@ function ($exception) { /** * Create request for operation 'companiesPost' * - * @param \Brevo\Client\Model\Body2 $body Company create data. (required) + * @param \Brevo\Client\Models\CompaniesPostRequest $companiesPostRequest Company create data. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['companiesPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function companiesPostRequest($body) + public function companiesPostRequest( + $companiesPostRequest, + string $contentType = self::contentTypes['companiesPost'][0] + ): Request { - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling companiesPost' + + // verify the required parameter 'companiesPostRequest' is set + if ($companiesPostRequest === null || (is_array($companiesPostRequest) && count($companiesPostRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $companiesPostRequest when calling companiesPost' ); } + $resourcePath = '/companies'; $formParams = []; $queryParams = []; @@ -1994,56 +2983,43 @@ protected function companiesPostRequest($body) - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($companiesPostRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($companiesPostRequest)); + } else { + $httpBody = $companiesPostRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2069,10 +3045,11 @@ protected function companiesPostRequest($body) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2084,7 +3061,7 @@ protected function companiesPostRequest($body) * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/ContactsApi.php b/lib/Api/ContactsApi.php index 8b5dc55..45bf389 100644 --- a/lib/Api/ContactsApi.php +++ b/lib/Api/ContactsApi.php @@ -1,12 +1,11 @@ [ + 'application/json', + ], + 'createAttribute' => [ + 'application/json', + ], + 'createContact' => [ + 'application/json', + ], + 'createDoiContact' => [ + 'application/json', + ], + 'createFolder' => [ + 'application/json', + ], + 'createList' => [ + 'application/json', + ], + 'deleteAttribute' => [ + 'application/json', + ], + 'deleteContact' => [ + 'application/json', + ], + 'deleteFolder' => [ + 'application/json', + ], + 'deleteList' => [ + 'application/json', + ], + 'deleteMultiAttributeOptions' => [ + 'application/json', + ], + 'getAttributes' => [ + 'application/json', + ], + 'getContactInfo' => [ + 'application/json', + ], + 'getContactStats' => [ + 'application/json', + ], + 'getContacts' => [ + 'application/json', + ], + 'getContactsFromList' => [ + 'application/json', + ], + 'getFolder' => [ + 'application/json', + ], + 'getFolderLists' => [ + 'application/json', + ], + 'getFolders' => [ + 'application/json', + ], + 'getList' => [ + 'application/json', + ], + 'getLists' => [ + 'application/json', + ], + 'getSegments' => [ + 'application/json', + ], + 'importContacts' => [ + 'application/json', + ], + 'removeContactFromList' => [ + 'application/json', + ], + 'requestContactExport' => [ + 'application/json', + ], + 'updateAttribute' => [ + 'application/json', + ], + 'updateBatchContacts' => [ + 'application/json', + ], + 'updateContact' => [ + 'application/json', + ], + 'updateFolder' => [ + 'application/json', + ], + 'updateList' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -93,15 +216,20 @@ public function getConfig() * Add existing contacts to a list * * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\AddContactToList $contactEmails Emails addresses OR IDs of the contacts (required) + * @param \Brevo\Client\Models\AddContactToListRequest $addContactToListRequest Emails addresses OR IDs OR EXT_ID attributes of the contacts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToList'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\PostContactInfo + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\PostContactInfo|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function addContactToList($listId, $contactEmails) + public function addContactToList( + int $listId, + \Brevo\Client\Models\AddContactToListRequest $addContactToListRequest, + string $contentType = self::contentTypes['addContactToList'][0] + ): \Brevo\Client\Models\PostContactInfo { - list($response) = $this->addContactToListWithHttpInfo($listId, $contactEmails); + list($response) = $this->addContactToListWithHttpInfo($listId, $addContactToListRequest, $contentType); return $response; } @@ -111,16 +239,20 @@ public function addContactToList($listId, $contactEmails) * Add existing contacts to a list * * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\AddContactToList $contactEmails Emails addresses OR IDs of the contacts (required) + * @param \Brevo\Client\Models\AddContactToListRequest $addContactToListRequest Emails addresses OR IDs OR EXT_ID attributes of the contacts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToList'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\PostContactInfo, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\PostContactInfo|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function addContactToListWithHttpInfo($listId, $contactEmails) + public function addContactToListWithHttpInfo( + int $listId, + \Brevo\Client\Models\AddContactToListRequest $addContactToListRequest, + string $contentType = self::contentTypes['addContactToList'][0] + ): array { - $returnType = '\Brevo\Client\Model\PostContactInfo'; - $request = $this->addContactToListRequest($listId, $contactEmails); + $request = $this->addContactToListRequest($listId, $addContactToListRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -129,34 +261,138 @@ public function addContactToListWithHttpInfo($listId, $contactEmails) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\PostContactInfo', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\PostContactInfo' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\PostContactInfo', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\PostContactInfo'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -171,7 +407,7 @@ public function addContactToListWithHttpInfo($listId, $contactEmails) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\PostContactInfo', + '\Brevo\Client\Models\PostContactInfo', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -179,7 +415,7 @@ public function addContactToListWithHttpInfo($listId, $contactEmails) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -187,7 +423,7 @@ public function addContactToListWithHttpInfo($listId, $contactEmails) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -203,14 +439,19 @@ public function addContactToListWithHttpInfo($listId, $contactEmails) * Add existing contacts to a list * * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\AddContactToList $contactEmails Emails addresses OR IDs of the contacts (required) + * @param \Brevo\Client\Models\AddContactToListRequest $addContactToListRequest Emails addresses OR IDs OR EXT_ID attributes of the contacts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToList'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function addContactToListAsync($listId, $contactEmails) + public function addContactToListAsync( + int $listId, + \Brevo\Client\Models\AddContactToListRequest $addContactToListRequest, + string $contentType = self::contentTypes['addContactToList'][0] + ): PromiseInterface { - return $this->addContactToListAsyncWithHttpInfo($listId, $contactEmails) + return $this->addContactToListAsyncWithHttpInfo($listId, $addContactToListRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -224,25 +465,30 @@ function ($response) { * Add existing contacts to a list * * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\AddContactToList $contactEmails Emails addresses OR IDs of the contacts (required) + * @param \Brevo\Client\Models\AddContactToListRequest $addContactToListRequest Emails addresses OR IDs OR EXT_ID attributes of the contacts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToList'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function addContactToListAsyncWithHttpInfo($listId, $contactEmails) + public function addContactToListAsyncWithHttpInfo( + $listId, + $addContactToListRequest, + string $contentType = self::contentTypes['addContactToList'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\PostContactInfo'; - $request = $this->addContactToListRequest($listId, $contactEmails); + $returnType = '\Brevo\Client\Models\PostContactInfo'; + $request = $this->addContactToListRequest($listId, $addContactToListRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -265,7 +511,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -275,26 +521,34 @@ function ($exception) { * Create request for operation 'addContactToList' * * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\AddContactToList $contactEmails Emails addresses OR IDs of the contacts (required) + * @param \Brevo\Client\Models\AddContactToListRequest $addContactToListRequest Emails addresses OR IDs OR EXT_ID attributes of the contacts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToList'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function addContactToListRequest($listId, $contactEmails) + public function addContactToListRequest( + $listId, + $addContactToListRequest, + string $contentType = self::contentTypes['addContactToList'][0] + ): Request { + // verify the required parameter 'listId' is set if ($listId === null || (is_array($listId) && count($listId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $listId when calling addContactToList' ); } - // verify the required parameter 'contactEmails' is set - if ($contactEmails === null || (is_array($contactEmails) && count($contactEmails) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $contactEmails when calling addContactToList' + + // verify the required parameter 'addContactToListRequest' is set + if ($addContactToListRequest === null || (is_array($addContactToListRequest) && count($addContactToListRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $addContactToListRequest when calling addContactToList' ); } + $resourcePath = '/contacts/lists/{listId}/contacts/add'; $formParams = []; $queryParams = []; @@ -303,6 +557,7 @@ protected function addContactToListRequest($listId, $contactEmails) $multipart = false; + // path params if ($listId !== null) { $resourcePath = str_replace( @@ -312,56 +567,42 @@ protected function addContactToListRequest($listId, $contactEmails) ); } - // 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'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($addContactToListRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($addContactToListRequest)); + } else { + $httpBody = $addContactToListRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -387,10 +628,11 @@ protected function addContactToListRequest($listId, $contactEmails) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -403,15 +645,21 @@ protected function addContactToListRequest($listId, $contactEmails) * * @param string $attributeCategory Category of the attribute (required) * @param string $attributeName Name of the attribute (required) - * @param \Brevo\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required) + * @param \Brevo\Client\Models\CreateAttribute $createAttribute Values to create an attribute (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAttribute'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function createAttribute($attributeCategory, $attributeName, $createAttribute) + public function createAttribute( + string $attributeCategory, + string $attributeName, + \Brevo\Client\Models\CreateAttribute $createAttribute, + string $contentType = self::contentTypes['createAttribute'][0] + ): void { - $this->createAttributeWithHttpInfo($attributeCategory, $attributeName, $createAttribute); + $this->createAttributeWithHttpInfo($attributeCategory, $attributeName, $createAttribute, $contentType); } /** @@ -421,16 +669,21 @@ public function createAttribute($attributeCategory, $attributeName, $createAttri * * @param string $attributeCategory Category of the attribute (required) * @param string $attributeName Name of the attribute (required) - * @param \Brevo\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required) + * @param \Brevo\Client\Models\CreateAttribute $createAttribute Values to create an attribute (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAttribute'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function createAttributeWithHttpInfo($attributeCategory, $attributeName, $createAttribute) + public function createAttributeWithHttpInfo( + string $attributeCategory, + string $attributeName, + \Brevo\Client\Models\CreateAttribute $createAttribute, + string $contentType = self::contentTypes['createAttribute'][0] + ): array { - $returnType = ''; - $request = $this->createAttributeRequest($attributeCategory, $attributeName, $createAttribute); + $request = $this->createAttributeRequest($attributeCategory, $attributeName, $createAttribute, $contentType); try { $options = $this->createHttpClientOption(); @@ -439,26 +692,21 @@ public function createAttributeWithHttpInfo($attributeCategory, $attributeName, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -467,7 +715,7 @@ public function createAttributeWithHttpInfo($attributeCategory, $attributeName, case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -484,14 +732,20 @@ public function createAttributeWithHttpInfo($attributeCategory, $attributeName, * * @param string $attributeCategory Category of the attribute (required) * @param string $attributeName Name of the attribute (required) - * @param \Brevo\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required) + * @param \Brevo\Client\Models\CreateAttribute $createAttribute Values to create an attribute (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAttribute'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createAttributeAsync($attributeCategory, $attributeName, $createAttribute) + public function createAttributeAsync( + string $attributeCategory, + string $attributeName, + \Brevo\Client\Models\CreateAttribute $createAttribute, + string $contentType = self::contentTypes['createAttribute'][0] + ): PromiseInterface { - return $this->createAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $createAttribute) + return $this->createAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $createAttribute, $contentType) ->then( function ($response) { return $response[0]; @@ -506,15 +760,22 @@ function ($response) { * * @param string $attributeCategory Category of the attribute (required) * @param string $attributeName Name of the attribute (required) - * @param \Brevo\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required) + * @param \Brevo\Client\Models\CreateAttribute $createAttribute Values to create an attribute (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAttribute'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $createAttribute) + public function createAttributeAsyncWithHttpInfo( + $attributeCategory, + $attributeName, + $createAttribute, + string $contentType = self::contentTypes['createAttribute'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->createAttributeRequest($attributeCategory, $attributeName, $createAttribute); + $request = $this->createAttributeRequest($attributeCategory, $attributeName, $createAttribute, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -533,7 +794,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -544,32 +805,42 @@ function ($exception) { * * @param string $attributeCategory Category of the attribute (required) * @param string $attributeName Name of the attribute (required) - * @param \Brevo\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required) + * @param \Brevo\Client\Models\CreateAttribute $createAttribute Values to create an attribute (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAttribute'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createAttributeRequest($attributeCategory, $attributeName, $createAttribute) + public function createAttributeRequest( + $attributeCategory, + $attributeName, + $createAttribute, + string $contentType = self::contentTypes['createAttribute'][0] + ): Request { + // verify the required parameter 'attributeCategory' is set if ($attributeCategory === null || (is_array($attributeCategory) && count($attributeCategory) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $attributeCategory when calling createAttribute' ); } + // verify the required parameter 'attributeName' is set if ($attributeName === null || (is_array($attributeName) && count($attributeName) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $attributeName when calling createAttribute' ); } + // verify the required parameter 'createAttribute' is set if ($createAttribute === null || (is_array($createAttribute) && count($createAttribute) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $createAttribute when calling createAttribute' ); } + $resourcePath = '/contacts/attributes/{attributeCategory}/{attributeName}'; $formParams = []; $queryParams = []; @@ -578,6 +849,7 @@ protected function createAttributeRequest($attributeCategory, $attributeName, $c $multipart = false; + // path params if ($attributeCategory !== null) { $resourcePath = str_replace( @@ -595,56 +867,42 @@ protected function createAttributeRequest($attributeCategory, $attributeName, $c ); } - // 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'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($createAttribute)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createAttribute)); + } else { + $httpBody = $createAttribute; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -670,10 +928,11 @@ protected function createAttributeRequest($attributeCategory, $attributeName, $c $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -684,15 +943,19 @@ protected function createAttributeRequest($attributeCategory, $attributeName, $c * * Create a contact * - * @param \Brevo\Client\Model\CreateContact $createContact Values to create a contact (required) + * @param \Brevo\Client\Models\CreateContact $createContact Values to create a contact (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreateUpdateContactModel + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateUpdateContactModel|\Brevo\Client\Models\ContactErrorModel|\Brevo\Client\Models\ContactErrorModel */ - public function createContact($createContact) + public function createContact( + \Brevo\Client\Models\CreateContact $createContact, + string $contentType = self::contentTypes['createContact'][0] + ): \Brevo\Client\Models\CreateUpdateContactModel { - list($response) = $this->createContactWithHttpInfo($createContact); + list($response) = $this->createContactWithHttpInfo($createContact, $contentType); return $response; } @@ -701,16 +964,19 @@ public function createContact($createContact) * * Create a contact * - * @param \Brevo\Client\Model\CreateContact $createContact Values to create a contact (required) + * @param \Brevo\Client\Models\CreateContact $createContact Values to create a contact (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreateUpdateContactModel, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateUpdateContactModel|\Brevo\Client\Models\ContactErrorModel|\Brevo\Client\Models\ContactErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function createContactWithHttpInfo($createContact) + public function createContactWithHttpInfo( + \Brevo\Client\Models\CreateContact $createContact, + string $contentType = self::contentTypes['createContact'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreateUpdateContactModel'; - $request = $this->createContactRequest($createContact); + $request = $this->createContactRequest($createContact, $contentType); try { $options = $this->createHttpClientOption(); @@ -719,34 +985,138 @@ public function createContactWithHttpInfo($createContact) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreateUpdateContactModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateUpdateContactModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateUpdateContactModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ContactErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ContactErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ContactErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 425: + if (in_array('\Brevo\Client\Models\ContactErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ContactErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ContactErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreateUpdateContactModel'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -761,7 +1131,7 @@ public function createContactWithHttpInfo($createContact) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreateUpdateContactModel', + '\Brevo\Client\Models\CreateUpdateContactModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -769,7 +1139,7 @@ public function createContactWithHttpInfo($createContact) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ContactErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -777,7 +1147,7 @@ public function createContactWithHttpInfo($createContact) case 425: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ContactErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -792,14 +1162,18 @@ public function createContactWithHttpInfo($createContact) * * Create a contact * - * @param \Brevo\Client\Model\CreateContact $createContact Values to create a contact (required) + * @param \Brevo\Client\Models\CreateContact $createContact Values to create a contact (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createContactAsync($createContact) + public function createContactAsync( + \Brevo\Client\Models\CreateContact $createContact, + string $contentType = self::contentTypes['createContact'][0] + ): PromiseInterface { - return $this->createContactAsyncWithHttpInfo($createContact) + return $this->createContactAsyncWithHttpInfo($createContact, $contentType) ->then( function ($response) { return $response[0]; @@ -812,25 +1186,29 @@ function ($response) { * * Create a contact * - * @param \Brevo\Client\Model\CreateContact $createContact Values to create a contact (required) + * @param \Brevo\Client\Models\CreateContact $createContact Values to create a contact (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createContactAsyncWithHttpInfo($createContact) + public function createContactAsyncWithHttpInfo( + $createContact, + string $contentType = self::contentTypes['createContact'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreateUpdateContactModel'; - $request = $this->createContactRequest($createContact); + $returnType = '\Brevo\Client\Models\CreateUpdateContactModel'; + $request = $this->createContactRequest($createContact, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -853,7 +1231,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -862,20 +1240,26 @@ function ($exception) { /** * Create request for operation 'createContact' * - * @param \Brevo\Client\Model\CreateContact $createContact Values to create a contact (required) + * @param \Brevo\Client\Models\CreateContact $createContact Values to create a contact (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createContactRequest($createContact) + public function createContactRequest( + $createContact, + string $contentType = self::contentTypes['createContact'][0] + ): Request { + // verify the required parameter 'createContact' is set if ($createContact === null || (is_array($createContact) && count($createContact) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $createContact when calling createContact' ); } + $resourcePath = '/contacts'; $formParams = []; $queryParams = []; @@ -885,56 +1269,43 @@ protected function createContactRequest($createContact) - // body params - $_tempBody = null; - if (isset($createContact)) { - $_tempBody = $createContact; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($createContact)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createContact)); + } else { + $httpBody = $createContact; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -960,10 +1331,11 @@ protected function createContactRequest($createContact) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -974,15 +1346,19 @@ protected function createContactRequest($createContact) * * Create Contact via DOI (Double-Opt-In) Flow * - * @param \Brevo\Client\Model\CreateDoiContact $createDoiContact Values to create the Double opt-in (DOI) contact (required) + * @param \Brevo\Client\Models\CreateDoiContact $createDoiContact Values to create the Double opt-in (DOI) contact (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDoiContact'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function createDoiContact($createDoiContact) + public function createDoiContact( + \Brevo\Client\Models\CreateDoiContact $createDoiContact, + string $contentType = self::contentTypes['createDoiContact'][0] + ): void { - $this->createDoiContactWithHttpInfo($createDoiContact); + $this->createDoiContactWithHttpInfo($createDoiContact, $contentType); } /** @@ -990,16 +1366,19 @@ public function createDoiContact($createDoiContact) * * Create Contact via DOI (Double-Opt-In) Flow * - * @param \Brevo\Client\Model\CreateDoiContact $createDoiContact Values to create the Double opt-in (DOI) contact (required) + * @param \Brevo\Client\Models\CreateDoiContact $createDoiContact Values to create the Double opt-in (DOI) contact (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDoiContact'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function createDoiContactWithHttpInfo($createDoiContact) + public function createDoiContactWithHttpInfo( + \Brevo\Client\Models\CreateDoiContact $createDoiContact, + string $contentType = self::contentTypes['createDoiContact'][0] + ): array { - $returnType = ''; - $request = $this->createDoiContactRequest($createDoiContact); + $request = $this->createDoiContactRequest($createDoiContact, $contentType); try { $options = $this->createHttpClientOption(); @@ -1008,26 +1387,21 @@ public function createDoiContactWithHttpInfo($createDoiContact) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -1036,7 +1410,7 @@ public function createDoiContactWithHttpInfo($createDoiContact) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1051,14 +1425,18 @@ public function createDoiContactWithHttpInfo($createDoiContact) * * Create Contact via DOI (Double-Opt-In) Flow * - * @param \Brevo\Client\Model\CreateDoiContact $createDoiContact Values to create the Double opt-in (DOI) contact (required) + * @param \Brevo\Client\Models\CreateDoiContact $createDoiContact Values to create the Double opt-in (DOI) contact (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDoiContact'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createDoiContactAsync($createDoiContact) + public function createDoiContactAsync( + \Brevo\Client\Models\CreateDoiContact $createDoiContact, + string $contentType = self::contentTypes['createDoiContact'][0] + ): PromiseInterface { - return $this->createDoiContactAsyncWithHttpInfo($createDoiContact) + return $this->createDoiContactAsyncWithHttpInfo($createDoiContact, $contentType) ->then( function ($response) { return $response[0]; @@ -1071,15 +1449,20 @@ function ($response) { * * Create Contact via DOI (Double-Opt-In) Flow * - * @param \Brevo\Client\Model\CreateDoiContact $createDoiContact Values to create the Double opt-in (DOI) contact (required) + * @param \Brevo\Client\Models\CreateDoiContact $createDoiContact Values to create the Double opt-in (DOI) contact (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDoiContact'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createDoiContactAsyncWithHttpInfo($createDoiContact) + public function createDoiContactAsyncWithHttpInfo( + $createDoiContact, + string $contentType = self::contentTypes['createDoiContact'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->createDoiContactRequest($createDoiContact); + $request = $this->createDoiContactRequest($createDoiContact, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1098,7 +1481,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1107,20 +1490,26 @@ function ($exception) { /** * Create request for operation 'createDoiContact' * - * @param \Brevo\Client\Model\CreateDoiContact $createDoiContact Values to create the Double opt-in (DOI) contact (required) + * @param \Brevo\Client\Models\CreateDoiContact $createDoiContact Values to create the Double opt-in (DOI) contact (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDoiContact'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createDoiContactRequest($createDoiContact) + public function createDoiContactRequest( + $createDoiContact, + string $contentType = self::contentTypes['createDoiContact'][0] + ): Request { + // verify the required parameter 'createDoiContact' is set if ($createDoiContact === null || (is_array($createDoiContact) && count($createDoiContact) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $createDoiContact when calling createDoiContact' ); } + $resourcePath = '/contacts/doubleOptinConfirmation'; $formParams = []; $queryParams = []; @@ -1130,56 +1519,43 @@ protected function createDoiContactRequest($createDoiContact) - // body params - $_tempBody = null; - if (isset($createDoiContact)) { - $_tempBody = $createDoiContact; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($createDoiContact)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createDoiContact)); + } else { + $httpBody = $createDoiContact; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1205,10 +1581,11 @@ protected function createDoiContactRequest($createDoiContact) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1219,15 +1596,19 @@ protected function createDoiContactRequest($createDoiContact) * * Create a folder * - * @param \Brevo\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) + * @param \Brevo\Client\Models\CreateUpdateFolder $createFolder Name of the folder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createFolder'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreateModel + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateModel|\Brevo\Client\Models\ErrorModel */ - public function createFolder($createFolder) + public function createFolder( + \Brevo\Client\Models\CreateUpdateFolder $createFolder, + string $contentType = self::contentTypes['createFolder'][0] + ): \Brevo\Client\Models\CreateModel { - list($response) = $this->createFolderWithHttpInfo($createFolder); + list($response) = $this->createFolderWithHttpInfo($createFolder, $contentType); return $response; } @@ -1236,16 +1617,19 @@ public function createFolder($createFolder) * * Create a folder * - * @param \Brevo\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) + * @param \Brevo\Client\Models\CreateUpdateFolder $createFolder Name of the folder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createFolder'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function createFolderWithHttpInfo($createFolder) + public function createFolderWithHttpInfo( + \Brevo\Client\Models\CreateUpdateFolder $createFolder, + string $contentType = self::contentTypes['createFolder'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreateModel'; - $request = $this->createFolderRequest($createFolder); + $request = $this->createFolderRequest($createFolder, $contentType); try { $options = $this->createHttpClientOption(); @@ -1254,34 +1638,111 @@ public function createFolderWithHttpInfo($createFolder) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreateModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreateModel'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1296,7 +1757,7 @@ public function createFolderWithHttpInfo($createFolder) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreateModel', + '\Brevo\Client\Models\CreateModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1304,7 +1765,7 @@ public function createFolderWithHttpInfo($createFolder) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1319,14 +1780,18 @@ public function createFolderWithHttpInfo($createFolder) * * Create a folder * - * @param \Brevo\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) + * @param \Brevo\Client\Models\CreateUpdateFolder $createFolder Name of the folder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createFolder'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createFolderAsync($createFolder) + public function createFolderAsync( + \Brevo\Client\Models\CreateUpdateFolder $createFolder, + string $contentType = self::contentTypes['createFolder'][0] + ): PromiseInterface { - return $this->createFolderAsyncWithHttpInfo($createFolder) + return $this->createFolderAsyncWithHttpInfo($createFolder, $contentType) ->then( function ($response) { return $response[0]; @@ -1339,25 +1804,29 @@ function ($response) { * * Create a folder * - * @param \Brevo\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) + * @param \Brevo\Client\Models\CreateUpdateFolder $createFolder Name of the folder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createFolder'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createFolderAsyncWithHttpInfo($createFolder) + public function createFolderAsyncWithHttpInfo( + $createFolder, + string $contentType = self::contentTypes['createFolder'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreateModel'; - $request = $this->createFolderRequest($createFolder); + $returnType = '\Brevo\Client\Models\CreateModel'; + $request = $this->createFolderRequest($createFolder, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1380,7 +1849,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1389,20 +1858,26 @@ function ($exception) { /** * Create request for operation 'createFolder' * - * @param \Brevo\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) + * @param \Brevo\Client\Models\CreateUpdateFolder $createFolder Name of the folder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createFolder'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createFolderRequest($createFolder) + public function createFolderRequest( + $createFolder, + string $contentType = self::contentTypes['createFolder'][0] + ): Request { + // verify the required parameter 'createFolder' is set if ($createFolder === null || (is_array($createFolder) && count($createFolder) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $createFolder when calling createFolder' ); } + $resourcePath = '/contacts/folders'; $formParams = []; $queryParams = []; @@ -1412,56 +1887,43 @@ protected function createFolderRequest($createFolder) - // body params - $_tempBody = null; - if (isset($createFolder)) { - $_tempBody = $createFolder; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($createFolder)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createFolder)); + } else { + $httpBody = $createFolder; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1487,10 +1949,11 @@ protected function createFolderRequest($createFolder) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1501,15 +1964,19 @@ protected function createFolderRequest($createFolder) * * Create a list * - * @param \Brevo\Client\Model\CreateList $createList Values to create a list (required) + * @param \Brevo\Client\Models\CreateList $createList Values to create a list (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createList'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreateModel + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateModel|\Brevo\Client\Models\ErrorModel */ - public function createList($createList) + public function createList( + \Brevo\Client\Models\CreateList $createList, + string $contentType = self::contentTypes['createList'][0] + ): \Brevo\Client\Models\CreateModel { - list($response) = $this->createListWithHttpInfo($createList); + list($response) = $this->createListWithHttpInfo($createList, $contentType); return $response; } @@ -1518,16 +1985,19 @@ public function createList($createList) * * Create a list * - * @param \Brevo\Client\Model\CreateList $createList Values to create a list (required) + * @param \Brevo\Client\Models\CreateList $createList Values to create a list (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createList'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function createListWithHttpInfo($createList) + public function createListWithHttpInfo( + \Brevo\Client\Models\CreateList $createList, + string $contentType = self::contentTypes['createList'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreateModel'; - $request = $this->createListRequest($createList); + $request = $this->createListRequest($createList, $contentType); try { $options = $this->createHttpClientOption(); @@ -1536,34 +2006,111 @@ public function createListWithHttpInfo($createList) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreateModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreateModel'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1578,7 +2125,7 @@ public function createListWithHttpInfo($createList) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreateModel', + '\Brevo\Client\Models\CreateModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1586,7 +2133,7 @@ public function createListWithHttpInfo($createList) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1601,14 +2148,18 @@ public function createListWithHttpInfo($createList) * * Create a list * - * @param \Brevo\Client\Model\CreateList $createList Values to create a list (required) + * @param \Brevo\Client\Models\CreateList $createList Values to create a list (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createList'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createListAsync($createList) + public function createListAsync( + \Brevo\Client\Models\CreateList $createList, + string $contentType = self::contentTypes['createList'][0] + ): PromiseInterface { - return $this->createListAsyncWithHttpInfo($createList) + return $this->createListAsyncWithHttpInfo($createList, $contentType) ->then( function ($response) { return $response[0]; @@ -1621,25 +2172,29 @@ function ($response) { * * Create a list * - * @param \Brevo\Client\Model\CreateList $createList Values to create a list (required) + * @param \Brevo\Client\Models\CreateList $createList Values to create a list (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createList'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createListAsyncWithHttpInfo($createList) + public function createListAsyncWithHttpInfo( + $createList, + string $contentType = self::contentTypes['createList'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreateModel'; - $request = $this->createListRequest($createList); + $returnType = '\Brevo\Client\Models\CreateModel'; + $request = $this->createListRequest($createList, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1662,7 +2217,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1671,20 +2226,26 @@ function ($exception) { /** * Create request for operation 'createList' * - * @param \Brevo\Client\Model\CreateList $createList Values to create a list (required) + * @param \Brevo\Client\Models\CreateList $createList Values to create a list (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createList'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createListRequest($createList) + public function createListRequest( + $createList, + string $contentType = self::contentTypes['createList'][0] + ): Request { + // verify the required parameter 'createList' is set if ($createList === null || (is_array($createList) && count($createList) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $createList when calling createList' ); } + $resourcePath = '/contacts/lists'; $formParams = []; $queryParams = []; @@ -1694,56 +2255,43 @@ protected function createListRequest($createList) - // body params - $_tempBody = null; - if (isset($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)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($createList)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createList)); + } else { + $httpBody = $createList; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1769,10 +2317,11 @@ protected function createListRequest($createList) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1785,14 +2334,19 @@ protected function createListRequest($createList) * * @param string $attributeCategory Category of the attribute (required) * @param string $attributeName Name of the existing attribute (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAttribute'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function deleteAttribute($attributeCategory, $attributeName) + public function deleteAttribute( + string $attributeCategory, + string $attributeName, + string $contentType = self::contentTypes['deleteAttribute'][0] + ): void { - $this->deleteAttributeWithHttpInfo($attributeCategory, $attributeName); + $this->deleteAttributeWithHttpInfo($attributeCategory, $attributeName, $contentType); } /** @@ -1802,15 +2356,19 @@ public function deleteAttribute($attributeCategory, $attributeName) * * @param string $attributeCategory Category of the attribute (required) * @param string $attributeName Name of the existing attribute (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAttribute'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteAttributeWithHttpInfo($attributeCategory, $attributeName) + public function deleteAttributeWithHttpInfo( + string $attributeCategory, + string $attributeName, + string $contentType = self::contentTypes['deleteAttribute'][0] + ): array { - $returnType = ''; - $request = $this->deleteAttributeRequest($attributeCategory, $attributeName); + $request = $this->deleteAttributeRequest($attributeCategory, $attributeName, $contentType); try { $options = $this->createHttpClientOption(); @@ -1819,43 +2377,38 @@ public function deleteAttributeWithHttpInfo($attributeCategory, $attributeName) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1872,13 +2425,18 @@ public function deleteAttributeWithHttpInfo($attributeCategory, $attributeName) * * @param string $attributeCategory Category of the attribute (required) * @param string $attributeName Name of the existing attribute (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAttribute'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteAttributeAsync($attributeCategory, $attributeName) + public function deleteAttributeAsync( + string $attributeCategory, + string $attributeName, + string $contentType = self::contentTypes['deleteAttribute'][0] + ): PromiseInterface { - return $this->deleteAttributeAsyncWithHttpInfo($attributeCategory, $attributeName) + return $this->deleteAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $contentType) ->then( function ($response) { return $response[0]; @@ -1893,14 +2451,20 @@ function ($response) { * * @param string $attributeCategory Category of the attribute (required) * @param string $attributeName Name of the existing attribute (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAttribute'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteAttributeAsyncWithHttpInfo($attributeCategory, $attributeName) + public function deleteAttributeAsyncWithHttpInfo( + $attributeCategory, + $attributeName, + string $contentType = self::contentTypes['deleteAttribute'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->deleteAttributeRequest($attributeCategory, $attributeName); + $request = $this->deleteAttributeRequest($attributeCategory, $attributeName, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1919,7 +2483,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1930,25 +2494,33 @@ function ($exception) { * * @param string $attributeCategory Category of the attribute (required) * @param string $attributeName Name of the existing attribute (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAttribute'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function deleteAttributeRequest($attributeCategory, $attributeName) + public function deleteAttributeRequest( + $attributeCategory, + $attributeName, + string $contentType = self::contentTypes['deleteAttribute'][0] + ): Request { + // verify the required parameter 'attributeCategory' is set if ($attributeCategory === null || (is_array($attributeCategory) && count($attributeCategory) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $attributeCategory when calling deleteAttribute' ); } + // verify the required parameter 'attributeName' is set if ($attributeName === null || (is_array($attributeName) && count($attributeName) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $attributeName when calling deleteAttribute' ); } + $resourcePath = '/contacts/attributes/{attributeCategory}/{attributeName}'; $formParams = []; $queryParams = []; @@ -1957,6 +2529,7 @@ protected function deleteAttributeRequest($attributeCategory, $attributeName) $multipart = false; + // path params if ($attributeCategory !== null) { $resourcePath = str_replace( @@ -1974,53 +2547,35 @@ protected function deleteAttributeRequest($attributeCategory, $attributeName) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2046,10 +2601,11 @@ protected function deleteAttributeRequest($attributeCategory, $attributeName) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2060,16 +2616,21 @@ protected function deleteAttributeRequest($attributeCategory, $attributeName) * * Delete a contact * - * @param string $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) (required) - * @param object $identifierType email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute (optional) + * @param \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) (required) + * @param string|null $identifierType email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function deleteContact($identifier, $identifierType = null) + public function deleteContact( + \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier, + ?string $identifierType = null, + string $contentType = self::contentTypes['deleteContact'][0] + ): void { - $this->deleteContactWithHttpInfo($identifier, $identifierType); + $this->deleteContactWithHttpInfo($identifier, $identifierType, $contentType); } /** @@ -2077,17 +2638,21 @@ public function deleteContact($identifier, $identifierType = null) * * Delete a contact * - * @param string $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) (required) - * @param object $identifierType email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute (optional) + * @param \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) (required) + * @param string|null $identifierType email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteContactWithHttpInfo($identifier, $identifierType = null) + public function deleteContactWithHttpInfo( + \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier, + ?string $identifierType = null, + string $contentType = self::contentTypes['deleteContact'][0] + ): array { - $returnType = ''; - $request = $this->deleteContactRequest($identifier, $identifierType); + $request = $this->deleteContactRequest($identifier, $identifierType, $contentType); try { $options = $this->createHttpClientOption(); @@ -2096,43 +2661,38 @@ public function deleteContactWithHttpInfo($identifier, $identifierType = null) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2140,7 +2700,7 @@ public function deleteContactWithHttpInfo($identifier, $identifierType = null) case 405: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2155,15 +2715,20 @@ public function deleteContactWithHttpInfo($identifier, $identifierType = null) * * Delete a contact * - * @param string $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) (required) - * @param object $identifierType email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute (optional) + * @param \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) (required) + * @param string|null $identifierType email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteContactAsync($identifier, $identifierType = null) + public function deleteContactAsync( + \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier, + ?string $identifierType = null, + string $contentType = self::contentTypes['deleteContact'][0] + ): PromiseInterface { - return $this->deleteContactAsyncWithHttpInfo($identifier, $identifierType) + return $this->deleteContactAsyncWithHttpInfo($identifier, $identifierType, $contentType) ->then( function ($response) { return $response[0]; @@ -2176,16 +2741,22 @@ function ($response) { * * Delete a contact * - * @param string $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) (required) - * @param object $identifierType email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute (optional) + * @param \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) (required) + * @param string|null $identifierType email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteContactAsyncWithHttpInfo($identifier, $identifierType = null) + public function deleteContactAsyncWithHttpInfo( + $identifier, + $identifierType = null, + string $contentType = self::contentTypes['deleteContact'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->deleteContactRequest($identifier, $identifierType); + $request = $this->deleteContactRequest($identifier, $identifierType, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2204,7 +2775,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2213,21 +2784,29 @@ function ($exception) { /** * Create request for operation 'deleteContact' * - * @param string $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) (required) - * @param object $identifierType email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute (optional) + * @param \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) (required) + * @param string|null $identifierType email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function deleteContactRequest($identifier, $identifierType = null) + public function deleteContactRequest( + $identifier, + $identifierType = null, + string $contentType = self::contentTypes['deleteContact'][0] + ): Request { + // verify the required parameter 'identifier' is set if ($identifier === null || (is_array($identifier) && count($identifier) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $identifier when calling deleteContact' ); } + + $resourcePath = '/contacts/{identifier}'; $formParams = []; $queryParams = []; @@ -2236,9 +2815,15 @@ protected function deleteContactRequest($identifier, $identifierType = null) $multipart = false; // query params - if ($identifierType !== null) { - $queryParams['identifierType'] = ObjectSerializer::toQueryValue($identifierType); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $identifierType, + 'identifierType', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // path params if ($identifier !== null) { @@ -2249,53 +2834,35 @@ protected function deleteContactRequest($identifier, $identifierType = null) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2321,10 +2888,11 @@ protected function deleteContactRequest($identifier, $identifierType = null) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2336,14 +2904,18 @@ protected function deleteContactRequest($identifier, $identifierType = null) * Delete a folder (and all its lists) * * @param int $folderId Id of the folder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFolder'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function deleteFolder($folderId) + public function deleteFolder( + int $folderId, + string $contentType = self::contentTypes['deleteFolder'][0] + ): void { - $this->deleteFolderWithHttpInfo($folderId); + $this->deleteFolderWithHttpInfo($folderId, $contentType); } /** @@ -2352,15 +2924,18 @@ public function deleteFolder($folderId) * Delete a folder (and all its lists) * * @param int $folderId Id of the folder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFolder'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteFolderWithHttpInfo($folderId) + public function deleteFolderWithHttpInfo( + int $folderId, + string $contentType = self::contentTypes['deleteFolder'][0] + ): array { - $returnType = ''; - $request = $this->deleteFolderRequest($folderId); + $request = $this->deleteFolderRequest($folderId, $contentType); try { $options = $this->createHttpClientOption(); @@ -2369,43 +2944,38 @@ public function deleteFolderWithHttpInfo($folderId) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2421,13 +2991,17 @@ public function deleteFolderWithHttpInfo($folderId) * Delete a folder (and all its lists) * * @param int $folderId Id of the folder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFolder'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteFolderAsync($folderId) + public function deleteFolderAsync( + int $folderId, + string $contentType = self::contentTypes['deleteFolder'][0] + ): PromiseInterface { - return $this->deleteFolderAsyncWithHttpInfo($folderId) + return $this->deleteFolderAsyncWithHttpInfo($folderId, $contentType) ->then( function ($response) { return $response[0]; @@ -2441,14 +3015,19 @@ function ($response) { * Delete a folder (and all its lists) * * @param int $folderId Id of the folder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFolder'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteFolderAsyncWithHttpInfo($folderId) + public function deleteFolderAsyncWithHttpInfo( + $folderId, + string $contentType = self::contentTypes['deleteFolder'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->deleteFolderRequest($folderId); + $request = $this->deleteFolderRequest($folderId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2467,7 +3046,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2477,19 +3056,25 @@ function ($exception) { * Create request for operation 'deleteFolder' * * @param int $folderId Id of the folder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFolder'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function deleteFolderRequest($folderId) + public function deleteFolderRequest( + $folderId, + string $contentType = self::contentTypes['deleteFolder'][0] + ): Request { + // verify the required parameter 'folderId' is set if ($folderId === null || (is_array($folderId) && count($folderId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $folderId when calling deleteFolder' ); } + $resourcePath = '/contacts/folders/{folderId}'; $formParams = []; $queryParams = []; @@ -2498,6 +3083,7 @@ protected function deleteFolderRequest($folderId) $multipart = false; + // path params if ($folderId !== null) { $resourcePath = str_replace( @@ -2507,53 +3093,35 @@ protected function deleteFolderRequest($folderId) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2579,10 +3147,11 @@ protected function deleteFolderRequest($folderId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2594,14 +3163,18 @@ protected function deleteFolderRequest($folderId) * Delete a list * * @param int $listId Id of the list (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteList'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function deleteList($listId) + public function deleteList( + int $listId, + string $contentType = self::contentTypes['deleteList'][0] + ): void { - $this->deleteListWithHttpInfo($listId); + $this->deleteListWithHttpInfo($listId, $contentType); } /** @@ -2610,15 +3183,18 @@ public function deleteList($listId) * Delete a list * * @param int $listId Id of the list (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteList'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteListWithHttpInfo($listId) + public function deleteListWithHttpInfo( + int $listId, + string $contentType = self::contentTypes['deleteList'][0] + ): array { - $returnType = ''; - $request = $this->deleteListRequest($listId); + $request = $this->deleteListRequest($listId, $contentType); try { $options = $this->createHttpClientOption(); @@ -2627,43 +3203,38 @@ public function deleteListWithHttpInfo($listId) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2679,13 +3250,17 @@ public function deleteListWithHttpInfo($listId) * Delete a list * * @param int $listId Id of the list (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteList'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteListAsync($listId) + public function deleteListAsync( + int $listId, + string $contentType = self::contentTypes['deleteList'][0] + ): PromiseInterface { - return $this->deleteListAsyncWithHttpInfo($listId) + return $this->deleteListAsyncWithHttpInfo($listId, $contentType) ->then( function ($response) { return $response[0]; @@ -2699,14 +3274,19 @@ function ($response) { * Delete a list * * @param int $listId Id of the list (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteList'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteListAsyncWithHttpInfo($listId) + public function deleteListAsyncWithHttpInfo( + $listId, + string $contentType = self::contentTypes['deleteList'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->deleteListRequest($listId); + $request = $this->deleteListRequest($listId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2725,7 +3305,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2735,19 +3315,25 @@ function ($exception) { * Create request for operation 'deleteList' * * @param int $listId Id of the list (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteList'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function deleteListRequest($listId) + public function deleteListRequest( + $listId, + string $contentType = self::contentTypes['deleteList'][0] + ): Request { + // verify the required parameter 'listId' is set if ($listId === null || (is_array($listId) && count($listId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $listId when calling deleteList' ); } + $resourcePath = '/contacts/lists/{listId}'; $formParams = []; $queryParams = []; @@ -2756,6 +3342,7 @@ protected function deleteListRequest($listId) $multipart = false; + // path params if ($listId !== null) { $resourcePath = str_replace( @@ -2765,53 +3352,35 @@ protected function deleteListRequest($listId) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2837,10 +3406,11 @@ protected function deleteListRequest($listId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2852,16 +3422,22 @@ protected function deleteListRequest($listId) * Delete a multiple-choice attribute option * * @param string $attributeType Type of the attribute (required) - * @param string $multipleChoiceAttribute Name of the existing multiple-choice attribute (required) + * @param string $multipleChoiceAttribute Name of the existing muliple-choice attribute (required) * @param string $multipleChoiceAttributeOption Name of the existing multiple-choice attribute option that you want to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteMultiAttributeOptions'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function deleteMultiAttributeOptions($attributeType, $multipleChoiceAttribute, $multipleChoiceAttributeOption) + public function deleteMultiAttributeOptions( + string $attributeType, + string $multipleChoiceAttribute, + string $multipleChoiceAttributeOption, + string $contentType = self::contentTypes['deleteMultiAttributeOptions'][0] + ): void { - $this->deleteMultiAttributeOptionsWithHttpInfo($attributeType, $multipleChoiceAttribute, $multipleChoiceAttributeOption); + $this->deleteMultiAttributeOptionsWithHttpInfo($attributeType, $multipleChoiceAttribute, $multipleChoiceAttributeOption, $contentType); } /** @@ -2870,17 +3446,22 @@ public function deleteMultiAttributeOptions($attributeType, $multipleChoiceAttri * Delete a multiple-choice attribute option * * @param string $attributeType Type of the attribute (required) - * @param string $multipleChoiceAttribute Name of the existing multiple-choice attribute (required) + * @param string $multipleChoiceAttribute Name of the existing muliple-choice attribute (required) * @param string $multipleChoiceAttributeOption Name of the existing multiple-choice attribute option that you want to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteMultiAttributeOptions'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteMultiAttributeOptionsWithHttpInfo($attributeType, $multipleChoiceAttribute, $multipleChoiceAttributeOption) + public function deleteMultiAttributeOptionsWithHttpInfo( + string $attributeType, + string $multipleChoiceAttribute, + string $multipleChoiceAttributeOption, + string $contentType = self::contentTypes['deleteMultiAttributeOptions'][0] + ): array { - $returnType = ''; - $request = $this->deleteMultiAttributeOptionsRequest($attributeType, $multipleChoiceAttribute, $multipleChoiceAttributeOption); + $request = $this->deleteMultiAttributeOptionsRequest($attributeType, $multipleChoiceAttribute, $multipleChoiceAttributeOption, $contentType); try { $options = $this->createHttpClientOption(); @@ -2889,43 +3470,38 @@ public function deleteMultiAttributeOptionsWithHttpInfo($attributeType, $multipl } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2941,15 +3517,21 @@ public function deleteMultiAttributeOptionsWithHttpInfo($attributeType, $multipl * Delete a multiple-choice attribute option * * @param string $attributeType Type of the attribute (required) - * @param string $multipleChoiceAttribute Name of the existing multiple-choice attribute (required) + * @param string $multipleChoiceAttribute Name of the existing muliple-choice attribute (required) * @param string $multipleChoiceAttributeOption Name of the existing multiple-choice attribute option that you want to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteMultiAttributeOptions'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteMultiAttributeOptionsAsync($attributeType, $multipleChoiceAttribute, $multipleChoiceAttributeOption) + public function deleteMultiAttributeOptionsAsync( + string $attributeType, + string $multipleChoiceAttribute, + string $multipleChoiceAttributeOption, + string $contentType = self::contentTypes['deleteMultiAttributeOptions'][0] + ): PromiseInterface { - return $this->deleteMultiAttributeOptionsAsyncWithHttpInfo($attributeType, $multipleChoiceAttribute, $multipleChoiceAttributeOption) + return $this->deleteMultiAttributeOptionsAsyncWithHttpInfo($attributeType, $multipleChoiceAttribute, $multipleChoiceAttributeOption, $contentType) ->then( function ($response) { return $response[0]; @@ -2963,16 +3545,23 @@ function ($response) { * Delete a multiple-choice attribute option * * @param string $attributeType Type of the attribute (required) - * @param string $multipleChoiceAttribute Name of the existing multiple-choice attribute (required) + * @param string $multipleChoiceAttribute Name of the existing muliple-choice attribute (required) * @param string $multipleChoiceAttributeOption Name of the existing multiple-choice attribute option that you want to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteMultiAttributeOptions'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteMultiAttributeOptionsAsyncWithHttpInfo($attributeType, $multipleChoiceAttribute, $multipleChoiceAttributeOption) + public function deleteMultiAttributeOptionsAsyncWithHttpInfo( + $attributeType, + $multipleChoiceAttribute, + $multipleChoiceAttributeOption, + string $contentType = self::contentTypes['deleteMultiAttributeOptions'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->deleteMultiAttributeOptionsRequest($attributeType, $multipleChoiceAttribute, $multipleChoiceAttributeOption); + $request = $this->deleteMultiAttributeOptionsRequest($attributeType, $multipleChoiceAttribute, $multipleChoiceAttributeOption, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2991,7 +3580,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3001,33 +3590,43 @@ function ($exception) { * Create request for operation 'deleteMultiAttributeOptions' * * @param string $attributeType Type of the attribute (required) - * @param string $multipleChoiceAttribute Name of the existing multiple-choice attribute (required) + * @param string $multipleChoiceAttribute Name of the existing muliple-choice attribute (required) * @param string $multipleChoiceAttributeOption Name of the existing multiple-choice attribute option that you want to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteMultiAttributeOptions'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function deleteMultiAttributeOptionsRequest($attributeType, $multipleChoiceAttribute, $multipleChoiceAttributeOption) + public function deleteMultiAttributeOptionsRequest( + $attributeType, + $multipleChoiceAttribute, + $multipleChoiceAttributeOption, + string $contentType = self::contentTypes['deleteMultiAttributeOptions'][0] + ): Request { + // verify the required parameter 'attributeType' is set if ($attributeType === null || (is_array($attributeType) && count($attributeType) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $attributeType when calling deleteMultiAttributeOptions' ); } + // verify the required parameter 'multipleChoiceAttribute' is set if ($multipleChoiceAttribute === null || (is_array($multipleChoiceAttribute) && count($multipleChoiceAttribute) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $multipleChoiceAttribute when calling deleteMultiAttributeOptions' ); } + // verify the required parameter 'multipleChoiceAttributeOption' is set if ($multipleChoiceAttributeOption === null || (is_array($multipleChoiceAttributeOption) && count($multipleChoiceAttributeOption) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $multipleChoiceAttributeOption when calling deleteMultiAttributeOptions' ); } + $resourcePath = '/contacts/attributes/{attributeType}/{multipleChoiceAttribute}/{multipleChoiceAttributeOption}'; $formParams = []; $queryParams = []; @@ -3036,6 +3635,7 @@ protected function deleteMultiAttributeOptionsRequest($attributeType, $multipleC $multipart = false; + // path params if ($attributeType !== null) { $resourcePath = str_replace( @@ -3061,53 +3661,35 @@ protected function deleteMultiAttributeOptionsRequest($attributeType, $multipleC ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3133,10 +3715,11 @@ protected function deleteMultiAttributeOptionsRequest($attributeType, $multipleC $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3147,14 +3730,17 @@ protected function deleteMultiAttributeOptionsRequest($attributeType, $multipleC * * List all attributes * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttributes'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetAttributes + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetAttributes */ - public function getAttributes() + public function getAttributes( + string $contentType = self::contentTypes['getAttributes'][0] + ): \Brevo\Client\Models\GetAttributes { - list($response) = $this->getAttributesWithHttpInfo(); + list($response) = $this->getAttributesWithHttpInfo($contentType); return $response; } @@ -3163,15 +3749,17 @@ public function getAttributes() * * List all attributes * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttributes'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetAttributes, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetAttributes, HTTP status code, HTTP response headers (array of strings) */ - public function getAttributesWithHttpInfo() + public function getAttributesWithHttpInfo( + string $contentType = self::contentTypes['getAttributes'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetAttributes'; - $request = $this->getAttributesRequest(); + $request = $this->getAttributesRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -3180,34 +3768,84 @@ public function getAttributesWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetAttributes', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetAttributes' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetAttributes', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetAttributes'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3222,7 +3860,7 @@ public function getAttributesWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetAttributes', + '\Brevo\Client\Models\GetAttributes', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3237,13 +3875,16 @@ public function getAttributesWithHttpInfo() * * List all attributes * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttributes'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getAttributesAsync() + public function getAttributesAsync( + string $contentType = self::contentTypes['getAttributes'][0] + ): PromiseInterface { - return $this->getAttributesAsyncWithHttpInfo() + return $this->getAttributesAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -3256,24 +3897,27 @@ function ($response) { * * List all attributes * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttributes'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getAttributesAsyncWithHttpInfo() + public function getAttributesAsyncWithHttpInfo( + string $contentType = self::contentTypes['getAttributes'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetAttributes'; - $request = $this->getAttributesRequest(); + $returnType = '\Brevo\Client\Models\GetAttributes'; + $request = $this->getAttributesRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3296,7 +3940,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3305,13 +3949,17 @@ function ($exception) { /** * Create request for operation 'getAttributes' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttributes'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getAttributesRequest() + public function getAttributesRequest( + string $contentType = self::contentTypes['getAttributes'][0] + ): Request { + $resourcePath = '/contacts/attributes'; $formParams = []; $queryParams = []; @@ -3321,53 +3969,36 @@ protected function getAttributesRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3393,10 +4024,11 @@ protected function getAttributesRequest() $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3405,41 +4037,54 @@ protected function getAttributesRequest() /** * Operation getContactInfo * - * Get a contact's details + * Get a contact's details * - * @param string $identifier Email (urlencoded) OR ID of the contact OR its SMS attribute value OR EXT_ID attribute (urlencoded) (required) - * @param object $identifierType email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute (optional) - * @param string $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate (optional) - * @param string $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. (optional) + * @param \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier Email (urlencoded) OR ID of the contact OR its SMS attribute value OR EXT_ID attribute (urlencoded) (required) + * @param string|null $identifierType email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute (optional) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactInfo'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetExtendedContactDetails + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetExtendedContactDetails|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function getContactInfo($identifier, $identifierType = null, $startDate = null, $endDate = null) + public function getContactInfo( + \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier, + ?string $identifierType = null, + ?string $startDate = null, + ?string $endDate = null, + string $contentType = self::contentTypes['getContactInfo'][0] + ): \Brevo\Client\Models\GetExtendedContactDetails { - list($response) = $this->getContactInfoWithHttpInfo($identifier, $identifierType, $startDate, $endDate); + list($response) = $this->getContactInfoWithHttpInfo($identifier, $identifierType, $startDate, $endDate, $contentType); return $response; } /** * Operation getContactInfoWithHttpInfo * - * Get a contact's details + * Get a contact's details * - * @param string $identifier Email (urlencoded) OR ID of the contact OR its SMS attribute value OR EXT_ID attribute (urlencoded) (required) - * @param object $identifierType email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute (optional) - * @param string $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate (optional) - * @param string $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. (optional) + * @param \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier Email (urlencoded) OR ID of the contact OR its SMS attribute value OR EXT_ID attribute (urlencoded) (required) + * @param string|null $identifierType email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute (optional) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactInfo'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetExtendedContactDetails, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetExtendedContactDetails|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getContactInfoWithHttpInfo($identifier, $identifierType = null, $startDate = null, $endDate = null) + public function getContactInfoWithHttpInfo( + \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier, + ?string $identifierType = null, + ?string $startDate = null, + ?string $endDate = null, + string $contentType = self::contentTypes['getContactInfo'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetExtendedContactDetails'; - $request = $this->getContactInfoRequest($identifier, $identifierType, $startDate, $endDate); + $request = $this->getContactInfoRequest($identifier, $identifierType, $startDate, $endDate, $contentType); try { $options = $this->createHttpClientOption(); @@ -3448,34 +4093,138 @@ public function getContactInfoWithHttpInfo($identifier, $identifierType = null, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetExtendedContactDetails', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetExtendedContactDetails' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetExtendedContactDetails', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetExtendedContactDetails'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3490,23 +4239,23 @@ public function getContactInfoWithHttpInfo($identifier, $identifierType = null, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetExtendedContactDetails', + '\Brevo\Client\Models\GetExtendedContactDetails', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3519,19 +4268,26 @@ public function getContactInfoWithHttpInfo($identifier, $identifierType = null, /** * Operation getContactInfoAsync * - * Get a contact's details + * Get a contact's details * - * @param string $identifier Email (urlencoded) OR ID of the contact OR its SMS attribute value OR EXT_ID attribute (urlencoded) (required) - * @param object $identifierType email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute (optional) - * @param string $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate (optional) - * @param string $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. (optional) + * @param \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier Email (urlencoded) OR ID of the contact OR its SMS attribute value OR EXT_ID attribute (urlencoded) (required) + * @param string|null $identifierType email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute (optional) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactInfo'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getContactInfoAsync($identifier, $identifierType = null, $startDate = null, $endDate = null) + public function getContactInfoAsync( + \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier, + ?string $identifierType = null, + ?string $startDate = null, + ?string $endDate = null, + string $contentType = self::contentTypes['getContactInfo'][0] + ): PromiseInterface { - return $this->getContactInfoAsyncWithHttpInfo($identifier, $identifierType, $startDate, $endDate) + return $this->getContactInfoAsyncWithHttpInfo($identifier, $identifierType, $startDate, $endDate, $contentType) ->then( function ($response) { return $response[0]; @@ -3542,30 +4298,37 @@ function ($response) { /** * Operation getContactInfoAsyncWithHttpInfo * - * Get a contact's details + * Get a contact's details * - * @param string $identifier Email (urlencoded) OR ID of the contact OR its SMS attribute value OR EXT_ID attribute (urlencoded) (required) - * @param object $identifierType email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute (optional) - * @param string $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate (optional) - * @param string $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. (optional) + * @param \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier Email (urlencoded) OR ID of the contact OR its SMS attribute value OR EXT_ID attribute (urlencoded) (required) + * @param string|null $identifierType email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute (optional) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactInfo'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getContactInfoAsyncWithHttpInfo($identifier, $identifierType = null, $startDate = null, $endDate = null) + public function getContactInfoAsyncWithHttpInfo( + $identifier, + $identifierType = null, + $startDate = null, + $endDate = null, + string $contentType = self::contentTypes['getContactInfo'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetExtendedContactDetails'; - $request = $this->getContactInfoRequest($identifier, $identifierType, $startDate, $endDate); + $returnType = '\Brevo\Client\Models\GetExtendedContactDetails'; + $request = $this->getContactInfoRequest($identifier, $identifierType, $startDate, $endDate, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3588,7 +4351,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3597,23 +4360,35 @@ function ($exception) { /** * Create request for operation 'getContactInfo' * - * @param string $identifier Email (urlencoded) OR ID of the contact OR its SMS attribute value OR EXT_ID attribute (urlencoded) (required) - * @param object $identifierType email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute (optional) - * @param string $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate (optional) - * @param string $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. (optional) + * @param \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier Email (urlencoded) OR ID of the contact OR its SMS attribute value OR EXT_ID attribute (urlencoded) (required) + * @param string|null $identifierType email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute (optional) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactInfo'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getContactInfoRequest($identifier, $identifierType = null, $startDate = null, $endDate = null) + public function getContactInfoRequest( + $identifier, + $identifierType = null, + $startDate = null, + $endDate = null, + string $contentType = self::contentTypes['getContactInfo'][0] + ): Request { + // verify the required parameter 'identifier' is set if ($identifier === null || (is_array($identifier) && count($identifier) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $identifier when calling getContactInfo' ); } + + + + $resourcePath = '/contacts/{identifier}'; $formParams = []; $queryParams = []; @@ -3622,17 +4397,33 @@ protected function getContactInfoRequest($identifier, $identifierType = null, $s $multipart = false; // query params - if ($identifierType !== null) { - $queryParams['identifierType'] = ObjectSerializer::toQueryValue($identifierType); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $identifierType, + 'identifierType', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($startDate !== null) { - $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($endDate !== null) { - $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // path params if ($identifier !== null) { @@ -3643,53 +4434,35 @@ protected function getContactInfoRequest($identifier, $identifierType = null, $s ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3715,10 +4488,11 @@ protected function getContactInfoRequest($identifier, $identifierType = null, $s $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3727,39 +4501,50 @@ protected function getContactInfoRequest($identifier, $identifierType = null, $s /** * Operation getContactStats * - * Get email campaigns' statistics for a contact + * Get email campaigns' statistics for a contact * - * @param string $identifier Email (urlencoded) OR ID of the contact (required) - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate (optional) - * @param string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days (optional) + * @param \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier Email (urlencoded) OR ID of the contact (required) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactStats'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetContactCampaignStats + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetContactCampaignStats|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function getContactStats($identifier, $startDate = null, $endDate = null) + public function getContactStats( + \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier, + ?string $startDate = null, + ?string $endDate = null, + string $contentType = self::contentTypes['getContactStats'][0] + ): \Brevo\Client\Models\GetContactCampaignStats { - list($response) = $this->getContactStatsWithHttpInfo($identifier, $startDate, $endDate); + list($response) = $this->getContactStatsWithHttpInfo($identifier, $startDate, $endDate, $contentType); return $response; } /** * Operation getContactStatsWithHttpInfo * - * Get email campaigns' statistics for a contact + * Get email campaigns' statistics for a contact * - * @param string $identifier Email (urlencoded) OR ID of the contact (required) - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate (optional) - * @param string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days (optional) + * @param \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier Email (urlencoded) OR ID of the contact (required) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactStats'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetContactCampaignStats, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetContactCampaignStats|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getContactStatsWithHttpInfo($identifier, $startDate = null, $endDate = null) + public function getContactStatsWithHttpInfo( + \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier, + ?string $startDate = null, + ?string $endDate = null, + string $contentType = self::contentTypes['getContactStats'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetContactCampaignStats'; - $request = $this->getContactStatsRequest($identifier, $startDate, $endDate); + $request = $this->getContactStatsRequest($identifier, $startDate, $endDate, $contentType); try { $options = $this->createHttpClientOption(); @@ -3768,34 +4553,138 @@ public function getContactStatsWithHttpInfo($identifier, $startDate = null, $end } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetContactCampaignStats', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetContactCampaignStats' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetContactCampaignStats', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetContactCampaignStats'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3810,23 +4699,23 @@ public function getContactStatsWithHttpInfo($identifier, $startDate = null, $end case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetContactCampaignStats', + '\Brevo\Client\Models\GetContactCampaignStats', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3839,18 +4728,24 @@ public function getContactStatsWithHttpInfo($identifier, $startDate = null, $end /** * Operation getContactStatsAsync * - * Get email campaigns' statistics for a contact + * Get email campaigns' statistics for a contact * - * @param string $identifier Email (urlencoded) OR ID of the contact (required) - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate (optional) - * @param string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days (optional) + * @param \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier Email (urlencoded) OR ID of the contact (required) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactStats'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getContactStatsAsync($identifier, $startDate = null, $endDate = null) + public function getContactStatsAsync( + \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier, + ?string $startDate = null, + ?string $endDate = null, + string $contentType = self::contentTypes['getContactStats'][0] + ): PromiseInterface { - return $this->getContactStatsAsyncWithHttpInfo($identifier, $startDate, $endDate) + return $this->getContactStatsAsyncWithHttpInfo($identifier, $startDate, $endDate, $contentType) ->then( function ($response) { return $response[0]; @@ -3861,29 +4756,35 @@ function ($response) { /** * Operation getContactStatsAsyncWithHttpInfo * - * Get email campaigns' statistics for a contact + * Get email campaigns' statistics for a contact * - * @param string $identifier Email (urlencoded) OR ID of the contact (required) - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate (optional) - * @param string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days (optional) + * @param \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier Email (urlencoded) OR ID of the contact (required) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactStats'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getContactStatsAsyncWithHttpInfo($identifier, $startDate = null, $endDate = null) + public function getContactStatsAsyncWithHttpInfo( + $identifier, + $startDate = null, + $endDate = null, + string $contentType = self::contentTypes['getContactStats'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetContactCampaignStats'; - $request = $this->getContactStatsRequest($identifier, $startDate, $endDate); + $returnType = '\Brevo\Client\Models\GetContactCampaignStats'; + $request = $this->getContactStatsRequest($identifier, $startDate, $endDate, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3906,7 +4807,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3915,22 +4816,32 @@ function ($exception) { /** * Create request for operation 'getContactStats' * - * @param string $identifier Email (urlencoded) OR ID of the contact (required) - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate (optional) - * @param string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days (optional) + * @param \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier Email (urlencoded) OR ID of the contact (required) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactStats'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getContactStatsRequest($identifier, $startDate = null, $endDate = null) + public function getContactStatsRequest( + $identifier, + $startDate = null, + $endDate = null, + string $contentType = self::contentTypes['getContactStats'][0] + ): Request { + // verify the required parameter 'identifier' is set if ($identifier === null || (is_array($identifier) && count($identifier) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $identifier when calling getContactStats' ); } + + + $resourcePath = '/contacts/{identifier}/campaignStats'; $formParams = []; $queryParams = []; @@ -3939,13 +4850,24 @@ protected function getContactStatsRequest($identifier, $startDate = null, $endDa $multipart = false; // query params - if ($startDate !== null) { - $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($endDate !== null) { - $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // path params if ($identifier !== null) { @@ -3956,53 +4878,35 @@ protected function getContactStatsRequest($identifier, $startDate = null, $endDa ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4028,10 +4932,11 @@ protected function getContactStatsRequest($identifier, $startDate = null, $endDa $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4042,22 +4947,33 @@ protected function getContactStatsRequest($identifier, $startDate = null, $endDa * * 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 string $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 string $createdSince Filter (urlencoded) the contacts created 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param int $segmentId Id of the segment. **Either listIds or segmentId can be passed.** (optional) - * @param int[] $listIds Ids of the list. **Either listIds or segmentId can be passed.** (optional) - * @param string $filter Filter the contacts on the basis of attributes. **Allowed operator: equals. (e.g. filter=equals(FIRSTNAME,\"Antoine\"), filter=equals(B1, true), filter=equals(DOB, \"1989-11-23\"))** (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetContacts - */ - public function getContacts($limit = '50', $offset = '0', $modifiedSince = null, $createdSince = null, $sort = 'desc', $segmentId = null, $listIds = null, $filter = null) - { - list($response) = $this->getContactsWithHttpInfo($limit, $offset, $modifiedSince, $createdSince, $sort, $segmentId, $listIds, $filter); + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $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 string|null $createdSince Filter (urlencoded) the contacts created 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 string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param int|null $segmentId Id of the segment. **Either listIds or segmentId can be passed.** (optional) + * @param int[]|null $listIds Ids of the list. **Either listIds or segmentId can be passed.** (optional) + * @param string|null $filter Filter the contacts on the basis of attributes. **Allowed operator: equals. (e.g. filter=equals(FIRSTNAME,\"Antoine\"), filter=equals(B1, true), filter=equals(DOB, \"1989-11-23\"))** (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContacts'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetContacts|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel + */ + public function getContacts( + ?int $limit = 50, + ?int $offset = 0, + ?string $modifiedSince = null, + ?string $createdSince = null, + ?string $sort = 'desc', + ?int $segmentId = null, + ?array $listIds = null, + ?string $filter = null, + string $contentType = self::contentTypes['getContacts'][0] + ): \Brevo\Client\Models\GetContacts + { + list($response) = $this->getContactsWithHttpInfo($limit, $offset, $modifiedSince, $createdSince, $sort, $segmentId, $listIds, $filter, $contentType); return $response; } @@ -4066,23 +4982,33 @@ public function getContacts($limit = '50', $offset = '0', $modifiedSince = null, * * 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 string $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 string $createdSince Filter (urlencoded) the contacts created 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param int $segmentId Id of the segment. **Either listIds or segmentId can be passed.** (optional) - * @param int[] $listIds Ids of the list. **Either listIds or segmentId can be passed.** (optional) - * @param string $filter Filter the contacts on the basis of attributes. **Allowed operator: equals. (e.g. filter=equals(FIRSTNAME,\"Antoine\"), filter=equals(B1, true), filter=equals(DOB, \"1989-11-23\"))** (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetContacts, HTTP status code, HTTP response headers (array of strings) - */ - public function getContactsWithHttpInfo($limit = '50', $offset = '0', $modifiedSince = null, $createdSince = null, $sort = 'desc', $segmentId = null, $listIds = null, $filter = null) - { - $returnType = '\Brevo\Client\Model\GetContacts'; - $request = $this->getContactsRequest($limit, $offset, $modifiedSince, $createdSince, $sort, $segmentId, $listIds, $filter); + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $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 string|null $createdSince Filter (urlencoded) the contacts created 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 string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param int|null $segmentId Id of the segment. **Either listIds or segmentId can be passed.** (optional) + * @param int[]|null $listIds Ids of the list. **Either listIds or segmentId can be passed.** (optional) + * @param string|null $filter Filter the contacts on the basis of attributes. **Allowed operator: equals. (e.g. filter=equals(FIRSTNAME,\"Antoine\"), filter=equals(B1, true), filter=equals(DOB, \"1989-11-23\"))** (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContacts'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetContacts|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) + */ + public function getContactsWithHttpInfo( + ?int $limit = 50, + ?int $offset = 0, + ?string $modifiedSince = null, + ?string $createdSince = null, + ?string $sort = 'desc', + ?int $segmentId = null, + ?array $listIds = null, + ?string $filter = null, + string $contentType = self::contentTypes['getContacts'][0] + ): array + { + $request = $this->getContactsRequest($limit, $offset, $modifiedSince, $createdSince, $sort, $segmentId, $listIds, $filter, $contentType); try { $options = $this->createHttpClientOption(); @@ -4091,34 +5017,138 @@ public function getContactsWithHttpInfo($limit = '50', $offset = '0', $modifiedS } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetContacts', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetContacts' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetContacts', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetContacts'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -4133,7 +5163,7 @@ public function getContactsWithHttpInfo($limit = '50', $offset = '0', $modifiedS case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetContacts', + '\Brevo\Client\Models\GetContacts', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4141,7 +5171,7 @@ public function getContactsWithHttpInfo($limit = '50', $offset = '0', $modifiedS case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4149,7 +5179,7 @@ public function getContactsWithHttpInfo($limit = '50', $offset = '0', $modifiedS case 429: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4164,21 +5194,32 @@ public function getContactsWithHttpInfo($limit = '50', $offset = '0', $modifiedS * * 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 string $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 string $createdSince Filter (urlencoded) the contacts created 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param int $segmentId Id of the segment. **Either listIds or segmentId can be passed.** (optional) - * @param int[] $listIds Ids of the list. **Either listIds or segmentId can be passed.** (optional) - * @param string $filter Filter the contacts on the basis of attributes. **Allowed operator: equals. (e.g. filter=equals(FIRSTNAME,\"Antoine\"), filter=equals(B1, true), filter=equals(DOB, \"1989-11-23\"))** (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getContactsAsync($limit = '50', $offset = '0', $modifiedSince = null, $createdSince = null, $sort = 'desc', $segmentId = null, $listIds = null, $filter = null) - { - return $this->getContactsAsyncWithHttpInfo($limit, $offset, $modifiedSince, $createdSince, $sort, $segmentId, $listIds, $filter) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $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 string|null $createdSince Filter (urlencoded) the contacts created 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 string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param int|null $segmentId Id of the segment. **Either listIds or segmentId can be passed.** (optional) + * @param int[]|null $listIds Ids of the list. **Either listIds or segmentId can be passed.** (optional) + * @param string|null $filter Filter the contacts on the basis of attributes. **Allowed operator: equals. (e.g. filter=equals(FIRSTNAME,\"Antoine\"), filter=equals(B1, true), filter=equals(DOB, \"1989-11-23\"))** (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContacts'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getContactsAsync( + ?int $limit = 50, + ?int $offset = 0, + ?string $modifiedSince = null, + ?string $createdSince = null, + ?string $sort = 'desc', + ?int $segmentId = null, + ?array $listIds = null, + ?string $filter = null, + string $contentType = self::contentTypes['getContacts'][0] + ): PromiseInterface + { + return $this->getContactsAsyncWithHttpInfo($limit, $offset, $modifiedSince, $createdSince, $sort, $segmentId, $listIds, $filter, $contentType) ->then( function ($response) { return $response[0]; @@ -4191,32 +5232,43 @@ function ($response) { * * 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 string $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 string $createdSince Filter (urlencoded) the contacts created 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param int $segmentId Id of the segment. **Either listIds or segmentId can be passed.** (optional) - * @param int[] $listIds Ids of the list. **Either listIds or segmentId can be passed.** (optional) - * @param string $filter Filter the contacts on the basis of attributes. **Allowed operator: equals. (e.g. filter=equals(FIRSTNAME,\"Antoine\"), filter=equals(B1, true), filter=equals(DOB, \"1989-11-23\"))** (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getContactsAsyncWithHttpInfo($limit = '50', $offset = '0', $modifiedSince = null, $createdSince = null, $sort = 'desc', $segmentId = null, $listIds = null, $filter = null) - { - $returnType = '\Brevo\Client\Model\GetContacts'; - $request = $this->getContactsRequest($limit, $offset, $modifiedSince, $createdSince, $sort, $segmentId, $listIds, $filter); + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $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 string|null $createdSince Filter (urlencoded) the contacts created 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 string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param int|null $segmentId Id of the segment. **Either listIds or segmentId can be passed.** (optional) + * @param int[]|null $listIds Ids of the list. **Either listIds or segmentId can be passed.** (optional) + * @param string|null $filter Filter the contacts on the basis of attributes. **Allowed operator: equals. (e.g. filter=equals(FIRSTNAME,\"Antoine\"), filter=equals(B1, true), filter=equals(DOB, \"1989-11-23\"))** (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContacts'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getContactsAsyncWithHttpInfo( + $limit = 50, + $offset = 0, + $modifiedSince = null, + $createdSince = null, + $sort = 'desc', + $segmentId = null, + $listIds = null, + $filter = null, + string $contentType = self::contentTypes['getContacts'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\GetContacts'; + $request = $this->getContactsRequest($limit, $offset, $modifiedSince, $createdSince, $sort, $segmentId, $listIds, $filter, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4239,7 +5291,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4248,26 +5300,45 @@ function ($exception) { /** * 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 string $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 string $createdSince Filter (urlencoded) the contacts created 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param int $segmentId Id of the segment. **Either listIds or segmentId can be passed.** (optional) - * @param int[] $listIds Ids of the list. **Either listIds or segmentId can be passed.** (optional) - * @param string $filter Filter the contacts on the basis of attributes. **Allowed operator: equals. (e.g. filter=equals(FIRSTNAME,\"Antoine\"), filter=equals(B1, true), filter=equals(DOB, \"1989-11-23\"))** (optional) - * - * @throws \InvalidArgumentException + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $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 string|null $createdSince Filter (urlencoded) the contacts created 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 string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param int|null $segmentId Id of the segment. **Either listIds or segmentId can be passed.** (optional) + * @param int[]|null $listIds Ids of the list. **Either listIds or segmentId can be passed.** (optional) + * @param string|null $filter Filter the contacts on the basis of attributes. **Allowed operator: equals. (e.g. filter=equals(FIRSTNAME,\"Antoine\"), filter=equals(B1, true), filter=equals(DOB, \"1989-11-23\"))** (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContacts'] to see the possible values for this operation + * + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getContactsRequest($limit = '50', $offset = '0', $modifiedSince = null, $createdSince = null, $sort = 'desc', $segmentId = null, $listIds = null, $filter = null) + public function getContactsRequest( + $limit = 50, + $offset = 0, + $modifiedSince = null, + $createdSince = null, + $sort = 'desc', + $segmentId = null, + $listIds = null, + $filter = null, + string $contentType = self::contentTypes['getContacts'][0] + ): Request { + if ($limit !== null && $limit > 1000) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getContacts, must be smaller than or equal to 1000.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getContacts, must be smaller than or equal to 1000.'); } if ($limit !== null && $limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getContacts, must be bigger than or equal to 0.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getContacts, must be bigger than or equal to 0.'); } + + + + + + + $resourcePath = '/contacts'; @@ -4278,89 +5349,109 @@ protected function getContactsRequest($limit = '50', $offset = '0', $modifiedSin $multipart = false; // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($modifiedSince !== null) { - $queryParams['modifiedSince'] = ObjectSerializer::toQueryValue($modifiedSince); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $modifiedSince, + 'modifiedSince', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($createdSince !== null) { - $queryParams['createdSince'] = ObjectSerializer::toQueryValue($createdSince); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $createdSince, + 'createdSince', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($segmentId !== null) { - $queryParams['segmentId'] = ObjectSerializer::toQueryValue($segmentId); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $segmentId, + 'segmentId', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if (is_array($listIds)) { - $queryParams['listIds'] = $listIds; - } else - if ($listIds !== null) { - $queryParams['listIds'] = ObjectSerializer::toQueryValue($listIds); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $listIds, + 'listIds', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($filter !== null) { - $queryParams['filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + 'filter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4386,10 +5477,11 @@ protected function getContactsRequest($limit = '50', $offset = '0', $modifiedSin $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4401,18 +5493,26 @@ protected function getContactsRequest($limit = '50', $offset = '0', $modifiedSin * Get contacts in a list * * @param int $listId Id of the list (required) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetContacts - */ - public function getContactsFromList($listId, $modifiedSince = null, $limit = '50', $offset = '0', $sort = 'desc') - { - list($response) = $this->getContactsFromListWithHttpInfo($listId, $modifiedSince, $limit, $offset, $sort); + * @param string|null $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|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactsFromList'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetContacts|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel + */ + public function getContactsFromList( + int $listId, + ?string $modifiedSince = null, + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getContactsFromList'][0] + ): \Brevo\Client\Models\GetContacts + { + list($response) = $this->getContactsFromListWithHttpInfo($listId, $modifiedSince, $limit, $offset, $sort, $contentType); return $response; } @@ -4422,19 +5522,26 @@ public function getContactsFromList($listId, $modifiedSince = null, $limit = '50 * Get contacts in a list * * @param int $listId Id of the list (required) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetContacts, HTTP status code, HTTP response headers (array of strings) - */ - public function getContactsFromListWithHttpInfo($listId, $modifiedSince = null, $limit = '50', $offset = '0', $sort = 'desc') - { - $returnType = '\Brevo\Client\Model\GetContacts'; - $request = $this->getContactsFromListRequest($listId, $modifiedSince, $limit, $offset, $sort); + * @param string|null $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|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactsFromList'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetContacts|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) + */ + public function getContactsFromListWithHttpInfo( + int $listId, + ?string $modifiedSince = null, + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getContactsFromList'][0] + ): array + { + $request = $this->getContactsFromListRequest($listId, $modifiedSince, $limit, $offset, $sort, $contentType); try { $options = $this->createHttpClientOption(); @@ -4443,34 +5550,138 @@ public function getContactsFromListWithHttpInfo($listId, $modifiedSince = null, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetContacts', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetContacts' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetContacts', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetContacts'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -4485,7 +5696,7 @@ public function getContactsFromListWithHttpInfo($listId, $modifiedSince = null, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetContacts', + '\Brevo\Client\Models\GetContacts', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4493,7 +5704,7 @@ public function getContactsFromListWithHttpInfo($listId, $modifiedSince = null, case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4501,7 +5712,7 @@ public function getContactsFromListWithHttpInfo($listId, $modifiedSince = null, case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4517,17 +5728,25 @@ public function getContactsFromListWithHttpInfo($listId, $modifiedSince = null, * Get contacts in a list * * @param int $listId Id of the list (required) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getContactsFromListAsync($listId, $modifiedSince = null, $limit = '50', $offset = '0', $sort = 'desc') - { - return $this->getContactsFromListAsyncWithHttpInfo($listId, $modifiedSince, $limit, $offset, $sort) + * @param string|null $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|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactsFromList'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getContactsFromListAsync( + int $listId, + ?string $modifiedSince = null, + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getContactsFromList'][0] + ): PromiseInterface + { + return $this->getContactsFromListAsyncWithHttpInfo($listId, $modifiedSince, $limit, $offset, $sort, $contentType) ->then( function ($response) { return $response[0]; @@ -4541,28 +5760,36 @@ function ($response) { * Get contacts in a list * * @param int $listId Id of the list (required) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getContactsFromListAsyncWithHttpInfo($listId, $modifiedSince = null, $limit = '50', $offset = '0', $sort = 'desc') - { - $returnType = '\Brevo\Client\Model\GetContacts'; - $request = $this->getContactsFromListRequest($listId, $modifiedSince, $limit, $offset, $sort); + * @param string|null $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|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactsFromList'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getContactsFromListAsyncWithHttpInfo( + $listId, + $modifiedSince = null, + $limit = 50, + $offset = 0, + $sort = 'desc', + string $contentType = self::contentTypes['getContactsFromList'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\GetContacts'; + $request = $this->getContactsFromListRequest($listId, $modifiedSince, $limit, $offset, $sort, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4585,7 +5812,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4595,28 +5822,41 @@ function ($exception) { * Create request for operation 'getContactsFromList' * * @param int $listId Id of the list (required) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param string|null $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|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactsFromList'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getContactsFromListRequest($listId, $modifiedSince = null, $limit = '50', $offset = '0', $sort = 'desc') + public function getContactsFromListRequest( + $listId, + $modifiedSince = null, + $limit = 50, + $offset = 0, + $sort = 'desc', + string $contentType = self::contentTypes['getContactsFromList'][0] + ): Request { + // verify the required parameter 'listId' is set if ($listId === null || (is_array($listId) && count($listId) === 0)) { - throw new \InvalidArgumentException( + 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 ContactsApi.getContactsFromList, must be smaller than or equal to 500.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getContactsFromList, must be smaller than or equal to 500.'); } if ($limit !== null && $limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getContactsFromList, must be bigger than or equal to 0.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getContactsFromList, must be bigger than or equal to 0.'); } + + $resourcePath = '/contacts/lists/{listId}/contacts'; @@ -4627,21 +5867,42 @@ protected function getContactsFromListRequest($listId, $modifiedSince = null, $l $multipart = false; // query params - if ($modifiedSince !== null) { - $queryParams['modifiedSince'] = ObjectSerializer::toQueryValue($modifiedSince); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $modifiedSince, + 'modifiedSince', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // path params if ($listId !== null) { @@ -4652,53 +5913,35 @@ protected function getContactsFromListRequest($listId, $modifiedSince = null, $l ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4724,10 +5967,11 @@ protected function getContactsFromListRequest($listId, $modifiedSince = null, $l $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4736,35 +5980,42 @@ protected function getContactsFromListRequest($listId, $modifiedSince = null, $l /** * Operation getFolder * - * Returns a folder's details + * Returns a folder's details * * @param int $folderId id of the folder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolder'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetFolder + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetFolder|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function getFolder($folderId) + public function getFolder( + int $folderId, + string $contentType = self::contentTypes['getFolder'][0] + ): \Brevo\Client\Models\GetFolder { - list($response) = $this->getFolderWithHttpInfo($folderId); + list($response) = $this->getFolderWithHttpInfo($folderId, $contentType); return $response; } /** * Operation getFolderWithHttpInfo * - * Returns a folder's details + * Returns a folder's details * * @param int $folderId id of the folder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolder'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetFolder, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetFolder|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getFolderWithHttpInfo($folderId) + public function getFolderWithHttpInfo( + int $folderId, + string $contentType = self::contentTypes['getFolder'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetFolder'; - $request = $this->getFolderRequest($folderId); + $request = $this->getFolderRequest($folderId, $contentType); try { $options = $this->createHttpClientOption(); @@ -4773,34 +6024,138 @@ public function getFolderWithHttpInfo($folderId) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetFolder', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetFolder' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetFolder', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetFolder'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -4815,23 +6170,23 @@ public function getFolderWithHttpInfo($folderId) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetFolder', + '\Brevo\Client\Models\GetFolder', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4844,16 +6199,20 @@ public function getFolderWithHttpInfo($folderId) /** * Operation getFolderAsync * - * Returns a folder's details + * Returns a folder's details * * @param int $folderId id of the folder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolder'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getFolderAsync($folderId) + public function getFolderAsync( + int $folderId, + string $contentType = self::contentTypes['getFolder'][0] + ): PromiseInterface { - return $this->getFolderAsyncWithHttpInfo($folderId) + return $this->getFolderAsyncWithHttpInfo($folderId, $contentType) ->then( function ($response) { return $response[0]; @@ -4864,27 +6223,31 @@ function ($response) { /** * Operation getFolderAsyncWithHttpInfo * - * Returns a folder's details + * Returns a folder's details * * @param int $folderId id of the folder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolder'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getFolderAsyncWithHttpInfo($folderId) + public function getFolderAsyncWithHttpInfo( + $folderId, + string $contentType = self::contentTypes['getFolder'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetFolder'; - $request = $this->getFolderRequest($folderId); + $returnType = '\Brevo\Client\Models\GetFolder'; + $request = $this->getFolderRequest($folderId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4907,7 +6270,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4917,19 +6280,25 @@ function ($exception) { * Create request for operation 'getFolder' * * @param int $folderId id of the folder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolder'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getFolderRequest($folderId) + public function getFolderRequest( + $folderId, + string $contentType = self::contentTypes['getFolder'][0] + ): Request { + // verify the required parameter 'folderId' is set if ($folderId === null || (is_array($folderId) && count($folderId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $folderId when calling getFolder' ); } + $resourcePath = '/contacts/folders/{folderId}'; $formParams = []; $queryParams = []; @@ -4938,6 +6307,7 @@ protected function getFolderRequest($folderId) $multipart = false; + // path params if ($folderId !== null) { $resourcePath = str_replace( @@ -4947,53 +6317,35 @@ protected function getFolderRequest($folderId) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5019,10 +6371,11 @@ protected function getFolderRequest($folderId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5034,17 +6387,24 @@ protected function getFolderRequest($folderId) * Get 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetFolderLists - */ - public function getFolderLists($folderId, $limit = '10', $offset = '0', $sort = 'desc') - { - list($response) = $this->getFolderListsWithHttpInfo($folderId, $limit, $offset, $sort); + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolderLists'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetFolderLists|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel + */ + public function getFolderLists( + int $folderId, + ?int $limit = 10, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getFolderLists'][0] + ): \Brevo\Client\Models\GetFolderLists + { + list($response) = $this->getFolderListsWithHttpInfo($folderId, $limit, $offset, $sort, $contentType); return $response; } @@ -5054,18 +6414,24 @@ public function getFolderLists($folderId, $limit = '10', $offset = '0', $sort = * Get 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolderLists'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetFolderLists, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetFolderLists|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getFolderListsWithHttpInfo($folderId, $limit = '10', $offset = '0', $sort = 'desc') + public function getFolderListsWithHttpInfo( + int $folderId, + ?int $limit = 10, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getFolderLists'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetFolderLists'; - $request = $this->getFolderListsRequest($folderId, $limit, $offset, $sort); + $request = $this->getFolderListsRequest($folderId, $limit, $offset, $sort, $contentType); try { $options = $this->createHttpClientOption(); @@ -5074,34 +6440,138 @@ public function getFolderListsWithHttpInfo($folderId, $limit = '10', $offset = ' } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetFolderLists', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetFolderLists' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetFolderLists', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetFolderLists'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -5116,23 +6586,23 @@ public function getFolderListsWithHttpInfo($folderId, $limit = '10', $offset = ' case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetFolderLists', + '\Brevo\Client\Models\GetFolderLists', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5148,16 +6618,23 @@ public function getFolderListsWithHttpInfo($folderId, $limit = '10', $offset = ' * Get 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getFolderListsAsync($folderId, $limit = '10', $offset = '0', $sort = 'desc') - { - return $this->getFolderListsAsyncWithHttpInfo($folderId, $limit, $offset, $sort) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolderLists'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getFolderListsAsync( + int $folderId, + ?int $limit = 10, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getFolderLists'][0] + ): PromiseInterface + { + return $this->getFolderListsAsyncWithHttpInfo($folderId, $limit, $offset, $sort, $contentType) ->then( function ($response) { return $response[0]; @@ -5171,27 +6648,34 @@ function ($response) { * Get 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getFolderListsAsyncWithHttpInfo($folderId, $limit = '10', $offset = '0', $sort = 'desc') - { - $returnType = '\Brevo\Client\Model\GetFolderLists'; - $request = $this->getFolderListsRequest($folderId, $limit, $offset, $sort); + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolderLists'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getFolderListsAsyncWithHttpInfo( + $folderId, + $limit = 10, + $offset = 0, + $sort = 'desc', + string $contentType = self::contentTypes['getFolderLists'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\GetFolderLists'; + $request = $this->getFolderListsRequest($folderId, $limit, $offset, $sort, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5214,7 +6698,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5224,27 +6708,38 @@ function ($exception) { * 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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolderLists'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getFolderListsRequest($folderId, $limit = '10', $offset = '0', $sort = 'desc') + public function getFolderListsRequest( + $folderId, + $limit = 10, + $offset = 0, + $sort = 'desc', + string $contentType = self::contentTypes['getFolderLists'][0] + ): Request { + // verify the required parameter 'folderId' is set if ($folderId === null || (is_array($folderId) && count($folderId) === 0)) { - throw new \InvalidArgumentException( + 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 ContactsApi.getFolderLists, must be smaller than or equal to 50.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getFolderLists, must be smaller than or equal to 50.'); } if ($limit !== null && $limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getFolderLists, must be bigger than or equal to 0.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getFolderLists, must be bigger than or equal to 0.'); } + + $resourcePath = '/contacts/folders/{folderId}/lists'; @@ -5255,17 +6750,33 @@ protected function getFolderListsRequest($folderId, $limit = '10', $offset = '0' $multipart = false; // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // path params if ($folderId !== null) { @@ -5276,53 +6787,35 @@ protected function getFolderListsRequest($folderId, $limit = '10', $offset = '0' ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5348,10 +6841,11 @@ protected function getFolderListsRequest($folderId, $limit = '10', $offset = '0' $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5362,17 +6856,23 @@ protected function getFolderListsRequest($folderId, $limit = '10', $offset = '0' * * Get all folders * - * @param int $limit Number of documents per page (required) - * @param int $offset Index of the first document of the page (required) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolders'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetFolders + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetFolders|\Brevo\Client\Models\ErrorModel */ - public function getFolders($limit, $offset, $sort = 'desc') + public function getFolders( + ?int $limit = 10, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getFolders'][0] + ): \Brevo\Client\Models\GetFolders { - list($response) = $this->getFoldersWithHttpInfo($limit, $offset, $sort); + list($response) = $this->getFoldersWithHttpInfo($limit, $offset, $sort, $contentType); return $response; } @@ -5381,18 +6881,23 @@ public function getFolders($limit, $offset, $sort = 'desc') * * Get all folders * - * @param int $limit Number of documents per page (required) - * @param int $offset Index of the first document of the page (required) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolders'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetFolders, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetFolders|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getFoldersWithHttpInfo($limit, $offset, $sort = 'desc') + public function getFoldersWithHttpInfo( + ?int $limit = 10, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getFolders'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetFolders'; - $request = $this->getFoldersRequest($limit, $offset, $sort); + $request = $this->getFoldersRequest($limit, $offset, $sort, $contentType); try { $options = $this->createHttpClientOption(); @@ -5401,34 +6906,111 @@ public function getFoldersWithHttpInfo($limit, $offset, $sort = 'desc') } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } - $statusCode = $response->getStatusCode(); + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetFolders', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetFolders' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetFolders', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetFolders'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -5443,7 +7025,7 @@ public function getFoldersWithHttpInfo($limit, $offset, $sort = 'desc') case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetFolders', + '\Brevo\Client\Models\GetFolders', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5451,7 +7033,7 @@ public function getFoldersWithHttpInfo($limit, $offset, $sort = 'desc') case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5466,16 +7048,22 @@ public function getFoldersWithHttpInfo($limit, $offset, $sort = 'desc') * * Get all folders * - * @param int $limit Number of documents per page (required) - * @param int $offset Index of the first document of the page (required) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolders'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getFoldersAsync($limit, $offset, $sort = 'desc') + public function getFoldersAsync( + ?int $limit = 10, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getFolders'][0] + ): PromiseInterface { - return $this->getFoldersAsyncWithHttpInfo($limit, $offset, $sort) + return $this->getFoldersAsyncWithHttpInfo($limit, $offset, $sort, $contentType) ->then( function ($response) { return $response[0]; @@ -5488,27 +7076,33 @@ function ($response) { * * Get all folders * - * @param int $limit Number of documents per page (required) - * @param int $offset Index of the first document of the page (required) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolders'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getFoldersAsyncWithHttpInfo($limit, $offset, $sort = 'desc') + public function getFoldersAsyncWithHttpInfo( + $limit = 10, + $offset = 0, + $sort = 'desc', + string $contentType = self::contentTypes['getFolders'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetFolders'; - $request = $this->getFoldersRequest($limit, $offset, $sort); + $returnType = '\Brevo\Client\Models\GetFolders'; + $request = $this->getFoldersRequest($limit, $offset, $sort, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5531,7 +7125,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5540,34 +7134,31 @@ function ($exception) { /** * 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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolders'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getFoldersRequest($limit, $offset, $sort = 'desc') + public function getFoldersRequest( + $limit = 10, + $offset = 0, + $sort = 'desc', + string $contentType = self::contentTypes['getFolders'][0] + ): Request { - // verify the required parameter 'limit' is set - if ($limit === null || (is_array($limit) && count($limit) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $limit when calling getFolders' - ); - } - if ($limit > 50) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getFolders, must be smaller than or equal to 50.'); + + if ($limit !== null && $limit > 50) { + throw new InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getFolders, must be smaller than or equal to 50.'); } - if ($limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getFolders, must be bigger than or equal to 0.'); + if ($limit !== null && $limit < 0) { + throw new InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getFolders, must be bigger than or equal to 0.'); } + + - // verify the required parameter 'offset' is set - if ($offset === null || (is_array($offset) && count($offset) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $offset when calling getFolders' - ); - } $resourcePath = '/contacts/folders'; $formParams = []; @@ -5577,66 +7168,64 @@ protected function getFoldersRequest($limit, $offset, $sort = 'desc') $multipart = false; // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5662,10 +7251,11 @@ protected function getFoldersRequest($limit, $offset, $sort = 'desc') $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5674,39 +7264,50 @@ protected function getFoldersRequest($limit, $offset, $sort = 'desc') /** * Operation getList * - * Get a list's details + * Get a list's details * * @param int $listId Id of the list (required) - * @param string $startDate Mandatory if endDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id.Prefer to pass your timezone in date-time format for accurate result (optional) - * @param string $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id.Prefer to pass your timezone in date-time format for accurate result (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetExtendedList - */ - public function getList($listId, $startDate = null, $endDate = null) - { - list($response) = $this->getListWithHttpInfo($listId, $startDate, $endDate); + * @param string|null $startDate **Mandatory if endDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param string|null $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getList'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetExtendedList|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel + */ + public function getList( + int $listId, + ?string $startDate = null, + ?string $endDate = null, + string $contentType = self::contentTypes['getList'][0] + ): \Brevo\Client\Models\GetExtendedList + { + list($response) = $this->getListWithHttpInfo($listId, $startDate, $endDate, $contentType); return $response; } /** * Operation getListWithHttpInfo * - * Get a list's details + * Get a list's details * * @param int $listId Id of the list (required) - * @param string $startDate Mandatory if endDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id.Prefer to pass your timezone in date-time format for accurate result (optional) - * @param string $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id.Prefer to pass your timezone in date-time format for accurate result (optional) + * @param string|null $startDate **Mandatory if endDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param string|null $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getList'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetExtendedList, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetExtendedList|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getListWithHttpInfo($listId, $startDate = null, $endDate = null) + public function getListWithHttpInfo( + int $listId, + ?string $startDate = null, + ?string $endDate = null, + string $contentType = self::contentTypes['getList'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetExtendedList'; - $request = $this->getListRequest($listId, $startDate, $endDate); + $request = $this->getListRequest($listId, $startDate, $endDate, $contentType); try { $options = $this->createHttpClientOption(); @@ -5715,34 +7316,138 @@ public function getListWithHttpInfo($listId, $startDate = null, $endDate = null) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetExtendedList', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetExtendedList' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetExtendedList', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetExtendedList'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -5757,23 +7462,23 @@ public function getListWithHttpInfo($listId, $startDate = null, $endDate = null) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetExtendedList', + '\Brevo\Client\Models\GetExtendedList', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5786,18 +7491,24 @@ public function getListWithHttpInfo($listId, $startDate = null, $endDate = null) /** * Operation getListAsync * - * Get a list's details + * Get a list's details * * @param int $listId Id of the list (required) - * @param string $startDate Mandatory if endDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id.Prefer to pass your timezone in date-time format for accurate result (optional) - * @param string $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id.Prefer to pass your timezone in date-time format for accurate result (optional) + * @param string|null $startDate **Mandatory if endDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param string|null $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getList'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getListAsync($listId, $startDate = null, $endDate = null) + public function getListAsync( + int $listId, + ?string $startDate = null, + ?string $endDate = null, + string $contentType = self::contentTypes['getList'][0] + ): PromiseInterface { - return $this->getListAsyncWithHttpInfo($listId, $startDate, $endDate) + return $this->getListAsyncWithHttpInfo($listId, $startDate, $endDate, $contentType) ->then( function ($response) { return $response[0]; @@ -5808,29 +7519,35 @@ function ($response) { /** * Operation getListAsyncWithHttpInfo * - * Get a list's details + * Get a list's details * * @param int $listId Id of the list (required) - * @param string $startDate Mandatory if endDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id.Prefer to pass your timezone in date-time format for accurate result (optional) - * @param string $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id.Prefer to pass your timezone in date-time format for accurate result (optional) + * @param string|null $startDate **Mandatory if endDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param string|null $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getList'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getListAsyncWithHttpInfo($listId, $startDate = null, $endDate = null) + public function getListAsyncWithHttpInfo( + $listId, + $startDate = null, + $endDate = null, + string $contentType = self::contentTypes['getList'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetExtendedList'; - $request = $this->getListRequest($listId, $startDate, $endDate); + $returnType = '\Brevo\Client\Models\GetExtendedList'; + $request = $this->getListRequest($listId, $startDate, $endDate, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5853,7 +7570,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5863,21 +7580,31 @@ function ($exception) { * Create request for operation 'getList' * * @param int $listId Id of the list (required) - * @param string $startDate Mandatory if endDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id.Prefer to pass your timezone in date-time format for accurate result (optional) - * @param string $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id.Prefer to pass your timezone in date-time format for accurate result (optional) + * @param string|null $startDate **Mandatory if endDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param string|null $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getList'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getListRequest($listId, $startDate = null, $endDate = null) + public function getListRequest( + $listId, + $startDate = null, + $endDate = null, + string $contentType = self::contentTypes['getList'][0] + ): Request { + // verify the required parameter 'listId' is set if ($listId === null || (is_array($listId) && count($listId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $listId when calling getList' ); } + + + $resourcePath = '/contacts/lists/{listId}'; $formParams = []; $queryParams = []; @@ -5886,13 +7613,24 @@ protected function getListRequest($listId, $startDate = null, $endDate = null) $multipart = false; // query params - if ($startDate !== null) { - $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($endDate !== null) { - $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // path params if ($listId !== null) { @@ -5903,53 +7641,35 @@ protected function getListRequest($listId, $startDate = null, $endDate = null) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5975,10 +7695,11 @@ protected function getListRequest($listId, $startDate = null, $endDate = null) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5989,17 +7710,23 @@ protected function getListRequest($listId, $startDate = null, $endDate = null) * * 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLists'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetLists + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetLists|\Brevo\Client\Models\ErrorModel */ - public function getLists($limit = '10', $offset = '0', $sort = 'desc') + public function getLists( + ?int $limit = 10, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getLists'][0] + ): \Brevo\Client\Models\GetLists { - list($response) = $this->getListsWithHttpInfo($limit, $offset, $sort); + list($response) = $this->getListsWithHttpInfo($limit, $offset, $sort, $contentType); return $response; } @@ -6008,18 +7735,23 @@ public function getLists($limit = '10', $offset = '0', $sort = 'desc') * * 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLists'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetLists, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetLists|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getListsWithHttpInfo($limit = '10', $offset = '0', $sort = 'desc') + public function getListsWithHttpInfo( + ?int $limit = 10, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getLists'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetLists'; - $request = $this->getListsRequest($limit, $offset, $sort); + $request = $this->getListsRequest($limit, $offset, $sort, $contentType); try { $options = $this->createHttpClientOption(); @@ -6028,34 +7760,111 @@ public function getListsWithHttpInfo($limit = '10', $offset = '0', $sort = 'desc } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetLists', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetLists' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetLists', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetLists'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -6070,7 +7879,7 @@ public function getListsWithHttpInfo($limit = '10', $offset = '0', $sort = 'desc case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetLists', + '\Brevo\Client\Models\GetLists', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6078,7 +7887,7 @@ public function getListsWithHttpInfo($limit = '10', $offset = '0', $sort = 'desc case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6093,16 +7902,22 @@ public function getListsWithHttpInfo($limit = '10', $offset = '0', $sort = 'desc * * 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLists'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getListsAsync($limit = '10', $offset = '0', $sort = 'desc') + public function getListsAsync( + ?int $limit = 10, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getLists'][0] + ): PromiseInterface { - return $this->getListsAsyncWithHttpInfo($limit, $offset, $sort) + return $this->getListsAsyncWithHttpInfo($limit, $offset, $sort, $contentType) ->then( function ($response) { return $response[0]; @@ -6115,27 +7930,33 @@ function ($response) { * * 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLists'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getListsAsyncWithHttpInfo($limit = '10', $offset = '0', $sort = 'desc') + public function getListsAsyncWithHttpInfo( + $limit = 10, + $offset = 0, + $sort = 'desc', + string $contentType = self::contentTypes['getLists'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetLists'; - $request = $this->getListsRequest($limit, $offset, $sort); + $returnType = '\Brevo\Client\Models\GetLists'; + $request = $this->getListsRequest($limit, $offset, $sort, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6158,7 +7979,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6167,21 +7988,30 @@ function ($exception) { /** * 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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLists'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getListsRequest($limit = '10', $offset = '0', $sort = 'desc') + public function getListsRequest( + $limit = 10, + $offset = 0, + $sort = 'desc', + string $contentType = self::contentTypes['getLists'][0] + ): Request { + if ($limit !== null && $limit > 50) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getLists, must be smaller than or equal to 50.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getLists, must be smaller than or equal to 50.'); } if ($limit !== null && $limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getLists, must be bigger than or equal to 0.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getLists, must be bigger than or equal to 0.'); } + + $resourcePath = '/contacts/lists'; @@ -6192,66 +8022,64 @@ protected function getListsRequest($limit = '10', $offset = '0', $sort = 'desc') $multipart = false; // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6277,10 +8105,11 @@ protected function getListsRequest($limit = '10', $offset = '0', $sort = 'desc') $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6289,39 +8118,50 @@ protected function getListsRequest($limit = '10', $offset = '0', $sort = 'desc') /** * Operation getSegments * - * Get all the Segments + * Get all the segments * - * @param int $limit Number of documents per page (required) - * @param int $offset Index of the first document of the page (required) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSegments'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetSegments + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetSegments|\Brevo\Client\Models\ErrorModel */ - public function getSegments($limit, $offset, $sort = 'desc') + public function getSegments( + ?int $limit = 10, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getSegments'][0] + ): \Brevo\Client\Models\GetSegments { - list($response) = $this->getSegmentsWithHttpInfo($limit, $offset, $sort); + list($response) = $this->getSegmentsWithHttpInfo($limit, $offset, $sort, $contentType); return $response; } /** * Operation getSegmentsWithHttpInfo * - * Get all the Segments + * Get all the segments * - * @param int $limit Number of documents per page (required) - * @param int $offset Index of the first document of the page (required) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSegments'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetSegments, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetSegments|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getSegmentsWithHttpInfo($limit, $offset, $sort = 'desc') + public function getSegmentsWithHttpInfo( + ?int $limit = 10, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getSegments'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetSegments'; - $request = $this->getSegmentsRequest($limit, $offset, $sort); + $request = $this->getSegmentsRequest($limit, $offset, $sort, $contentType); try { $options = $this->createHttpClientOption(); @@ -6330,34 +8170,111 @@ public function getSegmentsWithHttpInfo($limit, $offset, $sort = 'desc') } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetSegments', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetSegments' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetSegments', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetSegments'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -6372,7 +8289,7 @@ public function getSegmentsWithHttpInfo($limit, $offset, $sort = 'desc') case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetSegments', + '\Brevo\Client\Models\GetSegments', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6380,7 +8297,7 @@ public function getSegmentsWithHttpInfo($limit, $offset, $sort = 'desc') case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6393,18 +8310,24 @@ public function getSegmentsWithHttpInfo($limit, $offset, $sort = 'desc') /** * Operation getSegmentsAsync * - * Get all the Segments + * Get all the segments * - * @param int $limit Number of documents per page (required) - * @param int $offset Index of the first document of the page (required) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSegments'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getSegmentsAsync($limit, $offset, $sort = 'desc') + public function getSegmentsAsync( + ?int $limit = 10, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getSegments'][0] + ): PromiseInterface { - return $this->getSegmentsAsyncWithHttpInfo($limit, $offset, $sort) + return $this->getSegmentsAsyncWithHttpInfo($limit, $offset, $sort, $contentType) ->then( function ($response) { return $response[0]; @@ -6415,29 +8338,35 @@ function ($response) { /** * Operation getSegmentsAsyncWithHttpInfo * - * Get all the Segments + * Get all the segments * - * @param int $limit Number of documents per page (required) - * @param int $offset Index of the first document of the page (required) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSegments'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getSegmentsAsyncWithHttpInfo($limit, $offset, $sort = 'desc') + public function getSegmentsAsyncWithHttpInfo( + $limit = 10, + $offset = 0, + $sort = 'desc', + string $contentType = self::contentTypes['getSegments'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetSegments'; - $request = $this->getSegmentsRequest($limit, $offset, $sort); + $returnType = '\Brevo\Client\Models\GetSegments'; + $request = $this->getSegmentsRequest($limit, $offset, $sort, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6460,7 +8389,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6469,34 +8398,31 @@ function ($exception) { /** * Create request for operation 'getSegments' * - * @param int $limit Number of documents per page (required) - * @param int $offset Index of the first document of the page (required) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSegments'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getSegmentsRequest($limit, $offset, $sort = 'desc') + public function getSegmentsRequest( + $limit = 10, + $offset = 0, + $sort = 'desc', + string $contentType = self::contentTypes['getSegments'][0] + ): Request { - // verify the required parameter 'limit' is set - if ($limit === null || (is_array($limit) && count($limit) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $limit when calling getSegments' - ); - } - if ($limit > 50) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getSegments, must be smaller than or equal to 50.'); + + if ($limit !== null && $limit > 50) { + throw new InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getSegments, must be smaller than or equal to 50.'); } - if ($limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getSegments, must be bigger than or equal to 0.'); + if ($limit !== null && $limit < 0) { + throw new InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getSegments, must be bigger than or equal to 0.'); } + + - // verify the required parameter 'offset' is set - if ($offset === null || (is_array($offset) && count($offset) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $offset when calling getSegments' - ); - } $resourcePath = '/contacts/segments'; $formParams = []; @@ -6506,66 +8432,64 @@ protected function getSegmentsRequest($limit, $offset, $sort = 'desc') $multipart = false; // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6591,10 +8515,11 @@ protected function getSegmentsRequest($limit, $offset, $sort = 'desc') $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6605,15 +8530,19 @@ protected function getSegmentsRequest($limit, $offset, $sort = 'desc') * * Import contacts * - * @param \Brevo\Client\Model\RequestContactImport $requestContactImport Values to import contacts in Brevo. To know more about the expected format, please have a look at ``https://help.brevo.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` (required) + * @param \Brevo\Client\Models\RequestContactImport $requestContactImport Values to import contacts in Brevo. To know more about the expected format, please have a look at ``https://help.brevo.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importContacts'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreatedProcessId + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreatedProcessId|\Brevo\Client\Models\ErrorModel */ - public function importContacts($requestContactImport) + public function importContacts( + \Brevo\Client\Models\RequestContactImport $requestContactImport, + string $contentType = self::contentTypes['importContacts'][0] + ): \Brevo\Client\Models\CreatedProcessId { - list($response) = $this->importContactsWithHttpInfo($requestContactImport); + list($response) = $this->importContactsWithHttpInfo($requestContactImport, $contentType); return $response; } @@ -6622,16 +8551,19 @@ public function importContacts($requestContactImport) * * Import contacts * - * @param \Brevo\Client\Model\RequestContactImport $requestContactImport Values to import contacts in Brevo. To know more about the expected format, please have a look at ``https://help.brevo.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` (required) + * @param \Brevo\Client\Models\RequestContactImport $requestContactImport Values to import contacts in Brevo. To know more about the expected format, please have a look at ``https://help.brevo.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importContacts'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreatedProcessId, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreatedProcessId|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function importContactsWithHttpInfo($requestContactImport) + public function importContactsWithHttpInfo( + \Brevo\Client\Models\RequestContactImport $requestContactImport, + string $contentType = self::contentTypes['importContacts'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreatedProcessId'; - $request = $this->importContactsRequest($requestContactImport); + $request = $this->importContactsRequest($requestContactImport, $contentType); try { $options = $this->createHttpClientOption(); @@ -6640,34 +8572,111 @@ public function importContactsWithHttpInfo($requestContactImport) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 202: + if (in_array('\Brevo\Client\Models\CreatedProcessId', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreatedProcessId' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreatedProcessId', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreatedProcessId'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -6682,7 +8691,7 @@ public function importContactsWithHttpInfo($requestContactImport) case 202: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreatedProcessId', + '\Brevo\Client\Models\CreatedProcessId', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6690,7 +8699,7 @@ public function importContactsWithHttpInfo($requestContactImport) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6705,14 +8714,18 @@ public function importContactsWithHttpInfo($requestContactImport) * * Import contacts * - * @param \Brevo\Client\Model\RequestContactImport $requestContactImport Values to import contacts in Brevo. To know more about the expected format, please have a look at ``https://help.brevo.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` (required) + * @param \Brevo\Client\Models\RequestContactImport $requestContactImport Values to import contacts in Brevo. To know more about the expected format, please have a look at ``https://help.brevo.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importContacts'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function importContactsAsync($requestContactImport) + public function importContactsAsync( + \Brevo\Client\Models\RequestContactImport $requestContactImport, + string $contentType = self::contentTypes['importContacts'][0] + ): PromiseInterface { - return $this->importContactsAsyncWithHttpInfo($requestContactImport) + return $this->importContactsAsyncWithHttpInfo($requestContactImport, $contentType) ->then( function ($response) { return $response[0]; @@ -6725,25 +8738,29 @@ function ($response) { * * Import contacts * - * @param \Brevo\Client\Model\RequestContactImport $requestContactImport Values to import contacts in Brevo. To know more about the expected format, please have a look at ``https://help.brevo.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` (required) + * @param \Brevo\Client\Models\RequestContactImport $requestContactImport Values to import contacts in Brevo. To know more about the expected format, please have a look at ``https://help.brevo.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importContacts'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function importContactsAsyncWithHttpInfo($requestContactImport) + public function importContactsAsyncWithHttpInfo( + $requestContactImport, + string $contentType = self::contentTypes['importContacts'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreatedProcessId'; - $request = $this->importContactsRequest($requestContactImport); + $returnType = '\Brevo\Client\Models\CreatedProcessId'; + $request = $this->importContactsRequest($requestContactImport, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6766,7 +8783,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6775,20 +8792,26 @@ function ($exception) { /** * Create request for operation 'importContacts' * - * @param \Brevo\Client\Model\RequestContactImport $requestContactImport Values to import contacts in Brevo. To know more about the expected format, please have a look at ``https://help.brevo.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` (required) + * @param \Brevo\Client\Models\RequestContactImport $requestContactImport Values to import contacts in Brevo. To know more about the expected format, please have a look at ``https://help.brevo.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importContacts'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function importContactsRequest($requestContactImport) + public function importContactsRequest( + $requestContactImport, + string $contentType = self::contentTypes['importContacts'][0] + ): Request { + // verify the required parameter 'requestContactImport' is set if ($requestContactImport === null || (is_array($requestContactImport) && count($requestContactImport) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $requestContactImport when calling importContacts' ); } + $resourcePath = '/contacts/import'; $formParams = []; $queryParams = []; @@ -6798,56 +8821,43 @@ protected function importContactsRequest($requestContactImport) - // body params - $_tempBody = null; - if (isset($requestContactImport)) { - $_tempBody = $requestContactImport; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($requestContactImport)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($requestContactImport)); + } else { + $httpBody = $requestContactImport; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6873,10 +8883,11 @@ protected function importContactsRequest($requestContactImport) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6888,15 +8899,20 @@ protected function importContactsRequest($requestContactImport) * Delete a contact from a list * * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\RemoveContactFromList $contactEmails Emails addresses OR IDs of the contacts (required) + * @param \Brevo\Client\Models\RemoveContactFromListRequest $contactEmails Emails adresses OR IDs OR EXT_ID attributes of the contacts OR 'all' true (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromList'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\PostContactInfo + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\PostContactInfo|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function removeContactFromList($listId, $contactEmails) + public function removeContactFromList( + int $listId, + \Brevo\Client\Models\RemoveContactFromListRequest $contactEmails, + string $contentType = self::contentTypes['removeContactFromList'][0] + ): \Brevo\Client\Models\PostContactInfo { - list($response) = $this->removeContactFromListWithHttpInfo($listId, $contactEmails); + list($response) = $this->removeContactFromListWithHttpInfo($listId, $contactEmails, $contentType); return $response; } @@ -6906,52 +8922,160 @@ public function removeContactFromList($listId, $contactEmails) * Delete a contact from a list * * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\RemoveContactFromList $contactEmails Emails addresses OR IDs of the contacts (required) + * @param \Brevo\Client\Models\RemoveContactFromListRequest $contactEmails Emails adresses OR IDs OR EXT_ID attributes of the contacts OR 'all' true (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromList'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\PostContactInfo, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\PostContactInfo|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function removeContactFromListWithHttpInfo($listId, $contactEmails) + public function removeContactFromListWithHttpInfo( + int $listId, + \Brevo\Client\Models\RemoveContactFromListRequest $contactEmails, + string $contentType = self::contentTypes['removeContactFromList'][0] + ): array { - $returnType = '\Brevo\Client\Model\PostContactInfo'; - $request = $this->removeContactFromListRequest($listId, $contactEmails); + $request = $this->removeContactFromListRequest($listId, $contactEmails, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\PostContactInfo', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\PostContactInfo' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\PostContactInfo', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } - 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 - ); - } + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } - $statusCode = $response->getStatusCode(); + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\PostContactInfo'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -6966,7 +9090,7 @@ public function removeContactFromListWithHttpInfo($listId, $contactEmails) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\PostContactInfo', + '\Brevo\Client\Models\PostContactInfo', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6974,7 +9098,7 @@ public function removeContactFromListWithHttpInfo($listId, $contactEmails) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6982,7 +9106,7 @@ public function removeContactFromListWithHttpInfo($listId, $contactEmails) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6998,14 +9122,19 @@ public function removeContactFromListWithHttpInfo($listId, $contactEmails) * Delete a contact from a list * * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\RemoveContactFromList $contactEmails Emails addresses OR IDs of the contacts (required) + * @param \Brevo\Client\Models\RemoveContactFromListRequest $contactEmails Emails adresses OR IDs OR EXT_ID attributes of the contacts OR 'all' true (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromList'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function removeContactFromListAsync($listId, $contactEmails) + public function removeContactFromListAsync( + int $listId, + \Brevo\Client\Models\RemoveContactFromListRequest $contactEmails, + string $contentType = self::contentTypes['removeContactFromList'][0] + ): PromiseInterface { - return $this->removeContactFromListAsyncWithHttpInfo($listId, $contactEmails) + return $this->removeContactFromListAsyncWithHttpInfo($listId, $contactEmails, $contentType) ->then( function ($response) { return $response[0]; @@ -7019,25 +9148,30 @@ function ($response) { * Delete a contact from a list * * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\RemoveContactFromList $contactEmails Emails addresses OR IDs of the contacts (required) + * @param \Brevo\Client\Models\RemoveContactFromListRequest $contactEmails Emails adresses OR IDs OR EXT_ID attributes of the contacts OR 'all' true (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromList'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function removeContactFromListAsyncWithHttpInfo($listId, $contactEmails) + public function removeContactFromListAsyncWithHttpInfo( + $listId, + $contactEmails, + string $contentType = self::contentTypes['removeContactFromList'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\PostContactInfo'; - $request = $this->removeContactFromListRequest($listId, $contactEmails); + $returnType = '\Brevo\Client\Models\PostContactInfo'; + $request = $this->removeContactFromListRequest($listId, $contactEmails, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7060,7 +9194,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7070,26 +9204,34 @@ function ($exception) { * Create request for operation 'removeContactFromList' * * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\RemoveContactFromList $contactEmails Emails addresses OR IDs of the contacts (required) + * @param \Brevo\Client\Models\RemoveContactFromListRequest $contactEmails Emails adresses OR IDs OR EXT_ID attributes of the contacts OR 'all' true (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromList'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function removeContactFromListRequest($listId, $contactEmails) + public function removeContactFromListRequest( + $listId, + $contactEmails, + string $contentType = self::contentTypes['removeContactFromList'][0] + ): Request { + // verify the required parameter 'listId' is set if ($listId === null || (is_array($listId) && count($listId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $listId when calling removeContactFromList' ); } + // verify the required parameter 'contactEmails' is set if ($contactEmails === null || (is_array($contactEmails) && count($contactEmails) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $contactEmails when calling removeContactFromList' ); } + $resourcePath = '/contacts/lists/{listId}/contacts/remove'; $formParams = []; $queryParams = []; @@ -7098,6 +9240,7 @@ protected function removeContactFromListRequest($listId, $contactEmails) $multipart = false; + // path params if ($listId !== null) { $resourcePath = str_replace( @@ -7107,56 +9250,42 @@ protected function removeContactFromListRequest($listId, $contactEmails) ); } - // 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'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($contactEmails)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($contactEmails)); + } else { + $httpBody = $contactEmails; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7182,10 +9311,11 @@ protected function removeContactFromListRequest($listId, $contactEmails) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7196,15 +9326,19 @@ protected function removeContactFromListRequest($listId, $contactEmails) * * Export contacts * - * @param \Brevo\Client\Model\RequestContactExport $requestContactExport Values to request a contact export (required) + * @param \Brevo\Client\Models\RequestContactExport $requestContactExport Values to request a contact export (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestContactExport'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreatedProcessId + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreatedProcessId|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function requestContactExport($requestContactExport) + public function requestContactExport( + \Brevo\Client\Models\RequestContactExport $requestContactExport, + string $contentType = self::contentTypes['requestContactExport'][0] + ): \Brevo\Client\Models\CreatedProcessId { - list($response) = $this->requestContactExportWithHttpInfo($requestContactExport); + list($response) = $this->requestContactExportWithHttpInfo($requestContactExport, $contentType); return $response; } @@ -7213,16 +9347,19 @@ public function requestContactExport($requestContactExport) * * Export contacts * - * @param \Brevo\Client\Model\RequestContactExport $requestContactExport Values to request a contact export (required) + * @param \Brevo\Client\Models\RequestContactExport $requestContactExport Values to request a contact export (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestContactExport'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreatedProcessId, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreatedProcessId|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function requestContactExportWithHttpInfo($requestContactExport) + public function requestContactExportWithHttpInfo( + \Brevo\Client\Models\RequestContactExport $requestContactExport, + string $contentType = self::contentTypes['requestContactExport'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreatedProcessId'; - $request = $this->requestContactExportRequest($requestContactExport); + $request = $this->requestContactExportRequest($requestContactExport, $contentType); try { $options = $this->createHttpClientOption(); @@ -7231,34 +9368,138 @@ public function requestContactExportWithHttpInfo($requestContactExport) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 202: + if (in_array('\Brevo\Client\Models\CreatedProcessId', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreatedProcessId' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreatedProcessId', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreatedProcessId'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -7273,7 +9514,7 @@ public function requestContactExportWithHttpInfo($requestContactExport) case 202: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreatedProcessId', + '\Brevo\Client\Models\CreatedProcessId', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7281,7 +9522,7 @@ public function requestContactExportWithHttpInfo($requestContactExport) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7289,7 +9530,7 @@ public function requestContactExportWithHttpInfo($requestContactExport) case 429: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7304,14 +9545,18 @@ public function requestContactExportWithHttpInfo($requestContactExport) * * Export contacts * - * @param \Brevo\Client\Model\RequestContactExport $requestContactExport Values to request a contact export (required) + * @param \Brevo\Client\Models\RequestContactExport $requestContactExport Values to request a contact export (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestContactExport'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function requestContactExportAsync($requestContactExport) + public function requestContactExportAsync( + \Brevo\Client\Models\RequestContactExport $requestContactExport, + string $contentType = self::contentTypes['requestContactExport'][0] + ): PromiseInterface { - return $this->requestContactExportAsyncWithHttpInfo($requestContactExport) + return $this->requestContactExportAsyncWithHttpInfo($requestContactExport, $contentType) ->then( function ($response) { return $response[0]; @@ -7324,25 +9569,29 @@ function ($response) { * * Export contacts * - * @param \Brevo\Client\Model\RequestContactExport $requestContactExport Values to request a contact export (required) + * @param \Brevo\Client\Models\RequestContactExport $requestContactExport Values to request a contact export (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestContactExport'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function requestContactExportAsyncWithHttpInfo($requestContactExport) + public function requestContactExportAsyncWithHttpInfo( + $requestContactExport, + string $contentType = self::contentTypes['requestContactExport'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreatedProcessId'; - $request = $this->requestContactExportRequest($requestContactExport); + $returnType = '\Brevo\Client\Models\CreatedProcessId'; + $request = $this->requestContactExportRequest($requestContactExport, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7365,7 +9614,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7374,20 +9623,26 @@ function ($exception) { /** * Create request for operation 'requestContactExport' * - * @param \Brevo\Client\Model\RequestContactExport $requestContactExport Values to request a contact export (required) + * @param \Brevo\Client\Models\RequestContactExport $requestContactExport Values to request a contact export (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestContactExport'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function requestContactExportRequest($requestContactExport) + public function requestContactExportRequest( + $requestContactExport, + string $contentType = self::contentTypes['requestContactExport'][0] + ): Request { + // verify the required parameter 'requestContactExport' is set if ($requestContactExport === null || (is_array($requestContactExport) && count($requestContactExport) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $requestContactExport when calling requestContactExport' ); } + $resourcePath = '/contacts/export'; $formParams = []; $queryParams = []; @@ -7397,56 +9652,43 @@ protected function requestContactExportRequest($requestContactExport) - // body params - $_tempBody = null; - if (isset($requestContactExport)) { - $_tempBody = $requestContactExport; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($requestContactExport)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($requestContactExport)); + } else { + $httpBody = $requestContactExport; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7472,10 +9714,11 @@ protected function requestContactExportRequest($requestContactExport) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7488,15 +9731,21 @@ protected function requestContactExportRequest($requestContactExport) * * @param string $attributeCategory Category of the attribute (required) * @param string $attributeName Name of the existing attribute (required) - * @param \Brevo\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required) + * @param \Brevo\Client\Models\UpdateAttribute $updateAttribute Values to update an attribute (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateAttribute'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function updateAttribute($attributeCategory, $attributeName, $updateAttribute) + public function updateAttribute( + string $attributeCategory, + string $attributeName, + \Brevo\Client\Models\UpdateAttribute $updateAttribute, + string $contentType = self::contentTypes['updateAttribute'][0] + ): void { - $this->updateAttributeWithHttpInfo($attributeCategory, $attributeName, $updateAttribute); + $this->updateAttributeWithHttpInfo($attributeCategory, $attributeName, $updateAttribute, $contentType); } /** @@ -7506,16 +9755,21 @@ public function updateAttribute($attributeCategory, $attributeName, $updateAttri * * @param string $attributeCategory Category of the attribute (required) * @param string $attributeName Name of the existing attribute (required) - * @param \Brevo\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required) + * @param \Brevo\Client\Models\UpdateAttribute $updateAttribute Values to update an attribute (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateAttribute'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function updateAttributeWithHttpInfo($attributeCategory, $attributeName, $updateAttribute) + public function updateAttributeWithHttpInfo( + string $attributeCategory, + string $attributeName, + \Brevo\Client\Models\UpdateAttribute $updateAttribute, + string $contentType = self::contentTypes['updateAttribute'][0] + ): array { - $returnType = ''; - $request = $this->updateAttributeRequest($attributeCategory, $attributeName, $updateAttribute); + $request = $this->updateAttributeRequest($attributeCategory, $attributeName, $updateAttribute, $contentType); try { $options = $this->createHttpClientOption(); @@ -7524,26 +9778,21 @@ public function updateAttributeWithHttpInfo($attributeCategory, $attributeName, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -7552,7 +9801,7 @@ public function updateAttributeWithHttpInfo($attributeCategory, $attributeName, case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7560,7 +9809,7 @@ public function updateAttributeWithHttpInfo($attributeCategory, $attributeName, case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7577,14 +9826,20 @@ public function updateAttributeWithHttpInfo($attributeCategory, $attributeName, * * @param string $attributeCategory Category of the attribute (required) * @param string $attributeName Name of the existing attribute (required) - * @param \Brevo\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required) + * @param \Brevo\Client\Models\UpdateAttribute $updateAttribute Values to update an attribute (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateAttribute'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateAttributeAsync($attributeCategory, $attributeName, $updateAttribute) + public function updateAttributeAsync( + string $attributeCategory, + string $attributeName, + \Brevo\Client\Models\UpdateAttribute $updateAttribute, + string $contentType = self::contentTypes['updateAttribute'][0] + ): PromiseInterface { - return $this->updateAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $updateAttribute) + return $this->updateAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $updateAttribute, $contentType) ->then( function ($response) { return $response[0]; @@ -7599,15 +9854,22 @@ function ($response) { * * @param string $attributeCategory Category of the attribute (required) * @param string $attributeName Name of the existing attribute (required) - * @param \Brevo\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required) + * @param \Brevo\Client\Models\UpdateAttribute $updateAttribute Values to update an attribute (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateAttribute'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $updateAttribute) + public function updateAttributeAsyncWithHttpInfo( + $attributeCategory, + $attributeName, + $updateAttribute, + string $contentType = self::contentTypes['updateAttribute'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->updateAttributeRequest($attributeCategory, $attributeName, $updateAttribute); + $request = $this->updateAttributeRequest($attributeCategory, $attributeName, $updateAttribute, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -7626,7 +9888,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7637,32 +9899,42 @@ function ($exception) { * * @param string $attributeCategory Category of the attribute (required) * @param string $attributeName Name of the existing attribute (required) - * @param \Brevo\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required) + * @param \Brevo\Client\Models\UpdateAttribute $updateAttribute Values to update an attribute (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateAttribute'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updateAttributeRequest($attributeCategory, $attributeName, $updateAttribute) + public function updateAttributeRequest( + $attributeCategory, + $attributeName, + $updateAttribute, + string $contentType = self::contentTypes['updateAttribute'][0] + ): Request { + // verify the required parameter 'attributeCategory' is set if ($attributeCategory === null || (is_array($attributeCategory) && count($attributeCategory) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $attributeCategory when calling updateAttribute' ); } + // verify the required parameter 'attributeName' is set if ($attributeName === null || (is_array($attributeName) && count($attributeName) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $attributeName when calling updateAttribute' ); } + // verify the required parameter 'updateAttribute' is set if ($updateAttribute === null || (is_array($updateAttribute) && count($updateAttribute) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $updateAttribute when calling updateAttribute' ); } + $resourcePath = '/contacts/attributes/{attributeCategory}/{attributeName}'; $formParams = []; $queryParams = []; @@ -7671,6 +9943,7 @@ protected function updateAttributeRequest($attributeCategory, $attributeName, $u $multipart = false; + // path params if ($attributeCategory !== null) { $resourcePath = str_replace( @@ -7688,56 +9961,42 @@ protected function updateAttributeRequest($attributeCategory, $attributeName, $u ); } - // 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'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($updateAttribute)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($updateAttribute)); + } else { + $httpBody = $updateAttribute; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7763,10 +10022,11 @@ protected function updateAttributeRequest($attributeCategory, $attributeName, $u $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7777,15 +10037,19 @@ protected function updateAttributeRequest($attributeCategory, $attributeName, $u * * Update multiple contacts * - * @param \Brevo\Client\Model\UpdateBatchContacts $updateBatchContacts Values to update multiple contacts (required) + * @param \Brevo\Client\Models\UpdateBatchContacts $updateBatchContacts Values to update multiple contacts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatchContacts'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function updateBatchContacts($updateBatchContacts) + public function updateBatchContacts( + \Brevo\Client\Models\UpdateBatchContacts $updateBatchContacts, + string $contentType = self::contentTypes['updateBatchContacts'][0] + ): void { - $this->updateBatchContactsWithHttpInfo($updateBatchContacts); + $this->updateBatchContactsWithHttpInfo($updateBatchContacts, $contentType); } /** @@ -7793,16 +10057,19 @@ public function updateBatchContacts($updateBatchContacts) * * Update multiple contacts * - * @param \Brevo\Client\Model\UpdateBatchContacts $updateBatchContacts Values to update multiple contacts (required) + * @param \Brevo\Client\Models\UpdateBatchContacts $updateBatchContacts Values to update multiple contacts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatchContacts'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function updateBatchContactsWithHttpInfo($updateBatchContacts) + public function updateBatchContactsWithHttpInfo( + \Brevo\Client\Models\UpdateBatchContacts $updateBatchContacts, + string $contentType = self::contentTypes['updateBatchContacts'][0] + ): array { - $returnType = ''; - $request = $this->updateBatchContactsRequest($updateBatchContacts); + $request = $this->updateBatchContactsRequest($updateBatchContacts, $contentType); try { $options = $this->createHttpClientOption(); @@ -7811,26 +10078,21 @@ public function updateBatchContactsWithHttpInfo($updateBatchContacts) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -7839,7 +10101,7 @@ public function updateBatchContactsWithHttpInfo($updateBatchContacts) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7854,14 +10116,18 @@ public function updateBatchContactsWithHttpInfo($updateBatchContacts) * * Update multiple contacts * - * @param \Brevo\Client\Model\UpdateBatchContacts $updateBatchContacts Values to update multiple contacts (required) + * @param \Brevo\Client\Models\UpdateBatchContacts $updateBatchContacts Values to update multiple contacts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatchContacts'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateBatchContactsAsync($updateBatchContacts) + public function updateBatchContactsAsync( + \Brevo\Client\Models\UpdateBatchContacts $updateBatchContacts, + string $contentType = self::contentTypes['updateBatchContacts'][0] + ): PromiseInterface { - return $this->updateBatchContactsAsyncWithHttpInfo($updateBatchContacts) + return $this->updateBatchContactsAsyncWithHttpInfo($updateBatchContacts, $contentType) ->then( function ($response) { return $response[0]; @@ -7874,15 +10140,20 @@ function ($response) { * * Update multiple contacts * - * @param \Brevo\Client\Model\UpdateBatchContacts $updateBatchContacts Values to update multiple contacts (required) + * @param \Brevo\Client\Models\UpdateBatchContacts $updateBatchContacts Values to update multiple contacts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatchContacts'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateBatchContactsAsyncWithHttpInfo($updateBatchContacts) + public function updateBatchContactsAsyncWithHttpInfo( + $updateBatchContacts, + string $contentType = self::contentTypes['updateBatchContacts'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->updateBatchContactsRequest($updateBatchContacts); + $request = $this->updateBatchContactsRequest($updateBatchContacts, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -7901,7 +10172,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7910,20 +10181,26 @@ function ($exception) { /** * Create request for operation 'updateBatchContacts' * - * @param \Brevo\Client\Model\UpdateBatchContacts $updateBatchContacts Values to update multiple contacts (required) + * @param \Brevo\Client\Models\UpdateBatchContacts $updateBatchContacts Values to update multiple contacts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatchContacts'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updateBatchContactsRequest($updateBatchContacts) + public function updateBatchContactsRequest( + $updateBatchContacts, + string $contentType = self::contentTypes['updateBatchContacts'][0] + ): Request { + // verify the required parameter 'updateBatchContacts' is set if ($updateBatchContacts === null || (is_array($updateBatchContacts) && count($updateBatchContacts) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $updateBatchContacts when calling updateBatchContacts' ); } + $resourcePath = '/contacts/batch'; $formParams = []; $queryParams = []; @@ -7933,56 +10210,43 @@ protected function updateBatchContactsRequest($updateBatchContacts) - // body params - $_tempBody = null; - if (isset($updateBatchContacts)) { - $_tempBody = $updateBatchContacts; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($updateBatchContacts)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($updateBatchContacts)); + } else { + $httpBody = $updateBatchContacts; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8008,10 +10272,11 @@ protected function updateBatchContactsRequest($updateBatchContacts) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8022,17 +10287,23 @@ protected function updateBatchContactsRequest($updateBatchContacts) * * Update a contact * - * @param string $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value (required) - * @param \Brevo\Client\Model\UpdateContact $updateContact Values to update a contact (required) - * @param object $identifierType email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute (optional) + * @param \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value (required) + * @param \Brevo\Client\Models\UpdateContact $updateContact Values to update a contact (required) + * @param string|null $identifierType email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function updateContact($identifier, $updateContact, $identifierType = null) + public function updateContact( + \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier, + \Brevo\Client\Models\UpdateContact $updateContact, + ?string $identifierType = null, + string $contentType = self::contentTypes['updateContact'][0] + ): void { - $this->updateContactWithHttpInfo($identifier, $updateContact, $identifierType); + $this->updateContactWithHttpInfo($identifier, $updateContact, $identifierType, $contentType); } /** @@ -8040,18 +10311,23 @@ public function updateContact($identifier, $updateContact, $identifierType = nul * * Update a contact * - * @param string $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value (required) - * @param \Brevo\Client\Model\UpdateContact $updateContact Values to update a contact (required) - * @param object $identifierType email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute (optional) + * @param \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value (required) + * @param \Brevo\Client\Models\UpdateContact $updateContact Values to update a contact (required) + * @param string|null $identifierType email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function updateContactWithHttpInfo($identifier, $updateContact, $identifierType = null) + public function updateContactWithHttpInfo( + \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier, + \Brevo\Client\Models\UpdateContact $updateContact, + ?string $identifierType = null, + string $contentType = self::contentTypes['updateContact'][0] + ): array { - $returnType = ''; - $request = $this->updateContactRequest($identifier, $updateContact, $identifierType); + $request = $this->updateContactRequest($identifier, $updateContact, $identifierType, $contentType); try { $options = $this->createHttpClientOption(); @@ -8060,26 +10336,21 @@ public function updateContactWithHttpInfo($identifier, $updateContact, $identifi } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -8088,7 +10359,7 @@ public function updateContactWithHttpInfo($identifier, $updateContact, $identifi case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ContactErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8096,7 +10367,7 @@ public function updateContactWithHttpInfo($identifier, $updateContact, $identifi case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ContactErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8104,7 +10375,7 @@ public function updateContactWithHttpInfo($identifier, $updateContact, $identifi case 425: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ContactErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8119,16 +10390,22 @@ public function updateContactWithHttpInfo($identifier, $updateContact, $identifi * * Update a contact * - * @param string $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value (required) - * @param \Brevo\Client\Model\UpdateContact $updateContact Values to update a contact (required) - * @param object $identifierType email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute (optional) + * @param \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value (required) + * @param \Brevo\Client\Models\UpdateContact $updateContact Values to update a contact (required) + * @param string|null $identifierType email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateContactAsync($identifier, $updateContact, $identifierType = null) + public function updateContactAsync( + \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier, + \Brevo\Client\Models\UpdateContact $updateContact, + ?string $identifierType = null, + string $contentType = self::contentTypes['updateContact'][0] + ): PromiseInterface { - return $this->updateContactAsyncWithHttpInfo($identifier, $updateContact, $identifierType) + return $this->updateContactAsyncWithHttpInfo($identifier, $updateContact, $identifierType, $contentType) ->then( function ($response) { return $response[0]; @@ -8141,17 +10418,24 @@ function ($response) { * * Update a contact * - * @param string $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value (required) - * @param \Brevo\Client\Model\UpdateContact $updateContact Values to update a contact (required) - * @param object $identifierType email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute (optional) + * @param \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value (required) + * @param \Brevo\Client\Models\UpdateContact $updateContact Values to update a contact (required) + * @param string|null $identifierType email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateContactAsyncWithHttpInfo($identifier, $updateContact, $identifierType = null) + public function updateContactAsyncWithHttpInfo( + $identifier, + $updateContact, + $identifierType = null, + string $contentType = self::contentTypes['updateContact'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->updateContactRequest($identifier, $updateContact, $identifierType); + $request = $this->updateContactRequest($identifier, $updateContact, $identifierType, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -8170,7 +10454,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8179,28 +10463,38 @@ function ($exception) { /** * Create request for operation 'updateContact' * - * @param string $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value (required) - * @param \Brevo\Client\Model\UpdateContact $updateContact Values to update a contact (required) - * @param object $identifierType email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute (optional) + * @param \Brevo\Client\Models\GetContactInfoIdentifierParameter $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value (required) + * @param \Brevo\Client\Models\UpdateContact $updateContact Values to update a contact (required) + * @param string|null $identifierType email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updateContactRequest($identifier, $updateContact, $identifierType = null) + public function updateContactRequest( + $identifier, + $updateContact, + $identifierType = null, + string $contentType = self::contentTypes['updateContact'][0] + ): Request { + // verify the required parameter 'identifier' is set if ($identifier === null || (is_array($identifier) && count($identifier) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $identifier when calling updateContact' ); } + // verify the required parameter 'updateContact' is set if ($updateContact === null || (is_array($updateContact) && count($updateContact) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $updateContact when calling updateContact' ); } + + $resourcePath = '/contacts/{identifier}'; $formParams = []; $queryParams = []; @@ -8209,9 +10503,15 @@ protected function updateContactRequest($identifier, $updateContact, $identifier $multipart = false; // query params - if ($identifierType !== null) { - $queryParams['identifierType'] = ObjectSerializer::toQueryValue($identifierType); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $identifierType, + 'identifierType', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // path params if ($identifier !== null) { @@ -8222,56 +10522,42 @@ protected function updateContactRequest($identifier, $updateContact, $identifier ); } - // 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'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($updateContact)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($updateContact)); + } else { + $httpBody = $updateContact; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8297,10 +10583,11 @@ protected function updateContactRequest($identifier, $updateContact, $identifier $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8312,15 +10599,20 @@ protected function updateContactRequest($identifier, $updateContact, $identifier * Update a folder * * @param int $folderId Id of the folder (required) - * @param \Brevo\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) + * @param \Brevo\Client\Models\CreateUpdateFolder $updateFolder Name of the folder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateFolder'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function updateFolder($folderId, $updateFolder) + public function updateFolder( + int $folderId, + \Brevo\Client\Models\CreateUpdateFolder $updateFolder, + string $contentType = self::contentTypes['updateFolder'][0] + ): void { - $this->updateFolderWithHttpInfo($folderId, $updateFolder); + $this->updateFolderWithHttpInfo($folderId, $updateFolder, $contentType); } /** @@ -8329,16 +10621,20 @@ public function updateFolder($folderId, $updateFolder) * Update a folder * * @param int $folderId Id of the folder (required) - * @param \Brevo\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) + * @param \Brevo\Client\Models\CreateUpdateFolder $updateFolder Name of the folder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateFolder'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function updateFolderWithHttpInfo($folderId, $updateFolder) + public function updateFolderWithHttpInfo( + int $folderId, + \Brevo\Client\Models\CreateUpdateFolder $updateFolder, + string $contentType = self::contentTypes['updateFolder'][0] + ): array { - $returnType = ''; - $request = $this->updateFolderRequest($folderId, $updateFolder); + $request = $this->updateFolderRequest($folderId, $updateFolder, $contentType); try { $options = $this->createHttpClientOption(); @@ -8347,26 +10643,21 @@ public function updateFolderWithHttpInfo($folderId, $updateFolder) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -8375,7 +10666,7 @@ public function updateFolderWithHttpInfo($folderId, $updateFolder) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8383,7 +10674,7 @@ public function updateFolderWithHttpInfo($folderId, $updateFolder) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8399,14 +10690,19 @@ public function updateFolderWithHttpInfo($folderId, $updateFolder) * Update a folder * * @param int $folderId Id of the folder (required) - * @param \Brevo\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) + * @param \Brevo\Client\Models\CreateUpdateFolder $updateFolder Name of the folder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateFolder'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateFolderAsync($folderId, $updateFolder) + public function updateFolderAsync( + int $folderId, + \Brevo\Client\Models\CreateUpdateFolder $updateFolder, + string $contentType = self::contentTypes['updateFolder'][0] + ): PromiseInterface { - return $this->updateFolderAsyncWithHttpInfo($folderId, $updateFolder) + return $this->updateFolderAsyncWithHttpInfo($folderId, $updateFolder, $contentType) ->then( function ($response) { return $response[0]; @@ -8420,15 +10716,21 @@ function ($response) { * Update a folder * * @param int $folderId Id of the folder (required) - * @param \Brevo\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) + * @param \Brevo\Client\Models\CreateUpdateFolder $updateFolder Name of the folder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateFolder'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateFolderAsyncWithHttpInfo($folderId, $updateFolder) + public function updateFolderAsyncWithHttpInfo( + $folderId, + $updateFolder, + string $contentType = self::contentTypes['updateFolder'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->updateFolderRequest($folderId, $updateFolder); + $request = $this->updateFolderRequest($folderId, $updateFolder, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -8447,7 +10749,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8457,26 +10759,34 @@ function ($exception) { * Create request for operation 'updateFolder' * * @param int $folderId Id of the folder (required) - * @param \Brevo\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) + * @param \Brevo\Client\Models\CreateUpdateFolder $updateFolder Name of the folder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateFolder'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updateFolderRequest($folderId, $updateFolder) + public function updateFolderRequest( + $folderId, + $updateFolder, + string $contentType = self::contentTypes['updateFolder'][0] + ): Request { + // verify the required parameter 'folderId' is set if ($folderId === null || (is_array($folderId) && count($folderId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $folderId when calling updateFolder' ); } + // verify the required parameter 'updateFolder' is set if ($updateFolder === null || (is_array($updateFolder) && count($updateFolder) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $updateFolder when calling updateFolder' ); } + $resourcePath = '/contacts/folders/{folderId}'; $formParams = []; $queryParams = []; @@ -8485,6 +10795,7 @@ protected function updateFolderRequest($folderId, $updateFolder) $multipart = false; + // path params if ($folderId !== null) { $resourcePath = str_replace( @@ -8494,56 +10805,42 @@ protected function updateFolderRequest($folderId, $updateFolder) ); } - // 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'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($updateFolder)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($updateFolder)); + } else { + $httpBody = $updateFolder; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8569,10 +10866,11 @@ protected function updateFolderRequest($folderId, $updateFolder) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8584,15 +10882,20 @@ protected function updateFolderRequest($folderId, $updateFolder) * Update a list * * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\UpdateList $updateList Values to update a list (required) + * @param \Brevo\Client\Models\UpdateList $updateList Values to update a list (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateList'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function updateList($listId, $updateList) + public function updateList( + int $listId, + \Brevo\Client\Models\UpdateList $updateList, + string $contentType = self::contentTypes['updateList'][0] + ): void { - $this->updateListWithHttpInfo($listId, $updateList); + $this->updateListWithHttpInfo($listId, $updateList, $contentType); } /** @@ -8601,16 +10904,20 @@ public function updateList($listId, $updateList) * Update a list * * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\UpdateList $updateList Values to update a list (required) + * @param \Brevo\Client\Models\UpdateList $updateList Values to update a list (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateList'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function updateListWithHttpInfo($listId, $updateList) + public function updateListWithHttpInfo( + int $listId, + \Brevo\Client\Models\UpdateList $updateList, + string $contentType = self::contentTypes['updateList'][0] + ): array { - $returnType = ''; - $request = $this->updateListRequest($listId, $updateList); + $request = $this->updateListRequest($listId, $updateList, $contentType); try { $options = $this->createHttpClientOption(); @@ -8619,26 +10926,21 @@ public function updateListWithHttpInfo($listId, $updateList) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -8647,7 +10949,7 @@ public function updateListWithHttpInfo($listId, $updateList) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8655,7 +10957,7 @@ public function updateListWithHttpInfo($listId, $updateList) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8671,14 +10973,19 @@ public function updateListWithHttpInfo($listId, $updateList) * Update a list * * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\UpdateList $updateList Values to update a list (required) + * @param \Brevo\Client\Models\UpdateList $updateList Values to update a list (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateList'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateListAsync($listId, $updateList) + public function updateListAsync( + int $listId, + \Brevo\Client\Models\UpdateList $updateList, + string $contentType = self::contentTypes['updateList'][0] + ): PromiseInterface { - return $this->updateListAsyncWithHttpInfo($listId, $updateList) + return $this->updateListAsyncWithHttpInfo($listId, $updateList, $contentType) ->then( function ($response) { return $response[0]; @@ -8692,15 +10999,21 @@ function ($response) { * Update a list * * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\UpdateList $updateList Values to update a list (required) + * @param \Brevo\Client\Models\UpdateList $updateList Values to update a list (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateList'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateListAsyncWithHttpInfo($listId, $updateList) + public function updateListAsyncWithHttpInfo( + $listId, + $updateList, + string $contentType = self::contentTypes['updateList'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->updateListRequest($listId, $updateList); + $request = $this->updateListRequest($listId, $updateList, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -8719,7 +11032,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8729,26 +11042,34 @@ function ($exception) { * Create request for operation 'updateList' * * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\UpdateList $updateList Values to update a list (required) + * @param \Brevo\Client\Models\UpdateList $updateList Values to update a list (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateList'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updateListRequest($listId, $updateList) + public function updateListRequest( + $listId, + $updateList, + string $contentType = self::contentTypes['updateList'][0] + ): Request { + // verify the required parameter 'listId' is set if ($listId === null || (is_array($listId) && count($listId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $listId when calling updateList' ); } + // verify the required parameter 'updateList' is set if ($updateList === null || (is_array($updateList) && count($updateList) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $updateList when calling updateList' ); } + $resourcePath = '/contacts/lists/{listId}'; $formParams = []; $queryParams = []; @@ -8757,6 +11078,7 @@ protected function updateListRequest($listId, $updateList) $multipart = false; + // path params if ($listId !== null) { $resourcePath = str_replace( @@ -8766,56 +11088,42 @@ protected function updateListRequest($listId, $updateList) ); } - // 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'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($updateList)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($updateList)); + } else { + $httpBody = $updateList; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8841,10 +11149,11 @@ protected function updateListRequest($listId, $updateList) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8856,7 +11165,7 @@ protected function updateListRequest($listId, $updateList) * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/ConversationsApi.php b/lib/Api/ConversationsApi.php index 570d4c5..b096985 100644 --- a/lib/Api/ConversationsApi.php +++ b/lib/Api/ConversationsApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'conversationsMessagesIdDelete' => [ + 'application/json', + ], + 'conversationsMessagesIdGet' => [ + 'application/json', + ], + 'conversationsMessagesIdPut' => [ + 'application/json', + ], + 'conversationsMessagesPost' => [ + 'application/json', + ], + 'conversationsPushedMessagesIdDelete' => [ + 'application/json', + ], + 'conversationsPushedMessagesIdGet' => [ + 'application/json', + ], + 'conversationsPushedMessagesIdPut' => [ + 'application/json', + ], + 'conversationsPushedMessagesPost' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -92,15 +152,19 @@ public function getConfig() * * Sets agent’s status to online for 2-3 minutes * - * @param \Brevo\Client\Model\Body14 $body Agent fields. (required) + * @param \Brevo\Client\Models\ConversationsAgentOnlinePingPostRequest $conversationsAgentOnlinePingPostRequest conversationsAgentOnlinePingPostRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsAgentOnlinePingPost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function conversationsAgentOnlinePingPost($body) + public function conversationsAgentOnlinePingPost( + \Brevo\Client\Models\ConversationsAgentOnlinePingPostRequest $conversationsAgentOnlinePingPostRequest, + string $contentType = self::contentTypes['conversationsAgentOnlinePingPost'][0] + ): void { - $this->conversationsAgentOnlinePingPostWithHttpInfo($body); + $this->conversationsAgentOnlinePingPostWithHttpInfo($conversationsAgentOnlinePingPostRequest, $contentType); } /** @@ -108,16 +172,19 @@ public function conversationsAgentOnlinePingPost($body) * * Sets agent’s status to online for 2-3 minutes * - * @param \Brevo\Client\Model\Body14 $body Agent fields. (required) + * @param \Brevo\Client\Models\ConversationsAgentOnlinePingPostRequest $conversationsAgentOnlinePingPostRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsAgentOnlinePingPost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function conversationsAgentOnlinePingPostWithHttpInfo($body) + public function conversationsAgentOnlinePingPostWithHttpInfo( + \Brevo\Client\Models\ConversationsAgentOnlinePingPostRequest $conversationsAgentOnlinePingPostRequest, + string $contentType = self::contentTypes['conversationsAgentOnlinePingPost'][0] + ): array { - $returnType = ''; - $request = $this->conversationsAgentOnlinePingPostRequest($body); + $request = $this->conversationsAgentOnlinePingPostRequest($conversationsAgentOnlinePingPostRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -126,26 +193,21 @@ public function conversationsAgentOnlinePingPostWithHttpInfo($body) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -154,7 +216,7 @@ public function conversationsAgentOnlinePingPostWithHttpInfo($body) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -169,14 +231,18 @@ public function conversationsAgentOnlinePingPostWithHttpInfo($body) * * Sets agent’s status to online for 2-3 minutes * - * @param \Brevo\Client\Model\Body14 $body Agent fields. (required) + * @param \Brevo\Client\Models\ConversationsAgentOnlinePingPostRequest $conversationsAgentOnlinePingPostRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsAgentOnlinePingPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function conversationsAgentOnlinePingPostAsync($body) + public function conversationsAgentOnlinePingPostAsync( + \Brevo\Client\Models\ConversationsAgentOnlinePingPostRequest $conversationsAgentOnlinePingPostRequest, + string $contentType = self::contentTypes['conversationsAgentOnlinePingPost'][0] + ): PromiseInterface { - return $this->conversationsAgentOnlinePingPostAsyncWithHttpInfo($body) + return $this->conversationsAgentOnlinePingPostAsyncWithHttpInfo($conversationsAgentOnlinePingPostRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -189,15 +255,20 @@ function ($response) { * * Sets agent’s status to online for 2-3 minutes * - * @param \Brevo\Client\Model\Body14 $body Agent fields. (required) + * @param \Brevo\Client\Models\ConversationsAgentOnlinePingPostRequest $conversationsAgentOnlinePingPostRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsAgentOnlinePingPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function conversationsAgentOnlinePingPostAsyncWithHttpInfo($body) + public function conversationsAgentOnlinePingPostAsyncWithHttpInfo( + $conversationsAgentOnlinePingPostRequest, + string $contentType = self::contentTypes['conversationsAgentOnlinePingPost'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->conversationsAgentOnlinePingPostRequest($body); + $request = $this->conversationsAgentOnlinePingPostRequest($conversationsAgentOnlinePingPostRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -216,7 +287,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -225,20 +296,26 @@ function ($exception) { /** * Create request for operation 'conversationsAgentOnlinePingPost' * - * @param \Brevo\Client\Model\Body14 $body Agent fields. (required) + * @param \Brevo\Client\Models\ConversationsAgentOnlinePingPostRequest $conversationsAgentOnlinePingPostRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsAgentOnlinePingPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function conversationsAgentOnlinePingPostRequest($body) + public function conversationsAgentOnlinePingPostRequest( + $conversationsAgentOnlinePingPostRequest, + string $contentType = self::contentTypes['conversationsAgentOnlinePingPost'][0] + ): Request { - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling conversationsAgentOnlinePingPost' + + // verify the required parameter 'conversationsAgentOnlinePingPostRequest' is set + if ($conversationsAgentOnlinePingPostRequest === null || (is_array($conversationsAgentOnlinePingPostRequest) && count($conversationsAgentOnlinePingPostRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $conversationsAgentOnlinePingPostRequest when calling conversationsAgentOnlinePingPost' ); } + $resourcePath = '/conversations/agentOnlinePing'; $formParams = []; $queryParams = []; @@ -248,56 +325,43 @@ protected function conversationsAgentOnlinePingPostRequest($body) - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($conversationsAgentOnlinePingPostRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($conversationsAgentOnlinePingPostRequest)); + } else { + $httpBody = $conversationsAgentOnlinePingPostRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -323,10 +387,11 @@ protected function conversationsAgentOnlinePingPostRequest($body) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -338,14 +403,18 @@ protected function conversationsAgentOnlinePingPostRequest($body) * Delete a message sent by an agent * * @param string $id ID of the message (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsMessagesIdDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function conversationsMessagesIdDelete($id) + public function conversationsMessagesIdDelete( + string $id, + string $contentType = self::contentTypes['conversationsMessagesIdDelete'][0] + ): void { - $this->conversationsMessagesIdDeleteWithHttpInfo($id); + $this->conversationsMessagesIdDeleteWithHttpInfo($id, $contentType); } /** @@ -354,15 +423,18 @@ public function conversationsMessagesIdDelete($id) * Delete a message sent by an agent * * @param string $id ID of the message (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsMessagesIdDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function conversationsMessagesIdDeleteWithHttpInfo($id) + public function conversationsMessagesIdDeleteWithHttpInfo( + string $id, + string $contentType = self::contentTypes['conversationsMessagesIdDelete'][0] + ): array { - $returnType = ''; - $request = $this->conversationsMessagesIdDeleteRequest($id); + $request = $this->conversationsMessagesIdDeleteRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -371,26 +443,21 @@ public function conversationsMessagesIdDeleteWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -399,7 +466,7 @@ public function conversationsMessagesIdDeleteWithHttpInfo($id) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -407,7 +474,7 @@ public function conversationsMessagesIdDeleteWithHttpInfo($id) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -423,13 +490,17 @@ public function conversationsMessagesIdDeleteWithHttpInfo($id) * Delete a message sent by an agent * * @param string $id ID of the message (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsMessagesIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function conversationsMessagesIdDeleteAsync($id) + public function conversationsMessagesIdDeleteAsync( + string $id, + string $contentType = self::contentTypes['conversationsMessagesIdDelete'][0] + ): PromiseInterface { - return $this->conversationsMessagesIdDeleteAsyncWithHttpInfo($id) + return $this->conversationsMessagesIdDeleteAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -443,14 +514,19 @@ function ($response) { * Delete a message sent by an agent * * @param string $id ID of the message (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsMessagesIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function conversationsMessagesIdDeleteAsyncWithHttpInfo($id) + public function conversationsMessagesIdDeleteAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['conversationsMessagesIdDelete'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->conversationsMessagesIdDeleteRequest($id); + $request = $this->conversationsMessagesIdDeleteRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -469,7 +545,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -479,19 +555,25 @@ function ($exception) { * Create request for operation 'conversationsMessagesIdDelete' * * @param string $id ID of the message (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsMessagesIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function conversationsMessagesIdDeleteRequest($id) + public function conversationsMessagesIdDeleteRequest( + $id, + string $contentType = self::contentTypes['conversationsMessagesIdDelete'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling conversationsMessagesIdDelete' ); } + $resourcePath = '/conversations/messages/{id}'; $formParams = []; $queryParams = []; @@ -500,6 +582,7 @@ protected function conversationsMessagesIdDeleteRequest($id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -509,53 +592,35 @@ protected function conversationsMessagesIdDeleteRequest($id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -581,10 +646,11 @@ protected function conversationsMessagesIdDeleteRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -596,14 +662,18 @@ protected function conversationsMessagesIdDeleteRequest($id) * Get a message * * @param string $id ID of the message (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsMessagesIdGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\ConversationsMessage + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\ConversationsMessage|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function conversationsMessagesIdGet($id) + public function conversationsMessagesIdGet( + string $id, + string $contentType = self::contentTypes['conversationsMessagesIdGet'][0] + ): \Brevo\Client\Models\ConversationsMessage { - list($response) = $this->conversationsMessagesIdGetWithHttpInfo($id); + list($response) = $this->conversationsMessagesIdGetWithHttpInfo($id, $contentType); return $response; } @@ -613,15 +683,18 @@ public function conversationsMessagesIdGet($id) * Get a message * * @param string $id ID of the message (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsMessagesIdGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\ConversationsMessage, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\ConversationsMessage|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function conversationsMessagesIdGetWithHttpInfo($id) + public function conversationsMessagesIdGetWithHttpInfo( + string $id, + string $contentType = self::contentTypes['conversationsMessagesIdGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\ConversationsMessage'; - $request = $this->conversationsMessagesIdGetRequest($id); + $request = $this->conversationsMessagesIdGetRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -630,34 +703,138 @@ public function conversationsMessagesIdGetWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\ConversationsMessage', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ConversationsMessage' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ConversationsMessage', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\ConversationsMessage'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -672,7 +849,7 @@ public function conversationsMessagesIdGetWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ConversationsMessage', + '\Brevo\Client\Models\ConversationsMessage', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -680,7 +857,7 @@ public function conversationsMessagesIdGetWithHttpInfo($id) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -688,7 +865,7 @@ public function conversationsMessagesIdGetWithHttpInfo($id) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -704,13 +881,17 @@ public function conversationsMessagesIdGetWithHttpInfo($id) * Get a message * * @param string $id ID of the message (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsMessagesIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function conversationsMessagesIdGetAsync($id) + public function conversationsMessagesIdGetAsync( + string $id, + string $contentType = self::contentTypes['conversationsMessagesIdGet'][0] + ): PromiseInterface { - return $this->conversationsMessagesIdGetAsyncWithHttpInfo($id) + return $this->conversationsMessagesIdGetAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -724,24 +905,28 @@ function ($response) { * Get a message * * @param string $id ID of the message (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsMessagesIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function conversationsMessagesIdGetAsyncWithHttpInfo($id) + public function conversationsMessagesIdGetAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['conversationsMessagesIdGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\ConversationsMessage'; - $request = $this->conversationsMessagesIdGetRequest($id); + $returnType = '\Brevo\Client\Models\ConversationsMessage'; + $request = $this->conversationsMessagesIdGetRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -764,7 +949,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -774,19 +959,25 @@ function ($exception) { * Create request for operation 'conversationsMessagesIdGet' * * @param string $id ID of the message (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsMessagesIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function conversationsMessagesIdGetRequest($id) + public function conversationsMessagesIdGetRequest( + $id, + string $contentType = self::contentTypes['conversationsMessagesIdGet'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling conversationsMessagesIdGet' ); } + $resourcePath = '/conversations/messages/{id}'; $formParams = []; $queryParams = []; @@ -795,6 +986,7 @@ protected function conversationsMessagesIdGetRequest($id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -804,53 +996,35 @@ protected function conversationsMessagesIdGetRequest($id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -876,10 +1050,11 @@ protected function conversationsMessagesIdGetRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -891,15 +1066,20 @@ protected function conversationsMessagesIdGetRequest($id) * Update a message sent by an agent * * @param string $id ID of the message (required) - * @param \Brevo\Client\Model\Body11 $body body (optional) + * @param \Brevo\Client\Models\ConversationsMessagesIdPutRequest $conversationsMessagesIdPutRequest conversationsMessagesIdPutRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsMessagesIdPut'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\ConversationsMessage + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\ConversationsMessage|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function conversationsMessagesIdPut($id, $body = null) + public function conversationsMessagesIdPut( + string $id, + \Brevo\Client\Models\ConversationsMessagesIdPutRequest $conversationsMessagesIdPutRequest, + string $contentType = self::contentTypes['conversationsMessagesIdPut'][0] + ): \Brevo\Client\Models\ConversationsMessage { - list($response) = $this->conversationsMessagesIdPutWithHttpInfo($id, $body); + list($response) = $this->conversationsMessagesIdPutWithHttpInfo($id, $conversationsMessagesIdPutRequest, $contentType); return $response; } @@ -909,16 +1089,20 @@ public function conversationsMessagesIdPut($id, $body = null) * Update a message sent by an agent * * @param string $id ID of the message (required) - * @param \Brevo\Client\Model\Body11 $body (optional) + * @param \Brevo\Client\Models\ConversationsMessagesIdPutRequest $conversationsMessagesIdPutRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsMessagesIdPut'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\ConversationsMessage, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\ConversationsMessage|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function conversationsMessagesIdPutWithHttpInfo($id, $body = null) + public function conversationsMessagesIdPutWithHttpInfo( + string $id, + \Brevo\Client\Models\ConversationsMessagesIdPutRequest $conversationsMessagesIdPutRequest, + string $contentType = self::contentTypes['conversationsMessagesIdPut'][0] + ): array { - $returnType = '\Brevo\Client\Model\ConversationsMessage'; - $request = $this->conversationsMessagesIdPutRequest($id, $body); + $request = $this->conversationsMessagesIdPutRequest($id, $conversationsMessagesIdPutRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -927,34 +1111,138 @@ public function conversationsMessagesIdPutWithHttpInfo($id, $body = null) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\ConversationsMessage', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ConversationsMessage' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ConversationsMessage', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\ConversationsMessage'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -969,7 +1257,7 @@ public function conversationsMessagesIdPutWithHttpInfo($id, $body = null) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ConversationsMessage', + '\Brevo\Client\Models\ConversationsMessage', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -977,7 +1265,7 @@ public function conversationsMessagesIdPutWithHttpInfo($id, $body = null) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -985,7 +1273,7 @@ public function conversationsMessagesIdPutWithHttpInfo($id, $body = null) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1001,14 +1289,19 @@ public function conversationsMessagesIdPutWithHttpInfo($id, $body = null) * Update a message sent by an agent * * @param string $id ID of the message (required) - * @param \Brevo\Client\Model\Body11 $body (optional) + * @param \Brevo\Client\Models\ConversationsMessagesIdPutRequest $conversationsMessagesIdPutRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsMessagesIdPut'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function conversationsMessagesIdPutAsync($id, $body = null) + public function conversationsMessagesIdPutAsync( + string $id, + \Brevo\Client\Models\ConversationsMessagesIdPutRequest $conversationsMessagesIdPutRequest, + string $contentType = self::contentTypes['conversationsMessagesIdPut'][0] + ): PromiseInterface { - return $this->conversationsMessagesIdPutAsyncWithHttpInfo($id, $body) + return $this->conversationsMessagesIdPutAsyncWithHttpInfo($id, $conversationsMessagesIdPutRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -1022,25 +1315,30 @@ function ($response) { * Update a message sent by an agent * * @param string $id ID of the message (required) - * @param \Brevo\Client\Model\Body11 $body (optional) + * @param \Brevo\Client\Models\ConversationsMessagesIdPutRequest $conversationsMessagesIdPutRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsMessagesIdPut'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function conversationsMessagesIdPutAsyncWithHttpInfo($id, $body = null) + public function conversationsMessagesIdPutAsyncWithHttpInfo( + $id, + $conversationsMessagesIdPutRequest, + string $contentType = self::contentTypes['conversationsMessagesIdPut'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\ConversationsMessage'; - $request = $this->conversationsMessagesIdPutRequest($id, $body); + $returnType = '\Brevo\Client\Models\ConversationsMessage'; + $request = $this->conversationsMessagesIdPutRequest($id, $conversationsMessagesIdPutRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1063,7 +1361,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1073,20 +1371,34 @@ function ($exception) { * Create request for operation 'conversationsMessagesIdPut' * * @param string $id ID of the message (required) - * @param \Brevo\Client\Model\Body11 $body (optional) + * @param \Brevo\Client\Models\ConversationsMessagesIdPutRequest $conversationsMessagesIdPutRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsMessagesIdPut'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function conversationsMessagesIdPutRequest($id, $body = null) + public function conversationsMessagesIdPutRequest( + $id, + $conversationsMessagesIdPutRequest, + string $contentType = self::contentTypes['conversationsMessagesIdPut'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling conversationsMessagesIdPut' ); } + // verify the required parameter 'conversationsMessagesIdPutRequest' is set + if ($conversationsMessagesIdPutRequest === null || (is_array($conversationsMessagesIdPutRequest) && count($conversationsMessagesIdPutRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $conversationsMessagesIdPutRequest when calling conversationsMessagesIdPut' + ); + } + + $resourcePath = '/conversations/messages/{id}'; $formParams = []; $queryParams = []; @@ -1095,6 +1407,7 @@ protected function conversationsMessagesIdPutRequest($id, $body = null) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1104,56 +1417,42 @@ protected function conversationsMessagesIdPutRequest($id, $body = null) ); } - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($conversationsMessagesIdPutRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($conversationsMessagesIdPutRequest)); + } else { + $httpBody = $conversationsMessagesIdPutRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1179,10 +1478,11 @@ protected function conversationsMessagesIdPutRequest($id, $body = null) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1193,15 +1493,19 @@ protected function conversationsMessagesIdPutRequest($id, $body = null) * * Send a message as an agent * - * @param \Brevo\Client\Model\Body10 $body Message fields. (required) + * @param \Brevo\Client\Models\ConversationsMessagesPostRequest $conversationsMessagesPostRequest conversationsMessagesPostRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsMessagesPost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\ConversationsMessage + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\ConversationsMessage|\Brevo\Client\Models\ErrorModel */ - public function conversationsMessagesPost($body) + public function conversationsMessagesPost( + \Brevo\Client\Models\ConversationsMessagesPostRequest $conversationsMessagesPostRequest, + string $contentType = self::contentTypes['conversationsMessagesPost'][0] + ): \Brevo\Client\Models\ConversationsMessage { - list($response) = $this->conversationsMessagesPostWithHttpInfo($body); + list($response) = $this->conversationsMessagesPostWithHttpInfo($conversationsMessagesPostRequest, $contentType); return $response; } @@ -1210,16 +1514,19 @@ public function conversationsMessagesPost($body) * * Send a message as an agent * - * @param \Brevo\Client\Model\Body10 $body Message fields. (required) + * @param \Brevo\Client\Models\ConversationsMessagesPostRequest $conversationsMessagesPostRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsMessagesPost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\ConversationsMessage, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\ConversationsMessage|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function conversationsMessagesPostWithHttpInfo($body) + public function conversationsMessagesPostWithHttpInfo( + \Brevo\Client\Models\ConversationsMessagesPostRequest $conversationsMessagesPostRequest, + string $contentType = self::contentTypes['conversationsMessagesPost'][0] + ): array { - $returnType = '\Brevo\Client\Model\ConversationsMessage'; - $request = $this->conversationsMessagesPostRequest($body); + $request = $this->conversationsMessagesPostRequest($conversationsMessagesPostRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -1228,34 +1535,111 @@ public function conversationsMessagesPostWithHttpInfo($body) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\ConversationsMessage', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ConversationsMessage' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ConversationsMessage', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\ConversationsMessage'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1270,7 +1654,7 @@ public function conversationsMessagesPostWithHttpInfo($body) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ConversationsMessage', + '\Brevo\Client\Models\ConversationsMessage', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1278,7 +1662,7 @@ public function conversationsMessagesPostWithHttpInfo($body) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1293,14 +1677,18 @@ public function conversationsMessagesPostWithHttpInfo($body) * * Send a message as an agent * - * @param \Brevo\Client\Model\Body10 $body Message fields. (required) + * @param \Brevo\Client\Models\ConversationsMessagesPostRequest $conversationsMessagesPostRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsMessagesPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function conversationsMessagesPostAsync($body) + public function conversationsMessagesPostAsync( + \Brevo\Client\Models\ConversationsMessagesPostRequest $conversationsMessagesPostRequest, + string $contentType = self::contentTypes['conversationsMessagesPost'][0] + ): PromiseInterface { - return $this->conversationsMessagesPostAsyncWithHttpInfo($body) + return $this->conversationsMessagesPostAsyncWithHttpInfo($conversationsMessagesPostRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -1313,25 +1701,29 @@ function ($response) { * * Send a message as an agent * - * @param \Brevo\Client\Model\Body10 $body Message fields. (required) + * @param \Brevo\Client\Models\ConversationsMessagesPostRequest $conversationsMessagesPostRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsMessagesPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function conversationsMessagesPostAsyncWithHttpInfo($body) + public function conversationsMessagesPostAsyncWithHttpInfo( + $conversationsMessagesPostRequest, + string $contentType = self::contentTypes['conversationsMessagesPost'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\ConversationsMessage'; - $request = $this->conversationsMessagesPostRequest($body); + $returnType = '\Brevo\Client\Models\ConversationsMessage'; + $request = $this->conversationsMessagesPostRequest($conversationsMessagesPostRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1354,7 +1746,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1363,20 +1755,26 @@ function ($exception) { /** * Create request for operation 'conversationsMessagesPost' * - * @param \Brevo\Client\Model\Body10 $body Message fields. (required) + * @param \Brevo\Client\Models\ConversationsMessagesPostRequest $conversationsMessagesPostRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsMessagesPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function conversationsMessagesPostRequest($body) + public function conversationsMessagesPostRequest( + $conversationsMessagesPostRequest, + string $contentType = self::contentTypes['conversationsMessagesPost'][0] + ): Request { - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling conversationsMessagesPost' + + // verify the required parameter 'conversationsMessagesPostRequest' is set + if ($conversationsMessagesPostRequest === null || (is_array($conversationsMessagesPostRequest) && count($conversationsMessagesPostRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $conversationsMessagesPostRequest when calling conversationsMessagesPost' ); } + $resourcePath = '/conversations/messages'; $formParams = []; $queryParams = []; @@ -1386,56 +1784,43 @@ protected function conversationsMessagesPostRequest($body) - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($conversationsMessagesPostRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($conversationsMessagesPostRequest)); + } else { + $httpBody = $conversationsMessagesPostRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1461,10 +1846,11 @@ protected function conversationsMessagesPostRequest($body) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1476,14 +1862,18 @@ protected function conversationsMessagesPostRequest($body) * Delete an automated message * * @param string $id ID of the message (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsPushedMessagesIdDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function conversationsPushedMessagesIdDelete($id) + public function conversationsPushedMessagesIdDelete( + string $id, + string $contentType = self::contentTypes['conversationsPushedMessagesIdDelete'][0] + ): void { - $this->conversationsPushedMessagesIdDeleteWithHttpInfo($id); + $this->conversationsPushedMessagesIdDeleteWithHttpInfo($id, $contentType); } /** @@ -1492,15 +1882,18 @@ public function conversationsPushedMessagesIdDelete($id) * Delete an automated message * * @param string $id ID of the message (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsPushedMessagesIdDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function conversationsPushedMessagesIdDeleteWithHttpInfo($id) + public function conversationsPushedMessagesIdDeleteWithHttpInfo( + string $id, + string $contentType = self::contentTypes['conversationsPushedMessagesIdDelete'][0] + ): array { - $returnType = ''; - $request = $this->conversationsPushedMessagesIdDeleteRequest($id); + $request = $this->conversationsPushedMessagesIdDeleteRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1509,26 +1902,21 @@ public function conversationsPushedMessagesIdDeleteWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -1537,7 +1925,7 @@ public function conversationsPushedMessagesIdDeleteWithHttpInfo($id) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1545,7 +1933,7 @@ public function conversationsPushedMessagesIdDeleteWithHttpInfo($id) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1561,13 +1949,17 @@ public function conversationsPushedMessagesIdDeleteWithHttpInfo($id) * Delete an automated message * * @param string $id ID of the message (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsPushedMessagesIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function conversationsPushedMessagesIdDeleteAsync($id) + public function conversationsPushedMessagesIdDeleteAsync( + string $id, + string $contentType = self::contentTypes['conversationsPushedMessagesIdDelete'][0] + ): PromiseInterface { - return $this->conversationsPushedMessagesIdDeleteAsyncWithHttpInfo($id) + return $this->conversationsPushedMessagesIdDeleteAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -1581,14 +1973,19 @@ function ($response) { * Delete an automated message * * @param string $id ID of the message (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsPushedMessagesIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function conversationsPushedMessagesIdDeleteAsyncWithHttpInfo($id) + public function conversationsPushedMessagesIdDeleteAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['conversationsPushedMessagesIdDelete'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->conversationsPushedMessagesIdDeleteRequest($id); + $request = $this->conversationsPushedMessagesIdDeleteRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1607,7 +2004,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1617,19 +2014,25 @@ function ($exception) { * Create request for operation 'conversationsPushedMessagesIdDelete' * * @param string $id ID of the message (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsPushedMessagesIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function conversationsPushedMessagesIdDeleteRequest($id) + public function conversationsPushedMessagesIdDeleteRequest( + $id, + string $contentType = self::contentTypes['conversationsPushedMessagesIdDelete'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling conversationsPushedMessagesIdDelete' ); } + $resourcePath = '/conversations/pushedMessages/{id}'; $formParams = []; $queryParams = []; @@ -1638,6 +2041,7 @@ protected function conversationsPushedMessagesIdDeleteRequest($id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1647,53 +2051,35 @@ protected function conversationsPushedMessagesIdDeleteRequest($id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1719,10 +2105,11 @@ protected function conversationsPushedMessagesIdDeleteRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1734,14 +2121,18 @@ protected function conversationsPushedMessagesIdDeleteRequest($id) * Get an automated message * * @param string $id ID of the message sent previously (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsPushedMessagesIdGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\ConversationsMessage + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\ConversationsMessage|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function conversationsPushedMessagesIdGet($id) + public function conversationsPushedMessagesIdGet( + string $id, + string $contentType = self::contentTypes['conversationsPushedMessagesIdGet'][0] + ): \Brevo\Client\Models\ConversationsMessage { - list($response) = $this->conversationsPushedMessagesIdGetWithHttpInfo($id); + list($response) = $this->conversationsPushedMessagesIdGetWithHttpInfo($id, $contentType); return $response; } @@ -1751,15 +2142,18 @@ public function conversationsPushedMessagesIdGet($id) * Get an automated message * * @param string $id ID of the message sent previously (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsPushedMessagesIdGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\ConversationsMessage, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\ConversationsMessage|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function conversationsPushedMessagesIdGetWithHttpInfo($id) + public function conversationsPushedMessagesIdGetWithHttpInfo( + string $id, + string $contentType = self::contentTypes['conversationsPushedMessagesIdGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\ConversationsMessage'; - $request = $this->conversationsPushedMessagesIdGetRequest($id); + $request = $this->conversationsPushedMessagesIdGetRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1768,34 +2162,138 @@ public function conversationsPushedMessagesIdGetWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\ConversationsMessage', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ConversationsMessage' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ConversationsMessage', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\ConversationsMessage'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1810,7 +2308,7 @@ public function conversationsPushedMessagesIdGetWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ConversationsMessage', + '\Brevo\Client\Models\ConversationsMessage', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1818,7 +2316,7 @@ public function conversationsPushedMessagesIdGetWithHttpInfo($id) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1826,7 +2324,7 @@ public function conversationsPushedMessagesIdGetWithHttpInfo($id) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1842,13 +2340,17 @@ public function conversationsPushedMessagesIdGetWithHttpInfo($id) * Get an automated message * * @param string $id ID of the message sent previously (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsPushedMessagesIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function conversationsPushedMessagesIdGetAsync($id) + public function conversationsPushedMessagesIdGetAsync( + string $id, + string $contentType = self::contentTypes['conversationsPushedMessagesIdGet'][0] + ): PromiseInterface { - return $this->conversationsPushedMessagesIdGetAsyncWithHttpInfo($id) + return $this->conversationsPushedMessagesIdGetAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -1862,24 +2364,28 @@ function ($response) { * Get an automated message * * @param string $id ID of the message sent previously (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsPushedMessagesIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function conversationsPushedMessagesIdGetAsyncWithHttpInfo($id) + public function conversationsPushedMessagesIdGetAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['conversationsPushedMessagesIdGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\ConversationsMessage'; - $request = $this->conversationsPushedMessagesIdGetRequest($id); + $returnType = '\Brevo\Client\Models\ConversationsMessage'; + $request = $this->conversationsPushedMessagesIdGetRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1902,7 +2408,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1912,19 +2418,25 @@ function ($exception) { * Create request for operation 'conversationsPushedMessagesIdGet' * * @param string $id ID of the message sent previously (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsPushedMessagesIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function conversationsPushedMessagesIdGetRequest($id) + public function conversationsPushedMessagesIdGetRequest( + $id, + string $contentType = self::contentTypes['conversationsPushedMessagesIdGet'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling conversationsPushedMessagesIdGet' ); } + $resourcePath = '/conversations/pushedMessages/{id}'; $formParams = []; $queryParams = []; @@ -1933,6 +2445,7 @@ protected function conversationsPushedMessagesIdGetRequest($id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1942,53 +2455,35 @@ protected function conversationsPushedMessagesIdGetRequest($id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2014,10 +2509,11 @@ protected function conversationsPushedMessagesIdGetRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2029,15 +2525,20 @@ protected function conversationsPushedMessagesIdGetRequest($id) * Update an automated message * * @param string $id ID of the message (required) - * @param \Brevo\Client\Model\Body13 $body body (required) + * @param \Brevo\Client\Models\ConversationsMessagesIdPutRequest $conversationsMessagesIdPutRequest conversationsMessagesIdPutRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsPushedMessagesIdPut'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\ConversationsMessage + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\ConversationsMessage|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function conversationsPushedMessagesIdPut($id, $body) + public function conversationsPushedMessagesIdPut( + string $id, + \Brevo\Client\Models\ConversationsMessagesIdPutRequest $conversationsMessagesIdPutRequest, + string $contentType = self::contentTypes['conversationsPushedMessagesIdPut'][0] + ): \Brevo\Client\Models\ConversationsMessage { - list($response) = $this->conversationsPushedMessagesIdPutWithHttpInfo($id, $body); + list($response) = $this->conversationsPushedMessagesIdPutWithHttpInfo($id, $conversationsMessagesIdPutRequest, $contentType); return $response; } @@ -2047,16 +2548,20 @@ public function conversationsPushedMessagesIdPut($id, $body) * Update an automated message * * @param string $id ID of the message (required) - * @param \Brevo\Client\Model\Body13 $body (required) + * @param \Brevo\Client\Models\ConversationsMessagesIdPutRequest $conversationsMessagesIdPutRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsPushedMessagesIdPut'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\ConversationsMessage, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\ConversationsMessage|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function conversationsPushedMessagesIdPutWithHttpInfo($id, $body) + public function conversationsPushedMessagesIdPutWithHttpInfo( + string $id, + \Brevo\Client\Models\ConversationsMessagesIdPutRequest $conversationsMessagesIdPutRequest, + string $contentType = self::contentTypes['conversationsPushedMessagesIdPut'][0] + ): array { - $returnType = '\Brevo\Client\Model\ConversationsMessage'; - $request = $this->conversationsPushedMessagesIdPutRequest($id, $body); + $request = $this->conversationsPushedMessagesIdPutRequest($id, $conversationsMessagesIdPutRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -2065,34 +2570,138 @@ public function conversationsPushedMessagesIdPutWithHttpInfo($id, $body) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\ConversationsMessage', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ConversationsMessage' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ConversationsMessage', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\ConversationsMessage'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2107,7 +2716,7 @@ public function conversationsPushedMessagesIdPutWithHttpInfo($id, $body) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ConversationsMessage', + '\Brevo\Client\Models\ConversationsMessage', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2115,7 +2724,7 @@ public function conversationsPushedMessagesIdPutWithHttpInfo($id, $body) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2123,7 +2732,7 @@ public function conversationsPushedMessagesIdPutWithHttpInfo($id, $body) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2139,14 +2748,19 @@ public function conversationsPushedMessagesIdPutWithHttpInfo($id, $body) * Update an automated message * * @param string $id ID of the message (required) - * @param \Brevo\Client\Model\Body13 $body (required) + * @param \Brevo\Client\Models\ConversationsMessagesIdPutRequest $conversationsMessagesIdPutRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsPushedMessagesIdPut'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function conversationsPushedMessagesIdPutAsync($id, $body) + public function conversationsPushedMessagesIdPutAsync( + string $id, + \Brevo\Client\Models\ConversationsMessagesIdPutRequest $conversationsMessagesIdPutRequest, + string $contentType = self::contentTypes['conversationsPushedMessagesIdPut'][0] + ): PromiseInterface { - return $this->conversationsPushedMessagesIdPutAsyncWithHttpInfo($id, $body) + return $this->conversationsPushedMessagesIdPutAsyncWithHttpInfo($id, $conversationsMessagesIdPutRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -2160,25 +2774,30 @@ function ($response) { * Update an automated message * * @param string $id ID of the message (required) - * @param \Brevo\Client\Model\Body13 $body (required) + * @param \Brevo\Client\Models\ConversationsMessagesIdPutRequest $conversationsMessagesIdPutRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsPushedMessagesIdPut'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function conversationsPushedMessagesIdPutAsyncWithHttpInfo($id, $body) + public function conversationsPushedMessagesIdPutAsyncWithHttpInfo( + $id, + $conversationsMessagesIdPutRequest, + string $contentType = self::contentTypes['conversationsPushedMessagesIdPut'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\ConversationsMessage'; - $request = $this->conversationsPushedMessagesIdPutRequest($id, $body); + $returnType = '\Brevo\Client\Models\ConversationsMessage'; + $request = $this->conversationsPushedMessagesIdPutRequest($id, $conversationsMessagesIdPutRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2201,7 +2820,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2211,26 +2830,34 @@ function ($exception) { * Create request for operation 'conversationsPushedMessagesIdPut' * * @param string $id ID of the message (required) - * @param \Brevo\Client\Model\Body13 $body (required) + * @param \Brevo\Client\Models\ConversationsMessagesIdPutRequest $conversationsMessagesIdPutRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsPushedMessagesIdPut'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function conversationsPushedMessagesIdPutRequest($id, $body) + public function conversationsPushedMessagesIdPutRequest( + $id, + $conversationsMessagesIdPutRequest, + string $contentType = self::contentTypes['conversationsPushedMessagesIdPut'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling conversationsPushedMessagesIdPut' ); } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling conversationsPushedMessagesIdPut' + + // verify the required parameter 'conversationsMessagesIdPutRequest' is set + if ($conversationsMessagesIdPutRequest === null || (is_array($conversationsMessagesIdPutRequest) && count($conversationsMessagesIdPutRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $conversationsMessagesIdPutRequest when calling conversationsPushedMessagesIdPut' ); } + $resourcePath = '/conversations/pushedMessages/{id}'; $formParams = []; $queryParams = []; @@ -2239,6 +2866,7 @@ protected function conversationsPushedMessagesIdPutRequest($id, $body) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -2248,56 +2876,42 @@ protected function conversationsPushedMessagesIdPutRequest($id, $body) ); } - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($conversationsMessagesIdPutRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($conversationsMessagesIdPutRequest)); + } else { + $httpBody = $conversationsMessagesIdPutRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2323,10 +2937,11 @@ protected function conversationsPushedMessagesIdPutRequest($id, $body) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2337,15 +2952,19 @@ protected function conversationsPushedMessagesIdPutRequest($id, $body) * * Send an automated message to a visitor * - * @param \Brevo\Client\Model\Body12 $body body (required) + * @param \Brevo\Client\Models\ConversationsPushedMessagesPostRequest $conversationsPushedMessagesPostRequest conversationsPushedMessagesPostRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsPushedMessagesPost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\ConversationsMessage + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\ConversationsMessage|\Brevo\Client\Models\ErrorModel */ - public function conversationsPushedMessagesPost($body) + public function conversationsPushedMessagesPost( + \Brevo\Client\Models\ConversationsPushedMessagesPostRequest $conversationsPushedMessagesPostRequest, + string $contentType = self::contentTypes['conversationsPushedMessagesPost'][0] + ): \Brevo\Client\Models\ConversationsMessage { - list($response) = $this->conversationsPushedMessagesPostWithHttpInfo($body); + list($response) = $this->conversationsPushedMessagesPostWithHttpInfo($conversationsPushedMessagesPostRequest, $contentType); return $response; } @@ -2354,16 +2973,19 @@ public function conversationsPushedMessagesPost($body) * * Send an automated message to a visitor * - * @param \Brevo\Client\Model\Body12 $body (required) + * @param \Brevo\Client\Models\ConversationsPushedMessagesPostRequest $conversationsPushedMessagesPostRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsPushedMessagesPost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\ConversationsMessage, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\ConversationsMessage|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function conversationsPushedMessagesPostWithHttpInfo($body) + public function conversationsPushedMessagesPostWithHttpInfo( + \Brevo\Client\Models\ConversationsPushedMessagesPostRequest $conversationsPushedMessagesPostRequest, + string $contentType = self::contentTypes['conversationsPushedMessagesPost'][0] + ): array { - $returnType = '\Brevo\Client\Model\ConversationsMessage'; - $request = $this->conversationsPushedMessagesPostRequest($body); + $request = $this->conversationsPushedMessagesPostRequest($conversationsPushedMessagesPostRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -2372,34 +2994,111 @@ public function conversationsPushedMessagesPostWithHttpInfo($body) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\ConversationsMessage', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ConversationsMessage' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ConversationsMessage', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\ConversationsMessage'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2414,7 +3113,7 @@ public function conversationsPushedMessagesPostWithHttpInfo($body) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ConversationsMessage', + '\Brevo\Client\Models\ConversationsMessage', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2422,7 +3121,7 @@ public function conversationsPushedMessagesPostWithHttpInfo($body) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2437,14 +3136,18 @@ public function conversationsPushedMessagesPostWithHttpInfo($body) * * Send an automated message to a visitor * - * @param \Brevo\Client\Model\Body12 $body (required) + * @param \Brevo\Client\Models\ConversationsPushedMessagesPostRequest $conversationsPushedMessagesPostRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsPushedMessagesPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function conversationsPushedMessagesPostAsync($body) + public function conversationsPushedMessagesPostAsync( + \Brevo\Client\Models\ConversationsPushedMessagesPostRequest $conversationsPushedMessagesPostRequest, + string $contentType = self::contentTypes['conversationsPushedMessagesPost'][0] + ): PromiseInterface { - return $this->conversationsPushedMessagesPostAsyncWithHttpInfo($body) + return $this->conversationsPushedMessagesPostAsyncWithHttpInfo($conversationsPushedMessagesPostRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -2457,25 +3160,29 @@ function ($response) { * * Send an automated message to a visitor * - * @param \Brevo\Client\Model\Body12 $body (required) + * @param \Brevo\Client\Models\ConversationsPushedMessagesPostRequest $conversationsPushedMessagesPostRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsPushedMessagesPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function conversationsPushedMessagesPostAsyncWithHttpInfo($body) + public function conversationsPushedMessagesPostAsyncWithHttpInfo( + $conversationsPushedMessagesPostRequest, + string $contentType = self::contentTypes['conversationsPushedMessagesPost'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\ConversationsMessage'; - $request = $this->conversationsPushedMessagesPostRequest($body); + $returnType = '\Brevo\Client\Models\ConversationsMessage'; + $request = $this->conversationsPushedMessagesPostRequest($conversationsPushedMessagesPostRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2498,7 +3205,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2507,20 +3214,26 @@ function ($exception) { /** * Create request for operation 'conversationsPushedMessagesPost' * - * @param \Brevo\Client\Model\Body12 $body (required) + * @param \Brevo\Client\Models\ConversationsPushedMessagesPostRequest $conversationsPushedMessagesPostRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['conversationsPushedMessagesPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function conversationsPushedMessagesPostRequest($body) + public function conversationsPushedMessagesPostRequest( + $conversationsPushedMessagesPostRequest, + string $contentType = self::contentTypes['conversationsPushedMessagesPost'][0] + ): Request { - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling conversationsPushedMessagesPost' + + // verify the required parameter 'conversationsPushedMessagesPostRequest' is set + if ($conversationsPushedMessagesPostRequest === null || (is_array($conversationsPushedMessagesPostRequest) && count($conversationsPushedMessagesPostRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $conversationsPushedMessagesPostRequest when calling conversationsPushedMessagesPost' ); } + $resourcePath = '/conversations/pushedMessages'; $formParams = []; $queryParams = []; @@ -2530,56 +3243,43 @@ protected function conversationsPushedMessagesPostRequest($body) - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($conversationsPushedMessagesPostRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($conversationsPushedMessagesPostRequest)); + } else { + $httpBody = $conversationsPushedMessagesPostRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2605,10 +3305,11 @@ protected function conversationsPushedMessagesPostRequest($body) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2620,7 +3321,7 @@ protected function conversationsPushedMessagesPostRequest($body) * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/CouponsApi.php b/lib/Api/CouponsApi.php index ee2bde7..87cef44 100644 --- a/lib/Api/CouponsApi.php +++ b/lib/Api/CouponsApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'createCoupons' => [ + 'application/json', + ], + 'getCouponCollection' => [ + 'application/json', + ], + 'getCouponCollections' => [ + 'application/json', + ], + 'updateCouponCollection' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -92,15 +140,19 @@ public function getConfig() * * Create а coupon collection * - * @param \Brevo\Client\Model\CreateCouponCollection $createCouponCollection Values to create a coupon collection (required) + * @param \Brevo\Client\Models\CreateCouponCollectionRequest $createCouponCollectionRequest Values to create a coupon collection (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCouponCollection'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\InlineResponse2013 + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateCouponCollection201Response|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function createCouponCollection($createCouponCollection) + public function createCouponCollection( + \Brevo\Client\Models\CreateCouponCollectionRequest $createCouponCollectionRequest, + string $contentType = self::contentTypes['createCouponCollection'][0] + ): \Brevo\Client\Models\CreateCouponCollection201Response { - list($response) = $this->createCouponCollectionWithHttpInfo($createCouponCollection); + list($response) = $this->createCouponCollectionWithHttpInfo($createCouponCollectionRequest, $contentType); return $response; } @@ -109,16 +161,19 @@ public function createCouponCollection($createCouponCollection) * * Create а coupon collection * - * @param \Brevo\Client\Model\CreateCouponCollection $createCouponCollection Values to create a coupon collection (required) + * @param \Brevo\Client\Models\CreateCouponCollectionRequest $createCouponCollectionRequest Values to create a coupon collection (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCouponCollection'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\InlineResponse2013, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateCouponCollection201Response|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function createCouponCollectionWithHttpInfo($createCouponCollection) + public function createCouponCollectionWithHttpInfo( + \Brevo\Client\Models\CreateCouponCollectionRequest $createCouponCollectionRequest, + string $contentType = self::contentTypes['createCouponCollection'][0] + ): array { - $returnType = '\Brevo\Client\Model\InlineResponse2013'; - $request = $this->createCouponCollectionRequest($createCouponCollection); + $request = $this->createCouponCollectionRequest($createCouponCollectionRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -127,34 +182,138 @@ public function createCouponCollectionWithHttpInfo($createCouponCollection) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreateCouponCollection201Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateCouponCollection201Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateCouponCollection201Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreateCouponCollection201Response'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -169,23 +328,23 @@ public function createCouponCollectionWithHttpInfo($createCouponCollection) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\InlineResponse2013', + '\Brevo\Client\Models\CreateCouponCollection201Response', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 401: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 401: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -200,14 +359,18 @@ public function createCouponCollectionWithHttpInfo($createCouponCollection) * * Create а coupon collection * - * @param \Brevo\Client\Model\CreateCouponCollection $createCouponCollection Values to create a coupon collection (required) + * @param \Brevo\Client\Models\CreateCouponCollectionRequest $createCouponCollectionRequest Values to create a coupon collection (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCouponCollection'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createCouponCollectionAsync($createCouponCollection) + public function createCouponCollectionAsync( + \Brevo\Client\Models\CreateCouponCollectionRequest $createCouponCollectionRequest, + string $contentType = self::contentTypes['createCouponCollection'][0] + ): PromiseInterface { - return $this->createCouponCollectionAsyncWithHttpInfo($createCouponCollection) + return $this->createCouponCollectionAsyncWithHttpInfo($createCouponCollectionRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -220,25 +383,29 @@ function ($response) { * * Create а coupon collection * - * @param \Brevo\Client\Model\CreateCouponCollection $createCouponCollection Values to create a coupon collection (required) + * @param \Brevo\Client\Models\CreateCouponCollectionRequest $createCouponCollectionRequest Values to create a coupon collection (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCouponCollection'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createCouponCollectionAsyncWithHttpInfo($createCouponCollection) + public function createCouponCollectionAsyncWithHttpInfo( + $createCouponCollectionRequest, + string $contentType = self::contentTypes['createCouponCollection'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\InlineResponse2013'; - $request = $this->createCouponCollectionRequest($createCouponCollection); + $returnType = '\Brevo\Client\Models\CreateCouponCollection201Response'; + $request = $this->createCouponCollectionRequest($createCouponCollectionRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -261,7 +428,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -270,20 +437,26 @@ function ($exception) { /** * Create request for operation 'createCouponCollection' * - * @param \Brevo\Client\Model\CreateCouponCollection $createCouponCollection Values to create a coupon collection (required) + * @param \Brevo\Client\Models\CreateCouponCollectionRequest $createCouponCollectionRequest Values to create a coupon collection (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCouponCollection'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createCouponCollectionRequest($createCouponCollection) + public function createCouponCollectionRequest( + $createCouponCollectionRequest, + string $contentType = self::contentTypes['createCouponCollection'][0] + ): Request { - // verify the required parameter 'createCouponCollection' is set - if ($createCouponCollection === null || (is_array($createCouponCollection) && count($createCouponCollection) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $createCouponCollection when calling createCouponCollection' + + // verify the required parameter 'createCouponCollectionRequest' is set + if ($createCouponCollectionRequest === null || (is_array($createCouponCollectionRequest) && count($createCouponCollectionRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $createCouponCollectionRequest when calling createCouponCollection' ); } + $resourcePath = '/couponCollections'; $formParams = []; $queryParams = []; @@ -293,56 +466,43 @@ protected function createCouponCollectionRequest($createCouponCollection) - // body params - $_tempBody = null; - if (isset($createCouponCollection)) { - $_tempBody = $createCouponCollection; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($createCouponCollectionRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createCouponCollectionRequest)); + } else { + $httpBody = $createCouponCollectionRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -368,10 +528,11 @@ protected function createCouponCollectionRequest($createCouponCollection) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -382,15 +543,19 @@ protected function createCouponCollectionRequest($createCouponCollection) * * Create coupons for a coupon collection * - * @param \Brevo\Client\Model\CreateCoupons $createCoupons Values to create coupons (required) + * @param \Brevo\Client\Models\CreateCouponsRequest $createCouponsRequest Values to create coupons (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCoupons'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function createCoupons($createCoupons) + public function createCoupons( + \Brevo\Client\Models\CreateCouponsRequest $createCouponsRequest, + string $contentType = self::contentTypes['createCoupons'][0] + ): void { - $this->createCouponsWithHttpInfo($createCoupons); + $this->createCouponsWithHttpInfo($createCouponsRequest, $contentType); } /** @@ -398,16 +563,19 @@ public function createCoupons($createCoupons) * * Create coupons for a coupon collection * - * @param \Brevo\Client\Model\CreateCoupons $createCoupons Values to create coupons (required) + * @param \Brevo\Client\Models\CreateCouponsRequest $createCouponsRequest Values to create coupons (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCoupons'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function createCouponsWithHttpInfo($createCoupons) + public function createCouponsWithHttpInfo( + \Brevo\Client\Models\CreateCouponsRequest $createCouponsRequest, + string $contentType = self::contentTypes['createCoupons'][0] + ): array { - $returnType = ''; - $request = $this->createCouponsRequest($createCoupons); + $request = $this->createCouponsRequest($createCouponsRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -416,26 +584,21 @@ public function createCouponsWithHttpInfo($createCoupons) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -444,7 +607,7 @@ public function createCouponsWithHttpInfo($createCoupons) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -452,7 +615,7 @@ public function createCouponsWithHttpInfo($createCoupons) case 401: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -460,7 +623,7 @@ public function createCouponsWithHttpInfo($createCoupons) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -475,14 +638,18 @@ public function createCouponsWithHttpInfo($createCoupons) * * Create coupons for a coupon collection * - * @param \Brevo\Client\Model\CreateCoupons $createCoupons Values to create coupons (required) + * @param \Brevo\Client\Models\CreateCouponsRequest $createCouponsRequest Values to create coupons (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCoupons'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createCouponsAsync($createCoupons) + public function createCouponsAsync( + \Brevo\Client\Models\CreateCouponsRequest $createCouponsRequest, + string $contentType = self::contentTypes['createCoupons'][0] + ): PromiseInterface { - return $this->createCouponsAsyncWithHttpInfo($createCoupons) + return $this->createCouponsAsyncWithHttpInfo($createCouponsRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -495,15 +662,20 @@ function ($response) { * * Create coupons for a coupon collection * - * @param \Brevo\Client\Model\CreateCoupons $createCoupons Values to create coupons (required) + * @param \Brevo\Client\Models\CreateCouponsRequest $createCouponsRequest Values to create coupons (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCoupons'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createCouponsAsyncWithHttpInfo($createCoupons) + public function createCouponsAsyncWithHttpInfo( + $createCouponsRequest, + string $contentType = self::contentTypes['createCoupons'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->createCouponsRequest($createCoupons); + $request = $this->createCouponsRequest($createCouponsRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -522,7 +694,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -531,20 +703,26 @@ function ($exception) { /** * Create request for operation 'createCoupons' * - * @param \Brevo\Client\Model\CreateCoupons $createCoupons Values to create coupons (required) + * @param \Brevo\Client\Models\CreateCouponsRequest $createCouponsRequest Values to create coupons (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCoupons'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createCouponsRequest($createCoupons) + public function createCouponsRequest( + $createCouponsRequest, + string $contentType = self::contentTypes['createCoupons'][0] + ): Request { - // verify the required parameter 'createCoupons' is set - if ($createCoupons === null || (is_array($createCoupons) && count($createCoupons) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $createCoupons when calling createCoupons' + + // verify the required parameter 'createCouponsRequest' is set + if ($createCouponsRequest === null || (is_array($createCouponsRequest) && count($createCouponsRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $createCouponsRequest when calling createCoupons' ); } + $resourcePath = '/coupons'; $formParams = []; $queryParams = []; @@ -554,56 +732,43 @@ protected function createCouponsRequest($createCoupons) - // body params - $_tempBody = null; - if (isset($createCoupons)) { - $_tempBody = $createCoupons; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($createCouponsRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createCouponsRequest)); + } else { + $httpBody = $createCouponsRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -629,10 +794,11 @@ protected function createCouponsRequest($createCoupons) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -644,14 +810,18 @@ protected function createCouponsRequest($createCoupons) * Get a coupon collection by id * * @param string $id Id of the collection to return (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCouponCollection'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetCouponCollection + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetCouponCollection|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function getCouponCollection($id) + public function getCouponCollection( + string $id, + string $contentType = self::contentTypes['getCouponCollection'][0] + ): \Brevo\Client\Models\GetCouponCollection { - list($response) = $this->getCouponCollectionWithHttpInfo($id); + list($response) = $this->getCouponCollectionWithHttpInfo($id, $contentType); return $response; } @@ -661,15 +831,18 @@ public function getCouponCollection($id) * Get a coupon collection by id * * @param string $id Id of the collection to return (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCouponCollection'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetCouponCollection, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetCouponCollection|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getCouponCollectionWithHttpInfo($id) + public function getCouponCollectionWithHttpInfo( + string $id, + string $contentType = self::contentTypes['getCouponCollection'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetCouponCollection'; - $request = $this->getCouponCollectionRequest($id); + $request = $this->getCouponCollectionRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -678,34 +851,165 @@ public function getCouponCollectionWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetCouponCollection', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetCouponCollection' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetCouponCollection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetCouponCollection'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -720,7 +1024,7 @@ public function getCouponCollectionWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetCouponCollection', + '\Brevo\Client\Models\GetCouponCollection', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -728,7 +1032,7 @@ public function getCouponCollectionWithHttpInfo($id) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -736,7 +1040,7 @@ public function getCouponCollectionWithHttpInfo($id) case 401: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -744,7 +1048,7 @@ public function getCouponCollectionWithHttpInfo($id) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -760,13 +1064,17 @@ public function getCouponCollectionWithHttpInfo($id) * Get a coupon collection by id * * @param string $id Id of the collection to return (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCouponCollection'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getCouponCollectionAsync($id) + public function getCouponCollectionAsync( + string $id, + string $contentType = self::contentTypes['getCouponCollection'][0] + ): PromiseInterface { - return $this->getCouponCollectionAsyncWithHttpInfo($id) + return $this->getCouponCollectionAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -780,24 +1088,28 @@ function ($response) { * Get a coupon collection by id * * @param string $id Id of the collection to return (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCouponCollection'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getCouponCollectionAsyncWithHttpInfo($id) + public function getCouponCollectionAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['getCouponCollection'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetCouponCollection'; - $request = $this->getCouponCollectionRequest($id); + $returnType = '\Brevo\Client\Models\GetCouponCollection'; + $request = $this->getCouponCollectionRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -820,7 +1132,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -830,19 +1142,25 @@ function ($exception) { * Create request for operation 'getCouponCollection' * * @param string $id Id of the collection to return (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCouponCollection'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getCouponCollectionRequest($id) + public function getCouponCollectionRequest( + $id, + string $contentType = self::contentTypes['getCouponCollection'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling getCouponCollection' ); } + $resourcePath = '/couponCollections/{id}'; $formParams = []; $queryParams = []; @@ -851,6 +1169,7 @@ protected function getCouponCollectionRequest($id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -860,53 +1179,35 @@ protected function getCouponCollectionRequest($id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -932,10 +1233,11 @@ protected function getCouponCollectionRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -946,17 +1248,25 @@ protected function getCouponCollectionRequest($id) * * Get all your coupon collections * - * @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 string $sort Sort the results by creation time in ascending/descending order (optional, default to desc) + * @param int|null $limit Number of documents returned per page (optional, default to 50) + * @param int|null $offset Index of the first document on the page (optional, default to 0) + * @param string|null $sort Sort the results by creation time in ascending/descending order (optional, default to 'desc') + * @param string|null $sortBy The field used to sort coupon collections (optional, default to 'createdAt') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCouponCollections'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetCouponCollection + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetCouponCollection|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function getCouponCollections($limit = '50', $offset = '0', $sort = 'desc') + public function getCouponCollections( + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + ?string $sortBy = 'createdAt', + string $contentType = self::contentTypes['getCouponCollections'][0] + ): \Brevo\Client\Models\GetCouponCollection { - list($response) = $this->getCouponCollectionsWithHttpInfo($limit, $offset, $sort); + list($response) = $this->getCouponCollectionsWithHttpInfo($limit, $offset, $sort, $sortBy, $contentType); return $response; } @@ -965,18 +1275,25 @@ public function getCouponCollections($limit = '50', $offset = '0', $sort = 'desc * * Get all your coupon collections * - * @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 string $sort Sort the results by creation time in ascending/descending order (optional, default to desc) + * @param int|null $limit Number of documents returned per page (optional, default to 50) + * @param int|null $offset Index of the first document on the page (optional, default to 0) + * @param string|null $sort Sort the results by creation time in ascending/descending order (optional, default to 'desc') + * @param string|null $sortBy The field used to sort coupon collections (optional, default to 'createdAt') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCouponCollections'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetCouponCollection, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetCouponCollection|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getCouponCollectionsWithHttpInfo($limit = '50', $offset = '0', $sort = 'desc') + public function getCouponCollectionsWithHttpInfo( + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + ?string $sortBy = 'createdAt', + string $contentType = self::contentTypes['getCouponCollections'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetCouponCollection'; - $request = $this->getCouponCollectionsRequest($limit, $offset, $sort); + $request = $this->getCouponCollectionsRequest($limit, $offset, $sort, $sortBy, $contentType); try { $options = $this->createHttpClientOption(); @@ -985,34 +1302,138 @@ public function getCouponCollectionsWithHttpInfo($limit = '50', $offset = '0', $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetCouponCollection', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetCouponCollection' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetCouponCollection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetCouponCollection'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1027,7 +1448,7 @@ public function getCouponCollectionsWithHttpInfo($limit = '50', $offset = '0', $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetCouponCollection', + '\Brevo\Client\Models\GetCouponCollection', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1035,7 +1456,7 @@ public function getCouponCollectionsWithHttpInfo($limit = '50', $offset = '0', $ case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1043,15 +1464,7 @@ public function getCouponCollectionsWithHttpInfo($limit = '50', $offset = '0', $ case 401: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1066,16 +1479,24 @@ public function getCouponCollectionsWithHttpInfo($limit = '50', $offset = '0', $ * * Get all your coupon collections * - * @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 string $sort Sort the results by creation time in ascending/descending order (optional, default to desc) + * @param int|null $limit Number of documents returned per page (optional, default to 50) + * @param int|null $offset Index of the first document on the page (optional, default to 0) + * @param string|null $sort Sort the results by creation time in ascending/descending order (optional, default to 'desc') + * @param string|null $sortBy The field used to sort coupon collections (optional, default to 'createdAt') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCouponCollections'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getCouponCollectionsAsync($limit = '50', $offset = '0', $sort = 'desc') + public function getCouponCollectionsAsync( + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + ?string $sortBy = 'createdAt', + string $contentType = self::contentTypes['getCouponCollections'][0] + ): PromiseInterface { - return $this->getCouponCollectionsAsyncWithHttpInfo($limit, $offset, $sort) + return $this->getCouponCollectionsAsyncWithHttpInfo($limit, $offset, $sort, $sortBy, $contentType) ->then( function ($response) { return $response[0]; @@ -1088,27 +1509,35 @@ function ($response) { * * Get all your coupon collections * - * @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 string $sort Sort the results by creation time in ascending/descending order (optional, default to desc) + * @param int|null $limit Number of documents returned per page (optional, default to 50) + * @param int|null $offset Index of the first document on the page (optional, default to 0) + * @param string|null $sort Sort the results by creation time in ascending/descending order (optional, default to 'desc') + * @param string|null $sortBy The field used to sort coupon collections (optional, default to 'createdAt') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCouponCollections'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getCouponCollectionsAsyncWithHttpInfo($limit = '50', $offset = '0', $sort = 'desc') + public function getCouponCollectionsAsyncWithHttpInfo( + $limit = 50, + $offset = 0, + $sort = 'desc', + $sortBy = 'createdAt', + string $contentType = self::contentTypes['getCouponCollections'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetCouponCollection'; - $request = $this->getCouponCollectionsRequest($limit, $offset, $sort); + $returnType = '\Brevo\Client\Models\GetCouponCollection'; + $request = $this->getCouponCollectionsRequest($limit, $offset, $sort, $sortBy, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1131,7 +1560,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1140,25 +1569,36 @@ function ($exception) { /** * Create request for operation 'getCouponCollections' * - * @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 string $sort Sort the results by creation time in ascending/descending order (optional, default to desc) + * @param int|null $limit Number of documents returned per page (optional, default to 50) + * @param int|null $offset Index of the first document on the page (optional, default to 0) + * @param string|null $sort Sort the results by creation time in ascending/descending order (optional, default to 'desc') + * @param string|null $sortBy The field used to sort coupon collections (optional, default to 'createdAt') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCouponCollections'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getCouponCollectionsRequest($limit = '50', $offset = '0', $sort = 'desc') + public function getCouponCollectionsRequest( + $limit = 50, + $offset = 0, + $sort = 'desc', + $sortBy = 'createdAt', + string $contentType = self::contentTypes['getCouponCollections'][0] + ): Request { + if ($limit !== null && $limit > 100) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling CouponsApi.getCouponCollections, must be smaller than or equal to 100.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling CouponsApi.getCouponCollections, must be smaller than or equal to 100.'); } if ($limit !== null && $limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling CouponsApi.getCouponCollections, must be bigger than or equal to 0.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling CouponsApi.getCouponCollections, must be bigger than or equal to 0.'); } - + if ($offset !== null && $offset < 0) { - throw new \InvalidArgumentException('invalid value for "$offset" when calling CouponsApi.getCouponCollections, must be bigger than or equal to 0.'); + throw new InvalidArgumentException('invalid value for "$offset" when calling CouponsApi.getCouponCollections, must be bigger than or equal to 0.'); } + + $resourcePath = '/couponCollections'; @@ -1169,66 +1609,73 @@ protected function getCouponCollectionsRequest($limit = '50', $offset = '0', $so $multipart = false; // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sortBy, + 'sortBy', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1254,10 +1701,11 @@ protected function getCouponCollectionsRequest($limit = '50', $offset = '0', $so $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1269,15 +1717,20 @@ protected function getCouponCollectionsRequest($limit = '50', $offset = '0', $so * Update a coupon collection by id * * @param string $id Id of the collection to update (required) - * @param \Brevo\Client\Model\UpdateCouponCollection $updateCouponCollection Values to update the coupon collection (required) + * @param \Brevo\Client\Models\UpdateCouponCollectionRequest|null $updateCouponCollectionRequest Values to update the coupon collection (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCouponCollection'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\InlineResponse2002 + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\UpdateCouponCollection200Response|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function updateCouponCollection($id, $updateCouponCollection) + public function updateCouponCollection( + string $id, + ?\Brevo\Client\Models\UpdateCouponCollectionRequest $updateCouponCollectionRequest = null, + string $contentType = self::contentTypes['updateCouponCollection'][0] + ): \Brevo\Client\Models\UpdateCouponCollection200Response { - list($response) = $this->updateCouponCollectionWithHttpInfo($id, $updateCouponCollection); + list($response) = $this->updateCouponCollectionWithHttpInfo($id, $updateCouponCollectionRequest, $contentType); return $response; } @@ -1287,16 +1740,20 @@ public function updateCouponCollection($id, $updateCouponCollection) * Update a coupon collection by id * * @param string $id Id of the collection to update (required) - * @param \Brevo\Client\Model\UpdateCouponCollection $updateCouponCollection Values to update the coupon collection (required) + * @param \Brevo\Client\Models\UpdateCouponCollectionRequest|null $updateCouponCollectionRequest Values to update the coupon collection (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCouponCollection'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\InlineResponse2002, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\UpdateCouponCollection200Response|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function updateCouponCollectionWithHttpInfo($id, $updateCouponCollection) + public function updateCouponCollectionWithHttpInfo( + string $id, + ?\Brevo\Client\Models\UpdateCouponCollectionRequest $updateCouponCollectionRequest = null, + string $contentType = self::contentTypes['updateCouponCollection'][0] + ): array { - $returnType = '\Brevo\Client\Model\InlineResponse2002'; - $request = $this->updateCouponCollectionRequest($id, $updateCouponCollection); + $request = $this->updateCouponCollectionRequest($id, $updateCouponCollectionRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -1305,34 +1762,138 @@ public function updateCouponCollectionWithHttpInfo($id, $updateCouponCollection) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\UpdateCouponCollection200Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\UpdateCouponCollection200Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\UpdateCouponCollection200Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\UpdateCouponCollection200Response'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1347,7 +1908,7 @@ public function updateCouponCollectionWithHttpInfo($id, $updateCouponCollection) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\InlineResponse2002', + '\Brevo\Client\Models\UpdateCouponCollection200Response', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1355,7 +1916,7 @@ public function updateCouponCollectionWithHttpInfo($id, $updateCouponCollection) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1363,7 +1924,7 @@ public function updateCouponCollectionWithHttpInfo($id, $updateCouponCollection) case 401: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1379,14 +1940,19 @@ public function updateCouponCollectionWithHttpInfo($id, $updateCouponCollection) * Update a coupon collection by id * * @param string $id Id of the collection to update (required) - * @param \Brevo\Client\Model\UpdateCouponCollection $updateCouponCollection Values to update the coupon collection (required) + * @param \Brevo\Client\Models\UpdateCouponCollectionRequest|null $updateCouponCollectionRequest Values to update the coupon collection (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCouponCollection'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateCouponCollectionAsync($id, $updateCouponCollection) + public function updateCouponCollectionAsync( + string $id, + ?\Brevo\Client\Models\UpdateCouponCollectionRequest $updateCouponCollectionRequest = null, + string $contentType = self::contentTypes['updateCouponCollection'][0] + ): PromiseInterface { - return $this->updateCouponCollectionAsyncWithHttpInfo($id, $updateCouponCollection) + return $this->updateCouponCollectionAsyncWithHttpInfo($id, $updateCouponCollectionRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -1400,25 +1966,30 @@ function ($response) { * Update a coupon collection by id * * @param string $id Id of the collection to update (required) - * @param \Brevo\Client\Model\UpdateCouponCollection $updateCouponCollection Values to update the coupon collection (required) + * @param \Brevo\Client\Models\UpdateCouponCollectionRequest|null $updateCouponCollectionRequest Values to update the coupon collection (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCouponCollection'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateCouponCollectionAsyncWithHttpInfo($id, $updateCouponCollection) + public function updateCouponCollectionAsyncWithHttpInfo( + $id, + $updateCouponCollectionRequest = null, + string $contentType = self::contentTypes['updateCouponCollection'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\InlineResponse2002'; - $request = $this->updateCouponCollectionRequest($id, $updateCouponCollection); + $returnType = '\Brevo\Client\Models\UpdateCouponCollection200Response'; + $request = $this->updateCouponCollectionRequest($id, $updateCouponCollectionRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1441,7 +2012,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1451,25 +2022,27 @@ function ($exception) { * Create request for operation 'updateCouponCollection' * * @param string $id Id of the collection to update (required) - * @param \Brevo\Client\Model\UpdateCouponCollection $updateCouponCollection Values to update the coupon collection (required) + * @param \Brevo\Client\Models\UpdateCouponCollectionRequest|null $updateCouponCollectionRequest Values to update the coupon collection (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCouponCollection'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updateCouponCollectionRequest($id, $updateCouponCollection) + public function updateCouponCollectionRequest( + $id, + $updateCouponCollectionRequest = null, + string $contentType = self::contentTypes['updateCouponCollection'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling updateCouponCollection' ); } - // verify the required parameter 'updateCouponCollection' is set - if ($updateCouponCollection === null || (is_array($updateCouponCollection) && count($updateCouponCollection) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $updateCouponCollection when calling updateCouponCollection' - ); - } + + $resourcePath = '/couponCollections/{id}'; $formParams = []; @@ -1479,6 +2052,7 @@ protected function updateCouponCollectionRequest($id, $updateCouponCollection) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1488,56 +2062,42 @@ protected function updateCouponCollectionRequest($id, $updateCouponCollection) ); } - // body params - $_tempBody = null; - if (isset($updateCouponCollection)) { - $_tempBody = $updateCouponCollection; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($updateCouponCollectionRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($updateCouponCollectionRequest)); + } else { + $httpBody = $updateCouponCollectionRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1563,10 +2123,11 @@ protected function updateCouponCollectionRequest($id, $updateCouponCollection) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PATCH', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1578,7 +2139,7 @@ protected function updateCouponCollectionRequest($id, $updateCouponCollection) * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/DealsApi.php b/lib/Api/DealsApi.php index 1540c93..25f1222 100644 --- a/lib/Api/DealsApi.php +++ b/lib/Api/DealsApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'crmDealsGet' => [ + 'application/json', + ], + 'crmDealsIdDelete' => [ + 'application/json', + ], + 'crmDealsIdGet' => [ + 'application/json', + ], + 'crmDealsIdPatch' => [ + 'application/json', + ], + 'crmDealsImportPost' => [ + 'multipart/form-data', + ], + 'crmDealsLinkUnlinkIdPatch' => [ + 'application/json', + ], + 'crmDealsPost' => [ + 'application/json', + ], + 'crmPipelineDetailsAllGet' => [ + 'application/json', + ], + 'crmPipelineDetailsGet' => [ + 'application/json', + ], + 'crmPipelineDetailsPipelineIDGet' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -92,14 +158,17 @@ public function getConfig() * * Get deal attributes * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmAttributesDealsGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\DealAttributes + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\DealAttributesInner[] */ - public function crmAttributesDealsGet() + public function crmAttributesDealsGet( + string $contentType = self::contentTypes['crmAttributesDealsGet'][0] + ): array { - list($response) = $this->crmAttributesDealsGetWithHttpInfo(); + list($response) = $this->crmAttributesDealsGetWithHttpInfo($contentType); return $response; } @@ -108,15 +177,17 @@ public function crmAttributesDealsGet() * * Get deal attributes * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmAttributesDealsGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\DealAttributes, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\DealAttributesInner[], HTTP status code, HTTP response headers (array of strings) */ - public function crmAttributesDealsGetWithHttpInfo() + public function crmAttributesDealsGetWithHttpInfo( + string $contentType = self::contentTypes['crmAttributesDealsGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\DealAttributes'; - $request = $this->crmAttributesDealsGetRequest(); + $request = $this->crmAttributesDealsGetRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -125,34 +196,84 @@ public function crmAttributesDealsGetWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\DealAttributesInner[]', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\DealAttributesInner[]' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\DealAttributesInner[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\DealAttributesInner[]'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -167,7 +288,7 @@ public function crmAttributesDealsGetWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\DealAttributes', + '\Brevo\Client\Models\DealAttributesInner[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -182,13 +303,16 @@ public function crmAttributesDealsGetWithHttpInfo() * * Get deal attributes * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmAttributesDealsGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmAttributesDealsGetAsync() + public function crmAttributesDealsGetAsync( + string $contentType = self::contentTypes['crmAttributesDealsGet'][0] + ): PromiseInterface { - return $this->crmAttributesDealsGetAsyncWithHttpInfo() + return $this->crmAttributesDealsGetAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -201,24 +325,27 @@ function ($response) { * * Get deal attributes * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmAttributesDealsGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmAttributesDealsGetAsyncWithHttpInfo() + public function crmAttributesDealsGetAsyncWithHttpInfo( + string $contentType = self::contentTypes['crmAttributesDealsGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\DealAttributes'; - $request = $this->crmAttributesDealsGetRequest(); + $returnType = '\Brevo\Client\Models\DealAttributesInner[]'; + $request = $this->crmAttributesDealsGetRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -241,7 +368,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -250,13 +377,17 @@ function ($exception) { /** * Create request for operation 'crmAttributesDealsGet' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmAttributesDealsGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmAttributesDealsGetRequest() + public function crmAttributesDealsGetRequest( + string $contentType = self::contentTypes['crmAttributesDealsGet'][0] + ): Request { + $resourcePath = '/crm/attributes/deals'; $formParams = []; $queryParams = []; @@ -266,53 +397,36 @@ protected function crmAttributesDealsGetRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -338,10 +452,11 @@ protected function crmAttributesDealsGetRequest() $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -352,21 +467,29 @@ protected function crmAttributesDealsGetRequest() * * Get all deals * - * @param string $filtersAttributesDealName Filter by attributes. If you have filter for owner on your side please send it as `filters[attributes.deal_owner]`.\" (optional) - * @param string $filtersLinkedCompaniesIds Filter by linked companies ids (optional) - * @param string $filtersLinkedContactsIds Filter by linked companies ids (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * @param string $sortBy The field used to sort field names. (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\DealsList + * @param string|null $filtersAttributesDealName Filter by attributes. If you have a filter for the owner on your end, please send it as filters[attributes.deal_owner] and utilize the account email for the filtering. (optional) + * @param string|null $filtersLinkedCompaniesIds Filter by linked companies ids (optional) + * @param string|null $filtersLinkedContactsIds Filter by linked companies ids (optional) + * @param int|null $offset Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsGet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\DealsList|\Brevo\Client\Models\ErrorModel */ - public function crmDealsGet($filtersAttributesDealName = null, $filtersLinkedCompaniesIds = null, $filtersLinkedContactsIds = null, $offset = null, $limit = '50', $sort = null, $sortBy = null) + public function crmDealsGet( + ?string $filtersAttributesDealName = null, + ?string $filtersLinkedCompaniesIds = null, + ?string $filtersLinkedContactsIds = null, + ?int $offset = null, + ?int $limit = null, + ?string $sort = null, + string $contentType = self::contentTypes['crmDealsGet'][0] + ): \Brevo\Client\Models\DealsList { - list($response) = $this->crmDealsGetWithHttpInfo($filtersAttributesDealName, $filtersLinkedCompaniesIds, $filtersLinkedContactsIds, $offset, $limit, $sort, $sortBy); + list($response) = $this->crmDealsGetWithHttpInfo($filtersAttributesDealName, $filtersLinkedCompaniesIds, $filtersLinkedContactsIds, $offset, $limit, $sort, $contentType); return $response; } @@ -375,22 +498,29 @@ public function crmDealsGet($filtersAttributesDealName = null, $filtersLinkedCom * * Get all deals * - * @param string $filtersAttributesDealName Filter by attributes. If you have filter for owner on your side please send it as `filters[attributes.deal_owner]`.\" (optional) - * @param string $filtersLinkedCompaniesIds Filter by linked companies ids (optional) - * @param string $filtersLinkedContactsIds Filter by linked companies ids (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * @param string $sortBy The field used to sort field names. (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\DealsList, HTTP status code, HTTP response headers (array of strings) + * @param string|null $filtersAttributesDealName Filter by attributes. If you have a filter for the owner on your end, please send it as filters[attributes.deal_owner] and utilize the account email for the filtering. (optional) + * @param string|null $filtersLinkedCompaniesIds Filter by linked companies ids (optional) + * @param string|null $filtersLinkedContactsIds Filter by linked companies ids (optional) + * @param int|null $offset Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsGet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\DealsList|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function crmDealsGetWithHttpInfo($filtersAttributesDealName = null, $filtersLinkedCompaniesIds = null, $filtersLinkedContactsIds = null, $offset = null, $limit = '50', $sort = null, $sortBy = null) + public function crmDealsGetWithHttpInfo( + ?string $filtersAttributesDealName = null, + ?string $filtersLinkedCompaniesIds = null, + ?string $filtersLinkedContactsIds = null, + ?int $offset = null, + ?int $limit = null, + ?string $sort = null, + string $contentType = self::contentTypes['crmDealsGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\DealsList'; - $request = $this->crmDealsGetRequest($filtersAttributesDealName, $filtersLinkedCompaniesIds, $filtersLinkedContactsIds, $offset, $limit, $sort, $sortBy); + $request = $this->crmDealsGetRequest($filtersAttributesDealName, $filtersLinkedCompaniesIds, $filtersLinkedContactsIds, $offset, $limit, $sort, $contentType); try { $options = $this->createHttpClientOption(); @@ -399,34 +529,111 @@ public function crmDealsGetWithHttpInfo($filtersAttributesDealName = null, $filt } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\DealsList', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\DealsList' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\DealsList', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\DealsList'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -441,7 +648,7 @@ public function crmDealsGetWithHttpInfo($filtersAttributesDealName = null, $filt case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\DealsList', + '\Brevo\Client\Models\DealsList', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -449,7 +656,7 @@ public function crmDealsGetWithHttpInfo($filtersAttributesDealName = null, $filt case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -464,20 +671,28 @@ public function crmDealsGetWithHttpInfo($filtersAttributesDealName = null, $filt * * Get all deals * - * @param string $filtersAttributesDealName Filter by attributes. If you have filter for owner on your side please send it as `filters[attributes.deal_owner]`.\" (optional) - * @param string $filtersLinkedCompaniesIds Filter by linked companies ids (optional) - * @param string $filtersLinkedContactsIds Filter by linked companies ids (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * @param string $sortBy The field used to sort field names. (optional) + * @param string|null $filtersAttributesDealName Filter by attributes. If you have a filter for the owner on your end, please send it as filters[attributes.deal_owner] and utilize the account email for the filtering. (optional) + * @param string|null $filtersLinkedCompaniesIds Filter by linked companies ids (optional) + * @param string|null $filtersLinkedContactsIds Filter by linked companies ids (optional) + * @param int|null $offset Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmDealsGetAsync($filtersAttributesDealName = null, $filtersLinkedCompaniesIds = null, $filtersLinkedContactsIds = null, $offset = null, $limit = '50', $sort = null, $sortBy = null) + public function crmDealsGetAsync( + ?string $filtersAttributesDealName = null, + ?string $filtersLinkedCompaniesIds = null, + ?string $filtersLinkedContactsIds = null, + ?int $offset = null, + ?int $limit = null, + ?string $sort = null, + string $contentType = self::contentTypes['crmDealsGet'][0] + ): PromiseInterface { - return $this->crmDealsGetAsyncWithHttpInfo($filtersAttributesDealName, $filtersLinkedCompaniesIds, $filtersLinkedContactsIds, $offset, $limit, $sort, $sortBy) + return $this->crmDealsGetAsyncWithHttpInfo($filtersAttributesDealName, $filtersLinkedCompaniesIds, $filtersLinkedContactsIds, $offset, $limit, $sort, $contentType) ->then( function ($response) { return $response[0]; @@ -490,31 +705,39 @@ function ($response) { * * Get all deals * - * @param string $filtersAttributesDealName Filter by attributes. If you have filter for owner on your side please send it as `filters[attributes.deal_owner]`.\" (optional) - * @param string $filtersLinkedCompaniesIds Filter by linked companies ids (optional) - * @param string $filtersLinkedContactsIds Filter by linked companies ids (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * @param string $sortBy The field used to sort field names. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @param string|null $filtersAttributesDealName Filter by attributes. If you have a filter for the owner on your end, please send it as filters[attributes.deal_owner] and utilize the account email for the filtering. (optional) + * @param string|null $filtersLinkedCompaniesIds Filter by linked companies ids (optional) + * @param string|null $filtersLinkedContactsIds Filter by linked companies ids (optional) + * @param int|null $offset Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsGet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmDealsGetAsyncWithHttpInfo($filtersAttributesDealName = null, $filtersLinkedCompaniesIds = null, $filtersLinkedContactsIds = null, $offset = null, $limit = '50', $sort = null, $sortBy = null) + public function crmDealsGetAsyncWithHttpInfo( + $filtersAttributesDealName = null, + $filtersLinkedCompaniesIds = null, + $filtersLinkedContactsIds = null, + $offset = null, + $limit = null, + $sort = null, + string $contentType = self::contentTypes['crmDealsGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\DealsList'; - $request = $this->crmDealsGetRequest($filtersAttributesDealName, $filtersLinkedCompaniesIds, $filtersLinkedContactsIds, $offset, $limit, $sort, $sortBy); + $returnType = '\Brevo\Client\Models\DealsList'; + $request = $this->crmDealsGetRequest($filtersAttributesDealName, $filtersLinkedCompaniesIds, $filtersLinkedContactsIds, $offset, $limit, $sort, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -537,7 +760,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -546,20 +769,35 @@ function ($exception) { /** * Create request for operation 'crmDealsGet' * - * @param string $filtersAttributesDealName Filter by attributes. If you have filter for owner on your side please send it as `filters[attributes.deal_owner]`.\" (optional) - * @param string $filtersLinkedCompaniesIds Filter by linked companies ids (optional) - * @param string $filtersLinkedContactsIds Filter by linked companies ids (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * @param string $sortBy The field used to sort field names. (optional) + * @param string|null $filtersAttributesDealName Filter by attributes. If you have a filter for the owner on your end, please send it as filters[attributes.deal_owner] and utilize the account email for the filtering. (optional) + * @param string|null $filtersLinkedCompaniesIds Filter by linked companies ids (optional) + * @param string|null $filtersLinkedContactsIds Filter by linked companies ids (optional) + * @param int|null $offset Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmDealsGetRequest($filtersAttributesDealName = null, $filtersLinkedCompaniesIds = null, $filtersLinkedContactsIds = null, $offset = null, $limit = '50', $sort = null, $sortBy = null) + public function crmDealsGetRequest( + $filtersAttributesDealName = null, + $filtersLinkedCompaniesIds = null, + $filtersLinkedContactsIds = null, + $offset = null, + $limit = null, + $sort = null, + string $contentType = self::contentTypes['crmDealsGet'][0] + ): Request { + + + + + + + $resourcePath = '/crm/deals'; $formParams = []; $queryParams = []; @@ -568,82 +806,91 @@ protected function crmDealsGetRequest($filtersAttributesDealName = null, $filter $multipart = false; // query params - if ($filtersAttributesDealName !== null) { - $queryParams['filters[attributes.deal_name]'] = ObjectSerializer::toQueryValue($filtersAttributesDealName); - } - // query params - if ($filtersLinkedCompaniesIds !== null) { - $queryParams['filters[linkedCompaniesIds]'] = ObjectSerializer::toQueryValue($filtersLinkedCompaniesIds); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filtersAttributesDealName, + 'filters[attributes.deal_name]', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($filtersLinkedContactsIds !== null) { - $queryParams['filters[linkedContactsIds]'] = ObjectSerializer::toQueryValue($filtersLinkedContactsIds); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filtersLinkedCompaniesIds, + 'filters[linkedCompaniesIds]', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filtersLinkedContactsIds, + 'filters[linkedContactsIds]', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sortBy !== null) { - $queryParams['sortBy'] = ObjectSerializer::toQueryValue($sortBy); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -669,10 +916,11 @@ protected function crmDealsGetRequest($filtersAttributesDealName = null, $filter $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -684,14 +932,18 @@ protected function crmDealsGetRequest($filtersAttributesDealName = null, $filter * Delete a deal * * @param string $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsIdDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function crmDealsIdDelete($id) + public function crmDealsIdDelete( + string $id, + string $contentType = self::contentTypes['crmDealsIdDelete'][0] + ): void { - $this->crmDealsIdDeleteWithHttpInfo($id); + $this->crmDealsIdDeleteWithHttpInfo($id, $contentType); } /** @@ -700,15 +952,18 @@ public function crmDealsIdDelete($id) * Delete a deal * * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsIdDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function crmDealsIdDeleteWithHttpInfo($id) + public function crmDealsIdDeleteWithHttpInfo( + string $id, + string $contentType = self::contentTypes['crmDealsIdDelete'][0] + ): array { - $returnType = ''; - $request = $this->crmDealsIdDeleteRequest($id); + $request = $this->crmDealsIdDeleteRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -717,26 +972,21 @@ public function crmDealsIdDeleteWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -745,7 +995,7 @@ public function crmDealsIdDeleteWithHttpInfo($id) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -753,7 +1003,7 @@ public function crmDealsIdDeleteWithHttpInfo($id) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -769,13 +1019,17 @@ public function crmDealsIdDeleteWithHttpInfo($id) * Delete a deal * * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmDealsIdDeleteAsync($id) + public function crmDealsIdDeleteAsync( + string $id, + string $contentType = self::contentTypes['crmDealsIdDelete'][0] + ): PromiseInterface { - return $this->crmDealsIdDeleteAsyncWithHttpInfo($id) + return $this->crmDealsIdDeleteAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -789,14 +1043,19 @@ function ($response) { * Delete a deal * * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmDealsIdDeleteAsyncWithHttpInfo($id) + public function crmDealsIdDeleteAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['crmDealsIdDelete'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->crmDealsIdDeleteRequest($id); + $request = $this->crmDealsIdDeleteRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -815,7 +1074,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -825,19 +1084,25 @@ function ($exception) { * Create request for operation 'crmDealsIdDelete' * * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmDealsIdDeleteRequest($id) + public function crmDealsIdDeleteRequest( + $id, + string $contentType = self::contentTypes['crmDealsIdDelete'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling crmDealsIdDelete' ); } + $resourcePath = '/crm/deals/{id}'; $formParams = []; $queryParams = []; @@ -846,6 +1111,7 @@ protected function crmDealsIdDeleteRequest($id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -855,53 +1121,35 @@ protected function crmDealsIdDeleteRequest($id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -927,10 +1175,11 @@ protected function crmDealsIdDeleteRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -942,14 +1191,18 @@ protected function crmDealsIdDeleteRequest($id) * Get a deal * * @param string $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsIdGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\Deal + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\Deal|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function crmDealsIdGet($id) + public function crmDealsIdGet( + string $id, + string $contentType = self::contentTypes['crmDealsIdGet'][0] + ): \Brevo\Client\Models\Deal { - list($response) = $this->crmDealsIdGetWithHttpInfo($id); + list($response) = $this->crmDealsIdGetWithHttpInfo($id, $contentType); return $response; } @@ -959,15 +1212,18 @@ public function crmDealsIdGet($id) * Get a deal * * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsIdGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\Deal, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\Deal|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function crmDealsIdGetWithHttpInfo($id) + public function crmDealsIdGetWithHttpInfo( + string $id, + string $contentType = self::contentTypes['crmDealsIdGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\Deal'; - $request = $this->crmDealsIdGetRequest($id); + $request = $this->crmDealsIdGetRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -976,34 +1232,138 @@ public function crmDealsIdGetWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\Deal', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\Deal' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\Deal', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\Deal'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1018,7 +1378,7 @@ public function crmDealsIdGetWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\Deal', + '\Brevo\Client\Models\Deal', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1026,7 +1386,7 @@ public function crmDealsIdGetWithHttpInfo($id) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1034,7 +1394,7 @@ public function crmDealsIdGetWithHttpInfo($id) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1050,13 +1410,17 @@ public function crmDealsIdGetWithHttpInfo($id) * Get a deal * * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmDealsIdGetAsync($id) + public function crmDealsIdGetAsync( + string $id, + string $contentType = self::contentTypes['crmDealsIdGet'][0] + ): PromiseInterface { - return $this->crmDealsIdGetAsyncWithHttpInfo($id) + return $this->crmDealsIdGetAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -1070,24 +1434,28 @@ function ($response) { * Get a deal * * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmDealsIdGetAsyncWithHttpInfo($id) + public function crmDealsIdGetAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['crmDealsIdGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\Deal'; - $request = $this->crmDealsIdGetRequest($id); + $returnType = '\Brevo\Client\Models\Deal'; + $request = $this->crmDealsIdGetRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1110,7 +1478,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1120,19 +1488,25 @@ function ($exception) { * Create request for operation 'crmDealsIdGet' * * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmDealsIdGetRequest($id) + public function crmDealsIdGetRequest( + $id, + string $contentType = self::contentTypes['crmDealsIdGet'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling crmDealsIdGet' ); } + $resourcePath = '/crm/deals/{id}'; $formParams = []; $queryParams = []; @@ -1141,6 +1515,7 @@ protected function crmDealsIdGetRequest($id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1150,53 +1525,35 @@ protected function crmDealsIdGetRequest($id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1222,10 +1579,11 @@ protected function crmDealsIdGetRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1237,15 +1595,20 @@ protected function crmDealsIdGetRequest($id) * Update a deal * * @param string $id id (required) - * @param \Brevo\Client\Model\Body6 $body Updated deal details. (required) + * @param \Brevo\Client\Models\CrmDealsIdPatchRequest $crmDealsIdPatchRequest Updated deal details. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsIdPatch'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function crmDealsIdPatch($id, $body) + public function crmDealsIdPatch( + string $id, + \Brevo\Client\Models\CrmDealsIdPatchRequest $crmDealsIdPatchRequest, + string $contentType = self::contentTypes['crmDealsIdPatch'][0] + ): void { - $this->crmDealsIdPatchWithHttpInfo($id, $body); + $this->crmDealsIdPatchWithHttpInfo($id, $crmDealsIdPatchRequest, $contentType); } /** @@ -1254,16 +1617,304 @@ public function crmDealsIdPatch($id, $body) * Update a deal * * @param string $id (required) - * @param \Brevo\Client\Model\Body6 $body Updated deal details. (required) + * @param \Brevo\Client\Models\CrmDealsIdPatchRequest $crmDealsIdPatchRequest Updated deal details. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsIdPatch'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function crmDealsIdPatchWithHttpInfo($id, $body) + public function crmDealsIdPatchWithHttpInfo( + string $id, + \Brevo\Client\Models\CrmDealsIdPatchRequest $crmDealsIdPatchRequest, + string $contentType = self::contentTypes['crmDealsIdPatch'][0] + ): array + { + $request = $this->crmDealsIdPatchRequest($id, $crmDealsIdPatchRequest, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation crmDealsIdPatchAsync + * + * Update a deal + * + * @param string $id (required) + * @param \Brevo\Client\Models\CrmDealsIdPatchRequest $crmDealsIdPatchRequest Updated deal details. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsIdPatch'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function crmDealsIdPatchAsync( + string $id, + \Brevo\Client\Models\CrmDealsIdPatchRequest $crmDealsIdPatchRequest, + string $contentType = self::contentTypes['crmDealsIdPatch'][0] + ): PromiseInterface + { + return $this->crmDealsIdPatchAsyncWithHttpInfo($id, $crmDealsIdPatchRequest, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation crmDealsIdPatchAsyncWithHttpInfo + * + * Update a deal + * + * @param string $id (required) + * @param \Brevo\Client\Models\CrmDealsIdPatchRequest $crmDealsIdPatchRequest Updated deal details. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsIdPatch'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function crmDealsIdPatchAsyncWithHttpInfo( + $id, + $crmDealsIdPatchRequest, + string $contentType = self::contentTypes['crmDealsIdPatch'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->crmDealsIdPatchRequest($id, $body); + $request = $this->crmDealsIdPatchRequest($id, $crmDealsIdPatchRequest, $contentType); + + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'crmDealsIdPatch' + * + * @param string $id (required) + * @param \Brevo\Client\Models\CrmDealsIdPatchRequest $crmDealsIdPatchRequest Updated deal details. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsIdPatch'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function crmDealsIdPatchRequest( + $id, + $crmDealsIdPatchRequest, + string $contentType = self::contentTypes['crmDealsIdPatch'][0] + ): Request + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $id when calling crmDealsIdPatch' + ); + } + + // verify the required parameter 'crmDealsIdPatchRequest' is set + if ($crmDealsIdPatchRequest === null || (is_array($crmDealsIdPatchRequest) && count($crmDealsIdPatchRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $crmDealsIdPatchRequest when calling crmDealsIdPatch' + ); + } + + + $resourcePath = '/crm/deals/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($crmDealsIdPatchRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($crmDealsIdPatchRequest)); + } else { + $httpBody = $crmDealsIdPatchRequest; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PATCH', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation crmDealsImportPost + * + * Import deals(creation and updation) + * + * @param \SplFileObject|null $file The CSV file to upload.The file should have the first row as the mapping attribute. Some default attribute names are (a) deal_id [brevo mongoID to update deals] (b) associated_contact (c) associated_company (f) any other attribute with internal name (optional) + * @param object|null $mapping The mapping options in JSON format. Here is an example of the JSON structure: ```json { \\\"link_entities\\\": true, // Determines whether to link related entities during the import process \\\"unlink_entities\\\": false, // Determines whether to unlink related entities during the import process \\\"update_existing_records\\\": true, // Determines whether to update based on company ID or treat every row as create \\\"unset_empty_attributes\\\": false // Determines whether to unset a specific attribute during update if the values input is blank } ``` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsImportPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CompaniesImportPost200Response|\Brevo\Client\Models\CompaniesImportPost400Response + */ + public function crmDealsImportPost( + ?\SplFileObject $file = null, + ?array $mapping = null, + string $contentType = self::contentTypes['crmDealsImportPost'][0] + ): \Brevo\Client\Models\CompaniesImportPost200Response + { + list($response) = $this->crmDealsImportPostWithHttpInfo($file, $mapping, $contentType); + return $response; + } + + /** + * Operation crmDealsImportPostWithHttpInfo + * + * Import deals(creation and updation) + * + * @param \SplFileObject|null $file The CSV file to upload.The file should have the first row as the mapping attribute. Some default attribute names are (a) deal_id [brevo mongoID to update deals] (b) associated_contact (c) associated_company (f) any other attribute with internal name (optional) + * @param object|null $mapping The mapping options in JSON format. Here is an example of the JSON structure: ```json { \\\"link_entities\\\": true, // Determines whether to link related entities during the import process \\\"unlink_entities\\\": false, // Determines whether to unlink related entities during the import process \\\"update_existing_records\\\": true, // Determines whether to update based on company ID or treat every row as create \\\"unset_empty_attributes\\\": false // Determines whether to unset a specific attribute during update if the values input is blank } ``` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsImportPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CompaniesImportPost200Response|\Brevo\Client\Models\CompaniesImportPost400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function crmDealsImportPostWithHttpInfo( + ?\SplFileObject $file = null, + ?array $mapping = null, + string $contentType = self::contentTypes['crmDealsImportPost'][0] + ): array + { + $request = $this->crmDealsImportPostRequest($file, $mapping, $contentType); try { $options = $this->createHttpClientOption(); @@ -1272,43 +1923,134 @@ public function crmDealsIdPatchWithHttpInfo($id, $body) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } - $statusCode = $response->getStatusCode(); + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\CompaniesImportPost200Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CompaniesImportPost200Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CompaniesImportPost200Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\CompaniesImportPost400Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CompaniesImportPost400Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CompaniesImportPost400Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - return [null, $statusCode, $response->getHeaders()]; + $returnType = '\Brevo\Client\Models\CompaniesImportPost200Response'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; } catch (ApiException $e) { switch ($e->getCode()) { - case 400: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\CompaniesImportPost200Response', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\CompaniesImportPost400Response', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1319,19 +2061,24 @@ public function crmDealsIdPatchWithHttpInfo($id, $body) } /** - * Operation crmDealsIdPatchAsync + * Operation crmDealsImportPostAsync * - * Update a deal + * Import deals(creation and updation) * - * @param string $id (required) - * @param \Brevo\Client\Model\Body6 $body Updated deal details. (required) + * @param \SplFileObject|null $file The CSV file to upload.The file should have the first row as the mapping attribute. Some default attribute names are (a) deal_id [brevo mongoID to update deals] (b) associated_contact (c) associated_company (f) any other attribute with internal name (optional) + * @param object|null $mapping The mapping options in JSON format. Here is an example of the JSON structure: ```json { \\\"link_entities\\\": true, // Determines whether to link related entities during the import process \\\"unlink_entities\\\": false, // Determines whether to unlink related entities during the import process \\\"update_existing_records\\\": true, // Determines whether to update based on company ID or treat every row as create \\\"unset_empty_attributes\\\": false // Determines whether to unset a specific attribute during update if the values input is blank } ``` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsImportPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmDealsIdPatchAsync($id, $body) + public function crmDealsImportPostAsync( + ?\SplFileObject $file = null, + ?array $mapping = null, + string $contentType = self::contentTypes['crmDealsImportPost'][0] + ): PromiseInterface { - return $this->crmDealsIdPatchAsyncWithHttpInfo($id, $body) + return $this->crmDealsImportPostAsyncWithHttpInfo($file, $mapping, $contentType) ->then( function ($response) { return $response[0]; @@ -1340,26 +2087,45 @@ function ($response) { } /** - * Operation crmDealsIdPatchAsyncWithHttpInfo + * Operation crmDealsImportPostAsyncWithHttpInfo * - * Update a deal + * Import deals(creation and updation) * - * @param string $id (required) - * @param \Brevo\Client\Model\Body6 $body Updated deal details. (required) + * @param \SplFileObject|null $file The CSV file to upload.The file should have the first row as the mapping attribute. Some default attribute names are (a) deal_id [brevo mongoID to update deals] (b) associated_contact (c) associated_company (f) any other attribute with internal name (optional) + * @param object|null $mapping The mapping options in JSON format. Here is an example of the JSON structure: ```json { \\\"link_entities\\\": true, // Determines whether to link related entities during the import process \\\"unlink_entities\\\": false, // Determines whether to unlink related entities during the import process \\\"update_existing_records\\\": true, // Determines whether to update based on company ID or treat every row as create \\\"unset_empty_attributes\\\": false // Determines whether to unset a specific attribute during update if the values input is blank } ``` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsImportPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmDealsIdPatchAsyncWithHttpInfo($id, $body) + public function crmDealsImportPostAsyncWithHttpInfo( + $file = null, + $mapping = null, + string $contentType = self::contentTypes['crmDealsImportPost'][0] + ): PromiseInterface { - $returnType = ''; - $request = $this->crmDealsIdPatchRequest($id, $body); + $returnType = '\Brevo\Client\Models\CompaniesImportPost200Response'; + $request = $this->crmDealsImportPostRequest($file, $mapping, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; }, function ($exception) { $response = $exception->getResponse(); @@ -1372,37 +2138,33 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); } /** - * Create request for operation 'crmDealsIdPatch' + * Create request for operation 'crmDealsImportPost' * - * @param string $id (required) - * @param \Brevo\Client\Model\Body6 $body Updated deal details. (required) + * @param \SplFileObject|null $file The CSV file to upload.The file should have the first row as the mapping attribute. Some default attribute names are (a) deal_id [brevo mongoID to update deals] (b) associated_contact (c) associated_company (f) any other attribute with internal name (optional) + * @param object|null $mapping The mapping options in JSON format. Here is an example of the JSON structure: ```json { \\\"link_entities\\\": true, // Determines whether to link related entities during the import process \\\"unlink_entities\\\": false, // Determines whether to unlink related entities during the import process \\\"update_existing_records\\\": true, // Determines whether to update based on company ID or treat every row as create \\\"unset_empty_attributes\\\": false // Determines whether to unset a specific attribute during update if the values input is blank } ``` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsImportPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmDealsIdPatchRequest($id, $body) + public function crmDealsImportPostRequest( + $file = null, + $mapping = null, + string $contentType = self::contentTypes['crmDealsImportPost'][0] + ): Request { - // verify the required parameter 'id' is set - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling crmDealsIdPatch' - ); - } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling crmDealsIdPatch' - ); - } - $resourcePath = '/crm/deals/{id}'; + + + + $resourcePath = '/crm/deals/import'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1410,65 +2172,55 @@ protected function crmDealsIdPatchRequest($id, $body) $multipart = false; - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); + // form params + if ($file !== null) { + $multipart = true; + $formParams['file'] = []; + $paramFiles = is_array($file) ? $file : [$file]; + foreach ($paramFiles as $paramFile) { + $formParams['file'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface + ? $paramFile + : \GuzzleHttp\Psr7\Utils::tryFopen( + ObjectSerializer::toFormValue($paramFile), + 'rb' + ); + } + } + // form params + if ($mapping !== null) { + $formParams['mapping'] = ObjectSerializer::toFormValue($mapping); } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1494,10 +2246,11 @@ protected function crmDealsIdPatchRequest($id, $body) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'PATCH', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1509,15 +2262,20 @@ protected function crmDealsIdPatchRequest($id, $body) * Link and Unlink a deal with contacts and companies * * @param string $id id (required) - * @param \Brevo\Client\Model\Body7 $body Linked / Unlinked contacts and companies ids. (required) + * @param \Brevo\Client\Models\CrmDealsLinkUnlinkIdPatchRequest $crmDealsLinkUnlinkIdPatchRequest Linked / Unlinked contacts and companies ids. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsLinkUnlinkIdPatch'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function crmDealsLinkUnlinkIdPatch($id, $body) + public function crmDealsLinkUnlinkIdPatch( + string $id, + \Brevo\Client\Models\CrmDealsLinkUnlinkIdPatchRequest $crmDealsLinkUnlinkIdPatchRequest, + string $contentType = self::contentTypes['crmDealsLinkUnlinkIdPatch'][0] + ): void { - $this->crmDealsLinkUnlinkIdPatchWithHttpInfo($id, $body); + $this->crmDealsLinkUnlinkIdPatchWithHttpInfo($id, $crmDealsLinkUnlinkIdPatchRequest, $contentType); } /** @@ -1526,16 +2284,20 @@ public function crmDealsLinkUnlinkIdPatch($id, $body) * Link and Unlink a deal with contacts and companies * * @param string $id (required) - * @param \Brevo\Client\Model\Body7 $body Linked / Unlinked contacts and companies ids. (required) + * @param \Brevo\Client\Models\CrmDealsLinkUnlinkIdPatchRequest $crmDealsLinkUnlinkIdPatchRequest Linked / Unlinked contacts and companies ids. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsLinkUnlinkIdPatch'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function crmDealsLinkUnlinkIdPatchWithHttpInfo($id, $body) + public function crmDealsLinkUnlinkIdPatchWithHttpInfo( + string $id, + \Brevo\Client\Models\CrmDealsLinkUnlinkIdPatchRequest $crmDealsLinkUnlinkIdPatchRequest, + string $contentType = self::contentTypes['crmDealsLinkUnlinkIdPatch'][0] + ): array { - $returnType = ''; - $request = $this->crmDealsLinkUnlinkIdPatchRequest($id, $body); + $request = $this->crmDealsLinkUnlinkIdPatchRequest($id, $crmDealsLinkUnlinkIdPatchRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -1544,26 +2306,21 @@ public function crmDealsLinkUnlinkIdPatchWithHttpInfo($id, $body) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -1572,7 +2329,7 @@ public function crmDealsLinkUnlinkIdPatchWithHttpInfo($id, $body) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1588,14 +2345,19 @@ public function crmDealsLinkUnlinkIdPatchWithHttpInfo($id, $body) * Link and Unlink a deal with contacts and companies * * @param string $id (required) - * @param \Brevo\Client\Model\Body7 $body Linked / Unlinked contacts and companies ids. (required) + * @param \Brevo\Client\Models\CrmDealsLinkUnlinkIdPatchRequest $crmDealsLinkUnlinkIdPatchRequest Linked / Unlinked contacts and companies ids. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsLinkUnlinkIdPatch'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmDealsLinkUnlinkIdPatchAsync($id, $body) + public function crmDealsLinkUnlinkIdPatchAsync( + string $id, + \Brevo\Client\Models\CrmDealsLinkUnlinkIdPatchRequest $crmDealsLinkUnlinkIdPatchRequest, + string $contentType = self::contentTypes['crmDealsLinkUnlinkIdPatch'][0] + ): PromiseInterface { - return $this->crmDealsLinkUnlinkIdPatchAsyncWithHttpInfo($id, $body) + return $this->crmDealsLinkUnlinkIdPatchAsyncWithHttpInfo($id, $crmDealsLinkUnlinkIdPatchRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -1609,15 +2371,21 @@ function ($response) { * Link and Unlink a deal with contacts and companies * * @param string $id (required) - * @param \Brevo\Client\Model\Body7 $body Linked / Unlinked contacts and companies ids. (required) + * @param \Brevo\Client\Models\CrmDealsLinkUnlinkIdPatchRequest $crmDealsLinkUnlinkIdPatchRequest Linked / Unlinked contacts and companies ids. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsLinkUnlinkIdPatch'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmDealsLinkUnlinkIdPatchAsyncWithHttpInfo($id, $body) + public function crmDealsLinkUnlinkIdPatchAsyncWithHttpInfo( + $id, + $crmDealsLinkUnlinkIdPatchRequest, + string $contentType = self::contentTypes['crmDealsLinkUnlinkIdPatch'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->crmDealsLinkUnlinkIdPatchRequest($id, $body); + $request = $this->crmDealsLinkUnlinkIdPatchRequest($id, $crmDealsLinkUnlinkIdPatchRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1636,7 +2404,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1646,26 +2414,34 @@ function ($exception) { * Create request for operation 'crmDealsLinkUnlinkIdPatch' * * @param string $id (required) - * @param \Brevo\Client\Model\Body7 $body Linked / Unlinked contacts and companies ids. (required) + * @param \Brevo\Client\Models\CrmDealsLinkUnlinkIdPatchRequest $crmDealsLinkUnlinkIdPatchRequest Linked / Unlinked contacts and companies ids. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsLinkUnlinkIdPatch'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmDealsLinkUnlinkIdPatchRequest($id, $body) + public function crmDealsLinkUnlinkIdPatchRequest( + $id, + $crmDealsLinkUnlinkIdPatchRequest, + string $contentType = self::contentTypes['crmDealsLinkUnlinkIdPatch'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling crmDealsLinkUnlinkIdPatch' ); } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling crmDealsLinkUnlinkIdPatch' + + // verify the required parameter 'crmDealsLinkUnlinkIdPatchRequest' is set + if ($crmDealsLinkUnlinkIdPatchRequest === null || (is_array($crmDealsLinkUnlinkIdPatchRequest) && count($crmDealsLinkUnlinkIdPatchRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $crmDealsLinkUnlinkIdPatchRequest when calling crmDealsLinkUnlinkIdPatch' ); } + $resourcePath = '/crm/deals/link-unlink/{id}'; $formParams = []; $queryParams = []; @@ -1674,6 +2450,7 @@ protected function crmDealsLinkUnlinkIdPatchRequest($id, $body) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1683,56 +2460,42 @@ protected function crmDealsLinkUnlinkIdPatchRequest($id, $body) ); } - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($crmDealsLinkUnlinkIdPatchRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($crmDealsLinkUnlinkIdPatchRequest)); + } else { + $httpBody = $crmDealsLinkUnlinkIdPatchRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1758,10 +2521,11 @@ protected function crmDealsLinkUnlinkIdPatchRequest($id, $body) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PATCH', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1772,15 +2536,19 @@ protected function crmDealsLinkUnlinkIdPatchRequest($id, $body) * * Create a deal * - * @param \Brevo\Client\Model\Body5 $body Deal create data. (required) + * @param \Brevo\Client\Models\CrmDealsPostRequest $crmDealsPostRequest Deal create data. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsPost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\InlineResponse2011 + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CrmDealsPost201Response */ - public function crmDealsPost($body) + public function crmDealsPost( + \Brevo\Client\Models\CrmDealsPostRequest $crmDealsPostRequest, + string $contentType = self::contentTypes['crmDealsPost'][0] + ): \Brevo\Client\Models\CrmDealsPost201Response { - list($response) = $this->crmDealsPostWithHttpInfo($body); + list($response) = $this->crmDealsPostWithHttpInfo($crmDealsPostRequest, $contentType); return $response; } @@ -1789,16 +2557,19 @@ public function crmDealsPost($body) * * Create a deal * - * @param \Brevo\Client\Model\Body5 $body Deal create data. (required) + * @param \Brevo\Client\Models\CrmDealsPostRequest $crmDealsPostRequest Deal create data. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsPost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\InlineResponse2011, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CrmDealsPost201Response, HTTP status code, HTTP response headers (array of strings) */ - public function crmDealsPostWithHttpInfo($body) + public function crmDealsPostWithHttpInfo( + \Brevo\Client\Models\CrmDealsPostRequest $crmDealsPostRequest, + string $contentType = self::contentTypes['crmDealsPost'][0] + ): array { - $returnType = '\Brevo\Client\Model\InlineResponse2011'; - $request = $this->crmDealsPostRequest($body); + $request = $this->crmDealsPostRequest($crmDealsPostRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -1807,34 +2578,84 @@ public function crmDealsPostWithHttpInfo($body) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CrmDealsPost201Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CrmDealsPost201Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CrmDealsPost201Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CrmDealsPost201Response'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1849,7 +2670,7 @@ public function crmDealsPostWithHttpInfo($body) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\InlineResponse2011', + '\Brevo\Client\Models\CrmDealsPost201Response', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1864,14 +2685,18 @@ public function crmDealsPostWithHttpInfo($body) * * Create a deal * - * @param \Brevo\Client\Model\Body5 $body Deal create data. (required) + * @param \Brevo\Client\Models\CrmDealsPostRequest $crmDealsPostRequest Deal create data. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmDealsPostAsync($body) + public function crmDealsPostAsync( + \Brevo\Client\Models\CrmDealsPostRequest $crmDealsPostRequest, + string $contentType = self::contentTypes['crmDealsPost'][0] + ): PromiseInterface { - return $this->crmDealsPostAsyncWithHttpInfo($body) + return $this->crmDealsPostAsyncWithHttpInfo($crmDealsPostRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -1884,25 +2709,29 @@ function ($response) { * * Create a deal * - * @param \Brevo\Client\Model\Body5 $body Deal create data. (required) + * @param \Brevo\Client\Models\CrmDealsPostRequest $crmDealsPostRequest Deal create data. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmDealsPostAsyncWithHttpInfo($body) + public function crmDealsPostAsyncWithHttpInfo( + $crmDealsPostRequest, + string $contentType = self::contentTypes['crmDealsPost'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\InlineResponse2011'; - $request = $this->crmDealsPostRequest($body); + $returnType = '\Brevo\Client\Models\CrmDealsPost201Response'; + $request = $this->crmDealsPostRequest($crmDealsPostRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1925,7 +2754,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1934,20 +2763,26 @@ function ($exception) { /** * Create request for operation 'crmDealsPost' * - * @param \Brevo\Client\Model\Body5 $body Deal create data. (required) + * @param \Brevo\Client\Models\CrmDealsPostRequest $crmDealsPostRequest Deal create data. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmDealsPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmDealsPostRequest($body) + public function crmDealsPostRequest( + $crmDealsPostRequest, + string $contentType = self::contentTypes['crmDealsPost'][0] + ): Request { - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling crmDealsPost' + + // verify the required parameter 'crmDealsPostRequest' is set + if ($crmDealsPostRequest === null || (is_array($crmDealsPostRequest) && count($crmDealsPostRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $crmDealsPostRequest when calling crmDealsPost' ); } + $resourcePath = '/crm/deals'; $formParams = []; $queryParams = []; @@ -1957,56 +2792,43 @@ protected function crmDealsPostRequest($body) - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($crmDealsPostRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($crmDealsPostRequest)); + } else { + $httpBody = $crmDealsPostRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2032,10 +2854,11 @@ protected function crmDealsPostRequest($body) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2046,14 +2869,17 @@ protected function crmDealsPostRequest($body) * * Get all pipelines * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmPipelineDetailsAllGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\Pipelines + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\Pipeline[]|\Brevo\Client\Models\ErrorModel */ - public function crmPipelineDetailsAllGet() + public function crmPipelineDetailsAllGet( + string $contentType = self::contentTypes['crmPipelineDetailsAllGet'][0] + ): array { - list($response) = $this->crmPipelineDetailsAllGetWithHttpInfo(); + list($response) = $this->crmPipelineDetailsAllGetWithHttpInfo($contentType); return $response; } @@ -2062,15 +2888,17 @@ public function crmPipelineDetailsAllGet() * * Get all pipelines * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmPipelineDetailsAllGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\Pipelines, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\Pipeline[]|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function crmPipelineDetailsAllGetWithHttpInfo() + public function crmPipelineDetailsAllGetWithHttpInfo( + string $contentType = self::contentTypes['crmPipelineDetailsAllGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\Pipelines'; - $request = $this->crmPipelineDetailsAllGetRequest(); + $request = $this->crmPipelineDetailsAllGetRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -2079,34 +2907,111 @@ public function crmPipelineDetailsAllGetWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\Pipeline[]', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\Pipeline[]' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\Pipeline[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\Pipeline[]'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2121,7 +3026,7 @@ public function crmPipelineDetailsAllGetWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\Pipelines', + '\Brevo\Client\Models\Pipeline[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2129,7 +3034,7 @@ public function crmPipelineDetailsAllGetWithHttpInfo() case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2144,13 +3049,16 @@ public function crmPipelineDetailsAllGetWithHttpInfo() * * Get all pipelines * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmPipelineDetailsAllGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmPipelineDetailsAllGetAsync() + public function crmPipelineDetailsAllGetAsync( + string $contentType = self::contentTypes['crmPipelineDetailsAllGet'][0] + ): PromiseInterface { - return $this->crmPipelineDetailsAllGetAsyncWithHttpInfo() + return $this->crmPipelineDetailsAllGetAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -2163,24 +3071,27 @@ function ($response) { * * Get all pipelines * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmPipelineDetailsAllGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmPipelineDetailsAllGetAsyncWithHttpInfo() + public function crmPipelineDetailsAllGetAsyncWithHttpInfo( + string $contentType = self::contentTypes['crmPipelineDetailsAllGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\Pipelines'; - $request = $this->crmPipelineDetailsAllGetRequest(); + $returnType = '\Brevo\Client\Models\Pipeline[]'; + $request = $this->crmPipelineDetailsAllGetRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2203,7 +3114,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2212,13 +3123,17 @@ function ($exception) { /** * Create request for operation 'crmPipelineDetailsAllGet' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmPipelineDetailsAllGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmPipelineDetailsAllGetRequest() + public function crmPipelineDetailsAllGetRequest( + string $contentType = self::contentTypes['crmPipelineDetailsAllGet'][0] + ): Request { + $resourcePath = '/crm/pipeline/details/all'; $formParams = []; $queryParams = []; @@ -2228,53 +3143,36 @@ protected function crmPipelineDetailsAllGetRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2300,10 +3198,11 @@ protected function crmPipelineDetailsAllGetRequest() $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2314,14 +3213,18 @@ protected function crmPipelineDetailsAllGetRequest() * * Get pipeline stages * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmPipelineDetailsGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\Pipeline + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\Pipeline + * @deprecated */ - public function crmPipelineDetailsGet() + public function crmPipelineDetailsGet( + string $contentType = self::contentTypes['crmPipelineDetailsGet'][0] + ): \Brevo\Client\Models\Pipeline { - list($response) = $this->crmPipelineDetailsGetWithHttpInfo(); + list($response) = $this->crmPipelineDetailsGetWithHttpInfo($contentType); return $response; } @@ -2330,15 +3233,18 @@ public function crmPipelineDetailsGet() * * Get pipeline stages * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmPipelineDetailsGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\Pipeline, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\Pipeline, HTTP status code, HTTP response headers (array of strings) + * @deprecated */ - public function crmPipelineDetailsGetWithHttpInfo() + public function crmPipelineDetailsGetWithHttpInfo( + string $contentType = self::contentTypes['crmPipelineDetailsGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\Pipeline'; - $request = $this->crmPipelineDetailsGetRequest(); + $request = $this->crmPipelineDetailsGetRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -2347,34 +3253,84 @@ public function crmPipelineDetailsGetWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\Pipeline', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\Pipeline' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\Pipeline', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\Pipeline'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2389,7 +3345,7 @@ public function crmPipelineDetailsGetWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\Pipeline', + '\Brevo\Client\Models\Pipeline', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2404,13 +3360,17 @@ public function crmPipelineDetailsGetWithHttpInfo() * * Get pipeline stages * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmPipelineDetailsGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface + * @deprecated */ - public function crmPipelineDetailsGetAsync() + public function crmPipelineDetailsGetAsync( + string $contentType = self::contentTypes['crmPipelineDetailsGet'][0] + ): PromiseInterface { - return $this->crmPipelineDetailsGetAsyncWithHttpInfo() + return $this->crmPipelineDetailsGetAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -2423,24 +3383,28 @@ function ($response) { * * Get pipeline stages * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmPipelineDetailsGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + * @deprecated */ - public function crmPipelineDetailsGetAsyncWithHttpInfo() + public function crmPipelineDetailsGetAsyncWithHttpInfo( + string $contentType = self::contentTypes['crmPipelineDetailsGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\Pipeline'; - $request = $this->crmPipelineDetailsGetRequest(); + $returnType = '\Brevo\Client\Models\Pipeline'; + $request = $this->crmPipelineDetailsGetRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2463,7 +3427,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2472,13 +3436,18 @@ function ($exception) { /** * Create request for operation 'crmPipelineDetailsGet' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmPipelineDetailsGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request + * @deprecated */ - protected function crmPipelineDetailsGetRequest() + public function crmPipelineDetailsGetRequest( + string $contentType = self::contentTypes['crmPipelineDetailsGet'][0] + ): Request { + $resourcePath = '/crm/pipeline/details'; $formParams = []; $queryParams = []; @@ -2488,53 +3457,36 @@ protected function crmPipelineDetailsGetRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2560,10 +3512,11 @@ protected function crmPipelineDetailsGetRequest() $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2575,14 +3528,18 @@ protected function crmPipelineDetailsGetRequest() * Get a pipeline * * @param string $pipelineID pipelineID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmPipelineDetailsPipelineIDGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\Pipelines + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\Pipeline[]|\Brevo\Client\Models\ErrorModel */ - public function crmPipelineDetailsPipelineIDGet($pipelineID) + public function crmPipelineDetailsPipelineIDGet( + string $pipelineID, + string $contentType = self::contentTypes['crmPipelineDetailsPipelineIDGet'][0] + ): array { - list($response) = $this->crmPipelineDetailsPipelineIDGetWithHttpInfo($pipelineID); + list($response) = $this->crmPipelineDetailsPipelineIDGetWithHttpInfo($pipelineID, $contentType); return $response; } @@ -2592,15 +3549,18 @@ public function crmPipelineDetailsPipelineIDGet($pipelineID) * Get a pipeline * * @param string $pipelineID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmPipelineDetailsPipelineIDGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\Pipelines, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\Pipeline[]|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function crmPipelineDetailsPipelineIDGetWithHttpInfo($pipelineID) + public function crmPipelineDetailsPipelineIDGetWithHttpInfo( + string $pipelineID, + string $contentType = self::contentTypes['crmPipelineDetailsPipelineIDGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\Pipelines'; - $request = $this->crmPipelineDetailsPipelineIDGetRequest($pipelineID); + $request = $this->crmPipelineDetailsPipelineIDGetRequest($pipelineID, $contentType); try { $options = $this->createHttpClientOption(); @@ -2609,34 +3569,111 @@ public function crmPipelineDetailsPipelineIDGetWithHttpInfo($pipelineID) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\Pipeline[]', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\Pipeline[]' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\Pipeline[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\Pipeline[]'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2651,7 +3688,7 @@ public function crmPipelineDetailsPipelineIDGetWithHttpInfo($pipelineID) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\Pipelines', + '\Brevo\Client\Models\Pipeline[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2659,7 +3696,7 @@ public function crmPipelineDetailsPipelineIDGetWithHttpInfo($pipelineID) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2675,13 +3712,17 @@ public function crmPipelineDetailsPipelineIDGetWithHttpInfo($pipelineID) * Get a pipeline * * @param string $pipelineID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmPipelineDetailsPipelineIDGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmPipelineDetailsPipelineIDGetAsync($pipelineID) + public function crmPipelineDetailsPipelineIDGetAsync( + string $pipelineID, + string $contentType = self::contentTypes['crmPipelineDetailsPipelineIDGet'][0] + ): PromiseInterface { - return $this->crmPipelineDetailsPipelineIDGetAsyncWithHttpInfo($pipelineID) + return $this->crmPipelineDetailsPipelineIDGetAsyncWithHttpInfo($pipelineID, $contentType) ->then( function ($response) { return $response[0]; @@ -2695,24 +3736,28 @@ function ($response) { * Get a pipeline * * @param string $pipelineID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmPipelineDetailsPipelineIDGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmPipelineDetailsPipelineIDGetAsyncWithHttpInfo($pipelineID) + public function crmPipelineDetailsPipelineIDGetAsyncWithHttpInfo( + $pipelineID, + string $contentType = self::contentTypes['crmPipelineDetailsPipelineIDGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\Pipelines'; - $request = $this->crmPipelineDetailsPipelineIDGetRequest($pipelineID); + $returnType = '\Brevo\Client\Models\Pipeline[]'; + $request = $this->crmPipelineDetailsPipelineIDGetRequest($pipelineID, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2735,7 +3780,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2745,19 +3790,25 @@ function ($exception) { * Create request for operation 'crmPipelineDetailsPipelineIDGet' * * @param string $pipelineID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmPipelineDetailsPipelineIDGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmPipelineDetailsPipelineIDGetRequest($pipelineID) + public function crmPipelineDetailsPipelineIDGetRequest( + $pipelineID, + string $contentType = self::contentTypes['crmPipelineDetailsPipelineIDGet'][0] + ): Request { + // verify the required parameter 'pipelineID' is set if ($pipelineID === null || (is_array($pipelineID) && count($pipelineID) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $pipelineID when calling crmPipelineDetailsPipelineIDGet' ); } + $resourcePath = '/crm/pipeline/details/{pipelineID}'; $formParams = []; $queryParams = []; @@ -2766,6 +3817,7 @@ protected function crmPipelineDetailsPipelineIDGetRequest($pipelineID) $multipart = false; + // path params if ($pipelineID !== null) { $resourcePath = str_replace( @@ -2775,53 +3827,35 @@ protected function crmPipelineDetailsPipelineIDGetRequest($pipelineID) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2847,10 +3881,11 @@ protected function crmPipelineDetailsPipelineIDGetRequest($pipelineID) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2862,7 +3897,7 @@ protected function crmPipelineDetailsPipelineIDGetRequest($pipelineID) * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/DomainsApi.php b/lib/Api/DomainsApi.php index c4ec0d6..8484ea7 100644 --- a/lib/Api/DomainsApi.php +++ b/lib/Api/DomainsApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'createDomain' => [ + 'application/json', + ], + 'deleteDomain' => [ + 'application/json', + ], + 'getDomainConfiguration' => [ + 'application/json', + ], + 'getDomains' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -93,14 +141,18 @@ public function getConfig() * Authenticate a domain * * @param string $domainName Domain name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['authenticateDomain'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\AuthenticateDomainModel + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\AuthenticateDomainModel|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function authenticateDomain($domainName) + public function authenticateDomain( + string $domainName, + string $contentType = self::contentTypes['authenticateDomain'][0] + ): \Brevo\Client\Models\AuthenticateDomainModel { - list($response) = $this->authenticateDomainWithHttpInfo($domainName); + list($response) = $this->authenticateDomainWithHttpInfo($domainName, $contentType); return $response; } @@ -110,15 +162,18 @@ public function authenticateDomain($domainName) * Authenticate a domain * * @param string $domainName Domain name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['authenticateDomain'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\AuthenticateDomainModel, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\AuthenticateDomainModel|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function authenticateDomainWithHttpInfo($domainName) + public function authenticateDomainWithHttpInfo( + string $domainName, + string $contentType = self::contentTypes['authenticateDomain'][0] + ): array { - $returnType = '\Brevo\Client\Model\AuthenticateDomainModel'; - $request = $this->authenticateDomainRequest($domainName); + $request = $this->authenticateDomainRequest($domainName, $contentType); try { $options = $this->createHttpClientOption(); @@ -127,34 +182,138 @@ public function authenticateDomainWithHttpInfo($domainName) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\AuthenticateDomainModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\AuthenticateDomainModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\AuthenticateDomainModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\AuthenticateDomainModel'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -169,7 +328,7 @@ public function authenticateDomainWithHttpInfo($domainName) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\AuthenticateDomainModel', + '\Brevo\Client\Models\AuthenticateDomainModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -177,7 +336,7 @@ public function authenticateDomainWithHttpInfo($domainName) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -185,7 +344,7 @@ public function authenticateDomainWithHttpInfo($domainName) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -201,13 +360,17 @@ public function authenticateDomainWithHttpInfo($domainName) * Authenticate a domain * * @param string $domainName Domain name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['authenticateDomain'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function authenticateDomainAsync($domainName) + public function authenticateDomainAsync( + string $domainName, + string $contentType = self::contentTypes['authenticateDomain'][0] + ): PromiseInterface { - return $this->authenticateDomainAsyncWithHttpInfo($domainName) + return $this->authenticateDomainAsyncWithHttpInfo($domainName, $contentType) ->then( function ($response) { return $response[0]; @@ -221,24 +384,28 @@ function ($response) { * Authenticate a domain * * @param string $domainName Domain name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['authenticateDomain'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function authenticateDomainAsyncWithHttpInfo($domainName) + public function authenticateDomainAsyncWithHttpInfo( + $domainName, + string $contentType = self::contentTypes['authenticateDomain'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\AuthenticateDomainModel'; - $request = $this->authenticateDomainRequest($domainName); + $returnType = '\Brevo\Client\Models\AuthenticateDomainModel'; + $request = $this->authenticateDomainRequest($domainName, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -261,7 +428,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -271,19 +438,25 @@ function ($exception) { * Create request for operation 'authenticateDomain' * * @param string $domainName Domain name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['authenticateDomain'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function authenticateDomainRequest($domainName) + public function authenticateDomainRequest( + $domainName, + string $contentType = self::contentTypes['authenticateDomain'][0] + ): Request { + // verify the required parameter 'domainName' is set if ($domainName === null || (is_array($domainName) && count($domainName) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $domainName when calling authenticateDomain' ); } + $resourcePath = '/senders/domains/{domainName}/authenticate'; $formParams = []; $queryParams = []; @@ -292,6 +465,7 @@ protected function authenticateDomainRequest($domainName) $multipart = false; + // path params if ($domainName !== null) { $resourcePath = str_replace( @@ -301,53 +475,35 @@ protected function authenticateDomainRequest($domainName) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -373,10 +529,11 @@ protected function authenticateDomainRequest($domainName) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -387,15 +544,19 @@ protected function authenticateDomainRequest($domainName) * * Create a new domain * - * @param \Brevo\Client\Model\CreateDomain $domainName domain's name (optional) + * @param \Brevo\Client\Models\CreateDomain|null $domain domain's name (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDomain'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreateDomainModel + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateDomainModel|\Brevo\Client\Models\ErrorModel */ - public function createDomain($domainName = null) + public function createDomain( + ?\Brevo\Client\Models\CreateDomain $domain = null, + string $contentType = self::contentTypes['createDomain'][0] + ): \Brevo\Client\Models\CreateDomainModel { - list($response) = $this->createDomainWithHttpInfo($domainName); + list($response) = $this->createDomainWithHttpInfo($domain, $contentType); return $response; } @@ -404,16 +565,19 @@ public function createDomain($domainName = null) * * Create a new domain * - * @param \Brevo\Client\Model\CreateDomain $domainName domain's name (optional) + * @param \Brevo\Client\Models\CreateDomain|null $domain domain's name (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDomain'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreateDomainModel, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateDomainModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function createDomainWithHttpInfo($domainName = null) + public function createDomainWithHttpInfo( + ?\Brevo\Client\Models\CreateDomain $domain = null, + string $contentType = self::contentTypes['createDomain'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreateDomainModel'; - $request = $this->createDomainRequest($domainName); + $request = $this->createDomainRequest($domain, $contentType); try { $options = $this->createHttpClientOption(); @@ -422,34 +586,111 @@ public function createDomainWithHttpInfo($domainName = null) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\CreateDomainModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateDomainModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateDomainModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreateDomainModel'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -464,7 +705,7 @@ public function createDomainWithHttpInfo($domainName = null) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreateDomainModel', + '\Brevo\Client\Models\CreateDomainModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -472,7 +713,7 @@ public function createDomainWithHttpInfo($domainName = null) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -487,14 +728,18 @@ public function createDomainWithHttpInfo($domainName = null) * * Create a new domain * - * @param \Brevo\Client\Model\CreateDomain $domainName domain's name (optional) + * @param \Brevo\Client\Models\CreateDomain|null $domain domain's name (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDomain'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createDomainAsync($domainName = null) + public function createDomainAsync( + ?\Brevo\Client\Models\CreateDomain $domain = null, + string $contentType = self::contentTypes['createDomain'][0] + ): PromiseInterface { - return $this->createDomainAsyncWithHttpInfo($domainName) + return $this->createDomainAsyncWithHttpInfo($domain, $contentType) ->then( function ($response) { return $response[0]; @@ -507,25 +752,29 @@ function ($response) { * * Create a new domain * - * @param \Brevo\Client\Model\CreateDomain $domainName domain's name (optional) + * @param \Brevo\Client\Models\CreateDomain|null $domain domain's name (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDomain'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createDomainAsyncWithHttpInfo($domainName = null) + public function createDomainAsyncWithHttpInfo( + $domain = null, + string $contentType = self::contentTypes['createDomain'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreateDomainModel'; - $request = $this->createDomainRequest($domainName); + $returnType = '\Brevo\Client\Models\CreateDomainModel'; + $request = $this->createDomainRequest($domain, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -548,7 +797,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -557,14 +806,20 @@ function ($exception) { /** * Create request for operation 'createDomain' * - * @param \Brevo\Client\Model\CreateDomain $domainName domain's name (optional) + * @param \Brevo\Client\Models\CreateDomain|null $domain domain's name (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDomain'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createDomainRequest($domainName = null) + public function createDomainRequest( + $domain = null, + string $contentType = self::contentTypes['createDomain'][0] + ): Request { + + $resourcePath = '/senders/domains'; $formParams = []; $queryParams = []; @@ -574,56 +829,43 @@ protected function createDomainRequest($domainName = null) - // body params - $_tempBody = null; - if (isset($domainName)) { - $_tempBody = $domainName; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($domain)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($domain)); + } else { + $httpBody = $domain; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -649,10 +891,11 @@ protected function createDomainRequest($domainName = null) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -664,14 +907,18 @@ protected function createDomainRequest($domainName = null) * Delete a domain * * @param string $domainName Domain name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteDomain'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function deleteDomain($domainName) + public function deleteDomain( + string $domainName, + string $contentType = self::contentTypes['deleteDomain'][0] + ): void { - $this->deleteDomainWithHttpInfo($domainName); + $this->deleteDomainWithHttpInfo($domainName, $contentType); } /** @@ -680,15 +927,18 @@ public function deleteDomain($domainName) * Delete a domain * * @param string $domainName Domain name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteDomain'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteDomainWithHttpInfo($domainName) + public function deleteDomainWithHttpInfo( + string $domainName, + string $contentType = self::contentTypes['deleteDomain'][0] + ): array { - $returnType = ''; - $request = $this->deleteDomainRequest($domainName); + $request = $this->deleteDomainRequest($domainName, $contentType); try { $options = $this->createHttpClientOption(); @@ -697,26 +947,21 @@ public function deleteDomainWithHttpInfo($domainName) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -725,7 +970,7 @@ public function deleteDomainWithHttpInfo($domainName) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -733,7 +978,7 @@ public function deleteDomainWithHttpInfo($domainName) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -749,13 +994,17 @@ public function deleteDomainWithHttpInfo($domainName) * Delete a domain * * @param string $domainName Domain name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteDomain'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteDomainAsync($domainName) + public function deleteDomainAsync( + string $domainName, + string $contentType = self::contentTypes['deleteDomain'][0] + ): PromiseInterface { - return $this->deleteDomainAsyncWithHttpInfo($domainName) + return $this->deleteDomainAsyncWithHttpInfo($domainName, $contentType) ->then( function ($response) { return $response[0]; @@ -769,14 +1018,19 @@ function ($response) { * Delete a domain * * @param string $domainName Domain name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteDomain'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteDomainAsyncWithHttpInfo($domainName) + public function deleteDomainAsyncWithHttpInfo( + $domainName, + string $contentType = self::contentTypes['deleteDomain'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->deleteDomainRequest($domainName); + $request = $this->deleteDomainRequest($domainName, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -795,7 +1049,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -805,19 +1059,25 @@ function ($exception) { * Create request for operation 'deleteDomain' * * @param string $domainName Domain name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteDomain'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function deleteDomainRequest($domainName) + public function deleteDomainRequest( + $domainName, + string $contentType = self::contentTypes['deleteDomain'][0] + ): Request { + // verify the required parameter 'domainName' is set if ($domainName === null || (is_array($domainName) && count($domainName) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $domainName when calling deleteDomain' ); } + $resourcePath = '/senders/domains/{domainName}'; $formParams = []; $queryParams = []; @@ -826,6 +1086,7 @@ protected function deleteDomainRequest($domainName) $multipart = false; + // path params if ($domainName !== null) { $resourcePath = str_replace( @@ -835,53 +1096,35 @@ protected function deleteDomainRequest($domainName) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -907,10 +1150,11 @@ protected function deleteDomainRequest($domainName) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -922,14 +1166,18 @@ protected function deleteDomainRequest($domainName) * Validate domain configuration * * @param string $domainName Domain name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomainConfiguration'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetDomainConfigurationModel + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetDomainConfigurationModel|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function getDomainConfiguration($domainName) + public function getDomainConfiguration( + string $domainName, + string $contentType = self::contentTypes['getDomainConfiguration'][0] + ): \Brevo\Client\Models\GetDomainConfigurationModel { - list($response) = $this->getDomainConfigurationWithHttpInfo($domainName); + list($response) = $this->getDomainConfigurationWithHttpInfo($domainName, $contentType); return $response; } @@ -939,15 +1187,18 @@ public function getDomainConfiguration($domainName) * Validate domain configuration * * @param string $domainName Domain name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomainConfiguration'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetDomainConfigurationModel, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetDomainConfigurationModel|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getDomainConfigurationWithHttpInfo($domainName) + public function getDomainConfigurationWithHttpInfo( + string $domainName, + string $contentType = self::contentTypes['getDomainConfiguration'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetDomainConfigurationModel'; - $request = $this->getDomainConfigurationRequest($domainName); + $request = $this->getDomainConfigurationRequest($domainName, $contentType); try { $options = $this->createHttpClientOption(); @@ -956,34 +1207,138 @@ public function getDomainConfigurationWithHttpInfo($domainName) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetDomainConfigurationModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetDomainConfigurationModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetDomainConfigurationModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetDomainConfigurationModel'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -998,7 +1353,7 @@ public function getDomainConfigurationWithHttpInfo($domainName) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetDomainConfigurationModel', + '\Brevo\Client\Models\GetDomainConfigurationModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1006,7 +1361,7 @@ public function getDomainConfigurationWithHttpInfo($domainName) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1014,7 +1369,7 @@ public function getDomainConfigurationWithHttpInfo($domainName) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1030,13 +1385,17 @@ public function getDomainConfigurationWithHttpInfo($domainName) * Validate domain configuration * * @param string $domainName Domain name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomainConfiguration'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getDomainConfigurationAsync($domainName) + public function getDomainConfigurationAsync( + string $domainName, + string $contentType = self::contentTypes['getDomainConfiguration'][0] + ): PromiseInterface { - return $this->getDomainConfigurationAsyncWithHttpInfo($domainName) + return $this->getDomainConfigurationAsyncWithHttpInfo($domainName, $contentType) ->then( function ($response) { return $response[0]; @@ -1050,24 +1409,28 @@ function ($response) { * Validate domain configuration * * @param string $domainName Domain name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomainConfiguration'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getDomainConfigurationAsyncWithHttpInfo($domainName) + public function getDomainConfigurationAsyncWithHttpInfo( + $domainName, + string $contentType = self::contentTypes['getDomainConfiguration'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetDomainConfigurationModel'; - $request = $this->getDomainConfigurationRequest($domainName); + $returnType = '\Brevo\Client\Models\GetDomainConfigurationModel'; + $request = $this->getDomainConfigurationRequest($domainName, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1090,7 +1453,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1100,19 +1463,25 @@ function ($exception) { * Create request for operation 'getDomainConfiguration' * * @param string $domainName Domain name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomainConfiguration'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getDomainConfigurationRequest($domainName) + public function getDomainConfigurationRequest( + $domainName, + string $contentType = self::contentTypes['getDomainConfiguration'][0] + ): Request { + // verify the required parameter 'domainName' is set if ($domainName === null || (is_array($domainName) && count($domainName) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $domainName when calling getDomainConfiguration' ); } + $resourcePath = '/senders/domains/{domainName}'; $formParams = []; $queryParams = []; @@ -1121,6 +1490,7 @@ protected function getDomainConfigurationRequest($domainName) $multipart = false; + // path params if ($domainName !== null) { $resourcePath = str_replace( @@ -1130,53 +1500,35 @@ protected function getDomainConfigurationRequest($domainName) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1202,10 +1554,11 @@ protected function getDomainConfigurationRequest($domainName) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1216,14 +1569,17 @@ protected function getDomainConfigurationRequest($domainName) * * Get the list of all your domains * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomains'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetDomainsList + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetDomainsList|\Brevo\Client\Models\ErrorModel */ - public function getDomains() + public function getDomains( + string $contentType = self::contentTypes['getDomains'][0] + ): \Brevo\Client\Models\GetDomainsList { - list($response) = $this->getDomainsWithHttpInfo(); + list($response) = $this->getDomainsWithHttpInfo($contentType); return $response; } @@ -1232,15 +1588,17 @@ public function getDomains() * * Get the list of all your domains * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomains'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetDomainsList, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetDomainsList|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getDomainsWithHttpInfo() + public function getDomainsWithHttpInfo( + string $contentType = self::contentTypes['getDomains'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetDomainsList'; - $request = $this->getDomainsRequest(); + $request = $this->getDomainsRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -1249,34 +1607,111 @@ public function getDomainsWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetDomainsList', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetDomainsList' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetDomainsList', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetDomainsList'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1291,7 +1726,7 @@ public function getDomainsWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetDomainsList', + '\Brevo\Client\Models\GetDomainsList', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1299,7 +1734,7 @@ public function getDomainsWithHttpInfo() case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1314,13 +1749,16 @@ public function getDomainsWithHttpInfo() * * Get the list of all your domains * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomains'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getDomainsAsync() + public function getDomainsAsync( + string $contentType = self::contentTypes['getDomains'][0] + ): PromiseInterface { - return $this->getDomainsAsyncWithHttpInfo() + return $this->getDomainsAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -1333,24 +1771,27 @@ function ($response) { * * Get the list of all your domains * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomains'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getDomainsAsyncWithHttpInfo() + public function getDomainsAsyncWithHttpInfo( + string $contentType = self::contentTypes['getDomains'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetDomainsList'; - $request = $this->getDomainsRequest(); + $returnType = '\Brevo\Client\Models\GetDomainsList'; + $request = $this->getDomainsRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1373,7 +1814,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1382,13 +1823,17 @@ function ($exception) { /** * Create request for operation 'getDomains' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomains'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getDomainsRequest() + public function getDomainsRequest( + string $contentType = self::contentTypes['getDomains'][0] + ): Request { + $resourcePath = '/senders/domains'; $formParams = []; $queryParams = []; @@ -1398,53 +1843,36 @@ protected function getDomainsRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1470,10 +1898,11 @@ protected function getDomainsRequest() $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1485,7 +1914,7 @@ protected function getDomainsRequest() * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/EcommerceApi.php b/lib/Api/EcommerceApi.php index d667474..3e17499 100644 --- a/lib/Api/EcommerceApi.php +++ b/lib/Api/EcommerceApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'createOrder' => [ + 'application/json', + ], + 'createUpdateBatchCategory' => [ + 'application/json', + ], + 'createUpdateBatchProducts' => [ + 'application/json', + ], + 'createUpdateCategory' => [ + 'application/json', + ], + 'createUpdateProduct' => [ + 'application/json', + ], + 'ecommerceActivatePost' => [ + 'application/json', + ], + 'ecommerceAttributionMetricsConversionSourceConversionSourceIdGet' => [ + 'application/json', + ], + 'ecommerceAttributionMetricsGet' => [ + 'application/json', + ], + 'ecommerceAttributionProductsConversionSourceConversionSourceIdGet' => [ + 'application/json', + ], + 'ecommerceConfigDisplayCurrencyGet' => [ + 'application/json', + ], + 'getCategories' => [ + 'application/json', + ], + 'getCategoryInfo' => [ + 'application/json', + ], + 'getOrders' => [ + 'application/json', + ], + 'getProductInfo' => [ + 'application/json', + ], + 'getProducts' => [ + 'application/json', + ], + 'setConfigDisplayCurrency' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -92,15 +176,20 @@ public function getConfig() * * Create orders in batch * - * @param \Brevo\Client\Model\OrderBatch $orderBatch orderBatch (required) + * @param \Brevo\Client\Models\OrderBatch $orderBatch orderBatch (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBatchOrder'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreatedBatchId|\Brevo\Client\Models\ErrorModel */ - public function createBatchOrder($orderBatch) + public function createBatchOrder( + \Brevo\Client\Models\OrderBatch $orderBatch, + string $contentType = self::contentTypes['createBatchOrder'][0] + ): \Brevo\Client\Models\CreatedBatchId { - $this->createBatchOrderWithHttpInfo($orderBatch); + list($response) = $this->createBatchOrderWithHttpInfo($orderBatch, $contentType); + return $response; } /** @@ -108,16 +197,19 @@ public function createBatchOrder($orderBatch) * * Create orders in batch * - * @param \Brevo\Client\Model\OrderBatch $orderBatch (required) + * @param \Brevo\Client\Models\OrderBatch $orderBatch (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBatchOrder'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreatedBatchId|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function createBatchOrderWithHttpInfo($orderBatch) + public function createBatchOrderWithHttpInfo( + \Brevo\Client\Models\OrderBatch $orderBatch, + string $contentType = self::contentTypes['createBatchOrder'][0] + ): array { - $returnType = ''; - $request = $this->createBatchOrderRequest($orderBatch); + $request = $this->createBatchOrderRequest($orderBatch, $contentType); try { $options = $this->createHttpClientOption(); @@ -126,35 +218,134 @@ public function createBatchOrderWithHttpInfo($orderBatch) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 202: + if (in_array('\Brevo\Client\Models\CreatedBatchId', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreatedBatchId' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreatedBatchId', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - return [null, $statusCode, $response->getHeaders()]; + $returnType = '\Brevo\Client\Models\CreatedBatchId'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; } catch (ApiException $e) { switch ($e->getCode()) { + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\CreatedBatchId', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -169,14 +360,18 @@ public function createBatchOrderWithHttpInfo($orderBatch) * * Create orders in batch * - * @param \Brevo\Client\Model\OrderBatch $orderBatch (required) + * @param \Brevo\Client\Models\OrderBatch $orderBatch (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBatchOrder'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createBatchOrderAsync($orderBatch) + public function createBatchOrderAsync( + \Brevo\Client\Models\OrderBatch $orderBatch, + string $contentType = self::contentTypes['createBatchOrder'][0] + ): PromiseInterface { - return $this->createBatchOrderAsyncWithHttpInfo($orderBatch) + return $this->createBatchOrderAsyncWithHttpInfo($orderBatch, $contentType) ->then( function ($response) { return $response[0]; @@ -189,21 +384,39 @@ function ($response) { * * Create orders in batch * - * @param \Brevo\Client\Model\OrderBatch $orderBatch (required) + * @param \Brevo\Client\Models\OrderBatch $orderBatch (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBatchOrder'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createBatchOrderAsyncWithHttpInfo($orderBatch) + public function createBatchOrderAsyncWithHttpInfo( + $orderBatch, + string $contentType = self::contentTypes['createBatchOrder'][0] + ): PromiseInterface { - $returnType = ''; - $request = $this->createBatchOrderRequest($orderBatch); + $returnType = '\Brevo\Client\Models\CreatedBatchId'; + $request = $this->createBatchOrderRequest($orderBatch, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; }, function ($exception) { $response = $exception->getResponse(); @@ -216,7 +429,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -225,20 +438,26 @@ function ($exception) { /** * Create request for operation 'createBatchOrder' * - * @param \Brevo\Client\Model\OrderBatch $orderBatch (required) + * @param \Brevo\Client\Models\OrderBatch $orderBatch (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBatchOrder'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createBatchOrderRequest($orderBatch) + public function createBatchOrderRequest( + $orderBatch, + string $contentType = self::contentTypes['createBatchOrder'][0] + ): Request { + // verify the required parameter 'orderBatch' is set if ($orderBatch === null || (is_array($orderBatch) && count($orderBatch) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $orderBatch when calling createBatchOrder' ); } + $resourcePath = '/orders/status/batch'; $formParams = []; $queryParams = []; @@ -248,56 +467,43 @@ protected function createBatchOrderRequest($orderBatch) - // body params - $_tempBody = null; - if (isset($orderBatch)) { - $_tempBody = $orderBatch; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($orderBatch)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($orderBatch)); + } else { + $httpBody = $orderBatch; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -323,10 +529,11 @@ protected function createBatchOrderRequest($orderBatch) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -337,15 +544,19 @@ protected function createBatchOrderRequest($orderBatch) * * Managing the status of the order * - * @param \Brevo\Client\Model\Order $order order (required) + * @param \Brevo\Client\Models\Order $order order (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrder'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function createOrder($order) + public function createOrder( + \Brevo\Client\Models\Order $order, + string $contentType = self::contentTypes['createOrder'][0] + ): void { - $this->createOrderWithHttpInfo($order); + $this->createOrderWithHttpInfo($order, $contentType); } /** @@ -353,16 +564,19 @@ public function createOrder($order) * * Managing the status of the order * - * @param \Brevo\Client\Model\Order $order (required) + * @param \Brevo\Client\Models\Order $order (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrder'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function createOrderWithHttpInfo($order) + public function createOrderWithHttpInfo( + \Brevo\Client\Models\Order $order, + string $contentType = self::contentTypes['createOrder'][0] + ): array { - $returnType = ''; - $request = $this->createOrderRequest($order); + $request = $this->createOrderRequest($order, $contentType); try { $options = $this->createHttpClientOption(); @@ -371,26 +585,21 @@ public function createOrderWithHttpInfo($order) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -399,7 +608,7 @@ public function createOrderWithHttpInfo($order) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -414,14 +623,18 @@ public function createOrderWithHttpInfo($order) * * Managing the status of the order * - * @param \Brevo\Client\Model\Order $order (required) + * @param \Brevo\Client\Models\Order $order (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrder'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createOrderAsync($order) + public function createOrderAsync( + \Brevo\Client\Models\Order $order, + string $contentType = self::contentTypes['createOrder'][0] + ): PromiseInterface { - return $this->createOrderAsyncWithHttpInfo($order) + return $this->createOrderAsyncWithHttpInfo($order, $contentType) ->then( function ($response) { return $response[0]; @@ -434,15 +647,20 @@ function ($response) { * * Managing the status of the order * - * @param \Brevo\Client\Model\Order $order (required) + * @param \Brevo\Client\Models\Order $order (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrder'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createOrderAsyncWithHttpInfo($order) + public function createOrderAsyncWithHttpInfo( + $order, + string $contentType = self::contentTypes['createOrder'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->createOrderRequest($order); + $request = $this->createOrderRequest($order, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -461,7 +679,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -470,20 +688,26 @@ function ($exception) { /** * Create request for operation 'createOrder' * - * @param \Brevo\Client\Model\Order $order (required) + * @param \Brevo\Client\Models\Order $order (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrder'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createOrderRequest($order) + public function createOrderRequest( + $order, + string $contentType = self::contentTypes['createOrder'][0] + ): Request { + // verify the required parameter 'order' is set if ($order === null || (is_array($order) && count($order) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $order when calling createOrder' ); } + $resourcePath = '/orders/status'; $formParams = []; $queryParams = []; @@ -493,56 +717,43 @@ protected function createOrderRequest($order) - // body params - $_tempBody = null; - if (isset($order)) { - $_tempBody = $order; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($order)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($order)); + } else { + $httpBody = $order; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -568,10 +779,11 @@ protected function createOrderRequest($order) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -582,15 +794,19 @@ protected function createOrderRequest($order) * * Create categories in batch * - * @param \Brevo\Client\Model\CreateUpdateBatchCategory $createUpdateBatchCategory Values to create a batch of categories (required) + * @param \Brevo\Client\Models\CreateUpdateBatchCategory $createUpdateBatchCategory Values to create a batch of categories (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUpdateBatchCategory'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreateUpdateBatchCategoryModel + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateUpdateBatchCategoryModel|\Brevo\Client\Models\ErrorModel */ - public function createUpdateBatchCategory($createUpdateBatchCategory) + public function createUpdateBatchCategory( + \Brevo\Client\Models\CreateUpdateBatchCategory $createUpdateBatchCategory, + string $contentType = self::contentTypes['createUpdateBatchCategory'][0] + ): \Brevo\Client\Models\CreateUpdateBatchCategoryModel { - list($response) = $this->createUpdateBatchCategoryWithHttpInfo($createUpdateBatchCategory); + list($response) = $this->createUpdateBatchCategoryWithHttpInfo($createUpdateBatchCategory, $contentType); return $response; } @@ -599,16 +815,19 @@ public function createUpdateBatchCategory($createUpdateBatchCategory) * * Create categories in batch * - * @param \Brevo\Client\Model\CreateUpdateBatchCategory $createUpdateBatchCategory Values to create a batch of categories (required) + * @param \Brevo\Client\Models\CreateUpdateBatchCategory $createUpdateBatchCategory Values to create a batch of categories (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUpdateBatchCategory'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreateUpdateBatchCategoryModel, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateUpdateBatchCategoryModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function createUpdateBatchCategoryWithHttpInfo($createUpdateBatchCategory) + public function createUpdateBatchCategoryWithHttpInfo( + \Brevo\Client\Models\CreateUpdateBatchCategory $createUpdateBatchCategory, + string $contentType = self::contentTypes['createUpdateBatchCategory'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreateUpdateBatchCategoryModel'; - $request = $this->createUpdateBatchCategoryRequest($createUpdateBatchCategory); + $request = $this->createUpdateBatchCategoryRequest($createUpdateBatchCategory, $contentType); try { $options = $this->createHttpClientOption(); @@ -617,34 +836,111 @@ public function createUpdateBatchCategoryWithHttpInfo($createUpdateBatchCategory } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreateUpdateBatchCategoryModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateUpdateBatchCategoryModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateUpdateBatchCategoryModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreateUpdateBatchCategoryModel'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -659,7 +955,7 @@ public function createUpdateBatchCategoryWithHttpInfo($createUpdateBatchCategory case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreateUpdateBatchCategoryModel', + '\Brevo\Client\Models\CreateUpdateBatchCategoryModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -667,7 +963,7 @@ public function createUpdateBatchCategoryWithHttpInfo($createUpdateBatchCategory case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -682,14 +978,18 @@ public function createUpdateBatchCategoryWithHttpInfo($createUpdateBatchCategory * * Create categories in batch * - * @param \Brevo\Client\Model\CreateUpdateBatchCategory $createUpdateBatchCategory Values to create a batch of categories (required) + * @param \Brevo\Client\Models\CreateUpdateBatchCategory $createUpdateBatchCategory Values to create a batch of categories (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUpdateBatchCategory'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createUpdateBatchCategoryAsync($createUpdateBatchCategory) + public function createUpdateBatchCategoryAsync( + \Brevo\Client\Models\CreateUpdateBatchCategory $createUpdateBatchCategory, + string $contentType = self::contentTypes['createUpdateBatchCategory'][0] + ): PromiseInterface { - return $this->createUpdateBatchCategoryAsyncWithHttpInfo($createUpdateBatchCategory) + return $this->createUpdateBatchCategoryAsyncWithHttpInfo($createUpdateBatchCategory, $contentType) ->then( function ($response) { return $response[0]; @@ -702,25 +1002,29 @@ function ($response) { * * Create categories in batch * - * @param \Brevo\Client\Model\CreateUpdateBatchCategory $createUpdateBatchCategory Values to create a batch of categories (required) + * @param \Brevo\Client\Models\CreateUpdateBatchCategory $createUpdateBatchCategory Values to create a batch of categories (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUpdateBatchCategory'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createUpdateBatchCategoryAsyncWithHttpInfo($createUpdateBatchCategory) + public function createUpdateBatchCategoryAsyncWithHttpInfo( + $createUpdateBatchCategory, + string $contentType = self::contentTypes['createUpdateBatchCategory'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreateUpdateBatchCategoryModel'; - $request = $this->createUpdateBatchCategoryRequest($createUpdateBatchCategory); + $returnType = '\Brevo\Client\Models\CreateUpdateBatchCategoryModel'; + $request = $this->createUpdateBatchCategoryRequest($createUpdateBatchCategory, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -743,7 +1047,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -752,20 +1056,26 @@ function ($exception) { /** * Create request for operation 'createUpdateBatchCategory' * - * @param \Brevo\Client\Model\CreateUpdateBatchCategory $createUpdateBatchCategory Values to create a batch of categories (required) + * @param \Brevo\Client\Models\CreateUpdateBatchCategory $createUpdateBatchCategory Values to create a batch of categories (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUpdateBatchCategory'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createUpdateBatchCategoryRequest($createUpdateBatchCategory) + public function createUpdateBatchCategoryRequest( + $createUpdateBatchCategory, + string $contentType = self::contentTypes['createUpdateBatchCategory'][0] + ): Request { + // verify the required parameter 'createUpdateBatchCategory' is set if ($createUpdateBatchCategory === null || (is_array($createUpdateBatchCategory) && count($createUpdateBatchCategory) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $createUpdateBatchCategory when calling createUpdateBatchCategory' ); } + $resourcePath = '/categories/batch'; $formParams = []; $queryParams = []; @@ -775,56 +1085,43 @@ protected function createUpdateBatchCategoryRequest($createUpdateBatchCategory) - // body params - $_tempBody = null; - if (isset($createUpdateBatchCategory)) { - $_tempBody = $createUpdateBatchCategory; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($createUpdateBatchCategory)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createUpdateBatchCategory)); + } else { + $httpBody = $createUpdateBatchCategory; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -850,10 +1147,11 @@ protected function createUpdateBatchCategoryRequest($createUpdateBatchCategory) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -864,15 +1162,19 @@ protected function createUpdateBatchCategoryRequest($createUpdateBatchCategory) * * Create products in batch * - * @param \Brevo\Client\Model\CreateUpdateBatchProducts $createUpdateBatchProducts Values to create a batch of products (required) + * @param \Brevo\Client\Models\CreateUpdateBatchProducts $createUpdateBatchProducts Values to create a batch of products (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUpdateBatchProducts'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreateUpdateBatchProductsModel + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateUpdateBatchProductsModel|\Brevo\Client\Models\ErrorModel */ - public function createUpdateBatchProducts($createUpdateBatchProducts) + public function createUpdateBatchProducts( + \Brevo\Client\Models\CreateUpdateBatchProducts $createUpdateBatchProducts, + string $contentType = self::contentTypes['createUpdateBatchProducts'][0] + ): \Brevo\Client\Models\CreateUpdateBatchProductsModel { - list($response) = $this->createUpdateBatchProductsWithHttpInfo($createUpdateBatchProducts); + list($response) = $this->createUpdateBatchProductsWithHttpInfo($createUpdateBatchProducts, $contentType); return $response; } @@ -881,16 +1183,19 @@ public function createUpdateBatchProducts($createUpdateBatchProducts) * * Create products in batch * - * @param \Brevo\Client\Model\CreateUpdateBatchProducts $createUpdateBatchProducts Values to create a batch of products (required) + * @param \Brevo\Client\Models\CreateUpdateBatchProducts $createUpdateBatchProducts Values to create a batch of products (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUpdateBatchProducts'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreateUpdateBatchProductsModel, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateUpdateBatchProductsModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function createUpdateBatchProductsWithHttpInfo($createUpdateBatchProducts) + public function createUpdateBatchProductsWithHttpInfo( + \Brevo\Client\Models\CreateUpdateBatchProducts $createUpdateBatchProducts, + string $contentType = self::contentTypes['createUpdateBatchProducts'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreateUpdateBatchProductsModel'; - $request = $this->createUpdateBatchProductsRequest($createUpdateBatchProducts); + $request = $this->createUpdateBatchProductsRequest($createUpdateBatchProducts, $contentType); try { $options = $this->createHttpClientOption(); @@ -899,34 +1204,111 @@ public function createUpdateBatchProductsWithHttpInfo($createUpdateBatchProducts } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreateUpdateBatchProductsModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateUpdateBatchProductsModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateUpdateBatchProductsModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreateUpdateBatchProductsModel'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -941,7 +1323,7 @@ public function createUpdateBatchProductsWithHttpInfo($createUpdateBatchProducts case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreateUpdateBatchProductsModel', + '\Brevo\Client\Models\CreateUpdateBatchProductsModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -949,7 +1331,7 @@ public function createUpdateBatchProductsWithHttpInfo($createUpdateBatchProducts case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -964,14 +1346,18 @@ public function createUpdateBatchProductsWithHttpInfo($createUpdateBatchProducts * * Create products in batch * - * @param \Brevo\Client\Model\CreateUpdateBatchProducts $createUpdateBatchProducts Values to create a batch of products (required) + * @param \Brevo\Client\Models\CreateUpdateBatchProducts $createUpdateBatchProducts Values to create a batch of products (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUpdateBatchProducts'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createUpdateBatchProductsAsync($createUpdateBatchProducts) + public function createUpdateBatchProductsAsync( + \Brevo\Client\Models\CreateUpdateBatchProducts $createUpdateBatchProducts, + string $contentType = self::contentTypes['createUpdateBatchProducts'][0] + ): PromiseInterface { - return $this->createUpdateBatchProductsAsyncWithHttpInfo($createUpdateBatchProducts) + return $this->createUpdateBatchProductsAsyncWithHttpInfo($createUpdateBatchProducts, $contentType) ->then( function ($response) { return $response[0]; @@ -984,25 +1370,29 @@ function ($response) { * * Create products in batch * - * @param \Brevo\Client\Model\CreateUpdateBatchProducts $createUpdateBatchProducts Values to create a batch of products (required) + * @param \Brevo\Client\Models\CreateUpdateBatchProducts $createUpdateBatchProducts Values to create a batch of products (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUpdateBatchProducts'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createUpdateBatchProductsAsyncWithHttpInfo($createUpdateBatchProducts) + public function createUpdateBatchProductsAsyncWithHttpInfo( + $createUpdateBatchProducts, + string $contentType = self::contentTypes['createUpdateBatchProducts'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreateUpdateBatchProductsModel'; - $request = $this->createUpdateBatchProductsRequest($createUpdateBatchProducts); + $returnType = '\Brevo\Client\Models\CreateUpdateBatchProductsModel'; + $request = $this->createUpdateBatchProductsRequest($createUpdateBatchProducts, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1025,7 +1415,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1034,20 +1424,26 @@ function ($exception) { /** * Create request for operation 'createUpdateBatchProducts' * - * @param \Brevo\Client\Model\CreateUpdateBatchProducts $createUpdateBatchProducts Values to create a batch of products (required) + * @param \Brevo\Client\Models\CreateUpdateBatchProducts $createUpdateBatchProducts Values to create a batch of products (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUpdateBatchProducts'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createUpdateBatchProductsRequest($createUpdateBatchProducts) + public function createUpdateBatchProductsRequest( + $createUpdateBatchProducts, + string $contentType = self::contentTypes['createUpdateBatchProducts'][0] + ): Request { + // verify the required parameter 'createUpdateBatchProducts' is set if ($createUpdateBatchProducts === null || (is_array($createUpdateBatchProducts) && count($createUpdateBatchProducts) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $createUpdateBatchProducts when calling createUpdateBatchProducts' ); } + $resourcePath = '/products/batch'; $formParams = []; $queryParams = []; @@ -1057,56 +1453,43 @@ protected function createUpdateBatchProductsRequest($createUpdateBatchProducts) - // body params - $_tempBody = null; - if (isset($createUpdateBatchProducts)) { - $_tempBody = $createUpdateBatchProducts; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($createUpdateBatchProducts)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createUpdateBatchProducts)); + } else { + $httpBody = $createUpdateBatchProducts; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1132,10 +1515,11 @@ protected function createUpdateBatchProductsRequest($createUpdateBatchProducts) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1146,15 +1530,19 @@ protected function createUpdateBatchProductsRequest($createUpdateBatchProducts) * * Create/Update a category * - * @param \Brevo\Client\Model\CreateUpdateCategory $createUpdateCategory Values to create/update a category (required) + * @param \Brevo\Client\Models\CreateUpdateCategory $createUpdateCategory Values to create/update a category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUpdateCategory'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreateCategoryModel + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateCategoryModel|\Brevo\Client\Models\ErrorModel */ - public function createUpdateCategory($createUpdateCategory) + public function createUpdateCategory( + \Brevo\Client\Models\CreateUpdateCategory $createUpdateCategory, + string $contentType = self::contentTypes['createUpdateCategory'][0] + ): \Brevo\Client\Models\CreateCategoryModel { - list($response) = $this->createUpdateCategoryWithHttpInfo($createUpdateCategory); + list($response) = $this->createUpdateCategoryWithHttpInfo($createUpdateCategory, $contentType); return $response; } @@ -1163,16 +1551,19 @@ public function createUpdateCategory($createUpdateCategory) * * Create/Update a category * - * @param \Brevo\Client\Model\CreateUpdateCategory $createUpdateCategory Values to create/update a category (required) + * @param \Brevo\Client\Models\CreateUpdateCategory $createUpdateCategory Values to create/update a category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUpdateCategory'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreateCategoryModel, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateCategoryModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function createUpdateCategoryWithHttpInfo($createUpdateCategory) + public function createUpdateCategoryWithHttpInfo( + \Brevo\Client\Models\CreateUpdateCategory $createUpdateCategory, + string $contentType = self::contentTypes['createUpdateCategory'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreateCategoryModel'; - $request = $this->createUpdateCategoryRequest($createUpdateCategory); + $request = $this->createUpdateCategoryRequest($createUpdateCategory, $contentType); try { $options = $this->createHttpClientOption(); @@ -1181,34 +1572,111 @@ public function createUpdateCategoryWithHttpInfo($createUpdateCategory) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreateCategoryModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateCategoryModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateCategoryModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreateCategoryModel'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1223,7 +1691,7 @@ public function createUpdateCategoryWithHttpInfo($createUpdateCategory) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreateCategoryModel', + '\Brevo\Client\Models\CreateCategoryModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1231,7 +1699,7 @@ public function createUpdateCategoryWithHttpInfo($createUpdateCategory) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1246,14 +1714,18 @@ public function createUpdateCategoryWithHttpInfo($createUpdateCategory) * * Create/Update a category * - * @param \Brevo\Client\Model\CreateUpdateCategory $createUpdateCategory Values to create/update a category (required) + * @param \Brevo\Client\Models\CreateUpdateCategory $createUpdateCategory Values to create/update a category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUpdateCategory'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createUpdateCategoryAsync($createUpdateCategory) + public function createUpdateCategoryAsync( + \Brevo\Client\Models\CreateUpdateCategory $createUpdateCategory, + string $contentType = self::contentTypes['createUpdateCategory'][0] + ): PromiseInterface { - return $this->createUpdateCategoryAsyncWithHttpInfo($createUpdateCategory) + return $this->createUpdateCategoryAsyncWithHttpInfo($createUpdateCategory, $contentType) ->then( function ($response) { return $response[0]; @@ -1266,25 +1738,29 @@ function ($response) { * * Create/Update a category * - * @param \Brevo\Client\Model\CreateUpdateCategory $createUpdateCategory Values to create/update a category (required) + * @param \Brevo\Client\Models\CreateUpdateCategory $createUpdateCategory Values to create/update a category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUpdateCategory'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createUpdateCategoryAsyncWithHttpInfo($createUpdateCategory) + public function createUpdateCategoryAsyncWithHttpInfo( + $createUpdateCategory, + string $contentType = self::contentTypes['createUpdateCategory'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreateCategoryModel'; - $request = $this->createUpdateCategoryRequest($createUpdateCategory); + $returnType = '\Brevo\Client\Models\CreateCategoryModel'; + $request = $this->createUpdateCategoryRequest($createUpdateCategory, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1307,7 +1783,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1316,20 +1792,26 @@ function ($exception) { /** * Create request for operation 'createUpdateCategory' * - * @param \Brevo\Client\Model\CreateUpdateCategory $createUpdateCategory Values to create/update a category (required) + * @param \Brevo\Client\Models\CreateUpdateCategory $createUpdateCategory Values to create/update a category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUpdateCategory'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createUpdateCategoryRequest($createUpdateCategory) + public function createUpdateCategoryRequest( + $createUpdateCategory, + string $contentType = self::contentTypes['createUpdateCategory'][0] + ): Request { + // verify the required parameter 'createUpdateCategory' is set if ($createUpdateCategory === null || (is_array($createUpdateCategory) && count($createUpdateCategory) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $createUpdateCategory when calling createUpdateCategory' ); } + $resourcePath = '/categories'; $formParams = []; $queryParams = []; @@ -1339,56 +1821,43 @@ protected function createUpdateCategoryRequest($createUpdateCategory) - // body params - $_tempBody = null; - if (isset($createUpdateCategory)) { - $_tempBody = $createUpdateCategory; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($createUpdateCategory)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createUpdateCategory)); + } else { + $httpBody = $createUpdateCategory; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1414,10 +1883,11 @@ protected function createUpdateCategoryRequest($createUpdateCategory) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1428,15 +1898,19 @@ protected function createUpdateCategoryRequest($createUpdateCategory) * * Create/Update a product * - * @param \Brevo\Client\Model\CreateUpdateProduct $createUpdateProduct Values to create/update a product (required) + * @param \Brevo\Client\Models\CreateUpdateProduct $createUpdateProduct Values to create/update a product (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUpdateProduct'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreateProductModel + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateProductModel|\Brevo\Client\Models\ErrorModel */ - public function createUpdateProduct($createUpdateProduct) + public function createUpdateProduct( + \Brevo\Client\Models\CreateUpdateProduct $createUpdateProduct, + string $contentType = self::contentTypes['createUpdateProduct'][0] + ): \Brevo\Client\Models\CreateProductModel { - list($response) = $this->createUpdateProductWithHttpInfo($createUpdateProduct); + list($response) = $this->createUpdateProductWithHttpInfo($createUpdateProduct, $contentType); return $response; } @@ -1445,16 +1919,19 @@ public function createUpdateProduct($createUpdateProduct) * * Create/Update a product * - * @param \Brevo\Client\Model\CreateUpdateProduct $createUpdateProduct Values to create/update a product (required) + * @param \Brevo\Client\Models\CreateUpdateProduct $createUpdateProduct Values to create/update a product (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUpdateProduct'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreateProductModel, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateProductModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function createUpdateProductWithHttpInfo($createUpdateProduct) + public function createUpdateProductWithHttpInfo( + \Brevo\Client\Models\CreateUpdateProduct $createUpdateProduct, + string $contentType = self::contentTypes['createUpdateProduct'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreateProductModel'; - $request = $this->createUpdateProductRequest($createUpdateProduct); + $request = $this->createUpdateProductRequest($createUpdateProduct, $contentType); try { $options = $this->createHttpClientOption(); @@ -1463,34 +1940,111 @@ public function createUpdateProductWithHttpInfo($createUpdateProduct) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreateProductModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateProductModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateProductModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreateProductModel'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1505,7 +2059,7 @@ public function createUpdateProductWithHttpInfo($createUpdateProduct) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreateProductModel', + '\Brevo\Client\Models\CreateProductModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1513,7 +2067,7 @@ public function createUpdateProductWithHttpInfo($createUpdateProduct) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1528,14 +2082,18 @@ public function createUpdateProductWithHttpInfo($createUpdateProduct) * * Create/Update a product * - * @param \Brevo\Client\Model\CreateUpdateProduct $createUpdateProduct Values to create/update a product (required) + * @param \Brevo\Client\Models\CreateUpdateProduct $createUpdateProduct Values to create/update a product (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUpdateProduct'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createUpdateProductAsync($createUpdateProduct) + public function createUpdateProductAsync( + \Brevo\Client\Models\CreateUpdateProduct $createUpdateProduct, + string $contentType = self::contentTypes['createUpdateProduct'][0] + ): PromiseInterface { - return $this->createUpdateProductAsyncWithHttpInfo($createUpdateProduct) + return $this->createUpdateProductAsyncWithHttpInfo($createUpdateProduct, $contentType) ->then( function ($response) { return $response[0]; @@ -1548,25 +2106,29 @@ function ($response) { * * Create/Update a product * - * @param \Brevo\Client\Model\CreateUpdateProduct $createUpdateProduct Values to create/update a product (required) + * @param \Brevo\Client\Models\CreateUpdateProduct $createUpdateProduct Values to create/update a product (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUpdateProduct'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createUpdateProductAsyncWithHttpInfo($createUpdateProduct) + public function createUpdateProductAsyncWithHttpInfo( + $createUpdateProduct, + string $contentType = self::contentTypes['createUpdateProduct'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreateProductModel'; - $request = $this->createUpdateProductRequest($createUpdateProduct); + $returnType = '\Brevo\Client\Models\CreateProductModel'; + $request = $this->createUpdateProductRequest($createUpdateProduct, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1589,7 +2151,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1598,20 +2160,26 @@ function ($exception) { /** * Create request for operation 'createUpdateProduct' * - * @param \Brevo\Client\Model\CreateUpdateProduct $createUpdateProduct Values to create/update a product (required) + * @param \Brevo\Client\Models\CreateUpdateProduct $createUpdateProduct Values to create/update a product (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUpdateProduct'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createUpdateProductRequest($createUpdateProduct) + public function createUpdateProductRequest( + $createUpdateProduct, + string $contentType = self::contentTypes['createUpdateProduct'][0] + ): Request { + // verify the required parameter 'createUpdateProduct' is set if ($createUpdateProduct === null || (is_array($createUpdateProduct) && count($createUpdateProduct) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $createUpdateProduct when calling createUpdateProduct' ); } + $resourcePath = '/products'; $formParams = []; $queryParams = []; @@ -1621,56 +2189,43 @@ protected function createUpdateProductRequest($createUpdateProduct) - // body params - $_tempBody = null; - if (isset($createUpdateProduct)) { - $_tempBody = $createUpdateProduct; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($createUpdateProduct)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createUpdateProduct)); + } else { + $httpBody = $createUpdateProduct; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1696,10 +2251,11 @@ protected function createUpdateProductRequest($createUpdateProduct) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1710,14 +2266,17 @@ protected function createUpdateProductRequest($createUpdateProduct) * * Activate the eCommerce app * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceActivatePost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function ecommerceActivatePost() + public function ecommerceActivatePost( + string $contentType = self::contentTypes['ecommerceActivatePost'][0] + ): void { - $this->ecommerceActivatePostWithHttpInfo(); + $this->ecommerceActivatePostWithHttpInfo($contentType); } /** @@ -1725,15 +2284,17 @@ public function ecommerceActivatePost() * * Activate the eCommerce app * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceActivatePost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function ecommerceActivatePostWithHttpInfo() + public function ecommerceActivatePostWithHttpInfo( + string $contentType = self::contentTypes['ecommerceActivatePost'][0] + ): array { - $returnType = ''; - $request = $this->ecommerceActivatePostRequest(); + $request = $this->ecommerceActivatePostRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -1742,26 +2303,21 @@ public function ecommerceActivatePostWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -1770,7 +2326,7 @@ public function ecommerceActivatePostWithHttpInfo() case 401: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1778,7 +2334,7 @@ public function ecommerceActivatePostWithHttpInfo() case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1793,13 +2349,16 @@ public function ecommerceActivatePostWithHttpInfo() * * Activate the eCommerce app * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceActivatePost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function ecommerceActivatePostAsync() + public function ecommerceActivatePostAsync( + string $contentType = self::contentTypes['ecommerceActivatePost'][0] + ): PromiseInterface { - return $this->ecommerceActivatePostAsyncWithHttpInfo() + return $this->ecommerceActivatePostAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -1812,14 +2371,18 @@ function ($response) { * * Activate the eCommerce app * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceActivatePost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function ecommerceActivatePostAsyncWithHttpInfo() + public function ecommerceActivatePostAsyncWithHttpInfo( + string $contentType = self::contentTypes['ecommerceActivatePost'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->ecommerceActivatePostRequest(); + $request = $this->ecommerceActivatePostRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1838,7 +2401,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1847,13 +2410,17 @@ function ($exception) { /** * Create request for operation 'ecommerceActivatePost' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceActivatePost'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function ecommerceActivatePostRequest() + public function ecommerceActivatePostRequest( + string $contentType = self::contentTypes['ecommerceActivatePost'][0] + ): Request { + $resourcePath = '/ecommerce/activate'; $formParams = []; $queryParams = []; @@ -1863,53 +2430,36 @@ protected function ecommerceActivatePostRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1935,59 +2485,59 @@ protected function ecommerceActivatePostRequest() $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Operation getCategories + * Operation ecommerceAttributionMetricsConversionSourceConversionSourceIdGet * - * Return all your categories + * Get detailed attribution metrics for a single Brevo campaign * - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string[] $ids Filter by category ids (optional) - * @param string $name Filter by category name (optional) - * @param string $modifiedSince Filter (urlencoded) the categories 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 string $createdSince Filter (urlencoded) the categories created 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 string $conversionSource The Brevo campaign type for which data will be retrieved (required) + * @param float $conversionSourceId The Brevo campaign id for which data will be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceAttributionMetricsConversionSourceConversionSourceIdGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetCategories + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response|\Brevo\Client\Models\ErrorModel */ - public function getCategories($limit = '50', $offset = '0', $sort = 'desc', $ids = null, $name = null, $modifiedSince = null, $createdSince = null) + public function ecommerceAttributionMetricsConversionSourceConversionSourceIdGet( + string $conversionSource, + float $conversionSourceId, + string $contentType = self::contentTypes['ecommerceAttributionMetricsConversionSourceConversionSourceIdGet'][0] + ): \Brevo\Client\Models\EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response { - list($response) = $this->getCategoriesWithHttpInfo($limit, $offset, $sort, $ids, $name, $modifiedSince, $createdSince); + list($response) = $this->ecommerceAttributionMetricsConversionSourceConversionSourceIdGetWithHttpInfo($conversionSource, $conversionSourceId, $contentType); return $response; } /** - * Operation getCategoriesWithHttpInfo + * Operation ecommerceAttributionMetricsConversionSourceConversionSourceIdGetWithHttpInfo * - * Return all your categories + * Get detailed attribution metrics for a single Brevo campaign * - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string[] $ids Filter by category ids (optional) - * @param string $name Filter by category name (optional) - * @param string $modifiedSince Filter (urlencoded) the categories 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 string $createdSince Filter (urlencoded) the categories created 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 string $conversionSource The Brevo campaign type for which data will be retrieved (required) + * @param float $conversionSourceId The Brevo campaign id for which data will be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceAttributionMetricsConversionSourceConversionSourceIdGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetCategories, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getCategoriesWithHttpInfo($limit = '50', $offset = '0', $sort = 'desc', $ids = null, $name = null, $modifiedSince = null, $createdSince = null) + public function ecommerceAttributionMetricsConversionSourceConversionSourceIdGetWithHttpInfo( + string $conversionSource, + float $conversionSourceId, + string $contentType = self::contentTypes['ecommerceAttributionMetricsConversionSourceConversionSourceIdGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetCategories'; - $request = $this->getCategoriesRequest($limit, $offset, $sort, $ids, $name, $modifiedSince, $createdSince); + $request = $this->ecommerceAttributionMetricsConversionSourceConversionSourceIdGetRequest($conversionSource, $conversionSourceId, $contentType); try { $options = $this->createHttpClientOption(); @@ -1996,34 +2546,111 @@ public function getCategoriesWithHttpInfo($limit = '50', $offset = '0', $sort = } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2038,7 +2665,7 @@ public function getCategoriesWithHttpInfo($limit = '50', $offset = '0', $sort = case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetCategories', + '\Brevo\Client\Models\EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2046,7 +2673,7 @@ public function getCategoriesWithHttpInfo($limit = '50', $offset = '0', $sort = case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2057,24 +2684,24 @@ public function getCategoriesWithHttpInfo($limit = '50', $offset = '0', $sort = } /** - * Operation getCategoriesAsync + * Operation ecommerceAttributionMetricsConversionSourceConversionSourceIdGetAsync * - * Return all your categories + * Get detailed attribution metrics for a single Brevo campaign * - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string[] $ids Filter by category ids (optional) - * @param string $name Filter by category name (optional) - * @param string $modifiedSince Filter (urlencoded) the categories 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 string $createdSince Filter (urlencoded) the categories created 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 string $conversionSource The Brevo campaign type for which data will be retrieved (required) + * @param float $conversionSourceId The Brevo campaign id for which data will be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceAttributionMetricsConversionSourceConversionSourceIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getCategoriesAsync($limit = '50', $offset = '0', $sort = 'desc', $ids = null, $name = null, $modifiedSince = null, $createdSince = null) + public function ecommerceAttributionMetricsConversionSourceConversionSourceIdGetAsync( + string $conversionSource, + float $conversionSourceId, + string $contentType = self::contentTypes['ecommerceAttributionMetricsConversionSourceConversionSourceIdGet'][0] + ): PromiseInterface { - return $this->getCategoriesAsyncWithHttpInfo($limit, $offset, $sort, $ids, $name, $modifiedSince, $createdSince) + return $this->ecommerceAttributionMetricsConversionSourceConversionSourceIdGetAsyncWithHttpInfo($conversionSource, $conversionSourceId, $contentType) ->then( function ($response) { return $response[0]; @@ -2083,35 +2710,35 @@ function ($response) { } /** - * Operation getCategoriesAsyncWithHttpInfo + * Operation ecommerceAttributionMetricsConversionSourceConversionSourceIdGetAsyncWithHttpInfo * - * Return all your categories + * Get detailed attribution metrics for a single Brevo campaign * - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string[] $ids Filter by category ids (optional) - * @param string $name Filter by category name (optional) - * @param string $modifiedSince Filter (urlencoded) the categories 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 string $createdSince Filter (urlencoded) the categories created 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 string $conversionSource The Brevo campaign type for which data will be retrieved (required) + * @param float $conversionSourceId The Brevo campaign id for which data will be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceAttributionMetricsConversionSourceConversionSourceIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getCategoriesAsyncWithHttpInfo($limit = '50', $offset = '0', $sort = 'desc', $ids = null, $name = null, $modifiedSince = null, $createdSince = null) + public function ecommerceAttributionMetricsConversionSourceConversionSourceIdGetAsyncWithHttpInfo( + $conversionSource, + $conversionSourceId, + string $contentType = self::contentTypes['ecommerceAttributionMetricsConversionSourceConversionSourceIdGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetCategories'; - $request = $this->getCategoriesRequest($limit, $offset, $sort, $ids, $name, $modifiedSince, $createdSince); + $returnType = '\Brevo\Client\Models\EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response'; + $request = $this->ecommerceAttributionMetricsConversionSourceConversionSourceIdGetRequest($conversionSource, $conversionSourceId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2134,120 +2761,99 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); } /** - * Create request for operation 'getCategories' + * Create request for operation 'ecommerceAttributionMetricsConversionSourceConversionSourceIdGet' * - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string[] $ids Filter by category ids (optional) - * @param string $name Filter by category name (optional) - * @param string $modifiedSince Filter (urlencoded) the categories 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 string $createdSince Filter (urlencoded) the categories created 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 string $conversionSource The Brevo campaign type for which data will be retrieved (required) + * @param float $conversionSourceId The Brevo campaign id for which data will be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceAttributionMetricsConversionSourceConversionSourceIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getCategoriesRequest($limit = '50', $offset = '0', $sort = 'desc', $ids = null, $name = null, $modifiedSince = null, $createdSince = null) + public function ecommerceAttributionMetricsConversionSourceConversionSourceIdGetRequest( + $conversionSource, + $conversionSourceId, + string $contentType = self::contentTypes['ecommerceAttributionMetricsConversionSourceConversionSourceIdGet'][0] + ): Request { - if ($limit !== null && $limit > 100) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling EcommerceApi.getCategories, must be smaller than or equal to 100.'); + + // verify the required parameter 'conversionSource' is set + if ($conversionSource === null || (is_array($conversionSource) && count($conversionSource) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $conversionSource when calling ecommerceAttributionMetricsConversionSourceConversionSourceIdGet' + ); + } + + // verify the required parameter 'conversionSourceId' is set + if ($conversionSourceId === null || (is_array($conversionSourceId) && count($conversionSourceId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $conversionSourceId when calling ecommerceAttributionMetricsConversionSourceConversionSourceIdGet' + ); } - $resourcePath = '/categories'; + $resourcePath = '/ecommerce/attribution/metrics/{conversionSource}/{conversionSourceId}'; $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); - } - // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } - // query params - if (is_array($ids)) { - $queryParams['ids'] = $ids; - } else - if ($ids !== null) { - $queryParams['ids'] = ObjectSerializer::toQueryValue($ids); - } - // query params - if ($name !== null) { - $queryParams['name'] = ObjectSerializer::toQueryValue($name); - } - // query params - if ($modifiedSince !== null) { - $queryParams['modifiedSince'] = ObjectSerializer::toQueryValue($modifiedSince); - } - // query params - if ($createdSince !== null) { - $queryParams['createdSince'] = ObjectSerializer::toQueryValue($createdSince); - } - - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] + // path params + if ($conversionSource !== null) { + $resourcePath = str_replace( + '{' . 'conversionSource' . '}', + ObjectSerializer::toPathValue($conversionSource), + $resourcePath ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] + } + // path params + if ($conversionSourceId !== null) { + $resourcePath = str_replace( + '{' . 'conversionSourceId' . '}', + ObjectSerializer::toPathValue($conversionSourceId), + $resourcePath ); } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2273,47 +2879,63 @@ protected function getCategoriesRequest($limit = '50', $offset = '0', $sort = 'd $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Operation getCategoryInfo + * Operation ecommerceAttributionMetricsGet * - * Get a category details + * Get attribution metrics for one or more Brevo campaigns * - * @param string $id Category ID (required) + * @param \DateTime|null $periodFrom When getting metrics for a specific period, define the starting datetime in RFC3339 format (optional) + * @param \DateTime|null $periodTo When getting metrics for a specific period, define the end datetime in RFC3339 format (optional) + * @param float[]|null $emailCampaignId The email campaign id(s) to get metrics for (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceAttributionMetricsGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetCategoryDetails + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\EcommerceAttributionMetricsGet200Response|\Brevo\Client\Models\ErrorModel */ - public function getCategoryInfo($id) + public function ecommerceAttributionMetricsGet( + ?\DateTime $periodFrom = null, + ?\DateTime $periodTo = null, + ?array $emailCampaignId = null, + string $contentType = self::contentTypes['ecommerceAttributionMetricsGet'][0] + ): \Brevo\Client\Models\EcommerceAttributionMetricsGet200Response { - list($response) = $this->getCategoryInfoWithHttpInfo($id); + list($response) = $this->ecommerceAttributionMetricsGetWithHttpInfo($periodFrom, $periodTo, $emailCampaignId, $contentType); return $response; } /** - * Operation getCategoryInfoWithHttpInfo + * Operation ecommerceAttributionMetricsGetWithHttpInfo * - * Get a category details + * Get attribution metrics for one or more Brevo campaigns * - * @param string $id Category ID (required) + * @param \DateTime|null $periodFrom When getting metrics for a specific period, define the starting datetime in RFC3339 format (optional) + * @param \DateTime|null $periodTo When getting metrics for a specific period, define the end datetime in RFC3339 format (optional) + * @param float[]|null $emailCampaignId The email campaign id(s) to get metrics for (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceAttributionMetricsGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetCategoryDetails, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\EcommerceAttributionMetricsGet200Response|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getCategoryInfoWithHttpInfo($id) + public function ecommerceAttributionMetricsGetWithHttpInfo( + ?\DateTime $periodFrom = null, + ?\DateTime $periodTo = null, + ?array $emailCampaignId = null, + string $contentType = self::contentTypes['ecommerceAttributionMetricsGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetCategoryDetails'; - $request = $this->getCategoryInfoRequest($id); + $request = $this->ecommerceAttributionMetricsGetRequest($periodFrom, $periodTo, $emailCampaignId, $contentType); try { $options = $this->createHttpClientOption(); @@ -2322,34 +2944,111 @@ public function getCategoryInfoWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\EcommerceAttributionMetricsGet200Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\EcommerceAttributionMetricsGet200Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\EcommerceAttributionMetricsGet200Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\EcommerceAttributionMetricsGet200Response'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2364,7 +3063,7 @@ public function getCategoryInfoWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetCategoryDetails', + '\Brevo\Client\Models\EcommerceAttributionMetricsGet200Response', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2372,15 +3071,7 @@ public function getCategoryInfoWithHttpInfo($id) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2391,18 +3082,26 @@ public function getCategoryInfoWithHttpInfo($id) } /** - * Operation getCategoryInfoAsync + * Operation ecommerceAttributionMetricsGetAsync * - * Get a category details + * Get attribution metrics for one or more Brevo campaigns * - * @param string $id Category ID (required) + * @param \DateTime|null $periodFrom When getting metrics for a specific period, define the starting datetime in RFC3339 format (optional) + * @param \DateTime|null $periodTo When getting metrics for a specific period, define the end datetime in RFC3339 format (optional) + * @param float[]|null $emailCampaignId The email campaign id(s) to get metrics for (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceAttributionMetricsGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getCategoryInfoAsync($id) + public function ecommerceAttributionMetricsGetAsync( + ?\DateTime $periodFrom = null, + ?\DateTime $periodTo = null, + ?array $emailCampaignId = null, + string $contentType = self::contentTypes['ecommerceAttributionMetricsGet'][0] + ): PromiseInterface { - return $this->getCategoryInfoAsyncWithHttpInfo($id) + return $this->ecommerceAttributionMetricsGetAsyncWithHttpInfo($periodFrom, $periodTo, $emailCampaignId, $contentType) ->then( function ($response) { return $response[0]; @@ -2411,29 +3110,37 @@ function ($response) { } /** - * Operation getCategoryInfoAsyncWithHttpInfo + * Operation ecommerceAttributionMetricsGetAsyncWithHttpInfo * - * Get a category details + * Get attribution metrics for one or more Brevo campaigns * - * @param string $id Category ID (required) + * @param \DateTime|null $periodFrom When getting metrics for a specific period, define the starting datetime in RFC3339 format (optional) + * @param \DateTime|null $periodTo When getting metrics for a specific period, define the end datetime in RFC3339 format (optional) + * @param float[]|null $emailCampaignId The email campaign id(s) to get metrics for (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceAttributionMetricsGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getCategoryInfoAsyncWithHttpInfo($id) + public function ecommerceAttributionMetricsGetAsyncWithHttpInfo( + $periodFrom = null, + $periodTo = null, + $emailCampaignId = null, + string $contentType = self::contentTypes['ecommerceAttributionMetricsGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetCategoryDetails'; - $request = $this->getCategoryInfoRequest($id); + $returnType = '\Brevo\Client\Models\EcommerceAttributionMetricsGet200Response'; + $request = $this->ecommerceAttributionMetricsGetRequest($periodFrom, $periodTo, $emailCampaignId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2456,93 +3163,101 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); } /** - * Create request for operation 'getCategoryInfo' + * Create request for operation 'ecommerceAttributionMetricsGet' * - * @param string $id Category ID (required) + * @param \DateTime|null $periodFrom When getting metrics for a specific period, define the starting datetime in RFC3339 format (optional) + * @param \DateTime|null $periodTo When getting metrics for a specific period, define the end datetime in RFC3339 format (optional) + * @param float[]|null $emailCampaignId The email campaign id(s) to get metrics for (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceAttributionMetricsGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getCategoryInfoRequest($id) + public function ecommerceAttributionMetricsGetRequest( + $periodFrom = null, + $periodTo = null, + $emailCampaignId = null, + string $contentType = self::contentTypes['ecommerceAttributionMetricsGet'][0] + ): Request { - // verify the required parameter 'id' is set - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getCategoryInfo' - ); - } - $resourcePath = '/categories/{id}'; + + + + + $resourcePath = '/ecommerce/attribution/metrics'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $periodFrom, + 'periodFrom', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $periodTo, + 'periodTo', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $emailCampaignId, + 'emailCampaignId[]', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2568,55 +3283,59 @@ protected function getCategoryInfoRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Operation getOrders + * Operation ecommerceAttributionProductsConversionSourceConversionSourceIdGet * - * Get order details + * Get attributed product sales for a single Brevo campaign * - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string $modifiedSince Filter (urlencoded) the orders 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 string $createdSince Filter (urlencoded) the orders created 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 string $conversionSource The Brevo campaign type for which data will be retrieved (required) + * @param float $conversionSourceId The Brevo campaign id for which data will be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceAttributionProductsConversionSourceConversionSourceIdGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetOrders + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response|\Brevo\Client\Models\ErrorModel */ - public function getOrders($limit = '50', $offset = '0', $sort = 'desc', $modifiedSince = null, $createdSince = null) + public function ecommerceAttributionProductsConversionSourceConversionSourceIdGet( + string $conversionSource, + float $conversionSourceId, + string $contentType = self::contentTypes['ecommerceAttributionProductsConversionSourceConversionSourceIdGet'][0] + ): \Brevo\Client\Models\EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response { - list($response) = $this->getOrdersWithHttpInfo($limit, $offset, $sort, $modifiedSince, $createdSince); + list($response) = $this->ecommerceAttributionProductsConversionSourceConversionSourceIdGetWithHttpInfo($conversionSource, $conversionSourceId, $contentType); return $response; } /** - * Operation getOrdersWithHttpInfo + * Operation ecommerceAttributionProductsConversionSourceConversionSourceIdGetWithHttpInfo * - * Get order details + * Get attributed product sales for a single Brevo campaign * - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string $modifiedSince Filter (urlencoded) the orders 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 string $createdSince Filter (urlencoded) the orders created 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 string $conversionSource The Brevo campaign type for which data will be retrieved (required) + * @param float $conversionSourceId The Brevo campaign id for which data will be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceAttributionProductsConversionSourceConversionSourceIdGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetOrders, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getOrdersWithHttpInfo($limit = '50', $offset = '0', $sort = 'desc', $modifiedSince = null, $createdSince = null) + public function ecommerceAttributionProductsConversionSourceConversionSourceIdGetWithHttpInfo( + string $conversionSource, + float $conversionSourceId, + string $contentType = self::contentTypes['ecommerceAttributionProductsConversionSourceConversionSourceIdGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetOrders'; - $request = $this->getOrdersRequest($limit, $offset, $sort, $modifiedSince, $createdSince); + $request = $this->ecommerceAttributionProductsConversionSourceConversionSourceIdGetRequest($conversionSource, $conversionSourceId, $contentType); try { $options = $this->createHttpClientOption(); @@ -2625,35 +3344,112 @@ public function getOrdersWithHttpInfo($limit = '50', $offset = '0', $sort = 'des } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); - } + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -2667,7 +3463,7 @@ public function getOrdersWithHttpInfo($limit = '50', $offset = '0', $sort = 'des case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetOrders', + '\Brevo\Client\Models\EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2675,7 +3471,7 @@ public function getOrdersWithHttpInfo($limit = '50', $offset = '0', $sort = 'des case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2686,22 +3482,24 @@ public function getOrdersWithHttpInfo($limit = '50', $offset = '0', $sort = 'des } /** - * Operation getOrdersAsync + * Operation ecommerceAttributionProductsConversionSourceConversionSourceIdGetAsync * - * Get order details + * Get attributed product sales for a single Brevo campaign * - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string $modifiedSince Filter (urlencoded) the orders 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 string $createdSince Filter (urlencoded) the orders created 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 string $conversionSource The Brevo campaign type for which data will be retrieved (required) + * @param float $conversionSourceId The Brevo campaign id for which data will be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceAttributionProductsConversionSourceConversionSourceIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getOrdersAsync($limit = '50', $offset = '0', $sort = 'desc', $modifiedSince = null, $createdSince = null) + public function ecommerceAttributionProductsConversionSourceConversionSourceIdGetAsync( + string $conversionSource, + float $conversionSourceId, + string $contentType = self::contentTypes['ecommerceAttributionProductsConversionSourceConversionSourceIdGet'][0] + ): PromiseInterface { - return $this->getOrdersAsyncWithHttpInfo($limit, $offset, $sort, $modifiedSince, $createdSince) + return $this->ecommerceAttributionProductsConversionSourceConversionSourceIdGetAsyncWithHttpInfo($conversionSource, $conversionSourceId, $contentType) ->then( function ($response) { return $response[0]; @@ -2710,33 +3508,35 @@ function ($response) { } /** - * Operation getOrdersAsyncWithHttpInfo + * Operation ecommerceAttributionProductsConversionSourceConversionSourceIdGetAsyncWithHttpInfo * - * Get order details + * Get attributed product sales for a single Brevo campaign * - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string $modifiedSince Filter (urlencoded) the orders 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 string $createdSince Filter (urlencoded) the orders created 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 string $conversionSource The Brevo campaign type for which data will be retrieved (required) + * @param float $conversionSourceId The Brevo campaign id for which data will be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceAttributionProductsConversionSourceConversionSourceIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getOrdersAsyncWithHttpInfo($limit = '50', $offset = '0', $sort = 'desc', $modifiedSince = null, $createdSince = null) + public function ecommerceAttributionProductsConversionSourceConversionSourceIdGetAsyncWithHttpInfo( + $conversionSource, + $conversionSourceId, + string $contentType = self::contentTypes['ecommerceAttributionProductsConversionSourceConversionSourceIdGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetOrders'; - $request = $this->getOrdersRequest($limit, $offset, $sort, $modifiedSince, $createdSince); + $returnType = '\Brevo\Client\Models\EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response'; + $request = $this->ecommerceAttributionProductsConversionSourceConversionSourceIdGetRequest($conversionSource, $conversionSourceId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2759,107 +3559,99 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); } /** - * Create request for operation 'getOrders' + * Create request for operation 'ecommerceAttributionProductsConversionSourceConversionSourceIdGet' * - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string $modifiedSince Filter (urlencoded) the orders 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 string $createdSince Filter (urlencoded) the orders created 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 string $conversionSource The Brevo campaign type for which data will be retrieved (required) + * @param float $conversionSourceId The Brevo campaign id for which data will be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceAttributionProductsConversionSourceConversionSourceIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getOrdersRequest($limit = '50', $offset = '0', $sort = 'desc', $modifiedSince = null, $createdSince = null) + public function ecommerceAttributionProductsConversionSourceConversionSourceIdGetRequest( + $conversionSource, + $conversionSourceId, + string $contentType = self::contentTypes['ecommerceAttributionProductsConversionSourceConversionSourceIdGet'][0] + ): Request { - if ($limit !== null && $limit > 100) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling EcommerceApi.getOrders, must be smaller than or equal to 100.'); + + // verify the required parameter 'conversionSource' is set + if ($conversionSource === null || (is_array($conversionSource) && count($conversionSource) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $conversionSource when calling ecommerceAttributionProductsConversionSourceConversionSourceIdGet' + ); + } + + // verify the required parameter 'conversionSourceId' is set + if ($conversionSourceId === null || (is_array($conversionSourceId) && count($conversionSourceId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $conversionSourceId when calling ecommerceAttributionProductsConversionSourceConversionSourceIdGet' + ); } - $resourcePath = '/orders'; + $resourcePath = '/ecommerce/attribution/products/{conversionSource}/{conversionSourceId}'; $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); - } - // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } - // query params - if ($modifiedSince !== null) { - $queryParams['modifiedSince'] = ObjectSerializer::toQueryValue($modifiedSince); - } - // query params - if ($createdSince !== null) { - $queryParams['createdSince'] = ObjectSerializer::toQueryValue($createdSince); - } - - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] + // path params + if ($conversionSource !== null) { + $resourcePath = str_replace( + '{' . 'conversionSource' . '}', + ObjectSerializer::toPathValue($conversionSource), + $resourcePath ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] + } + // path params + if ($conversionSourceId !== null) { + $resourcePath = str_replace( + '{' . 'conversionSourceId' . '}', + ObjectSerializer::toPathValue($conversionSourceId), + $resourcePath ); } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2885,47 +3677,51 @@ protected function getOrdersRequest($limit = '50', $offset = '0', $sort = 'desc' $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Operation getProductInfo + * Operation ecommerceConfigDisplayCurrencyGet * - * Get a product's details + * Get the ISO 4217 compliant display currency code for your Brevo account * - * @param string $id Product ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceConfigDisplayCurrencyGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetProductDetails + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function getProductInfo($id) + public function ecommerceConfigDisplayCurrencyGet( + string $contentType = self::contentTypes['ecommerceConfigDisplayCurrencyGet'][0] + ): \Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response { - list($response) = $this->getProductInfoWithHttpInfo($id); + list($response) = $this->ecommerceConfigDisplayCurrencyGetWithHttpInfo($contentType); return $response; } /** - * Operation getProductInfoWithHttpInfo + * Operation ecommerceConfigDisplayCurrencyGetWithHttpInfo * - * Get a product's details + * Get the ISO 4217 compliant display currency code for your Brevo account * - * @param string $id Product ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceConfigDisplayCurrencyGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetProductDetails, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getProductInfoWithHttpInfo($id) + public function ecommerceConfigDisplayCurrencyGetWithHttpInfo( + string $contentType = self::contentTypes['ecommerceConfigDisplayCurrencyGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetProductDetails'; - $request = $this->getProductInfoRequest($id); + $request = $this->ecommerceConfigDisplayCurrencyGetRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -2934,34 +3730,165 @@ public function getProductInfoWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2976,7 +3903,7 @@ public function getProductInfoWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetProductDetails', + '\Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2984,15 +3911,23 @@ public function getProductInfoWithHttpInfo($id) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 404: + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3003,18 +3938,20 @@ public function getProductInfoWithHttpInfo($id) } /** - * Operation getProductInfoAsync + * Operation ecommerceConfigDisplayCurrencyGetAsync * - * Get a product's details + * Get the ISO 4217 compliant display currency code for your Brevo account * - * @param string $id Product ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceConfigDisplayCurrencyGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getProductInfoAsync($id) + public function ecommerceConfigDisplayCurrencyGetAsync( + string $contentType = self::contentTypes['ecommerceConfigDisplayCurrencyGet'][0] + ): PromiseInterface { - return $this->getProductInfoAsyncWithHttpInfo($id) + return $this->ecommerceConfigDisplayCurrencyGetAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -3023,29 +3960,31 @@ function ($response) { } /** - * Operation getProductInfoAsyncWithHttpInfo + * Operation ecommerceConfigDisplayCurrencyGetAsyncWithHttpInfo * - * Get a product's details + * Get the ISO 4217 compliant display currency code for your Brevo account * - * @param string $id Product ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceConfigDisplayCurrencyGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getProductInfoAsyncWithHttpInfo($id) + public function ecommerceConfigDisplayCurrencyGetAsyncWithHttpInfo( + string $contentType = self::contentTypes['ecommerceConfigDisplayCurrencyGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetProductDetails'; - $request = $this->getProductInfoRequest($id); + $returnType = '\Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response'; + $request = $this->ecommerceConfigDisplayCurrencyGetRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3068,30 +4007,27 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); } /** - * Create request for operation 'getProductInfo' + * Create request for operation 'ecommerceConfigDisplayCurrencyGet' * - * @param string $id Product ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ecommerceConfigDisplayCurrencyGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getProductInfoRequest($id) + public function ecommerceConfigDisplayCurrencyGetRequest( + string $contentType = self::contentTypes['ecommerceConfigDisplayCurrencyGet'][0] + ): Request { - // verify the required parameter 'id' is set - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getProductInfo' - ); - } - $resourcePath = '/products/{id}'; + + $resourcePath = '/ecommerce/config/displayCurrency'; $formParams = []; $queryParams = []; $headerParams = []; @@ -3099,62 +4035,37 @@ protected function getProductInfoRequest($id) $multipart = false; - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3180,73 +4091,79 @@ protected function getProductInfoRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Operation getProducts + * Operation getCategories * - * Return all your products + * Return all your categories * - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string[] $ids Filter by product ids (optional) - * @param string $name Filter by product name, minimum 3 characters should be present for search (optional) - * @param float $priceLte Price filter for products less than and equals to particular amount (optional) - * @param float $priceGte Price filter for products greater than and equals to particular amount (optional) - * @param float $priceLt Price filter for products less than particular amount (optional) - * @param float $priceGt Price filter for products greater than particular amount (optional) - * @param float $priceEq Price filter for products equals to particular amount (optional) - * @param float $priceNe Price filter for products not equals to particular amount (optional) - * @param string[] $categories Filter by category ids (optional) - * @param string $modifiedSince Filter (urlencoded) the orders 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 string $createdSince Filter (urlencoded) the orders created 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 \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetProducts - */ - public function getProducts($limit = '50', $offset = '0', $sort = 'desc', $ids = null, $name = null, $priceLte = null, $priceGte = null, $priceLt = null, $priceGt = null, $priceEq = null, $priceNe = null, $categories = null, $modifiedSince = null, $createdSince = null) - { - list($response) = $this->getProductsWithHttpInfo($limit, $offset, $sort, $ids, $name, $priceLte, $priceGte, $priceLt, $priceGt, $priceEq, $priceNe, $categories, $modifiedSince, $createdSince); + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string[]|null $ids Filter by category ids (optional) + * @param string|null $name Filter by category name (optional) + * @param string|null $modifiedSince Filter (urlencoded) the categories 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 string|null $createdSince Filter (urlencoded) the categories created 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 string $contentType The value for the Content-Type header. Check self::contentTypes['getCategories'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetCategories|\Brevo\Client\Models\ErrorModel + */ + public function getCategories( + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + ?array $ids = null, + ?string $name = null, + ?string $modifiedSince = null, + ?string $createdSince = null, + string $contentType = self::contentTypes['getCategories'][0] + ): \Brevo\Client\Models\GetCategories + { + list($response) = $this->getCategoriesWithHttpInfo($limit, $offset, $sort, $ids, $name, $modifiedSince, $createdSince, $contentType); return $response; } /** - * Operation getProductsWithHttpInfo + * Operation getCategoriesWithHttpInfo * - * Return all your products + * Return all your categories * - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string[] $ids Filter by product ids (optional) - * @param string $name Filter by product name, minimum 3 characters should be present for search (optional) - * @param float $priceLte Price filter for products less than and equals to particular amount (optional) - * @param float $priceGte Price filter for products greater than and equals to particular amount (optional) - * @param float $priceLt Price filter for products less than particular amount (optional) - * @param float $priceGt Price filter for products greater than particular amount (optional) - * @param float $priceEq Price filter for products equals to particular amount (optional) - * @param float $priceNe Price filter for products not equals to particular amount (optional) - * @param string[] $categories Filter by category ids (optional) - * @param string $modifiedSince Filter (urlencoded) the orders 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 string $createdSince Filter (urlencoded) the orders created 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 \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetProducts, HTTP status code, HTTP response headers (array of strings) - */ - public function getProductsWithHttpInfo($limit = '50', $offset = '0', $sort = 'desc', $ids = null, $name = null, $priceLte = null, $priceGte = null, $priceLt = null, $priceGt = null, $priceEq = null, $priceNe = null, $categories = null, $modifiedSince = null, $createdSince = null) - { - $returnType = '\Brevo\Client\Model\GetProducts'; - $request = $this->getProductsRequest($limit, $offset, $sort, $ids, $name, $priceLte, $priceGte, $priceLt, $priceGt, $priceEq, $priceNe, $categories, $modifiedSince, $createdSince); + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string[]|null $ids Filter by category ids (optional) + * @param string|null $name Filter by category name (optional) + * @param string|null $modifiedSince Filter (urlencoded) the categories 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 string|null $createdSince Filter (urlencoded) the categories created 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 string $contentType The value for the Content-Type header. Check self::contentTypes['getCategories'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetCategories|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) + */ + public function getCategoriesWithHttpInfo( + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + ?array $ids = null, + ?string $name = null, + ?string $modifiedSince = null, + ?string $createdSince = null, + string $contentType = self::contentTypes['getCategories'][0] + ): array + { + $request = $this->getCategoriesRequest($limit, $offset, $sort, $ids, $name, $modifiedSince, $createdSince, $contentType); try { $options = $this->createHttpClientOption(); @@ -3255,34 +4172,111 @@ public function getProductsWithHttpInfo($limit = '50', $offset = '0', $sort = 'd } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetCategories', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetCategories' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetCategories', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetCategories'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3297,7 +4291,7 @@ public function getProductsWithHttpInfo($limit = '50', $offset = '0', $sort = 'd case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetProducts', + '\Brevo\Client\Models\GetCategories', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3305,7 +4299,7 @@ public function getProductsWithHttpInfo($limit = '50', $offset = '0', $sort = 'd case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3316,31 +4310,34 @@ public function getProductsWithHttpInfo($limit = '50', $offset = '0', $sort = 'd } /** - * Operation getProductsAsync + * Operation getCategoriesAsync * - * Return all your products + * Return all your categories * - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string[] $ids Filter by product ids (optional) - * @param string $name Filter by product name, minimum 3 characters should be present for search (optional) - * @param float $priceLte Price filter for products less than and equals to particular amount (optional) - * @param float $priceGte Price filter for products greater than and equals to particular amount (optional) - * @param float $priceLt Price filter for products less than particular amount (optional) - * @param float $priceGt Price filter for products greater than particular amount (optional) - * @param float $priceEq Price filter for products equals to particular amount (optional) - * @param float $priceNe Price filter for products not equals to particular amount (optional) - * @param string[] $categories Filter by category ids (optional) - * @param string $modifiedSince Filter (urlencoded) the orders 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 string $createdSince Filter (urlencoded) the orders created 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 getProductsAsync($limit = '50', $offset = '0', $sort = 'desc', $ids = null, $name = null, $priceLte = null, $priceGte = null, $priceLt = null, $priceGt = null, $priceEq = null, $priceNe = null, $categories = null, $modifiedSince = null, $createdSince = null) - { - return $this->getProductsAsyncWithHttpInfo($limit, $offset, $sort, $ids, $name, $priceLte, $priceGte, $priceLt, $priceGt, $priceEq, $priceNe, $categories, $modifiedSince, $createdSince) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string[]|null $ids Filter by category ids (optional) + * @param string|null $name Filter by category name (optional) + * @param string|null $modifiedSince Filter (urlencoded) the categories 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 string|null $createdSince Filter (urlencoded) the categories created 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 string $contentType The value for the Content-Type header. Check self::contentTypes['getCategories'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getCategoriesAsync( + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + ?array $ids = null, + ?string $name = null, + ?string $modifiedSince = null, + ?string $createdSince = null, + string $contentType = self::contentTypes['getCategories'][0] + ): PromiseInterface + { + return $this->getCategoriesAsyncWithHttpInfo($limit, $offset, $sort, $ids, $name, $modifiedSince, $createdSince, $contentType) ->then( function ($response) { return $response[0]; @@ -3349,42 +4346,45 @@ function ($response) { } /** - * Operation getProductsAsyncWithHttpInfo + * Operation getCategoriesAsyncWithHttpInfo * - * Return all your products + * Return all your categories * - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string[] $ids Filter by product ids (optional) - * @param string $name Filter by product name, minimum 3 characters should be present for search (optional) - * @param float $priceLte Price filter for products less than and equals to particular amount (optional) - * @param float $priceGte Price filter for products greater than and equals to particular amount (optional) - * @param float $priceLt Price filter for products less than particular amount (optional) - * @param float $priceGt Price filter for products greater than particular amount (optional) - * @param float $priceEq Price filter for products equals to particular amount (optional) - * @param float $priceNe Price filter for products not equals to particular amount (optional) - * @param string[] $categories Filter by category ids (optional) - * @param string $modifiedSince Filter (urlencoded) the orders 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 string $createdSince Filter (urlencoded) the orders created 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 getProductsAsyncWithHttpInfo($limit = '50', $offset = '0', $sort = 'desc', $ids = null, $name = null, $priceLte = null, $priceGte = null, $priceLt = null, $priceGt = null, $priceEq = null, $priceNe = null, $categories = null, $modifiedSince = null, $createdSince = null) - { - $returnType = '\Brevo\Client\Model\GetProducts'; - $request = $this->getProductsRequest($limit, $offset, $sort, $ids, $name, $priceLte, $priceGte, $priceLt, $priceGt, $priceEq, $priceNe, $categories, $modifiedSince, $createdSince); + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string[]|null $ids Filter by category ids (optional) + * @param string|null $name Filter by category name (optional) + * @param string|null $modifiedSince Filter (urlencoded) the categories 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 string|null $createdSince Filter (urlencoded) the categories created 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 string $contentType The value for the Content-Type header. Check self::contentTypes['getCategories'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getCategoriesAsyncWithHttpInfo( + $limit = 50, + $offset = 0, + $sort = 'desc', + $ids = null, + $name = null, + $modifiedSince = null, + $createdSince = null, + string $contentType = self::contentTypes['getCategories'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\GetCategories'; + $request = $this->getCategoriesRequest($limit, $offset, $sort, $ids, $name, $modifiedSince, $createdSince, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3407,41 +4407,51 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); } /** - * Create request for operation 'getProducts' + * Create request for operation 'getCategories' + * + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string[]|null $ids Filter by category ids (optional) + * @param string|null $name Filter by category name (optional) + * @param string|null $modifiedSince Filter (urlencoded) the categories 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 string|null $createdSince Filter (urlencoded) the categories created 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 string $contentType The value for the Content-Type header. Check self::contentTypes['getCategories'] to see the possible values for this operation * - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string[] $ids Filter by product ids (optional) - * @param string $name Filter by product name, minimum 3 characters should be present for search (optional) - * @param float $priceLte Price filter for products less than and equals to particular amount (optional) - * @param float $priceGte Price filter for products greater than and equals to particular amount (optional) - * @param float $priceLt Price filter for products less than particular amount (optional) - * @param float $priceGt Price filter for products greater than particular amount (optional) - * @param float $priceEq Price filter for products equals to particular amount (optional) - * @param float $priceNe Price filter for products not equals to particular amount (optional) - * @param string[] $categories Filter by category ids (optional) - * @param string $modifiedSince Filter (urlencoded) the orders 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 string $createdSince Filter (urlencoded) the orders created 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 + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getProductsRequest($limit = '50', $offset = '0', $sort = 'desc', $ids = null, $name = null, $priceLte = null, $priceGte = null, $priceLt = null, $priceGt = null, $priceEq = null, $priceNe = null, $categories = null, $modifiedSince = null, $createdSince = null) + public function getCategoriesRequest( + $limit = 50, + $offset = 0, + $sort = 'desc', + $ids = null, + $name = null, + $modifiedSince = null, + $createdSince = null, + string $contentType = self::contentTypes['getCategories'][0] + ): Request { - if ($limit !== null && $limit > 1000) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling EcommerceApi.getProducts, must be smaller than or equal to 1000.'); + + if ($limit !== null && $limit > 100) { + throw new InvalidArgumentException('invalid value for "$limit" when calling EcommerceApi.getCategories, must be smaller than or equal to 100.'); } + - $resourcePath = '/products'; + + + + + + $resourcePath = '/categories'; $formParams = []; $queryParams = []; $headerParams = []; @@ -3449,116 +4459,100 @@ protected function getProductsRequest($limit = '50', $offset = '0', $sort = 'des $multipart = false; // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } - // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } - // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } - // query params - if (is_array($ids)) { - $queryParams['ids'] = $ids; - } else - if ($ids !== null) { - $queryParams['ids'] = ObjectSerializer::toQueryValue($ids); - } - // query params - if ($name !== null) { - $queryParams['name'] = ObjectSerializer::toQueryValue($name); - } - // query params - if ($priceLte !== null) { - $queryParams['price[lte]'] = ObjectSerializer::toQueryValue($priceLte); - } - // query params - if ($priceGte !== null) { - $queryParams['price[gte]'] = ObjectSerializer::toQueryValue($priceGte); - } - // query params - if ($priceLt !== null) { - $queryParams['price[lt]'] = ObjectSerializer::toQueryValue($priceLt); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($priceGt !== null) { - $queryParams['price[gt]'] = ObjectSerializer::toQueryValue($priceGt); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($priceEq !== null) { - $queryParams['price[eq]'] = ObjectSerializer::toQueryValue($priceEq); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($priceNe !== null) { - $queryParams['price[ne]'] = ObjectSerializer::toQueryValue($priceNe); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $ids, + 'ids', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if (is_array($categories)) { - $queryParams['categories'] = $categories; - } else - if ($categories !== null) { - $queryParams['categories'] = ObjectSerializer::toQueryValue($categories); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $name, + 'name', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($modifiedSince !== null) { - $queryParams['modifiedSince'] = ObjectSerializer::toQueryValue($modifiedSince); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $modifiedSince, + 'modifiedSince', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($createdSince !== null) { - $queryParams['createdSince'] = ObjectSerializer::toQueryValue($createdSince); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $createdSince, + 'createdSince', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3584,10 +4578,2242 @@ protected function getProductsRequest($limit = '50', $offset = '0', $sort = 'des $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getCategoryInfo + * + * Get a category details + * + * @param string $id Category ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCategoryInfo'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetCategoryDetails|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel + */ + public function getCategoryInfo( + string $id, + string $contentType = self::contentTypes['getCategoryInfo'][0] + ): \Brevo\Client\Models\GetCategoryDetails + { + list($response) = $this->getCategoryInfoWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getCategoryInfoWithHttpInfo + * + * Get a category details + * + * @param string $id Category ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCategoryInfo'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetCategoryDetails|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) + */ + public function getCategoryInfoWithHttpInfo( + string $id, + string $contentType = self::contentTypes['getCategoryInfo'][0] + ): array + { + $request = $this->getCategoryInfoRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetCategoryDetails', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetCategoryDetails' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetCategoryDetails', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\GetCategoryDetails'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\GetCategoryDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getCategoryInfoAsync + * + * Get a category details + * + * @param string $id Category ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCategoryInfo'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getCategoryInfoAsync( + string $id, + string $contentType = self::contentTypes['getCategoryInfo'][0] + ): PromiseInterface + { + return $this->getCategoryInfoAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getCategoryInfoAsyncWithHttpInfo + * + * Get a category details + * + * @param string $id Category ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCategoryInfo'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getCategoryInfoAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['getCategoryInfo'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\GetCategoryDetails'; + $request = $this->getCategoryInfoRequest($id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getCategoryInfo' + * + * @param string $id Category ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCategoryInfo'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getCategoryInfoRequest( + $id, + string $contentType = self::contentTypes['getCategoryInfo'][0] + ): Request + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $id when calling getCategoryInfo' + ); + } + + + $resourcePath = '/categories/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getOrders + * + * Get order details + * + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string|null $modifiedSince Filter (urlencoded) the orders 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 string|null $createdSince Filter (urlencoded) the orders created 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 string $contentType The value for the Content-Type header. Check self::contentTypes['getOrders'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return void + */ + public function getOrders( + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + ?string $modifiedSince = null, + ?string $createdSince = null, + string $contentType = self::contentTypes['getOrders'][0] + ): void + { + $this->getOrdersWithHttpInfo($limit, $offset, $sort, $modifiedSince, $createdSince, $contentType); + } + + /** + * Operation getOrdersWithHttpInfo + * + * Get order details + * + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string|null $modifiedSince Filter (urlencoded) the orders 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 string|null $createdSince Filter (urlencoded) the orders created 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 string $contentType The value for the Content-Type header. Check self::contentTypes['getOrders'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function getOrdersWithHttpInfo( + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + ?string $modifiedSince = null, + ?string $createdSince = null, + string $contentType = self::contentTypes['getOrders'][0] + ): array + { + $request = $this->getOrdersRequest($limit, $offset, $sort, $modifiedSince, $createdSince, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getOrdersAsync + * + * Get order details + * + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string|null $modifiedSince Filter (urlencoded) the orders 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 string|null $createdSince Filter (urlencoded) the orders created 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 string $contentType The value for the Content-Type header. Check self::contentTypes['getOrders'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getOrdersAsync( + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + ?string $modifiedSince = null, + ?string $createdSince = null, + string $contentType = self::contentTypes['getOrders'][0] + ): PromiseInterface + { + return $this->getOrdersAsyncWithHttpInfo($limit, $offset, $sort, $modifiedSince, $createdSince, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getOrdersAsyncWithHttpInfo + * + * Get order details + * + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string|null $modifiedSince Filter (urlencoded) the orders 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 string|null $createdSince Filter (urlencoded) the orders created 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 string $contentType The value for the Content-Type header. Check self::contentTypes['getOrders'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getOrdersAsyncWithHttpInfo( + $limit = 50, + $offset = 0, + $sort = 'desc', + $modifiedSince = null, + $createdSince = null, + string $contentType = self::contentTypes['getOrders'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->getOrdersRequest($limit, $offset, $sort, $modifiedSince, $createdSince, $contentType); + + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getOrders' + * + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string|null $modifiedSince Filter (urlencoded) the orders 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 string|null $createdSince Filter (urlencoded) the orders created 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 string $contentType The value for the Content-Type header. Check self::contentTypes['getOrders'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getOrdersRequest( + $limit = 50, + $offset = 0, + $sort = 'desc', + $modifiedSince = null, + $createdSince = null, + string $contentType = self::contentTypes['getOrders'][0] + ): Request + { + + if ($limit !== null && $limit > 100) { + throw new InvalidArgumentException('invalid value for "$limit" when calling EcommerceApi.getOrders, must be smaller than or equal to 100.'); + } + + + + + + + $resourcePath = '/orders'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $modifiedSince, + 'modifiedSince', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $createdSince, + 'createdSince', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getProductInfo + * + * Get a product's details + * + * @param string $id Product ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProductInfo'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetProductDetails|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel + */ + public function getProductInfo( + string $id, + string $contentType = self::contentTypes['getProductInfo'][0] + ): \Brevo\Client\Models\GetProductDetails + { + list($response) = $this->getProductInfoWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getProductInfoWithHttpInfo + * + * Get a product's details + * + * @param string $id Product ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProductInfo'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetProductDetails|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) + */ + public function getProductInfoWithHttpInfo( + string $id, + string $contentType = self::contentTypes['getProductInfo'][0] + ): array + { + $request = $this->getProductInfoRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetProductDetails', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetProductDetails' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetProductDetails', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\GetProductDetails'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\GetProductDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProductInfoAsync + * + * Get a product's details + * + * @param string $id Product ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProductInfo'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getProductInfoAsync( + string $id, + string $contentType = self::contentTypes['getProductInfo'][0] + ): PromiseInterface + { + return $this->getProductInfoAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProductInfoAsyncWithHttpInfo + * + * Get a product's details + * + * @param string $id Product ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProductInfo'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getProductInfoAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['getProductInfo'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\GetProductDetails'; + $request = $this->getProductInfoRequest($id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getProductInfo' + * + * @param string $id Product ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProductInfo'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getProductInfoRequest( + $id, + string $contentType = self::contentTypes['getProductInfo'][0] + ): Request + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $id when calling getProductInfo' + ); + } + + + $resourcePath = '/products/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getProducts + * + * Return all your products + * + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string[]|null $ids Filter by product ids (optional) + * @param string|null $name Filter by product name, minimum 3 characters should be present for search (optional) + * @param float|null $priceLte Price filter for products less than and equals to particular amount (optional) + * @param float|null $priceGte Price filter for products greater than and equals to particular amount (optional) + * @param float|null $priceLt Price filter for products less than particular amount (optional) + * @param float|null $priceGt Price filter for products greater than particular amount (optional) + * @param float|null $priceEq Price filter for products equals to particular amount (optional) + * @param float|null $priceNe Price filter for products not equals to particular amount (optional) + * @param string[]|null $categories Filter by product categories (optional) + * @param string|null $modifiedSince Filter (urlencoded) the orders 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 string|null $createdSince Filter (urlencoded) the orders created 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 string $contentType The value for the Content-Type header. Check self::contentTypes['getProducts'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetProducts|\Brevo\Client\Models\ErrorModel + */ + public function getProducts( + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + ?array $ids = null, + ?string $name = null, + ?float $priceLte = null, + ?float $priceGte = null, + ?float $priceLt = null, + ?float $priceGt = null, + ?float $priceEq = null, + ?float $priceNe = null, + ?array $categories = null, + ?string $modifiedSince = null, + ?string $createdSince = null, + string $contentType = self::contentTypes['getProducts'][0] + ): \Brevo\Client\Models\GetProducts + { + list($response) = $this->getProductsWithHttpInfo($limit, $offset, $sort, $ids, $name, $priceLte, $priceGte, $priceLt, $priceGt, $priceEq, $priceNe, $categories, $modifiedSince, $createdSince, $contentType); + return $response; + } + + /** + * Operation getProductsWithHttpInfo + * + * Return all your products + * + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string[]|null $ids Filter by product ids (optional) + * @param string|null $name Filter by product name, minimum 3 characters should be present for search (optional) + * @param float|null $priceLte Price filter for products less than and equals to particular amount (optional) + * @param float|null $priceGte Price filter for products greater than and equals to particular amount (optional) + * @param float|null $priceLt Price filter for products less than particular amount (optional) + * @param float|null $priceGt Price filter for products greater than particular amount (optional) + * @param float|null $priceEq Price filter for products equals to particular amount (optional) + * @param float|null $priceNe Price filter for products not equals to particular amount (optional) + * @param string[]|null $categories Filter by product categories (optional) + * @param string|null $modifiedSince Filter (urlencoded) the orders 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 string|null $createdSince Filter (urlencoded) the orders created 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 string $contentType The value for the Content-Type header. Check self::contentTypes['getProducts'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetProducts|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) + */ + public function getProductsWithHttpInfo( + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + ?array $ids = null, + ?string $name = null, + ?float $priceLte = null, + ?float $priceGte = null, + ?float $priceLt = null, + ?float $priceGt = null, + ?float $priceEq = null, + ?float $priceNe = null, + ?array $categories = null, + ?string $modifiedSince = null, + ?string $createdSince = null, + string $contentType = self::contentTypes['getProducts'][0] + ): array + { + $request = $this->getProductsRequest($limit, $offset, $sort, $ids, $name, $priceLte, $priceGte, $priceLt, $priceGt, $priceEq, $priceNe, $categories, $modifiedSince, $createdSince, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetProducts', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetProducts' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetProducts', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\GetProducts'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\GetProducts', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProductsAsync + * + * Return all your products + * + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string[]|null $ids Filter by product ids (optional) + * @param string|null $name Filter by product name, minimum 3 characters should be present for search (optional) + * @param float|null $priceLte Price filter for products less than and equals to particular amount (optional) + * @param float|null $priceGte Price filter for products greater than and equals to particular amount (optional) + * @param float|null $priceLt Price filter for products less than particular amount (optional) + * @param float|null $priceGt Price filter for products greater than particular amount (optional) + * @param float|null $priceEq Price filter for products equals to particular amount (optional) + * @param float|null $priceNe Price filter for products not equals to particular amount (optional) + * @param string[]|null $categories Filter by product categories (optional) + * @param string|null $modifiedSince Filter (urlencoded) the orders 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 string|null $createdSince Filter (urlencoded) the orders created 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 string $contentType The value for the Content-Type header. Check self::contentTypes['getProducts'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getProductsAsync( + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + ?array $ids = null, + ?string $name = null, + ?float $priceLte = null, + ?float $priceGte = null, + ?float $priceLt = null, + ?float $priceGt = null, + ?float $priceEq = null, + ?float $priceNe = null, + ?array $categories = null, + ?string $modifiedSince = null, + ?string $createdSince = null, + string $contentType = self::contentTypes['getProducts'][0] + ): PromiseInterface + { + return $this->getProductsAsyncWithHttpInfo($limit, $offset, $sort, $ids, $name, $priceLte, $priceGte, $priceLt, $priceGt, $priceEq, $priceNe, $categories, $modifiedSince, $createdSince, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProductsAsyncWithHttpInfo + * + * Return all your products + * + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string[]|null $ids Filter by product ids (optional) + * @param string|null $name Filter by product name, minimum 3 characters should be present for search (optional) + * @param float|null $priceLte Price filter for products less than and equals to particular amount (optional) + * @param float|null $priceGte Price filter for products greater than and equals to particular amount (optional) + * @param float|null $priceLt Price filter for products less than particular amount (optional) + * @param float|null $priceGt Price filter for products greater than particular amount (optional) + * @param float|null $priceEq Price filter for products equals to particular amount (optional) + * @param float|null $priceNe Price filter for products not equals to particular amount (optional) + * @param string[]|null $categories Filter by product categories (optional) + * @param string|null $modifiedSince Filter (urlencoded) the orders 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 string|null $createdSince Filter (urlencoded) the orders created 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 string $contentType The value for the Content-Type header. Check self::contentTypes['getProducts'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getProductsAsyncWithHttpInfo( + $limit = 50, + $offset = 0, + $sort = 'desc', + $ids = null, + $name = null, + $priceLte = null, + $priceGte = null, + $priceLt = null, + $priceGt = null, + $priceEq = null, + $priceNe = null, + $categories = null, + $modifiedSince = null, + $createdSince = null, + string $contentType = self::contentTypes['getProducts'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\GetProducts'; + $request = $this->getProductsRequest($limit, $offset, $sort, $ids, $name, $priceLte, $priceGte, $priceLt, $priceGt, $priceEq, $priceNe, $categories, $modifiedSince, $createdSince, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getProducts' + * + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string[]|null $ids Filter by product ids (optional) + * @param string|null $name Filter by product name, minimum 3 characters should be present for search (optional) + * @param float|null $priceLte Price filter for products less than and equals to particular amount (optional) + * @param float|null $priceGte Price filter for products greater than and equals to particular amount (optional) + * @param float|null $priceLt Price filter for products less than particular amount (optional) + * @param float|null $priceGt Price filter for products greater than particular amount (optional) + * @param float|null $priceEq Price filter for products equals to particular amount (optional) + * @param float|null $priceNe Price filter for products not equals to particular amount (optional) + * @param string[]|null $categories Filter by product categories (optional) + * @param string|null $modifiedSince Filter (urlencoded) the orders 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 string|null $createdSince Filter (urlencoded) the orders created 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 string $contentType The value for the Content-Type header. Check self::contentTypes['getProducts'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getProductsRequest( + $limit = 50, + $offset = 0, + $sort = 'desc', + $ids = null, + $name = null, + $priceLte = null, + $priceGte = null, + $priceLt = null, + $priceGt = null, + $priceEq = null, + $priceNe = null, + $categories = null, + $modifiedSince = null, + $createdSince = null, + string $contentType = self::contentTypes['getProducts'][0] + ): Request + { + + if ($limit !== null && $limit > 1000) { + throw new InvalidArgumentException('invalid value for "$limit" when calling EcommerceApi.getProducts, must be smaller than or equal to 1000.'); + } + + + + + + + + + + + + + + + + $resourcePath = '/products'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $ids, + 'ids', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $name, + 'name', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $priceLte, + 'price[lte]', // param base name + 'number', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $priceGte, + 'price[gte]', // param base name + 'number', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $priceLt, + 'price[lt]', // param base name + 'number', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $priceGt, + 'price[gt]', // param base name + 'number', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $priceEq, + 'price[eq]', // param base name + 'number', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $priceNe, + 'price[ne]', // param base name + 'number', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $categories, + 'categories', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $modifiedSince, + 'modifiedSince', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $createdSince, + 'createdSince', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation setConfigDisplayCurrency + * + * Set the ISO 4217 compliant display currency code for your Brevo account + * + * @param \Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response|null $ecommerceConfigDisplayCurrencyGet200Response set ISO 4217 compliant display currency code payload (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['setConfigDisplayCurrency'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel + */ + public function setConfigDisplayCurrency( + ?\Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response $ecommerceConfigDisplayCurrencyGet200Response = null, + string $contentType = self::contentTypes['setConfigDisplayCurrency'][0] + ): \Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response + { + list($response) = $this->setConfigDisplayCurrencyWithHttpInfo($ecommerceConfigDisplayCurrencyGet200Response, $contentType); + return $response; + } + + /** + * Operation setConfigDisplayCurrencyWithHttpInfo + * + * Set the ISO 4217 compliant display currency code for your Brevo account + * + * @param \Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response|null $ecommerceConfigDisplayCurrencyGet200Response set ISO 4217 compliant display currency code payload (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['setConfigDisplayCurrency'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) + */ + public function setConfigDisplayCurrencyWithHttpInfo( + ?\Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response $ecommerceConfigDisplayCurrencyGet200Response = null, + string $contentType = self::contentTypes['setConfigDisplayCurrency'][0] + ): array + { + $request = $this->setConfigDisplayCurrencyRequest($ecommerceConfigDisplayCurrencyGet200Response, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation setConfigDisplayCurrencyAsync + * + * Set the ISO 4217 compliant display currency code for your Brevo account + * + * @param \Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response|null $ecommerceConfigDisplayCurrencyGet200Response set ISO 4217 compliant display currency code payload (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['setConfigDisplayCurrency'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function setConfigDisplayCurrencyAsync( + ?\Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response $ecommerceConfigDisplayCurrencyGet200Response = null, + string $contentType = self::contentTypes['setConfigDisplayCurrency'][0] + ): PromiseInterface + { + return $this->setConfigDisplayCurrencyAsyncWithHttpInfo($ecommerceConfigDisplayCurrencyGet200Response, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation setConfigDisplayCurrencyAsyncWithHttpInfo + * + * Set the ISO 4217 compliant display currency code for your Brevo account + * + * @param \Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response|null $ecommerceConfigDisplayCurrencyGet200Response set ISO 4217 compliant display currency code payload (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['setConfigDisplayCurrency'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function setConfigDisplayCurrencyAsyncWithHttpInfo( + $ecommerceConfigDisplayCurrencyGet200Response = null, + string $contentType = self::contentTypes['setConfigDisplayCurrency'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response'; + $request = $this->setConfigDisplayCurrencyRequest($ecommerceConfigDisplayCurrencyGet200Response, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'setConfigDisplayCurrency' + * + * @param \Brevo\Client\Models\EcommerceConfigDisplayCurrencyGet200Response|null $ecommerceConfigDisplayCurrencyGet200Response set ISO 4217 compliant display currency code payload (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['setConfigDisplayCurrency'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function setConfigDisplayCurrencyRequest( + $ecommerceConfigDisplayCurrencyGet200Response = null, + string $contentType = self::contentTypes['setConfigDisplayCurrency'][0] + ): Request + { + + + + $resourcePath = '/ecommerce/config/displayCurrency'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($ecommerceConfigDisplayCurrencyGet200Response)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($ecommerceConfigDisplayCurrencyGet200Response)); + } else { + $httpBody = $ecommerceConfigDisplayCurrencyGet200Response; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3599,7 +6825,7 @@ protected function getProductsRequest($limit = '50', $offset = '0', $sort = 'des * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/EmailCampaignsApi.php b/lib/Api/EmailCampaignsApi.php index f5cec46..c61b998 100644 --- a/lib/Api/EmailCampaignsApi.php +++ b/lib/Api/EmailCampaignsApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'deleteEmailCampaign' => [ + 'application/json', + ], + 'emailExportRecipients' => [ + 'application/json', + ], + 'getAbTestCampaignResult' => [ + 'application/json', + ], + 'getEmailCampaign' => [ + 'application/json', + ], + 'getEmailCampaigns' => [ + 'application/json', + ], + 'getSharedTemplateUrl' => [ + 'application/json', + ], + 'sendEmailCampaignNow' => [ + 'application/json', + ], + 'sendReport' => [ + 'application/json', + ], + 'sendTestEmail' => [ + 'application/json', + ], + 'updateCampaignStatus' => [ + 'application/json', + ], + 'updateEmailCampaign' => [ + 'application/json', + ], + 'uploadImageToGallery' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -92,15 +164,19 @@ public function getConfig() * * Create an email campaign * - * @param \Brevo\Client\Model\CreateEmailCampaign $emailCampaigns Values to create a campaign (required) + * @param \Brevo\Client\Models\CreateEmailCampaign $createEmailCampaign Values to create a campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEmailCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreateModel + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateModel|\Brevo\Client\Models\ErrorModel */ - public function createEmailCampaign($emailCampaigns) + public function createEmailCampaign( + \Brevo\Client\Models\CreateEmailCampaign $createEmailCampaign, + string $contentType = self::contentTypes['createEmailCampaign'][0] + ): \Brevo\Client\Models\CreateModel { - list($response) = $this->createEmailCampaignWithHttpInfo($emailCampaigns); + list($response) = $this->createEmailCampaignWithHttpInfo($createEmailCampaign, $contentType); return $response; } @@ -109,16 +185,19 @@ public function createEmailCampaign($emailCampaigns) * * Create an email campaign * - * @param \Brevo\Client\Model\CreateEmailCampaign $emailCampaigns Values to create a campaign (required) + * @param \Brevo\Client\Models\CreateEmailCampaign $createEmailCampaign Values to create a campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEmailCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function createEmailCampaignWithHttpInfo($emailCampaigns) + public function createEmailCampaignWithHttpInfo( + \Brevo\Client\Models\CreateEmailCampaign $createEmailCampaign, + string $contentType = self::contentTypes['createEmailCampaign'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreateModel'; - $request = $this->createEmailCampaignRequest($emailCampaigns); + $request = $this->createEmailCampaignRequest($createEmailCampaign, $contentType); try { $options = $this->createHttpClientOption(); @@ -127,34 +206,111 @@ public function createEmailCampaignWithHttpInfo($emailCampaigns) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreateModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreateModel'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -169,7 +325,7 @@ public function createEmailCampaignWithHttpInfo($emailCampaigns) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreateModel', + '\Brevo\Client\Models\CreateModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -177,7 +333,7 @@ public function createEmailCampaignWithHttpInfo($emailCampaigns) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -192,14 +348,18 @@ public function createEmailCampaignWithHttpInfo($emailCampaigns) * * Create an email campaign * - * @param \Brevo\Client\Model\CreateEmailCampaign $emailCampaigns Values to create a campaign (required) + * @param \Brevo\Client\Models\CreateEmailCampaign $createEmailCampaign Values to create a campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEmailCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createEmailCampaignAsync($emailCampaigns) + public function createEmailCampaignAsync( + \Brevo\Client\Models\CreateEmailCampaign $createEmailCampaign, + string $contentType = self::contentTypes['createEmailCampaign'][0] + ): PromiseInterface { - return $this->createEmailCampaignAsyncWithHttpInfo($emailCampaigns) + return $this->createEmailCampaignAsyncWithHttpInfo($createEmailCampaign, $contentType) ->then( function ($response) { return $response[0]; @@ -212,25 +372,29 @@ function ($response) { * * Create an email campaign * - * @param \Brevo\Client\Model\CreateEmailCampaign $emailCampaigns Values to create a campaign (required) + * @param \Brevo\Client\Models\CreateEmailCampaign $createEmailCampaign Values to create a campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEmailCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createEmailCampaignAsyncWithHttpInfo($emailCampaigns) + public function createEmailCampaignAsyncWithHttpInfo( + $createEmailCampaign, + string $contentType = self::contentTypes['createEmailCampaign'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreateModel'; - $request = $this->createEmailCampaignRequest($emailCampaigns); + $returnType = '\Brevo\Client\Models\CreateModel'; + $request = $this->createEmailCampaignRequest($createEmailCampaign, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -253,7 +417,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -262,20 +426,26 @@ function ($exception) { /** * Create request for operation 'createEmailCampaign' * - * @param \Brevo\Client\Model\CreateEmailCampaign $emailCampaigns Values to create a campaign (required) + * @param \Brevo\Client\Models\CreateEmailCampaign $createEmailCampaign Values to create a campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEmailCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createEmailCampaignRequest($emailCampaigns) + public function createEmailCampaignRequest( + $createEmailCampaign, + string $contentType = self::contentTypes['createEmailCampaign'][0] + ): Request { - // verify the required parameter 'emailCampaigns' is set - if ($emailCampaigns === null || (is_array($emailCampaigns) && count($emailCampaigns) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $emailCampaigns when calling createEmailCampaign' + + // verify the required parameter 'createEmailCampaign' is set + if ($createEmailCampaign === null || (is_array($createEmailCampaign) && count($createEmailCampaign) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $createEmailCampaign when calling createEmailCampaign' ); } + $resourcePath = '/emailCampaigns'; $formParams = []; $queryParams = []; @@ -285,56 +455,43 @@ protected function createEmailCampaignRequest($emailCampaigns) - // body params - $_tempBody = null; - if (isset($emailCampaigns)) { - $_tempBody = $emailCampaigns; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($createEmailCampaign)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createEmailCampaign)); + } else { + $httpBody = $createEmailCampaign; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -360,10 +517,11 @@ protected function createEmailCampaignRequest($emailCampaigns) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -375,14 +533,18 @@ protected function createEmailCampaignRequest($emailCampaigns) * Delete an email campaign * * @param int $campaignId id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmailCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function deleteEmailCampaign($campaignId) + public function deleteEmailCampaign( + int $campaignId, + string $contentType = self::contentTypes['deleteEmailCampaign'][0] + ): void { - $this->deleteEmailCampaignWithHttpInfo($campaignId); + $this->deleteEmailCampaignWithHttpInfo($campaignId, $contentType); } /** @@ -391,15 +553,18 @@ public function deleteEmailCampaign($campaignId) * Delete an email campaign * * @param int $campaignId id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmailCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteEmailCampaignWithHttpInfo($campaignId) + public function deleteEmailCampaignWithHttpInfo( + int $campaignId, + string $contentType = self::contentTypes['deleteEmailCampaign'][0] + ): array { - $returnType = ''; - $request = $this->deleteEmailCampaignRequest($campaignId); + $request = $this->deleteEmailCampaignRequest($campaignId, $contentType); try { $options = $this->createHttpClientOption(); @@ -408,43 +573,38 @@ public function deleteEmailCampaignWithHttpInfo($campaignId) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -460,13 +620,17 @@ public function deleteEmailCampaignWithHttpInfo($campaignId) * Delete an email campaign * * @param int $campaignId id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmailCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteEmailCampaignAsync($campaignId) + public function deleteEmailCampaignAsync( + int $campaignId, + string $contentType = self::contentTypes['deleteEmailCampaign'][0] + ): PromiseInterface { - return $this->deleteEmailCampaignAsyncWithHttpInfo($campaignId) + return $this->deleteEmailCampaignAsyncWithHttpInfo($campaignId, $contentType) ->then( function ($response) { return $response[0]; @@ -480,14 +644,19 @@ function ($response) { * Delete an email campaign * * @param int $campaignId id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmailCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteEmailCampaignAsyncWithHttpInfo($campaignId) + public function deleteEmailCampaignAsyncWithHttpInfo( + $campaignId, + string $contentType = self::contentTypes['deleteEmailCampaign'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->deleteEmailCampaignRequest($campaignId); + $request = $this->deleteEmailCampaignRequest($campaignId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -506,7 +675,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -516,19 +685,25 @@ function ($exception) { * Create request for operation 'deleteEmailCampaign' * * @param int $campaignId id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmailCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function deleteEmailCampaignRequest($campaignId) + public function deleteEmailCampaignRequest( + $campaignId, + string $contentType = self::contentTypes['deleteEmailCampaign'][0] + ): Request { + // verify the required parameter 'campaignId' is set if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $campaignId when calling deleteEmailCampaign' ); } + $resourcePath = '/emailCampaigns/{campaignId}'; $formParams = []; $queryParams = []; @@ -537,6 +712,7 @@ protected function deleteEmailCampaignRequest($campaignId) $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( @@ -546,53 +722,35 @@ protected function deleteEmailCampaignRequest($campaignId) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -618,10 +776,11 @@ protected function deleteEmailCampaignRequest($campaignId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -633,15 +792,20 @@ protected function deleteEmailCampaignRequest($campaignId) * Export the recipients of an email campaign * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\EmailExportRecipients $recipientExport Values to send for a recipient export request (optional) + * @param \Brevo\Client\Models\EmailExportRecipients|null $emailExportRecipients Values to send for a recipient export request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailExportRecipients'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreatedProcessId + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreatedProcessId|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function emailExportRecipients($campaignId, $recipientExport = null) + public function emailExportRecipients( + int $campaignId, + ?\Brevo\Client\Models\EmailExportRecipients $emailExportRecipients = null, + string $contentType = self::contentTypes['emailExportRecipients'][0] + ): \Brevo\Client\Models\CreatedProcessId { - list($response) = $this->emailExportRecipientsWithHttpInfo($campaignId, $recipientExport); + list($response) = $this->emailExportRecipientsWithHttpInfo($campaignId, $emailExportRecipients, $contentType); return $response; } @@ -651,16 +815,20 @@ public function emailExportRecipients($campaignId, $recipientExport = null) * Export the recipients of an email campaign * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\EmailExportRecipients $recipientExport Values to send for a recipient export request (optional) + * @param \Brevo\Client\Models\EmailExportRecipients|null $emailExportRecipients Values to send for a recipient export request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailExportRecipients'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreatedProcessId, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreatedProcessId|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function emailExportRecipientsWithHttpInfo($campaignId, $recipientExport = null) + public function emailExportRecipientsWithHttpInfo( + int $campaignId, + ?\Brevo\Client\Models\EmailExportRecipients $emailExportRecipients = null, + string $contentType = self::contentTypes['emailExportRecipients'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreatedProcessId'; - $request = $this->emailExportRecipientsRequest($campaignId, $recipientExport); + $request = $this->emailExportRecipientsRequest($campaignId, $emailExportRecipients, $contentType); try { $options = $this->createHttpClientOption(); @@ -669,34 +837,138 @@ public function emailExportRecipientsWithHttpInfo($campaignId, $recipientExport } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 202: + if (in_array('\Brevo\Client\Models\CreatedProcessId', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreatedProcessId' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreatedProcessId', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreatedProcessId'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -711,7 +983,7 @@ public function emailExportRecipientsWithHttpInfo($campaignId, $recipientExport case 202: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreatedProcessId', + '\Brevo\Client\Models\CreatedProcessId', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -719,7 +991,7 @@ public function emailExportRecipientsWithHttpInfo($campaignId, $recipientExport case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -727,7 +999,7 @@ public function emailExportRecipientsWithHttpInfo($campaignId, $recipientExport case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -743,14 +1015,19 @@ public function emailExportRecipientsWithHttpInfo($campaignId, $recipientExport * Export the recipients of an email campaign * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\EmailExportRecipients $recipientExport Values to send for a recipient export request (optional) + * @param \Brevo\Client\Models\EmailExportRecipients|null $emailExportRecipients Values to send for a recipient export request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailExportRecipients'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function emailExportRecipientsAsync($campaignId, $recipientExport = null) + public function emailExportRecipientsAsync( + int $campaignId, + ?\Brevo\Client\Models\EmailExportRecipients $emailExportRecipients = null, + string $contentType = self::contentTypes['emailExportRecipients'][0] + ): PromiseInterface { - return $this->emailExportRecipientsAsyncWithHttpInfo($campaignId, $recipientExport) + return $this->emailExportRecipientsAsyncWithHttpInfo($campaignId, $emailExportRecipients, $contentType) ->then( function ($response) { return $response[0]; @@ -764,25 +1041,30 @@ function ($response) { * Export the recipients of an email campaign * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\EmailExportRecipients $recipientExport Values to send for a recipient export request (optional) + * @param \Brevo\Client\Models\EmailExportRecipients|null $emailExportRecipients Values to send for a recipient export request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailExportRecipients'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function emailExportRecipientsAsyncWithHttpInfo($campaignId, $recipientExport = null) + public function emailExportRecipientsAsyncWithHttpInfo( + $campaignId, + $emailExportRecipients = null, + string $contentType = self::contentTypes['emailExportRecipients'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreatedProcessId'; - $request = $this->emailExportRecipientsRequest($campaignId, $recipientExport); + $returnType = '\Brevo\Client\Models\CreatedProcessId'; + $request = $this->emailExportRecipientsRequest($campaignId, $emailExportRecipients, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -805,7 +1087,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -815,20 +1097,28 @@ function ($exception) { * Create request for operation 'emailExportRecipients' * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\EmailExportRecipients $recipientExport Values to send for a recipient export request (optional) + * @param \Brevo\Client\Models\EmailExportRecipients|null $emailExportRecipients Values to send for a recipient export request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailExportRecipients'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function emailExportRecipientsRequest($campaignId, $recipientExport = null) + public function emailExportRecipientsRequest( + $campaignId, + $emailExportRecipients = null, + string $contentType = self::contentTypes['emailExportRecipients'][0] + ): Request { + // verify the required parameter 'campaignId' is set if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $campaignId when calling emailExportRecipients' ); } + + $resourcePath = '/emailCampaigns/{campaignId}/exportRecipients'; $formParams = []; $queryParams = []; @@ -837,6 +1127,7 @@ protected function emailExportRecipientsRequest($campaignId, $recipientExport = $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( @@ -846,56 +1137,42 @@ protected function emailExportRecipientsRequest($campaignId, $recipientExport = ); } - // 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'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($emailExportRecipients)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($emailExportRecipients)); + } else { + $httpBody = $emailExportRecipients; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -921,10 +1198,11 @@ protected function emailExportRecipientsRequest($campaignId, $recipientExport = $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -936,14 +1214,18 @@ protected function emailExportRecipientsRequest($campaignId, $recipientExport = * Get an A/B test email campaign results * * @param int $campaignId Id of the A/B test campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAbTestCampaignResult'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\AbTestCampaignResult + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\AbTestCampaignResult|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function getAbTestCampaignResult($campaignId) + public function getAbTestCampaignResult( + int $campaignId, + string $contentType = self::contentTypes['getAbTestCampaignResult'][0] + ): \Brevo\Client\Models\AbTestCampaignResult { - list($response) = $this->getAbTestCampaignResultWithHttpInfo($campaignId); + list($response) = $this->getAbTestCampaignResultWithHttpInfo($campaignId, $contentType); return $response; } @@ -953,15 +1235,18 @@ public function getAbTestCampaignResult($campaignId) * Get an A/B test email campaign results * * @param int $campaignId Id of the A/B test campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAbTestCampaignResult'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\AbTestCampaignResult, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\AbTestCampaignResult|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getAbTestCampaignResultWithHttpInfo($campaignId) + public function getAbTestCampaignResultWithHttpInfo( + int $campaignId, + string $contentType = self::contentTypes['getAbTestCampaignResult'][0] + ): array { - $returnType = '\Brevo\Client\Model\AbTestCampaignResult'; - $request = $this->getAbTestCampaignResultRequest($campaignId); + $request = $this->getAbTestCampaignResultRequest($campaignId, $contentType); try { $options = $this->createHttpClientOption(); @@ -970,34 +1255,138 @@ public function getAbTestCampaignResultWithHttpInfo($campaignId) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\AbTestCampaignResult', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\AbTestCampaignResult' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\AbTestCampaignResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\AbTestCampaignResult'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1012,15 +1401,7 @@ public function getAbTestCampaignResultWithHttpInfo($campaignId) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\AbTestCampaignResult', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\AbTestCampaignResult', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1028,15 +1409,15 @@ public function getAbTestCampaignResultWithHttpInfo($campaignId) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 405: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1052,13 +1433,17 @@ public function getAbTestCampaignResultWithHttpInfo($campaignId) * Get an A/B test email campaign results * * @param int $campaignId Id of the A/B test campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAbTestCampaignResult'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getAbTestCampaignResultAsync($campaignId) + public function getAbTestCampaignResultAsync( + int $campaignId, + string $contentType = self::contentTypes['getAbTestCampaignResult'][0] + ): PromiseInterface { - return $this->getAbTestCampaignResultAsyncWithHttpInfo($campaignId) + return $this->getAbTestCampaignResultAsyncWithHttpInfo($campaignId, $contentType) ->then( function ($response) { return $response[0]; @@ -1072,24 +1457,28 @@ function ($response) { * Get an A/B test email campaign results * * @param int $campaignId Id of the A/B test campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAbTestCampaignResult'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getAbTestCampaignResultAsyncWithHttpInfo($campaignId) + public function getAbTestCampaignResultAsyncWithHttpInfo( + $campaignId, + string $contentType = self::contentTypes['getAbTestCampaignResult'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\AbTestCampaignResult'; - $request = $this->getAbTestCampaignResultRequest($campaignId); + $returnType = '\Brevo\Client\Models\AbTestCampaignResult'; + $request = $this->getAbTestCampaignResultRequest($campaignId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1112,7 +1501,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1122,19 +1511,25 @@ function ($exception) { * Create request for operation 'getAbTestCampaignResult' * * @param int $campaignId Id of the A/B test campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAbTestCampaignResult'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getAbTestCampaignResultRequest($campaignId) + public function getAbTestCampaignResultRequest( + $campaignId, + string $contentType = self::contentTypes['getAbTestCampaignResult'][0] + ): Request { + // verify the required parameter 'campaignId' is set if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $campaignId when calling getAbTestCampaignResult' ); } + $resourcePath = '/emailCampaigns/{campaignId}/abTestCampaignResult'; $formParams = []; $queryParams = []; @@ -1143,6 +1538,7 @@ protected function getAbTestCampaignResultRequest($campaignId) $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( @@ -1152,53 +1548,35 @@ protected function getAbTestCampaignResultRequest($campaignId) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1224,10 +1602,11 @@ protected function getAbTestCampaignResultRequest($campaignId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1239,15 +1618,20 @@ protected function getAbTestCampaignResultRequest($campaignId) * Get an email campaign report * * @param int $campaignId Id of the campaign (required) - * @param string $statistics Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. (optional) + * @param string|null $statistics Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetEmailCampaign + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetEmailCampaign|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function getEmailCampaign($campaignId, $statistics = null) + public function getEmailCampaign( + int $campaignId, + ?string $statistics = null, + string $contentType = self::contentTypes['getEmailCampaign'][0] + ): \Brevo\Client\Models\GetEmailCampaign { - list($response) = $this->getEmailCampaignWithHttpInfo($campaignId, $statistics); + list($response) = $this->getEmailCampaignWithHttpInfo($campaignId, $statistics, $contentType); return $response; } @@ -1257,16 +1641,20 @@ public function getEmailCampaign($campaignId, $statistics = null) * Get an email campaign report * * @param int $campaignId Id of the campaign (required) - * @param string $statistics Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. (optional) + * @param string|null $statistics Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetEmailCampaign, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetEmailCampaign|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getEmailCampaignWithHttpInfo($campaignId, $statistics = null) + public function getEmailCampaignWithHttpInfo( + int $campaignId, + ?string $statistics = null, + string $contentType = self::contentTypes['getEmailCampaign'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetEmailCampaign'; - $request = $this->getEmailCampaignRequest($campaignId, $statistics); + $request = $this->getEmailCampaignRequest($campaignId, $statistics, $contentType); try { $options = $this->createHttpClientOption(); @@ -1275,34 +1663,138 @@ public function getEmailCampaignWithHttpInfo($campaignId, $statistics = null) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetEmailCampaign', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetEmailCampaign' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetEmailCampaign', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetEmailCampaign'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1317,23 +1809,23 @@ public function getEmailCampaignWithHttpInfo($campaignId, $statistics = null) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetEmailCampaign', + '\Brevo\Client\Models\GetEmailCampaign', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1349,14 +1841,19 @@ public function getEmailCampaignWithHttpInfo($campaignId, $statistics = null) * Get an email campaign report * * @param int $campaignId Id of the campaign (required) - * @param string $statistics Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. (optional) + * @param string|null $statistics Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getEmailCampaignAsync($campaignId, $statistics = null) + public function getEmailCampaignAsync( + int $campaignId, + ?string $statistics = null, + string $contentType = self::contentTypes['getEmailCampaign'][0] + ): PromiseInterface { - return $this->getEmailCampaignAsyncWithHttpInfo($campaignId, $statistics) + return $this->getEmailCampaignAsyncWithHttpInfo($campaignId, $statistics, $contentType) ->then( function ($response) { return $response[0]; @@ -1370,25 +1867,30 @@ function ($response) { * Get an email campaign report * * @param int $campaignId Id of the campaign (required) - * @param string $statistics Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. (optional) + * @param string|null $statistics Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getEmailCampaignAsyncWithHttpInfo($campaignId, $statistics = null) + public function getEmailCampaignAsyncWithHttpInfo( + $campaignId, + $statistics = null, + string $contentType = self::contentTypes['getEmailCampaign'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetEmailCampaign'; - $request = $this->getEmailCampaignRequest($campaignId, $statistics); + $returnType = '\Brevo\Client\Models\GetEmailCampaign'; + $request = $this->getEmailCampaignRequest($campaignId, $statistics, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1411,7 +1913,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1421,20 +1923,28 @@ function ($exception) { * Create request for operation 'getEmailCampaign' * * @param int $campaignId Id of the campaign (required) - * @param string $statistics Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. (optional) + * @param string|null $statistics Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getEmailCampaignRequest($campaignId, $statistics = null) + public function getEmailCampaignRequest( + $campaignId, + $statistics = null, + string $contentType = self::contentTypes['getEmailCampaign'][0] + ): Request { + // verify the required parameter 'campaignId' is set if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $campaignId when calling getEmailCampaign' ); } + + $resourcePath = '/emailCampaigns/{campaignId}'; $formParams = []; $queryParams = []; @@ -1443,9 +1953,15 @@ protected function getEmailCampaignRequest($campaignId, $statistics = null) $multipart = false; // query params - if ($statistics !== null) { - $queryParams['statistics'] = ObjectSerializer::toQueryValue($statistics); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $statistics, + 'statistics', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // path params if ($campaignId !== null) { @@ -1456,53 +1972,35 @@ protected function getEmailCampaignRequest($campaignId, $statistics = null) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1528,10 +2026,11 @@ protected function getEmailCampaignRequest($campaignId, $statistics = null) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1542,23 +2041,35 @@ protected function getEmailCampaignRequest($campaignId, $statistics = null) * * Return all your created email campaigns * - * @param string $type Filter on the type of the campaigns (optional) - * @param string $status Filter on the status of the campaign (optional) - * @param string $statistics Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. (optional) - * @param string $startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) - * @param string $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param bool $excludeHtmlContent Use this flag to exclude htmlContent from the response body. If set to **true**, htmlContent field will be returned as empty string in the response body (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetEmailCampaigns + * @param string|null $type Filter on the type of the campaigns (optional) + * @param string|null $status Filter on the status of the campaign (optional) + * @param string|null $statistics Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response.This option only returns data for events occurred in the last 6 months.For older campaigns, it’s advisable to use the **Get Campaign Report** endpoint. (optional) + * @param string|null $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) + * @param string|null $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param bool|null $excludeHtmlContent Use this flag to exclude htmlContent from the response body. If set to **true**, htmlContent field will be returned as empty string in the response body (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailCampaigns'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetEmailCampaigns|\Brevo\Client\Models\ErrorModel */ - public function getEmailCampaigns($type = null, $status = null, $statistics = null, $startDate = null, $endDate = null, $limit = '50', $offset = '0', $sort = 'desc', $excludeHtmlContent = null) + public function getEmailCampaigns( + ?string $type = null, + ?string $status = null, + ?string $statistics = null, + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + ?bool $excludeHtmlContent = null, + string $contentType = self::contentTypes['getEmailCampaigns'][0] + ): \Brevo\Client\Models\GetEmailCampaigns { - list($response) = $this->getEmailCampaignsWithHttpInfo($type, $status, $statistics, $startDate, $endDate, $limit, $offset, $sort, $excludeHtmlContent); + list($response) = $this->getEmailCampaignsWithHttpInfo($type, $status, $statistics, $startDate, $endDate, $limit, $offset, $sort, $excludeHtmlContent, $contentType); return $response; } @@ -1567,24 +2078,35 @@ public function getEmailCampaigns($type = null, $status = null, $statistics = nu * * Return all your created email campaigns * - * @param string $type Filter on the type of the campaigns (optional) - * @param string $status Filter on the status of the campaign (optional) - * @param string $statistics Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. (optional) - * @param string $startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) - * @param string $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param bool $excludeHtmlContent Use this flag to exclude htmlContent from the response body. If set to **true**, htmlContent field will be returned as empty string in the response body (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetEmailCampaigns, HTTP status code, HTTP response headers (array of strings) + * @param string|null $type Filter on the type of the campaigns (optional) + * @param string|null $status Filter on the status of the campaign (optional) + * @param string|null $statistics Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response.This option only returns data for events occurred in the last 6 months.For older campaigns, it’s advisable to use the **Get Campaign Report** endpoint. (optional) + * @param string|null $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) + * @param string|null $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param bool|null $excludeHtmlContent Use this flag to exclude htmlContent from the response body. If set to **true**, htmlContent field will be returned as empty string in the response body (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailCampaigns'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetEmailCampaigns|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getEmailCampaignsWithHttpInfo($type = null, $status = null, $statistics = null, $startDate = null, $endDate = null, $limit = '50', $offset = '0', $sort = 'desc', $excludeHtmlContent = null) + public function getEmailCampaignsWithHttpInfo( + ?string $type = null, + ?string $status = null, + ?string $statistics = null, + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + ?bool $excludeHtmlContent = null, + string $contentType = self::contentTypes['getEmailCampaigns'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetEmailCampaigns'; - $request = $this->getEmailCampaignsRequest($type, $status, $statistics, $startDate, $endDate, $limit, $offset, $sort, $excludeHtmlContent); + $request = $this->getEmailCampaignsRequest($type, $status, $statistics, $startDate, $endDate, $limit, $offset, $sort, $excludeHtmlContent, $contentType); try { $options = $this->createHttpClientOption(); @@ -1593,34 +2115,111 @@ public function getEmailCampaignsWithHttpInfo($type = null, $status = null, $sta } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetEmailCampaigns', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetEmailCampaigns' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetEmailCampaigns', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetEmailCampaigns'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1635,7 +2234,7 @@ public function getEmailCampaignsWithHttpInfo($type = null, $status = null, $sta case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetEmailCampaigns', + '\Brevo\Client\Models\GetEmailCampaigns', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1643,7 +2242,7 @@ public function getEmailCampaignsWithHttpInfo($type = null, $status = null, $sta case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1658,22 +2257,34 @@ public function getEmailCampaignsWithHttpInfo($type = null, $status = null, $sta * * Return all your created email campaigns * - * @param string $type Filter on the type of the campaigns (optional) - * @param string $status Filter on the status of the campaign (optional) - * @param string $statistics Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. (optional) - * @param string $startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) - * @param string $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param bool $excludeHtmlContent Use this flag to exclude htmlContent from the response body. If set to **true**, htmlContent field will be returned as empty string in the response body (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @param string|null $type Filter on the type of the campaigns (optional) + * @param string|null $status Filter on the status of the campaign (optional) + * @param string|null $statistics Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response.This option only returns data for events occurred in the last 6 months.For older campaigns, it’s advisable to use the **Get Campaign Report** endpoint. (optional) + * @param string|null $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) + * @param string|null $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param bool|null $excludeHtmlContent Use this flag to exclude htmlContent from the response body. If set to **true**, htmlContent field will be returned as empty string in the response body (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailCampaigns'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getEmailCampaignsAsync($type = null, $status = null, $statistics = null, $startDate = null, $endDate = null, $limit = '50', $offset = '0', $sort = 'desc', $excludeHtmlContent = null) + public function getEmailCampaignsAsync( + ?string $type = null, + ?string $status = null, + ?string $statistics = null, + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + ?bool $excludeHtmlContent = null, + string $contentType = self::contentTypes['getEmailCampaigns'][0] + ): PromiseInterface { - return $this->getEmailCampaignsAsyncWithHttpInfo($type, $status, $statistics, $startDate, $endDate, $limit, $offset, $sort, $excludeHtmlContent) + return $this->getEmailCampaignsAsyncWithHttpInfo($type, $status, $statistics, $startDate, $endDate, $limit, $offset, $sort, $excludeHtmlContent, $contentType) ->then( function ($response) { return $response[0]; @@ -1686,33 +2297,45 @@ function ($response) { * * Return all your created email campaigns * - * @param string $type Filter on the type of the campaigns (optional) - * @param string $status Filter on the status of the campaign (optional) - * @param string $statistics Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. (optional) - * @param string $startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) - * @param string $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param bool $excludeHtmlContent Use this flag to exclude htmlContent from the response body. If set to **true**, htmlContent field will be returned as empty string in the response body (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @param string|null $type Filter on the type of the campaigns (optional) + * @param string|null $status Filter on the status of the campaign (optional) + * @param string|null $statistics Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response.This option only returns data for events occurred in the last 6 months.For older campaigns, it’s advisable to use the **Get Campaign Report** endpoint. (optional) + * @param string|null $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) + * @param string|null $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param bool|null $excludeHtmlContent Use this flag to exclude htmlContent from the response body. If set to **true**, htmlContent field will be returned as empty string in the response body (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailCampaigns'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getEmailCampaignsAsyncWithHttpInfo($type = null, $status = null, $statistics = null, $startDate = null, $endDate = null, $limit = '50', $offset = '0', $sort = 'desc', $excludeHtmlContent = null) + public function getEmailCampaignsAsyncWithHttpInfo( + $type = null, + $status = null, + $statistics = null, + $startDate = null, + $endDate = null, + $limit = 50, + $offset = 0, + $sort = 'desc', + $excludeHtmlContent = null, + string $contentType = self::contentTypes['getEmailCampaigns'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetEmailCampaigns'; - $request = $this->getEmailCampaignsRequest($type, $status, $statistics, $startDate, $endDate, $limit, $offset, $sort, $excludeHtmlContent); + $returnType = '\Brevo\Client\Models\GetEmailCampaigns'; + $request = $this->getEmailCampaignsRequest($type, $status, $statistics, $startDate, $endDate, $limit, $offset, $sort, $excludeHtmlContent, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1735,7 +2358,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1744,27 +2367,48 @@ function ($exception) { /** * 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 string $statistics Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. (optional) - * @param string $startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) - * @param string $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param bool $excludeHtmlContent Use this flag to exclude htmlContent from the response body. If set to **true**, htmlContent field will be returned as empty string in the response body (optional) - * - * @throws \InvalidArgumentException + * @param string|null $type Filter on the type of the campaigns (optional) + * @param string|null $status Filter on the status of the campaign (optional) + * @param string|null $statistics Filter on the type of statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response.This option only returns data for events occurred in the last 6 months.For older campaigns, it’s advisable to use the **Get Campaign Report** endpoint. (optional) + * @param string|null $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) + * @param string|null $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param bool|null $excludeHtmlContent Use this flag to exclude htmlContent from the response body. If set to **true**, htmlContent field will be returned as empty string in the response body (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailCampaigns'] to see the possible values for this operation + * + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getEmailCampaignsRequest($type = null, $status = null, $statistics = null, $startDate = null, $endDate = null, $limit = '50', $offset = '0', $sort = 'desc', $excludeHtmlContent = null) + public function getEmailCampaignsRequest( + $type = null, + $status = null, + $statistics = null, + $startDate = null, + $endDate = null, + $limit = 50, + $offset = 0, + $sort = 'desc', + $excludeHtmlContent = null, + string $contentType = self::contentTypes['getEmailCampaigns'][0] + ): Request { + + + + + + if ($limit !== null && $limit > 100) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling EmailCampaignsApi.getEmailCampaigns, must be smaller than or equal to 100.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling EmailCampaignsApi.getEmailCampaigns, must be smaller than or equal to 100.'); } if ($limit !== null && $limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling EmailCampaignsApi.getEmailCampaigns, must be bigger than or equal to 0.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling EmailCampaignsApi.getEmailCampaigns, must be bigger than or equal to 0.'); } + + + $resourcePath = '/emailCampaigns'; @@ -1775,90 +2419,118 @@ protected function getEmailCampaignsRequest($type = null, $status = null, $stati $multipart = false; // query params - if ($type !== null) { - $queryParams['type'] = ObjectSerializer::toQueryValue($type); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $type, + 'type', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($status !== null) { - $queryParams['status'] = ObjectSerializer::toQueryValue($status); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $status, + 'status', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($statistics !== null) { - $queryParams['statistics'] = ObjectSerializer::toQueryValue($statistics); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $statistics, + 'statistics', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($startDate !== null) { - $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($endDate !== null) { - $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($excludeHtmlContent !== null) { - $queryParams['excludeHtmlContent'] = ObjectSerializer::toQueryValue($excludeHtmlContent); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $excludeHtmlContent, + 'excludeHtmlContent', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1884,10 +2556,11 @@ protected function getEmailCampaignsRequest($type = null, $status = null, $stati $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1899,14 +2572,18 @@ protected function getEmailCampaignsRequest($type = null, $status = null, $stati * Get a shared template url * * @param int $campaignId Id of the campaign or template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSharedTemplateUrl'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetSharedTemplateUrl + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetSharedTemplateUrl|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function getSharedTemplateUrl($campaignId) + public function getSharedTemplateUrl( + int $campaignId, + string $contentType = self::contentTypes['getSharedTemplateUrl'][0] + ): \Brevo\Client\Models\GetSharedTemplateUrl { - list($response) = $this->getSharedTemplateUrlWithHttpInfo($campaignId); + list($response) = $this->getSharedTemplateUrlWithHttpInfo($campaignId, $contentType); return $response; } @@ -1916,15 +2593,18 @@ public function getSharedTemplateUrl($campaignId) * Get a shared template url * * @param int $campaignId Id of the campaign or template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSharedTemplateUrl'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetSharedTemplateUrl, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetSharedTemplateUrl|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getSharedTemplateUrlWithHttpInfo($campaignId) + public function getSharedTemplateUrlWithHttpInfo( + int $campaignId, + string $contentType = self::contentTypes['getSharedTemplateUrl'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetSharedTemplateUrl'; - $request = $this->getSharedTemplateUrlRequest($campaignId); + $request = $this->getSharedTemplateUrlRequest($campaignId, $contentType); try { $options = $this->createHttpClientOption(); @@ -1933,34 +2613,165 @@ public function getSharedTemplateUrlWithHttpInfo($campaignId) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetSharedTemplateUrl', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetSharedTemplateUrl' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetSharedTemplateUrl', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 405: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetSharedTemplateUrl'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1975,7 +2786,15 @@ public function getSharedTemplateUrlWithHttpInfo($campaignId) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetSharedTemplateUrl', + '\Brevo\Client\Models\GetSharedTemplateUrl', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1983,15 +2802,15 @@ public function getSharedTemplateUrlWithHttpInfo($campaignId) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 405: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2007,13 +2826,17 @@ public function getSharedTemplateUrlWithHttpInfo($campaignId) * Get a shared template url * * @param int $campaignId Id of the campaign or template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSharedTemplateUrl'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getSharedTemplateUrlAsync($campaignId) + public function getSharedTemplateUrlAsync( + int $campaignId, + string $contentType = self::contentTypes['getSharedTemplateUrl'][0] + ): PromiseInterface { - return $this->getSharedTemplateUrlAsyncWithHttpInfo($campaignId) + return $this->getSharedTemplateUrlAsyncWithHttpInfo($campaignId, $contentType) ->then( function ($response) { return $response[0]; @@ -2027,24 +2850,28 @@ function ($response) { * Get a shared template url * * @param int $campaignId Id of the campaign or template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSharedTemplateUrl'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getSharedTemplateUrlAsyncWithHttpInfo($campaignId) + public function getSharedTemplateUrlAsyncWithHttpInfo( + $campaignId, + string $contentType = self::contentTypes['getSharedTemplateUrl'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetSharedTemplateUrl'; - $request = $this->getSharedTemplateUrlRequest($campaignId); + $returnType = '\Brevo\Client\Models\GetSharedTemplateUrl'; + $request = $this->getSharedTemplateUrlRequest($campaignId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2067,7 +2894,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2077,19 +2904,25 @@ function ($exception) { * Create request for operation 'getSharedTemplateUrl' * * @param int $campaignId Id of the campaign or template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSharedTemplateUrl'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getSharedTemplateUrlRequest($campaignId) + public function getSharedTemplateUrlRequest( + $campaignId, + string $contentType = self::contentTypes['getSharedTemplateUrl'][0] + ): Request { + // verify the required parameter 'campaignId' is set if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $campaignId when calling getSharedTemplateUrl' ); } + $resourcePath = '/emailCampaigns/{campaignId}/sharedUrl'; $formParams = []; $queryParams = []; @@ -2098,6 +2931,7 @@ protected function getSharedTemplateUrlRequest($campaignId) $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( @@ -2107,53 +2941,35 @@ protected function getSharedTemplateUrlRequest($campaignId) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2179,10 +2995,11 @@ protected function getSharedTemplateUrlRequest($campaignId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2194,14 +3011,18 @@ protected function getSharedTemplateUrlRequest($campaignId) * Send an email campaign immediately, based on campaignId * * @param int $campaignId Id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailCampaignNow'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function sendEmailCampaignNow($campaignId) + public function sendEmailCampaignNow( + int $campaignId, + string $contentType = self::contentTypes['sendEmailCampaignNow'][0] + ): void { - $this->sendEmailCampaignNowWithHttpInfo($campaignId); + $this->sendEmailCampaignNowWithHttpInfo($campaignId, $contentType); } /** @@ -2210,15 +3031,18 @@ public function sendEmailCampaignNow($campaignId) * Send an email campaign immediately, based on campaignId * * @param int $campaignId Id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailCampaignNow'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function sendEmailCampaignNowWithHttpInfo($campaignId) + public function sendEmailCampaignNowWithHttpInfo( + int $campaignId, + string $contentType = self::contentTypes['sendEmailCampaignNow'][0] + ): array { - $returnType = ''; - $request = $this->sendEmailCampaignNowRequest($campaignId); + $request = $this->sendEmailCampaignNowRequest($campaignId, $contentType); try { $options = $this->createHttpClientOption(); @@ -2227,26 +3051,21 @@ public function sendEmailCampaignNowWithHttpInfo($campaignId) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -2255,7 +3074,7 @@ public function sendEmailCampaignNowWithHttpInfo($campaignId) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2263,7 +3082,7 @@ public function sendEmailCampaignNowWithHttpInfo($campaignId) case 402: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2271,7 +3090,7 @@ public function sendEmailCampaignNowWithHttpInfo($campaignId) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2287,13 +3106,17 @@ public function sendEmailCampaignNowWithHttpInfo($campaignId) * Send an email campaign immediately, based on campaignId * * @param int $campaignId Id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailCampaignNow'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendEmailCampaignNowAsync($campaignId) + public function sendEmailCampaignNowAsync( + int $campaignId, + string $contentType = self::contentTypes['sendEmailCampaignNow'][0] + ): PromiseInterface { - return $this->sendEmailCampaignNowAsyncWithHttpInfo($campaignId) + return $this->sendEmailCampaignNowAsyncWithHttpInfo($campaignId, $contentType) ->then( function ($response) { return $response[0]; @@ -2307,14 +3130,19 @@ function ($response) { * Send an email campaign immediately, based on campaignId * * @param int $campaignId Id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailCampaignNow'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendEmailCampaignNowAsyncWithHttpInfo($campaignId) + public function sendEmailCampaignNowAsyncWithHttpInfo( + $campaignId, + string $contentType = self::contentTypes['sendEmailCampaignNow'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->sendEmailCampaignNowRequest($campaignId); + $request = $this->sendEmailCampaignNowRequest($campaignId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2333,7 +3161,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2343,19 +3171,25 @@ function ($exception) { * Create request for operation 'sendEmailCampaignNow' * * @param int $campaignId Id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailCampaignNow'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function sendEmailCampaignNowRequest($campaignId) + public function sendEmailCampaignNowRequest( + $campaignId, + string $contentType = self::contentTypes['sendEmailCampaignNow'][0] + ): Request { + // verify the required parameter 'campaignId' is set if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $campaignId when calling sendEmailCampaignNow' ); } + $resourcePath = '/emailCampaigns/{campaignId}/sendNow'; $formParams = []; $queryParams = []; @@ -2364,6 +3198,7 @@ protected function sendEmailCampaignNowRequest($campaignId) $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( @@ -2373,53 +3208,35 @@ protected function sendEmailCampaignNowRequest($campaignId) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2445,10 +3262,11 @@ protected function sendEmailCampaignNowRequest($campaignId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2460,15 +3278,20 @@ protected function sendEmailCampaignNowRequest($campaignId) * Send the report of a campaign * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\SendReport $sendReport Values for send a report (required) + * @param \Brevo\Client\Models\SendReport $sendReport Values for send a report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendReport'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function sendReport($campaignId, $sendReport) + public function sendReport( + int $campaignId, + \Brevo\Client\Models\SendReport $sendReport, + string $contentType = self::contentTypes['sendReport'][0] + ): void { - $this->sendReportWithHttpInfo($campaignId, $sendReport); + $this->sendReportWithHttpInfo($campaignId, $sendReport, $contentType); } /** @@ -2477,16 +3300,20 @@ public function sendReport($campaignId, $sendReport) * Send the report of a campaign * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\SendReport $sendReport Values for send a report (required) + * @param \Brevo\Client\Models\SendReport $sendReport Values for send a report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendReport'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function sendReportWithHttpInfo($campaignId, $sendReport) + public function sendReportWithHttpInfo( + int $campaignId, + \Brevo\Client\Models\SendReport $sendReport, + string $contentType = self::contentTypes['sendReport'][0] + ): array { - $returnType = ''; - $request = $this->sendReportRequest($campaignId, $sendReport); + $request = $this->sendReportRequest($campaignId, $sendReport, $contentType); try { $options = $this->createHttpClientOption(); @@ -2495,26 +3322,21 @@ public function sendReportWithHttpInfo($campaignId, $sendReport) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -2523,7 +3345,7 @@ public function sendReportWithHttpInfo($campaignId, $sendReport) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2531,7 +3353,7 @@ public function sendReportWithHttpInfo($campaignId, $sendReport) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2547,14 +3369,19 @@ public function sendReportWithHttpInfo($campaignId, $sendReport) * Send the report of a campaign * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\SendReport $sendReport Values for send a report (required) + * @param \Brevo\Client\Models\SendReport $sendReport Values for send a report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendReport'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendReportAsync($campaignId, $sendReport) + public function sendReportAsync( + int $campaignId, + \Brevo\Client\Models\SendReport $sendReport, + string $contentType = self::contentTypes['sendReport'][0] + ): PromiseInterface { - return $this->sendReportAsyncWithHttpInfo($campaignId, $sendReport) + return $this->sendReportAsyncWithHttpInfo($campaignId, $sendReport, $contentType) ->then( function ($response) { return $response[0]; @@ -2568,15 +3395,21 @@ function ($response) { * Send the report of a campaign * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\SendReport $sendReport Values for send a report (required) + * @param \Brevo\Client\Models\SendReport $sendReport Values for send a report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendReport'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendReportAsyncWithHttpInfo($campaignId, $sendReport) + public function sendReportAsyncWithHttpInfo( + $campaignId, + $sendReport, + string $contentType = self::contentTypes['sendReport'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->sendReportRequest($campaignId, $sendReport); + $request = $this->sendReportRequest($campaignId, $sendReport, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2595,7 +3428,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2605,26 +3438,34 @@ function ($exception) { * Create request for operation 'sendReport' * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\SendReport $sendReport Values for send a report (required) + * @param \Brevo\Client\Models\SendReport $sendReport Values for send a report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendReport'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function sendReportRequest($campaignId, $sendReport) + public function sendReportRequest( + $campaignId, + $sendReport, + string $contentType = self::contentTypes['sendReport'][0] + ): Request { + // verify the required parameter 'campaignId' is set if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $campaignId when calling sendReport' ); } + // verify the required parameter 'sendReport' is set if ($sendReport === null || (is_array($sendReport) && count($sendReport) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $sendReport when calling sendReport' ); } + $resourcePath = '/emailCampaigns/{campaignId}/sendReport'; $formParams = []; $queryParams = []; @@ -2633,6 +3474,7 @@ protected function sendReportRequest($campaignId, $sendReport) $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( @@ -2642,56 +3484,42 @@ protected function sendReportRequest($campaignId, $sendReport) ); } - // 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'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($sendReport)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($sendReport)); + } else { + $httpBody = $sendReport; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2717,10 +3545,11 @@ protected function sendReportRequest($campaignId, $sendReport) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2732,15 +3561,20 @@ protected function sendReportRequest($campaignId, $sendReport) * Send an email campaign to your test list * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\SendTestEmail $emailTo emailTo (required) + * @param \Brevo\Client\Models\SendTestEmail $sendTestEmail sendTestEmail (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestEmail'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function sendTestEmail($campaignId, $emailTo) + public function sendTestEmail( + int $campaignId, + \Brevo\Client\Models\SendTestEmail $sendTestEmail, + string $contentType = self::contentTypes['sendTestEmail'][0] + ): void { - $this->sendTestEmailWithHttpInfo($campaignId, $emailTo); + $this->sendTestEmailWithHttpInfo($campaignId, $sendTestEmail, $contentType); } /** @@ -2749,16 +3583,20 @@ public function sendTestEmail($campaignId, $emailTo) * Send an email campaign to your test list * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\SendTestEmail $emailTo (required) + * @param \Brevo\Client\Models\SendTestEmail $sendTestEmail (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestEmail'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function sendTestEmailWithHttpInfo($campaignId, $emailTo) + public function sendTestEmailWithHttpInfo( + int $campaignId, + \Brevo\Client\Models\SendTestEmail $sendTestEmail, + string $contentType = self::contentTypes['sendTestEmail'][0] + ): array { - $returnType = ''; - $request = $this->sendTestEmailRequest($campaignId, $emailTo); + $request = $this->sendTestEmailRequest($campaignId, $sendTestEmail, $contentType); try { $options = $this->createHttpClientOption(); @@ -2767,26 +3605,21 @@ public function sendTestEmailWithHttpInfo($campaignId, $emailTo) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -2795,7 +3628,7 @@ public function sendTestEmailWithHttpInfo($campaignId, $emailTo) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\PostSendFailed', + '\Brevo\Client\Models\PostSendFailed', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2803,7 +3636,7 @@ public function sendTestEmailWithHttpInfo($campaignId, $emailTo) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\PostSendFailed', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2819,14 +3652,19 @@ public function sendTestEmailWithHttpInfo($campaignId, $emailTo) * Send an email campaign to your test list * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\SendTestEmail $emailTo (required) + * @param \Brevo\Client\Models\SendTestEmail $sendTestEmail (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestEmail'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendTestEmailAsync($campaignId, $emailTo) + public function sendTestEmailAsync( + int $campaignId, + \Brevo\Client\Models\SendTestEmail $sendTestEmail, + string $contentType = self::contentTypes['sendTestEmail'][0] + ): PromiseInterface { - return $this->sendTestEmailAsyncWithHttpInfo($campaignId, $emailTo) + return $this->sendTestEmailAsyncWithHttpInfo($campaignId, $sendTestEmail, $contentType) ->then( function ($response) { return $response[0]; @@ -2840,15 +3678,21 @@ function ($response) { * Send an email campaign to your test list * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\SendTestEmail $emailTo (required) + * @param \Brevo\Client\Models\SendTestEmail $sendTestEmail (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestEmail'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendTestEmailAsyncWithHttpInfo($campaignId, $emailTo) + public function sendTestEmailAsyncWithHttpInfo( + $campaignId, + $sendTestEmail, + string $contentType = self::contentTypes['sendTestEmail'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->sendTestEmailRequest($campaignId, $emailTo); + $request = $this->sendTestEmailRequest($campaignId, $sendTestEmail, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2867,7 +3711,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2877,26 +3721,34 @@ function ($exception) { * Create request for operation 'sendTestEmail' * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\SendTestEmail $emailTo (required) + * @param \Brevo\Client\Models\SendTestEmail $sendTestEmail (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestEmail'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function sendTestEmailRequest($campaignId, $emailTo) + public function sendTestEmailRequest( + $campaignId, + $sendTestEmail, + string $contentType = self::contentTypes['sendTestEmail'][0] + ): Request { + // verify the required parameter 'campaignId' is set if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $campaignId when calling sendTestEmail' ); } - // verify the required parameter 'emailTo' is set - if ($emailTo === null || (is_array($emailTo) && count($emailTo) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $emailTo when calling sendTestEmail' + + // verify the required parameter 'sendTestEmail' is set + if ($sendTestEmail === null || (is_array($sendTestEmail) && count($sendTestEmail) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $sendTestEmail when calling sendTestEmail' ); } + $resourcePath = '/emailCampaigns/{campaignId}/sendTest'; $formParams = []; $queryParams = []; @@ -2905,6 +3757,7 @@ protected function sendTestEmailRequest($campaignId, $emailTo) $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( @@ -2914,56 +3767,42 @@ protected function sendTestEmailRequest($campaignId, $emailTo) ); } - // 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'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($sendTestEmail)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($sendTestEmail)); + } else { + $httpBody = $sendTestEmail; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2989,10 +3828,11 @@ protected function sendTestEmailRequest($campaignId, $emailTo) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3004,15 +3844,20 @@ protected function sendTestEmailRequest($campaignId, $emailTo) * Update an email campaign status * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\UpdateCampaignStatus $status Status of the campaign (required) + * @param \Brevo\Client\Models\UpdateCampaignStatus $updateCampaignStatus Status of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCampaignStatus'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function updateCampaignStatus($campaignId, $status) + public function updateCampaignStatus( + int $campaignId, + \Brevo\Client\Models\UpdateCampaignStatus $updateCampaignStatus, + string $contentType = self::contentTypes['updateCampaignStatus'][0] + ): void { - $this->updateCampaignStatusWithHttpInfo($campaignId, $status); + $this->updateCampaignStatusWithHttpInfo($campaignId, $updateCampaignStatus, $contentType); } /** @@ -3021,16 +3866,20 @@ public function updateCampaignStatus($campaignId, $status) * Update an email campaign status * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\UpdateCampaignStatus $status Status of the campaign (required) + * @param \Brevo\Client\Models\UpdateCampaignStatus $updateCampaignStatus Status of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCampaignStatus'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function updateCampaignStatusWithHttpInfo($campaignId, $status) + public function updateCampaignStatusWithHttpInfo( + int $campaignId, + \Brevo\Client\Models\UpdateCampaignStatus $updateCampaignStatus, + string $contentType = self::contentTypes['updateCampaignStatus'][0] + ): array { - $returnType = ''; - $request = $this->updateCampaignStatusRequest($campaignId, $status); + $request = $this->updateCampaignStatusRequest($campaignId, $updateCampaignStatus, $contentType); try { $options = $this->createHttpClientOption(); @@ -3039,26 +3888,21 @@ public function updateCampaignStatusWithHttpInfo($campaignId, $status) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -3067,7 +3911,7 @@ public function updateCampaignStatusWithHttpInfo($campaignId, $status) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3075,7 +3919,7 @@ public function updateCampaignStatusWithHttpInfo($campaignId, $status) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3091,14 +3935,19 @@ public function updateCampaignStatusWithHttpInfo($campaignId, $status) * Update an email campaign status * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\UpdateCampaignStatus $status Status of the campaign (required) + * @param \Brevo\Client\Models\UpdateCampaignStatus $updateCampaignStatus Status of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCampaignStatus'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateCampaignStatusAsync($campaignId, $status) + public function updateCampaignStatusAsync( + int $campaignId, + \Brevo\Client\Models\UpdateCampaignStatus $updateCampaignStatus, + string $contentType = self::contentTypes['updateCampaignStatus'][0] + ): PromiseInterface { - return $this->updateCampaignStatusAsyncWithHttpInfo($campaignId, $status) + return $this->updateCampaignStatusAsyncWithHttpInfo($campaignId, $updateCampaignStatus, $contentType) ->then( function ($response) { return $response[0]; @@ -3112,15 +3961,21 @@ function ($response) { * Update an email campaign status * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\UpdateCampaignStatus $status Status of the campaign (required) + * @param \Brevo\Client\Models\UpdateCampaignStatus $updateCampaignStatus Status of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCampaignStatus'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateCampaignStatusAsyncWithHttpInfo($campaignId, $status) + public function updateCampaignStatusAsyncWithHttpInfo( + $campaignId, + $updateCampaignStatus, + string $contentType = self::contentTypes['updateCampaignStatus'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->updateCampaignStatusRequest($campaignId, $status); + $request = $this->updateCampaignStatusRequest($campaignId, $updateCampaignStatus, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3139,7 +3994,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3149,26 +4004,34 @@ function ($exception) { * Create request for operation 'updateCampaignStatus' * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\UpdateCampaignStatus $status Status of the campaign (required) + * @param \Brevo\Client\Models\UpdateCampaignStatus $updateCampaignStatus Status of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCampaignStatus'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updateCampaignStatusRequest($campaignId, $status) + public function updateCampaignStatusRequest( + $campaignId, + $updateCampaignStatus, + string $contentType = self::contentTypes['updateCampaignStatus'][0] + ): Request { + // verify the required parameter 'campaignId' is set if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $campaignId when calling updateCampaignStatus' ); } - // verify the required parameter 'status' is set - if ($status === null || (is_array($status) && count($status) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $status when calling updateCampaignStatus' + + // verify the required parameter 'updateCampaignStatus' is set + if ($updateCampaignStatus === null || (is_array($updateCampaignStatus) && count($updateCampaignStatus) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $updateCampaignStatus when calling updateCampaignStatus' ); } + $resourcePath = '/emailCampaigns/{campaignId}/status'; $formParams = []; $queryParams = []; @@ -3177,6 +4040,7 @@ protected function updateCampaignStatusRequest($campaignId, $status) $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( @@ -3186,56 +4050,42 @@ protected function updateCampaignStatusRequest($campaignId, $status) ); } - // 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'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($updateCampaignStatus)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($updateCampaignStatus)); + } else { + $httpBody = $updateCampaignStatus; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3261,10 +4111,11 @@ protected function updateCampaignStatusRequest($campaignId, $status) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3276,15 +4127,20 @@ protected function updateCampaignStatusRequest($campaignId, $status) * Update an email campaign * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\UpdateEmailCampaign $emailCampaign Values to update a campaign (required) + * @param \Brevo\Client\Models\UpdateEmailCampaign $updateEmailCampaign Values to update a campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEmailCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function updateEmailCampaign($campaignId, $emailCampaign) + public function updateEmailCampaign( + int $campaignId, + \Brevo\Client\Models\UpdateEmailCampaign $updateEmailCampaign, + string $contentType = self::contentTypes['updateEmailCampaign'][0] + ): void { - $this->updateEmailCampaignWithHttpInfo($campaignId, $emailCampaign); + $this->updateEmailCampaignWithHttpInfo($campaignId, $updateEmailCampaign, $contentType); } /** @@ -3293,16 +4149,20 @@ public function updateEmailCampaign($campaignId, $emailCampaign) * Update an email campaign * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\UpdateEmailCampaign $emailCampaign Values to update a campaign (required) + * @param \Brevo\Client\Models\UpdateEmailCampaign $updateEmailCampaign Values to update a campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEmailCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function updateEmailCampaignWithHttpInfo($campaignId, $emailCampaign) + public function updateEmailCampaignWithHttpInfo( + int $campaignId, + \Brevo\Client\Models\UpdateEmailCampaign $updateEmailCampaign, + string $contentType = self::contentTypes['updateEmailCampaign'][0] + ): array { - $returnType = ''; - $request = $this->updateEmailCampaignRequest($campaignId, $emailCampaign); + $request = $this->updateEmailCampaignRequest($campaignId, $updateEmailCampaign, $contentType); try { $options = $this->createHttpClientOption(); @@ -3311,26 +4171,21 @@ public function updateEmailCampaignWithHttpInfo($campaignId, $emailCampaign) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -3339,7 +4194,7 @@ public function updateEmailCampaignWithHttpInfo($campaignId, $emailCampaign) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3347,7 +4202,7 @@ public function updateEmailCampaignWithHttpInfo($campaignId, $emailCampaign) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3363,14 +4218,19 @@ public function updateEmailCampaignWithHttpInfo($campaignId, $emailCampaign) * Update an email campaign * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\UpdateEmailCampaign $emailCampaign Values to update a campaign (required) + * @param \Brevo\Client\Models\UpdateEmailCampaign $updateEmailCampaign Values to update a campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEmailCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateEmailCampaignAsync($campaignId, $emailCampaign) + public function updateEmailCampaignAsync( + int $campaignId, + \Brevo\Client\Models\UpdateEmailCampaign $updateEmailCampaign, + string $contentType = self::contentTypes['updateEmailCampaign'][0] + ): PromiseInterface { - return $this->updateEmailCampaignAsyncWithHttpInfo($campaignId, $emailCampaign) + return $this->updateEmailCampaignAsyncWithHttpInfo($campaignId, $updateEmailCampaign, $contentType) ->then( function ($response) { return $response[0]; @@ -3384,15 +4244,21 @@ function ($response) { * Update an email campaign * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\UpdateEmailCampaign $emailCampaign Values to update a campaign (required) + * @param \Brevo\Client\Models\UpdateEmailCampaign $updateEmailCampaign Values to update a campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEmailCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateEmailCampaignAsyncWithHttpInfo($campaignId, $emailCampaign) + public function updateEmailCampaignAsyncWithHttpInfo( + $campaignId, + $updateEmailCampaign, + string $contentType = self::contentTypes['updateEmailCampaign'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->updateEmailCampaignRequest($campaignId, $emailCampaign); + $request = $this->updateEmailCampaignRequest($campaignId, $updateEmailCampaign, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3411,7 +4277,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3421,26 +4287,34 @@ function ($exception) { * Create request for operation 'updateEmailCampaign' * * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\UpdateEmailCampaign $emailCampaign Values to update a campaign (required) + * @param \Brevo\Client\Models\UpdateEmailCampaign $updateEmailCampaign Values to update a campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEmailCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updateEmailCampaignRequest($campaignId, $emailCampaign) + public function updateEmailCampaignRequest( + $campaignId, + $updateEmailCampaign, + string $contentType = self::contentTypes['updateEmailCampaign'][0] + ): Request { + // verify the required parameter 'campaignId' is set if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $campaignId when calling updateEmailCampaign' ); } - // verify the required parameter 'emailCampaign' is set - if ($emailCampaign === null || (is_array($emailCampaign) && count($emailCampaign) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $emailCampaign when calling updateEmailCampaign' + + // verify the required parameter 'updateEmailCampaign' is set + if ($updateEmailCampaign === null || (is_array($updateEmailCampaign) && count($updateEmailCampaign) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $updateEmailCampaign when calling updateEmailCampaign' ); } + $resourcePath = '/emailCampaigns/{campaignId}'; $formParams = []; $queryParams = []; @@ -3449,6 +4323,7 @@ protected function updateEmailCampaignRequest($campaignId, $emailCampaign) $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( @@ -3458,56 +4333,42 @@ protected function updateEmailCampaignRequest($campaignId, $emailCampaign) ); } - // 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'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($updateEmailCampaign)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($updateEmailCampaign)); + } else { + $httpBody = $updateEmailCampaign; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3533,10 +4394,11 @@ protected function updateEmailCampaignRequest($campaignId, $emailCampaign) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3545,35 +4407,42 @@ protected function updateEmailCampaignRequest($campaignId, $emailCampaign) /** * Operation uploadImageToGallery * - * Upload an image to your account's image gallery + * Upload an image to your account's image gallery * - * @param \Brevo\Client\Model\UploadImageToGallery $uploadImage Parameters to upload an image (required) + * @param \Brevo\Client\Models\UploadImageToGallery $uploadImageToGallery Parameters to upload an image (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadImageToGallery'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\UploadImageModel + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\UploadImageModel|\Brevo\Client\Models\ErrorModel */ - public function uploadImageToGallery($uploadImage) + public function uploadImageToGallery( + \Brevo\Client\Models\UploadImageToGallery $uploadImageToGallery, + string $contentType = self::contentTypes['uploadImageToGallery'][0] + ): \Brevo\Client\Models\UploadImageModel { - list($response) = $this->uploadImageToGalleryWithHttpInfo($uploadImage); + list($response) = $this->uploadImageToGalleryWithHttpInfo($uploadImageToGallery, $contentType); return $response; } /** * Operation uploadImageToGalleryWithHttpInfo * - * Upload an image to your account's image gallery + * Upload an image to your account's image gallery * - * @param \Brevo\Client\Model\UploadImageToGallery $uploadImage Parameters to upload an image (required) + * @param \Brevo\Client\Models\UploadImageToGallery $uploadImageToGallery Parameters to upload an image (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadImageToGallery'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\UploadImageModel, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\UploadImageModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function uploadImageToGalleryWithHttpInfo($uploadImage) + public function uploadImageToGalleryWithHttpInfo( + \Brevo\Client\Models\UploadImageToGallery $uploadImageToGallery, + string $contentType = self::contentTypes['uploadImageToGallery'][0] + ): array { - $returnType = '\Brevo\Client\Model\UploadImageModel'; - $request = $this->uploadImageToGalleryRequest($uploadImage); + $request = $this->uploadImageToGalleryRequest($uploadImageToGallery, $contentType); try { $options = $this->createHttpClientOption(); @@ -3582,34 +4451,111 @@ public function uploadImageToGalleryWithHttpInfo($uploadImage) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\UploadImageModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\UploadImageModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\UploadImageModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\UploadImageModel'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3624,7 +4570,7 @@ public function uploadImageToGalleryWithHttpInfo($uploadImage) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\UploadImageModel', + '\Brevo\Client\Models\UploadImageModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3632,7 +4578,7 @@ public function uploadImageToGalleryWithHttpInfo($uploadImage) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3645,16 +4591,20 @@ public function uploadImageToGalleryWithHttpInfo($uploadImage) /** * Operation uploadImageToGalleryAsync * - * Upload an image to your account's image gallery + * Upload an image to your account's image gallery * - * @param \Brevo\Client\Model\UploadImageToGallery $uploadImage Parameters to upload an image (required) + * @param \Brevo\Client\Models\UploadImageToGallery $uploadImageToGallery Parameters to upload an image (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadImageToGallery'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function uploadImageToGalleryAsync($uploadImage) + public function uploadImageToGalleryAsync( + \Brevo\Client\Models\UploadImageToGallery $uploadImageToGallery, + string $contentType = self::contentTypes['uploadImageToGallery'][0] + ): PromiseInterface { - return $this->uploadImageToGalleryAsyncWithHttpInfo($uploadImage) + return $this->uploadImageToGalleryAsyncWithHttpInfo($uploadImageToGallery, $contentType) ->then( function ($response) { return $response[0]; @@ -3665,27 +4615,31 @@ function ($response) { /** * Operation uploadImageToGalleryAsyncWithHttpInfo * - * Upload an image to your account's image gallery + * Upload an image to your account's image gallery * - * @param \Brevo\Client\Model\UploadImageToGallery $uploadImage Parameters to upload an image (required) + * @param \Brevo\Client\Models\UploadImageToGallery $uploadImageToGallery Parameters to upload an image (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadImageToGallery'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function uploadImageToGalleryAsyncWithHttpInfo($uploadImage) + public function uploadImageToGalleryAsyncWithHttpInfo( + $uploadImageToGallery, + string $contentType = self::contentTypes['uploadImageToGallery'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\UploadImageModel'; - $request = $this->uploadImageToGalleryRequest($uploadImage); + $returnType = '\Brevo\Client\Models\UploadImageModel'; + $request = $this->uploadImageToGalleryRequest($uploadImageToGallery, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3708,7 +4662,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3717,20 +4671,26 @@ function ($exception) { /** * Create request for operation 'uploadImageToGallery' * - * @param \Brevo\Client\Model\UploadImageToGallery $uploadImage Parameters to upload an image (required) + * @param \Brevo\Client\Models\UploadImageToGallery $uploadImageToGallery Parameters to upload an image (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadImageToGallery'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function uploadImageToGalleryRequest($uploadImage) + public function uploadImageToGalleryRequest( + $uploadImageToGallery, + string $contentType = self::contentTypes['uploadImageToGallery'][0] + ): Request { - // verify the required parameter 'uploadImage' is set - if ($uploadImage === null || (is_array($uploadImage) && count($uploadImage) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $uploadImage when calling uploadImageToGallery' + + // verify the required parameter 'uploadImageToGallery' is set + if ($uploadImageToGallery === null || (is_array($uploadImageToGallery) && count($uploadImageToGallery) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $uploadImageToGallery when calling uploadImageToGallery' ); } + $resourcePath = '/emailCampaigns/images'; $formParams = []; $queryParams = []; @@ -3740,56 +4700,43 @@ protected function uploadImageToGalleryRequest($uploadImage) - // body params - $_tempBody = null; - if (isset($uploadImage)) { - $_tempBody = $uploadImage; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($uploadImageToGallery)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($uploadImageToGallery)); + } else { + $httpBody = $uploadImageToGallery; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3815,10 +4762,11 @@ protected function uploadImageToGalleryRequest($uploadImage) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3830,7 +4778,7 @@ protected function uploadImageToGalleryRequest($uploadImage) * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/EventsApi.php b/lib/Api/EventApi.php similarity index 52% rename from lib/Api/EventsApi.php rename to lib/Api/EventApi.php index 88a81c4..d9c4c66 100644 --- a/lib/Api/EventsApi.php +++ b/lib/Api/EventApi.php @@ -1,12 +1,11 @@ [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -92,15 +128,19 @@ public function getConfig() * * Create an event * - * @param \Brevo\Client\Model\Event $event event (required) + * @param \Brevo\Client\Models\Event $event event (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEvent'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function createEvent($event) + public function createEvent( + \Brevo\Client\Models\Event $event, + string $contentType = self::contentTypes['createEvent'][0] + ): void { - $this->createEventWithHttpInfo($event); + $this->createEventWithHttpInfo($event, $contentType); } /** @@ -108,16 +148,19 @@ public function createEvent($event) * * Create an event * - * @param \Brevo\Client\Model\Event $event (required) + * @param \Brevo\Client\Models\Event $event (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEvent'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function createEventWithHttpInfo($event) + public function createEventWithHttpInfo( + \Brevo\Client\Models\Event $event, + string $contentType = self::contentTypes['createEvent'][0] + ): array { - $returnType = ''; - $request = $this->createEventRequest($event); + $request = $this->createEventRequest($event, $contentType); try { $options = $this->createHttpClientOption(); @@ -126,26 +169,21 @@ public function createEventWithHttpInfo($event) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -154,7 +192,7 @@ public function createEventWithHttpInfo($event) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -162,7 +200,7 @@ public function createEventWithHttpInfo($event) case 401: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -177,14 +215,18 @@ public function createEventWithHttpInfo($event) * * Create an event * - * @param \Brevo\Client\Model\Event $event (required) + * @param \Brevo\Client\Models\Event $event (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEvent'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createEventAsync($event) + public function createEventAsync( + \Brevo\Client\Models\Event $event, + string $contentType = self::contentTypes['createEvent'][0] + ): PromiseInterface { - return $this->createEventAsyncWithHttpInfo($event) + return $this->createEventAsyncWithHttpInfo($event, $contentType) ->then( function ($response) { return $response[0]; @@ -197,15 +239,20 @@ function ($response) { * * Create an event * - * @param \Brevo\Client\Model\Event $event (required) + * @param \Brevo\Client\Models\Event $event (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEvent'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createEventAsyncWithHttpInfo($event) + public function createEventAsyncWithHttpInfo( + $event, + string $contentType = self::contentTypes['createEvent'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->createEventRequest($event); + $request = $this->createEventRequest($event, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -224,7 +271,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -233,20 +280,26 @@ function ($exception) { /** * Create request for operation 'createEvent' * - * @param \Brevo\Client\Model\Event $event (required) + * @param \Brevo\Client\Models\Event $event (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEvent'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createEventRequest($event) + public function createEventRequest( + $event, + string $contentType = self::contentTypes['createEvent'][0] + ): Request { + // verify the required parameter 'event' is set if ($event === null || (is_array($event) && count($event) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $event when calling createEvent' ); } + $resourcePath = '/events'; $formParams = []; $queryParams = []; @@ -256,56 +309,43 @@ protected function createEventRequest($event) - // body params - $_tempBody = null; - if (isset($event)) { - $_tempBody = $event; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($event)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($event)); + } else { + $httpBody = $event; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -331,10 +371,11 @@ protected function createEventRequest($event) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -346,7 +387,7 @@ protected function createEventRequest($event) * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/ExternalFeedsApi.php b/lib/Api/ExternalFeedsApi.php index 3970d76..e91800a 100644 --- a/lib/Api/ExternalFeedsApi.php +++ b/lib/Api/ExternalFeedsApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'deleteExternalFeed' => [ + 'application/json', + ], + 'getAllExternalFeeds' => [ + 'application/json', + ], + 'getExternalFeedByUUID' => [ + 'application/json', + ], + 'updateExternalFeed' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -92,15 +140,19 @@ public function getConfig() * * Create an external feed * - * @param \Brevo\Client\Model\CreateExternalFeed $createExternalFeed Values to create a feed (required) + * @param \Brevo\Client\Models\CreateExternalFeed $createExternalFeed Values to create a feed (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createExternalFeed'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\InlineResponse2015 + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateExternalFeed201Response|\Brevo\Client\Models\ErrorModel */ - public function createExternalFeed($createExternalFeed) + public function createExternalFeed( + \Brevo\Client\Models\CreateExternalFeed $createExternalFeed, + string $contentType = self::contentTypes['createExternalFeed'][0] + ): \Brevo\Client\Models\CreateExternalFeed201Response { - list($response) = $this->createExternalFeedWithHttpInfo($createExternalFeed); + list($response) = $this->createExternalFeedWithHttpInfo($createExternalFeed, $contentType); return $response; } @@ -109,16 +161,19 @@ public function createExternalFeed($createExternalFeed) * * Create an external feed * - * @param \Brevo\Client\Model\CreateExternalFeed $createExternalFeed Values to create a feed (required) + * @param \Brevo\Client\Models\CreateExternalFeed $createExternalFeed Values to create a feed (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createExternalFeed'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\InlineResponse2015, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateExternalFeed201Response|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function createExternalFeedWithHttpInfo($createExternalFeed) + public function createExternalFeedWithHttpInfo( + \Brevo\Client\Models\CreateExternalFeed $createExternalFeed, + string $contentType = self::contentTypes['createExternalFeed'][0] + ): array { - $returnType = '\Brevo\Client\Model\InlineResponse2015'; - $request = $this->createExternalFeedRequest($createExternalFeed); + $request = $this->createExternalFeedRequest($createExternalFeed, $contentType); try { $options = $this->createHttpClientOption(); @@ -127,34 +182,111 @@ public function createExternalFeedWithHttpInfo($createExternalFeed) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreateExternalFeed201Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateExternalFeed201Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateExternalFeed201Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreateExternalFeed201Response'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -169,7 +301,7 @@ public function createExternalFeedWithHttpInfo($createExternalFeed) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\InlineResponse2015', + '\Brevo\Client\Models\CreateExternalFeed201Response', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -177,7 +309,7 @@ public function createExternalFeedWithHttpInfo($createExternalFeed) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -192,14 +324,18 @@ public function createExternalFeedWithHttpInfo($createExternalFeed) * * Create an external feed * - * @param \Brevo\Client\Model\CreateExternalFeed $createExternalFeed Values to create a feed (required) + * @param \Brevo\Client\Models\CreateExternalFeed $createExternalFeed Values to create a feed (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createExternalFeed'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createExternalFeedAsync($createExternalFeed) + public function createExternalFeedAsync( + \Brevo\Client\Models\CreateExternalFeed $createExternalFeed, + string $contentType = self::contentTypes['createExternalFeed'][0] + ): PromiseInterface { - return $this->createExternalFeedAsyncWithHttpInfo($createExternalFeed) + return $this->createExternalFeedAsyncWithHttpInfo($createExternalFeed, $contentType) ->then( function ($response) { return $response[0]; @@ -212,25 +348,29 @@ function ($response) { * * Create an external feed * - * @param \Brevo\Client\Model\CreateExternalFeed $createExternalFeed Values to create a feed (required) + * @param \Brevo\Client\Models\CreateExternalFeed $createExternalFeed Values to create a feed (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createExternalFeed'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createExternalFeedAsyncWithHttpInfo($createExternalFeed) + public function createExternalFeedAsyncWithHttpInfo( + $createExternalFeed, + string $contentType = self::contentTypes['createExternalFeed'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\InlineResponse2015'; - $request = $this->createExternalFeedRequest($createExternalFeed); + $returnType = '\Brevo\Client\Models\CreateExternalFeed201Response'; + $request = $this->createExternalFeedRequest($createExternalFeed, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -253,7 +393,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -262,20 +402,26 @@ function ($exception) { /** * Create request for operation 'createExternalFeed' * - * @param \Brevo\Client\Model\CreateExternalFeed $createExternalFeed Values to create a feed (required) + * @param \Brevo\Client\Models\CreateExternalFeed $createExternalFeed Values to create a feed (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createExternalFeed'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createExternalFeedRequest($createExternalFeed) + public function createExternalFeedRequest( + $createExternalFeed, + string $contentType = self::contentTypes['createExternalFeed'][0] + ): Request { + // verify the required parameter 'createExternalFeed' is set if ($createExternalFeed === null || (is_array($createExternalFeed) && count($createExternalFeed) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $createExternalFeed when calling createExternalFeed' ); } + $resourcePath = '/feeds'; $formParams = []; $queryParams = []; @@ -285,56 +431,43 @@ protected function createExternalFeedRequest($createExternalFeed) - // body params - $_tempBody = null; - if (isset($createExternalFeed)) { - $_tempBody = $createExternalFeed; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($createExternalFeed)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createExternalFeed)); + } else { + $httpBody = $createExternalFeed; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -360,10 +493,11 @@ protected function createExternalFeedRequest($createExternalFeed) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -375,14 +509,18 @@ protected function createExternalFeedRequest($createExternalFeed) * Delete an external feed * * @param string $uuid UUID of the feed to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteExternalFeed'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function deleteExternalFeed($uuid) + public function deleteExternalFeed( + string $uuid, + string $contentType = self::contentTypes['deleteExternalFeed'][0] + ): void { - $this->deleteExternalFeedWithHttpInfo($uuid); + $this->deleteExternalFeedWithHttpInfo($uuid, $contentType); } /** @@ -391,15 +529,18 @@ public function deleteExternalFeed($uuid) * Delete an external feed * * @param string $uuid UUID of the feed to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteExternalFeed'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteExternalFeedWithHttpInfo($uuid) + public function deleteExternalFeedWithHttpInfo( + string $uuid, + string $contentType = self::contentTypes['deleteExternalFeed'][0] + ): array { - $returnType = ''; - $request = $this->deleteExternalFeedRequest($uuid); + $request = $this->deleteExternalFeedRequest($uuid, $contentType); try { $options = $this->createHttpClientOption(); @@ -408,26 +549,21 @@ public function deleteExternalFeedWithHttpInfo($uuid) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -436,7 +572,7 @@ public function deleteExternalFeedWithHttpInfo($uuid) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -444,7 +580,7 @@ public function deleteExternalFeedWithHttpInfo($uuid) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -460,13 +596,17 @@ public function deleteExternalFeedWithHttpInfo($uuid) * Delete an external feed * * @param string $uuid UUID of the feed to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteExternalFeed'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteExternalFeedAsync($uuid) + public function deleteExternalFeedAsync( + string $uuid, + string $contentType = self::contentTypes['deleteExternalFeed'][0] + ): PromiseInterface { - return $this->deleteExternalFeedAsyncWithHttpInfo($uuid) + return $this->deleteExternalFeedAsyncWithHttpInfo($uuid, $contentType) ->then( function ($response) { return $response[0]; @@ -480,14 +620,19 @@ function ($response) { * Delete an external feed * * @param string $uuid UUID of the feed to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteExternalFeed'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteExternalFeedAsyncWithHttpInfo($uuid) + public function deleteExternalFeedAsyncWithHttpInfo( + $uuid, + string $contentType = self::contentTypes['deleteExternalFeed'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->deleteExternalFeedRequest($uuid); + $request = $this->deleteExternalFeedRequest($uuid, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -506,7 +651,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -516,19 +661,25 @@ function ($exception) { * Create request for operation 'deleteExternalFeed' * * @param string $uuid UUID of the feed to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteExternalFeed'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function deleteExternalFeedRequest($uuid) + public function deleteExternalFeedRequest( + $uuid, + string $contentType = self::contentTypes['deleteExternalFeed'][0] + ): Request { + // verify the required parameter 'uuid' is set if ($uuid === null || (is_array($uuid) && count($uuid) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $uuid when calling deleteExternalFeed' ); } + $resourcePath = '/feeds/{uuid}'; $formParams = []; $queryParams = []; @@ -537,6 +688,7 @@ protected function deleteExternalFeedRequest($uuid) $multipart = false; + // path params if ($uuid !== null) { $resourcePath = str_replace( @@ -546,53 +698,35 @@ protected function deleteExternalFeedRequest($uuid) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -618,10 +752,11 @@ protected function deleteExternalFeedRequest($uuid) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -632,21 +767,31 @@ protected function deleteExternalFeedRequest($uuid) * * Fetch all external feeds * - * @param string $search Can be used to filter records by search keyword on feed name (optional) - * @param \DateTime $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older than current date. (optional) - * @param \DateTime $endDate Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. (optional, default to desc) - * @param string $authType Filter the records by `authType` of the feed. (optional) - * @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) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetAllExternalFeeds + * @param string|null $search Can be used to filter records by search keyword on feed name (optional) + * @param \DateTime|null $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older than current date. (optional) + * @param \DateTime|null $endDate Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. (optional, default to 'desc') + * @param string|null $authType Filter the records by `authType` of the feed. (optional) + * @param int|null $limit Number of documents returned per page. (optional, default to 50) + * @param int|null $offset Index of the first document on the page. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllExternalFeeds'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetAllExternalFeeds|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function getAllExternalFeeds($search = null, $startDate = null, $endDate = null, $sort = 'desc', $authType = null, $limit = '50', $offset = '0') + public function getAllExternalFeeds( + ?string $search = null, + ?\DateTime $startDate = null, + ?\DateTime $endDate = null, + ?string $sort = 'desc', + ?string $authType = null, + ?int $limit = 50, + ?int $offset = 0, + string $contentType = self::contentTypes['getAllExternalFeeds'][0] + ): \Brevo\Client\Models\GetAllExternalFeeds { - list($response) = $this->getAllExternalFeedsWithHttpInfo($search, $startDate, $endDate, $sort, $authType, $limit, $offset); + list($response) = $this->getAllExternalFeedsWithHttpInfo($search, $startDate, $endDate, $sort, $authType, $limit, $offset, $contentType); return $response; } @@ -655,22 +800,31 @@ public function getAllExternalFeeds($search = null, $startDate = null, $endDate * * Fetch all external feeds * - * @param string $search Can be used to filter records by search keyword on feed name (optional) - * @param \DateTime $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older than current date. (optional) - * @param \DateTime $endDate Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. (optional, default to desc) - * @param string $authType Filter the records by `authType` of the feed. (optional) - * @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) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetAllExternalFeeds, HTTP status code, HTTP response headers (array of strings) + * @param string|null $search Can be used to filter records by search keyword on feed name (optional) + * @param \DateTime|null $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older than current date. (optional) + * @param \DateTime|null $endDate Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. (optional, default to 'desc') + * @param string|null $authType Filter the records by `authType` of the feed. (optional) + * @param int|null $limit Number of documents returned per page. (optional, default to 50) + * @param int|null $offset Index of the first document on the page. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllExternalFeeds'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetAllExternalFeeds|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getAllExternalFeedsWithHttpInfo($search = null, $startDate = null, $endDate = null, $sort = 'desc', $authType = null, $limit = '50', $offset = '0') + public function getAllExternalFeedsWithHttpInfo( + ?string $search = null, + ?\DateTime $startDate = null, + ?\DateTime $endDate = null, + ?string $sort = 'desc', + ?string $authType = null, + ?int $limit = 50, + ?int $offset = 0, + string $contentType = self::contentTypes['getAllExternalFeeds'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetAllExternalFeeds'; - $request = $this->getAllExternalFeedsRequest($search, $startDate, $endDate, $sort, $authType, $limit, $offset); + $request = $this->getAllExternalFeedsRequest($search, $startDate, $endDate, $sort, $authType, $limit, $offset, $contentType); try { $options = $this->createHttpClientOption(); @@ -679,34 +833,138 @@ public function getAllExternalFeedsWithHttpInfo($search = null, $startDate = nul } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetAllExternalFeeds', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetAllExternalFeeds' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetAllExternalFeeds', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetAllExternalFeeds'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -721,7 +979,7 @@ public function getAllExternalFeedsWithHttpInfo($search = null, $startDate = nul case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetAllExternalFeeds', + '\Brevo\Client\Models\GetAllExternalFeeds', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -729,7 +987,7 @@ public function getAllExternalFeedsWithHttpInfo($search = null, $startDate = nul case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -737,7 +995,7 @@ public function getAllExternalFeedsWithHttpInfo($search = null, $startDate = nul case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -752,20 +1010,30 @@ public function getAllExternalFeedsWithHttpInfo($search = null, $startDate = nul * * Fetch all external feeds * - * @param string $search Can be used to filter records by search keyword on feed name (optional) - * @param \DateTime $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older than current date. (optional) - * @param \DateTime $endDate Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. (optional, default to desc) - * @param string $authType Filter the records by `authType` of the feed. (optional) - * @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) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @param string|null $search Can be used to filter records by search keyword on feed name (optional) + * @param \DateTime|null $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older than current date. (optional) + * @param \DateTime|null $endDate Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. (optional, default to 'desc') + * @param string|null $authType Filter the records by `authType` of the feed. (optional) + * @param int|null $limit Number of documents returned per page. (optional, default to 50) + * @param int|null $offset Index of the first document on the page. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllExternalFeeds'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getAllExternalFeedsAsync($search = null, $startDate = null, $endDate = null, $sort = 'desc', $authType = null, $limit = '50', $offset = '0') + public function getAllExternalFeedsAsync( + ?string $search = null, + ?\DateTime $startDate = null, + ?\DateTime $endDate = null, + ?string $sort = 'desc', + ?string $authType = null, + ?int $limit = 50, + ?int $offset = 0, + string $contentType = self::contentTypes['getAllExternalFeeds'][0] + ): PromiseInterface { - return $this->getAllExternalFeedsAsyncWithHttpInfo($search, $startDate, $endDate, $sort, $authType, $limit, $offset) + return $this->getAllExternalFeedsAsyncWithHttpInfo($search, $startDate, $endDate, $sort, $authType, $limit, $offset, $contentType) ->then( function ($response) { return $response[0]; @@ -778,31 +1046,41 @@ function ($response) { * * Fetch all external feeds * - * @param string $search Can be used to filter records by search keyword on feed name (optional) - * @param \DateTime $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older than current date. (optional) - * @param \DateTime $endDate Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. (optional, default to desc) - * @param string $authType Filter the records by `authType` of the feed. (optional) - * @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) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @param string|null $search Can be used to filter records by search keyword on feed name (optional) + * @param \DateTime|null $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older than current date. (optional) + * @param \DateTime|null $endDate Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. (optional, default to 'desc') + * @param string|null $authType Filter the records by `authType` of the feed. (optional) + * @param int|null $limit Number of documents returned per page. (optional, default to 50) + * @param int|null $offset Index of the first document on the page. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllExternalFeeds'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getAllExternalFeedsAsyncWithHttpInfo($search = null, $startDate = null, $endDate = null, $sort = 'desc', $authType = null, $limit = '50', $offset = '0') + public function getAllExternalFeedsAsyncWithHttpInfo( + $search = null, + $startDate = null, + $endDate = null, + $sort = 'desc', + $authType = null, + $limit = 50, + $offset = 0, + string $contentType = self::contentTypes['getAllExternalFeeds'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetAllExternalFeeds'; - $request = $this->getAllExternalFeedsRequest($search, $startDate, $endDate, $sort, $authType, $limit, $offset); + $returnType = '\Brevo\Client\Models\GetAllExternalFeeds'; + $request = $this->getAllExternalFeedsRequest($search, $startDate, $endDate, $sort, $authType, $limit, $offset, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -825,7 +1103,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -834,25 +1112,42 @@ function ($exception) { /** * Create request for operation 'getAllExternalFeeds' * - * @param string $search Can be used to filter records by search keyword on feed name (optional) - * @param \DateTime $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older than current date. (optional) - * @param \DateTime $endDate Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. (optional, default to desc) - * @param string $authType Filter the records by `authType` of the feed. (optional) - * @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 string|null $search Can be used to filter records by search keyword on feed name (optional) + * @param \DateTime|null $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older than current date. (optional) + * @param \DateTime|null $endDate Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. (optional, default to 'desc') + * @param string|null $authType Filter the records by `authType` of the feed. (optional) + * @param int|null $limit Number of documents returned per page. (optional, default to 50) + * @param int|null $offset Index of the first document on the page. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllExternalFeeds'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getAllExternalFeedsRequest($search = null, $startDate = null, $endDate = null, $sort = 'desc', $authType = null, $limit = '50', $offset = '0') + public function getAllExternalFeedsRequest( + $search = null, + $startDate = null, + $endDate = null, + $sort = 'desc', + $authType = null, + $limit = 50, + $offset = 0, + string $contentType = self::contentTypes['getAllExternalFeeds'][0] + ): Request { + + + + + + if ($limit !== null && $limit > 500) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling ExternalFeedsApi.getAllExternalFeeds, must be smaller than or equal to 500.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling ExternalFeedsApi.getAllExternalFeeds, must be smaller than or equal to 500.'); } if ($limit !== null && $limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling ExternalFeedsApi.getAllExternalFeeds, must be bigger than or equal to 0.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling ExternalFeedsApi.getAllExternalFeeds, must be bigger than or equal to 0.'); } + $resourcePath = '/feeds'; @@ -863,82 +1158,100 @@ protected function getAllExternalFeedsRequest($search = null, $startDate = null, $multipart = false; // query params - if ($search !== null) { - $queryParams['search'] = ObjectSerializer::toQueryValue($search); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search, + 'search', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($startDate !== null) { - $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($endDate !== null) { - $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($authType !== null) { - $queryParams['authType'] = ObjectSerializer::toQueryValue($authType); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $authType, + 'authType', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -964,10 +1277,11 @@ protected function getAllExternalFeedsRequest($search = null, $startDate = null, $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -979,14 +1293,18 @@ protected function getAllExternalFeedsRequest($search = null, $startDate = null, * Get an external feed by UUID * * @param string $uuid UUID of the feed to fetch (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExternalFeedByUUID'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetExternalFeedByUUID + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetExternalFeedByUUID|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function getExternalFeedByUUID($uuid) + public function getExternalFeedByUUID( + string $uuid, + string $contentType = self::contentTypes['getExternalFeedByUUID'][0] + ): \Brevo\Client\Models\GetExternalFeedByUUID { - list($response) = $this->getExternalFeedByUUIDWithHttpInfo($uuid); + list($response) = $this->getExternalFeedByUUIDWithHttpInfo($uuid, $contentType); return $response; } @@ -996,15 +1314,18 @@ public function getExternalFeedByUUID($uuid) * Get an external feed by UUID * * @param string $uuid UUID of the feed to fetch (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExternalFeedByUUID'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetExternalFeedByUUID, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetExternalFeedByUUID|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getExternalFeedByUUIDWithHttpInfo($uuid) + public function getExternalFeedByUUIDWithHttpInfo( + string $uuid, + string $contentType = self::contentTypes['getExternalFeedByUUID'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetExternalFeedByUUID'; - $request = $this->getExternalFeedByUUIDRequest($uuid); + $request = $this->getExternalFeedByUUIDRequest($uuid, $contentType); try { $options = $this->createHttpClientOption(); @@ -1013,34 +1334,138 @@ public function getExternalFeedByUUIDWithHttpInfo($uuid) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetExternalFeedByUUID', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetExternalFeedByUUID' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetExternalFeedByUUID', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetExternalFeedByUUID'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1055,7 +1480,7 @@ public function getExternalFeedByUUIDWithHttpInfo($uuid) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetExternalFeedByUUID', + '\Brevo\Client\Models\GetExternalFeedByUUID', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1063,7 +1488,7 @@ public function getExternalFeedByUUIDWithHttpInfo($uuid) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1071,7 +1496,7 @@ public function getExternalFeedByUUIDWithHttpInfo($uuid) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1087,13 +1512,17 @@ public function getExternalFeedByUUIDWithHttpInfo($uuid) * Get an external feed by UUID * * @param string $uuid UUID of the feed to fetch (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExternalFeedByUUID'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getExternalFeedByUUIDAsync($uuid) + public function getExternalFeedByUUIDAsync( + string $uuid, + string $contentType = self::contentTypes['getExternalFeedByUUID'][0] + ): PromiseInterface { - return $this->getExternalFeedByUUIDAsyncWithHttpInfo($uuid) + return $this->getExternalFeedByUUIDAsyncWithHttpInfo($uuid, $contentType) ->then( function ($response) { return $response[0]; @@ -1107,24 +1536,28 @@ function ($response) { * Get an external feed by UUID * * @param string $uuid UUID of the feed to fetch (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExternalFeedByUUID'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getExternalFeedByUUIDAsyncWithHttpInfo($uuid) + public function getExternalFeedByUUIDAsyncWithHttpInfo( + $uuid, + string $contentType = self::contentTypes['getExternalFeedByUUID'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetExternalFeedByUUID'; - $request = $this->getExternalFeedByUUIDRequest($uuid); + $returnType = '\Brevo\Client\Models\GetExternalFeedByUUID'; + $request = $this->getExternalFeedByUUIDRequest($uuid, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1147,7 +1580,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1157,19 +1590,25 @@ function ($exception) { * Create request for operation 'getExternalFeedByUUID' * * @param string $uuid UUID of the feed to fetch (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExternalFeedByUUID'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getExternalFeedByUUIDRequest($uuid) + public function getExternalFeedByUUIDRequest( + $uuid, + string $contentType = self::contentTypes['getExternalFeedByUUID'][0] + ): Request { + // verify the required parameter 'uuid' is set if ($uuid === null || (is_array($uuid) && count($uuid) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $uuid when calling getExternalFeedByUUID' ); } + $resourcePath = '/feeds/{uuid}'; $formParams = []; $queryParams = []; @@ -1178,6 +1617,7 @@ protected function getExternalFeedByUUIDRequest($uuid) $multipart = false; + // path params if ($uuid !== null) { $resourcePath = str_replace( @@ -1187,53 +1627,35 @@ protected function getExternalFeedByUUIDRequest($uuid) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1259,10 +1681,11 @@ protected function getExternalFeedByUUIDRequest($uuid) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1274,15 +1697,20 @@ protected function getExternalFeedByUUIDRequest($uuid) * Update an external feed * * @param string $uuid UUID of the feed to update (required) - * @param \Brevo\Client\Model\UpdateExternalFeed $updateExternalFeed Values to update a feed (required) + * @param \Brevo\Client\Models\UpdateExternalFeed $updateExternalFeed Values to update a feed (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateExternalFeed'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function updateExternalFeed($uuid, $updateExternalFeed) + public function updateExternalFeed( + string $uuid, + \Brevo\Client\Models\UpdateExternalFeed $updateExternalFeed, + string $contentType = self::contentTypes['updateExternalFeed'][0] + ): void { - $this->updateExternalFeedWithHttpInfo($uuid, $updateExternalFeed); + $this->updateExternalFeedWithHttpInfo($uuid, $updateExternalFeed, $contentType); } /** @@ -1291,16 +1719,20 @@ public function updateExternalFeed($uuid, $updateExternalFeed) * Update an external feed * * @param string $uuid UUID of the feed to update (required) - * @param \Brevo\Client\Model\UpdateExternalFeed $updateExternalFeed Values to update a feed (required) + * @param \Brevo\Client\Models\UpdateExternalFeed $updateExternalFeed Values to update a feed (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateExternalFeed'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function updateExternalFeedWithHttpInfo($uuid, $updateExternalFeed) + public function updateExternalFeedWithHttpInfo( + string $uuid, + \Brevo\Client\Models\UpdateExternalFeed $updateExternalFeed, + string $contentType = self::contentTypes['updateExternalFeed'][0] + ): array { - $returnType = ''; - $request = $this->updateExternalFeedRequest($uuid, $updateExternalFeed); + $request = $this->updateExternalFeedRequest($uuid, $updateExternalFeed, $contentType); try { $options = $this->createHttpClientOption(); @@ -1309,26 +1741,21 @@ public function updateExternalFeedWithHttpInfo($uuid, $updateExternalFeed) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -1337,7 +1764,7 @@ public function updateExternalFeedWithHttpInfo($uuid, $updateExternalFeed) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1345,7 +1772,7 @@ public function updateExternalFeedWithHttpInfo($uuid, $updateExternalFeed) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1361,14 +1788,19 @@ public function updateExternalFeedWithHttpInfo($uuid, $updateExternalFeed) * Update an external feed * * @param string $uuid UUID of the feed to update (required) - * @param \Brevo\Client\Model\UpdateExternalFeed $updateExternalFeed Values to update a feed (required) + * @param \Brevo\Client\Models\UpdateExternalFeed $updateExternalFeed Values to update a feed (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateExternalFeed'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateExternalFeedAsync($uuid, $updateExternalFeed) + public function updateExternalFeedAsync( + string $uuid, + \Brevo\Client\Models\UpdateExternalFeed $updateExternalFeed, + string $contentType = self::contentTypes['updateExternalFeed'][0] + ): PromiseInterface { - return $this->updateExternalFeedAsyncWithHttpInfo($uuid, $updateExternalFeed) + return $this->updateExternalFeedAsyncWithHttpInfo($uuid, $updateExternalFeed, $contentType) ->then( function ($response) { return $response[0]; @@ -1382,15 +1814,21 @@ function ($response) { * Update an external feed * * @param string $uuid UUID of the feed to update (required) - * @param \Brevo\Client\Model\UpdateExternalFeed $updateExternalFeed Values to update a feed (required) + * @param \Brevo\Client\Models\UpdateExternalFeed $updateExternalFeed Values to update a feed (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateExternalFeed'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateExternalFeedAsyncWithHttpInfo($uuid, $updateExternalFeed) + public function updateExternalFeedAsyncWithHttpInfo( + $uuid, + $updateExternalFeed, + string $contentType = self::contentTypes['updateExternalFeed'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->updateExternalFeedRequest($uuid, $updateExternalFeed); + $request = $this->updateExternalFeedRequest($uuid, $updateExternalFeed, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1409,7 +1847,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1419,26 +1857,34 @@ function ($exception) { * Create request for operation 'updateExternalFeed' * * @param string $uuid UUID of the feed to update (required) - * @param \Brevo\Client\Model\UpdateExternalFeed $updateExternalFeed Values to update a feed (required) + * @param \Brevo\Client\Models\UpdateExternalFeed $updateExternalFeed Values to update a feed (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateExternalFeed'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updateExternalFeedRequest($uuid, $updateExternalFeed) + public function updateExternalFeedRequest( + $uuid, + $updateExternalFeed, + string $contentType = self::contentTypes['updateExternalFeed'][0] + ): Request { + // verify the required parameter 'uuid' is set if ($uuid === null || (is_array($uuid) && count($uuid) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $uuid when calling updateExternalFeed' ); } + // verify the required parameter 'updateExternalFeed' is set if ($updateExternalFeed === null || (is_array($updateExternalFeed) && count($updateExternalFeed) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $updateExternalFeed when calling updateExternalFeed' ); } + $resourcePath = '/feeds/{uuid}'; $formParams = []; $queryParams = []; @@ -1447,6 +1893,7 @@ protected function updateExternalFeedRequest($uuid, $updateExternalFeed) $multipart = false; + // path params if ($uuid !== null) { $resourcePath = str_replace( @@ -1456,56 +1903,42 @@ protected function updateExternalFeedRequest($uuid, $updateExternalFeed) ); } - // body params - $_tempBody = null; - if (isset($updateExternalFeed)) { - $_tempBody = $updateExternalFeed; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($updateExternalFeed)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($updateExternalFeed)); + } else { + $httpBody = $updateExternalFeed; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1531,10 +1964,11 @@ protected function updateExternalFeedRequest($uuid, $updateExternalFeed) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1546,7 +1980,7 @@ protected function updateExternalFeedRequest($uuid, $updateExternalFeed) * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/FilesApi.php b/lib/Api/FilesApi.php index ee1f190..df08e63 100644 --- a/lib/Api/FilesApi.php +++ b/lib/Api/FilesApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'crmFilesIdDataGet' => [ + 'application/json', + ], + 'crmFilesIdDelete' => [ + 'application/json', + ], + 'crmFilesIdGet' => [ + 'application/json', + ], + 'crmFilesPost' => [ + 'multipart/form-data', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -92,21 +140,31 @@ public function getConfig() * * Get all files * - * @param string $entity Filter by file entity type (optional) - * @param string $entityIds Filter by file entity IDs (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\FileList + * @param string|null $entity Filter by file entity type (optional) + * @param string|null $entityIds Filter by file entity IDs (optional) + * @param int|null $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $offset Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesGet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\FileData[]|\Brevo\Client\Models\ErrorModel */ - public function crmFilesGet($entity = null, $entityIds = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null) + public function crmFilesGet( + ?string $entity = null, + ?string $entityIds = null, + ?int $dateFrom = null, + ?int $dateTo = null, + ?int $offset = null, + ?int $limit = 50, + ?string $sort = null, + string $contentType = self::contentTypes['crmFilesGet'][0] + ): array { - list($response) = $this->crmFilesGetWithHttpInfo($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort); + list($response) = $this->crmFilesGetWithHttpInfo($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort, $contentType); return $response; } @@ -115,22 +173,31 @@ public function crmFilesGet($entity = null, $entityIds = null, $dateFrom = null, * * Get all files * - * @param string $entity Filter by file entity type (optional) - * @param string $entityIds Filter by file entity IDs (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\FileList, HTTP status code, HTTP response headers (array of strings) + * @param string|null $entity Filter by file entity type (optional) + * @param string|null $entityIds Filter by file entity IDs (optional) + * @param int|null $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $offset Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesGet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\FileData[]|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function crmFilesGetWithHttpInfo($entity = null, $entityIds = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null) + public function crmFilesGetWithHttpInfo( + ?string $entity = null, + ?string $entityIds = null, + ?int $dateFrom = null, + ?int $dateTo = null, + ?int $offset = null, + ?int $limit = 50, + ?string $sort = null, + string $contentType = self::contentTypes['crmFilesGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\FileList'; - $request = $this->crmFilesGetRequest($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort); + $request = $this->crmFilesGetRequest($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort, $contentType); try { $options = $this->createHttpClientOption(); @@ -139,34 +206,111 @@ public function crmFilesGetWithHttpInfo($entity = null, $entityIds = null, $date } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\FileData[]', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\FileData[]' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\FileData[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\FileData[]'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -181,7 +325,7 @@ public function crmFilesGetWithHttpInfo($entity = null, $entityIds = null, $date case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\FileList', + '\Brevo\Client\Models\FileData[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -189,7 +333,7 @@ public function crmFilesGetWithHttpInfo($entity = null, $entityIds = null, $date case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -204,20 +348,30 @@ public function crmFilesGetWithHttpInfo($entity = null, $entityIds = null, $date * * Get all files * - * @param string $entity Filter by file entity type (optional) - * @param string $entityIds Filter by file entity IDs (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @param string|null $entity Filter by file entity type (optional) + * @param string|null $entityIds Filter by file entity IDs (optional) + * @param int|null $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $offset Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesGet'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmFilesGetAsync($entity = null, $entityIds = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null) + public function crmFilesGetAsync( + ?string $entity = null, + ?string $entityIds = null, + ?int $dateFrom = null, + ?int $dateTo = null, + ?int $offset = null, + ?int $limit = 50, + ?string $sort = null, + string $contentType = self::contentTypes['crmFilesGet'][0] + ): PromiseInterface { - return $this->crmFilesGetAsyncWithHttpInfo($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort) + return $this->crmFilesGetAsyncWithHttpInfo($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort, $contentType) ->then( function ($response) { return $response[0]; @@ -230,31 +384,41 @@ function ($response) { * * Get all files * - * @param string $entity Filter by file entity type (optional) - * @param string $entityIds Filter by file entity IDs (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @param string|null $entity Filter by file entity type (optional) + * @param string|null $entityIds Filter by file entity IDs (optional) + * @param int|null $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $offset Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesGet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmFilesGetAsyncWithHttpInfo($entity = null, $entityIds = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null) + public function crmFilesGetAsyncWithHttpInfo( + $entity = null, + $entityIds = null, + $dateFrom = null, + $dateTo = null, + $offset = null, + $limit = 50, + $sort = null, + string $contentType = self::contentTypes['crmFilesGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\FileList'; - $request = $this->crmFilesGetRequest($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort); + $returnType = '\Brevo\Client\Models\FileData[]'; + $request = $this->crmFilesGetRequest($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -277,7 +441,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -286,20 +450,38 @@ function ($exception) { /** * Create request for operation 'crmFilesGet' * - * @param string $entity Filter by file entity type (optional) - * @param string $entityIds Filter by file entity IDs (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string|null $entity Filter by file entity type (optional) + * @param string|null $entityIds Filter by file entity IDs (optional) + * @param int|null $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $offset Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmFilesGetRequest($entity = null, $entityIds = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null) + public function crmFilesGetRequest( + $entity = null, + $entityIds = null, + $dateFrom = null, + $dateTo = null, + $offset = null, + $limit = 50, + $sort = null, + string $contentType = self::contentTypes['crmFilesGet'][0] + ): Request { + + + + + + + + $resourcePath = '/crm/files'; $formParams = []; $queryParams = []; @@ -308,82 +490,100 @@ protected function crmFilesGetRequest($entity = null, $entityIds = null, $dateFr $multipart = false; // query params - if ($entity !== null) { - $queryParams['entity'] = ObjectSerializer::toQueryValue($entity); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $entity, + 'entity', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($entityIds !== null) { - $queryParams['entityIds'] = ObjectSerializer::toQueryValue($entityIds); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $entityIds, + 'entityIds', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($dateFrom !== null) { - $queryParams['dateFrom'] = ObjectSerializer::toQueryValue($dateFrom); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $dateFrom, + 'dateFrom', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($dateTo !== null) { - $queryParams['dateTo'] = ObjectSerializer::toQueryValue($dateTo); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $dateTo, + 'dateTo', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -409,10 +609,11 @@ protected function crmFilesGetRequest($entity = null, $entityIds = null, $dateFr $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -424,14 +625,18 @@ protected function crmFilesGetRequest($entity = null, $entityIds = null, $dateFr * Get file details * * @param string $id File id to get file data. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesIdDataGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\FileData + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\FileData|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function crmFilesIdDataGet($id) + public function crmFilesIdDataGet( + string $id, + string $contentType = self::contentTypes['crmFilesIdDataGet'][0] + ): \Brevo\Client\Models\FileData { - list($response) = $this->crmFilesIdDataGetWithHttpInfo($id); + list($response) = $this->crmFilesIdDataGetWithHttpInfo($id, $contentType); return $response; } @@ -441,15 +646,18 @@ public function crmFilesIdDataGet($id) * Get file details * * @param string $id File id to get file data. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesIdDataGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\FileData, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\FileData|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function crmFilesIdDataGetWithHttpInfo($id) + public function crmFilesIdDataGetWithHttpInfo( + string $id, + string $contentType = self::contentTypes['crmFilesIdDataGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\FileData'; - $request = $this->crmFilesIdDataGetRequest($id); + $request = $this->crmFilesIdDataGetRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -458,34 +666,138 @@ public function crmFilesIdDataGetWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\FileData', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\FileData' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\FileData', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\FileData'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -500,7 +812,7 @@ public function crmFilesIdDataGetWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\FileData', + '\Brevo\Client\Models\FileData', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -508,7 +820,7 @@ public function crmFilesIdDataGetWithHttpInfo($id) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -516,7 +828,7 @@ public function crmFilesIdDataGetWithHttpInfo($id) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -532,13 +844,17 @@ public function crmFilesIdDataGetWithHttpInfo($id) * Get file details * * @param string $id File id to get file data. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesIdDataGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmFilesIdDataGetAsync($id) + public function crmFilesIdDataGetAsync( + string $id, + string $contentType = self::contentTypes['crmFilesIdDataGet'][0] + ): PromiseInterface { - return $this->crmFilesIdDataGetAsyncWithHttpInfo($id) + return $this->crmFilesIdDataGetAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -552,24 +868,28 @@ function ($response) { * Get file details * * @param string $id File id to get file data. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesIdDataGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmFilesIdDataGetAsyncWithHttpInfo($id) + public function crmFilesIdDataGetAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['crmFilesIdDataGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\FileData'; - $request = $this->crmFilesIdDataGetRequest($id); + $returnType = '\Brevo\Client\Models\FileData'; + $request = $this->crmFilesIdDataGetRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -592,7 +912,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -602,19 +922,25 @@ function ($exception) { * Create request for operation 'crmFilesIdDataGet' * * @param string $id File id to get file data. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesIdDataGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmFilesIdDataGetRequest($id) + public function crmFilesIdDataGetRequest( + $id, + string $contentType = self::contentTypes['crmFilesIdDataGet'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling crmFilesIdDataGet' ); } + $resourcePath = '/crm/files/{id}/data'; $formParams = []; $queryParams = []; @@ -623,6 +949,7 @@ protected function crmFilesIdDataGetRequest($id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -632,53 +959,35 @@ protected function crmFilesIdDataGetRequest($id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -704,10 +1013,11 @@ protected function crmFilesIdDataGetRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -719,14 +1029,18 @@ protected function crmFilesIdDataGetRequest($id) * Delete a file * * @param string $id File id to delete. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesIdDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function crmFilesIdDelete($id) + public function crmFilesIdDelete( + string $id, + string $contentType = self::contentTypes['crmFilesIdDelete'][0] + ): void { - $this->crmFilesIdDeleteWithHttpInfo($id); + $this->crmFilesIdDeleteWithHttpInfo($id, $contentType); } /** @@ -735,15 +1049,18 @@ public function crmFilesIdDelete($id) * Delete a file * * @param string $id File id to delete. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesIdDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function crmFilesIdDeleteWithHttpInfo($id) + public function crmFilesIdDeleteWithHttpInfo( + string $id, + string $contentType = self::contentTypes['crmFilesIdDelete'][0] + ): array { - $returnType = ''; - $request = $this->crmFilesIdDeleteRequest($id); + $request = $this->crmFilesIdDeleteRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -752,26 +1069,21 @@ public function crmFilesIdDeleteWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -780,7 +1092,7 @@ public function crmFilesIdDeleteWithHttpInfo($id) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -788,7 +1100,7 @@ public function crmFilesIdDeleteWithHttpInfo($id) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -804,13 +1116,17 @@ public function crmFilesIdDeleteWithHttpInfo($id) * Delete a file * * @param string $id File id to delete. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmFilesIdDeleteAsync($id) + public function crmFilesIdDeleteAsync( + string $id, + string $contentType = self::contentTypes['crmFilesIdDelete'][0] + ): PromiseInterface { - return $this->crmFilesIdDeleteAsyncWithHttpInfo($id) + return $this->crmFilesIdDeleteAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -824,14 +1140,19 @@ function ($response) { * Delete a file * * @param string $id File id to delete. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmFilesIdDeleteAsyncWithHttpInfo($id) + public function crmFilesIdDeleteAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['crmFilesIdDelete'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->crmFilesIdDeleteRequest($id); + $request = $this->crmFilesIdDeleteRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -850,7 +1171,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -860,19 +1181,25 @@ function ($exception) { * Create request for operation 'crmFilesIdDelete' * * @param string $id File id to delete. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmFilesIdDeleteRequest($id) + public function crmFilesIdDeleteRequest( + $id, + string $contentType = self::contentTypes['crmFilesIdDelete'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling crmFilesIdDelete' ); } + $resourcePath = '/crm/files/{id}'; $formParams = []; $queryParams = []; @@ -881,6 +1208,7 @@ protected function crmFilesIdDeleteRequest($id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -890,53 +1218,35 @@ protected function crmFilesIdDeleteRequest($id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -962,10 +1272,11 @@ protected function crmFilesIdDeleteRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -977,14 +1288,18 @@ protected function crmFilesIdDeleteRequest($id) * Download a file * * @param string $id File id to download. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesIdGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\FileDownloadableLink + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\FileDownloadableLink|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function crmFilesIdGet($id) + public function crmFilesIdGet( + string $id, + string $contentType = self::contentTypes['crmFilesIdGet'][0] + ): \Brevo\Client\Models\FileDownloadableLink { - list($response) = $this->crmFilesIdGetWithHttpInfo($id); + list($response) = $this->crmFilesIdGetWithHttpInfo($id, $contentType); return $response; } @@ -994,15 +1309,18 @@ public function crmFilesIdGet($id) * Download a file * * @param string $id File id to download. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesIdGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\FileDownloadableLink, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\FileDownloadableLink|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function crmFilesIdGetWithHttpInfo($id) + public function crmFilesIdGetWithHttpInfo( + string $id, + string $contentType = self::contentTypes['crmFilesIdGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\FileDownloadableLink'; - $request = $this->crmFilesIdGetRequest($id); + $request = $this->crmFilesIdGetRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1011,34 +1329,138 @@ public function crmFilesIdGetWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\FileDownloadableLink', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\FileDownloadableLink' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\FileDownloadableLink', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\FileDownloadableLink'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1053,7 +1475,7 @@ public function crmFilesIdGetWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\FileDownloadableLink', + '\Brevo\Client\Models\FileDownloadableLink', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1061,7 +1483,7 @@ public function crmFilesIdGetWithHttpInfo($id) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1069,7 +1491,7 @@ public function crmFilesIdGetWithHttpInfo($id) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1085,13 +1507,17 @@ public function crmFilesIdGetWithHttpInfo($id) * Download a file * * @param string $id File id to download. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmFilesIdGetAsync($id) + public function crmFilesIdGetAsync( + string $id, + string $contentType = self::contentTypes['crmFilesIdGet'][0] + ): PromiseInterface { - return $this->crmFilesIdGetAsyncWithHttpInfo($id) + return $this->crmFilesIdGetAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -1105,24 +1531,28 @@ function ($response) { * Download a file * * @param string $id File id to download. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmFilesIdGetAsyncWithHttpInfo($id) + public function crmFilesIdGetAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['crmFilesIdGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\FileDownloadableLink'; - $request = $this->crmFilesIdGetRequest($id); + $returnType = '\Brevo\Client\Models\FileDownloadableLink'; + $request = $this->crmFilesIdGetRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1145,7 +1575,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1155,19 +1585,25 @@ function ($exception) { * Create request for operation 'crmFilesIdGet' * * @param string $id File id to download. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmFilesIdGetRequest($id) + public function crmFilesIdGetRequest( + $id, + string $contentType = self::contentTypes['crmFilesIdGet'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling crmFilesIdGet' ); } + $resourcePath = '/crm/files/{id}'; $formParams = []; $queryParams = []; @@ -1176,6 +1612,7 @@ protected function crmFilesIdGetRequest($id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1185,53 +1622,35 @@ protected function crmFilesIdGetRequest($id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1257,10 +1676,11 @@ protected function crmFilesIdGetRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1272,17 +1692,24 @@ protected function crmFilesIdGetRequest($id) * Upload a file * * @param \SplFileObject $file File data to create a file. (required) - * @param string $dealId Deal id linked to a file (optional) - * @param int $contactId Contact id linked to a file (optional) - * @param string $companyId Company id linked to a file (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\FileData + * @param string|null $dealId dealId (optional) + * @param int|null $contactId contactId (optional) + * @param string|null $companyId companyId (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\FileData|\Brevo\Client\Models\ErrorModel */ - public function crmFilesPost($file, $dealId = null, $contactId = null, $companyId = null) + public function crmFilesPost( + \SplFileObject $file, + ?string $dealId = null, + ?int $contactId = null, + ?string $companyId = null, + string $contentType = self::contentTypes['crmFilesPost'][0] + ): \Brevo\Client\Models\FileData { - list($response) = $this->crmFilesPostWithHttpInfo($file, $dealId, $contactId, $companyId); + list($response) = $this->crmFilesPostWithHttpInfo($file, $dealId, $contactId, $companyId, $contentType); return $response; } @@ -1292,18 +1719,24 @@ public function crmFilesPost($file, $dealId = null, $contactId = null, $companyI * Upload a file * * @param \SplFileObject $file File data to create a file. (required) - * @param string $dealId Deal id linked to a file (optional) - * @param int $contactId Contact id linked to a file (optional) - * @param string $companyId Company id linked to a file (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\FileData, HTTP status code, HTTP response headers (array of strings) + * @param string|null $dealId (optional) + * @param int|null $contactId (optional) + * @param string|null $companyId (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\FileData|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function crmFilesPostWithHttpInfo($file, $dealId = null, $contactId = null, $companyId = null) + public function crmFilesPostWithHttpInfo( + \SplFileObject $file, + ?string $dealId = null, + ?int $contactId = null, + ?string $companyId = null, + string $contentType = self::contentTypes['crmFilesPost'][0] + ): array { - $returnType = '\Brevo\Client\Model\FileData'; - $request = $this->crmFilesPostRequest($file, $dealId, $contactId, $companyId); + $request = $this->crmFilesPostRequest($file, $dealId, $contactId, $companyId, $contentType); try { $options = $this->createHttpClientOption(); @@ -1312,34 +1745,111 @@ public function crmFilesPostWithHttpInfo($file, $dealId = null, $contactId = nul } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\FileData', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\FileData' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\FileData', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\FileData'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1354,7 +1864,7 @@ public function crmFilesPostWithHttpInfo($file, $dealId = null, $contactId = nul case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\FileData', + '\Brevo\Client\Models\FileData', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1362,7 +1872,7 @@ public function crmFilesPostWithHttpInfo($file, $dealId = null, $contactId = nul case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1378,16 +1888,23 @@ public function crmFilesPostWithHttpInfo($file, $dealId = null, $contactId = nul * Upload a file * * @param \SplFileObject $file File data to create a file. (required) - * @param string $dealId Deal id linked to a file (optional) - * @param int $contactId Contact id linked to a file (optional) - * @param string $companyId Company id linked to a file (optional) + * @param string|null $dealId (optional) + * @param int|null $contactId (optional) + * @param string|null $companyId (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmFilesPostAsync($file, $dealId = null, $contactId = null, $companyId = null) + public function crmFilesPostAsync( + \SplFileObject $file, + ?string $dealId = null, + ?int $contactId = null, + ?string $companyId = null, + string $contentType = self::contentTypes['crmFilesPost'][0] + ): PromiseInterface { - return $this->crmFilesPostAsyncWithHttpInfo($file, $dealId, $contactId, $companyId) + return $this->crmFilesPostAsyncWithHttpInfo($file, $dealId, $contactId, $companyId, $contentType) ->then( function ($response) { return $response[0]; @@ -1401,27 +1918,34 @@ function ($response) { * Upload a file * * @param \SplFileObject $file File data to create a file. (required) - * @param string $dealId Deal id linked to a file (optional) - * @param int $contactId Contact id linked to a file (optional) - * @param string $companyId Company id linked to a file (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @param string|null $dealId (optional) + * @param int|null $contactId (optional) + * @param string|null $companyId (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmFilesPostAsyncWithHttpInfo($file, $dealId = null, $contactId = null, $companyId = null) + public function crmFilesPostAsyncWithHttpInfo( + $file, + $dealId = null, + $contactId = null, + $companyId = null, + string $contentType = self::contentTypes['crmFilesPost'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\FileData'; - $request = $this->crmFilesPostRequest($file, $dealId, $contactId, $companyId); + $returnType = '\Brevo\Client\Models\FileData'; + $request = $this->crmFilesPostRequest($file, $dealId, $contactId, $companyId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1444,7 +1968,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1454,22 +1978,34 @@ function ($exception) { * Create request for operation 'crmFilesPost' * * @param \SplFileObject $file File data to create a file. (required) - * @param string $dealId Deal id linked to a file (optional) - * @param int $contactId Contact id linked to a file (optional) - * @param string $companyId Company id linked to a file (optional) + * @param string|null $dealId (optional) + * @param int|null $contactId (optional) + * @param string|null $companyId (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmFilesPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmFilesPostRequest($file, $dealId = null, $contactId = null, $companyId = null) + public function crmFilesPostRequest( + $file, + $dealId = null, + $contactId = null, + $companyId = null, + string $contentType = self::contentTypes['crmFilesPost'][0] + ): Request { + // verify the required parameter 'file' is set if ($file === null || (is_array($file) && count($file) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $file when calling crmFilesPost' ); } + + + + $resourcePath = '/crm/files'; $formParams = []; $queryParams = []; @@ -1479,10 +2015,20 @@ protected function crmFilesPostRequest($file, $dealId = null, $contactId = null, + // form params if ($file !== null) { $multipart = true; - $formParams['file'] = \GuzzleHttp\Psr7\try_fopen(ObjectSerializer::toFormValue($file), 'rb'); + $formParams['file'] = []; + $paramFiles = is_array($file) ? $file : [$file]; + foreach ($paramFiles as $paramFile) { + $formParams['file'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface + ? $paramFile + : \GuzzleHttp\Psr7\Utils::tryFopen( + ObjectSerializer::toFormValue($paramFile), + 'rb' + ); + } } // form params if ($dealId !== null) { @@ -1496,53 +2042,35 @@ protected function crmFilesPostRequest($file, $dealId = null, $contactId = null, if ($companyId !== null) { $formParams['companyId'] = ObjectSerializer::toFormValue($companyId); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['multipart/form-data'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1568,10 +2096,11 @@ protected function crmFilesPostRequest($file, $dealId = null, $contactId = null, $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1583,7 +2112,7 @@ protected function crmFilesPostRequest($file, $dealId = null, $contactId = null, * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/FoldersApi.php b/lib/Api/FoldersApi.php deleted file mode 100644 index 80d50fb..0000000 --- a/lib/Api/FoldersApi.php +++ /dev/null @@ -1,1852 +0,0 @@ -client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation createFolder - * - * Create a folder - * - * @param \Brevo\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreateModel - */ - public function createFolder($createFolder) - { - list($response) = $this->createFolderWithHttpInfo($createFolder); - return $response; - } - - /** - * Operation createFolderWithHttpInfo - * - * Create a folder - * - * @param \Brevo\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings) - */ - public function createFolderWithHttpInfo($createFolder) - { - $returnType = '\Brevo\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(), - '\Brevo\Client\Model\CreateModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation createFolderAsync - * - * Create a folder - * - * @param \Brevo\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 \Brevo\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createFolderAsyncWithHttpInfo($createFolder) - { - $returnType = '\Brevo\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 \Brevo\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 || (is_array($createFolder) && count($createFolder) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $createFolder when calling createFolder' - ); - } - - $resourcePath = '/contacts/folders'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // body params - $_tempBody = null; - if (isset($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)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($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 \Brevo\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 \Brevo\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()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deleteFolderAsync - * - * Delete a folder (and all its lists) - * - * @param int $folderId Id of the folder (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteFolderAsync($folderId) - { - return $this->deleteFolderAsyncWithHttpInfo($folderId) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deleteFolderAsyncWithHttpInfo - * - * Delete a folder (and all its lists) - * - * @param int $folderId Id of the folder (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - 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 || (is_array($folderId) && count($folderId) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $folderId when calling deleteFolder' - ); - } - - $resourcePath = '/contacts/folders/{folderId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // 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; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getFolder - * - * Returns a folder's details - * - * @param int $folderId id of the folder (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetFolder - */ - public function getFolder($folderId) - { - list($response) = $this->getFolderWithHttpInfo($folderId); - return $response; - } - - /** - * Operation getFolderWithHttpInfo - * - * Returns a folder's details - * - * @param int $folderId id of the folder (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetFolder, HTTP status code, HTTP response headers (array of strings) - */ - public function getFolderWithHttpInfo($folderId) - { - $returnType = '\Brevo\Client\Model\GetFolder'; - $request = $this->getFolderRequest($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() - ); - } - - $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(), - '\Brevo\Client\Model\GetFolder', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getFolderAsync - * - * Returns a folder's details - * - * @param int $folderId id of the folder (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getFolderAsync($folderId) - { - return $this->getFolderAsyncWithHttpInfo($folderId) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getFolderAsyncWithHttpInfo - * - * Returns a folder's details - * - * @param int $folderId id of the folder (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getFolderAsyncWithHttpInfo($folderId) - { - $returnType = '\Brevo\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 || (is_array($folderId) && count($folderId) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $folderId when calling getFolder' - ); - } - - $resourcePath = '/contacts/folders/{folderId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // 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; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getFolderLists - * - * Get 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetFolderLists - */ - public function getFolderLists($folderId, $limit = '10', $offset = '0', $sort = 'desc') - { - list($response) = $this->getFolderListsWithHttpInfo($folderId, $limit, $offset, $sort); - return $response; - } - - /** - * Operation getFolderListsWithHttpInfo - * - * Get 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetFolderLists, HTTP status code, HTTP response headers (array of strings) - */ - public function getFolderListsWithHttpInfo($folderId, $limit = '10', $offset = '0', $sort = 'desc') - { - $returnType = '\Brevo\Client\Model\GetFolderLists'; - $request = $this->getFolderListsRequest($folderId, $limit, $offset, $sort); - - 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(), - '\Brevo\Client\Model\GetFolderLists', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getFolderListsAsync - * - * Get 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getFolderListsAsync($folderId, $limit = '10', $offset = '0', $sort = 'desc') - { - return $this->getFolderListsAsyncWithHttpInfo($folderId, $limit, $offset, $sort) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getFolderListsAsyncWithHttpInfo - * - * Get 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getFolderListsAsyncWithHttpInfo($folderId, $limit = '10', $offset = '0', $sort = 'desc') - { - $returnType = '\Brevo\Client\Model\GetFolderLists'; - $request = $this->getFolderListsRequest($folderId, $limit, $offset, $sort); - - 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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getFolderListsRequest($folderId, $limit = '10', $offset = '0', $sort = 'desc') - { - // verify the required parameter 'folderId' is set - if ($folderId === null || (is_array($folderId) && count($folderId) === 0)) { - 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); - } - // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } - - // 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; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getFolders - * - * Get all folders - * - * @param int $limit Number of documents per page (required) - * @param int $offset Index of the first document of the page (required) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetFolders - */ - public function getFolders($limit, $offset, $sort = 'desc') - { - list($response) = $this->getFoldersWithHttpInfo($limit, $offset, $sort); - return $response; - } - - /** - * Operation getFoldersWithHttpInfo - * - * Get all folders - * - * @param int $limit Number of documents per page (required) - * @param int $offset Index of the first document of the page (required) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetFolders, HTTP status code, HTTP response headers (array of strings) - */ - public function getFoldersWithHttpInfo($limit, $offset, $sort = 'desc') - { - $returnType = '\Brevo\Client\Model\GetFolders'; - $request = $this->getFoldersRequest($limit, $offset, $sort); - - 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(), - '\Brevo\Client\Model\GetFolders', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getFoldersAsync - * - * Get all folders - * - * @param int $limit Number of documents per page (required) - * @param int $offset Index of the first document of the page (required) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getFoldersAsync($limit, $offset, $sort = 'desc') - { - return $this->getFoldersAsyncWithHttpInfo($limit, $offset, $sort) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getFoldersAsyncWithHttpInfo - * - * Get all folders - * - * @param int $limit Number of documents per page (required) - * @param int $offset Index of the first document of the page (required) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getFoldersAsyncWithHttpInfo($limit, $offset, $sort = 'desc') - { - $returnType = '\Brevo\Client\Model\GetFolders'; - $request = $this->getFoldersRequest($limit, $offset, $sort); - - 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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getFoldersRequest($limit, $offset, $sort = 'desc') - { - // verify the required parameter 'limit' is set - if ($limit === null || (is_array($limit) && count($limit) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $limit when calling getFolders' - ); - } - 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 || (is_array($offset) && count($offset) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $offset when calling getFolders' - ); - } - - $resourcePath = '/contacts/folders'; - $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); - } - // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } - - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation updateFolder - * - * Update a folder - * - * @param int $folderId Id of the folder (required) - * @param \Brevo\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function updateFolder($folderId, $updateFolder) - { - $this->updateFolderWithHttpInfo($folderId, $updateFolder); - } - - /** - * Operation updateFolderWithHttpInfo - * - * Update a folder - * - * @param int $folderId Id of the folder (required) - * @param \Brevo\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) - * - * @throws \Brevo\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 { - $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(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation updateFolderAsync - * - * Update a folder - * - * @param int $folderId Id of the folder (required) - * @param \Brevo\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateFolderAsync($folderId, $updateFolder) - { - return $this->updateFolderAsyncWithHttpInfo($folderId, $updateFolder) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateFolderAsyncWithHttpInfo - * - * Update a folder - * - * @param int $folderId Id of the folder (required) - * @param \Brevo\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - 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 \Brevo\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 || (is_array($folderId) && count($folderId) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $folderId when calling updateFolder' - ); - } - // verify the required parameter 'updateFolder' is set - if ($updateFolder === null || (is_array($updateFolder) && count($updateFolder) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $updateFolder when calling updateFolder' - ); - } - - $resourcePath = '/contacts/folders/{folderId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($folderId !== null) { - $resourcePath = str_replace( - '{' . '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)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($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/InboundParsingApi.php b/lib/Api/InboundParsingApi.php index 865dd15..54733a5 100644 --- a/lib/Api/InboundParsingApi.php +++ b/lib/Api/InboundParsingApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'getInboundEmailEvents' => [ + 'application/json', + ], + 'getInboundEmailEventsByUuid' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -93,14 +135,18 @@ public function getConfig() * Retrieve inbound attachment with download token. * * @param string $downloadToken Token to fetch a particular attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboundEmailAttachment'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \SplFileObject + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \SplFileObject|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function getInboundEmailAttachment($downloadToken) + public function getInboundEmailAttachment( + string $downloadToken, + string $contentType = self::contentTypes['getInboundEmailAttachment'][0] + ): \SplFileObject { - list($response) = $this->getInboundEmailAttachmentWithHttpInfo($downloadToken); + list($response) = $this->getInboundEmailAttachmentWithHttpInfo($downloadToken, $contentType); return $response; } @@ -110,15 +156,18 @@ public function getInboundEmailAttachment($downloadToken) * Retrieve inbound attachment with download token. * * @param string $downloadToken Token to fetch a particular attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboundEmailAttachment'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \SplFileObject|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getInboundEmailAttachmentWithHttpInfo($downloadToken) + public function getInboundEmailAttachmentWithHttpInfo( + string $downloadToken, + string $contentType = self::contentTypes['getInboundEmailAttachment'][0] + ): array { - $returnType = '\SplFileObject'; - $request = $this->getInboundEmailAttachmentRequest($downloadToken); + $request = $this->getInboundEmailAttachmentRequest($downloadToken, $contentType); try { $options = $this->createHttpClientOption(); @@ -127,34 +176,138 @@ public function getInboundEmailAttachmentWithHttpInfo($downloadToken) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\SplFileObject', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\SplFileObject' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\SplFileObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\SplFileObject'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -177,7 +330,7 @@ public function getInboundEmailAttachmentWithHttpInfo($downloadToken) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -185,7 +338,7 @@ public function getInboundEmailAttachmentWithHttpInfo($downloadToken) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -201,13 +354,17 @@ public function getInboundEmailAttachmentWithHttpInfo($downloadToken) * Retrieve inbound attachment with download token. * * @param string $downloadToken Token to fetch a particular attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboundEmailAttachment'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getInboundEmailAttachmentAsync($downloadToken) + public function getInboundEmailAttachmentAsync( + string $downloadToken, + string $contentType = self::contentTypes['getInboundEmailAttachment'][0] + ): PromiseInterface { - return $this->getInboundEmailAttachmentAsyncWithHttpInfo($downloadToken) + return $this->getInboundEmailAttachmentAsyncWithHttpInfo($downloadToken, $contentType) ->then( function ($response) { return $response[0]; @@ -221,24 +378,28 @@ function ($response) { * Retrieve inbound attachment with download token. * * @param string $downloadToken Token to fetch a particular attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboundEmailAttachment'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getInboundEmailAttachmentAsyncWithHttpInfo($downloadToken) + public function getInboundEmailAttachmentAsyncWithHttpInfo( + $downloadToken, + string $contentType = self::contentTypes['getInboundEmailAttachment'][0] + ): PromiseInterface { $returnType = '\SplFileObject'; - $request = $this->getInboundEmailAttachmentRequest($downloadToken); + $request = $this->getInboundEmailAttachmentRequest($downloadToken, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -261,7 +422,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -271,19 +432,25 @@ function ($exception) { * Create request for operation 'getInboundEmailAttachment' * * @param string $downloadToken Token to fetch a particular attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboundEmailAttachment'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getInboundEmailAttachmentRequest($downloadToken) + public function getInboundEmailAttachmentRequest( + $downloadToken, + string $contentType = self::contentTypes['getInboundEmailAttachment'][0] + ): Request { + // verify the required parameter 'downloadToken' is set if ($downloadToken === null || (is_array($downloadToken) && count($downloadToken) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $downloadToken when calling getInboundEmailAttachment' ); } + $resourcePath = '/inbound/attachments/{downloadToken}'; $formParams = []; $queryParams = []; @@ -292,6 +459,7 @@ protected function getInboundEmailAttachmentRequest($downloadToken) $multipart = false; + // path params if ($downloadToken !== null) { $resourcePath = str_replace( @@ -301,53 +469,35 @@ protected function getInboundEmailAttachmentRequest($downloadToken) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/octet-stream', 'application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -373,10 +523,11 @@ protected function getInboundEmailAttachmentRequest($downloadToken) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -387,20 +538,29 @@ protected function getInboundEmailAttachmentRequest($downloadToken) * * Get the list of all the events for the received emails. * - * @param string $sender Email address of the sender. (optional) - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) from which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param int $limit Number of documents returned per page (optional, default to 100) - * @param int $offset Index of the first document on the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation (optional, default to desc) + * @param string|null $sender Email address of the sender. (optional) + * @param string|null $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) from which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * @param string|null $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * @param int|null $limit Number of documents returned per page (optional, default to 100) + * @param int|null $offset Index of the first document on the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboundEmailEvents'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetInboundEmailEvents + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetInboundEmailEvents|\Brevo\Client\Models\ErrorModel */ - public function getInboundEmailEvents($sender = null, $startDate = null, $endDate = null, $limit = '100', $offset = '0', $sort = 'desc') + public function getInboundEmailEvents( + ?string $sender = null, + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 100, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getInboundEmailEvents'][0] + ): \Brevo\Client\Models\GetInboundEmailEvents { - list($response) = $this->getInboundEmailEventsWithHttpInfo($sender, $startDate, $endDate, $limit, $offset, $sort); + list($response) = $this->getInboundEmailEventsWithHttpInfo($sender, $startDate, $endDate, $limit, $offset, $sort, $contentType); return $response; } @@ -409,21 +569,29 @@ public function getInboundEmailEvents($sender = null, $startDate = null, $endDat * * Get the list of all the events for the received emails. * - * @param string $sender Email address of the sender. (optional) - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) from which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param int $limit Number of documents returned per page (optional, default to 100) - * @param int $offset Index of the first document on the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation (optional, default to desc) + * @param string|null $sender Email address of the sender. (optional) + * @param string|null $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) from which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * @param string|null $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * @param int|null $limit Number of documents returned per page (optional, default to 100) + * @param int|null $offset Index of the first document on the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboundEmailEvents'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetInboundEmailEvents, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetInboundEmailEvents|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getInboundEmailEventsWithHttpInfo($sender = null, $startDate = null, $endDate = null, $limit = '100', $offset = '0', $sort = 'desc') + public function getInboundEmailEventsWithHttpInfo( + ?string $sender = null, + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 100, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getInboundEmailEvents'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetInboundEmailEvents'; - $request = $this->getInboundEmailEventsRequest($sender, $startDate, $endDate, $limit, $offset, $sort); + $request = $this->getInboundEmailEventsRequest($sender, $startDate, $endDate, $limit, $offset, $sort, $contentType); try { $options = $this->createHttpClientOption(); @@ -432,34 +600,111 @@ public function getInboundEmailEventsWithHttpInfo($sender = null, $startDate = n } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetInboundEmailEvents', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetInboundEmailEvents' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetInboundEmailEvents', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetInboundEmailEvents'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -474,7 +719,7 @@ public function getInboundEmailEventsWithHttpInfo($sender = null, $startDate = n case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetInboundEmailEvents', + '\Brevo\Client\Models\GetInboundEmailEvents', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -482,7 +727,7 @@ public function getInboundEmailEventsWithHttpInfo($sender = null, $startDate = n case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -497,19 +742,28 @@ public function getInboundEmailEventsWithHttpInfo($sender = null, $startDate = n * * Get the list of all the events for the received emails. * - * @param string $sender Email address of the sender. (optional) - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) from which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param int $limit Number of documents returned per page (optional, default to 100) - * @param int $offset Index of the first document on the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation (optional, default to desc) + * @param string|null $sender Email address of the sender. (optional) + * @param string|null $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) from which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * @param string|null $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * @param int|null $limit Number of documents returned per page (optional, default to 100) + * @param int|null $offset Index of the first document on the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboundEmailEvents'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getInboundEmailEventsAsync($sender = null, $startDate = null, $endDate = null, $limit = '100', $offset = '0', $sort = 'desc') + public function getInboundEmailEventsAsync( + ?string $sender = null, + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 100, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getInboundEmailEvents'][0] + ): PromiseInterface { - return $this->getInboundEmailEventsAsyncWithHttpInfo($sender, $startDate, $endDate, $limit, $offset, $sort) + return $this->getInboundEmailEventsAsyncWithHttpInfo($sender, $startDate, $endDate, $limit, $offset, $sort, $contentType) ->then( function ($response) { return $response[0]; @@ -522,30 +776,39 @@ function ($response) { * * Get the list of all the events for the received emails. * - * @param string $sender Email address of the sender. (optional) - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) from which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param int $limit Number of documents returned per page (optional, default to 100) - * @param int $offset Index of the first document on the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation (optional, default to desc) + * @param string|null $sender Email address of the sender. (optional) + * @param string|null $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) from which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * @param string|null $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * @param int|null $limit Number of documents returned per page (optional, default to 100) + * @param int|null $offset Index of the first document on the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboundEmailEvents'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getInboundEmailEventsAsyncWithHttpInfo($sender = null, $startDate = null, $endDate = null, $limit = '100', $offset = '0', $sort = 'desc') + public function getInboundEmailEventsAsyncWithHttpInfo( + $sender = null, + $startDate = null, + $endDate = null, + $limit = 100, + $offset = 0, + $sort = 'desc', + string $contentType = self::contentTypes['getInboundEmailEvents'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetInboundEmailEvents'; - $request = $this->getInboundEmailEventsRequest($sender, $startDate, $endDate, $limit, $offset, $sort); + $returnType = '\Brevo\Client\Models\GetInboundEmailEvents'; + $request = $this->getInboundEmailEventsRequest($sender, $startDate, $endDate, $limit, $offset, $sort, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -568,7 +831,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -577,24 +840,39 @@ function ($exception) { /** * Create request for operation 'getInboundEmailEvents' * - * @param string $sender Email address of the sender. (optional) - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) from which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param int $limit Number of documents returned per page (optional, default to 100) - * @param int $offset Index of the first document on the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record creation (optional, default to desc) + * @param string|null $sender Email address of the sender. (optional) + * @param string|null $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) from which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * @param string|null $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * @param int|null $limit Number of documents returned per page (optional, default to 100) + * @param int|null $offset Index of the first document on the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboundEmailEvents'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getInboundEmailEventsRequest($sender = null, $startDate = null, $endDate = null, $limit = '100', $offset = '0', $sort = 'desc') + public function getInboundEmailEventsRequest( + $sender = null, + $startDate = null, + $endDate = null, + $limit = 100, + $offset = 0, + $sort = 'desc', + string $contentType = self::contentTypes['getInboundEmailEvents'][0] + ): Request { + + + + if ($limit !== null && $limit > 500) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling InboundParsingApi.getInboundEmailEvents, must be smaller than or equal to 500.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling InboundParsingApi.getInboundEmailEvents, must be smaller than or equal to 500.'); } if ($limit !== null && $limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling InboundParsingApi.getInboundEmailEvents, must be bigger than or equal to 0.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling InboundParsingApi.getInboundEmailEvents, must be bigger than or equal to 0.'); } + + $resourcePath = '/inbound/events'; @@ -605,78 +883,91 @@ protected function getInboundEmailEventsRequest($sender = null, $startDate = nul $multipart = false; // query params - if ($sender !== null) { - $queryParams['sender'] = ObjectSerializer::toQueryValue($sender); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sender, + 'sender', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($startDate !== null) { - $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($endDate !== null) { - $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -702,10 +993,11 @@ protected function getInboundEmailEventsRequest($sender = null, $startDate = nul $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -717,14 +1009,18 @@ protected function getInboundEmailEventsRequest($sender = null, $startDate = nul * Fetch all events history for one particular received email. * * @param string $uuid UUID to fetch events specific to recieved email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboundEmailEventsByUuid'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetInboundEmailEventsByUuid + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetInboundEmailEventsByUuid|\Brevo\Client\Models\ErrorModel */ - public function getInboundEmailEventsByUuid($uuid) + public function getInboundEmailEventsByUuid( + string $uuid, + string $contentType = self::contentTypes['getInboundEmailEventsByUuid'][0] + ): \Brevo\Client\Models\GetInboundEmailEventsByUuid { - list($response) = $this->getInboundEmailEventsByUuidWithHttpInfo($uuid); + list($response) = $this->getInboundEmailEventsByUuidWithHttpInfo($uuid, $contentType); return $response; } @@ -734,15 +1030,18 @@ public function getInboundEmailEventsByUuid($uuid) * Fetch all events history for one particular received email. * * @param string $uuid UUID to fetch events specific to recieved email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboundEmailEventsByUuid'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetInboundEmailEventsByUuid, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetInboundEmailEventsByUuid|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getInboundEmailEventsByUuidWithHttpInfo($uuid) + public function getInboundEmailEventsByUuidWithHttpInfo( + string $uuid, + string $contentType = self::contentTypes['getInboundEmailEventsByUuid'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetInboundEmailEventsByUuid'; - $request = $this->getInboundEmailEventsByUuidRequest($uuid); + $request = $this->getInboundEmailEventsByUuidRequest($uuid, $contentType); try { $options = $this->createHttpClientOption(); @@ -751,34 +1050,111 @@ public function getInboundEmailEventsByUuidWithHttpInfo($uuid) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetInboundEmailEventsByUuid', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetInboundEmailEventsByUuid' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetInboundEmailEventsByUuid', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetInboundEmailEventsByUuid'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -793,7 +1169,7 @@ public function getInboundEmailEventsByUuidWithHttpInfo($uuid) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetInboundEmailEventsByUuid', + '\Brevo\Client\Models\GetInboundEmailEventsByUuid', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -801,7 +1177,7 @@ public function getInboundEmailEventsByUuidWithHttpInfo($uuid) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -817,13 +1193,17 @@ public function getInboundEmailEventsByUuidWithHttpInfo($uuid) * Fetch all events history for one particular received email. * * @param string $uuid UUID to fetch events specific to recieved email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboundEmailEventsByUuid'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getInboundEmailEventsByUuidAsync($uuid) + public function getInboundEmailEventsByUuidAsync( + string $uuid, + string $contentType = self::contentTypes['getInboundEmailEventsByUuid'][0] + ): PromiseInterface { - return $this->getInboundEmailEventsByUuidAsyncWithHttpInfo($uuid) + return $this->getInboundEmailEventsByUuidAsyncWithHttpInfo($uuid, $contentType) ->then( function ($response) { return $response[0]; @@ -837,24 +1217,28 @@ function ($response) { * Fetch all events history for one particular received email. * * @param string $uuid UUID to fetch events specific to recieved email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboundEmailEventsByUuid'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getInboundEmailEventsByUuidAsyncWithHttpInfo($uuid) + public function getInboundEmailEventsByUuidAsyncWithHttpInfo( + $uuid, + string $contentType = self::contentTypes['getInboundEmailEventsByUuid'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetInboundEmailEventsByUuid'; - $request = $this->getInboundEmailEventsByUuidRequest($uuid); + $returnType = '\Brevo\Client\Models\GetInboundEmailEventsByUuid'; + $request = $this->getInboundEmailEventsByUuidRequest($uuid, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -877,7 +1261,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -887,19 +1271,25 @@ function ($exception) { * Create request for operation 'getInboundEmailEventsByUuid' * * @param string $uuid UUID to fetch events specific to recieved email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboundEmailEventsByUuid'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getInboundEmailEventsByUuidRequest($uuid) + public function getInboundEmailEventsByUuidRequest( + $uuid, + string $contentType = self::contentTypes['getInboundEmailEventsByUuid'][0] + ): Request { + // verify the required parameter 'uuid' is set if ($uuid === null || (is_array($uuid) && count($uuid) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $uuid when calling getInboundEmailEventsByUuid' ); } + $resourcePath = '/inbound/events/{uuid}'; $formParams = []; $queryParams = []; @@ -908,6 +1298,7 @@ protected function getInboundEmailEventsByUuidRequest($uuid) $multipart = false; + // path params if ($uuid !== null) { $resourcePath = str_replace( @@ -917,53 +1308,35 @@ protected function getInboundEmailEventsByUuidRequest($uuid) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -989,10 +1362,11 @@ protected function getInboundEmailEventsByUuidRequest($uuid) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1004,7 +1378,7 @@ protected function getInboundEmailEventsByUuidRequest($uuid) * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/ListsApi.php b/lib/Api/ListsApi.php deleted file mode 100644 index da332bd..0000000 --- a/lib/Api/ListsApi.php +++ /dev/null @@ -1,2793 +0,0 @@ -client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation addContactToList - * - * Add existing contacts to a list - * - * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\AddContactToList $contactEmails Emails addresses OR IDs of the contacts (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\PostContactInfo - */ - public function addContactToList($listId, $contactEmails) - { - list($response) = $this->addContactToListWithHttpInfo($listId, $contactEmails); - return $response; - } - - /** - * Operation addContactToListWithHttpInfo - * - * Add existing contacts to a list - * - * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\AddContactToList $contactEmails Emails addresses OR IDs of the contacts (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\PostContactInfo, HTTP status code, HTTP response headers (array of strings) - */ - public function addContactToListWithHttpInfo($listId, $contactEmails) - { - $returnType = '\Brevo\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(), - '\Brevo\Client\Model\PostContactInfo', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\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 \Brevo\Client\Model\AddContactToList $contactEmails Emails addresses OR IDs 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 \Brevo\Client\Model\AddContactToList $contactEmails Emails addresses OR IDs of the contacts (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function addContactToListAsyncWithHttpInfo($listId, $contactEmails) - { - $returnType = '\Brevo\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 \Brevo\Client\Model\AddContactToList $contactEmails Emails addresses OR IDs 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 || (is_array($listId) && count($listId) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $listId when calling addContactToList' - ); - } - // verify the required parameter 'contactEmails' is set - if ($contactEmails === null || (is_array($contactEmails) && count($contactEmails) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $contactEmails when calling addContactToList' - ); - } - - $resourcePath = '/contacts/lists/{listId}/contacts/add'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($listId !== null) { - $resourcePath = str_replace( - '{' . '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)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation createList - * - * Create a list - * - * @param \Brevo\Client\Model\CreateList $createList Values to create a list (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreateModel - */ - public function createList($createList) - { - list($response) = $this->createListWithHttpInfo($createList); - return $response; - } - - /** - * Operation createListWithHttpInfo - * - * Create a list - * - * @param \Brevo\Client\Model\CreateList $createList Values to create a list (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings) - */ - public function createListWithHttpInfo($createList) - { - $returnType = '\Brevo\Client\Model\CreateModel'; - $request = $this->createListRequest($createList); - - 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(), - '\Brevo\Client\Model\CreateModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation createListAsync - * - * Create a list - * - * @param \Brevo\Client\Model\CreateList $createList Values to create a list (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createListAsync($createList) - { - return $this->createListAsyncWithHttpInfo($createList) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createListAsyncWithHttpInfo - * - * Create a list - * - * @param \Brevo\Client\Model\CreateList $createList Values to create a list (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createListAsyncWithHttpInfo($createList) - { - $returnType = '\Brevo\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 \Brevo\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 || (is_array($createList) && count($createList) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $createList when calling createList' - ); - } - - $resourcePath = '/contacts/lists'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // body params - $_tempBody = null; - if (isset($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)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation deleteList - * - * Delete a list - * - * @param int $listId Id of the list (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function deleteList($listId) - { - $this->deleteListWithHttpInfo($listId); - } - - /** - * Operation deleteListWithHttpInfo - * - * Delete a list - * - * @param int $listId Id of the list (required) - * - * @throws \Brevo\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) - { - $returnType = ''; - $request = $this->deleteListRequest($listId); - - 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(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deleteListAsync - * - * Delete a list - * - * @param int $listId Id of the list (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteListAsync($listId) - { - return $this->deleteListAsyncWithHttpInfo($listId) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deleteListAsyncWithHttpInfo - * - * Delete a list - * - * @param int $listId Id of the list (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - 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 || (is_array($listId) && count($listId) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $listId when calling deleteList' - ); - } - - $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; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getContactsFromList - * - * Get contacts in a list - * - * @param int $listId Id of the list (required) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetContacts - */ - public function getContactsFromList($listId, $modifiedSince = null, $limit = '50', $offset = '0', $sort = 'desc') - { - list($response) = $this->getContactsFromListWithHttpInfo($listId, $modifiedSince, $limit, $offset, $sort); - return $response; - } - - /** - * Operation getContactsFromListWithHttpInfo - * - * Get contacts in a list - * - * @param int $listId Id of the list (required) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetContacts, HTTP status code, HTTP response headers (array of strings) - */ - public function getContactsFromListWithHttpInfo($listId, $modifiedSince = null, $limit = '50', $offset = '0', $sort = 'desc') - { - $returnType = '\Brevo\Client\Model\GetContacts'; - $request = $this->getContactsFromListRequest($listId, $modifiedSince, $limit, $offset, $sort); - - 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(), - '\Brevo\Client\Model\GetContacts', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getContactsFromListAsync - * - * Get contacts in a list - * - * @param int $listId Id of the list (required) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getContactsFromListAsync($listId, $modifiedSince = null, $limit = '50', $offset = '0', $sort = 'desc') - { - return $this->getContactsFromListAsyncWithHttpInfo($listId, $modifiedSince, $limit, $offset, $sort) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getContactsFromListAsyncWithHttpInfo - * - * Get contacts in a list - * - * @param int $listId Id of the list (required) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getContactsFromListAsyncWithHttpInfo($listId, $modifiedSince = null, $limit = '50', $offset = '0', $sort = 'desc') - { - $returnType = '\Brevo\Client\Model\GetContacts'; - $request = $this->getContactsFromListRequest($listId, $modifiedSince, $limit, $offset, $sort); - - 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 string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getContactsFromListRequest($listId, $modifiedSince = null, $limit = '50', $offset = '0', $sort = 'desc') - { - // verify the required parameter 'listId' is set - if ($listId === null || (is_array($listId) && count($listId) === 0)) { - 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); - } - // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } - - // 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; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getFolderLists - * - * Get 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetFolderLists - */ - public function getFolderLists($folderId, $limit = '10', $offset = '0', $sort = 'desc') - { - list($response) = $this->getFolderListsWithHttpInfo($folderId, $limit, $offset, $sort); - return $response; - } - - /** - * Operation getFolderListsWithHttpInfo - * - * Get 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetFolderLists, HTTP status code, HTTP response headers (array of strings) - */ - public function getFolderListsWithHttpInfo($folderId, $limit = '10', $offset = '0', $sort = 'desc') - { - $returnType = '\Brevo\Client\Model\GetFolderLists'; - $request = $this->getFolderListsRequest($folderId, $limit, $offset, $sort); - - 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(), - '\Brevo\Client\Model\GetFolderLists', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getFolderListsAsync - * - * Get 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getFolderListsAsync($folderId, $limit = '10', $offset = '0', $sort = 'desc') - { - return $this->getFolderListsAsyncWithHttpInfo($folderId, $limit, $offset, $sort) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getFolderListsAsyncWithHttpInfo - * - * Get 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getFolderListsAsyncWithHttpInfo($folderId, $limit = '10', $offset = '0', $sort = 'desc') - { - $returnType = '\Brevo\Client\Model\GetFolderLists'; - $request = $this->getFolderListsRequest($folderId, $limit, $offset, $sort); - - 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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getFolderListsRequest($folderId, $limit = '10', $offset = '0', $sort = 'desc') - { - // verify the required parameter 'folderId' is set - if ($folderId === null || (is_array($folderId) && count($folderId) === 0)) { - 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 ListsApi.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); - } - // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } - - // 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; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getList - * - * Get a list's details - * - * @param int $listId Id of the list (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetExtendedList - */ - public function getList($listId) - { - list($response) = $this->getListWithHttpInfo($listId); - return $response; - } - - /** - * Operation getListWithHttpInfo - * - * Get a list's details - * - * @param int $listId Id of the list (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetExtendedList, HTTP status code, HTTP response headers (array of strings) - */ - public function getListWithHttpInfo($listId) - { - $returnType = '\Brevo\Client\Model\GetExtendedList'; - $request = $this->getListRequest($listId); - - 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(), - '\Brevo\Client\Model\GetExtendedList', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getListAsync - * - * Get a list's details - * - * @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 a list's details - * - * @param int $listId Id of the list (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getListAsyncWithHttpInfo($listId) - { - $returnType = '\Brevo\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 || (is_array($listId) && count($listId) === 0)) { - 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; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetLists - */ - public function getLists($limit = '10', $offset = '0', $sort = 'desc') - { - list($response) = $this->getListsWithHttpInfo($limit, $offset, $sort); - 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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetLists, HTTP status code, HTTP response headers (array of strings) - */ - public function getListsWithHttpInfo($limit = '10', $offset = '0', $sort = 'desc') - { - $returnType = '\Brevo\Client\Model\GetLists'; - $request = $this->getListsRequest($limit, $offset, $sort); - - 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(), - '\Brevo\Client\Model\GetLists', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * 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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getListsAsync($limit = '10', $offset = '0', $sort = 'desc') - { - return $this->getListsAsyncWithHttpInfo($limit, $offset, $sort) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * 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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getListsAsyncWithHttpInfo($limit = '10', $offset = '0', $sort = 'desc') - { - $returnType = '\Brevo\Client\Model\GetLists'; - $request = $this->getListsRequest($limit, $offset, $sort); - - 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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getListsRequest($limit = '10', $offset = '0', $sort = 'desc') - { - if ($limit !== null && $limit > 50) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling ListsApi.getLists, must be smaller than or equal to 50.'); - } - - - $resourcePath = '/contacts/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); - } - // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } - - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation removeContactFromList - * - * Delete a contact from a list - * - * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\RemoveContactFromList $contactEmails Emails addresses OR IDs of the contacts (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\PostContactInfo - */ - public function removeContactFromList($listId, $contactEmails) - { - list($response) = $this->removeContactFromListWithHttpInfo($listId, $contactEmails); - return $response; - } - - /** - * Operation removeContactFromListWithHttpInfo - * - * Delete a contact from a list - * - * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\RemoveContactFromList $contactEmails Emails addresses OR IDs of the contacts (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\PostContactInfo, HTTP status code, HTTP response headers (array of strings) - */ - public function removeContactFromListWithHttpInfo($listId, $contactEmails) - { - $returnType = '\Brevo\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(), - '\Brevo\Client\Model\PostContactInfo', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation removeContactFromListAsync - * - * Delete a contact from a list - * - * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\RemoveContactFromList $contactEmails Emails addresses OR IDs of the contacts (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 - * - * Delete a contact from a list - * - * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\RemoveContactFromList $contactEmails Emails addresses OR IDs of the contacts (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function removeContactFromListAsyncWithHttpInfo($listId, $contactEmails) - { - $returnType = '\Brevo\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 \Brevo\Client\Model\RemoveContactFromList $contactEmails Emails addresses OR IDs of the contacts (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function removeContactFromListRequest($listId, $contactEmails) - { - // verify the required parameter 'listId' is set - if ($listId === null || (is_array($listId) && count($listId) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $listId when calling removeContactFromList' - ); - } - // verify the required parameter 'contactEmails' is set - if ($contactEmails === null || (is_array($contactEmails) && count($contactEmails) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $contactEmails when calling removeContactFromList' - ); - } - - $resourcePath = '/contacts/lists/{listId}/contacts/remove'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($listId !== null) { - $resourcePath = str_replace( - '{' . '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)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($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 \Brevo\Client\Model\UpdateList $updateList Values to update a list (required) - * - * @throws \Brevo\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 \Brevo\Client\Model\UpdateList $updateList Values to update a list (required) - * - * @throws \Brevo\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 { - $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(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation updateListAsync - * - * Update a list - * - * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\UpdateList $updateList Values to update a list (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateListAsync($listId, $updateList) - { - return $this->updateListAsyncWithHttpInfo($listId, $updateList) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateListAsyncWithHttpInfo - * - * Update a list - * - * @param int $listId Id of the list (required) - * @param \Brevo\Client\Model\UpdateList $updateList Values to update a list (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - 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 \Brevo\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 || (is_array($listId) && count($listId) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $listId when calling updateList' - ); - } - // verify the required parameter 'updateList' is set - if ($updateList === null || (is_array($updateList) && count($updateList) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $updateList when calling updateList' - ); - } - - $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 (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)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($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/MasterAccountApi.php b/lib/Api/MasterAccountApi.php index 8de81eb..b6e2b43 100644 --- a/lib/Api/MasterAccountApi.php +++ b/lib/Api/MasterAccountApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'corporateGroupIdGet' => [ + 'application/json', + ], + 'corporateGroupIdPut' => [ + 'application/json', + ], + 'corporateGroupPost' => [ + 'application/json', + ], + 'corporateGroupUnlinkGroupIdSubAccountsPut' => [ + 'application/json', + ], + 'corporateIpGet' => [ + 'application/json', + ], + 'corporateMasterAccountGet' => [ + 'application/json', + ], + 'corporateSsoTokenPost' => [ + 'application/json', + ], + 'corporateSubAccountGet' => [ + 'application/json', + ], + 'corporateSubAccountIdApplicationsTogglePut' => [ + 'application/json', + ], + 'corporateSubAccountIdDelete' => [ + 'application/json', + ], + 'corporateSubAccountIdGet' => [ + 'application/json', + ], + 'corporateSubAccountIdPlanPut' => [ + 'application/json', + ], + 'corporateSubAccountIpAssociatePost' => [ + 'application/json', + ], + 'corporateSubAccountIpDissociatePut' => [ + 'application/json', + ], + 'corporateSubAccountKeyPost' => [ + 'application/json', + ], + 'corporateSubAccountPost' => [ + 'application/json', + ], + 'corporateSubAccountSsoTokenPost' => [ + 'application/json', + ], + 'corporateUserEmailPermissionsPut' => [ + 'application/json', + ], + 'corporateUserInvitationActionEmailPut' => [ + 'application/json', + ], + 'corporateUserRevokeEmailDelete' => [ + 'application/json', + ], + 'getAccountActivity_0' => [ + 'application/json', + ], + 'getCorporateInvitedUsersList' => [ + 'application/json', + ], + 'getCorporateUserPermission' => [ + 'application/json', + ], + 'getSubAccountGroups' => [ + 'application/json', + ], + 'inviteAdminUser' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } /** - * Operation corporateGroupIdPut + * Operation corporateGroupIdDelete * - * Update a group of sub-accounts + * Delete a group * * @param string $id Id of the group (required) - * @param \Brevo\Client\Model\Body1 $body Group details to be updated. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupIdDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function corporateGroupIdPut($id, $body) + public function corporateGroupIdDelete( + string $id, + string $contentType = self::contentTypes['corporateGroupIdDelete'][0] + ): void { - $this->corporateGroupIdPutWithHttpInfo($id, $body); + $this->corporateGroupIdDeleteWithHttpInfo($id, $contentType); } /** - * Operation corporateGroupIdPutWithHttpInfo + * Operation corporateGroupIdDeleteWithHttpInfo * - * Update a group of sub-accounts + * Delete a group * * @param string $id Id of the group (required) - * @param \Brevo\Client\Model\Body1 $body Group details to be updated. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupIdDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function corporateGroupIdPutWithHttpInfo($id, $body) + public function corporateGroupIdDeleteWithHttpInfo( + string $id, + string $contentType = self::contentTypes['corporateGroupIdDelete'][0] + ): array { - $returnType = ''; - $request = $this->corporateGroupIdPutRequest($id, $body); + $request = $this->corporateGroupIdDeleteRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,26 +244,21 @@ public function corporateGroupIdPutWithHttpInfo($id, $body) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -156,7 +267,7 @@ public function corporateGroupIdPutWithHttpInfo($id, $body) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -167,19 +278,22 @@ public function corporateGroupIdPutWithHttpInfo($id, $body) } /** - * Operation corporateGroupIdPutAsync + * Operation corporateGroupIdDeleteAsync * - * Update a group of sub-accounts + * Delete a group * * @param string $id Id of the group (required) - * @param \Brevo\Client\Model\Body1 $body Group details to be updated. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateGroupIdPutAsync($id, $body) + public function corporateGroupIdDeleteAsync( + string $id, + string $contentType = self::contentTypes['corporateGroupIdDelete'][0] + ): PromiseInterface { - return $this->corporateGroupIdPutAsyncWithHttpInfo($id, $body) + return $this->corporateGroupIdDeleteAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -188,20 +302,24 @@ function ($response) { } /** - * Operation corporateGroupIdPutAsyncWithHttpInfo + * Operation corporateGroupIdDeleteAsyncWithHttpInfo * - * Update a group of sub-accounts + * Delete a group * * @param string $id Id of the group (required) - * @param \Brevo\Client\Model\Body1 $body Group details to be updated. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateGroupIdPutAsyncWithHttpInfo($id, $body) + public function corporateGroupIdDeleteAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['corporateGroupIdDelete'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->corporateGroupIdPutRequest($id, $body); + $request = $this->corporateGroupIdDeleteRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -220,36 +338,35 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); } /** - * Create request for operation 'corporateGroupIdPut' + * Create request for operation 'corporateGroupIdDelete' * * @param string $id Id of the group (required) - * @param \Brevo\Client\Model\Body1 $body Group details to be updated. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function corporateGroupIdPutRequest($id, $body) + public function corporateGroupIdDeleteRequest( + $id, + string $contentType = self::contentTypes['corporateGroupIdDelete'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling corporateGroupIdPut' - ); - } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling corporateGroupIdPut' + throw new InvalidArgumentException( + 'Missing the required parameter $id when calling corporateGroupIdDelete' ); } + $resourcePath = '/corporate/group/{id}'; $formParams = []; $queryParams = []; @@ -258,6 +375,7 @@ protected function corporateGroupIdPutRequest($id, $body) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -267,56 +385,35 @@ protected function corporateGroupIdPutRequest($id, $body) ); } - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -342,47 +439,55 @@ protected function corporateGroupIdPutRequest($id, $body) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Operation corporateGroupPost + * Operation corporateGroupIdGet * - * Create a new group of sub-accounts + * GET a group details * - * @param \Brevo\Client\Model\Body $body Group details to be created. (required) + * @param string $id Id of the group of sub-organization (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupIdGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\InlineResponse201 + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CorporateGroupDetailsResponse */ - public function corporateGroupPost($body) + public function corporateGroupIdGet( + string $id, + string $contentType = self::contentTypes['corporateGroupIdGet'][0] + ): \Brevo\Client\Models\CorporateGroupDetailsResponse { - list($response) = $this->corporateGroupPostWithHttpInfo($body); + list($response) = $this->corporateGroupIdGetWithHttpInfo($id, $contentType); return $response; } /** - * Operation corporateGroupPostWithHttpInfo + * Operation corporateGroupIdGetWithHttpInfo * - * Create a new group of sub-accounts + * GET a group details * - * @param \Brevo\Client\Model\Body $body Group details to be created. (required) + * @param string $id Id of the group of sub-organization (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupIdGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\InlineResponse201, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CorporateGroupDetailsResponse, HTTP status code, HTTP response headers (array of strings) */ - public function corporateGroupPostWithHttpInfo($body) + public function corporateGroupIdGetWithHttpInfo( + string $id, + string $contentType = self::contentTypes['corporateGroupIdGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\InlineResponse201'; - $request = $this->corporateGroupPostRequest($body); + $request = $this->corporateGroupIdGetRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -391,34 +496,84 @@ public function corporateGroupPostWithHttpInfo($body) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\CorporateGroupDetailsResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CorporateGroupDetailsResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CorporateGroupDetailsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CorporateGroupDetailsResponse'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -430,18 +585,10 @@ public function corporateGroupPostWithHttpInfo($body) } catch (ApiException $e) { switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\InlineResponse201', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\CorporateGroupDetailsResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -452,18 +599,22 @@ public function corporateGroupPostWithHttpInfo($body) } /** - * Operation corporateGroupPostAsync + * Operation corporateGroupIdGetAsync * - * Create a new group of sub-accounts + * GET a group details * - * @param \Brevo\Client\Model\Body $body Group details to be created. (required) + * @param string $id Id of the group of sub-organization (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateGroupPostAsync($body) + public function corporateGroupIdGetAsync( + string $id, + string $contentType = self::contentTypes['corporateGroupIdGet'][0] + ): PromiseInterface { - return $this->corporateGroupPostAsyncWithHttpInfo($body) + return $this->corporateGroupIdGetAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -472,29 +623,33 @@ function ($response) { } /** - * Operation corporateGroupPostAsyncWithHttpInfo + * Operation corporateGroupIdGetAsyncWithHttpInfo * - * Create a new group of sub-accounts + * GET a group details * - * @param \Brevo\Client\Model\Body $body Group details to be created. (required) + * @param string $id Id of the group of sub-organization (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateGroupPostAsyncWithHttpInfo($body) + public function corporateGroupIdGetAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['corporateGroupIdGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\InlineResponse201'; - $request = $this->corporateGroupPostRequest($body); + $returnType = '\Brevo\Client\Models\CorporateGroupDetailsResponse'; + $request = $this->corporateGroupIdGetRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -517,30 +672,36 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); } /** - * Create request for operation 'corporateGroupPost' + * Create request for operation 'corporateGroupIdGet' * - * @param \Brevo\Client\Model\Body $body Group details to be created. (required) + * @param string $id Id of the group of sub-organization (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function corporateGroupPostRequest($body) + public function corporateGroupIdGetRequest( + $id, + string $contentType = self::contentTypes['corporateGroupIdGet'][0] + ): Request { - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling corporateGroupPost' + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $id when calling corporateGroupIdGet' ); } - $resourcePath = '/corporate/group'; + + $resourcePath = '/corporate/group/{id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -549,56 +710,44 @@ protected function corporateGroupPostRequest($body) - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath ); } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -624,45 +773,58 @@ protected function corporateGroupPostRequest($body) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Operation corporateMasterAccountGet + * Operation corporateGroupIdPut * - * Get the details of requested master account + * Update a group of sub-accounts * + * @param string $id Id of the group (required) + * @param \Brevo\Client\Models\CorporateGroupIdPutRequest $corporateGroupIdPutRequest Group details to be updated. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupIdPut'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\MasterDetailsResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return void */ - public function corporateMasterAccountGet() + public function corporateGroupIdPut( + string $id, + \Brevo\Client\Models\CorporateGroupIdPutRequest $corporateGroupIdPutRequest, + string $contentType = self::contentTypes['corporateGroupIdPut'][0] + ): void { - list($response) = $this->corporateMasterAccountGetWithHttpInfo(); - return $response; + $this->corporateGroupIdPutWithHttpInfo($id, $corporateGroupIdPutRequest, $contentType); } /** - * Operation corporateMasterAccountGetWithHttpInfo + * Operation corporateGroupIdPutWithHttpInfo * - * Get the details of requested master account + * Update a group of sub-accounts * + * @param string $id Id of the group (required) + * @param \Brevo\Client\Models\CorporateGroupIdPutRequest $corporateGroupIdPutRequest Group details to be updated. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupIdPut'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\MasterDetailsResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function corporateMasterAccountGetWithHttpInfo() + public function corporateGroupIdPutWithHttpInfo( + string $id, + \Brevo\Client\Models\CorporateGroupIdPutRequest $corporateGroupIdPutRequest, + string $contentType = self::contentTypes['corporateGroupIdPut'][0] + ): array { - $returnType = '\Brevo\Client\Model\MasterDetailsResponse'; - $request = $this->corporateMasterAccountGetRequest(); + $request = $this->corporateGroupIdPutRequest($id, $corporateGroupIdPutRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -671,57 +833,30 @@ public function corporateMasterAccountGetWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { + } catch (ConnectException $e) { throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } + $statusCode = $response->getStatusCode(); - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; + + return [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\MasterDetailsResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -732,17 +867,24 @@ public function corporateMasterAccountGetWithHttpInfo() } /** - * Operation corporateMasterAccountGetAsync + * Operation corporateGroupIdPutAsync * - * Get the details of requested master account + * Update a group of sub-accounts * + * @param string $id Id of the group (required) + * @param \Brevo\Client\Models\CorporateGroupIdPutRequest $corporateGroupIdPutRequest Group details to be updated. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupIdPut'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateMasterAccountGetAsync() + public function corporateGroupIdPutAsync( + string $id, + \Brevo\Client\Models\CorporateGroupIdPutRequest $corporateGroupIdPutRequest, + string $contentType = self::contentTypes['corporateGroupIdPut'][0] + ): PromiseInterface { - return $this->corporateMasterAccountGetAsyncWithHttpInfo() + return $this->corporateGroupIdPutAsyncWithHttpInfo($id, $corporateGroupIdPutRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -751,38 +893,32 @@ function ($response) { } /** - * Operation corporateMasterAccountGetAsyncWithHttpInfo + * Operation corporateGroupIdPutAsyncWithHttpInfo * - * Get the details of requested master account + * Update a group of sub-accounts * + * @param string $id Id of the group (required) + * @param \Brevo\Client\Models\CorporateGroupIdPutRequest $corporateGroupIdPutRequest Group details to be updated. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupIdPut'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateMasterAccountGetAsyncWithHttpInfo() + public function corporateGroupIdPutAsyncWithHttpInfo( + $id, + $corporateGroupIdPutRequest, + string $contentType = self::contentTypes['corporateGroupIdPut'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\MasterDetailsResponse'; - $request = $this->corporateMasterAccountGetRequest(); + $returnType = ''; + $request = $this->corporateGroupIdPutRequest($id, $corporateGroupIdPutRequest, $contentType); 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() - ]; + return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { $response = $exception->getResponse(); @@ -795,23 +931,45 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); } /** - * Create request for operation 'corporateMasterAccountGet' + * Create request for operation 'corporateGroupIdPut' * + * @param string $id Id of the group (required) + * @param \Brevo\Client\Models\CorporateGroupIdPutRequest $corporateGroupIdPutRequest Group details to be updated. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupIdPut'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function corporateMasterAccountGetRequest() + public function corporateGroupIdPutRequest( + $id, + $corporateGroupIdPutRequest, + string $contentType = self::contentTypes['corporateGroupIdPut'][0] + ): Request { - $resourcePath = '/corporate/masterAccount'; + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $id when calling corporateGroupIdPut' + ); + } + + // verify the required parameter 'corporateGroupIdPutRequest' is set + if ($corporateGroupIdPutRequest === null || (is_array($corporateGroupIdPutRequest) && count($corporateGroupIdPutRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $corporateGroupIdPutRequest when calling corporateGroupIdPut' + ); + } + + + $resourcePath = '/corporate/group/{id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -820,53 +978,51 @@ protected function corporateMasterAccountGetRequest() - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath ); } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($corporateGroupIdPutRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($corporateGroupIdPutRequest)); + } else { + $httpBody = $corporateGroupIdPutRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -892,49 +1048,55 @@ protected function corporateMasterAccountGetRequest() $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Operation corporateSubAccountGet + * Operation corporateGroupPost * - * Get the list of all the sub-accounts of the master account. + * Create a group of sub-accounts * - * @param int $offset Index of the first sub-account in the page (required) - * @param int $limit Number of sub-accounts to be displayed on each page (required) + * @param \Brevo\Client\Models\CorporateGroupPostRequest|null $corporateGroupPostRequest corporateGroupPostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupPost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\SubAccountsResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CorporateGroupPost201Response|\Brevo\Client\Models\ErrorModel */ - public function corporateSubAccountGet($offset, $limit) + public function corporateGroupPost( + ?\Brevo\Client\Models\CorporateGroupPostRequest $corporateGroupPostRequest = null, + string $contentType = self::contentTypes['corporateGroupPost'][0] + ): \Brevo\Client\Models\CorporateGroupPost201Response { - list($response) = $this->corporateSubAccountGetWithHttpInfo($offset, $limit); + list($response) = $this->corporateGroupPostWithHttpInfo($corporateGroupPostRequest, $contentType); return $response; } /** - * Operation corporateSubAccountGetWithHttpInfo + * Operation corporateGroupPostWithHttpInfo * - * Get the list of all the sub-accounts of the master account. + * Create a group of sub-accounts * - * @param int $offset Index of the first sub-account in the page (required) - * @param int $limit Number of sub-accounts to be displayed on each page (required) + * @param \Brevo\Client\Models\CorporateGroupPostRequest|null $corporateGroupPostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupPost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\SubAccountsResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CorporateGroupPost201Response|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function corporateSubAccountGetWithHttpInfo($offset, $limit) + public function corporateGroupPostWithHttpInfo( + ?\Brevo\Client\Models\CorporateGroupPostRequest $corporateGroupPostRequest = null, + string $contentType = self::contentTypes['corporateGroupPost'][0] + ): array { - $returnType = '\Brevo\Client\Model\SubAccountsResponse'; - $request = $this->corporateSubAccountGetRequest($offset, $limit); + $request = $this->corporateGroupPostRequest($corporateGroupPostRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -943,34 +1105,111 @@ public function corporateSubAccountGetWithHttpInfo($offset, $limit) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CorporateGroupPost201Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CorporateGroupPost201Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CorporateGroupPost201Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CorporateGroupPost201Response'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -982,10 +1221,10 @@ public function corporateSubAccountGetWithHttpInfo($offset, $limit) } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\SubAccountsResponse', + '\Brevo\Client\Models\CorporateGroupPost201Response', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -993,7 +1232,7 @@ public function corporateSubAccountGetWithHttpInfo($offset, $limit) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1004,19 +1243,22 @@ public function corporateSubAccountGetWithHttpInfo($offset, $limit) } /** - * Operation corporateSubAccountGetAsync + * Operation corporateGroupPostAsync * - * Get the list of all the sub-accounts of the master account. + * Create a group of sub-accounts * - * @param int $offset Index of the first sub-account in the page (required) - * @param int $limit Number of sub-accounts to be displayed on each page (required) + * @param \Brevo\Client\Models\CorporateGroupPostRequest|null $corporateGroupPostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateSubAccountGetAsync($offset, $limit) + public function corporateGroupPostAsync( + ?\Brevo\Client\Models\CorporateGroupPostRequest $corporateGroupPostRequest = null, + string $contentType = self::contentTypes['corporateGroupPost'][0] + ): PromiseInterface { - return $this->corporateSubAccountGetAsyncWithHttpInfo($offset, $limit) + return $this->corporateGroupPostAsyncWithHttpInfo($corporateGroupPostRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -1025,30 +1267,33 @@ function ($response) { } /** - * Operation corporateSubAccountGetAsyncWithHttpInfo + * Operation corporateGroupPostAsyncWithHttpInfo * - * Get the list of all the sub-accounts of the master account. + * Create a group of sub-accounts * - * @param int $offset Index of the first sub-account in the page (required) - * @param int $limit Number of sub-accounts to be displayed on each page (required) + * @param \Brevo\Client\Models\CorporateGroupPostRequest|null $corporateGroupPostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateSubAccountGetAsyncWithHttpInfo($offset, $limit) + public function corporateGroupPostAsyncWithHttpInfo( + $corporateGroupPostRequest = null, + string $contentType = self::contentTypes['corporateGroupPost'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\SubAccountsResponse'; - $request = $this->corporateSubAccountGetRequest($offset, $limit); + $returnType = '\Brevo\Client\Models\CorporateGroupPost201Response'; + $request = $this->corporateGroupPostRequest($corporateGroupPostRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1071,100 +1316,75 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); } /** - * Create request for operation 'corporateSubAccountGet' + * Create request for operation 'corporateGroupPost' * - * @param int $offset Index of the first sub-account in the page (required) - * @param int $limit Number of sub-accounts to be displayed on each page (required) + * @param \Brevo\Client\Models\CorporateGroupPostRequest|null $corporateGroupPostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function corporateSubAccountGetRequest($offset, $limit) + public function corporateGroupPostRequest( + $corporateGroupPostRequest = null, + string $contentType = self::contentTypes['corporateGroupPost'][0] + ): Request { - // verify the required parameter 'offset' is set - if ($offset === null || (is_array($offset) && count($offset) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $offset when calling corporateSubAccountGet' - ); - } - // verify the required parameter 'limit' is set - if ($limit === null || (is_array($limit) && count($limit) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $limit when calling corporateSubAccountGet' - ); - } - $resourcePath = '/corporate/subAccount'; + + + $resourcePath = '/corporate/group'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } - // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($corporateGroupPostRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($corporateGroupPostRequest)); + } else { + $httpBody = $corporateGroupPostRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1190,48 +1410,58 @@ protected function corporateSubAccountGetRequest($offset, $limit) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Operation corporateSubAccountIdApplicationsTogglePut + * Operation corporateGroupUnlinkGroupIdSubAccountsPut * - * Enable/disable sub-account application(s) + * Delete sub-account from group * - * @param int $id Id of the sub-account organization (mandatory) (required) - * @param \Brevo\Client\Model\SubAccountAppsToggleRequest $toggleApplications List of applications to activate or deactivate on a sub-account (required) + * @param string $groupId Group id (required) + * @param \Brevo\Client\Models\CorporateGroupUnlinkGroupIdSubAccountsPutRequest $corporateGroupUnlinkGroupIdSubAccountsPutRequest List of sub-account ids (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupUnlinkGroupIdSubAccountsPut'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function corporateSubAccountIdApplicationsTogglePut($id, $toggleApplications) + public function corporateGroupUnlinkGroupIdSubAccountsPut( + string $groupId, + \Brevo\Client\Models\CorporateGroupUnlinkGroupIdSubAccountsPutRequest $corporateGroupUnlinkGroupIdSubAccountsPutRequest, + string $contentType = self::contentTypes['corporateGroupUnlinkGroupIdSubAccountsPut'][0] + ): void { - $this->corporateSubAccountIdApplicationsTogglePutWithHttpInfo($id, $toggleApplications); + $this->corporateGroupUnlinkGroupIdSubAccountsPutWithHttpInfo($groupId, $corporateGroupUnlinkGroupIdSubAccountsPutRequest, $contentType); } /** - * Operation corporateSubAccountIdApplicationsTogglePutWithHttpInfo + * Operation corporateGroupUnlinkGroupIdSubAccountsPutWithHttpInfo * - * Enable/disable sub-account application(s) + * Delete sub-account from group * - * @param int $id Id of the sub-account organization (mandatory) (required) - * @param \Brevo\Client\Model\SubAccountAppsToggleRequest $toggleApplications List of applications to activate or deactivate on a sub-account (required) + * @param string $groupId Group id (required) + * @param \Brevo\Client\Models\CorporateGroupUnlinkGroupIdSubAccountsPutRequest $corporateGroupUnlinkGroupIdSubAccountsPutRequest List of sub-account ids (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupUnlinkGroupIdSubAccountsPut'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function corporateSubAccountIdApplicationsTogglePutWithHttpInfo($id, $toggleApplications) + public function corporateGroupUnlinkGroupIdSubAccountsPutWithHttpInfo( + string $groupId, + \Brevo\Client\Models\CorporateGroupUnlinkGroupIdSubAccountsPutRequest $corporateGroupUnlinkGroupIdSubAccountsPutRequest, + string $contentType = self::contentTypes['corporateGroupUnlinkGroupIdSubAccountsPut'][0] + ): array { - $returnType = ''; - $request = $this->corporateSubAccountIdApplicationsTogglePutRequest($id, $toggleApplications); + $request = $this->corporateGroupUnlinkGroupIdSubAccountsPutRequest($groupId, $corporateGroupUnlinkGroupIdSubAccountsPutRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -1240,26 +1470,21 @@ public function corporateSubAccountIdApplicationsTogglePutWithHttpInfo($id, $tog } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -1268,15 +1493,7 @@ public function corporateSubAccountIdApplicationsTogglePutWithHttpInfo($id, $tog case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1287,19 +1504,24 @@ public function corporateSubAccountIdApplicationsTogglePutWithHttpInfo($id, $tog } /** - * Operation corporateSubAccountIdApplicationsTogglePutAsync + * Operation corporateGroupUnlinkGroupIdSubAccountsPutAsync * - * Enable/disable sub-account application(s) + * Delete sub-account from group * - * @param int $id Id of the sub-account organization (mandatory) (required) - * @param \Brevo\Client\Model\SubAccountAppsToggleRequest $toggleApplications List of applications to activate or deactivate on a sub-account (required) + * @param string $groupId Group id (required) + * @param \Brevo\Client\Models\CorporateGroupUnlinkGroupIdSubAccountsPutRequest $corporateGroupUnlinkGroupIdSubAccountsPutRequest List of sub-account ids (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupUnlinkGroupIdSubAccountsPut'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateSubAccountIdApplicationsTogglePutAsync($id, $toggleApplications) + public function corporateGroupUnlinkGroupIdSubAccountsPutAsync( + string $groupId, + \Brevo\Client\Models\CorporateGroupUnlinkGroupIdSubAccountsPutRequest $corporateGroupUnlinkGroupIdSubAccountsPutRequest, + string $contentType = self::contentTypes['corporateGroupUnlinkGroupIdSubAccountsPut'][0] + ): PromiseInterface { - return $this->corporateSubAccountIdApplicationsTogglePutAsyncWithHttpInfo($id, $toggleApplications) + return $this->corporateGroupUnlinkGroupIdSubAccountsPutAsyncWithHttpInfo($groupId, $corporateGroupUnlinkGroupIdSubAccountsPutRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -1308,20 +1530,26 @@ function ($response) { } /** - * Operation corporateSubAccountIdApplicationsTogglePutAsyncWithHttpInfo + * Operation corporateGroupUnlinkGroupIdSubAccountsPutAsyncWithHttpInfo * - * Enable/disable sub-account application(s) + * Delete sub-account from group * - * @param int $id Id of the sub-account organization (mandatory) (required) - * @param \Brevo\Client\Model\SubAccountAppsToggleRequest $toggleApplications List of applications to activate or deactivate on a sub-account (required) + * @param string $groupId Group id (required) + * @param \Brevo\Client\Models\CorporateGroupUnlinkGroupIdSubAccountsPutRequest $corporateGroupUnlinkGroupIdSubAccountsPutRequest List of sub-account ids (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupUnlinkGroupIdSubAccountsPut'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateSubAccountIdApplicationsTogglePutAsyncWithHttpInfo($id, $toggleApplications) + public function corporateGroupUnlinkGroupIdSubAccountsPutAsyncWithHttpInfo( + $groupId, + $corporateGroupUnlinkGroupIdSubAccountsPutRequest, + string $contentType = self::contentTypes['corporateGroupUnlinkGroupIdSubAccountsPut'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->corporateSubAccountIdApplicationsTogglePutRequest($id, $toggleApplications); + $request = $this->corporateGroupUnlinkGroupIdSubAccountsPutRequest($groupId, $corporateGroupUnlinkGroupIdSubAccountsPutRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1340,37 +1568,45 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); } /** - * Create request for operation 'corporateSubAccountIdApplicationsTogglePut' + * Create request for operation 'corporateGroupUnlinkGroupIdSubAccountsPut' * - * @param int $id Id of the sub-account organization (mandatory) (required) - * @param \Brevo\Client\Model\SubAccountAppsToggleRequest $toggleApplications List of applications to activate or deactivate on a sub-account (required) + * @param string $groupId Group id (required) + * @param \Brevo\Client\Models\CorporateGroupUnlinkGroupIdSubAccountsPutRequest $corporateGroupUnlinkGroupIdSubAccountsPutRequest List of sub-account ids (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateGroupUnlinkGroupIdSubAccountsPut'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function corporateSubAccountIdApplicationsTogglePutRequest($id, $toggleApplications) + public function corporateGroupUnlinkGroupIdSubAccountsPutRequest( + $groupId, + $corporateGroupUnlinkGroupIdSubAccountsPutRequest, + string $contentType = self::contentTypes['corporateGroupUnlinkGroupIdSubAccountsPut'][0] + ): Request { - // verify the required parameter 'id' is set - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling corporateSubAccountIdApplicationsTogglePut' + + // verify the required parameter 'groupId' is set + if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $groupId when calling corporateGroupUnlinkGroupIdSubAccountsPut' ); } - // verify the required parameter 'toggleApplications' is set - if ($toggleApplications === null || (is_array($toggleApplications) && count($toggleApplications) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $toggleApplications when calling corporateSubAccountIdApplicationsTogglePut' + + // verify the required parameter 'corporateGroupUnlinkGroupIdSubAccountsPutRequest' is set + if ($corporateGroupUnlinkGroupIdSubAccountsPutRequest === null || (is_array($corporateGroupUnlinkGroupIdSubAccountsPutRequest) && count($corporateGroupUnlinkGroupIdSubAccountsPutRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $corporateGroupUnlinkGroupIdSubAccountsPutRequest when calling corporateGroupUnlinkGroupIdSubAccountsPut' ); } - $resourcePath = '/corporate/subAccount/{id}/applications/toggle'; + + $resourcePath = '/corporate/group/unlink/{groupId}/subAccounts'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1378,65 +1614,52 @@ protected function corporateSubAccountIdApplicationsTogglePutRequest($id, $toggl $multipart = false; + // path params - if ($id !== null) { + if ($groupId !== null) { $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), + '{' . 'groupId' . '}', + ObjectSerializer::toPathValue($groupId), $resourcePath ); } - // body params - $_tempBody = null; - if (isset($toggleApplications)) { - $_tempBody = $toggleApplications; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($corporateGroupUnlinkGroupIdSubAccountsPutRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($corporateGroupUnlinkGroupIdSubAccountsPutRequest)); + } else { + $httpBody = $corporateGroupUnlinkGroupIdSubAccountsPutRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1462,46 +1685,51 @@ protected function corporateSubAccountIdApplicationsTogglePutRequest($id, $toggl $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Operation corporateSubAccountIdDelete + * Operation corporateIpGet * - * Delete a sub-account + * List of all IPs * - * @param int $id Id of the sub-account organization to be deleted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateIpGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CorporateIpGet200ResponseInner[] */ - public function corporateSubAccountIdDelete($id) + public function corporateIpGet( + string $contentType = self::contentTypes['corporateIpGet'][0] + ): array { - $this->corporateSubAccountIdDeleteWithHttpInfo($id); + list($response) = $this->corporateIpGetWithHttpInfo($contentType); + return $response; } /** - * Operation corporateSubAccountIdDeleteWithHttpInfo + * Operation corporateIpGetWithHttpInfo * - * Delete a sub-account + * List of all IPs * - * @param int $id Id of the sub-account organization to be deleted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateIpGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CorporateIpGet200ResponseInner[], HTTP status code, HTTP response headers (array of strings) */ - public function corporateSubAccountIdDeleteWithHttpInfo($id) + public function corporateIpGetWithHttpInfo( + string $contentType = self::contentTypes['corporateIpGet'][0] + ): array { - $returnType = ''; - $request = $this->corporateSubAccountIdDeleteRequest($id); + $request = $this->corporateIpGetRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -1510,49 +1738,123 @@ public function corporateSubAccountIdDeleteWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\CorporateIpGet200ResponseInner[]', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CorporateIpGet200ResponseInner[]' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CorporateIpGet200ResponseInner[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - return [null, $statusCode, $response->getHeaders()]; + $returnType = '\Brevo\Client\Models\CorporateIpGet200ResponseInner[]'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\CorporateIpGet200ResponseInner[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } throw $e; } } /** - * Operation corporateSubAccountIdDeleteAsync + * Operation corporateIpGetAsync * - * Delete a sub-account + * List of all IPs * - * @param int $id Id of the sub-account organization to be deleted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateIpGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateSubAccountIdDeleteAsync($id) + public function corporateIpGetAsync( + string $contentType = self::contentTypes['corporateIpGet'][0] + ): PromiseInterface { - return $this->corporateSubAccountIdDeleteAsyncWithHttpInfo($id) + return $this->corporateIpGetAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -1561,25 +1863,41 @@ function ($response) { } /** - * Operation corporateSubAccountIdDeleteAsyncWithHttpInfo + * Operation corporateIpGetAsyncWithHttpInfo * - * Delete a sub-account + * List of all IPs * - * @param int $id Id of the sub-account organization to be deleted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateIpGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateSubAccountIdDeleteAsyncWithHttpInfo($id) + public function corporateIpGetAsyncWithHttpInfo( + string $contentType = self::contentTypes['corporateIpGet'][0] + ): PromiseInterface { - $returnType = ''; - $request = $this->corporateSubAccountIdDeleteRequest($id); + $returnType = '\Brevo\Client\Models\CorporateIpGet200ResponseInner[]'; + $request = $this->corporateIpGetRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; }, function ($exception) { $response = $exception->getResponse(); @@ -1592,30 +1910,27 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); } /** - * Create request for operation 'corporateSubAccountIdDelete' + * Create request for operation 'corporateIpGet' * - * @param int $id Id of the sub-account organization to be deleted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateIpGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function corporateSubAccountIdDeleteRequest($id) + public function corporateIpGetRequest( + string $contentType = self::contentTypes['corporateIpGet'][0] + ): Request { - // verify the required parameter 'id' is set - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling corporateSubAccountIdDelete' - ); - } - $resourcePath = '/corporate/subAccount/{id}'; + + $resourcePath = '/corporate/ip'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1623,62 +1938,37 @@ protected function corporateSubAccountIdDeleteRequest($id) $multipart = false; - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1704,47 +1994,51 @@ protected function corporateSubAccountIdDeleteRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Operation corporateSubAccountIdGet + * Operation corporateMasterAccountGet * - * Get sub-account details + * Get the details of requested master account * - * @param int $id Id of the sub-account organization (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateMasterAccountGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\SubAccountDetailsResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\MasterDetailsResponse|\Brevo\Client\Models\ErrorModel */ - public function corporateSubAccountIdGet($id) + public function corporateMasterAccountGet( + string $contentType = self::contentTypes['corporateMasterAccountGet'][0] + ): \Brevo\Client\Models\MasterDetailsResponse { - list($response) = $this->corporateSubAccountIdGetWithHttpInfo($id); + list($response) = $this->corporateMasterAccountGetWithHttpInfo($contentType); return $response; } /** - * Operation corporateSubAccountIdGetWithHttpInfo + * Operation corporateMasterAccountGetWithHttpInfo * - * Get sub-account details + * Get the details of requested master account * - * @param int $id Id of the sub-account organization (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateMasterAccountGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\SubAccountDetailsResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\MasterDetailsResponse|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function corporateSubAccountIdGetWithHttpInfo($id) + public function corporateMasterAccountGetWithHttpInfo( + string $contentType = self::contentTypes['corporateMasterAccountGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\SubAccountDetailsResponse'; - $request = $this->corporateSubAccountIdGetRequest($id); + $request = $this->corporateMasterAccountGetRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -1753,34 +2047,111 @@ public function corporateSubAccountIdGetWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\MasterDetailsResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\MasterDetailsResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\MasterDetailsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\MasterDetailsResponse'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1795,7 +2166,15 @@ public function corporateSubAccountIdGetWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\SubAccountDetailsResponse', + '\Brevo\Client\Models\MasterDetailsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1806,18 +2185,20 @@ public function corporateSubAccountIdGetWithHttpInfo($id) } /** - * Operation corporateSubAccountIdGetAsync + * Operation corporateMasterAccountGetAsync * - * Get sub-account details + * Get the details of requested master account * - * @param int $id Id of the sub-account organization (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateMasterAccountGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateSubAccountIdGetAsync($id) + public function corporateMasterAccountGetAsync( + string $contentType = self::contentTypes['corporateMasterAccountGet'][0] + ): PromiseInterface { - return $this->corporateSubAccountIdGetAsyncWithHttpInfo($id) + return $this->corporateMasterAccountGetAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -1826,29 +2207,31 @@ function ($response) { } /** - * Operation corporateSubAccountIdGetAsyncWithHttpInfo + * Operation corporateMasterAccountGetAsyncWithHttpInfo * - * Get sub-account details + * Get the details of requested master account * - * @param int $id Id of the sub-account organization (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateMasterAccountGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateSubAccountIdGetAsyncWithHttpInfo($id) + public function corporateMasterAccountGetAsyncWithHttpInfo( + string $contentType = self::contentTypes['corporateMasterAccountGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\SubAccountDetailsResponse'; - $request = $this->corporateSubAccountIdGetRequest($id); + $returnType = '\Brevo\Client\Models\MasterDetailsResponse'; + $request = $this->corporateMasterAccountGetRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1871,30 +2254,27 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); } /** - * Create request for operation 'corporateSubAccountIdGet' + * Create request for operation 'corporateMasterAccountGet' * - * @param int $id Id of the sub-account organization (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateMasterAccountGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function corporateSubAccountIdGetRequest($id) + public function corporateMasterAccountGetRequest( + string $contentType = self::contentTypes['corporateMasterAccountGet'][0] + ): Request { - // verify the required parameter 'id' is set - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling corporateSubAccountIdGet' - ); - } - $resourcePath = '/corporate/subAccount/{id}'; + + $resourcePath = '/corporate/masterAccount'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1902,62 +2282,37 @@ protected function corporateSubAccountIdGetRequest($id) $multipart = false; - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1983,48 +2338,55 @@ protected function corporateSubAccountIdGetRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Operation corporateSubAccountIdPlanPut + * Operation corporateSsoTokenPost * - * Update sub-account plan + * Generate SSO token to access admin account * - * @param int $id Id of the sub-account organization (required) - * @param \Brevo\Client\Model\SubAccountUpdatePlanRequest $updatePlanDetails Values to update a sub-account plan (required) + * @param \Brevo\Client\Models\CorporateSsoTokenPostRequest|null $corporateSsoTokenPostRequest corporateSsoTokenPostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSsoTokenPost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetSsoToken|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function corporateSubAccountIdPlanPut($id, $updatePlanDetails) + public function corporateSsoTokenPost( + ?\Brevo\Client\Models\CorporateSsoTokenPostRequest $corporateSsoTokenPostRequest = null, + string $contentType = self::contentTypes['corporateSsoTokenPost'][0] + ): \Brevo\Client\Models\GetSsoToken { - $this->corporateSubAccountIdPlanPutWithHttpInfo($id, $updatePlanDetails); + list($response) = $this->corporateSsoTokenPostWithHttpInfo($corporateSsoTokenPostRequest, $contentType); + return $response; } /** - * Operation corporateSubAccountIdPlanPutWithHttpInfo + * Operation corporateSsoTokenPostWithHttpInfo * - * Update sub-account plan + * Generate SSO token to access admin account * - * @param int $id Id of the sub-account organization (required) - * @param \Brevo\Client\Model\SubAccountUpdatePlanRequest $updatePlanDetails Values to update a sub-account plan (required) + * @param \Brevo\Client\Models\CorporateSsoTokenPostRequest|null $corporateSsoTokenPostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSsoTokenPost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetSsoToken|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function corporateSubAccountIdPlanPutWithHttpInfo($id, $updatePlanDetails) + public function corporateSsoTokenPostWithHttpInfo( + ?\Brevo\Client\Models\CorporateSsoTokenPostRequest $corporateSsoTokenPostRequest = null, + string $contentType = self::contentTypes['corporateSsoTokenPost'][0] + ): array { - $returnType = ''; - $request = $this->corporateSubAccountIdPlanPutRequest($id, $updatePlanDetails); + $request = $this->corporateSsoTokenPostRequest($corporateSsoTokenPostRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -2033,35 +2395,161 @@ public function corporateSubAccountIdPlanPutWithHttpInfo($id, $updatePlanDetails } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetSsoToken', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetSsoToken' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetSsoToken', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - return [null, $statusCode, $response->getHeaders()]; + $returnType = '\Brevo\Client\Models\GetSsoToken'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\GetSsoToken', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2069,7 +2557,7 @@ public function corporateSubAccountIdPlanPutWithHttpInfo($id, $updatePlanDetails case 403: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2080,19 +2568,22 @@ public function corporateSubAccountIdPlanPutWithHttpInfo($id, $updatePlanDetails } /** - * Operation corporateSubAccountIdPlanPutAsync + * Operation corporateSsoTokenPostAsync * - * Update sub-account plan + * Generate SSO token to access admin account * - * @param int $id Id of the sub-account organization (required) - * @param \Brevo\Client\Model\SubAccountUpdatePlanRequest $updatePlanDetails Values to update a sub-account plan (required) + * @param \Brevo\Client\Models\CorporateSsoTokenPostRequest|null $corporateSsoTokenPostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSsoTokenPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateSubAccountIdPlanPutAsync($id, $updatePlanDetails) + public function corporateSsoTokenPostAsync( + ?\Brevo\Client\Models\CorporateSsoTokenPostRequest $corporateSsoTokenPostRequest = null, + string $contentType = self::contentTypes['corporateSsoTokenPost'][0] + ): PromiseInterface { - return $this->corporateSubAccountIdPlanPutAsyncWithHttpInfo($id, $updatePlanDetails) + return $this->corporateSsoTokenPostAsyncWithHttpInfo($corporateSsoTokenPostRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -2101,26 +2592,43 @@ function ($response) { } /** - * Operation corporateSubAccountIdPlanPutAsyncWithHttpInfo + * Operation corporateSsoTokenPostAsyncWithHttpInfo * - * Update sub-account plan + * Generate SSO token to access admin account * - * @param int $id Id of the sub-account organization (required) - * @param \Brevo\Client\Model\SubAccountUpdatePlanRequest $updatePlanDetails Values to update a sub-account plan (required) + * @param \Brevo\Client\Models\CorporateSsoTokenPostRequest|null $corporateSsoTokenPostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSsoTokenPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateSubAccountIdPlanPutAsyncWithHttpInfo($id, $updatePlanDetails) + public function corporateSsoTokenPostAsyncWithHttpInfo( + $corporateSsoTokenPostRequest = null, + string $contentType = self::contentTypes['corporateSsoTokenPost'][0] + ): PromiseInterface { - $returnType = ''; - $request = $this->corporateSubAccountIdPlanPutRequest($id, $updatePlanDetails); + $returnType = '\Brevo\Client\Models\GetSsoToken'; + $request = $this->corporateSsoTokenPostRequest($corporateSsoTokenPostRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; }, function ($exception) { $response = $exception->getResponse(); @@ -2133,37 +2641,30 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); } /** - * Create request for operation 'corporateSubAccountIdPlanPut' + * Create request for operation 'corporateSsoTokenPost' * - * @param int $id Id of the sub-account organization (required) - * @param \Brevo\Client\Model\SubAccountUpdatePlanRequest $updatePlanDetails Values to update a sub-account plan (required) + * @param \Brevo\Client\Models\CorporateSsoTokenPostRequest|null $corporateSsoTokenPostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSsoTokenPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function corporateSubAccountIdPlanPutRequest($id, $updatePlanDetails) + public function corporateSsoTokenPostRequest( + $corporateSsoTokenPostRequest = null, + string $contentType = self::contentTypes['corporateSsoTokenPost'][0] + ): Request { - // verify the required parameter 'id' is set - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling corporateSubAccountIdPlanPut' - ); - } - // verify the required parameter 'updatePlanDetails' is set - if ($updatePlanDetails === null || (is_array($updatePlanDetails) && count($updatePlanDetails) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $updatePlanDetails when calling corporateSubAccountIdPlanPut' - ); - } - $resourcePath = '/corporate/subAccount/{id}/plan'; + + + $resourcePath = '/corporate/ssoToken'; $formParams = []; $queryParams = []; $headerParams = []; @@ -2171,65 +2672,44 @@ protected function corporateSubAccountIdPlanPutRequest($id, $updatePlanDetails) $multipart = false; - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - // body params - $_tempBody = null; - if (isset($updatePlanDetails)) { - $_tempBody = $updatePlanDetails; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($corporateSsoTokenPostRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($corporateSsoTokenPostRequest)); + } else { + $httpBody = $corporateSsoTokenPostRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2255,47 +2735,59 @@ protected function corporateSubAccountIdPlanPutRequest($id, $updatePlanDetails) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Operation corporateSubAccountKeyPost + * Operation corporateSubAccountGet * - * Create an API key for a sub-account + * Get the list of all the sub-accounts of the master account. * - * @param \Brevo\Client\Model\CreateApiKeyRequest $createApiKeyRequest Values to generate API key for sub-account (required) + * @param int $offset Index of the first sub-account in the page (required) + * @param int $limit Number of sub-accounts to be displayed on each page (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreateApiKeyResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\SubAccountsResponse|\Brevo\Client\Models\ErrorModel */ - public function corporateSubAccountKeyPost($createApiKeyRequest) + public function corporateSubAccountGet( + int $offset, + int $limit, + string $contentType = self::contentTypes['corporateSubAccountGet'][0] + ): \Brevo\Client\Models\SubAccountsResponse { - list($response) = $this->corporateSubAccountKeyPostWithHttpInfo($createApiKeyRequest); + list($response) = $this->corporateSubAccountGetWithHttpInfo($offset, $limit, $contentType); return $response; } /** - * Operation corporateSubAccountKeyPostWithHttpInfo + * Operation corporateSubAccountGetWithHttpInfo * - * Create an API key for a sub-account + * Get the list of all the sub-accounts of the master account. * - * @param \Brevo\Client\Model\CreateApiKeyRequest $createApiKeyRequest Values to generate API key for sub-account (required) + * @param int $offset Index of the first sub-account in the page (required) + * @param int $limit Number of sub-accounts to be displayed on each page (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreateApiKeyResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\SubAccountsResponse|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function corporateSubAccountKeyPostWithHttpInfo($createApiKeyRequest) + public function corporateSubAccountGetWithHttpInfo( + int $offset, + int $limit, + string $contentType = self::contentTypes['corporateSubAccountGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreateApiKeyResponse'; - $request = $this->corporateSubAccountKeyPostRequest($createApiKeyRequest); + $request = $this->corporateSubAccountGetRequest($offset, $limit, $contentType); try { $options = $this->createHttpClientOption(); @@ -2304,34 +2796,111 @@ public function corporateSubAccountKeyPostWithHttpInfo($createApiKeyRequest) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\SubAccountsResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\SubAccountsResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\SubAccountsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\SubAccountsResponse'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2343,10 +2912,10 @@ public function corporateSubAccountKeyPostWithHttpInfo($createApiKeyRequest) } catch (ApiException $e) { switch ($e->getCode()) { - case 201: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreateApiKeyResponse', + '\Brevo\Client\Models\SubAccountsResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2354,7 +2923,7 @@ public function corporateSubAccountKeyPostWithHttpInfo($createApiKeyRequest) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2365,18 +2934,24 @@ public function corporateSubAccountKeyPostWithHttpInfo($createApiKeyRequest) } /** - * Operation corporateSubAccountKeyPostAsync + * Operation corporateSubAccountGetAsync * - * Create an API key for a sub-account + * Get the list of all the sub-accounts of the master account. * - * @param \Brevo\Client\Model\CreateApiKeyRequest $createApiKeyRequest Values to generate API key for sub-account (required) + * @param int $offset Index of the first sub-account in the page (required) + * @param int $limit Number of sub-accounts to be displayed on each page (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateSubAccountKeyPostAsync($createApiKeyRequest) + public function corporateSubAccountGetAsync( + int $offset, + int $limit, + string $contentType = self::contentTypes['corporateSubAccountGet'][0] + ): PromiseInterface { - return $this->corporateSubAccountKeyPostAsyncWithHttpInfo($createApiKeyRequest) + return $this->corporateSubAccountGetAsyncWithHttpInfo($offset, $limit, $contentType) ->then( function ($response) { return $response[0]; @@ -2385,29 +2960,35 @@ function ($response) { } /** - * Operation corporateSubAccountKeyPostAsyncWithHttpInfo + * Operation corporateSubAccountGetAsyncWithHttpInfo * - * Create an API key for a sub-account + * Get the list of all the sub-accounts of the master account. * - * @param \Brevo\Client\Model\CreateApiKeyRequest $createApiKeyRequest Values to generate API key for sub-account (required) + * @param int $offset Index of the first sub-account in the page (required) + * @param int $limit Number of sub-accounts to be displayed on each page (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateSubAccountKeyPostAsyncWithHttpInfo($createApiKeyRequest) + public function corporateSubAccountGetAsyncWithHttpInfo( + $offset, + $limit, + string $contentType = self::contentTypes['corporateSubAccountGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreateApiKeyResponse'; - $request = $this->corporateSubAccountKeyPostRequest($createApiKeyRequest); + $returnType = '\Brevo\Client\Models\SubAccountsResponse'; + $request = $this->corporateSubAccountGetRequest($offset, $limit, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2430,30 +3011,3250 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); } /** - * Create request for operation 'corporateSubAccountKeyPost' + * Create request for operation 'corporateSubAccountGet' * - * @param \Brevo\Client\Model\CreateApiKeyRequest $createApiKeyRequest Values to generate API key for sub-account (required) + * @param int $offset Index of the first sub-account in the page (required) + * @param int $limit Number of sub-accounts to be displayed on each page (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function corporateSubAccountKeyPostRequest($createApiKeyRequest) + public function corporateSubAccountGetRequest( + $offset, + $limit, + string $contentType = self::contentTypes['corporateSubAccountGet'][0] + ): Request { - // verify the required parameter 'createApiKeyRequest' is set - if ($createApiKeyRequest === null || (is_array($createApiKeyRequest) && count($createApiKeyRequest) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $createApiKeyRequest when calling corporateSubAccountKeyPost' + + // verify the required parameter 'offset' is set + if ($offset === null || (is_array($offset) && count($offset) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $offset when calling corporateSubAccountGet' + ); + } + + // verify the required parameter 'limit' is set + if ($limit === null || (is_array($limit) && count($limit) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $limit when calling corporateSubAccountGet' + ); + } + + + $resourcePath = '/corporate/subAccount'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation corporateSubAccountIdApplicationsTogglePut + * + * Enable/disable sub-account application(s) + * + * @param int $id Id of the sub-account organization (mandatory) (required) + * @param \Brevo\Client\Models\SubAccountAppsToggleRequest $subAccountAppsToggleRequest List of applications to activate or deactivate on a sub-account (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIdApplicationsTogglePut'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return void + */ + public function corporateSubAccountIdApplicationsTogglePut( + int $id, + \Brevo\Client\Models\SubAccountAppsToggleRequest $subAccountAppsToggleRequest, + string $contentType = self::contentTypes['corporateSubAccountIdApplicationsTogglePut'][0] + ): void + { + $this->corporateSubAccountIdApplicationsTogglePutWithHttpInfo($id, $subAccountAppsToggleRequest, $contentType); + } + + /** + * Operation corporateSubAccountIdApplicationsTogglePutWithHttpInfo + * + * Enable/disable sub-account application(s) + * + * @param int $id Id of the sub-account organization (mandatory) (required) + * @param \Brevo\Client\Models\SubAccountAppsToggleRequest $subAccountAppsToggleRequest List of applications to activate or deactivate on a sub-account (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIdApplicationsTogglePut'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function corporateSubAccountIdApplicationsTogglePutWithHttpInfo( + int $id, + \Brevo\Client\Models\SubAccountAppsToggleRequest $subAccountAppsToggleRequest, + string $contentType = self::contentTypes['corporateSubAccountIdApplicationsTogglePut'][0] + ): array + { + $request = $this->corporateSubAccountIdApplicationsTogglePutRequest($id, $subAccountAppsToggleRequest, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation corporateSubAccountIdApplicationsTogglePutAsync + * + * Enable/disable sub-account application(s) + * + * @param int $id Id of the sub-account organization (mandatory) (required) + * @param \Brevo\Client\Models\SubAccountAppsToggleRequest $subAccountAppsToggleRequest List of applications to activate or deactivate on a sub-account (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIdApplicationsTogglePut'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function corporateSubAccountIdApplicationsTogglePutAsync( + int $id, + \Brevo\Client\Models\SubAccountAppsToggleRequest $subAccountAppsToggleRequest, + string $contentType = self::contentTypes['corporateSubAccountIdApplicationsTogglePut'][0] + ): PromiseInterface + { + return $this->corporateSubAccountIdApplicationsTogglePutAsyncWithHttpInfo($id, $subAccountAppsToggleRequest, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation corporateSubAccountIdApplicationsTogglePutAsyncWithHttpInfo + * + * Enable/disable sub-account application(s) + * + * @param int $id Id of the sub-account organization (mandatory) (required) + * @param \Brevo\Client\Models\SubAccountAppsToggleRequest $subAccountAppsToggleRequest List of applications to activate or deactivate on a sub-account (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIdApplicationsTogglePut'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function corporateSubAccountIdApplicationsTogglePutAsyncWithHttpInfo( + $id, + $subAccountAppsToggleRequest, + string $contentType = self::contentTypes['corporateSubAccountIdApplicationsTogglePut'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->corporateSubAccountIdApplicationsTogglePutRequest($id, $subAccountAppsToggleRequest, $contentType); + + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'corporateSubAccountIdApplicationsTogglePut' + * + * @param int $id Id of the sub-account organization (mandatory) (required) + * @param \Brevo\Client\Models\SubAccountAppsToggleRequest $subAccountAppsToggleRequest List of applications to activate or deactivate on a sub-account (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIdApplicationsTogglePut'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function corporateSubAccountIdApplicationsTogglePutRequest( + $id, + $subAccountAppsToggleRequest, + string $contentType = self::contentTypes['corporateSubAccountIdApplicationsTogglePut'][0] + ): Request + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $id when calling corporateSubAccountIdApplicationsTogglePut' + ); + } + + // verify the required parameter 'subAccountAppsToggleRequest' is set + if ($subAccountAppsToggleRequest === null || (is_array($subAccountAppsToggleRequest) && count($subAccountAppsToggleRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $subAccountAppsToggleRequest when calling corporateSubAccountIdApplicationsTogglePut' + ); + } + + + $resourcePath = '/corporate/subAccount/{id}/applications/toggle'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($subAccountAppsToggleRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($subAccountAppsToggleRequest)); + } else { + $httpBody = $subAccountAppsToggleRequest; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation corporateSubAccountIdDelete + * + * Delete a sub-account + * + * @param int $id Id of the sub-account organization to be deleted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIdDelete'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return void + */ + public function corporateSubAccountIdDelete( + int $id, + string $contentType = self::contentTypes['corporateSubAccountIdDelete'][0] + ): void + { + $this->corporateSubAccountIdDeleteWithHttpInfo($id, $contentType); + } + + /** + * Operation corporateSubAccountIdDeleteWithHttpInfo + * + * Delete a sub-account + * + * @param int $id Id of the sub-account organization to be deleted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIdDelete'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function corporateSubAccountIdDeleteWithHttpInfo( + int $id, + string $contentType = self::contentTypes['corporateSubAccountIdDelete'][0] + ): array + { + $request = $this->corporateSubAccountIdDeleteRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation corporateSubAccountIdDeleteAsync + * + * Delete a sub-account + * + * @param int $id Id of the sub-account organization to be deleted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIdDelete'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function corporateSubAccountIdDeleteAsync( + int $id, + string $contentType = self::contentTypes['corporateSubAccountIdDelete'][0] + ): PromiseInterface + { + return $this->corporateSubAccountIdDeleteAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation corporateSubAccountIdDeleteAsyncWithHttpInfo + * + * Delete a sub-account + * + * @param int $id Id of the sub-account organization to be deleted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIdDelete'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function corporateSubAccountIdDeleteAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['corporateSubAccountIdDelete'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->corporateSubAccountIdDeleteRequest($id, $contentType); + + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'corporateSubAccountIdDelete' + * + * @param int $id Id of the sub-account organization to be deleted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIdDelete'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function corporateSubAccountIdDeleteRequest( + $id, + string $contentType = self::contentTypes['corporateSubAccountIdDelete'][0] + ): Request + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $id when calling corporateSubAccountIdDelete' + ); + } + + + $resourcePath = '/corporate/subAccount/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation corporateSubAccountIdGet + * + * Get sub-account details + * + * @param int $id Id of the sub-account organization (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIdGet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\SubAccountDetailsResponse|\Brevo\Client\Models\ErrorModel + */ + public function corporateSubAccountIdGet( + int $id, + string $contentType = self::contentTypes['corporateSubAccountIdGet'][0] + ): \Brevo\Client\Models\SubAccountDetailsResponse + { + list($response) = $this->corporateSubAccountIdGetWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation corporateSubAccountIdGetWithHttpInfo + * + * Get sub-account details + * + * @param int $id Id of the sub-account organization (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIdGet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\SubAccountDetailsResponse|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) + */ + public function corporateSubAccountIdGetWithHttpInfo( + int $id, + string $contentType = self::contentTypes['corporateSubAccountIdGet'][0] + ): array + { + $request = $this->corporateSubAccountIdGetRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\SubAccountDetailsResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\SubAccountDetailsResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\SubAccountDetailsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\SubAccountDetailsResponse'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\SubAccountDetailsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation corporateSubAccountIdGetAsync + * + * Get sub-account details + * + * @param int $id Id of the sub-account organization (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIdGet'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function corporateSubAccountIdGetAsync( + int $id, + string $contentType = self::contentTypes['corporateSubAccountIdGet'][0] + ): PromiseInterface + { + return $this->corporateSubAccountIdGetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation corporateSubAccountIdGetAsyncWithHttpInfo + * + * Get sub-account details + * + * @param int $id Id of the sub-account organization (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIdGet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function corporateSubAccountIdGetAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['corporateSubAccountIdGet'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\SubAccountDetailsResponse'; + $request = $this->corporateSubAccountIdGetRequest($id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'corporateSubAccountIdGet' + * + * @param int $id Id of the sub-account organization (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIdGet'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function corporateSubAccountIdGetRequest( + $id, + string $contentType = self::contentTypes['corporateSubAccountIdGet'][0] + ): Request + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $id when calling corporateSubAccountIdGet' + ); + } + + + $resourcePath = '/corporate/subAccount/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation corporateSubAccountIdPlanPut + * + * Update sub-account plan + * + * @param int $id Id of the sub-account organization (required) + * @param \Brevo\Client\Models\SubAccountUpdatePlanRequest $subAccountUpdatePlanRequest Values to update a sub-account plan (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIdPlanPut'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return void + */ + public function corporateSubAccountIdPlanPut( + int $id, + \Brevo\Client\Models\SubAccountUpdatePlanRequest $subAccountUpdatePlanRequest, + string $contentType = self::contentTypes['corporateSubAccountIdPlanPut'][0] + ): void + { + $this->corporateSubAccountIdPlanPutWithHttpInfo($id, $subAccountUpdatePlanRequest, $contentType); + } + + /** + * Operation corporateSubAccountIdPlanPutWithHttpInfo + * + * Update sub-account plan + * + * @param int $id Id of the sub-account organization (required) + * @param \Brevo\Client\Models\SubAccountUpdatePlanRequest $subAccountUpdatePlanRequest Values to update a sub-account plan (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIdPlanPut'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function corporateSubAccountIdPlanPutWithHttpInfo( + int $id, + \Brevo\Client\Models\SubAccountUpdatePlanRequest $subAccountUpdatePlanRequest, + string $contentType = self::contentTypes['corporateSubAccountIdPlanPut'][0] + ): array + { + $request = $this->corporateSubAccountIdPlanPutRequest($id, $subAccountUpdatePlanRequest, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation corporateSubAccountIdPlanPutAsync + * + * Update sub-account plan + * + * @param int $id Id of the sub-account organization (required) + * @param \Brevo\Client\Models\SubAccountUpdatePlanRequest $subAccountUpdatePlanRequest Values to update a sub-account plan (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIdPlanPut'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function corporateSubAccountIdPlanPutAsync( + int $id, + \Brevo\Client\Models\SubAccountUpdatePlanRequest $subAccountUpdatePlanRequest, + string $contentType = self::contentTypes['corporateSubAccountIdPlanPut'][0] + ): PromiseInterface + { + return $this->corporateSubAccountIdPlanPutAsyncWithHttpInfo($id, $subAccountUpdatePlanRequest, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation corporateSubAccountIdPlanPutAsyncWithHttpInfo + * + * Update sub-account plan + * + * @param int $id Id of the sub-account organization (required) + * @param \Brevo\Client\Models\SubAccountUpdatePlanRequest $subAccountUpdatePlanRequest Values to update a sub-account plan (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIdPlanPut'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function corporateSubAccountIdPlanPutAsyncWithHttpInfo( + $id, + $subAccountUpdatePlanRequest, + string $contentType = self::contentTypes['corporateSubAccountIdPlanPut'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->corporateSubAccountIdPlanPutRequest($id, $subAccountUpdatePlanRequest, $contentType); + + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'corporateSubAccountIdPlanPut' + * + * @param int $id Id of the sub-account organization (required) + * @param \Brevo\Client\Models\SubAccountUpdatePlanRequest $subAccountUpdatePlanRequest Values to update a sub-account plan (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIdPlanPut'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function corporateSubAccountIdPlanPutRequest( + $id, + $subAccountUpdatePlanRequest, + string $contentType = self::contentTypes['corporateSubAccountIdPlanPut'][0] + ): Request + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $id when calling corporateSubAccountIdPlanPut' + ); + } + + // verify the required parameter 'subAccountUpdatePlanRequest' is set + if ($subAccountUpdatePlanRequest === null || (is_array($subAccountUpdatePlanRequest) && count($subAccountUpdatePlanRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $subAccountUpdatePlanRequest when calling corporateSubAccountIdPlanPut' + ); + } + + + $resourcePath = '/corporate/subAccount/{id}/plan'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($subAccountUpdatePlanRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($subAccountUpdatePlanRequest)); + } else { + $httpBody = $subAccountUpdatePlanRequest; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation corporateSubAccountIpAssociatePost + * + * Associate an IP to sub-accounts + * + * @param \Brevo\Client\Models\CorporateSubAccountIpAssociatePostRequest|null $corporateSubAccountIpAssociatePostRequest corporateSubAccountIpAssociatePostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIpAssociatePost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return object|\Brevo\Client\Models\ErrorModel + */ + public function corporateSubAccountIpAssociatePost( + ?\Brevo\Client\Models\CorporateSubAccountIpAssociatePostRequest $corporateSubAccountIpAssociatePostRequest = null, + string $contentType = self::contentTypes['corporateSubAccountIpAssociatePost'][0] + ): object + { + list($response) = $this->corporateSubAccountIpAssociatePostWithHttpInfo($corporateSubAccountIpAssociatePostRequest, $contentType); + return $response; + } + + /** + * Operation corporateSubAccountIpAssociatePostWithHttpInfo + * + * Associate an IP to sub-accounts + * + * @param \Brevo\Client\Models\CorporateSubAccountIpAssociatePostRequest|null $corporateSubAccountIpAssociatePostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIpAssociatePost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of object|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) + */ + public function corporateSubAccountIpAssociatePostWithHttpInfo( + ?\Brevo\Client\Models\CorporateSubAccountIpAssociatePostRequest $corporateSubAccountIpAssociatePostRequest = null, + string $contentType = self::contentTypes['corporateSubAccountIpAssociatePost'][0] + ): array + { + $request = $this->corporateSubAccountIpAssociatePostRequest($corporateSubAccountIpAssociatePostRequest, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 201: + if (in_array('object', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('object' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, 'object', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = 'object'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'object', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation corporateSubAccountIpAssociatePostAsync + * + * Associate an IP to sub-accounts + * + * @param \Brevo\Client\Models\CorporateSubAccountIpAssociatePostRequest|null $corporateSubAccountIpAssociatePostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIpAssociatePost'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function corporateSubAccountIpAssociatePostAsync( + ?\Brevo\Client\Models\CorporateSubAccountIpAssociatePostRequest $corporateSubAccountIpAssociatePostRequest = null, + string $contentType = self::contentTypes['corporateSubAccountIpAssociatePost'][0] + ): PromiseInterface + { + return $this->corporateSubAccountIpAssociatePostAsyncWithHttpInfo($corporateSubAccountIpAssociatePostRequest, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation corporateSubAccountIpAssociatePostAsyncWithHttpInfo + * + * Associate an IP to sub-accounts + * + * @param \Brevo\Client\Models\CorporateSubAccountIpAssociatePostRequest|null $corporateSubAccountIpAssociatePostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIpAssociatePost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function corporateSubAccountIpAssociatePostAsyncWithHttpInfo( + $corporateSubAccountIpAssociatePostRequest = null, + string $contentType = self::contentTypes['corporateSubAccountIpAssociatePost'][0] + ): PromiseInterface + { + $returnType = 'object'; + $request = $this->corporateSubAccountIpAssociatePostRequest($corporateSubAccountIpAssociatePostRequest, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'corporateSubAccountIpAssociatePost' + * + * @param \Brevo\Client\Models\CorporateSubAccountIpAssociatePostRequest|null $corporateSubAccountIpAssociatePostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIpAssociatePost'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function corporateSubAccountIpAssociatePostRequest( + $corporateSubAccountIpAssociatePostRequest = null, + string $contentType = self::contentTypes['corporateSubAccountIpAssociatePost'][0] + ): Request + { + + + + $resourcePath = '/corporate/subAccount/ip/associate'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($corporateSubAccountIpAssociatePostRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($corporateSubAccountIpAssociatePostRequest)); + } else { + $httpBody = $corporateSubAccountIpAssociatePostRequest; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation corporateSubAccountIpDissociatePut + * + * Dissociate an IP to sub-accounts + * + * @param \Brevo\Client\Models\CorporateSubAccountIpDissociatePutRequest|null $corporateSubAccountIpDissociatePutRequest corporateSubAccountIpDissociatePutRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIpDissociatePut'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return void + */ + public function corporateSubAccountIpDissociatePut( + ?\Brevo\Client\Models\CorporateSubAccountIpDissociatePutRequest $corporateSubAccountIpDissociatePutRequest = null, + string $contentType = self::contentTypes['corporateSubAccountIpDissociatePut'][0] + ): void + { + $this->corporateSubAccountIpDissociatePutWithHttpInfo($corporateSubAccountIpDissociatePutRequest, $contentType); + } + + /** + * Operation corporateSubAccountIpDissociatePutWithHttpInfo + * + * Dissociate an IP to sub-accounts + * + * @param \Brevo\Client\Models\CorporateSubAccountIpDissociatePutRequest|null $corporateSubAccountIpDissociatePutRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIpDissociatePut'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function corporateSubAccountIpDissociatePutWithHttpInfo( + ?\Brevo\Client\Models\CorporateSubAccountIpDissociatePutRequest $corporateSubAccountIpDissociatePutRequest = null, + string $contentType = self::contentTypes['corporateSubAccountIpDissociatePut'][0] + ): array + { + $request = $this->corporateSubAccountIpDissociatePutRequest($corporateSubAccountIpDissociatePutRequest, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation corporateSubAccountIpDissociatePutAsync + * + * Dissociate an IP to sub-accounts + * + * @param \Brevo\Client\Models\CorporateSubAccountIpDissociatePutRequest|null $corporateSubAccountIpDissociatePutRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIpDissociatePut'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function corporateSubAccountIpDissociatePutAsync( + ?\Brevo\Client\Models\CorporateSubAccountIpDissociatePutRequest $corporateSubAccountIpDissociatePutRequest = null, + string $contentType = self::contentTypes['corporateSubAccountIpDissociatePut'][0] + ): PromiseInterface + { + return $this->corporateSubAccountIpDissociatePutAsyncWithHttpInfo($corporateSubAccountIpDissociatePutRequest, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation corporateSubAccountIpDissociatePutAsyncWithHttpInfo + * + * Dissociate an IP to sub-accounts + * + * @param \Brevo\Client\Models\CorporateSubAccountIpDissociatePutRequest|null $corporateSubAccountIpDissociatePutRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIpDissociatePut'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function corporateSubAccountIpDissociatePutAsyncWithHttpInfo( + $corporateSubAccountIpDissociatePutRequest = null, + string $contentType = self::contentTypes['corporateSubAccountIpDissociatePut'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->corporateSubAccountIpDissociatePutRequest($corporateSubAccountIpDissociatePutRequest, $contentType); + + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'corporateSubAccountIpDissociatePut' + * + * @param \Brevo\Client\Models\CorporateSubAccountIpDissociatePutRequest|null $corporateSubAccountIpDissociatePutRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountIpDissociatePut'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function corporateSubAccountIpDissociatePutRequest( + $corporateSubAccountIpDissociatePutRequest = null, + string $contentType = self::contentTypes['corporateSubAccountIpDissociatePut'][0] + ): Request + { + + + + $resourcePath = '/corporate/subAccount/ip/dissociate'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($corporateSubAccountIpDissociatePutRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($corporateSubAccountIpDissociatePutRequest)); + } else { + $httpBody = $corporateSubAccountIpDissociatePutRequest; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation corporateSubAccountKeyPost + * + * Create an API key for a sub-account + * + * @param \Brevo\Client\Models\CorporateSubAccountKeyPostRequest|null $corporateSubAccountKeyPostRequest corporateSubAccountKeyPostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountKeyPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateApiKeyResponse|\Brevo\Client\Models\ErrorModel + */ + public function corporateSubAccountKeyPost( + ?\Brevo\Client\Models\CorporateSubAccountKeyPostRequest $corporateSubAccountKeyPostRequest = null, + string $contentType = self::contentTypes['corporateSubAccountKeyPost'][0] + ): \Brevo\Client\Models\CreateApiKeyResponse + { + list($response) = $this->corporateSubAccountKeyPostWithHttpInfo($corporateSubAccountKeyPostRequest, $contentType); + return $response; + } + + /** + * Operation corporateSubAccountKeyPostWithHttpInfo + * + * Create an API key for a sub-account + * + * @param \Brevo\Client\Models\CorporateSubAccountKeyPostRequest|null $corporateSubAccountKeyPostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountKeyPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateApiKeyResponse|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) + */ + public function corporateSubAccountKeyPostWithHttpInfo( + ?\Brevo\Client\Models\CorporateSubAccountKeyPostRequest $corporateSubAccountKeyPostRequest = null, + string $contentType = self::contentTypes['corporateSubAccountKeyPost'][0] + ): array + { + $request = $this->corporateSubAccountKeyPostRequest($corporateSubAccountKeyPostRequest, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreateApiKeyResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateApiKeyResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateApiKeyResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\CreateApiKeyResponse'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\CreateApiKeyResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation corporateSubAccountKeyPostAsync + * + * Create an API key for a sub-account + * + * @param \Brevo\Client\Models\CorporateSubAccountKeyPostRequest|null $corporateSubAccountKeyPostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountKeyPost'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function corporateSubAccountKeyPostAsync( + ?\Brevo\Client\Models\CorporateSubAccountKeyPostRequest $corporateSubAccountKeyPostRequest = null, + string $contentType = self::contentTypes['corporateSubAccountKeyPost'][0] + ): PromiseInterface + { + return $this->corporateSubAccountKeyPostAsyncWithHttpInfo($corporateSubAccountKeyPostRequest, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation corporateSubAccountKeyPostAsyncWithHttpInfo + * + * Create an API key for a sub-account + * + * @param \Brevo\Client\Models\CorporateSubAccountKeyPostRequest|null $corporateSubAccountKeyPostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountKeyPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function corporateSubAccountKeyPostAsyncWithHttpInfo( + $corporateSubAccountKeyPostRequest = null, + string $contentType = self::contentTypes['corporateSubAccountKeyPost'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\CreateApiKeyResponse'; + $request = $this->corporateSubAccountKeyPostRequest($corporateSubAccountKeyPostRequest, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'corporateSubAccountKeyPost' + * + * @param \Brevo\Client\Models\CorporateSubAccountKeyPostRequest|null $corporateSubAccountKeyPostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountKeyPost'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function corporateSubAccountKeyPostRequest( + $corporateSubAccountKeyPostRequest = null, + string $contentType = self::contentTypes['corporateSubAccountKeyPost'][0] + ): Request + { + + + + $resourcePath = '/corporate/subAccount/key'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($corporateSubAccountKeyPostRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($corporateSubAccountKeyPostRequest)); + } else { + $httpBody = $corporateSubAccountKeyPostRequest; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation corporateSubAccountPost + * + * Create a new sub-account under a master account. + * + * @param \Brevo\Client\Models\CreateSubAccount $createSubAccount Request body with sub-account organization name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateSubAccountResponse|\Brevo\Client\Models\ErrorModel + */ + public function corporateSubAccountPost( + \Brevo\Client\Models\CreateSubAccount $createSubAccount, + string $contentType = self::contentTypes['corporateSubAccountPost'][0] + ): \Brevo\Client\Models\CreateSubAccountResponse + { + list($response) = $this->corporateSubAccountPostWithHttpInfo($createSubAccount, $contentType); + return $response; + } + + /** + * Operation corporateSubAccountPostWithHttpInfo + * + * Create a new sub-account under a master account. + * + * @param \Brevo\Client\Models\CreateSubAccount $createSubAccount Request body with sub-account organization name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateSubAccountResponse|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) + */ + public function corporateSubAccountPostWithHttpInfo( + \Brevo\Client\Models\CreateSubAccount $createSubAccount, + string $contentType = self::contentTypes['corporateSubAccountPost'][0] + ): array + { + $request = $this->corporateSubAccountPostRequest($createSubAccount, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreateSubAccountResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateSubAccountResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateSubAccountResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\CreateSubAccountResponse'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\CreateSubAccountResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation corporateSubAccountPostAsync + * + * Create a new sub-account under a master account. + * + * @param \Brevo\Client\Models\CreateSubAccount $createSubAccount Request body with sub-account organization name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountPost'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function corporateSubAccountPostAsync( + \Brevo\Client\Models\CreateSubAccount $createSubAccount, + string $contentType = self::contentTypes['corporateSubAccountPost'][0] + ): PromiseInterface + { + return $this->corporateSubAccountPostAsyncWithHttpInfo($createSubAccount, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation corporateSubAccountPostAsyncWithHttpInfo + * + * Create a new sub-account under a master account. + * + * @param \Brevo\Client\Models\CreateSubAccount $createSubAccount Request body with sub-account organization name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function corporateSubAccountPostAsyncWithHttpInfo( + $createSubAccount, + string $contentType = self::contentTypes['corporateSubAccountPost'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\CreateSubAccountResponse'; + $request = $this->corporateSubAccountPostRequest($createSubAccount, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'corporateSubAccountPost' + * + * @param \Brevo\Client\Models\CreateSubAccount $createSubAccount Request body with sub-account organization name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountPost'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function corporateSubAccountPostRequest( + $createSubAccount, + string $contentType = self::contentTypes['corporateSubAccountPost'][0] + ): Request + { + + // verify the required parameter 'createSubAccount' is set + if ($createSubAccount === null || (is_array($createSubAccount) && count($createSubAccount) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $createSubAccount when calling corporateSubAccountPost' + ); + } + + + $resourcePath = '/corporate/subAccount'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($createSubAccount)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createSubAccount)); + } else { + $httpBody = $createSubAccount; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation corporateSubAccountSsoTokenPost + * + * Generate SSO token to access sub-account + * + * @param \Brevo\Client\Models\CorporateSubAccountSsoTokenPostRequest|null $corporateSubAccountSsoTokenPostRequest corporateSubAccountSsoTokenPostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountSsoTokenPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetSsoToken|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel + */ + public function corporateSubAccountSsoTokenPost( + ?\Brevo\Client\Models\CorporateSubAccountSsoTokenPostRequest $corporateSubAccountSsoTokenPostRequest = null, + string $contentType = self::contentTypes['corporateSubAccountSsoTokenPost'][0] + ): \Brevo\Client\Models\GetSsoToken + { + list($response) = $this->corporateSubAccountSsoTokenPostWithHttpInfo($corporateSubAccountSsoTokenPostRequest, $contentType); + return $response; + } + + /** + * Operation corporateSubAccountSsoTokenPostWithHttpInfo + * + * Generate SSO token to access sub-account + * + * @param \Brevo\Client\Models\CorporateSubAccountSsoTokenPostRequest|null $corporateSubAccountSsoTokenPostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountSsoTokenPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetSsoToken|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) + */ + public function corporateSubAccountSsoTokenPostWithHttpInfo( + ?\Brevo\Client\Models\CorporateSubAccountSsoTokenPostRequest $corporateSubAccountSsoTokenPostRequest = null, + string $contentType = self::contentTypes['corporateSubAccountSsoTokenPost'][0] + ): array + { + $request = $this->corporateSubAccountSsoTokenPostRequest($corporateSubAccountSsoTokenPostRequest, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetSsoToken', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetSsoToken' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetSsoToken', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\GetSsoToken'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\GetSsoToken', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation corporateSubAccountSsoTokenPostAsync + * + * Generate SSO token to access sub-account + * + * @param \Brevo\Client\Models\CorporateSubAccountSsoTokenPostRequest|null $corporateSubAccountSsoTokenPostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountSsoTokenPost'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function corporateSubAccountSsoTokenPostAsync( + ?\Brevo\Client\Models\CorporateSubAccountSsoTokenPostRequest $corporateSubAccountSsoTokenPostRequest = null, + string $contentType = self::contentTypes['corporateSubAccountSsoTokenPost'][0] + ): PromiseInterface + { + return $this->corporateSubAccountSsoTokenPostAsyncWithHttpInfo($corporateSubAccountSsoTokenPostRequest, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation corporateSubAccountSsoTokenPostAsyncWithHttpInfo + * + * Generate SSO token to access sub-account + * + * @param \Brevo\Client\Models\CorporateSubAccountSsoTokenPostRequest|null $corporateSubAccountSsoTokenPostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountSsoTokenPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function corporateSubAccountSsoTokenPostAsyncWithHttpInfo( + $corporateSubAccountSsoTokenPostRequest = null, + string $contentType = self::contentTypes['corporateSubAccountSsoTokenPost'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\GetSsoToken'; + $request = $this->corporateSubAccountSsoTokenPostRequest($corporateSubAccountSsoTokenPostRequest, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'corporateSubAccountSsoTokenPost' + * + * @param \Brevo\Client\Models\CorporateSubAccountSsoTokenPostRequest|null $corporateSubAccountSsoTokenPostRequest (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateSubAccountSsoTokenPost'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function corporateSubAccountSsoTokenPostRequest( + $corporateSubAccountSsoTokenPostRequest = null, + string $contentType = self::contentTypes['corporateSubAccountSsoTokenPost'][0] + ): Request + { + + + + $resourcePath = '/corporate/subAccount/ssoToken'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($corporateSubAccountSsoTokenPostRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($corporateSubAccountSsoTokenPostRequest)); + } else { + $httpBody = $corporateSubAccountSsoTokenPostRequest; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation corporateUserEmailPermissionsPut + * + * Change admin user permissions + * + * @param string $email Email address of Admin user (required) + * @param \Brevo\Client\Models\CorporateUserEmailPermissionsPutRequest $corporateUserEmailPermissionsPutRequest Values to update an admin user permissions (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateUserEmailPermissionsPut'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return void + */ + public function corporateUserEmailPermissionsPut( + string $email, + \Brevo\Client\Models\CorporateUserEmailPermissionsPutRequest $corporateUserEmailPermissionsPutRequest, + string $contentType = self::contentTypes['corporateUserEmailPermissionsPut'][0] + ): void + { + $this->corporateUserEmailPermissionsPutWithHttpInfo($email, $corporateUserEmailPermissionsPutRequest, $contentType); + } + + /** + * Operation corporateUserEmailPermissionsPutWithHttpInfo + * + * Change admin user permissions + * + * @param string $email Email address of Admin user (required) + * @param \Brevo\Client\Models\CorporateUserEmailPermissionsPutRequest $corporateUserEmailPermissionsPutRequest Values to update an admin user permissions (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateUserEmailPermissionsPut'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function corporateUserEmailPermissionsPutWithHttpInfo( + string $email, + \Brevo\Client\Models\CorporateUserEmailPermissionsPutRequest $corporateUserEmailPermissionsPutRequest, + string $contentType = self::contentTypes['corporateUserEmailPermissionsPut'][0] + ): array + { + $request = $this->corporateUserEmailPermissionsPutRequest($email, $corporateUserEmailPermissionsPutRequest, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation corporateUserEmailPermissionsPutAsync + * + * Change admin user permissions + * + * @param string $email Email address of Admin user (required) + * @param \Brevo\Client\Models\CorporateUserEmailPermissionsPutRequest $corporateUserEmailPermissionsPutRequest Values to update an admin user permissions (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateUserEmailPermissionsPut'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function corporateUserEmailPermissionsPutAsync( + string $email, + \Brevo\Client\Models\CorporateUserEmailPermissionsPutRequest $corporateUserEmailPermissionsPutRequest, + string $contentType = self::contentTypes['corporateUserEmailPermissionsPut'][0] + ): PromiseInterface + { + return $this->corporateUserEmailPermissionsPutAsyncWithHttpInfo($email, $corporateUserEmailPermissionsPutRequest, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation corporateUserEmailPermissionsPutAsyncWithHttpInfo + * + * Change admin user permissions + * + * @param string $email Email address of Admin user (required) + * @param \Brevo\Client\Models\CorporateUserEmailPermissionsPutRequest $corporateUserEmailPermissionsPutRequest Values to update an admin user permissions (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateUserEmailPermissionsPut'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function corporateUserEmailPermissionsPutAsyncWithHttpInfo( + $email, + $corporateUserEmailPermissionsPutRequest, + string $contentType = self::contentTypes['corporateUserEmailPermissionsPut'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->corporateUserEmailPermissionsPutRequest($email, $corporateUserEmailPermissionsPutRequest, $contentType); + + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'corporateUserEmailPermissionsPut' + * + * @param string $email Email address of Admin user (required) + * @param \Brevo\Client\Models\CorporateUserEmailPermissionsPutRequest $corporateUserEmailPermissionsPutRequest Values to update an admin user permissions (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateUserEmailPermissionsPut'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function corporateUserEmailPermissionsPutRequest( + $email, + $corporateUserEmailPermissionsPutRequest, + string $contentType = self::contentTypes['corporateUserEmailPermissionsPut'][0] + ): Request + { + + // verify the required parameter 'email' is set + if ($email === null || (is_array($email) && count($email) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $email when calling corporateUserEmailPermissionsPut' + ); + } + + // verify the required parameter 'corporateUserEmailPermissionsPutRequest' is set + if ($corporateUserEmailPermissionsPutRequest === null || (is_array($corporateUserEmailPermissionsPutRequest) && count($corporateUserEmailPermissionsPutRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $corporateUserEmailPermissionsPutRequest when calling corporateUserEmailPermissionsPut' ); } - $resourcePath = '/corporate/subAccount/key'; + + $resourcePath = '/corporate/user/{email}/permissions'; $formParams = []; $queryParams = []; $headerParams = []; @@ -2462,56 +6263,51 @@ protected function corporateSubAccountKeyPostRequest($createApiKeyRequest) - // body params - $_tempBody = null; - if (isset($createApiKeyRequest)) { - $_tempBody = $createApiKeyRequest; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] + // path params + if ($email !== null) { + $resourcePath = str_replace( + '{' . 'email' . '}', + ObjectSerializer::toPathValue($email), + $resourcePath ); } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($corporateUserEmailPermissionsPutRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($corporateUserEmailPermissionsPutRequest)); + } else { + $httpBody = $corporateUserEmailPermissionsPutRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2537,47 +6333,59 @@ protected function corporateSubAccountKeyPostRequest($createApiKeyRequest) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Operation corporateSubAccountPost + * Operation corporateUserInvitationActionEmailPut * - * Create a new sub-account under a master account. + * Resend / cancel admin user invitation * - * @param \Brevo\Client\Model\CreateSubAccount $subAccountCreate values to create new sub-account (required) + * @param string $action Action to be performed (cancel / resend) (required) + * @param string $email Email address of the recipient (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateUserInvitationActionEmailPut'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreateSubAccountResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CorporateUserInvitationActionEmailPut200Response|\Brevo\Client\Models\ErrorModel */ - public function corporateSubAccountPost($subAccountCreate) + public function corporateUserInvitationActionEmailPut( + string $action, + string $email, + string $contentType = self::contentTypes['corporateUserInvitationActionEmailPut'][0] + ): \Brevo\Client\Models\CorporateUserInvitationActionEmailPut200Response { - list($response) = $this->corporateSubAccountPostWithHttpInfo($subAccountCreate); + list($response) = $this->corporateUserInvitationActionEmailPutWithHttpInfo($action, $email, $contentType); return $response; } /** - * Operation corporateSubAccountPostWithHttpInfo + * Operation corporateUserInvitationActionEmailPutWithHttpInfo * - * Create a new sub-account under a master account. + * Resend / cancel admin user invitation * - * @param \Brevo\Client\Model\CreateSubAccount $subAccountCreate values to create new sub-account (required) + * @param string $action Action to be performed (cancel / resend) (required) + * @param string $email Email address of the recipient (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateUserInvitationActionEmailPut'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreateSubAccountResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CorporateUserInvitationActionEmailPut200Response|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function corporateSubAccountPostWithHttpInfo($subAccountCreate) + public function corporateUserInvitationActionEmailPutWithHttpInfo( + string $action, + string $email, + string $contentType = self::contentTypes['corporateUserInvitationActionEmailPut'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreateSubAccountResponse'; - $request = $this->corporateSubAccountPostRequest($subAccountCreate); + $request = $this->corporateUserInvitationActionEmailPutRequest($action, $email, $contentType); try { $options = $this->createHttpClientOption(); @@ -2586,34 +6394,111 @@ public function corporateSubAccountPostWithHttpInfo($subAccountCreate) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\CorporateUserInvitationActionEmailPut200Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CorporateUserInvitationActionEmailPut200Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CorporateUserInvitationActionEmailPut200Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CorporateUserInvitationActionEmailPut200Response'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2625,10 +6510,10 @@ public function corporateSubAccountPostWithHttpInfo($subAccountCreate) } catch (ApiException $e) { switch ($e->getCode()) { - case 201: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreateSubAccountResponse', + '\Brevo\Client\Models\CorporateUserInvitationActionEmailPut200Response', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2636,7 +6521,7 @@ public function corporateSubAccountPostWithHttpInfo($subAccountCreate) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2647,18 +6532,24 @@ public function corporateSubAccountPostWithHttpInfo($subAccountCreate) } /** - * Operation corporateSubAccountPostAsync + * Operation corporateUserInvitationActionEmailPutAsync * - * Create a new sub-account under a master account. + * Resend / cancel admin user invitation * - * @param \Brevo\Client\Model\CreateSubAccount $subAccountCreate values to create new sub-account (required) + * @param string $action Action to be performed (cancel / resend) (required) + * @param string $email Email address of the recipient (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateUserInvitationActionEmailPut'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateSubAccountPostAsync($subAccountCreate) + public function corporateUserInvitationActionEmailPutAsync( + string $action, + string $email, + string $contentType = self::contentTypes['corporateUserInvitationActionEmailPut'][0] + ): PromiseInterface { - return $this->corporateSubAccountPostAsyncWithHttpInfo($subAccountCreate) + return $this->corporateUserInvitationActionEmailPutAsyncWithHttpInfo($action, $email, $contentType) ->then( function ($response) { return $response[0]; @@ -2667,29 +6558,35 @@ function ($response) { } /** - * Operation corporateSubAccountPostAsyncWithHttpInfo + * Operation corporateUserInvitationActionEmailPutAsyncWithHttpInfo * - * Create a new sub-account under a master account. + * Resend / cancel admin user invitation * - * @param \Brevo\Client\Model\CreateSubAccount $subAccountCreate values to create new sub-account (required) + * @param string $action Action to be performed (cancel / resend) (required) + * @param string $email Email address of the recipient (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateUserInvitationActionEmailPut'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateSubAccountPostAsyncWithHttpInfo($subAccountCreate) + public function corporateUserInvitationActionEmailPutAsyncWithHttpInfo( + $action, + $email, + string $contentType = self::contentTypes['corporateUserInvitationActionEmailPut'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreateSubAccountResponse'; - $request = $this->corporateSubAccountPostRequest($subAccountCreate); + $returnType = '\Brevo\Client\Models\CorporateUserInvitationActionEmailPut200Response'; + $request = $this->corporateUserInvitationActionEmailPutRequest($action, $email, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2712,30 +6609,45 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); } /** - * Create request for operation 'corporateSubAccountPost' + * Create request for operation 'corporateUserInvitationActionEmailPut' * - * @param \Brevo\Client\Model\CreateSubAccount $subAccountCreate values to create new sub-account (required) + * @param string $action Action to be performed (cancel / resend) (required) + * @param string $email Email address of the recipient (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateUserInvitationActionEmailPut'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function corporateSubAccountPostRequest($subAccountCreate) + public function corporateUserInvitationActionEmailPutRequest( + $action, + $email, + string $contentType = self::contentTypes['corporateUserInvitationActionEmailPut'][0] + ): Request { - // verify the required parameter 'subAccountCreate' is set - if ($subAccountCreate === null || (is_array($subAccountCreate) && count($subAccountCreate) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $subAccountCreate when calling corporateSubAccountPost' + + // verify the required parameter 'action' is set + if ($action === null || (is_array($action) && count($action) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $action when calling corporateUserInvitationActionEmailPut' ); } - $resourcePath = '/corporate/subAccount'; + // verify the required parameter 'email' is set + if ($email === null || (is_array($email) && count($email) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $email when calling corporateUserInvitationActionEmailPut' + ); + } + + + $resourcePath = '/corporate/user/invitation/{action}/{email}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -2744,56 +6656,52 @@ protected function corporateSubAccountPostRequest($subAccountCreate) - // body params - $_tempBody = null; - if (isset($subAccountCreate)) { - $_tempBody = $subAccountCreate; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] + // path params + if ($action !== null) { + $resourcePath = str_replace( + '{' . 'action' . '}', + ObjectSerializer::toPathValue($action), + $resourcePath ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] + } + // path params + if ($email !== null) { + $resourcePath = str_replace( + '{' . 'email' . '}', + ObjectSerializer::toPathValue($email), + $resourcePath ); } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2819,47 +6727,54 @@ protected function corporateSubAccountPostRequest($subAccountCreate) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Operation corporateSubAccountSsoTokenPost + * Operation corporateUserRevokeEmailDelete * - * Generate SSO token to access Brevo + * Revoke an admin user * - * @param \Brevo\Client\Model\SsoTokenRequest $ssoTokenRequest Values to generate SSO token for sub-account (required) + * @param string $email Email of the invited user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateUserRevokeEmailDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetSsoToken + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return void */ - public function corporateSubAccountSsoTokenPost($ssoTokenRequest) + public function corporateUserRevokeEmailDelete( + string $email, + string $contentType = self::contentTypes['corporateUserRevokeEmailDelete'][0] + ): void { - list($response) = $this->corporateSubAccountSsoTokenPostWithHttpInfo($ssoTokenRequest); - return $response; + $this->corporateUserRevokeEmailDeleteWithHttpInfo($email, $contentType); } /** - * Operation corporateSubAccountSsoTokenPostWithHttpInfo + * Operation corporateUserRevokeEmailDeleteWithHttpInfo * - * Generate SSO token to access Brevo + * Revoke an admin user * - * @param \Brevo\Client\Model\SsoTokenRequest $ssoTokenRequest Values to generate SSO token for sub-account (required) + * @param string $email Email of the invited user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateUserRevokeEmailDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetSsoToken, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function corporateSubAccountSsoTokenPostWithHttpInfo($ssoTokenRequest) + public function corporateUserRevokeEmailDeleteWithHttpInfo( + string $email, + string $contentType = self::contentTypes['corporateUserRevokeEmailDelete'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetSsoToken'; - $request = $this->corporateSubAccountSsoTokenPostRequest($ssoTokenRequest); + $request = $this->corporateUserRevokeEmailDeleteRequest($email, $contentType); try { $options = $this->createHttpClientOption(); @@ -2868,65 +6783,30 @@ public function corporateSubAccountSsoTokenPostWithHttpInfo($ssoTokenRequest) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { + } catch (ConnectException $e) { throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } + $statusCode = $response->getStatusCode(); - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; + + return [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\GetSsoToken', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2937,18 +6817,22 @@ public function corporateSubAccountSsoTokenPostWithHttpInfo($ssoTokenRequest) } /** - * Operation corporateSubAccountSsoTokenPostAsync + * Operation corporateUserRevokeEmailDeleteAsync * - * Generate SSO token to access Brevo + * Revoke an admin user * - * @param \Brevo\Client\Model\SsoTokenRequest $ssoTokenRequest Values to generate SSO token for sub-account (required) + * @param string $email Email of the invited user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateUserRevokeEmailDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateSubAccountSsoTokenPostAsync($ssoTokenRequest) + public function corporateUserRevokeEmailDeleteAsync( + string $email, + string $contentType = self::contentTypes['corporateUserRevokeEmailDelete'][0] + ): PromiseInterface { - return $this->corporateSubAccountSsoTokenPostAsyncWithHttpInfo($ssoTokenRequest) + return $this->corporateUserRevokeEmailDeleteAsyncWithHttpInfo($email, $contentType) ->then( function ($response) { return $response[0]; @@ -2957,39 +6841,30 @@ function ($response) { } /** - * Operation corporateSubAccountSsoTokenPostAsyncWithHttpInfo + * Operation corporateUserRevokeEmailDeleteAsyncWithHttpInfo * - * Generate SSO token to access Brevo + * Revoke an admin user * - * @param \Brevo\Client\Model\SsoTokenRequest $ssoTokenRequest Values to generate SSO token for sub-account (required) + * @param string $email Email of the invited user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateUserRevokeEmailDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateSubAccountSsoTokenPostAsyncWithHttpInfo($ssoTokenRequest) + public function corporateUserRevokeEmailDeleteAsyncWithHttpInfo( + $email, + string $contentType = self::contentTypes['corporateUserRevokeEmailDelete'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetSsoToken'; - $request = $this->corporateSubAccountSsoTokenPostRequest($ssoTokenRequest); + $returnType = ''; + $request = $this->corporateUserRevokeEmailDeleteRequest($email, $contentType); 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() - ]; + return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { $response = $exception->getResponse(); @@ -3002,30 +6877,36 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); } /** - * Create request for operation 'corporateSubAccountSsoTokenPost' + * Create request for operation 'corporateUserRevokeEmailDelete' * - * @param \Brevo\Client\Model\SsoTokenRequest $ssoTokenRequest Values to generate SSO token for sub-account (required) + * @param string $email Email of the invited user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['corporateUserRevokeEmailDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function corporateSubAccountSsoTokenPostRequest($ssoTokenRequest) + public function corporateUserRevokeEmailDeleteRequest( + $email, + string $contentType = self::contentTypes['corporateUserRevokeEmailDelete'][0] + ): Request { - // verify the required parameter 'ssoTokenRequest' is set - if ($ssoTokenRequest === null || (is_array($ssoTokenRequest) && count($ssoTokenRequest) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $ssoTokenRequest when calling corporateSubAccountSsoTokenPost' + + // verify the required parameter 'email' is set + if ($email === null || (is_array($email) && count($email) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $email when calling corporateUserRevokeEmailDelete' ); } - $resourcePath = '/corporate/subAccount/ssoToken'; + + $resourcePath = '/corporate/user/revoke/{email}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -3034,56 +6915,44 @@ protected function corporateSubAccountSsoTokenPostRequest($ssoTokenRequest) - // body params - $_tempBody = null; - if (isset($ssoTokenRequest)) { - $_tempBody = $ssoTokenRequest; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] + // path params + if ($email !== null) { + $resourcePath = str_replace( + '{' . 'email' . '}', + ObjectSerializer::toPathValue($email), + $resourcePath ); } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3109,46 +6978,67 @@ protected function corporateSubAccountSsoTokenPostRequest($ssoTokenRequest) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Operation corporateUserRevokeEmailDelete + * Operation getAccountActivity_0 * - * Revoke an admin user + * Get user activity logs * - * @param string $email Email of the invited user (required) + * @param string|null $startDate Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. (optional) + * @param string|null $endDate Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. (optional) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document in the page. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccountActivity_0'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetAccountActivity|\Brevo\Client\Models\ErrorModel */ - public function corporateUserRevokeEmailDelete($email) + public function getAccountActivity_0( + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 10, + ?int $offset = 0, + string $contentType = self::contentTypes['getAccountActivity_0'][0] + ): \Brevo\Client\Models\GetAccountActivity { - $this->corporateUserRevokeEmailDeleteWithHttpInfo($email); + list($response) = $this->getAccountActivity_0WithHttpInfo($startDate, $endDate, $limit, $offset, $contentType); + return $response; } /** - * Operation corporateUserRevokeEmailDeleteWithHttpInfo + * Operation getAccountActivity_0WithHttpInfo * - * Revoke an admin user + * Get user activity logs * - * @param string $email Email of the invited user (required) + * @param string|null $startDate Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. (optional) + * @param string|null $endDate Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. (optional) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document in the page. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccountActivity_0'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetAccountActivity|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function corporateUserRevokeEmailDeleteWithHttpInfo($email) + public function getAccountActivity_0WithHttpInfo( + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 10, + ?int $offset = 0, + string $contentType = self::contentTypes['getAccountActivity_0'][0] + ): array { - $returnType = ''; - $request = $this->corporateUserRevokeEmailDeleteRequest($email); + $request = $this->getAccountActivity_0Request($startDate, $endDate, $limit, $offset, $contentType); try { $options = $this->createHttpClientOption(); @@ -3157,35 +7047,134 @@ public function corporateUserRevokeEmailDeleteWithHttpInfo($email) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetAccountActivity', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetAccountActivity' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetAccountActivity', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - return [null, $statusCode, $response->getHeaders()]; + $returnType = '\Brevo\Client\Models\GetAccountActivity'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\GetAccountActivity', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3196,18 +7185,28 @@ public function corporateUserRevokeEmailDeleteWithHttpInfo($email) } /** - * Operation corporateUserRevokeEmailDeleteAsync + * Operation getAccountActivity_0Async * - * Revoke an admin user + * Get user activity logs * - * @param string $email Email of the invited user (required) + * @param string|null $startDate Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. (optional) + * @param string|null $endDate Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. (optional) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document in the page. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccountActivity_0'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateUserRevokeEmailDeleteAsync($email) + public function getAccountActivity_0Async( + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 10, + ?int $offset = 0, + string $contentType = self::contentTypes['getAccountActivity_0'][0] + ): PromiseInterface { - return $this->corporateUserRevokeEmailDeleteAsyncWithHttpInfo($email) + return $this->getAccountActivity_0AsyncWithHttpInfo($startDate, $endDate, $limit, $offset, $contentType) ->then( function ($response) { return $response[0]; @@ -3216,25 +7215,49 @@ function ($response) { } /** - * Operation corporateUserRevokeEmailDeleteAsyncWithHttpInfo + * Operation getAccountActivity_0AsyncWithHttpInfo * - * Revoke an admin user + * Get user activity logs * - * @param string $email Email of the invited user (required) + * @param string|null $startDate Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. (optional) + * @param string|null $endDate Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. (optional) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document in the page. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccountActivity_0'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function corporateUserRevokeEmailDeleteAsyncWithHttpInfo($email) + public function getAccountActivity_0AsyncWithHttpInfo( + $startDate = null, + $endDate = null, + $limit = 10, + $offset = 0, + string $contentType = self::contentTypes['getAccountActivity_0'][0] + ): PromiseInterface { - $returnType = ''; - $request = $this->corporateUserRevokeEmailDeleteRequest($email); + $returnType = '\Brevo\Client\Models\GetAccountActivity'; + $request = $this->getAccountActivity_0Request($startDate, $endDate, $limit, $offset, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; }, function ($exception) { $response = $exception->getResponse(); @@ -3247,93 +7270,119 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); } /** - * Create request for operation 'corporateUserRevokeEmailDelete' + * Create request for operation 'getAccountActivity_0' * - * @param string $email Email of the invited user (required) + * @param string|null $startDate Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. (optional) + * @param string|null $endDate Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. (optional) + * @param int|null $limit Number of documents per page (optional, default to 10) + * @param int|null $offset Index of the first document in the page. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccountActivity_0'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function corporateUserRevokeEmailDeleteRequest($email) + public function getAccountActivity_0Request( + $startDate = null, + $endDate = null, + $limit = 10, + $offset = 0, + string $contentType = self::contentTypes['getAccountActivity_0'][0] + ): Request { - // verify the required parameter 'email' is set - if ($email === null || (is_array($email) && count($email) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $email when calling corporateUserRevokeEmailDelete' - ); + + + + if ($limit !== null && $limit > 100) { + throw new InvalidArgumentException('invalid value for "$limit" when calling MasterAccountApi.getAccountActivity_0, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new InvalidArgumentException('invalid value for "$limit" when calling MasterAccountApi.getAccountActivity_0, must be bigger than or equal to 1.'); } + - $resourcePath = '/corporate/user/revoke/{email}'; + + $resourcePath = '/organization/activities'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + - // 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'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3359,53 +7408,51 @@ protected function corporateUserRevokeEmailDeleteRequest($email) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Operation getAccountActivity + * Operation getCorporateInvitedUsersList * - * Get user activity logs + * Get the list of all admin users * - * @param string $startDate Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. (optional) - * @param string $endDate Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. (optional) - * @param int $limit Number of documents per page (optional, default to 10) - * @param int $offset Index of the first document in the page. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCorporateInvitedUsersList'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetAccountActivity + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetCorporateInvitedUsersList */ - public function getAccountActivity($startDate = null, $endDate = null, $limit = '10', $offset = '0') + public function getCorporateInvitedUsersList( + string $contentType = self::contentTypes['getCorporateInvitedUsersList'][0] + ): \Brevo\Client\Models\GetCorporateInvitedUsersList { - list($response) = $this->getAccountActivityWithHttpInfo($startDate, $endDate, $limit, $offset); + list($response) = $this->getCorporateInvitedUsersListWithHttpInfo($contentType); return $response; } /** - * Operation getAccountActivityWithHttpInfo + * Operation getCorporateInvitedUsersListWithHttpInfo * - * Get user activity logs + * Get the list of all admin users * - * @param string $startDate Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. (optional) - * @param string $endDate Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. (optional) - * @param int $limit Number of documents per page (optional, default to 10) - * @param int $offset Index of the first document in the page. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCorporateInvitedUsersList'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetAccountActivity, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetCorporateInvitedUsersList, HTTP status code, HTTP response headers (array of strings) */ - public function getAccountActivityWithHttpInfo($startDate = null, $endDate = null, $limit = '10', $offset = '0') + public function getCorporateInvitedUsersListWithHttpInfo( + string $contentType = self::contentTypes['getCorporateInvitedUsersList'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetAccountActivity'; - $request = $this->getAccountActivityRequest($startDate, $endDate, $limit, $offset); + $request = $this->getCorporateInvitedUsersListRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -3414,34 +7461,84 @@ public function getAccountActivityWithHttpInfo($startDate = null, $endDate = nul } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetCorporateInvitedUsersList', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetCorporateInvitedUsersList' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetCorporateInvitedUsersList', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetCorporateInvitedUsersList'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3456,15 +7553,7 @@ public function getAccountActivityWithHttpInfo($startDate = null, $endDate = nul case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetAccountActivity', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\GetCorporateInvitedUsersList', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3475,21 +7564,20 @@ public function getAccountActivityWithHttpInfo($startDate = null, $endDate = nul } /** - * Operation getAccountActivityAsync + * Operation getCorporateInvitedUsersListAsync * - * Get user activity logs + * Get the list of all admin users * - * @param string $startDate Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. (optional) - * @param string $endDate Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. (optional) - * @param int $limit Number of documents per page (optional, default to 10) - * @param int $offset Index of the first document in the page. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCorporateInvitedUsersList'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getAccountActivityAsync($startDate = null, $endDate = null, $limit = '10', $offset = '0') + public function getCorporateInvitedUsersListAsync( + string $contentType = self::contentTypes['getCorporateInvitedUsersList'][0] + ): PromiseInterface { - return $this->getAccountActivityAsyncWithHttpInfo($startDate, $endDate, $limit, $offset) + return $this->getCorporateInvitedUsersListAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -3498,32 +7586,31 @@ function ($response) { } /** - * Operation getAccountActivityAsyncWithHttpInfo + * Operation getCorporateInvitedUsersListAsyncWithHttpInfo * - * Get user activity logs + * Get the list of all admin users * - * @param string $startDate Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. (optional) - * @param string $endDate Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. (optional) - * @param int $limit Number of documents per page (optional, default to 10) - * @param int $offset Index of the first document in the page. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCorporateInvitedUsersList'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getAccountActivityAsyncWithHttpInfo($startDate = null, $endDate = null, $limit = '10', $offset = '0') + public function getCorporateInvitedUsersListAsyncWithHttpInfo( + string $contentType = self::contentTypes['getCorporateInvitedUsersList'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetAccountActivity'; - $request = $this->getAccountActivityRequest($startDate, $endDate, $limit, $offset); + $returnType = '\Brevo\Client\Models\GetCorporateInvitedUsersList'; + $request = $this->getCorporateInvitedUsersListRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3546,105 +7633,65 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); } /** - * Create request for operation 'getAccountActivity' + * Create request for operation 'getCorporateInvitedUsersList' * - * @param string $startDate Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. (optional) - * @param string $endDate Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. (optional) - * @param int $limit Number of documents per page (optional, default to 10) - * @param int $offset Index of the first document in the page. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCorporateInvitedUsersList'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getAccountActivityRequest($startDate = null, $endDate = null, $limit = '10', $offset = '0') + public function getCorporateInvitedUsersListRequest( + string $contentType = self::contentTypes['getCorporateInvitedUsersList'][0] + ): Request { - if ($limit !== null && $limit > 100) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling MasterAccountApi.getAccountActivity, must be smaller than or equal to 100.'); - } - if ($limit !== null && $limit < 1) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling MasterAccountApi.getAccountActivity, must be bigger than or equal to 1.'); - } - $resourcePath = '/organization/activities'; + $resourcePath = '/corporate/invited/users'; $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 ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } - // query params - if ($offset !== null) { - $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'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3670,45 +7717,55 @@ protected function getAccountActivityRequest($startDate = null, $endDate = null, $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Operation getCorporateInvitedUsersList + * Operation getCorporateUserPermission * - * Get the list of all admin users + * Check admin user permissions * + * @param string $email Email of the invited user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCorporateUserPermission'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetCorporateInvitedUsersList + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetCorporateUserPermission|\Brevo\Client\Models\ErrorModel */ - public function getCorporateInvitedUsersList() + public function getCorporateUserPermission( + string $email, + string $contentType = self::contentTypes['getCorporateUserPermission'][0] + ): \Brevo\Client\Models\GetCorporateUserPermission { - list($response) = $this->getCorporateInvitedUsersListWithHttpInfo(); + list($response) = $this->getCorporateUserPermissionWithHttpInfo($email, $contentType); return $response; } /** - * Operation getCorporateInvitedUsersListWithHttpInfo + * Operation getCorporateUserPermissionWithHttpInfo * - * Get the list of all admin users + * Check admin user permissions * + * @param string $email Email of the invited user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCorporateUserPermission'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetCorporateInvitedUsersList, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetCorporateUserPermission|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getCorporateInvitedUsersListWithHttpInfo() + public function getCorporateUserPermissionWithHttpInfo( + string $email, + string $contentType = self::contentTypes['getCorporateUserPermission'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetCorporateInvitedUsersList'; - $request = $this->getCorporateInvitedUsersListRequest(); + $request = $this->getCorporateUserPermissionRequest($email, $contentType); try { $options = $this->createHttpClientOption(); @@ -3717,34 +7774,111 @@ public function getCorporateInvitedUsersListWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetCorporateUserPermission', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetCorporateUserPermission' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetCorporateUserPermission', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetCorporateUserPermission'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3759,7 +7893,7 @@ public function getCorporateInvitedUsersListWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetCorporateInvitedUsersList', + '\Brevo\Client\Models\GetCorporateUserPermission', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3767,7 +7901,7 @@ public function getCorporateInvitedUsersListWithHttpInfo() case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3778,17 +7912,22 @@ public function getCorporateInvitedUsersListWithHttpInfo() } /** - * Operation getCorporateInvitedUsersListAsync + * Operation getCorporateUserPermissionAsync * - * Get the list of all admin users + * Check admin user permissions * + * @param string $email Email of the invited user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCorporateUserPermission'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getCorporateInvitedUsersListAsync() + public function getCorporateUserPermissionAsync( + string $email, + string $contentType = self::contentTypes['getCorporateUserPermission'][0] + ): PromiseInterface { - return $this->getCorporateInvitedUsersListAsyncWithHttpInfo() + return $this->getCorporateUserPermissionAsyncWithHttpInfo($email, $contentType) ->then( function ($response) { return $response[0]; @@ -3797,28 +7936,33 @@ function ($response) { } /** - * Operation getCorporateInvitedUsersListAsyncWithHttpInfo + * Operation getCorporateUserPermissionAsyncWithHttpInfo * - * Get the list of all admin users + * Check admin user permissions * + * @param string $email Email of the invited user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCorporateUserPermission'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getCorporateInvitedUsersListAsyncWithHttpInfo() + public function getCorporateUserPermissionAsyncWithHttpInfo( + $email, + string $contentType = self::contentTypes['getCorporateUserPermission'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetCorporateInvitedUsersList'; - $request = $this->getCorporateInvitedUsersListRequest(); + $returnType = '\Brevo\Client\Models\GetCorporateUserPermission'; + $request = $this->getCorporateUserPermissionRequest($email, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3841,23 +7985,36 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); } /** - * Create request for operation 'getCorporateInvitedUsersList' + * Create request for operation 'getCorporateUserPermission' * + * @param string $email Email of the invited user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCorporateUserPermission'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getCorporateInvitedUsersListRequest() + public function getCorporateUserPermissionRequest( + $email, + string $contentType = self::contentTypes['getCorporateUserPermission'][0] + ): Request { - $resourcePath = '/corporate/invited/users'; + // verify the required parameter 'email' is set + if ($email === null || (is_array($email) && count($email) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $email when calling getCorporateUserPermission' + ); + } + + + $resourcePath = '/corporate/user/{email}/permissions'; $formParams = []; $queryParams = []; $headerParams = []; @@ -3866,53 +8023,44 @@ protected function getCorporateInvitedUsersListRequest() - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] + // path params + if ($email !== null) { + $resourcePath = str_replace( + '{' . 'email' . '}', + ObjectSerializer::toPathValue($email), + $resourcePath ); } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3938,10 +8086,11 @@ protected function getCorporateInvitedUsersListRequest() $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3952,14 +8101,17 @@ protected function getCorporateInvitedUsersListRequest() * * Get the list of groups * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubAccountGroups'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\InlineResponse200[] + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetSubAccountGroups200ResponseInner[] */ - public function getSubAccountGroups() + public function getSubAccountGroups( + string $contentType = self::contentTypes['getSubAccountGroups'][0] + ): array { - list($response) = $this->getSubAccountGroupsWithHttpInfo(); + list($response) = $this->getSubAccountGroupsWithHttpInfo($contentType); return $response; } @@ -3968,15 +8120,17 @@ public function getSubAccountGroups() * * Get the list of groups * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubAccountGroups'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\InlineResponse200[], HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetSubAccountGroups200ResponseInner[], HTTP status code, HTTP response headers (array of strings) */ - public function getSubAccountGroupsWithHttpInfo() + public function getSubAccountGroupsWithHttpInfo( + string $contentType = self::contentTypes['getSubAccountGroups'][0] + ): array { - $returnType = '\Brevo\Client\Model\InlineResponse200[]'; - $request = $this->getSubAccountGroupsRequest(); + $request = $this->getSubAccountGroupsRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -3985,34 +8139,84 @@ public function getSubAccountGroupsWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetSubAccountGroups200ResponseInner[]', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetSubAccountGroups200ResponseInner[]' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetSubAccountGroups200ResponseInner[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetSubAccountGroups200ResponseInner[]'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -4027,15 +8231,7 @@ public function getSubAccountGroupsWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\InlineResponse200[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\GetSubAccountGroups200ResponseInner[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4050,13 +8246,16 @@ public function getSubAccountGroupsWithHttpInfo() * * Get the list of groups * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubAccountGroups'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getSubAccountGroupsAsync() + public function getSubAccountGroupsAsync( + string $contentType = self::contentTypes['getSubAccountGroups'][0] + ): PromiseInterface { - return $this->getSubAccountGroupsAsyncWithHttpInfo() + return $this->getSubAccountGroupsAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -4069,24 +8268,27 @@ function ($response) { * * Get the list of groups * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubAccountGroups'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getSubAccountGroupsAsyncWithHttpInfo() + public function getSubAccountGroupsAsyncWithHttpInfo( + string $contentType = self::contentTypes['getSubAccountGroups'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\InlineResponse200[]'; - $request = $this->getSubAccountGroupsRequest(); + $returnType = '\Brevo\Client\Models\GetSubAccountGroups200ResponseInner[]'; + $request = $this->getSubAccountGroupsRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4109,7 +8311,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4118,13 +8320,17 @@ function ($exception) { /** * Create request for operation 'getSubAccountGroups' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubAccountGroups'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getSubAccountGroupsRequest() + public function getSubAccountGroupsRequest( + string $contentType = self::contentTypes['getSubAccountGroups'][0] + ): Request { + $resourcePath = '/corporate/groups'; $formParams = []; $queryParams = []; @@ -4134,53 +8340,36 @@ protected function getSubAccountGroupsRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4206,10 +8395,11 @@ protected function getSubAccountGroupsRequest() $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4220,15 +8410,19 @@ protected function getSubAccountGroupsRequest() * * Send invitation to an admin user * - * @param \Brevo\Client\Model\InviteAdminUser $sendInvitation Payload to send an invitation (required) + * @param \Brevo\Client\Models\InviteAdminUser $inviteAdminUser Payload to send an invitation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['inviteAdminUser'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\InviteAdminUser + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CorporateGroupPost201Response|\Brevo\Client\Models\ErrorModel */ - public function inviteAdminUser($sendInvitation) + public function inviteAdminUser( + \Brevo\Client\Models\InviteAdminUser $inviteAdminUser, + string $contentType = self::contentTypes['inviteAdminUser'][0] + ): \Brevo\Client\Models\CorporateGroupPost201Response { - list($response) = $this->inviteAdminUserWithHttpInfo($sendInvitation); + list($response) = $this->inviteAdminUserWithHttpInfo($inviteAdminUser, $contentType); return $response; } @@ -4237,16 +8431,19 @@ public function inviteAdminUser($sendInvitation) * * Send invitation to an admin user * - * @param \Brevo\Client\Model\InviteAdminUser $sendInvitation Payload to send an invitation (required) + * @param \Brevo\Client\Models\InviteAdminUser $inviteAdminUser Payload to send an invitation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['inviteAdminUser'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\InviteAdminUser, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CorporateGroupPost201Response|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function inviteAdminUserWithHttpInfo($sendInvitation) + public function inviteAdminUserWithHttpInfo( + \Brevo\Client\Models\InviteAdminUser $inviteAdminUser, + string $contentType = self::contentTypes['inviteAdminUser'][0] + ): array { - $returnType = '\Brevo\Client\Model\InviteAdminUser'; - $request = $this->inviteAdminUserRequest($sendInvitation); + $request = $this->inviteAdminUserRequest($inviteAdminUser, $contentType); try { $options = $this->createHttpClientOption(); @@ -4255,34 +8452,111 @@ public function inviteAdminUserWithHttpInfo($sendInvitation) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CorporateGroupPost201Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CorporateGroupPost201Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CorporateGroupPost201Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CorporateGroupPost201Response'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -4294,10 +8568,10 @@ public function inviteAdminUserWithHttpInfo($sendInvitation) } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\InviteAdminUser', + '\Brevo\Client\Models\CorporateGroupPost201Response', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4305,7 +8579,7 @@ public function inviteAdminUserWithHttpInfo($sendInvitation) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4320,14 +8594,18 @@ public function inviteAdminUserWithHttpInfo($sendInvitation) * * Send invitation to an admin user * - * @param \Brevo\Client\Model\InviteAdminUser $sendInvitation Payload to send an invitation (required) + * @param \Brevo\Client\Models\InviteAdminUser $inviteAdminUser Payload to send an invitation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['inviteAdminUser'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function inviteAdminUserAsync($sendInvitation) + public function inviteAdminUserAsync( + \Brevo\Client\Models\InviteAdminUser $inviteAdminUser, + string $contentType = self::contentTypes['inviteAdminUser'][0] + ): PromiseInterface { - return $this->inviteAdminUserAsyncWithHttpInfo($sendInvitation) + return $this->inviteAdminUserAsyncWithHttpInfo($inviteAdminUser, $contentType) ->then( function ($response) { return $response[0]; @@ -4340,25 +8618,29 @@ function ($response) { * * Send invitation to an admin user * - * @param \Brevo\Client\Model\InviteAdminUser $sendInvitation Payload to send an invitation (required) + * @param \Brevo\Client\Models\InviteAdminUser $inviteAdminUser Payload to send an invitation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['inviteAdminUser'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function inviteAdminUserAsyncWithHttpInfo($sendInvitation) + public function inviteAdminUserAsyncWithHttpInfo( + $inviteAdminUser, + string $contentType = self::contentTypes['inviteAdminUser'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\InviteAdminUser'; - $request = $this->inviteAdminUserRequest($sendInvitation); + $returnType = '\Brevo\Client\Models\CorporateGroupPost201Response'; + $request = $this->inviteAdminUserRequest($inviteAdminUser, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4381,7 +8663,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4390,20 +8672,26 @@ function ($exception) { /** * Create request for operation 'inviteAdminUser' * - * @param \Brevo\Client\Model\InviteAdminUser $sendInvitation Payload to send an invitation (required) + * @param \Brevo\Client\Models\InviteAdminUser $inviteAdminUser Payload to send an invitation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['inviteAdminUser'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function inviteAdminUserRequest($sendInvitation) + public function inviteAdminUserRequest( + $inviteAdminUser, + string $contentType = self::contentTypes['inviteAdminUser'][0] + ): Request { - // verify the required parameter 'sendInvitation' is set - if ($sendInvitation === null || (is_array($sendInvitation) && count($sendInvitation) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $sendInvitation when calling inviteAdminUser' + + // verify the required parameter 'inviteAdminUser' is set + if ($inviteAdminUser === null || (is_array($inviteAdminUser) && count($inviteAdminUser) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $inviteAdminUser when calling inviteAdminUser' ); } + $resourcePath = '/corporate/user/invitation/send'; $formParams = []; $queryParams = []; @@ -4413,56 +8701,43 @@ protected function inviteAdminUserRequest($sendInvitation) - // body params - $_tempBody = null; - if (isset($sendInvitation)) { - $_tempBody = $sendInvitation; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($inviteAdminUser)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($inviteAdminUser)); + } else { + $httpBody = $inviteAdminUser; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4488,10 +8763,11 @@ protected function inviteAdminUserRequest($sendInvitation) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4503,7 +8779,7 @@ protected function inviteAdminUserRequest($sendInvitation) * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/NotesApi.php b/lib/Api/NotesApi.php index 16e235d..6960c93 100644 --- a/lib/Api/NotesApi.php +++ b/lib/Api/NotesApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'crmNotesIdDelete' => [ + 'application/json', + ], + 'crmNotesIdGet' => [ + 'application/json', + ], + 'crmNotesIdPatch' => [ + 'application/json', + ], + 'crmNotesPost' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -92,21 +140,31 @@ public function getConfig() * * Get all notes * - * @param string $entity Filter by note entity type (optional) - * @param string $entityIds Filter by note entity IDs (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\NoteList + * @param string|null $entity Filter by note entity type (optional) + * @param string|null $entityIds Filter by note entity IDs (optional) + * @param int|null $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $offset Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesGet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\Note[]|\Brevo\Client\Models\ErrorModel */ - public function crmNotesGet($entity = null, $entityIds = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null) + public function crmNotesGet( + ?string $entity = null, + ?string $entityIds = null, + ?int $dateFrom = null, + ?int $dateTo = null, + ?int $offset = null, + ?int $limit = 50, + ?string $sort = null, + string $contentType = self::contentTypes['crmNotesGet'][0] + ): array { - list($response) = $this->crmNotesGetWithHttpInfo($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort); + list($response) = $this->crmNotesGetWithHttpInfo($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort, $contentType); return $response; } @@ -115,22 +173,31 @@ public function crmNotesGet($entity = null, $entityIds = null, $dateFrom = null, * * Get all notes * - * @param string $entity Filter by note entity type (optional) - * @param string $entityIds Filter by note entity IDs (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\NoteList, HTTP status code, HTTP response headers (array of strings) + * @param string|null $entity Filter by note entity type (optional) + * @param string|null $entityIds Filter by note entity IDs (optional) + * @param int|null $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $offset Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesGet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\Note[]|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function crmNotesGetWithHttpInfo($entity = null, $entityIds = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null) + public function crmNotesGetWithHttpInfo( + ?string $entity = null, + ?string $entityIds = null, + ?int $dateFrom = null, + ?int $dateTo = null, + ?int $offset = null, + ?int $limit = 50, + ?string $sort = null, + string $contentType = self::contentTypes['crmNotesGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\NoteList'; - $request = $this->crmNotesGetRequest($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort); + $request = $this->crmNotesGetRequest($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort, $contentType); try { $options = $this->createHttpClientOption(); @@ -139,34 +206,111 @@ public function crmNotesGetWithHttpInfo($entity = null, $entityIds = null, $date } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\Note[]', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\Note[]' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\Note[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\Note[]'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -181,7 +325,7 @@ public function crmNotesGetWithHttpInfo($entity = null, $entityIds = null, $date case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\NoteList', + '\Brevo\Client\Models\Note[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -189,7 +333,7 @@ public function crmNotesGetWithHttpInfo($entity = null, $entityIds = null, $date case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -204,20 +348,30 @@ public function crmNotesGetWithHttpInfo($entity = null, $entityIds = null, $date * * Get all notes * - * @param string $entity Filter by note entity type (optional) - * @param string $entityIds Filter by note entity IDs (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @param string|null $entity Filter by note entity type (optional) + * @param string|null $entityIds Filter by note entity IDs (optional) + * @param int|null $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $offset Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesGet'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmNotesGetAsync($entity = null, $entityIds = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null) + public function crmNotesGetAsync( + ?string $entity = null, + ?string $entityIds = null, + ?int $dateFrom = null, + ?int $dateTo = null, + ?int $offset = null, + ?int $limit = 50, + ?string $sort = null, + string $contentType = self::contentTypes['crmNotesGet'][0] + ): PromiseInterface { - return $this->crmNotesGetAsyncWithHttpInfo($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort) + return $this->crmNotesGetAsyncWithHttpInfo($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort, $contentType) ->then( function ($response) { return $response[0]; @@ -230,31 +384,41 @@ function ($response) { * * Get all notes * - * @param string $entity Filter by note entity type (optional) - * @param string $entityIds Filter by note entity IDs (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @param string|null $entity Filter by note entity type (optional) + * @param string|null $entityIds Filter by note entity IDs (optional) + * @param int|null $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $offset Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesGet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmNotesGetAsyncWithHttpInfo($entity = null, $entityIds = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null) + public function crmNotesGetAsyncWithHttpInfo( + $entity = null, + $entityIds = null, + $dateFrom = null, + $dateTo = null, + $offset = null, + $limit = 50, + $sort = null, + string $contentType = self::contentTypes['crmNotesGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\NoteList'; - $request = $this->crmNotesGetRequest($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort); + $returnType = '\Brevo\Client\Models\Note[]'; + $request = $this->crmNotesGetRequest($entity, $entityIds, $dateFrom, $dateTo, $offset, $limit, $sort, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -277,7 +441,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -286,20 +450,38 @@ function ($exception) { /** * Create request for operation 'crmNotesGet' * - * @param string $entity Filter by note entity type (optional) - * @param string $entityIds Filter by note entity IDs (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string|null $entity Filter by note entity type (optional) + * @param string|null $entityIds Filter by note entity IDs (optional) + * @param int|null $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $offset Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmNotesGetRequest($entity = null, $entityIds = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null) + public function crmNotesGetRequest( + $entity = null, + $entityIds = null, + $dateFrom = null, + $dateTo = null, + $offset = null, + $limit = 50, + $sort = null, + string $contentType = self::contentTypes['crmNotesGet'][0] + ): Request { + + + + + + + + $resourcePath = '/crm/notes'; $formParams = []; $queryParams = []; @@ -308,82 +490,100 @@ protected function crmNotesGetRequest($entity = null, $entityIds = null, $dateFr $multipart = false; // query params - if ($entity !== null) { - $queryParams['entity'] = ObjectSerializer::toQueryValue($entity); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $entity, + 'entity', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($entityIds !== null) { - $queryParams['entityIds'] = ObjectSerializer::toQueryValue($entityIds); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $entityIds, + 'entityIds', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($dateFrom !== null) { - $queryParams['dateFrom'] = ObjectSerializer::toQueryValue($dateFrom); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $dateFrom, + 'dateFrom', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($dateTo !== null) { - $queryParams['dateTo'] = ObjectSerializer::toQueryValue($dateTo); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $dateTo, + 'dateTo', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -409,10 +609,11 @@ protected function crmNotesGetRequest($entity = null, $entityIds = null, $dateFr $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -424,14 +625,18 @@ protected function crmNotesGetRequest($entity = null, $entityIds = null, $dateFr * Delete a note * * @param string $id Note ID to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesIdDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function crmNotesIdDelete($id) + public function crmNotesIdDelete( + string $id, + string $contentType = self::contentTypes['crmNotesIdDelete'][0] + ): void { - $this->crmNotesIdDeleteWithHttpInfo($id); + $this->crmNotesIdDeleteWithHttpInfo($id, $contentType); } /** @@ -440,15 +645,18 @@ public function crmNotesIdDelete($id) * Delete a note * * @param string $id Note ID to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesIdDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function crmNotesIdDeleteWithHttpInfo($id) + public function crmNotesIdDeleteWithHttpInfo( + string $id, + string $contentType = self::contentTypes['crmNotesIdDelete'][0] + ): array { - $returnType = ''; - $request = $this->crmNotesIdDeleteRequest($id); + $request = $this->crmNotesIdDeleteRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -457,26 +665,21 @@ public function crmNotesIdDeleteWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -485,7 +688,7 @@ public function crmNotesIdDeleteWithHttpInfo($id) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -493,7 +696,7 @@ public function crmNotesIdDeleteWithHttpInfo($id) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -509,13 +712,17 @@ public function crmNotesIdDeleteWithHttpInfo($id) * Delete a note * * @param string $id Note ID to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmNotesIdDeleteAsync($id) + public function crmNotesIdDeleteAsync( + string $id, + string $contentType = self::contentTypes['crmNotesIdDelete'][0] + ): PromiseInterface { - return $this->crmNotesIdDeleteAsyncWithHttpInfo($id) + return $this->crmNotesIdDeleteAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -529,14 +736,19 @@ function ($response) { * Delete a note * * @param string $id Note ID to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmNotesIdDeleteAsyncWithHttpInfo($id) + public function crmNotesIdDeleteAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['crmNotesIdDelete'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->crmNotesIdDeleteRequest($id); + $request = $this->crmNotesIdDeleteRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -555,7 +767,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -565,19 +777,25 @@ function ($exception) { * Create request for operation 'crmNotesIdDelete' * * @param string $id Note ID to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmNotesIdDeleteRequest($id) + public function crmNotesIdDeleteRequest( + $id, + string $contentType = self::contentTypes['crmNotesIdDelete'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling crmNotesIdDelete' ); } + $resourcePath = '/crm/notes/{id}'; $formParams = []; $queryParams = []; @@ -586,6 +804,7 @@ protected function crmNotesIdDeleteRequest($id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -595,53 +814,35 @@ protected function crmNotesIdDeleteRequest($id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -667,10 +868,11 @@ protected function crmNotesIdDeleteRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -682,14 +884,18 @@ protected function crmNotesIdDeleteRequest($id) * Get a note * * @param string $id Note ID to get (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesIdGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\Note + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\Note|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function crmNotesIdGet($id) + public function crmNotesIdGet( + string $id, + string $contentType = self::contentTypes['crmNotesIdGet'][0] + ): \Brevo\Client\Models\Note { - list($response) = $this->crmNotesIdGetWithHttpInfo($id); + list($response) = $this->crmNotesIdGetWithHttpInfo($id, $contentType); return $response; } @@ -699,15 +905,18 @@ public function crmNotesIdGet($id) * Get a note * * @param string $id Note ID to get (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesIdGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\Note, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\Note|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function crmNotesIdGetWithHttpInfo($id) + public function crmNotesIdGetWithHttpInfo( + string $id, + string $contentType = self::contentTypes['crmNotesIdGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\Note'; - $request = $this->crmNotesIdGetRequest($id); + $request = $this->crmNotesIdGetRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -716,34 +925,138 @@ public function crmNotesIdGetWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\Note', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\Note' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\Note', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\Note'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -758,7 +1071,7 @@ public function crmNotesIdGetWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\Note', + '\Brevo\Client\Models\Note', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -766,7 +1079,7 @@ public function crmNotesIdGetWithHttpInfo($id) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -774,7 +1087,7 @@ public function crmNotesIdGetWithHttpInfo($id) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -790,13 +1103,17 @@ public function crmNotesIdGetWithHttpInfo($id) * Get a note * * @param string $id Note ID to get (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmNotesIdGetAsync($id) + public function crmNotesIdGetAsync( + string $id, + string $contentType = self::contentTypes['crmNotesIdGet'][0] + ): PromiseInterface { - return $this->crmNotesIdGetAsyncWithHttpInfo($id) + return $this->crmNotesIdGetAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -810,24 +1127,28 @@ function ($response) { * Get a note * * @param string $id Note ID to get (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmNotesIdGetAsyncWithHttpInfo($id) + public function crmNotesIdGetAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['crmNotesIdGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\Note'; - $request = $this->crmNotesIdGetRequest($id); + $returnType = '\Brevo\Client\Models\Note'; + $request = $this->crmNotesIdGetRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -850,7 +1171,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -860,19 +1181,25 @@ function ($exception) { * Create request for operation 'crmNotesIdGet' * * @param string $id Note ID to get (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmNotesIdGetRequest($id) + public function crmNotesIdGetRequest( + $id, + string $contentType = self::contentTypes['crmNotesIdGet'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling crmNotesIdGet' ); } + $resourcePath = '/crm/notes/{id}'; $formParams = []; $queryParams = []; @@ -881,6 +1208,7 @@ protected function crmNotesIdGetRequest($id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -890,53 +1218,35 @@ protected function crmNotesIdGetRequest($id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -962,10 +1272,11 @@ protected function crmNotesIdGetRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -977,15 +1288,20 @@ protected function crmNotesIdGetRequest($id) * Update a note * * @param string $id Note ID to update (required) - * @param \Brevo\Client\Model\NoteData $body Note data to update a note (required) + * @param \Brevo\Client\Models\NoteData $noteData Note data to update a note. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesIdPatch'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function crmNotesIdPatch($id, $body) + public function crmNotesIdPatch( + string $id, + \Brevo\Client\Models\NoteData $noteData, + string $contentType = self::contentTypes['crmNotesIdPatch'][0] + ): void { - $this->crmNotesIdPatchWithHttpInfo($id, $body); + $this->crmNotesIdPatchWithHttpInfo($id, $noteData, $contentType); } /** @@ -994,16 +1310,20 @@ public function crmNotesIdPatch($id, $body) * Update a note * * @param string $id Note ID to update (required) - * @param \Brevo\Client\Model\NoteData $body Note data to update a note (required) + * @param \Brevo\Client\Models\NoteData $noteData Note data to update a note. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesIdPatch'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function crmNotesIdPatchWithHttpInfo($id, $body) + public function crmNotesIdPatchWithHttpInfo( + string $id, + \Brevo\Client\Models\NoteData $noteData, + string $contentType = self::contentTypes['crmNotesIdPatch'][0] + ): array { - $returnType = ''; - $request = $this->crmNotesIdPatchRequest($id, $body); + $request = $this->crmNotesIdPatchRequest($id, $noteData, $contentType); try { $options = $this->createHttpClientOption(); @@ -1012,26 +1332,21 @@ public function crmNotesIdPatchWithHttpInfo($id, $body) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -1040,7 +1355,7 @@ public function crmNotesIdPatchWithHttpInfo($id, $body) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1048,7 +1363,7 @@ public function crmNotesIdPatchWithHttpInfo($id, $body) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1056,7 +1371,7 @@ public function crmNotesIdPatchWithHttpInfo($id, $body) case 415: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1072,14 +1387,19 @@ public function crmNotesIdPatchWithHttpInfo($id, $body) * Update a note * * @param string $id Note ID to update (required) - * @param \Brevo\Client\Model\NoteData $body Note data to update a note (required) + * @param \Brevo\Client\Models\NoteData $noteData Note data to update a note. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesIdPatch'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmNotesIdPatchAsync($id, $body) + public function crmNotesIdPatchAsync( + string $id, + \Brevo\Client\Models\NoteData $noteData, + string $contentType = self::contentTypes['crmNotesIdPatch'][0] + ): PromiseInterface { - return $this->crmNotesIdPatchAsyncWithHttpInfo($id, $body) + return $this->crmNotesIdPatchAsyncWithHttpInfo($id, $noteData, $contentType) ->then( function ($response) { return $response[0]; @@ -1093,15 +1413,21 @@ function ($response) { * Update a note * * @param string $id Note ID to update (required) - * @param \Brevo\Client\Model\NoteData $body Note data to update a note (required) + * @param \Brevo\Client\Models\NoteData $noteData Note data to update a note. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesIdPatch'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmNotesIdPatchAsyncWithHttpInfo($id, $body) + public function crmNotesIdPatchAsyncWithHttpInfo( + $id, + $noteData, + string $contentType = self::contentTypes['crmNotesIdPatch'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->crmNotesIdPatchRequest($id, $body); + $request = $this->crmNotesIdPatchRequest($id, $noteData, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1120,7 +1446,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1130,26 +1456,34 @@ function ($exception) { * Create request for operation 'crmNotesIdPatch' * * @param string $id Note ID to update (required) - * @param \Brevo\Client\Model\NoteData $body Note data to update a note (required) + * @param \Brevo\Client\Models\NoteData $noteData Note data to update a note. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesIdPatch'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmNotesIdPatchRequest($id, $body) + public function crmNotesIdPatchRequest( + $id, + $noteData, + string $contentType = self::contentTypes['crmNotesIdPatch'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling crmNotesIdPatch' ); } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling crmNotesIdPatch' + + // verify the required parameter 'noteData' is set + if ($noteData === null || (is_array($noteData) && count($noteData) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $noteData when calling crmNotesIdPatch' ); } + $resourcePath = '/crm/notes/{id}'; $formParams = []; $queryParams = []; @@ -1158,6 +1492,7 @@ protected function crmNotesIdPatchRequest($id, $body) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1167,56 +1502,42 @@ protected function crmNotesIdPatchRequest($id, $body) ); } - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($noteData)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($noteData)); + } else { + $httpBody = $noteData; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1242,10 +1563,11 @@ protected function crmNotesIdPatchRequest($id, $body) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PATCH', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1256,15 +1578,19 @@ protected function crmNotesIdPatchRequest($id, $body) * * Create a note * - * @param \Brevo\Client\Model\NoteData $body Note data to create a note. (required) + * @param \Brevo\Client\Models\NoteData $noteData Note data to create a note. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesPost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\NoteId + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\NoteId|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function crmNotesPost($body) + public function crmNotesPost( + \Brevo\Client\Models\NoteData $noteData, + string $contentType = self::contentTypes['crmNotesPost'][0] + ): \Brevo\Client\Models\NoteId { - list($response) = $this->crmNotesPostWithHttpInfo($body); + list($response) = $this->crmNotesPostWithHttpInfo($noteData, $contentType); return $response; } @@ -1273,16 +1599,19 @@ public function crmNotesPost($body) * * Create a note * - * @param \Brevo\Client\Model\NoteData $body Note data to create a note. (required) + * @param \Brevo\Client\Models\NoteData $noteData Note data to create a note. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesPost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\NoteId, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\NoteId|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function crmNotesPostWithHttpInfo($body) + public function crmNotesPostWithHttpInfo( + \Brevo\Client\Models\NoteData $noteData, + string $contentType = self::contentTypes['crmNotesPost'][0] + ): array { - $returnType = '\Brevo\Client\Model\NoteId'; - $request = $this->crmNotesPostRequest($body); + $request = $this->crmNotesPostRequest($noteData, $contentType); try { $options = $this->createHttpClientOption(); @@ -1291,34 +1620,138 @@ public function crmNotesPostWithHttpInfo($body) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\NoteId', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\NoteId' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\NoteId', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 415: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\NoteId'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1333,7 +1766,7 @@ public function crmNotesPostWithHttpInfo($body) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\NoteId', + '\Brevo\Client\Models\NoteId', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1341,7 +1774,7 @@ public function crmNotesPostWithHttpInfo($body) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1349,7 +1782,7 @@ public function crmNotesPostWithHttpInfo($body) case 415: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1364,14 +1797,18 @@ public function crmNotesPostWithHttpInfo($body) * * Create a note * - * @param \Brevo\Client\Model\NoteData $body Note data to create a note. (required) + * @param \Brevo\Client\Models\NoteData $noteData Note data to create a note. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmNotesPostAsync($body) + public function crmNotesPostAsync( + \Brevo\Client\Models\NoteData $noteData, + string $contentType = self::contentTypes['crmNotesPost'][0] + ): PromiseInterface { - return $this->crmNotesPostAsyncWithHttpInfo($body) + return $this->crmNotesPostAsyncWithHttpInfo($noteData, $contentType) ->then( function ($response) { return $response[0]; @@ -1384,25 +1821,29 @@ function ($response) { * * Create a note * - * @param \Brevo\Client\Model\NoteData $body Note data to create a note. (required) + * @param \Brevo\Client\Models\NoteData $noteData Note data to create a note. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmNotesPostAsyncWithHttpInfo($body) + public function crmNotesPostAsyncWithHttpInfo( + $noteData, + string $contentType = self::contentTypes['crmNotesPost'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\NoteId'; - $request = $this->crmNotesPostRequest($body); + $returnType = '\Brevo\Client\Models\NoteId'; + $request = $this->crmNotesPostRequest($noteData, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1425,7 +1866,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1434,20 +1875,26 @@ function ($exception) { /** * Create request for operation 'crmNotesPost' * - * @param \Brevo\Client\Model\NoteData $body Note data to create a note. (required) + * @param \Brevo\Client\Models\NoteData $noteData Note data to create a note. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmNotesPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmNotesPostRequest($body) + public function crmNotesPostRequest( + $noteData, + string $contentType = self::contentTypes['crmNotesPost'][0] + ): Request { - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling crmNotesPost' + + // verify the required parameter 'noteData' is set + if ($noteData === null || (is_array($noteData) && count($noteData) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $noteData when calling crmNotesPost' ); } + $resourcePath = '/crm/notes'; $formParams = []; $queryParams = []; @@ -1457,56 +1904,43 @@ protected function crmNotesPostRequest($body) - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($noteData)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($noteData)); + } else { + $httpBody = $noteData; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1532,10 +1966,11 @@ protected function crmNotesPostRequest($body) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1547,7 +1982,7 @@ protected function crmNotesPostRequest($body) * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/PaymentsApi.php b/lib/Api/PaymentsApi.php new file mode 100644 index 0000000..ac79434 --- /dev/null +++ b/lib/Api/PaymentsApi.php @@ -0,0 +1,1329 @@ + [ + 'application/json', + ], + 'deletePaymentRequest' => [ + 'application/json', + ], + 'getPaymentRequest' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation createPaymentRequest + * + * Create a payment request + * + * @param \Brevo\Client\Models\CreatePaymentRequest $createPaymentRequest Create a payment request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPaymentRequest'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreatePaymentResponse|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel + */ + public function createPaymentRequest( + \Brevo\Client\Models\CreatePaymentRequest $createPaymentRequest, + string $contentType = self::contentTypes['createPaymentRequest'][0] + ): \Brevo\Client\Models\CreatePaymentResponse + { + list($response) = $this->createPaymentRequestWithHttpInfo($createPaymentRequest, $contentType); + return $response; + } + + /** + * Operation createPaymentRequestWithHttpInfo + * + * Create a payment request + * + * @param \Brevo\Client\Models\CreatePaymentRequest $createPaymentRequest Create a payment request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPaymentRequest'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreatePaymentResponse|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) + */ + public function createPaymentRequestWithHttpInfo( + \Brevo\Client\Models\CreatePaymentRequest $createPaymentRequest, + string $contentType = self::contentTypes['createPaymentRequest'][0] + ): array + { + $request = $this->createPaymentRequestRequest($createPaymentRequest, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreatePaymentResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreatePaymentResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreatePaymentResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\CreatePaymentResponse'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\CreatePaymentResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createPaymentRequestAsync + * + * Create a payment request + * + * @param \Brevo\Client\Models\CreatePaymentRequest $createPaymentRequest Create a payment request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPaymentRequest'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createPaymentRequestAsync( + \Brevo\Client\Models\CreatePaymentRequest $createPaymentRequest, + string $contentType = self::contentTypes['createPaymentRequest'][0] + ): PromiseInterface + { + return $this->createPaymentRequestAsyncWithHttpInfo($createPaymentRequest, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createPaymentRequestAsyncWithHttpInfo + * + * Create a payment request + * + * @param \Brevo\Client\Models\CreatePaymentRequest $createPaymentRequest Create a payment request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPaymentRequest'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createPaymentRequestAsyncWithHttpInfo( + $createPaymentRequest, + string $contentType = self::contentTypes['createPaymentRequest'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\CreatePaymentResponse'; + $request = $this->createPaymentRequestRequest($createPaymentRequest, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createPaymentRequest' + * + * @param \Brevo\Client\Models\CreatePaymentRequest $createPaymentRequest Create a payment request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPaymentRequest'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createPaymentRequestRequest( + $createPaymentRequest, + string $contentType = self::contentTypes['createPaymentRequest'][0] + ): Request + { + + // verify the required parameter 'createPaymentRequest' is set + if ($createPaymentRequest === null || (is_array($createPaymentRequest) && count($createPaymentRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $createPaymentRequest when calling createPaymentRequest' + ); + } + + + $resourcePath = '/payments/requests'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($createPaymentRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createPaymentRequest)); + } else { + $httpBody = $createPaymentRequest; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deletePaymentRequest + * + * Delete a payment request. + * + * @param string $id ID of the payment request. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePaymentRequest'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return void + */ + public function deletePaymentRequest( + string $id, + string $contentType = self::contentTypes['deletePaymentRequest'][0] + ): void + { + $this->deletePaymentRequestWithHttpInfo($id, $contentType); + } + + /** + * Operation deletePaymentRequestWithHttpInfo + * + * Delete a payment request. + * + * @param string $id ID of the payment request. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePaymentRequest'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deletePaymentRequestWithHttpInfo( + string $id, + string $contentType = self::contentTypes['deletePaymentRequest'][0] + ): array + { + $request = $this->deletePaymentRequestRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deletePaymentRequestAsync + * + * Delete a payment request. + * + * @param string $id ID of the payment request. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePaymentRequest'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deletePaymentRequestAsync( + string $id, + string $contentType = self::contentTypes['deletePaymentRequest'][0] + ): PromiseInterface + { + return $this->deletePaymentRequestAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deletePaymentRequestAsyncWithHttpInfo + * + * Delete a payment request. + * + * @param string $id ID of the payment request. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePaymentRequest'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deletePaymentRequestAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['deletePaymentRequest'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deletePaymentRequestRequest($id, $contentType); + + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deletePaymentRequest' + * + * @param string $id ID of the payment request. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePaymentRequest'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deletePaymentRequestRequest( + $id, + string $contentType = self::contentTypes['deletePaymentRequest'][0] + ): Request + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $id when calling deletePaymentRequest' + ); + } + + + $resourcePath = '/payments/requests/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getPaymentRequest + * + * Get payment request details + * + * @param string $id Id of the payment Request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentRequest'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetPaymentRequest|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel + */ + public function getPaymentRequest( + string $id, + string $contentType = self::contentTypes['getPaymentRequest'][0] + ): \Brevo\Client\Models\GetPaymentRequest + { + list($response) = $this->getPaymentRequestWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getPaymentRequestWithHttpInfo + * + * Get payment request details + * + * @param string $id Id of the payment Request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentRequest'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetPaymentRequest|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) + */ + public function getPaymentRequestWithHttpInfo( + string $id, + string $contentType = self::contentTypes['getPaymentRequest'][0] + ): array + { + $request = $this->getPaymentRequestRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetPaymentRequest', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetPaymentRequest' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetPaymentRequest', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\GetPaymentRequest'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\GetPaymentRequest', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPaymentRequestAsync + * + * Get payment request details + * + * @param string $id Id of the payment Request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentRequest'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getPaymentRequestAsync( + string $id, + string $contentType = self::contentTypes['getPaymentRequest'][0] + ): PromiseInterface + { + return $this->getPaymentRequestAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPaymentRequestAsyncWithHttpInfo + * + * Get payment request details + * + * @param string $id Id of the payment Request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentRequest'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getPaymentRequestAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['getPaymentRequest'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\GetPaymentRequest'; + $request = $this->getPaymentRequestRequest($id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getPaymentRequest' + * + * @param string $id Id of the payment Request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentRequest'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPaymentRequestRequest( + $id, + string $contentType = self::contentTypes['getPaymentRequest'][0] + ): Request + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $id when calling getPaymentRequest' + ); + } + + + $resourcePath = '/payments/requests/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $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 7e38628..6be2a2b 100644 --- a/lib/Api/ProcessApi.php +++ b/lib/Api/ProcessApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'getProcesses' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -93,14 +132,18 @@ public function getConfig() * Return the informations for a process * * @param int $processId Id of the process (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProcess'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetProcess + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetProcess|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function getProcess($processId) + public function getProcess( + int $processId, + string $contentType = self::contentTypes['getProcess'][0] + ): \Brevo\Client\Models\GetProcess { - list($response) = $this->getProcessWithHttpInfo($processId); + list($response) = $this->getProcessWithHttpInfo($processId, $contentType); return $response; } @@ -110,15 +153,18 @@ public function getProcess($processId) * Return the informations for a process * * @param int $processId Id of the process (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProcess'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetProcess, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetProcess|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getProcessWithHttpInfo($processId) + public function getProcessWithHttpInfo( + int $processId, + string $contentType = self::contentTypes['getProcess'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetProcess'; - $request = $this->getProcessRequest($processId); + $request = $this->getProcessRequest($processId, $contentType); try { $options = $this->createHttpClientOption(); @@ -127,34 +173,138 @@ public function getProcessWithHttpInfo($processId) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetProcess', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetProcess' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetProcess', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetProcess'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -169,23 +319,23 @@ public function getProcessWithHttpInfo($processId) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetProcess', + '\Brevo\Client\Models\GetProcess', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -201,13 +351,17 @@ public function getProcessWithHttpInfo($processId) * Return the informations for a process * * @param int $processId Id of the process (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProcess'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getProcessAsync($processId) + public function getProcessAsync( + int $processId, + string $contentType = self::contentTypes['getProcess'][0] + ): PromiseInterface { - return $this->getProcessAsyncWithHttpInfo($processId) + return $this->getProcessAsyncWithHttpInfo($processId, $contentType) ->then( function ($response) { return $response[0]; @@ -221,24 +375,28 @@ function ($response) { * Return the informations for a process * * @param int $processId Id of the process (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProcess'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getProcessAsyncWithHttpInfo($processId) + public function getProcessAsyncWithHttpInfo( + $processId, + string $contentType = self::contentTypes['getProcess'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetProcess'; - $request = $this->getProcessRequest($processId); + $returnType = '\Brevo\Client\Models\GetProcess'; + $request = $this->getProcessRequest($processId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -261,7 +419,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -271,19 +429,25 @@ function ($exception) { * Create request for operation 'getProcess' * * @param int $processId Id of the process (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProcess'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getProcessRequest($processId) + public function getProcessRequest( + $processId, + string $contentType = self::contentTypes['getProcess'][0] + ): Request { + // verify the required parameter 'processId' is set if ($processId === null || (is_array($processId) && count($processId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $processId when calling getProcess' ); } + $resourcePath = '/processes/{processId}'; $formParams = []; $queryParams = []; @@ -292,6 +456,7 @@ protected function getProcessRequest($processId) $multipart = false; + // path params if ($processId !== null) { $resourcePath = str_replace( @@ -301,53 +466,35 @@ protected function getProcessRequest($processId) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -373,10 +520,11 @@ protected function getProcessRequest($processId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -387,17 +535,23 @@ protected function getProcessRequest($processId) * * 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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number limitation for the result returned (optional, default to 10) + * @param int|null $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProcesses'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetProcesses + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetProcesses|\Brevo\Client\Models\ErrorModel */ - public function getProcesses($limit = '10', $offset = '0', $sort = 'desc') + public function getProcesses( + ?int $limit = 10, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getProcesses'][0] + ): \Brevo\Client\Models\GetProcesses { - list($response) = $this->getProcessesWithHttpInfo($limit, $offset, $sort); + list($response) = $this->getProcessesWithHttpInfo($limit, $offset, $sort, $contentType); return $response; } @@ -406,18 +560,23 @@ public function getProcesses($limit = '10', $offset = '0', $sort = 'desc') * * 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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number limitation for the result returned (optional, default to 10) + * @param int|null $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProcesses'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetProcesses, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetProcesses|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getProcessesWithHttpInfo($limit = '10', $offset = '0', $sort = 'desc') + public function getProcessesWithHttpInfo( + ?int $limit = 10, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getProcesses'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetProcesses'; - $request = $this->getProcessesRequest($limit, $offset, $sort); + $request = $this->getProcessesRequest($limit, $offset, $sort, $contentType); try { $options = $this->createHttpClientOption(); @@ -426,34 +585,111 @@ public function getProcessesWithHttpInfo($limit = '10', $offset = '0', $sort = ' } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetProcesses', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetProcesses' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetProcesses', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetProcesses'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -468,7 +704,7 @@ public function getProcessesWithHttpInfo($limit = '10', $offset = '0', $sort = ' case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetProcesses', + '\Brevo\Client\Models\GetProcesses', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -476,7 +712,7 @@ public function getProcessesWithHttpInfo($limit = '10', $offset = '0', $sort = ' case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -491,16 +727,22 @@ public function getProcessesWithHttpInfo($limit = '10', $offset = '0', $sort = ' * * 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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number limitation for the result returned (optional, default to 10) + * @param int|null $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProcesses'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getProcessesAsync($limit = '10', $offset = '0', $sort = 'desc') + public function getProcessesAsync( + ?int $limit = 10, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getProcesses'][0] + ): PromiseInterface { - return $this->getProcessesAsyncWithHttpInfo($limit, $offset, $sort) + return $this->getProcessesAsyncWithHttpInfo($limit, $offset, $sort, $contentType) ->then( function ($response) { return $response[0]; @@ -513,27 +755,33 @@ function ($response) { * * 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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number limitation for the result returned (optional, default to 10) + * @param int|null $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProcesses'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getProcessesAsyncWithHttpInfo($limit = '10', $offset = '0', $sort = 'desc') + public function getProcessesAsyncWithHttpInfo( + $limit = 10, + $offset = 0, + $sort = 'desc', + string $contentType = self::contentTypes['getProcesses'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetProcesses'; - $request = $this->getProcessesRequest($limit, $offset, $sort); + $returnType = '\Brevo\Client\Models\GetProcesses'; + $request = $this->getProcessesRequest($limit, $offset, $sort, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -556,7 +804,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -565,21 +813,30 @@ function ($exception) { /** * 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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number limitation for the result returned (optional, default to 10) + * @param int|null $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProcesses'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getProcessesRequest($limit = '10', $offset = '0', $sort = 'desc') + public function getProcessesRequest( + $limit = 10, + $offset = 0, + $sort = 'desc', + string $contentType = self::contentTypes['getProcesses'][0] + ): Request { + if ($limit !== null && $limit > 50) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling ProcessApi.getProcesses, must be smaller than or equal to 50.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling ProcessApi.getProcesses, must be smaller than or equal to 50.'); } if ($limit !== null && $limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling ProcessApi.getProcesses, must be bigger than or equal to 0.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling ProcessApi.getProcesses, must be bigger than or equal to 0.'); } + + $resourcePath = '/processes'; @@ -590,66 +847,64 @@ protected function getProcessesRequest($limit = '10', $offset = '0', $sort = 'de $multipart = false; // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -675,10 +930,11 @@ protected function getProcessesRequest($limit = '10', $offset = '0', $sort = 'de $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -690,7 +946,7 @@ protected function getProcessesRequest($limit = '10', $offset = '0', $sort = 'de * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/ProgramApi.php b/lib/Api/ProgramApi.php new file mode 100644 index 0000000..d6c1884 --- /dev/null +++ b/lib/Api/ProgramApi.php @@ -0,0 +1,5684 @@ + [ + 'application/json', + ], + 'deleteContactMembers' => [ + 'application/json', + ], + 'deleteLoyaltyProgram' => [ + 'application/json', + ], + 'deleteSubscriptionMember' => [ + 'application/json', + ], + 'getLPList' => [ + 'application/json', + ], + 'getLoyaltyProgramInfo' => [ + 'application/json', + ], + 'getParameterSubscriptionInfo' => [ + 'application/json', + ], + 'getSubscriptionMember' => [ + 'application/json', + ], + 'partiallyUpdateLoyaltyProgram' => [ + 'application/json', + ], + 'publishLoyaltyProgram' => [ + 'application/json', + ], + 'subscribeMemberToASubscription' => [ + 'application/json', + ], + 'subscribeToLoyaltyProgram' => [ + 'application/json', + ], + 'updateLoyaltyProgram' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation createNewLP + * + * Create loyalty program + * + * @param \Brevo\Client\Models\CreateLoyaltyProgramPayload|null $createLoyaltyProgramPayload Loyalty Program information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewLP'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\LoyaltyProgram|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload + */ + public function createNewLP( + ?\Brevo\Client\Models\CreateLoyaltyProgramPayload $createLoyaltyProgramPayload = null, + string $contentType = self::contentTypes['createNewLP'][0] + ): \Brevo\Client\Models\LoyaltyProgram + { + list($response) = $this->createNewLPWithHttpInfo($createLoyaltyProgramPayload, $contentType); + return $response; + } + + /** + * Operation createNewLPWithHttpInfo + * + * Create loyalty program + * + * @param \Brevo\Client\Models\CreateLoyaltyProgramPayload|null $createLoyaltyProgramPayload Loyalty Program information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewLP'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\LoyaltyProgram|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload, HTTP status code, HTTP response headers (array of strings) + */ + public function createNewLPWithHttpInfo( + ?\Brevo\Client\Models\CreateLoyaltyProgramPayload $createLoyaltyProgramPayload = null, + string $contentType = self::contentTypes['createNewLP'][0] + ): array + { + $request = $this->createNewLPRequest($createLoyaltyProgramPayload, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\LoyaltyProgram', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\LoyaltyProgram' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\LoyaltyProgram', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 409: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\LoyaltyProgram'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\LoyaltyProgram', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createNewLPAsync + * + * Create loyalty program + * + * @param \Brevo\Client\Models\CreateLoyaltyProgramPayload|null $createLoyaltyProgramPayload Loyalty Program information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewLP'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createNewLPAsync( + ?\Brevo\Client\Models\CreateLoyaltyProgramPayload $createLoyaltyProgramPayload = null, + string $contentType = self::contentTypes['createNewLP'][0] + ): PromiseInterface + { + return $this->createNewLPAsyncWithHttpInfo($createLoyaltyProgramPayload, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createNewLPAsyncWithHttpInfo + * + * Create loyalty program + * + * @param \Brevo\Client\Models\CreateLoyaltyProgramPayload|null $createLoyaltyProgramPayload Loyalty Program information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewLP'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createNewLPAsyncWithHttpInfo( + $createLoyaltyProgramPayload = null, + string $contentType = self::contentTypes['createNewLP'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\LoyaltyProgram'; + $request = $this->createNewLPRequest($createLoyaltyProgramPayload, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createNewLP' + * + * @param \Brevo\Client\Models\CreateLoyaltyProgramPayload|null $createLoyaltyProgramPayload Loyalty Program information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewLP'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createNewLPRequest( + $createLoyaltyProgramPayload = null, + string $contentType = self::contentTypes['createNewLP'][0] + ): Request + { + + + + $resourcePath = '/loyalty/config/programs'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($createLoyaltyProgramPayload)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createLoyaltyProgramPayload)); + } else { + $httpBody = $createLoyaltyProgramPayload; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteContactMembers + * + * Delete subscription member + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param int $contactId Contact Id (required) + * @param int $memberContactIds Member Contact Ids, comma-seperated (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContactMembers'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return void + */ + public function deleteContactMembers( + string $loyaltyProgramId, + int $contactId, + int $memberContactIds, + string $contentType = self::contentTypes['deleteContactMembers'][0] + ): void + { + $this->deleteContactMembersWithHttpInfo($loyaltyProgramId, $contactId, $memberContactIds, $contentType); + } + + /** + * Operation deleteContactMembersWithHttpInfo + * + * Delete subscription member + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param int $contactId Contact Id (required) + * @param int $memberContactIds Member Contact Ids, comma-seperated (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContactMembers'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteContactMembersWithHttpInfo( + string $loyaltyProgramId, + int $contactId, + int $memberContactIds, + string $contentType = self::contentTypes['deleteContactMembers'][0] + ): array + { + $request = $this->deleteContactMembersRequest($loyaltyProgramId, $contactId, $memberContactIds, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteContactMembersAsync + * + * Delete subscription member + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param int $contactId Contact Id (required) + * @param int $memberContactIds Member Contact Ids, comma-seperated (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContactMembers'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteContactMembersAsync( + string $loyaltyProgramId, + int $contactId, + int $memberContactIds, + string $contentType = self::contentTypes['deleteContactMembers'][0] + ): PromiseInterface + { + return $this->deleteContactMembersAsyncWithHttpInfo($loyaltyProgramId, $contactId, $memberContactIds, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteContactMembersAsyncWithHttpInfo + * + * Delete subscription member + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param int $contactId Contact Id (required) + * @param int $memberContactIds Member Contact Ids, comma-seperated (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContactMembers'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteContactMembersAsyncWithHttpInfo( + $loyaltyProgramId, + $contactId, + $memberContactIds, + string $contentType = self::contentTypes['deleteContactMembers'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteContactMembersRequest($loyaltyProgramId, $contactId, $memberContactIds, $contentType); + + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteContactMembers' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param int $contactId Contact Id (required) + * @param int $memberContactIds Member Contact Ids, comma-seperated (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContactMembers'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteContactMembersRequest( + $loyaltyProgramId, + $contactId, + $memberContactIds, + string $contentType = self::contentTypes['deleteContactMembers'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling deleteContactMembers' + ); + } + + // verify the required parameter 'contactId' is set + if ($contactId === null || (is_array($contactId) && count($contactId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $contactId when calling deleteContactMembers' + ); + } + + // verify the required parameter 'memberContactIds' is set + if ($memberContactIds === null || (is_array($memberContactIds) && count($memberContactIds) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $memberContactIds when calling deleteContactMembers' + ); + } + + + $resourcePath = '/loyalty/config/programs/{loyaltyProgramId}/subscriptions-members'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $contactId, + 'contactId', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $memberContactIds, + 'memberContactIds', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteLoyaltyProgram + * + * Delete Loyalty Program + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteLoyaltyProgram'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return void + */ + public function deleteLoyaltyProgram( + string $loyaltyProgramId, + string $contentType = self::contentTypes['deleteLoyaltyProgram'][0] + ): void + { + $this->deleteLoyaltyProgramWithHttpInfo($loyaltyProgramId, $contentType); + } + + /** + * Operation deleteLoyaltyProgramWithHttpInfo + * + * Delete Loyalty Program + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteLoyaltyProgram'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteLoyaltyProgramWithHttpInfo( + string $loyaltyProgramId, + string $contentType = self::contentTypes['deleteLoyaltyProgram'][0] + ): array + { + $request = $this->deleteLoyaltyProgramRequest($loyaltyProgramId, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteLoyaltyProgramAsync + * + * Delete Loyalty Program + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteLoyaltyProgram'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteLoyaltyProgramAsync( + string $loyaltyProgramId, + string $contentType = self::contentTypes['deleteLoyaltyProgram'][0] + ): PromiseInterface + { + return $this->deleteLoyaltyProgramAsyncWithHttpInfo($loyaltyProgramId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteLoyaltyProgramAsyncWithHttpInfo + * + * Delete Loyalty Program + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteLoyaltyProgram'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteLoyaltyProgramAsyncWithHttpInfo( + $loyaltyProgramId, + string $contentType = self::contentTypes['deleteLoyaltyProgram'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteLoyaltyProgramRequest($loyaltyProgramId, $contentType); + + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteLoyaltyProgram' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteLoyaltyProgram'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteLoyaltyProgramRequest( + $loyaltyProgramId, + string $contentType = self::contentTypes['deleteLoyaltyProgram'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling deleteLoyaltyProgram' + ); + } + + + $resourcePath = '/loyalty/config/programs/{loyaltyProgramId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteSubscriptionMember + * + * Delete subscription + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contactId Contact Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSubscriptionMember'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return void + */ + public function deleteSubscriptionMember( + string $loyaltyProgramId, + string $contactId, + string $contentType = self::contentTypes['deleteSubscriptionMember'][0] + ): void + { + $this->deleteSubscriptionMemberWithHttpInfo($loyaltyProgramId, $contactId, $contentType); + } + + /** + * Operation deleteSubscriptionMemberWithHttpInfo + * + * Delete subscription + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contactId Contact Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSubscriptionMember'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteSubscriptionMemberWithHttpInfo( + string $loyaltyProgramId, + string $contactId, + string $contentType = self::contentTypes['deleteSubscriptionMember'][0] + ): array + { + $request = $this->deleteSubscriptionMemberRequest($loyaltyProgramId, $contactId, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteSubscriptionMemberAsync + * + * Delete subscription + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contactId Contact Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSubscriptionMember'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteSubscriptionMemberAsync( + string $loyaltyProgramId, + string $contactId, + string $contentType = self::contentTypes['deleteSubscriptionMember'][0] + ): PromiseInterface + { + return $this->deleteSubscriptionMemberAsyncWithHttpInfo($loyaltyProgramId, $contactId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteSubscriptionMemberAsyncWithHttpInfo + * + * Delete subscription + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contactId Contact Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSubscriptionMember'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteSubscriptionMemberAsyncWithHttpInfo( + $loyaltyProgramId, + $contactId, + string $contentType = self::contentTypes['deleteSubscriptionMember'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteSubscriptionMemberRequest($loyaltyProgramId, $contactId, $contentType); + + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteSubscriptionMember' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contactId Contact Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSubscriptionMember'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteSubscriptionMemberRequest( + $loyaltyProgramId, + $contactId, + string $contentType = self::contentTypes['deleteSubscriptionMember'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling deleteSubscriptionMember' + ); + } + + // verify the required parameter 'contactId' is set + if ($contactId === null || (is_array($contactId) && count($contactId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $contactId when calling deleteSubscriptionMember' + ); + } + + + $resourcePath = '/loyalty/config/programs/{loyaltyProgramId}/contact/{contactId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + // path params + if ($contactId !== null) { + $resourcePath = str_replace( + '{' . 'contactId' . '}', + ObjectSerializer::toPathValue($contactId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getLPList + * + * Get loyalty program list + * + * @param int|null $limit Number of documents per page (optional, default to 200) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sortField Sort documents by field (optional, default to 'updatedAt') + * @param string|null $sort Sort the documents in the ascending or descending order (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLPList'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\LoyaltyProgramPage|\Brevo\Client\Models\BadRequestPayload + */ + public function getLPList( + ?int $limit = 200, + ?int $offset = 0, + ?string $sortField = 'updatedAt', + ?string $sort = 'desc', + string $contentType = self::contentTypes['getLPList'][0] + ): \Brevo\Client\Models\LoyaltyProgramPage + { + list($response) = $this->getLPListWithHttpInfo($limit, $offset, $sortField, $sort, $contentType); + return $response; + } + + /** + * Operation getLPListWithHttpInfo + * + * Get loyalty program list + * + * @param int|null $limit Number of documents per page (optional, default to 200) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sortField Sort documents by field (optional, default to 'updatedAt') + * @param string|null $sort Sort the documents in the ascending or descending order (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLPList'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\LoyaltyProgramPage|\Brevo\Client\Models\BadRequestPayload, HTTP status code, HTTP response headers (array of strings) + */ + public function getLPListWithHttpInfo( + ?int $limit = 200, + ?int $offset = 0, + ?string $sortField = 'updatedAt', + ?string $sort = 'desc', + string $contentType = self::contentTypes['getLPList'][0] + ): array + { + $request = $this->getLPListRequest($limit, $offset, $sortField, $sort, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\LoyaltyProgramPage', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\LoyaltyProgramPage' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\LoyaltyProgramPage', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\LoyaltyProgramPage'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\LoyaltyProgramPage', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getLPListAsync + * + * Get loyalty program list + * + * @param int|null $limit Number of documents per page (optional, default to 200) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sortField Sort documents by field (optional, default to 'updatedAt') + * @param string|null $sort Sort the documents in the ascending or descending order (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLPList'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getLPListAsync( + ?int $limit = 200, + ?int $offset = 0, + ?string $sortField = 'updatedAt', + ?string $sort = 'desc', + string $contentType = self::contentTypes['getLPList'][0] + ): PromiseInterface + { + return $this->getLPListAsyncWithHttpInfo($limit, $offset, $sortField, $sort, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getLPListAsyncWithHttpInfo + * + * Get loyalty program list + * + * @param int|null $limit Number of documents per page (optional, default to 200) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sortField Sort documents by field (optional, default to 'updatedAt') + * @param string|null $sort Sort the documents in the ascending or descending order (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLPList'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getLPListAsyncWithHttpInfo( + $limit = 200, + $offset = 0, + $sortField = 'updatedAt', + $sort = 'desc', + string $contentType = self::contentTypes['getLPList'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\LoyaltyProgramPage'; + $request = $this->getLPListRequest($limit, $offset, $sortField, $sort, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getLPList' + * + * @param int|null $limit Number of documents per page (optional, default to 200) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sortField Sort documents by field (optional, default to 'updatedAt') + * @param string|null $sort Sort the documents in the ascending or descending order (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLPList'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getLPListRequest( + $limit = 200, + $offset = 0, + $sortField = 'updatedAt', + $sort = 'desc', + string $contentType = self::contentTypes['getLPList'][0] + ): Request + { + + + + + + + $resourcePath = '/loyalty/config/programs'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sortField, + 'sortField', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getLoyaltyProgramInfo + * + * Get loyalty program Info + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLoyaltyProgramInfo'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\LoyaltyProgram|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload + */ + public function getLoyaltyProgramInfo( + string $loyaltyProgramId, + string $contentType = self::contentTypes['getLoyaltyProgramInfo'][0] + ): \Brevo\Client\Models\LoyaltyProgram + { + list($response) = $this->getLoyaltyProgramInfoWithHttpInfo($loyaltyProgramId, $contentType); + return $response; + } + + /** + * Operation getLoyaltyProgramInfoWithHttpInfo + * + * Get loyalty program Info + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLoyaltyProgramInfo'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\LoyaltyProgram|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload, HTTP status code, HTTP response headers (array of strings) + */ + public function getLoyaltyProgramInfoWithHttpInfo( + string $loyaltyProgramId, + string $contentType = self::contentTypes['getLoyaltyProgramInfo'][0] + ): array + { + $request = $this->getLoyaltyProgramInfoRequest($loyaltyProgramId, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\LoyaltyProgram', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\LoyaltyProgram' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\LoyaltyProgram', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\LoyaltyProgram'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\LoyaltyProgram', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getLoyaltyProgramInfoAsync + * + * Get loyalty program Info + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLoyaltyProgramInfo'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getLoyaltyProgramInfoAsync( + string $loyaltyProgramId, + string $contentType = self::contentTypes['getLoyaltyProgramInfo'][0] + ): PromiseInterface + { + return $this->getLoyaltyProgramInfoAsyncWithHttpInfo($loyaltyProgramId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getLoyaltyProgramInfoAsyncWithHttpInfo + * + * Get loyalty program Info + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLoyaltyProgramInfo'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getLoyaltyProgramInfoAsyncWithHttpInfo( + $loyaltyProgramId, + string $contentType = self::contentTypes['getLoyaltyProgramInfo'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\LoyaltyProgram'; + $request = $this->getLoyaltyProgramInfoRequest($loyaltyProgramId, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getLoyaltyProgramInfo' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLoyaltyProgramInfo'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getLoyaltyProgramInfoRequest( + $loyaltyProgramId, + string $contentType = self::contentTypes['getLoyaltyProgramInfo'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling getLoyaltyProgramInfo' + ); + } + + + $resourcePath = '/loyalty/config/programs/{loyaltyProgramId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getParameterSubscriptionInfo + * + * Get Subscription Data + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param int $contactId One of contact id or loyalty subscription id is required (required) + * @param string|null $loyaltySubscriptionId Loyalty Subscription Id (optional) + * @param string[]|null $params Add query params (balance, tier, reward, or member) (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParameterSubscriptionInfo'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetSubscriptionInfoResponse|\Brevo\Client\Models\ContactIdInvalidResponse|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ContactIdInvalidResponse + */ + public function getParameterSubscriptionInfo( + string $loyaltyProgramId, + int $contactId, + ?string $loyaltySubscriptionId = null, + ?array $params = null, + string $contentType = self::contentTypes['getParameterSubscriptionInfo'][0] + ): \Brevo\Client\Models\GetSubscriptionInfoResponse + { + list($response) = $this->getParameterSubscriptionInfoWithHttpInfo($loyaltyProgramId, $contactId, $loyaltySubscriptionId, $params, $contentType); + return $response; + } + + /** + * Operation getParameterSubscriptionInfoWithHttpInfo + * + * Get Subscription Data + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param int $contactId One of contact id or loyalty subscription id is required (required) + * @param string|null $loyaltySubscriptionId Loyalty Subscription Id (optional) + * @param string[]|null $params Add query params (balance, tier, reward, or member) (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParameterSubscriptionInfo'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetSubscriptionInfoResponse|\Brevo\Client\Models\ContactIdInvalidResponse|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ContactIdInvalidResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getParameterSubscriptionInfoWithHttpInfo( + string $loyaltyProgramId, + int $contactId, + ?string $loyaltySubscriptionId = null, + ?array $params = null, + string $contentType = self::contentTypes['getParameterSubscriptionInfo'][0] + ): array + { + $request = $this->getParameterSubscriptionInfoRequest($loyaltyProgramId, $contactId, $loyaltySubscriptionId, $params, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetSubscriptionInfoResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetSubscriptionInfoResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetSubscriptionInfoResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ContactIdInvalidResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ContactIdInvalidResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ContactIdInvalidResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ContactIdInvalidResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ContactIdInvalidResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ContactIdInvalidResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\GetSubscriptionInfoResponse'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\GetSubscriptionInfoResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getParameterSubscriptionInfoAsync + * + * Get Subscription Data + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param int $contactId One of contact id or loyalty subscription id is required (required) + * @param string|null $loyaltySubscriptionId Loyalty Subscription Id (optional) + * @param string[]|null $params Add query params (balance, tier, reward, or member) (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParameterSubscriptionInfo'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getParameterSubscriptionInfoAsync( + string $loyaltyProgramId, + int $contactId, + ?string $loyaltySubscriptionId = null, + ?array $params = null, + string $contentType = self::contentTypes['getParameterSubscriptionInfo'][0] + ): PromiseInterface + { + return $this->getParameterSubscriptionInfoAsyncWithHttpInfo($loyaltyProgramId, $contactId, $loyaltySubscriptionId, $params, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getParameterSubscriptionInfoAsyncWithHttpInfo + * + * Get Subscription Data + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param int $contactId One of contact id or loyalty subscription id is required (required) + * @param string|null $loyaltySubscriptionId Loyalty Subscription Id (optional) + * @param string[]|null $params Add query params (balance, tier, reward, or member) (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParameterSubscriptionInfo'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getParameterSubscriptionInfoAsyncWithHttpInfo( + $loyaltyProgramId, + $contactId, + $loyaltySubscriptionId = null, + $params = null, + string $contentType = self::contentTypes['getParameterSubscriptionInfo'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\GetSubscriptionInfoResponse'; + $request = $this->getParameterSubscriptionInfoRequest($loyaltyProgramId, $contactId, $loyaltySubscriptionId, $params, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getParameterSubscriptionInfo' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param int $contactId One of contact id or loyalty subscription id is required (required) + * @param string|null $loyaltySubscriptionId Loyalty Subscription Id (optional) + * @param string[]|null $params Add query params (balance, tier, reward, or member) (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParameterSubscriptionInfo'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getParameterSubscriptionInfoRequest( + $loyaltyProgramId, + $contactId, + $loyaltySubscriptionId = null, + $params = null, + string $contentType = self::contentTypes['getParameterSubscriptionInfo'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling getParameterSubscriptionInfo' + ); + } + + // verify the required parameter 'contactId' is set + if ($contactId === null || (is_array($contactId) && count($contactId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $contactId when calling getParameterSubscriptionInfo' + ); + } + + + + + $resourcePath = '/loyalty/config/programs/{loyaltyProgramId}/account-info'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $contactId, + 'contactId', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $loyaltySubscriptionId, + 'loyaltySubscriptionId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $params, + 'params', // param base name + 'array', // openApiType + 'form', // style + false, // explode + false // required + ) ?? []); + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSubscriptionMember + * + * Get subscription info + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contactId Contact Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubscriptionMember'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetSubscriptionMemberResponse|\Brevo\Client\Models\ContactIdInvalidResponse|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ContactIdInvalidResponse + */ + public function getSubscriptionMember( + string $loyaltyProgramId, + string $contactId, + string $contentType = self::contentTypes['getSubscriptionMember'][0] + ): \Brevo\Client\Models\GetSubscriptionMemberResponse + { + list($response) = $this->getSubscriptionMemberWithHttpInfo($loyaltyProgramId, $contactId, $contentType); + return $response; + } + + /** + * Operation getSubscriptionMemberWithHttpInfo + * + * Get subscription info + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contactId Contact Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubscriptionMember'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetSubscriptionMemberResponse|\Brevo\Client\Models\ContactIdInvalidResponse|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ContactIdInvalidResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getSubscriptionMemberWithHttpInfo( + string $loyaltyProgramId, + string $contactId, + string $contentType = self::contentTypes['getSubscriptionMember'][0] + ): array + { + $request = $this->getSubscriptionMemberRequest($loyaltyProgramId, $contactId, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetSubscriptionMemberResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetSubscriptionMemberResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetSubscriptionMemberResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ContactIdInvalidResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ContactIdInvalidResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ContactIdInvalidResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ContactIdInvalidResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ContactIdInvalidResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ContactIdInvalidResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\GetSubscriptionMemberResponse'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\GetSubscriptionMemberResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSubscriptionMemberAsync + * + * Get subscription info + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contactId Contact Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubscriptionMember'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getSubscriptionMemberAsync( + string $loyaltyProgramId, + string $contactId, + string $contentType = self::contentTypes['getSubscriptionMember'][0] + ): PromiseInterface + { + return $this->getSubscriptionMemberAsyncWithHttpInfo($loyaltyProgramId, $contactId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSubscriptionMemberAsyncWithHttpInfo + * + * Get subscription info + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contactId Contact Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubscriptionMember'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getSubscriptionMemberAsyncWithHttpInfo( + $loyaltyProgramId, + $contactId, + string $contentType = self::contentTypes['getSubscriptionMember'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\GetSubscriptionMemberResponse'; + $request = $this->getSubscriptionMemberRequest($loyaltyProgramId, $contactId, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSubscriptionMember' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contactId Contact Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubscriptionMember'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSubscriptionMemberRequest( + $loyaltyProgramId, + $contactId, + string $contentType = self::contentTypes['getSubscriptionMember'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling getSubscriptionMember' + ); + } + + // verify the required parameter 'contactId' is set + if ($contactId === null || (is_array($contactId) && count($contactId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $contactId when calling getSubscriptionMember' + ); + } + + + $resourcePath = '/loyalty/config/programs/{loyaltyProgramId}/contact/{contactId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + // path params + if ($contactId !== null) { + $resourcePath = str_replace( + '{' . 'contactId' . '}', + ObjectSerializer::toPathValue($contactId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation partiallyUpdateLoyaltyProgram + * + * Partially update loyalty program + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\PatchLoyaltyProgramPayload|null $patchLoyaltyProgramPayload Loyalty Program information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['partiallyUpdateLoyaltyProgram'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\LoyaltyProgram|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload + */ + public function partiallyUpdateLoyaltyProgram( + string $loyaltyProgramId, + ?\Brevo\Client\Models\PatchLoyaltyProgramPayload $patchLoyaltyProgramPayload = null, + string $contentType = self::contentTypes['partiallyUpdateLoyaltyProgram'][0] + ): \Brevo\Client\Models\LoyaltyProgram + { + list($response) = $this->partiallyUpdateLoyaltyProgramWithHttpInfo($loyaltyProgramId, $patchLoyaltyProgramPayload, $contentType); + return $response; + } + + /** + * Operation partiallyUpdateLoyaltyProgramWithHttpInfo + * + * Partially update loyalty program + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\PatchLoyaltyProgramPayload|null $patchLoyaltyProgramPayload Loyalty Program information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['partiallyUpdateLoyaltyProgram'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\LoyaltyProgram|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload, HTTP status code, HTTP response headers (array of strings) + */ + public function partiallyUpdateLoyaltyProgramWithHttpInfo( + string $loyaltyProgramId, + ?\Brevo\Client\Models\PatchLoyaltyProgramPayload $patchLoyaltyProgramPayload = null, + string $contentType = self::contentTypes['partiallyUpdateLoyaltyProgram'][0] + ): array + { + $request = $this->partiallyUpdateLoyaltyProgramRequest($loyaltyProgramId, $patchLoyaltyProgramPayload, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\LoyaltyProgram', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\LoyaltyProgram' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\LoyaltyProgram', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 409: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\LoyaltyProgram'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\LoyaltyProgram', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation partiallyUpdateLoyaltyProgramAsync + * + * Partially update loyalty program + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\PatchLoyaltyProgramPayload|null $patchLoyaltyProgramPayload Loyalty Program information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['partiallyUpdateLoyaltyProgram'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function partiallyUpdateLoyaltyProgramAsync( + string $loyaltyProgramId, + ?\Brevo\Client\Models\PatchLoyaltyProgramPayload $patchLoyaltyProgramPayload = null, + string $contentType = self::contentTypes['partiallyUpdateLoyaltyProgram'][0] + ): PromiseInterface + { + return $this->partiallyUpdateLoyaltyProgramAsyncWithHttpInfo($loyaltyProgramId, $patchLoyaltyProgramPayload, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation partiallyUpdateLoyaltyProgramAsyncWithHttpInfo + * + * Partially update loyalty program + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\PatchLoyaltyProgramPayload|null $patchLoyaltyProgramPayload Loyalty Program information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['partiallyUpdateLoyaltyProgram'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function partiallyUpdateLoyaltyProgramAsyncWithHttpInfo( + $loyaltyProgramId, + $patchLoyaltyProgramPayload = null, + string $contentType = self::contentTypes['partiallyUpdateLoyaltyProgram'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\LoyaltyProgram'; + $request = $this->partiallyUpdateLoyaltyProgramRequest($loyaltyProgramId, $patchLoyaltyProgramPayload, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'partiallyUpdateLoyaltyProgram' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\PatchLoyaltyProgramPayload|null $patchLoyaltyProgramPayload Loyalty Program information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['partiallyUpdateLoyaltyProgram'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function partiallyUpdateLoyaltyProgramRequest( + $loyaltyProgramId, + $patchLoyaltyProgramPayload = null, + string $contentType = self::contentTypes['partiallyUpdateLoyaltyProgram'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling partiallyUpdateLoyaltyProgram' + ); + } + + + + $resourcePath = '/loyalty/config/programs/{loyaltyProgramId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($patchLoyaltyProgramPayload)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($patchLoyaltyProgramPayload)); + } else { + $httpBody = $patchLoyaltyProgramPayload; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PATCH', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation publishLoyaltyProgram + * + * Publish loyalty program + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['publishLoyaltyProgram'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return void + */ + public function publishLoyaltyProgram( + string $loyaltyProgramId, + string $contentType = self::contentTypes['publishLoyaltyProgram'][0] + ): void + { + $this->publishLoyaltyProgramWithHttpInfo($loyaltyProgramId, $contentType); + } + + /** + * Operation publishLoyaltyProgramWithHttpInfo + * + * Publish loyalty program + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['publishLoyaltyProgram'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function publishLoyaltyProgramWithHttpInfo( + string $loyaltyProgramId, + string $contentType = self::contentTypes['publishLoyaltyProgram'][0] + ): array + { + $request = $this->publishLoyaltyProgramRequest($loyaltyProgramId, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation publishLoyaltyProgramAsync + * + * Publish loyalty program + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['publishLoyaltyProgram'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function publishLoyaltyProgramAsync( + string $loyaltyProgramId, + string $contentType = self::contentTypes['publishLoyaltyProgram'][0] + ): PromiseInterface + { + return $this->publishLoyaltyProgramAsyncWithHttpInfo($loyaltyProgramId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation publishLoyaltyProgramAsyncWithHttpInfo + * + * Publish loyalty program + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['publishLoyaltyProgram'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function publishLoyaltyProgramAsyncWithHttpInfo( + $loyaltyProgramId, + string $contentType = self::contentTypes['publishLoyaltyProgram'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->publishLoyaltyProgramRequest($loyaltyProgramId, $contentType); + + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'publishLoyaltyProgram' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['publishLoyaltyProgram'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function publishLoyaltyProgramRequest( + $loyaltyProgramId, + string $contentType = self::contentTypes['publishLoyaltyProgram'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling publishLoyaltyProgram' + ); + } + + + $resourcePath = '/loyalty/config/programs/{loyaltyProgramId}/publish'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation subscribeMemberToASubscription + * + * Create subscription member + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateSubscriptionMemberPayload|null $createSubscriptionMemberPayload Subscription Member information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['subscribeMemberToASubscription'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateSubscriptionMemberResponse|\Brevo\Client\Models\ContactIdInvalidResponse|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ContactIdInvalidResponse|\Brevo\Client\Models\ContactIdInvalidResponse|\Brevo\Client\Models\ContactIdInvalidResponse + */ + public function subscribeMemberToASubscription( + string $loyaltyProgramId, + ?\Brevo\Client\Models\CreateSubscriptionMemberPayload $createSubscriptionMemberPayload = null, + string $contentType = self::contentTypes['subscribeMemberToASubscription'][0] + ): \Brevo\Client\Models\CreateSubscriptionMemberResponse + { + list($response) = $this->subscribeMemberToASubscriptionWithHttpInfo($loyaltyProgramId, $createSubscriptionMemberPayload, $contentType); + return $response; + } + + /** + * Operation subscribeMemberToASubscriptionWithHttpInfo + * + * Create subscription member + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateSubscriptionMemberPayload|null $createSubscriptionMemberPayload Subscription Member information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['subscribeMemberToASubscription'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateSubscriptionMemberResponse|\Brevo\Client\Models\ContactIdInvalidResponse|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ContactIdInvalidResponse|\Brevo\Client\Models\ContactIdInvalidResponse|\Brevo\Client\Models\ContactIdInvalidResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function subscribeMemberToASubscriptionWithHttpInfo( + string $loyaltyProgramId, + ?\Brevo\Client\Models\CreateSubscriptionMemberPayload $createSubscriptionMemberPayload = null, + string $contentType = self::contentTypes['subscribeMemberToASubscription'][0] + ): array + { + $request = $this->subscribeMemberToASubscriptionRequest($loyaltyProgramId, $createSubscriptionMemberPayload, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\CreateSubscriptionMemberResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateSubscriptionMemberResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateSubscriptionMemberResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ContactIdInvalidResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ContactIdInvalidResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ContactIdInvalidResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ContactIdInvalidResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ContactIdInvalidResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ContactIdInvalidResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 409: + if (in_array('\Brevo\Client\Models\ContactIdInvalidResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ContactIdInvalidResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ContactIdInvalidResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ContactIdInvalidResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ContactIdInvalidResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ContactIdInvalidResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\CreateSubscriptionMemberResponse'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\CreateSubscriptionMemberResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation subscribeMemberToASubscriptionAsync + * + * Create subscription member + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateSubscriptionMemberPayload|null $createSubscriptionMemberPayload Subscription Member information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['subscribeMemberToASubscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function subscribeMemberToASubscriptionAsync( + string $loyaltyProgramId, + ?\Brevo\Client\Models\CreateSubscriptionMemberPayload $createSubscriptionMemberPayload = null, + string $contentType = self::contentTypes['subscribeMemberToASubscription'][0] + ): PromiseInterface + { + return $this->subscribeMemberToASubscriptionAsyncWithHttpInfo($loyaltyProgramId, $createSubscriptionMemberPayload, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation subscribeMemberToASubscriptionAsyncWithHttpInfo + * + * Create subscription member + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateSubscriptionMemberPayload|null $createSubscriptionMemberPayload Subscription Member information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['subscribeMemberToASubscription'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function subscribeMemberToASubscriptionAsyncWithHttpInfo( + $loyaltyProgramId, + $createSubscriptionMemberPayload = null, + string $contentType = self::contentTypes['subscribeMemberToASubscription'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\CreateSubscriptionMemberResponse'; + $request = $this->subscribeMemberToASubscriptionRequest($loyaltyProgramId, $createSubscriptionMemberPayload, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'subscribeMemberToASubscription' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateSubscriptionMemberPayload|null $createSubscriptionMemberPayload Subscription Member information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['subscribeMemberToASubscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function subscribeMemberToASubscriptionRequest( + $loyaltyProgramId, + $createSubscriptionMemberPayload = null, + string $contentType = self::contentTypes['subscribeMemberToASubscription'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling subscribeMemberToASubscription' + ); + } + + + + $resourcePath = '/loyalty/config/programs/{loyaltyProgramId}/subscriptions-members'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($createSubscriptionMemberPayload)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createSubscriptionMemberPayload)); + } else { + $httpBody = $createSubscriptionMemberPayload; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation subscribeToLoyaltyProgram + * + * Create subscription + * + * @param string $loyaltyProgramId Loyalty Program ID (required) + * @param \Brevo\Client\Models\CreateSubscriptionPayload $createSubscriptionPayload Subscription information (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['subscribeToLoyaltyProgram'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateSubscriptionResponse|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ContactIdInvalidResponse|\Brevo\Client\Models\ContactIdInvalidResponse + */ + public function subscribeToLoyaltyProgram( + string $loyaltyProgramId, + \Brevo\Client\Models\CreateSubscriptionPayload $createSubscriptionPayload, + string $contentType = self::contentTypes['subscribeToLoyaltyProgram'][0] + ): \Brevo\Client\Models\CreateSubscriptionResponse + { + list($response) = $this->subscribeToLoyaltyProgramWithHttpInfo($loyaltyProgramId, $createSubscriptionPayload, $contentType); + return $response; + } + + /** + * Operation subscribeToLoyaltyProgramWithHttpInfo + * + * Create subscription + * + * @param string $loyaltyProgramId Loyalty Program ID (required) + * @param \Brevo\Client\Models\CreateSubscriptionPayload $createSubscriptionPayload Subscription information (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['subscribeToLoyaltyProgram'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateSubscriptionResponse|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ContactIdInvalidResponse|\Brevo\Client\Models\ContactIdInvalidResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function subscribeToLoyaltyProgramWithHttpInfo( + string $loyaltyProgramId, + \Brevo\Client\Models\CreateSubscriptionPayload $createSubscriptionPayload, + string $contentType = self::contentTypes['subscribeToLoyaltyProgram'][0] + ): array + { + $request = $this->subscribeToLoyaltyProgramRequest($loyaltyProgramId, $createSubscriptionPayload, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreateSubscriptionResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateSubscriptionResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateSubscriptionResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ContactIdInvalidResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ContactIdInvalidResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ContactIdInvalidResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ContactIdInvalidResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ContactIdInvalidResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ContactIdInvalidResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\CreateSubscriptionResponse'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\CreateSubscriptionResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation subscribeToLoyaltyProgramAsync + * + * Create subscription + * + * @param string $loyaltyProgramId Loyalty Program ID (required) + * @param \Brevo\Client\Models\CreateSubscriptionPayload $createSubscriptionPayload Subscription information (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['subscribeToLoyaltyProgram'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function subscribeToLoyaltyProgramAsync( + string $loyaltyProgramId, + \Brevo\Client\Models\CreateSubscriptionPayload $createSubscriptionPayload, + string $contentType = self::contentTypes['subscribeToLoyaltyProgram'][0] + ): PromiseInterface + { + return $this->subscribeToLoyaltyProgramAsyncWithHttpInfo($loyaltyProgramId, $createSubscriptionPayload, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation subscribeToLoyaltyProgramAsyncWithHttpInfo + * + * Create subscription + * + * @param string $loyaltyProgramId Loyalty Program ID (required) + * @param \Brevo\Client\Models\CreateSubscriptionPayload $createSubscriptionPayload Subscription information (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['subscribeToLoyaltyProgram'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function subscribeToLoyaltyProgramAsyncWithHttpInfo( + $loyaltyProgramId, + $createSubscriptionPayload, + string $contentType = self::contentTypes['subscribeToLoyaltyProgram'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\CreateSubscriptionResponse'; + $request = $this->subscribeToLoyaltyProgramRequest($loyaltyProgramId, $createSubscriptionPayload, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'subscribeToLoyaltyProgram' + * + * @param string $loyaltyProgramId Loyalty Program ID (required) + * @param \Brevo\Client\Models\CreateSubscriptionPayload $createSubscriptionPayload Subscription information (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['subscribeToLoyaltyProgram'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function subscribeToLoyaltyProgramRequest( + $loyaltyProgramId, + $createSubscriptionPayload, + string $contentType = self::contentTypes['subscribeToLoyaltyProgram'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling subscribeToLoyaltyProgram' + ); + } + + // verify the required parameter 'createSubscriptionPayload' is set + if ($createSubscriptionPayload === null || (is_array($createSubscriptionPayload) && count($createSubscriptionPayload) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $createSubscriptionPayload when calling subscribeToLoyaltyProgram' + ); + } + + + $resourcePath = '/loyalty/config/programs/{loyaltyProgramId}/subscriptions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($createSubscriptionPayload)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createSubscriptionPayload)); + } else { + $httpBody = $createSubscriptionPayload; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateLoyaltyProgram + * + * Update loyalty program + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\UpdateLoyaltyProgramPayload|null $updateLoyaltyProgramPayload Loyalty Program information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoyaltyProgram'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\LoyaltyProgram|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload + */ + public function updateLoyaltyProgram( + string $loyaltyProgramId, + ?\Brevo\Client\Models\UpdateLoyaltyProgramPayload $updateLoyaltyProgramPayload = null, + string $contentType = self::contentTypes['updateLoyaltyProgram'][0] + ): \Brevo\Client\Models\LoyaltyProgram + { + list($response) = $this->updateLoyaltyProgramWithHttpInfo($loyaltyProgramId, $updateLoyaltyProgramPayload, $contentType); + return $response; + } + + /** + * Operation updateLoyaltyProgramWithHttpInfo + * + * Update loyalty program + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\UpdateLoyaltyProgramPayload|null $updateLoyaltyProgramPayload Loyalty Program information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoyaltyProgram'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\LoyaltyProgram|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload, HTTP status code, HTTP response headers (array of strings) + */ + public function updateLoyaltyProgramWithHttpInfo( + string $loyaltyProgramId, + ?\Brevo\Client\Models\UpdateLoyaltyProgramPayload $updateLoyaltyProgramPayload = null, + string $contentType = self::contentTypes['updateLoyaltyProgram'][0] + ): array + { + $request = $this->updateLoyaltyProgramRequest($loyaltyProgramId, $updateLoyaltyProgramPayload, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\LoyaltyProgram', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\LoyaltyProgram' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\LoyaltyProgram', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 409: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\LoyaltyProgram'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\LoyaltyProgram', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateLoyaltyProgramAsync + * + * Update loyalty program + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\UpdateLoyaltyProgramPayload|null $updateLoyaltyProgramPayload Loyalty Program information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoyaltyProgram'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateLoyaltyProgramAsync( + string $loyaltyProgramId, + ?\Brevo\Client\Models\UpdateLoyaltyProgramPayload $updateLoyaltyProgramPayload = null, + string $contentType = self::contentTypes['updateLoyaltyProgram'][0] + ): PromiseInterface + { + return $this->updateLoyaltyProgramAsyncWithHttpInfo($loyaltyProgramId, $updateLoyaltyProgramPayload, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateLoyaltyProgramAsyncWithHttpInfo + * + * Update loyalty program + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\UpdateLoyaltyProgramPayload|null $updateLoyaltyProgramPayload Loyalty Program information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoyaltyProgram'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateLoyaltyProgramAsyncWithHttpInfo( + $loyaltyProgramId, + $updateLoyaltyProgramPayload = null, + string $contentType = self::contentTypes['updateLoyaltyProgram'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\LoyaltyProgram'; + $request = $this->updateLoyaltyProgramRequest($loyaltyProgramId, $updateLoyaltyProgramPayload, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateLoyaltyProgram' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\UpdateLoyaltyProgramPayload|null $updateLoyaltyProgramPayload Loyalty Program information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoyaltyProgram'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateLoyaltyProgramRequest( + $loyaltyProgramId, + $updateLoyaltyProgramPayload = null, + string $contentType = self::contentTypes['updateLoyaltyProgram'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling updateLoyaltyProgram' + ); + } + + + + $resourcePath = '/loyalty/config/programs/{loyaltyProgramId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($updateLoyaltyProgramPayload)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($updateLoyaltyProgramPayload)); + } else { + $httpBody = $updateLoyaltyProgramPayload; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $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 deleted file mode 100644 index 410a8c5..0000000 --- a/lib/Api/ResellerApi.php +++ /dev/null @@ -1,4765 +0,0 @@ -client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation addCredits - * - * Add Email and/or SMS credits to a specific child account - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\AddCredits $addCredits Values to post to add credit to a specific child account (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\RemainingCreditModel - */ - public function addCredits($childIdentifier, $addCredits) - { - list($response) = $this->addCreditsWithHttpInfo($childIdentifier, $addCredits); - return $response; - } - - /** - * Operation addCreditsWithHttpInfo - * - * Add Email and/or SMS credits to a specific child account - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\AddCredits $addCredits Values to post to add credit to a specific child account (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\RemainingCreditModel, HTTP status code, HTTP response headers (array of strings) - */ - public function addCreditsWithHttpInfo($childIdentifier, $addCredits) - { - $returnType = '\Brevo\Client\Model\RemainingCreditModel'; - $request = $this->addCreditsRequest($childIdentifier, $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(), - '\Brevo\Client\Model\RemainingCreditModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\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 $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\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($childIdentifier, $addCredits) - { - return $this->addCreditsAsyncWithHttpInfo($childIdentifier, $addCredits) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation addCreditsAsyncWithHttpInfo - * - * Add Email and/or SMS credits to a specific child account - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\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($childIdentifier, $addCredits) - { - $returnType = '\Brevo\Client\Model\RemainingCreditModel'; - $request = $this->addCreditsRequest($childIdentifier, $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 $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\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($childIdentifier, $addCredits) - { - // verify the required parameter 'childIdentifier' is set - if ($childIdentifier === null || (is_array($childIdentifier) && count($childIdentifier) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $childIdentifier when calling addCredits' - ); - } - // verify the required parameter 'addCredits' is set - if ($addCredits === null || (is_array($addCredits) && count($addCredits) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $addCredits when calling addCredits' - ); - } - - $resourcePath = '/reseller/children/{childIdentifier}/credits/add'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($childIdentifier !== null) { - $resourcePath = str_replace( - '{' . 'childIdentifier' . '}', - ObjectSerializer::toPathValue($childIdentifier), - $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)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation associateIpToChild - * - * Associate a dedicated IP to the child - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\ManageIp $ip IP to associate (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function associateIpToChild($childIdentifier, $ip) - { - $this->associateIpToChildWithHttpInfo($childIdentifier, $ip); - } - - /** - * Operation associateIpToChildWithHttpInfo - * - * Associate a dedicated IP to the child - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\ManageIp $ip IP to associate (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function associateIpToChildWithHttpInfo($childIdentifier, $ip) - { - $returnType = ''; - $request = $this->associateIpToChildRequest($childIdentifier, $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(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation associateIpToChildAsync - * - * Associate a dedicated IP to the child - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\ManageIp $ip IP to associate (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function associateIpToChildAsync($childIdentifier, $ip) - { - return $this->associateIpToChildAsyncWithHttpInfo($childIdentifier, $ip) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation associateIpToChildAsyncWithHttpInfo - * - * Associate a dedicated IP to the child - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\ManageIp $ip IP to associate (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function associateIpToChildAsyncWithHttpInfo($childIdentifier, $ip) - { - $returnType = ''; - $request = $this->associateIpToChildRequest($childIdentifier, $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 $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\ManageIp $ip IP to associate (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function associateIpToChildRequest($childIdentifier, $ip) - { - // verify the required parameter 'childIdentifier' is set - if ($childIdentifier === null || (is_array($childIdentifier) && count($childIdentifier) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $childIdentifier when calling associateIpToChild' - ); - } - // verify the required parameter 'ip' is set - if ($ip === null || (is_array($ip) && count($ip) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $ip when calling associateIpToChild' - ); - } - - $resourcePath = '/reseller/children/{childIdentifier}/ips/associate'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($childIdentifier !== null) { - $resourcePath = str_replace( - '{' . 'childIdentifier' . '}', - ObjectSerializer::toPathValue($childIdentifier), - $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)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation createChildDomain - * - * Create a domain for a child account - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\AddChildDomain $addChildDomain Sender domain to add for a specific child account. This will not be displayed to the parent account. (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function createChildDomain($childIdentifier, $addChildDomain) - { - $this->createChildDomainWithHttpInfo($childIdentifier, $addChildDomain); - } - - /** - * Operation createChildDomainWithHttpInfo - * - * Create a domain for a child account - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\AddChildDomain $addChildDomain Sender domain to add for a specific child account. This will not be displayed to the parent account. (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function createChildDomainWithHttpInfo($childIdentifier, $addChildDomain) - { - $returnType = ''; - $request = $this->createChildDomainRequest($childIdentifier, $addChildDomain); - - 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(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation createChildDomainAsync - * - * Create a domain for a child account - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\AddChildDomain $addChildDomain Sender domain to add for a specific child account. This will not be displayed to the parent account. (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createChildDomainAsync($childIdentifier, $addChildDomain) - { - return $this->createChildDomainAsyncWithHttpInfo($childIdentifier, $addChildDomain) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createChildDomainAsyncWithHttpInfo - * - * Create a domain for a child account - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\AddChildDomain $addChildDomain Sender domain to add for a specific child account. This will not be displayed to the parent account. (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createChildDomainAsyncWithHttpInfo($childIdentifier, $addChildDomain) - { - $returnType = ''; - $request = $this->createChildDomainRequest($childIdentifier, $addChildDomain); - - 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 'createChildDomain' - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\AddChildDomain $addChildDomain Sender domain to add for a specific child account. This will not be displayed to the parent account. (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function createChildDomainRequest($childIdentifier, $addChildDomain) - { - // verify the required parameter 'childIdentifier' is set - if ($childIdentifier === null || (is_array($childIdentifier) && count($childIdentifier) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $childIdentifier when calling createChildDomain' - ); - } - // verify the required parameter 'addChildDomain' is set - if ($addChildDomain === null || (is_array($addChildDomain) && count($addChildDomain) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $addChildDomain when calling createChildDomain' - ); - } - - $resourcePath = '/reseller/children/{childIdentifier}/domains'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($childIdentifier !== null) { - $resourcePath = str_replace( - '{' . 'childIdentifier' . '}', - ObjectSerializer::toPathValue($childIdentifier), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($addChildDomain)) { - $_tempBody = $addChildDomain; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation createResellerChild - * - * Creates a reseller child - * - * @param \Brevo\Client\Model\CreateChild $resellerChild reseller child to add (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreateReseller - */ - public function createResellerChild($resellerChild = null) - { - list($response) = $this->createResellerChildWithHttpInfo($resellerChild); - return $response; - } - - /** - * Operation createResellerChildWithHttpInfo - * - * Creates a reseller child - * - * @param \Brevo\Client\Model\CreateChild $resellerChild reseller child to add (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreateReseller, HTTP status code, HTTP response headers (array of strings) - */ - public function createResellerChildWithHttpInfo($resellerChild = null) - { - $returnType = '\Brevo\Client\Model\CreateReseller'; - $request = $this->createResellerChildRequest($resellerChild); - - 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(), - '\Brevo\Client\Model\CreateReseller', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation createResellerChildAsync - * - * Creates a reseller child - * - * @param \Brevo\Client\Model\CreateChild $resellerChild reseller child to add (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createResellerChildAsync($resellerChild = null) - { - return $this->createResellerChildAsyncWithHttpInfo($resellerChild) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createResellerChildAsyncWithHttpInfo - * - * Creates a reseller child - * - * @param \Brevo\Client\Model\CreateChild $resellerChild reseller child to add (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createResellerChildAsyncWithHttpInfo($resellerChild = null) - { - $returnType = '\Brevo\Client\Model\CreateReseller'; - $request = $this->createResellerChildRequest($resellerChild); - - 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 'createResellerChild' - * - * @param \Brevo\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; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation deleteChildDomain - * - * Delete the sender domain of the reseller child based on the childIdentifier and domainName passed - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param string $domainName Pass the existing domain that needs to be deleted (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function deleteChildDomain($childIdentifier, $domainName) - { - $this->deleteChildDomainWithHttpInfo($childIdentifier, $domainName); - } - - /** - * Operation deleteChildDomainWithHttpInfo - * - * Delete the sender domain of the reseller child based on the childIdentifier and domainName passed - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param string $domainName Pass the existing domain that needs to be deleted (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function deleteChildDomainWithHttpInfo($childIdentifier, $domainName) - { - $returnType = ''; - $request = $this->deleteChildDomainRequest($childIdentifier, $domainName); - - 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 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deleteChildDomainAsync - * - * Delete the sender domain of the reseller child based on the childIdentifier and domainName passed - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param string $domainName Pass the existing domain that needs to be deleted (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteChildDomainAsync($childIdentifier, $domainName) - { - return $this->deleteChildDomainAsyncWithHttpInfo($childIdentifier, $domainName) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deleteChildDomainAsyncWithHttpInfo - * - * Delete the sender domain of the reseller child based on the childIdentifier and domainName passed - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param string $domainName Pass the existing domain that needs to be deleted (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteChildDomainAsyncWithHttpInfo($childIdentifier, $domainName) - { - $returnType = ''; - $request = $this->deleteChildDomainRequest($childIdentifier, $domainName); - - 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 'deleteChildDomain' - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param string $domainName Pass the existing domain that needs to be deleted (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function deleteChildDomainRequest($childIdentifier, $domainName) - { - // verify the required parameter 'childIdentifier' is set - if ($childIdentifier === null || (is_array($childIdentifier) && count($childIdentifier) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $childIdentifier when calling deleteChildDomain' - ); - } - // verify the required parameter 'domainName' is set - if ($domainName === null || (is_array($domainName) && count($domainName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $domainName when calling deleteChildDomain' - ); - } - - $resourcePath = '/reseller/children/{childIdentifier}/domains/{domainName}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($childIdentifier !== null) { - $resourcePath = str_replace( - '{' . 'childIdentifier' . '}', - ObjectSerializer::toPathValue($childIdentifier), - $resourcePath - ); - } - // path params - if ($domainName !== null) { - $resourcePath = str_replace( - '{' . 'domainName' . '}', - ObjectSerializer::toPathValue($domainName), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation deleteResellerChild - * - * Delete a single reseller child based on the child identifier supplied - * - * @param string $childIdentifier Either auth key or child id of reseller's child (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function deleteResellerChild($childIdentifier) - { - $this->deleteResellerChildWithHttpInfo($childIdentifier); - } - - /** - * Operation deleteResellerChildWithHttpInfo - * - * Delete a single reseller child based on the child identifier supplied - * - * @param string $childIdentifier Either auth key or child id of reseller's child (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function deleteResellerChildWithHttpInfo($childIdentifier) - { - $returnType = ''; - $request = $this->deleteResellerChildRequest($childIdentifier); - - 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 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deleteResellerChildAsync - * - * Delete a single reseller child based on the child identifier supplied - * - * @param string $childIdentifier Either auth key or child id of reseller's child (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteResellerChildAsync($childIdentifier) - { - return $this->deleteResellerChildAsyncWithHttpInfo($childIdentifier) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deleteResellerChildAsyncWithHttpInfo - * - * Delete a single reseller child based on the child identifier supplied - * - * @param string $childIdentifier Either auth key or child id of reseller's child (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteResellerChildAsyncWithHttpInfo($childIdentifier) - { - $returnType = ''; - $request = $this->deleteResellerChildRequest($childIdentifier); - - 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 $childIdentifier Either auth key or child id of reseller's child (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function deleteResellerChildRequest($childIdentifier) - { - // verify the required parameter 'childIdentifier' is set - if ($childIdentifier === null || (is_array($childIdentifier) && count($childIdentifier) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $childIdentifier when calling deleteResellerChild' - ); - } - - $resourcePath = '/reseller/children/{childIdentifier}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($childIdentifier !== null) { - $resourcePath = str_replace( - '{' . 'childIdentifier' . '}', - ObjectSerializer::toPathValue($childIdentifier), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation dissociateIpFromChild - * - * Dissociate a dedicated IP to the child - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\ManageIp $ip IP to dissociate (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function dissociateIpFromChild($childIdentifier, $ip) - { - $this->dissociateIpFromChildWithHttpInfo($childIdentifier, $ip); - } - - /** - * Operation dissociateIpFromChildWithHttpInfo - * - * Dissociate a dedicated IP to the child - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\ManageIp $ip IP to dissociate (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function dissociateIpFromChildWithHttpInfo($childIdentifier, $ip) - { - $returnType = ''; - $request = $this->dissociateIpFromChildRequest($childIdentifier, $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(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation dissociateIpFromChildAsync - * - * Dissociate a dedicated IP to the child - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\ManageIp $ip IP to dissociate (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dissociateIpFromChildAsync($childIdentifier, $ip) - { - return $this->dissociateIpFromChildAsyncWithHttpInfo($childIdentifier, $ip) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation dissociateIpFromChildAsyncWithHttpInfo - * - * Dissociate a dedicated IP to the child - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\ManageIp $ip IP to dissociate (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dissociateIpFromChildAsyncWithHttpInfo($childIdentifier, $ip) - { - $returnType = ''; - $request = $this->dissociateIpFromChildRequest($childIdentifier, $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 $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\ManageIp $ip IP to dissociate (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function dissociateIpFromChildRequest($childIdentifier, $ip) - { - // verify the required parameter 'childIdentifier' is set - if ($childIdentifier === null || (is_array($childIdentifier) && count($childIdentifier) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $childIdentifier when calling dissociateIpFromChild' - ); - } - // verify the required parameter 'ip' is set - if ($ip === null || (is_array($ip) && count($ip) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $ip when calling dissociateIpFromChild' - ); - } - - $resourcePath = '/reseller/children/{childIdentifier}/ips/dissociate'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($childIdentifier !== null) { - $resourcePath = str_replace( - '{' . 'childIdentifier' . '}', - ObjectSerializer::toPathValue($childIdentifier), - $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)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getChildAccountCreationStatus - * - * Get the status of a reseller's child account creation, whether it is successfully created (exists) or not based on the identifier supplied - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetChildAccountCreationStatus - */ - public function getChildAccountCreationStatus($childIdentifier) - { - list($response) = $this->getChildAccountCreationStatusWithHttpInfo($childIdentifier); - return $response; - } - - /** - * Operation getChildAccountCreationStatusWithHttpInfo - * - * Get the status of a reseller's child account creation, whether it is successfully created (exists) or not based on the identifier supplied - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetChildAccountCreationStatus, HTTP status code, HTTP response headers (array of strings) - */ - public function getChildAccountCreationStatusWithHttpInfo($childIdentifier) - { - $returnType = '\Brevo\Client\Model\GetChildAccountCreationStatus'; - $request = $this->getChildAccountCreationStatusRequest($childIdentifier); - - 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(), - '\Brevo\Client\Model\GetChildAccountCreationStatus', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getChildAccountCreationStatusAsync - * - * Get the status of a reseller's child account creation, whether it is successfully created (exists) or not based on the identifier supplied - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getChildAccountCreationStatusAsync($childIdentifier) - { - return $this->getChildAccountCreationStatusAsyncWithHttpInfo($childIdentifier) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getChildAccountCreationStatusAsyncWithHttpInfo - * - * Get the status of a reseller's child account creation, whether it is successfully created (exists) or not based on the identifier supplied - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getChildAccountCreationStatusAsyncWithHttpInfo($childIdentifier) - { - $returnType = '\Brevo\Client\Model\GetChildAccountCreationStatus'; - $request = $this->getChildAccountCreationStatusRequest($childIdentifier); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getChildAccountCreationStatus' - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getChildAccountCreationStatusRequest($childIdentifier) - { - // verify the required parameter 'childIdentifier' is set - if ($childIdentifier === null || (is_array($childIdentifier) && count($childIdentifier) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $childIdentifier when calling getChildAccountCreationStatus' - ); - } - - $resourcePath = '/reseller/children/{childIdentifier}/accountCreationStatus'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($childIdentifier !== null) { - $resourcePath = str_replace( - '{' . 'childIdentifier' . '}', - ObjectSerializer::toPathValue($childIdentifier), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getChildDomains - * - * Get all sender domains for a specific child account - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetChildDomains - */ - public function getChildDomains($childIdentifier) - { - list($response) = $this->getChildDomainsWithHttpInfo($childIdentifier); - return $response; - } - - /** - * Operation getChildDomainsWithHttpInfo - * - * Get all sender domains for a specific child account - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetChildDomains, HTTP status code, HTTP response headers (array of strings) - */ - public function getChildDomainsWithHttpInfo($childIdentifier) - { - $returnType = '\Brevo\Client\Model\GetChildDomains'; - $request = $this->getChildDomainsRequest($childIdentifier); - - 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(), - '\Brevo\Client\Model\GetChildDomains', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getChildDomainsAsync - * - * Get all sender domains for a specific child account - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getChildDomainsAsync($childIdentifier) - { - return $this->getChildDomainsAsyncWithHttpInfo($childIdentifier) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getChildDomainsAsyncWithHttpInfo - * - * Get all sender domains for a specific child account - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getChildDomainsAsyncWithHttpInfo($childIdentifier) - { - $returnType = '\Brevo\Client\Model\GetChildDomains'; - $request = $this->getChildDomainsRequest($childIdentifier); - - 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 'getChildDomains' - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getChildDomainsRequest($childIdentifier) - { - // verify the required parameter 'childIdentifier' is set - if ($childIdentifier === null || (is_array($childIdentifier) && count($childIdentifier) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $childIdentifier when calling getChildDomains' - ); - } - - $resourcePath = '/reseller/children/{childIdentifier}/domains'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($childIdentifier !== null) { - $resourcePath = str_replace( - '{' . 'childIdentifier' . '}', - ObjectSerializer::toPathValue($childIdentifier), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getChildInfo - * - * Get a child account's details - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetChildInfo - */ - public function getChildInfo($childIdentifier) - { - list($response) = $this->getChildInfoWithHttpInfo($childIdentifier); - return $response; - } - - /** - * Operation getChildInfoWithHttpInfo - * - * Get a child account's details - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetChildInfo, HTTP status code, HTTP response headers (array of strings) - */ - public function getChildInfoWithHttpInfo($childIdentifier) - { - $returnType = '\Brevo\Client\Model\GetChildInfo'; - $request = $this->getChildInfoRequest($childIdentifier); - - 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(), - '\Brevo\Client\Model\GetChildInfo', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getChildInfoAsync - * - * Get a child account's details - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getChildInfoAsync($childIdentifier) - { - return $this->getChildInfoAsyncWithHttpInfo($childIdentifier) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getChildInfoAsyncWithHttpInfo - * - * Get a child account's details - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getChildInfoAsyncWithHttpInfo($childIdentifier) - { - $returnType = '\Brevo\Client\Model\GetChildInfo'; - $request = $this->getChildInfoRequest($childIdentifier); - - 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 $childIdentifier Either auth key or id of reseller's child (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getChildInfoRequest($childIdentifier) - { - // verify the required parameter 'childIdentifier' is set - if ($childIdentifier === null || (is_array($childIdentifier) && count($childIdentifier) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $childIdentifier when calling getChildInfo' - ); - } - - $resourcePath = '/reseller/children/{childIdentifier}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($childIdentifier !== null) { - $resourcePath = str_replace( - '{' . 'childIdentifier' . '}', - ObjectSerializer::toPathValue($childIdentifier), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getResellerChilds - * - * Get the list of all children accounts - * - * @param int $limit Number of documents for child accounts information per page (optional, default to 10) - * @param int $offset Index of the first document in the page (optional, default to 0) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetChildrenList - */ - public function getResellerChilds($limit = '10', $offset = '0') - { - list($response) = $this->getResellerChildsWithHttpInfo($limit, $offset); - return $response; - } - - /** - * Operation getResellerChildsWithHttpInfo - * - * Get the list of all children accounts - * - * @param int $limit Number of documents for child accounts information per page (optional, default to 10) - * @param int $offset Index of the first document in the page (optional, default to 0) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetChildrenList, HTTP status code, HTTP response headers (array of strings) - */ - public function getResellerChildsWithHttpInfo($limit = '10', $offset = '0') - { - $returnType = '\Brevo\Client\Model\GetChildrenList'; - $request = $this->getResellerChildsRequest($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(), - '\Brevo\Client\Model\GetChildrenList', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getResellerChildsAsync - * - * Get the list of all children accounts - * - * @param int $limit Number of documents for child accounts information per page (optional, default to 10) - * @param int $offset Index of the first document in the page (optional, default to 0) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getResellerChildsAsync($limit = '10', $offset = '0') - { - return $this->getResellerChildsAsyncWithHttpInfo($limit, $offset) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getResellerChildsAsyncWithHttpInfo - * - * Get the list of all children accounts - * - * @param int $limit Number of documents for child accounts information per page (optional, default to 10) - * @param int $offset Index of the first document in the page (optional, default to 0) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getResellerChildsAsyncWithHttpInfo($limit = '10', $offset = '0') - { - $returnType = '\Brevo\Client\Model\GetChildrenList'; - $request = $this->getResellerChildsRequest($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 'getResellerChilds' - * - * @param int $limit Number of documents for child accounts information per page (optional, default to 10) - * @param int $offset Index of the first document in the page (optional, default to 0) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getResellerChildsRequest($limit = '10', $offset = '0') - { - if ($limit !== null && $limit > 20) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling ResellerApi.getResellerChilds, must be smaller than or equal to 20.'); - } - if ($limit !== null && $limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling ResellerApi.getResellerChilds, must be bigger than or equal to 0.'); - } - - - $resourcePath = '/reseller/children'; - $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); - } - - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getSsoToken - * - * Get session token to access Brevo (SSO) - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetSsoToken - */ - public function getSsoToken($childIdentifier) - { - list($response) = $this->getSsoTokenWithHttpInfo($childIdentifier); - return $response; - } - - /** - * Operation getSsoTokenWithHttpInfo - * - * Get session token to access Brevo (SSO) - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetSsoToken, HTTP status code, HTTP response headers (array of strings) - */ - public function getSsoTokenWithHttpInfo($childIdentifier) - { - $returnType = '\Brevo\Client\Model\GetSsoToken'; - $request = $this->getSsoTokenRequest($childIdentifier); - - 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(), - '\Brevo\Client\Model\GetSsoToken', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getSsoTokenAsync - * - * Get session token to access Brevo (SSO) - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getSsoTokenAsync($childIdentifier) - { - return $this->getSsoTokenAsyncWithHttpInfo($childIdentifier) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getSsoTokenAsyncWithHttpInfo - * - * Get session token to access Brevo (SSO) - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getSsoTokenAsyncWithHttpInfo($childIdentifier) - { - $returnType = '\Brevo\Client\Model\GetSsoToken'; - $request = $this->getSsoTokenRequest($childIdentifier); - - 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 'getSsoToken' - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getSsoTokenRequest($childIdentifier) - { - // verify the required parameter 'childIdentifier' is set - if ($childIdentifier === null || (is_array($childIdentifier) && count($childIdentifier) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $childIdentifier when calling getSsoToken' - ); - } - - $resourcePath = '/reseller/children/{childIdentifier}/auth'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($childIdentifier !== null) { - $resourcePath = str_replace( - '{' . 'childIdentifier' . '}', - ObjectSerializer::toPathValue($childIdentifier), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation removeCredits - * - * Remove Email and/or SMS credits from a specific child account - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\RemoveCredits $removeCredits Values to post to remove email or SMS credits from a specific child account (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\RemainingCreditModel - */ - public function removeCredits($childIdentifier, $removeCredits) - { - list($response) = $this->removeCreditsWithHttpInfo($childIdentifier, $removeCredits); - return $response; - } - - /** - * Operation removeCreditsWithHttpInfo - * - * Remove Email and/or SMS credits from a specific child account - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\RemoveCredits $removeCredits Values to post to remove email or SMS credits from a specific child account (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\RemainingCreditModel, HTTP status code, HTTP response headers (array of strings) - */ - public function removeCreditsWithHttpInfo($childIdentifier, $removeCredits) - { - $returnType = '\Brevo\Client\Model\RemainingCreditModel'; - $request = $this->removeCreditsRequest($childIdentifier, $removeCredits); - - 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(), - '\Brevo\Client\Model\RemainingCreditModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation removeCreditsAsync - * - * Remove Email and/or SMS credits from a specific child account - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\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 removeCreditsAsync($childIdentifier, $removeCredits) - { - return $this->removeCreditsAsyncWithHttpInfo($childIdentifier, $removeCredits) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation removeCreditsAsyncWithHttpInfo - * - * Remove Email and/or SMS credits from a specific child account - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\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 removeCreditsAsyncWithHttpInfo($childIdentifier, $removeCredits) - { - $returnType = '\Brevo\Client\Model\RemainingCreditModel'; - $request = $this->removeCreditsRequest($childIdentifier, $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 $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\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($childIdentifier, $removeCredits) - { - // verify the required parameter 'childIdentifier' is set - if ($childIdentifier === null || (is_array($childIdentifier) && count($childIdentifier) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $childIdentifier when calling removeCredits' - ); - } - // verify the required parameter 'removeCredits' is set - if ($removeCredits === null || (is_array($removeCredits) && count($removeCredits) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $removeCredits when calling removeCredits' - ); - } - - $resourcePath = '/reseller/children/{childIdentifier}/credits/remove'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($childIdentifier !== null) { - $resourcePath = str_replace( - '{' . 'childIdentifier' . '}', - ObjectSerializer::toPathValue($childIdentifier), - $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)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation updateChildAccountStatus - * - * Update info of reseller's child account status based on the childIdentifier supplied - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\UpdateChildAccountStatus $updateChildAccountStatus values to update in child account status (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function updateChildAccountStatus($childIdentifier, $updateChildAccountStatus) - { - $this->updateChildAccountStatusWithHttpInfo($childIdentifier, $updateChildAccountStatus); - } - - /** - * Operation updateChildAccountStatusWithHttpInfo - * - * Update info of reseller's child account status based on the childIdentifier supplied - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\UpdateChildAccountStatus $updateChildAccountStatus values to update in child account status (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function updateChildAccountStatusWithHttpInfo($childIdentifier, $updateChildAccountStatus) - { - $returnType = ''; - $request = $this->updateChildAccountStatusRequest($childIdentifier, $updateChildAccountStatus); - - 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 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation updateChildAccountStatusAsync - * - * Update info of reseller's child account status based on the childIdentifier supplied - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\UpdateChildAccountStatus $updateChildAccountStatus values to update in child account status (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateChildAccountStatusAsync($childIdentifier, $updateChildAccountStatus) - { - return $this->updateChildAccountStatusAsyncWithHttpInfo($childIdentifier, $updateChildAccountStatus) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateChildAccountStatusAsyncWithHttpInfo - * - * Update info of reseller's child account status based on the childIdentifier supplied - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\UpdateChildAccountStatus $updateChildAccountStatus values to update in child account status (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateChildAccountStatusAsyncWithHttpInfo($childIdentifier, $updateChildAccountStatus) - { - $returnType = ''; - $request = $this->updateChildAccountStatusRequest($childIdentifier, $updateChildAccountStatus); - - 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 'updateChildAccountStatus' - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\UpdateChildAccountStatus $updateChildAccountStatus values to update in child account status (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function updateChildAccountStatusRequest($childIdentifier, $updateChildAccountStatus) - { - // verify the required parameter 'childIdentifier' is set - if ($childIdentifier === null || (is_array($childIdentifier) && count($childIdentifier) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $childIdentifier when calling updateChildAccountStatus' - ); - } - // verify the required parameter 'updateChildAccountStatus' is set - if ($updateChildAccountStatus === null || (is_array($updateChildAccountStatus) && count($updateChildAccountStatus) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $updateChildAccountStatus when calling updateChildAccountStatus' - ); - } - - $resourcePath = '/reseller/children/{childIdentifier}/accountStatus'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($childIdentifier !== null) { - $resourcePath = str_replace( - '{' . 'childIdentifier' . '}', - ObjectSerializer::toPathValue($childIdentifier), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($updateChildAccountStatus)) { - $_tempBody = $updateChildAccountStatus; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation updateChildDomain - * - * Update the sender domain of reseller's child based on the childIdentifier and domainName passed - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param string $domainName Pass the existing domain that needs to be updated (required) - * @param \Brevo\Client\Model\UpdateChildDomain $updateChildDomain value to update for sender domain (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function updateChildDomain($childIdentifier, $domainName, $updateChildDomain) - { - $this->updateChildDomainWithHttpInfo($childIdentifier, $domainName, $updateChildDomain); - } - - /** - * Operation updateChildDomainWithHttpInfo - * - * Update the sender domain of reseller's child based on the childIdentifier and domainName passed - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param string $domainName Pass the existing domain that needs to be updated (required) - * @param \Brevo\Client\Model\UpdateChildDomain $updateChildDomain value to update for sender domain (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function updateChildDomainWithHttpInfo($childIdentifier, $domainName, $updateChildDomain) - { - $returnType = ''; - $request = $this->updateChildDomainRequest($childIdentifier, $domainName, $updateChildDomain); - - 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 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation updateChildDomainAsync - * - * Update the sender domain of reseller's child based on the childIdentifier and domainName passed - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param string $domainName Pass the existing domain that needs to be updated (required) - * @param \Brevo\Client\Model\UpdateChildDomain $updateChildDomain value to update for sender domain (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateChildDomainAsync($childIdentifier, $domainName, $updateChildDomain) - { - return $this->updateChildDomainAsyncWithHttpInfo($childIdentifier, $domainName, $updateChildDomain) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateChildDomainAsyncWithHttpInfo - * - * Update the sender domain of reseller's child based on the childIdentifier and domainName passed - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param string $domainName Pass the existing domain that needs to be updated (required) - * @param \Brevo\Client\Model\UpdateChildDomain $updateChildDomain value to update for sender domain (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateChildDomainAsyncWithHttpInfo($childIdentifier, $domainName, $updateChildDomain) - { - $returnType = ''; - $request = $this->updateChildDomainRequest($childIdentifier, $domainName, $updateChildDomain); - - 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 'updateChildDomain' - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param string $domainName Pass the existing domain that needs to be updated (required) - * @param \Brevo\Client\Model\UpdateChildDomain $updateChildDomain value to update for sender domain (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function updateChildDomainRequest($childIdentifier, $domainName, $updateChildDomain) - { - // verify the required parameter 'childIdentifier' is set - if ($childIdentifier === null || (is_array($childIdentifier) && count($childIdentifier) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $childIdentifier when calling updateChildDomain' - ); - } - // verify the required parameter 'domainName' is set - if ($domainName === null || (is_array($domainName) && count($domainName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $domainName when calling updateChildDomain' - ); - } - // verify the required parameter 'updateChildDomain' is set - if ($updateChildDomain === null || (is_array($updateChildDomain) && count($updateChildDomain) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $updateChildDomain when calling updateChildDomain' - ); - } - - $resourcePath = '/reseller/children/{childIdentifier}/domains/{domainName}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($childIdentifier !== null) { - $resourcePath = str_replace( - '{' . 'childIdentifier' . '}', - ObjectSerializer::toPathValue($childIdentifier), - $resourcePath - ); - } - // path params - if ($domainName !== null) { - $resourcePath = str_replace( - '{' . 'domainName' . '}', - ObjectSerializer::toPathValue($domainName), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($updateChildDomain)) { - $_tempBody = $updateChildDomain; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation updateResellerChild - * - * Update info of reseller's child based on the child identifier supplied - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\UpdateChild $resellerChild values to update in child profile (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function updateResellerChild($childIdentifier, $resellerChild) - { - $this->updateResellerChildWithHttpInfo($childIdentifier, $resellerChild); - } - - /** - * Operation updateResellerChildWithHttpInfo - * - * Update info of reseller's child based on the child identifier supplied - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\UpdateChild $resellerChild values to update in child profile (required) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function updateResellerChildWithHttpInfo($childIdentifier, $resellerChild) - { - $returnType = ''; - $request = $this->updateResellerChildRequest($childIdentifier, $resellerChild); - - 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 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation updateResellerChildAsync - * - * Update info of reseller's child based on the child identifier supplied - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\UpdateChild $resellerChild values to update in child profile (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateResellerChildAsync($childIdentifier, $resellerChild) - { - return $this->updateResellerChildAsyncWithHttpInfo($childIdentifier, $resellerChild) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateResellerChildAsyncWithHttpInfo - * - * Update info of reseller's child based on the child identifier supplied - * - * @param string $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\UpdateChild $resellerChild values to update in child profile (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateResellerChildAsyncWithHttpInfo($childIdentifier, $resellerChild) - { - $returnType = ''; - $request = $this->updateResellerChildRequest($childIdentifier, $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 $childIdentifier Either auth key or id of reseller's child (required) - * @param \Brevo\Client\Model\UpdateChild $resellerChild values to update in child profile (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function updateResellerChildRequest($childIdentifier, $resellerChild) - { - // verify the required parameter 'childIdentifier' is set - if ($childIdentifier === null || (is_array($childIdentifier) && count($childIdentifier) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $childIdentifier when calling updateResellerChild' - ); - } - // verify the required parameter 'resellerChild' is set - if ($resellerChild === null || (is_array($resellerChild) && count($resellerChild) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $resellerChild when calling updateResellerChild' - ); - } - - $resourcePath = '/reseller/children/{childIdentifier}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($childIdentifier !== null) { - $resourcePath = str_replace( - '{' . 'childIdentifier' . '}', - ObjectSerializer::toPathValue($childIdentifier), - $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)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($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/RewardsApi.php b/lib/Api/RewardsApi.php new file mode 100644 index 0000000..71a9426 --- /dev/null +++ b/lib/Api/RewardsApi.php @@ -0,0 +1,2699 @@ + [ + 'application/json', + ], + 'getOffersList' => [ + 'application/json', + ], + 'redeemReward' => [ + 'application/json', + ], + 'revokeReward' => [ + 'application/json', + ], + 'validateReward' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation attributeReward + * + * Attribute reward to a contact + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\AttributeRewardPayload $attributeRewardPayload Attribute reward information (One of contactId and loyaltySubscriptionId must be provided.) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attributeReward'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\RewardAttributionResponse|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\AttributedRewardFailedConditionErrorResponse|\Brevo\Client\Models\ContactIdInvalidResponse|\Brevo\Client\Models\ContactIdInvalidResponse + */ + public function attributeReward( + string $loyaltyProgramId, + \Brevo\Client\Models\AttributeRewardPayload $attributeRewardPayload, + string $contentType = self::contentTypes['attributeReward'][0] + ): \Brevo\Client\Models\RewardAttributionResponse + { + list($response) = $this->attributeRewardWithHttpInfo($loyaltyProgramId, $attributeRewardPayload, $contentType); + return $response; + } + + /** + * Operation attributeRewardWithHttpInfo + * + * Attribute reward to a contact + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\AttributeRewardPayload $attributeRewardPayload Attribute reward information (One of contactId and loyaltySubscriptionId must be provided.) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attributeReward'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\RewardAttributionResponse|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\AttributedRewardFailedConditionErrorResponse|\Brevo\Client\Models\ContactIdInvalidResponse|\Brevo\Client\Models\ContactIdInvalidResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function attributeRewardWithHttpInfo( + string $loyaltyProgramId, + \Brevo\Client\Models\AttributeRewardPayload $attributeRewardPayload, + string $contentType = self::contentTypes['attributeReward'][0] + ): array + { + $request = $this->attributeRewardRequest($loyaltyProgramId, $attributeRewardPayload, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\RewardAttributionResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\RewardAttributionResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\RewardAttributionResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 412: + if (in_array('\Brevo\Client\Models\AttributedRewardFailedConditionErrorResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\AttributedRewardFailedConditionErrorResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\AttributedRewardFailedConditionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ContactIdInvalidResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ContactIdInvalidResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ContactIdInvalidResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 424: + if (in_array('\Brevo\Client\Models\ContactIdInvalidResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ContactIdInvalidResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ContactIdInvalidResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\RewardAttributionResponse'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\RewardAttributionResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 412: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\AttributedRewardFailedConditionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 424: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation attributeRewardAsync + * + * Attribute reward to a contact + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\AttributeRewardPayload $attributeRewardPayload Attribute reward information (One of contactId and loyaltySubscriptionId must be provided.) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attributeReward'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function attributeRewardAsync( + string $loyaltyProgramId, + \Brevo\Client\Models\AttributeRewardPayload $attributeRewardPayload, + string $contentType = self::contentTypes['attributeReward'][0] + ): PromiseInterface + { + return $this->attributeRewardAsyncWithHttpInfo($loyaltyProgramId, $attributeRewardPayload, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation attributeRewardAsyncWithHttpInfo + * + * Attribute reward to a contact + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\AttributeRewardPayload $attributeRewardPayload Attribute reward information (One of contactId and loyaltySubscriptionId must be provided.) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attributeReward'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function attributeRewardAsyncWithHttpInfo( + $loyaltyProgramId, + $attributeRewardPayload, + string $contentType = self::contentTypes['attributeReward'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\RewardAttributionResponse'; + $request = $this->attributeRewardRequest($loyaltyProgramId, $attributeRewardPayload, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'attributeReward' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\AttributeRewardPayload $attributeRewardPayload Attribute reward information (One of contactId and loyaltySubscriptionId must be provided.) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attributeReward'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function attributeRewardRequest( + $loyaltyProgramId, + $attributeRewardPayload, + string $contentType = self::contentTypes['attributeReward'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling attributeReward' + ); + } + + // verify the required parameter 'attributeRewardPayload' is set + if ($attributeRewardPayload === null || (is_array($attributeRewardPayload) && count($attributeRewardPayload) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $attributeRewardPayload when calling attributeReward' + ); + } + + + $resourcePath = '/loyalty/offer/programs/{loyaltyProgramId}/rewards/attribute'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($attributeRewardPayload)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($attributeRewardPayload)); + } else { + $httpBody = $attributeRewardPayload; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getOffersList + * + * Get Reward list + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param int|null $limit Number of documents per page (optional, default to 100) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $rewardState State of the reward (optional, default to 'all') + * @param string|null $rewardVersion Select 'active' to retrieve list of all rewards which are live for clients. Select draft to retrieve list of all non deleted rewards. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOffersList'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\OffersListResponse|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ContactIdInvalidResponse + */ + public function getOffersList( + string $loyaltyProgramId, + ?int $limit = 100, + ?int $offset = 0, + ?string $rewardState = 'all', + ?string $rewardVersion = 'draft', + string $contentType = self::contentTypes['getOffersList'][0] + ): \Brevo\Client\Models\OffersListResponse + { + list($response) = $this->getOffersListWithHttpInfo($loyaltyProgramId, $limit, $offset, $rewardState, $rewardVersion, $contentType); + return $response; + } + + /** + * Operation getOffersListWithHttpInfo + * + * Get Reward list + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param int|null $limit Number of documents per page (optional, default to 100) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $rewardState State of the reward (optional, default to 'all') + * @param string|null $rewardVersion Select 'active' to retrieve list of all rewards which are live for clients. Select draft to retrieve list of all non deleted rewards. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOffersList'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\OffersListResponse|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ContactIdInvalidResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getOffersListWithHttpInfo( + string $loyaltyProgramId, + ?int $limit = 100, + ?int $offset = 0, + ?string $rewardState = 'all', + ?string $rewardVersion = 'draft', + string $contentType = self::contentTypes['getOffersList'][0] + ): array + { + $request = $this->getOffersListRequest($loyaltyProgramId, $limit, $offset, $rewardState, $rewardVersion, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\OffersListResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\OffersListResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\OffersListResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ContactIdInvalidResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ContactIdInvalidResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ContactIdInvalidResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\OffersListResponse'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\OffersListResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getOffersListAsync + * + * Get Reward list + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param int|null $limit Number of documents per page (optional, default to 100) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $rewardState State of the reward (optional, default to 'all') + * @param string|null $rewardVersion Select 'active' to retrieve list of all rewards which are live for clients. Select draft to retrieve list of all non deleted rewards. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOffersList'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getOffersListAsync( + string $loyaltyProgramId, + ?int $limit = 100, + ?int $offset = 0, + ?string $rewardState = 'all', + ?string $rewardVersion = 'draft', + string $contentType = self::contentTypes['getOffersList'][0] + ): PromiseInterface + { + return $this->getOffersListAsyncWithHttpInfo($loyaltyProgramId, $limit, $offset, $rewardState, $rewardVersion, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getOffersListAsyncWithHttpInfo + * + * Get Reward list + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param int|null $limit Number of documents per page (optional, default to 100) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $rewardState State of the reward (optional, default to 'all') + * @param string|null $rewardVersion Select 'active' to retrieve list of all rewards which are live for clients. Select draft to retrieve list of all non deleted rewards. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOffersList'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getOffersListAsyncWithHttpInfo( + $loyaltyProgramId, + $limit = 100, + $offset = 0, + $rewardState = 'all', + $rewardVersion = 'draft', + string $contentType = self::contentTypes['getOffersList'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\OffersListResponse'; + $request = $this->getOffersListRequest($loyaltyProgramId, $limit, $offset, $rewardState, $rewardVersion, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getOffersList' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param int|null $limit Number of documents per page (optional, default to 100) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $rewardState State of the reward (optional, default to 'all') + * @param string|null $rewardVersion Select 'active' to retrieve list of all rewards which are live for clients. Select draft to retrieve list of all non deleted rewards. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOffersList'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getOffersListRequest( + $loyaltyProgramId, + $limit = 100, + $offset = 0, + $rewardState = 'all', + $rewardVersion = 'draft', + string $contentType = self::contentTypes['getOffersList'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling getOffersList' + ); + } + + + + + + + $resourcePath = '/loyalty/offer/programs/{loyaltyProgramId}/offers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $rewardState, + 'rewardState', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $rewardVersion, + 'rewardVersion', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation redeemReward + * + * Redeem reward + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\RedeemRewardPayload $redeemRewardPayload Redeemed reward information (Either contactId or loyaltySubscriptionId must be present.) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemReward'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\RewardRedeemResponse|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\SubscriptionNotFoundErrorResponse|\Brevo\Client\Models\RedeemedRewardFailedConditionErrorResponse|\Brevo\Client\Models\ContactIdInvalidResponse + */ + public function redeemReward( + string $loyaltyProgramId, + \Brevo\Client\Models\RedeemRewardPayload $redeemRewardPayload, + string $contentType = self::contentTypes['redeemReward'][0] + ): \Brevo\Client\Models\RewardRedeemResponse + { + list($response) = $this->redeemRewardWithHttpInfo($loyaltyProgramId, $redeemRewardPayload, $contentType); + return $response; + } + + /** + * Operation redeemRewardWithHttpInfo + * + * Redeem reward + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\RedeemRewardPayload $redeemRewardPayload Redeemed reward information (Either contactId or loyaltySubscriptionId must be present.) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemReward'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\RewardRedeemResponse|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\SubscriptionNotFoundErrorResponse|\Brevo\Client\Models\RedeemedRewardFailedConditionErrorResponse|\Brevo\Client\Models\ContactIdInvalidResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function redeemRewardWithHttpInfo( + string $loyaltyProgramId, + \Brevo\Client\Models\RedeemRewardPayload $redeemRewardPayload, + string $contentType = self::contentTypes['redeemReward'][0] + ): array + { + $request = $this->redeemRewardRequest($loyaltyProgramId, $redeemRewardPayload, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\RewardRedeemResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\RewardRedeemResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\RewardRedeemResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\SubscriptionNotFoundErrorResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\SubscriptionNotFoundErrorResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\SubscriptionNotFoundErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 412: + if (in_array('\Brevo\Client\Models\RedeemedRewardFailedConditionErrorResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\RedeemedRewardFailedConditionErrorResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\RedeemedRewardFailedConditionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ContactIdInvalidResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ContactIdInvalidResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ContactIdInvalidResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\RewardRedeemResponse'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\RewardRedeemResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\SubscriptionNotFoundErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 412: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\RedeemedRewardFailedConditionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation redeemRewardAsync + * + * Redeem reward + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\RedeemRewardPayload $redeemRewardPayload Redeemed reward information (Either contactId or loyaltySubscriptionId must be present.) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemReward'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function redeemRewardAsync( + string $loyaltyProgramId, + \Brevo\Client\Models\RedeemRewardPayload $redeemRewardPayload, + string $contentType = self::contentTypes['redeemReward'][0] + ): PromiseInterface + { + return $this->redeemRewardAsyncWithHttpInfo($loyaltyProgramId, $redeemRewardPayload, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation redeemRewardAsyncWithHttpInfo + * + * Redeem reward + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\RedeemRewardPayload $redeemRewardPayload Redeemed reward information (Either contactId or loyaltySubscriptionId must be present.) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemReward'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function redeemRewardAsyncWithHttpInfo( + $loyaltyProgramId, + $redeemRewardPayload, + string $contentType = self::contentTypes['redeemReward'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\RewardRedeemResponse'; + $request = $this->redeemRewardRequest($loyaltyProgramId, $redeemRewardPayload, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'redeemReward' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\RedeemRewardPayload $redeemRewardPayload Redeemed reward information (Either contactId or loyaltySubscriptionId must be present.) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemReward'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function redeemRewardRequest( + $loyaltyProgramId, + $redeemRewardPayload, + string $contentType = self::contentTypes['redeemReward'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling redeemReward' + ); + } + + // verify the required parameter 'redeemRewardPayload' is set + if ($redeemRewardPayload === null || (is_array($redeemRewardPayload) && count($redeemRewardPayload) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $redeemRewardPayload when calling redeemReward' + ); + } + + + $resourcePath = '/loyalty/offer/programs/{loyaltyProgramId}/rewards/redeem'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($redeemRewardPayload)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($redeemRewardPayload)); + } else { + $httpBody = $redeemRewardPayload; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation revokeReward + * + * Revoke reward + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $attributedRewardId Attributed Reward Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['revokeReward'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return void + */ + public function revokeReward( + string $loyaltyProgramId, + string $attributedRewardId, + string $contentType = self::contentTypes['revokeReward'][0] + ): void + { + $this->revokeRewardWithHttpInfo($loyaltyProgramId, $attributedRewardId, $contentType); + } + + /** + * Operation revokeRewardWithHttpInfo + * + * Revoke reward + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $attributedRewardId Attributed Reward Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['revokeReward'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function revokeRewardWithHttpInfo( + string $loyaltyProgramId, + string $attributedRewardId, + string $contentType = self::contentTypes['revokeReward'][0] + ): array + { + $request = $this->revokeRewardRequest($loyaltyProgramId, $attributedRewardId, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation revokeRewardAsync + * + * Revoke reward + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $attributedRewardId Attributed Reward Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['revokeReward'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function revokeRewardAsync( + string $loyaltyProgramId, + string $attributedRewardId, + string $contentType = self::contentTypes['revokeReward'][0] + ): PromiseInterface + { + return $this->revokeRewardAsyncWithHttpInfo($loyaltyProgramId, $attributedRewardId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation revokeRewardAsyncWithHttpInfo + * + * Revoke reward + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $attributedRewardId Attributed Reward Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['revokeReward'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function revokeRewardAsyncWithHttpInfo( + $loyaltyProgramId, + $attributedRewardId, + string $contentType = self::contentTypes['revokeReward'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->revokeRewardRequest($loyaltyProgramId, $attributedRewardId, $contentType); + + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'revokeReward' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $attributedRewardId Attributed Reward Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['revokeReward'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function revokeRewardRequest( + $loyaltyProgramId, + $attributedRewardId, + string $contentType = self::contentTypes['revokeReward'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling revokeReward' + ); + } + + // verify the required parameter 'attributedRewardId' is set + if ($attributedRewardId === null || (is_array($attributedRewardId) && count($attributedRewardId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $attributedRewardId when calling revokeReward' + ); + } + + + $resourcePath = '/loyalty/offer/programs/{loyaltyProgramId}/rewards/revoke'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $attributedRewardId, + 'attributedRewardId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation validateReward + * + * Validates a voucher + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\ValidateRewardPayload $validateRewardPayload Validate reward information (One of contactId and loyaltySubscriptionId must be present, or one of code and attributedRewardId must be present.) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateReward'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\ValidatedRewardResponse|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\SubscriptionNotFoundErrorResponse|\Brevo\Client\Models\ContactIdInvalidResponse|\Brevo\Client\Models\ContactIdInvalidResponse + */ + public function validateReward( + string $loyaltyProgramId, + \Brevo\Client\Models\ValidateRewardPayload $validateRewardPayload, + string $contentType = self::contentTypes['validateReward'][0] + ): \Brevo\Client\Models\ValidatedRewardResponse + { + list($response) = $this->validateRewardWithHttpInfo($loyaltyProgramId, $validateRewardPayload, $contentType); + return $response; + } + + /** + * Operation validateRewardWithHttpInfo + * + * Validates a voucher + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\ValidateRewardPayload $validateRewardPayload Validate reward information (One of contactId and loyaltySubscriptionId must be present, or one of code and attributedRewardId must be present.) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateReward'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\ValidatedRewardResponse|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\SubscriptionNotFoundErrorResponse|\Brevo\Client\Models\ContactIdInvalidResponse|\Brevo\Client\Models\ContactIdInvalidResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function validateRewardWithHttpInfo( + string $loyaltyProgramId, + \Brevo\Client\Models\ValidateRewardPayload $validateRewardPayload, + string $contentType = self::contentTypes['validateReward'][0] + ): array + { + $request = $this->validateRewardRequest($loyaltyProgramId, $validateRewardPayload, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\ValidatedRewardResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ValidatedRewardResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ValidatedRewardResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\SubscriptionNotFoundErrorResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\SubscriptionNotFoundErrorResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\SubscriptionNotFoundErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ContactIdInvalidResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ContactIdInvalidResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ContactIdInvalidResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 424: + if (in_array('\Brevo\Client\Models\ContactIdInvalidResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ContactIdInvalidResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ContactIdInvalidResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\ValidatedRewardResponse'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ValidatedRewardResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\SubscriptionNotFoundErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 424: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ContactIdInvalidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation validateRewardAsync + * + * Validates a voucher + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\ValidateRewardPayload $validateRewardPayload Validate reward information (One of contactId and loyaltySubscriptionId must be present, or one of code and attributedRewardId must be present.) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateReward'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function validateRewardAsync( + string $loyaltyProgramId, + \Brevo\Client\Models\ValidateRewardPayload $validateRewardPayload, + string $contentType = self::contentTypes['validateReward'][0] + ): PromiseInterface + { + return $this->validateRewardAsyncWithHttpInfo($loyaltyProgramId, $validateRewardPayload, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation validateRewardAsyncWithHttpInfo + * + * Validates a voucher + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\ValidateRewardPayload $validateRewardPayload Validate reward information (One of contactId and loyaltySubscriptionId must be present, or one of code and attributedRewardId must be present.) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateReward'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function validateRewardAsyncWithHttpInfo( + $loyaltyProgramId, + $validateRewardPayload, + string $contentType = self::contentTypes['validateReward'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\ValidatedRewardResponse'; + $request = $this->validateRewardRequest($loyaltyProgramId, $validateRewardPayload, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'validateReward' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\ValidateRewardPayload $validateRewardPayload Validate reward information (One of contactId and loyaltySubscriptionId must be present, or one of code and attributedRewardId must be present.) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateReward'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function validateRewardRequest( + $loyaltyProgramId, + $validateRewardPayload, + string $contentType = self::contentTypes['validateReward'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling validateReward' + ); + } + + // verify the required parameter 'validateRewardPayload' is set + if ($validateRewardPayload === null || (is_array($validateRewardPayload) && count($validateRewardPayload) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $validateRewardPayload when calling validateReward' + ); + } + + + $resourcePath = '/loyalty/offer/programs/{loyaltyProgramId}/rewards/validate'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($validateRewardPayload)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($validateRewardPayload)); + } else { + $httpBody = $validateRewardPayload; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $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 f01c678..901346e 100644 --- a/lib/Api/SMSCampaignsApi.php +++ b/lib/Api/SMSCampaignsApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'deleteSmsCampaign' => [ + 'application/json', + ], + 'getSmsCampaign' => [ + 'application/json', + ], + 'getSmsCampaigns' => [ + 'application/json', + ], + 'requestSmsRecipientExport' => [ + 'application/json', + ], + 'sendSmsCampaignNow' => [ + 'application/json', + ], + 'sendSmsReport' => [ + 'application/json', + ], + 'sendTestSms' => [ + 'application/json', + ], + 'updateSmsCampaign' => [ + 'application/json', + ], + 'updateSmsCampaignStatus' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -92,15 +155,19 @@ public function getConfig() * * Creates an SMS campaign * - * @param \Brevo\Client\Model\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required) + * @param \Brevo\Client\Models\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSmsCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreateModel + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateModel|\Brevo\Client\Models\ErrorModel */ - public function createSmsCampaign($createSmsCampaign) + public function createSmsCampaign( + \Brevo\Client\Models\CreateSmsCampaign $createSmsCampaign, + string $contentType = self::contentTypes['createSmsCampaign'][0] + ): \Brevo\Client\Models\CreateModel { - list($response) = $this->createSmsCampaignWithHttpInfo($createSmsCampaign); + list($response) = $this->createSmsCampaignWithHttpInfo($createSmsCampaign, $contentType); return $response; } @@ -109,16 +176,19 @@ public function createSmsCampaign($createSmsCampaign) * * Creates an SMS campaign * - * @param \Brevo\Client\Model\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required) + * @param \Brevo\Client\Models\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSmsCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function createSmsCampaignWithHttpInfo($createSmsCampaign) + public function createSmsCampaignWithHttpInfo( + \Brevo\Client\Models\CreateSmsCampaign $createSmsCampaign, + string $contentType = self::contentTypes['createSmsCampaign'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreateModel'; - $request = $this->createSmsCampaignRequest($createSmsCampaign); + $request = $this->createSmsCampaignRequest($createSmsCampaign, $contentType); try { $options = $this->createHttpClientOption(); @@ -127,34 +197,111 @@ public function createSmsCampaignWithHttpInfo($createSmsCampaign) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreateModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreateModel'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -169,7 +316,7 @@ public function createSmsCampaignWithHttpInfo($createSmsCampaign) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreateModel', + '\Brevo\Client\Models\CreateModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -177,7 +324,7 @@ public function createSmsCampaignWithHttpInfo($createSmsCampaign) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -192,14 +339,18 @@ public function createSmsCampaignWithHttpInfo($createSmsCampaign) * * Creates an SMS campaign * - * @param \Brevo\Client\Model\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required) + * @param \Brevo\Client\Models\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSmsCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createSmsCampaignAsync($createSmsCampaign) + public function createSmsCampaignAsync( + \Brevo\Client\Models\CreateSmsCampaign $createSmsCampaign, + string $contentType = self::contentTypes['createSmsCampaign'][0] + ): PromiseInterface { - return $this->createSmsCampaignAsyncWithHttpInfo($createSmsCampaign) + return $this->createSmsCampaignAsyncWithHttpInfo($createSmsCampaign, $contentType) ->then( function ($response) { return $response[0]; @@ -212,25 +363,29 @@ function ($response) { * * Creates an SMS campaign * - * @param \Brevo\Client\Model\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required) + * @param \Brevo\Client\Models\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSmsCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createSmsCampaignAsyncWithHttpInfo($createSmsCampaign) + public function createSmsCampaignAsyncWithHttpInfo( + $createSmsCampaign, + string $contentType = self::contentTypes['createSmsCampaign'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreateModel'; - $request = $this->createSmsCampaignRequest($createSmsCampaign); + $returnType = '\Brevo\Client\Models\CreateModel'; + $request = $this->createSmsCampaignRequest($createSmsCampaign, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -253,7 +408,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -262,20 +417,26 @@ function ($exception) { /** * Create request for operation 'createSmsCampaign' * - * @param \Brevo\Client\Model\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required) + * @param \Brevo\Client\Models\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSmsCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createSmsCampaignRequest($createSmsCampaign) + public function createSmsCampaignRequest( + $createSmsCampaign, + string $contentType = self::contentTypes['createSmsCampaign'][0] + ): Request { + // verify the required parameter 'createSmsCampaign' is set if ($createSmsCampaign === null || (is_array($createSmsCampaign) && count($createSmsCampaign) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $createSmsCampaign when calling createSmsCampaign' ); } + $resourcePath = '/smsCampaigns'; $formParams = []; $queryParams = []; @@ -285,56 +446,43 @@ protected function createSmsCampaignRequest($createSmsCampaign) - // body params - $_tempBody = null; - if (isset($createSmsCampaign)) { - $_tempBody = $createSmsCampaign; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($createSmsCampaign)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createSmsCampaign)); + } else { + $httpBody = $createSmsCampaign; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -360,10 +508,11 @@ protected function createSmsCampaignRequest($createSmsCampaign) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -375,14 +524,18 @@ protected function createSmsCampaignRequest($createSmsCampaign) * Delete an SMS campaign * * @param int $campaignId id of the SMS campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function deleteSmsCampaign($campaignId) + public function deleteSmsCampaign( + int $campaignId, + string $contentType = self::contentTypes['deleteSmsCampaign'][0] + ): void { - $this->deleteSmsCampaignWithHttpInfo($campaignId); + $this->deleteSmsCampaignWithHttpInfo($campaignId, $contentType); } /** @@ -391,15 +544,18 @@ public function deleteSmsCampaign($campaignId) * Delete an SMS campaign * * @param int $campaignId id of the SMS campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteSmsCampaignWithHttpInfo($campaignId) + public function deleteSmsCampaignWithHttpInfo( + int $campaignId, + string $contentType = self::contentTypes['deleteSmsCampaign'][0] + ): array { - $returnType = ''; - $request = $this->deleteSmsCampaignRequest($campaignId); + $request = $this->deleteSmsCampaignRequest($campaignId, $contentType); try { $options = $this->createHttpClientOption(); @@ -408,43 +564,38 @@ public function deleteSmsCampaignWithHttpInfo($campaignId) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -460,13 +611,17 @@ public function deleteSmsCampaignWithHttpInfo($campaignId) * Delete an SMS campaign * * @param int $campaignId id of the SMS campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteSmsCampaignAsync($campaignId) + public function deleteSmsCampaignAsync( + int $campaignId, + string $contentType = self::contentTypes['deleteSmsCampaign'][0] + ): PromiseInterface { - return $this->deleteSmsCampaignAsyncWithHttpInfo($campaignId) + return $this->deleteSmsCampaignAsyncWithHttpInfo($campaignId, $contentType) ->then( function ($response) { return $response[0]; @@ -480,14 +635,19 @@ function ($response) { * Delete an SMS campaign * * @param int $campaignId id of the SMS campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteSmsCampaignAsyncWithHttpInfo($campaignId) + public function deleteSmsCampaignAsyncWithHttpInfo( + $campaignId, + string $contentType = self::contentTypes['deleteSmsCampaign'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->deleteSmsCampaignRequest($campaignId); + $request = $this->deleteSmsCampaignRequest($campaignId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -506,7 +666,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -516,19 +676,25 @@ function ($exception) { * Create request for operation 'deleteSmsCampaign' * * @param int $campaignId id of the SMS campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function deleteSmsCampaignRequest($campaignId) + public function deleteSmsCampaignRequest( + $campaignId, + string $contentType = self::contentTypes['deleteSmsCampaign'][0] + ): Request { + // verify the required parameter 'campaignId' is set if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $campaignId when calling deleteSmsCampaign' ); } + $resourcePath = '/smsCampaigns/{campaignId}'; $formParams = []; $queryParams = []; @@ -537,6 +703,7 @@ protected function deleteSmsCampaignRequest($campaignId) $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( @@ -546,53 +713,35 @@ protected function deleteSmsCampaignRequest($campaignId) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -618,10 +767,11 @@ protected function deleteSmsCampaignRequest($campaignId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -633,14 +783,18 @@ protected function deleteSmsCampaignRequest($campaignId) * Get an SMS campaign * * @param int $campaignId id of the SMS campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetSmsCampaign + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetSmsCampaign|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function getSmsCampaign($campaignId) + public function getSmsCampaign( + int $campaignId, + string $contentType = self::contentTypes['getSmsCampaign'][0] + ): \Brevo\Client\Models\GetSmsCampaign { - list($response) = $this->getSmsCampaignWithHttpInfo($campaignId); + list($response) = $this->getSmsCampaignWithHttpInfo($campaignId, $contentType); return $response; } @@ -650,15 +804,18 @@ public function getSmsCampaign($campaignId) * Get an SMS campaign * * @param int $campaignId id of the SMS campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetSmsCampaign, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetSmsCampaign|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getSmsCampaignWithHttpInfo($campaignId) + public function getSmsCampaignWithHttpInfo( + int $campaignId, + string $contentType = self::contentTypes['getSmsCampaign'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetSmsCampaign'; - $request = $this->getSmsCampaignRequest($campaignId); + $request = $this->getSmsCampaignRequest($campaignId, $contentType); try { $options = $this->createHttpClientOption(); @@ -667,34 +824,138 @@ public function getSmsCampaignWithHttpInfo($campaignId) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetSmsCampaign', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetSmsCampaign' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetSmsCampaign', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetSmsCampaign'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -709,7 +970,7 @@ public function getSmsCampaignWithHttpInfo($campaignId) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetSmsCampaign', + '\Brevo\Client\Models\GetSmsCampaign', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -717,7 +978,7 @@ public function getSmsCampaignWithHttpInfo($campaignId) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -725,7 +986,7 @@ public function getSmsCampaignWithHttpInfo($campaignId) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -741,13 +1002,17 @@ public function getSmsCampaignWithHttpInfo($campaignId) * Get an SMS campaign * * @param int $campaignId id of the SMS campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getSmsCampaignAsync($campaignId) + public function getSmsCampaignAsync( + int $campaignId, + string $contentType = self::contentTypes['getSmsCampaign'][0] + ): PromiseInterface { - return $this->getSmsCampaignAsyncWithHttpInfo($campaignId) + return $this->getSmsCampaignAsyncWithHttpInfo($campaignId, $contentType) ->then( function ($response) { return $response[0]; @@ -761,24 +1026,28 @@ function ($response) { * Get an SMS campaign * * @param int $campaignId id of the SMS campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getSmsCampaignAsyncWithHttpInfo($campaignId) + public function getSmsCampaignAsyncWithHttpInfo( + $campaignId, + string $contentType = self::contentTypes['getSmsCampaign'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetSmsCampaign'; - $request = $this->getSmsCampaignRequest($campaignId); + $returnType = '\Brevo\Client\Models\GetSmsCampaign'; + $request = $this->getSmsCampaignRequest($campaignId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -801,7 +1070,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -811,19 +1080,25 @@ function ($exception) { * Create request for operation 'getSmsCampaign' * * @param int $campaignId id of the SMS campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getSmsCampaignRequest($campaignId) + public function getSmsCampaignRequest( + $campaignId, + string $contentType = self::contentTypes['getSmsCampaign'][0] + ): Request { + // verify the required parameter 'campaignId' is set if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $campaignId when calling getSmsCampaign' ); } + $resourcePath = '/smsCampaigns/{campaignId}'; $formParams = []; $queryParams = []; @@ -832,6 +1107,7 @@ protected function getSmsCampaignRequest($campaignId) $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( @@ -841,53 +1117,35 @@ protected function getSmsCampaignRequest($campaignId) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -913,10 +1171,11 @@ protected function getSmsCampaignRequest($campaignId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -927,20 +1186,29 @@ protected function getSmsCampaignRequest($campaignId) * * Returns the information for all your created SMS campaigns * - * @param string $status Status of campaign. (optional) - * @param string $startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) - * @param string $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (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 $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetSmsCampaigns + * @param string|null $status Status of campaign. (optional) + * @param string|null $startDate **Mandatory if endDate is used.** Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) + * @param int|null $limit Number limitation for the result returned (optional, default to 500) + * @param int|null $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsCampaigns'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetSmsCampaigns|\Brevo\Client\Models\ErrorModel */ - public function getSmsCampaigns($status = null, $startDate = null, $endDate = null, $limit = '500', $offset = '0', $sort = 'desc') + public function getSmsCampaigns( + ?string $status = null, + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 500, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getSmsCampaigns'][0] + ): \Brevo\Client\Models\GetSmsCampaigns { - list($response) = $this->getSmsCampaignsWithHttpInfo($status, $startDate, $endDate, $limit, $offset, $sort); + list($response) = $this->getSmsCampaignsWithHttpInfo($status, $startDate, $endDate, $limit, $offset, $sort, $contentType); return $response; } @@ -949,21 +1217,29 @@ public function getSmsCampaigns($status = null, $startDate = null, $endDate = nu * * Returns the information for all your created SMS campaigns * - * @param string $status Status of campaign. (optional) - * @param string $startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) - * @param string $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (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 $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetSmsCampaigns, HTTP status code, HTTP response headers (array of strings) + * @param string|null $status Status of campaign. (optional) + * @param string|null $startDate **Mandatory if endDate is used.** Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) + * @param int|null $limit Number limitation for the result returned (optional, default to 500) + * @param int|null $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsCampaigns'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetSmsCampaigns|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getSmsCampaignsWithHttpInfo($status = null, $startDate = null, $endDate = null, $limit = '500', $offset = '0', $sort = 'desc') + public function getSmsCampaignsWithHttpInfo( + ?string $status = null, + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 500, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getSmsCampaigns'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetSmsCampaigns'; - $request = $this->getSmsCampaignsRequest($status, $startDate, $endDate, $limit, $offset, $sort); + $request = $this->getSmsCampaignsRequest($status, $startDate, $endDate, $limit, $offset, $sort, $contentType); try { $options = $this->createHttpClientOption(); @@ -972,34 +1248,111 @@ public function getSmsCampaignsWithHttpInfo($status = null, $startDate = null, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetSmsCampaigns', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetSmsCampaigns' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetSmsCampaigns', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetSmsCampaigns'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1014,7 +1367,7 @@ public function getSmsCampaignsWithHttpInfo($status = null, $startDate = null, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetSmsCampaigns', + '\Brevo\Client\Models\GetSmsCampaigns', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1022,7 +1375,7 @@ public function getSmsCampaignsWithHttpInfo($status = null, $startDate = null, $ case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1037,19 +1390,28 @@ public function getSmsCampaignsWithHttpInfo($status = null, $startDate = null, $ * * Returns the information for all your created SMS campaigns * - * @param string $status Status of campaign. (optional) - * @param string $startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) - * @param string $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (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 $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param string|null $status Status of campaign. (optional) + * @param string|null $startDate **Mandatory if endDate is used.** Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) + * @param int|null $limit Number limitation for the result returned (optional, default to 500) + * @param int|null $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsCampaigns'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getSmsCampaignsAsync($status = null, $startDate = null, $endDate = null, $limit = '500', $offset = '0', $sort = 'desc') + public function getSmsCampaignsAsync( + ?string $status = null, + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 500, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getSmsCampaigns'][0] + ): PromiseInterface { - return $this->getSmsCampaignsAsyncWithHttpInfo($status, $startDate, $endDate, $limit, $offset, $sort) + return $this->getSmsCampaignsAsyncWithHttpInfo($status, $startDate, $endDate, $limit, $offset, $sort, $contentType) ->then( function ($response) { return $response[0]; @@ -1062,30 +1424,39 @@ function ($response) { * * Returns the information for all your created SMS campaigns * - * @param string $status Status of campaign. (optional) - * @param string $startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) - * @param string $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (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 $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @param string|null $status Status of campaign. (optional) + * @param string|null $startDate **Mandatory if endDate is used.** Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) + * @param int|null $limit Number limitation for the result returned (optional, default to 500) + * @param int|null $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsCampaigns'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getSmsCampaignsAsyncWithHttpInfo($status = null, $startDate = null, $endDate = null, $limit = '500', $offset = '0', $sort = 'desc') + public function getSmsCampaignsAsyncWithHttpInfo( + $status = null, + $startDate = null, + $endDate = null, + $limit = 500, + $offset = 0, + $sort = 'desc', + string $contentType = self::contentTypes['getSmsCampaigns'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetSmsCampaigns'; - $request = $this->getSmsCampaignsRequest($status, $startDate, $endDate, $limit, $offset, $sort); + $returnType = '\Brevo\Client\Models\GetSmsCampaigns'; + $request = $this->getSmsCampaignsRequest($status, $startDate, $endDate, $limit, $offset, $sort, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1108,7 +1479,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1117,24 +1488,39 @@ function ($exception) { /** * Create request for operation 'getSmsCampaigns' * - * @param string $status Status of campaign. (optional) - * @param string $startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) - * @param string $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (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 $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param string|null $status Status of campaign. (optional) + * @param string|null $startDate **Mandatory if endDate is used.** Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional) + * @param int|null $limit Number limitation for the result returned (optional, default to 500) + * @param int|null $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsCampaigns'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getSmsCampaignsRequest($status = null, $startDate = null, $endDate = null, $limit = '500', $offset = '0', $sort = 'desc') + public function getSmsCampaignsRequest( + $status = null, + $startDate = null, + $endDate = null, + $limit = 500, + $offset = 0, + $sort = 'desc', + string $contentType = self::contentTypes['getSmsCampaigns'][0] + ): Request { + + + + if ($limit !== null && $limit > 1000) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling SMSCampaignsApi.getSmsCampaigns, must be smaller than or equal to 1000.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling SMSCampaignsApi.getSmsCampaigns, must be smaller than or equal to 1000.'); } if ($limit !== null && $limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling SMSCampaignsApi.getSmsCampaigns, must be bigger than or equal to 0.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling SMSCampaignsApi.getSmsCampaigns, must be bigger than or equal to 0.'); } + + $resourcePath = '/smsCampaigns'; @@ -1145,78 +1531,91 @@ protected function getSmsCampaignsRequest($status = null, $startDate = null, $en $multipart = false; // query params - if ($status !== null) { - $queryParams['status'] = ObjectSerializer::toQueryValue($status); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $status, + 'status', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($startDate !== null) { - $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($endDate !== null) { - $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1242,10 +1641,11 @@ protected function getSmsCampaignsRequest($status = null, $startDate = null, $en $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1254,37 +1654,46 @@ protected function getSmsCampaignsRequest($status = null, $startDate = null, $en /** * Operation requestSmsRecipientExport * - * Export an SMS campaign's recipients + * Export an SMS campaign's recipients * * @param int $campaignId id of the campaign (required) - * @param \Brevo\Client\Model\RequestSmsRecipientExport $recipientExport Values to send for a recipient export request (optional) + * @param \Brevo\Client\Models\RequestSmsRecipientExport|null $recipientExport Values to send for a recipient export request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestSmsRecipientExport'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreatedProcessId + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreatedProcessId|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function requestSmsRecipientExport($campaignId, $recipientExport = null) + public function requestSmsRecipientExport( + int $campaignId, + ?\Brevo\Client\Models\RequestSmsRecipientExport $recipientExport = null, + string $contentType = self::contentTypes['requestSmsRecipientExport'][0] + ): \Brevo\Client\Models\CreatedProcessId { - list($response) = $this->requestSmsRecipientExportWithHttpInfo($campaignId, $recipientExport); + list($response) = $this->requestSmsRecipientExportWithHttpInfo($campaignId, $recipientExport, $contentType); return $response; } /** * Operation requestSmsRecipientExportWithHttpInfo * - * Export an SMS campaign's recipients + * Export an SMS campaign's recipients * * @param int $campaignId id of the campaign (required) - * @param \Brevo\Client\Model\RequestSmsRecipientExport $recipientExport Values to send for a recipient export request (optional) + * @param \Brevo\Client\Models\RequestSmsRecipientExport|null $recipientExport Values to send for a recipient export request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestSmsRecipientExport'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreatedProcessId, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreatedProcessId|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function requestSmsRecipientExportWithHttpInfo($campaignId, $recipientExport = null) + public function requestSmsRecipientExportWithHttpInfo( + int $campaignId, + ?\Brevo\Client\Models\RequestSmsRecipientExport $recipientExport = null, + string $contentType = self::contentTypes['requestSmsRecipientExport'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreatedProcessId'; - $request = $this->requestSmsRecipientExportRequest($campaignId, $recipientExport); + $request = $this->requestSmsRecipientExportRequest($campaignId, $recipientExport, $contentType); try { $options = $this->createHttpClientOption(); @@ -1293,34 +1702,138 @@ public function requestSmsRecipientExportWithHttpInfo($campaignId, $recipientExp } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 202: + if (in_array('\Brevo\Client\Models\CreatedProcessId', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreatedProcessId' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreatedProcessId', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreatedProcessId'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1335,7 +1848,7 @@ public function requestSmsRecipientExportWithHttpInfo($campaignId, $recipientExp case 202: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreatedProcessId', + '\Brevo\Client\Models\CreatedProcessId', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1343,7 +1856,7 @@ public function requestSmsRecipientExportWithHttpInfo($campaignId, $recipientExp case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1351,7 +1864,7 @@ public function requestSmsRecipientExportWithHttpInfo($campaignId, $recipientExp case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1364,17 +1877,22 @@ public function requestSmsRecipientExportWithHttpInfo($campaignId, $recipientExp /** * Operation requestSmsRecipientExportAsync * - * Export an SMS campaign's recipients + * Export an SMS campaign's recipients * * @param int $campaignId id of the campaign (required) - * @param \Brevo\Client\Model\RequestSmsRecipientExport $recipientExport Values to send for a recipient export request (optional) + * @param \Brevo\Client\Models\RequestSmsRecipientExport|null $recipientExport Values to send for a recipient export request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestSmsRecipientExport'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function requestSmsRecipientExportAsync($campaignId, $recipientExport = null) + public function requestSmsRecipientExportAsync( + int $campaignId, + ?\Brevo\Client\Models\RequestSmsRecipientExport $recipientExport = null, + string $contentType = self::contentTypes['requestSmsRecipientExport'][0] + ): PromiseInterface { - return $this->requestSmsRecipientExportAsyncWithHttpInfo($campaignId, $recipientExport) + return $this->requestSmsRecipientExportAsyncWithHttpInfo($campaignId, $recipientExport, $contentType) ->then( function ($response) { return $response[0]; @@ -1385,28 +1903,33 @@ function ($response) { /** * Operation requestSmsRecipientExportAsyncWithHttpInfo * - * Export an SMS campaign's recipients + * Export an SMS campaign's recipients * * @param int $campaignId id of the campaign (required) - * @param \Brevo\Client\Model\RequestSmsRecipientExport $recipientExport Values to send for a recipient export request (optional) + * @param \Brevo\Client\Models\RequestSmsRecipientExport|null $recipientExport Values to send for a recipient export request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestSmsRecipientExport'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function requestSmsRecipientExportAsyncWithHttpInfo($campaignId, $recipientExport = null) + public function requestSmsRecipientExportAsyncWithHttpInfo( + $campaignId, + $recipientExport = null, + string $contentType = self::contentTypes['requestSmsRecipientExport'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreatedProcessId'; - $request = $this->requestSmsRecipientExportRequest($campaignId, $recipientExport); + $returnType = '\Brevo\Client\Models\CreatedProcessId'; + $request = $this->requestSmsRecipientExportRequest($campaignId, $recipientExport, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1429,7 +1952,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1439,20 +1962,28 @@ function ($exception) { * Create request for operation 'requestSmsRecipientExport' * * @param int $campaignId id of the campaign (required) - * @param \Brevo\Client\Model\RequestSmsRecipientExport $recipientExport Values to send for a recipient export request (optional) + * @param \Brevo\Client\Models\RequestSmsRecipientExport|null $recipientExport Values to send for a recipient export request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestSmsRecipientExport'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function requestSmsRecipientExportRequest($campaignId, $recipientExport = null) + public function requestSmsRecipientExportRequest( + $campaignId, + $recipientExport = null, + string $contentType = self::contentTypes['requestSmsRecipientExport'][0] + ): Request { + // verify the required parameter 'campaignId' is set if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $campaignId when calling requestSmsRecipientExport' ); } + + $resourcePath = '/smsCampaigns/{campaignId}/exportRecipients'; $formParams = []; $queryParams = []; @@ -1461,6 +1992,7 @@ protected function requestSmsRecipientExportRequest($campaignId, $recipientExpor $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( @@ -1470,56 +2002,42 @@ protected function requestSmsRecipientExportRequest($campaignId, $recipientExpor ); } - // 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'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($recipientExport)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($recipientExport)); + } else { + $httpBody = $recipientExport; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1545,10 +2063,11 @@ protected function requestSmsRecipientExportRequest($campaignId, $recipientExpor $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1560,14 +2079,18 @@ protected function requestSmsRecipientExportRequest($campaignId, $recipientExpor * Send your SMS campaign immediately * * @param int $campaignId id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendSmsCampaignNow'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function sendSmsCampaignNow($campaignId) + public function sendSmsCampaignNow( + int $campaignId, + string $contentType = self::contentTypes['sendSmsCampaignNow'][0] + ): void { - $this->sendSmsCampaignNowWithHttpInfo($campaignId); + $this->sendSmsCampaignNowWithHttpInfo($campaignId, $contentType); } /** @@ -1576,15 +2099,18 @@ public function sendSmsCampaignNow($campaignId) * Send your SMS campaign immediately * * @param int $campaignId id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendSmsCampaignNow'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function sendSmsCampaignNowWithHttpInfo($campaignId) + public function sendSmsCampaignNowWithHttpInfo( + int $campaignId, + string $contentType = self::contentTypes['sendSmsCampaignNow'][0] + ): array { - $returnType = ''; - $request = $this->sendSmsCampaignNowRequest($campaignId); + $request = $this->sendSmsCampaignNowRequest($campaignId, $contentType); try { $options = $this->createHttpClientOption(); @@ -1593,26 +2119,21 @@ public function sendSmsCampaignNowWithHttpInfo($campaignId) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -1621,7 +2142,7 @@ public function sendSmsCampaignNowWithHttpInfo($campaignId) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1629,7 +2150,7 @@ public function sendSmsCampaignNowWithHttpInfo($campaignId) case 402: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1637,7 +2158,7 @@ public function sendSmsCampaignNowWithHttpInfo($campaignId) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1653,13 +2174,17 @@ public function sendSmsCampaignNowWithHttpInfo($campaignId) * Send your SMS campaign immediately * * @param int $campaignId id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendSmsCampaignNow'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendSmsCampaignNowAsync($campaignId) + public function sendSmsCampaignNowAsync( + int $campaignId, + string $contentType = self::contentTypes['sendSmsCampaignNow'][0] + ): PromiseInterface { - return $this->sendSmsCampaignNowAsyncWithHttpInfo($campaignId) + return $this->sendSmsCampaignNowAsyncWithHttpInfo($campaignId, $contentType) ->then( function ($response) { return $response[0]; @@ -1673,14 +2198,19 @@ function ($response) { * Send your SMS campaign immediately * * @param int $campaignId id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendSmsCampaignNow'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendSmsCampaignNowAsyncWithHttpInfo($campaignId) + public function sendSmsCampaignNowAsyncWithHttpInfo( + $campaignId, + string $contentType = self::contentTypes['sendSmsCampaignNow'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->sendSmsCampaignNowRequest($campaignId); + $request = $this->sendSmsCampaignNowRequest($campaignId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1699,7 +2229,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1709,19 +2239,25 @@ function ($exception) { * Create request for operation 'sendSmsCampaignNow' * * @param int $campaignId id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendSmsCampaignNow'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function sendSmsCampaignNowRequest($campaignId) + public function sendSmsCampaignNowRequest( + $campaignId, + string $contentType = self::contentTypes['sendSmsCampaignNow'][0] + ): Request { + // verify the required parameter 'campaignId' is set if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $campaignId when calling sendSmsCampaignNow' ); } + $resourcePath = '/smsCampaigns/{campaignId}/sendNow'; $formParams = []; $queryParams = []; @@ -1730,6 +2266,7 @@ protected function sendSmsCampaignNowRequest($campaignId) $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( @@ -1739,53 +2276,35 @@ protected function sendSmsCampaignNowRequest($campaignId) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1811,10 +2330,11 @@ protected function sendSmsCampaignNowRequest($campaignId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1823,36 +2343,45 @@ protected function sendSmsCampaignNowRequest($campaignId) /** * Operation sendSmsReport * - * Send an SMS campaign's report + * Send an SMS campaign's report * * @param int $campaignId id of the campaign (required) - * @param \Brevo\Client\Model\SendReport $sendReport Values for send a report (required) + * @param \Brevo\Client\Models\SendReport $sendReport Values for send a report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendSmsReport'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function sendSmsReport($campaignId, $sendReport) + public function sendSmsReport( + int $campaignId, + \Brevo\Client\Models\SendReport $sendReport, + string $contentType = self::contentTypes['sendSmsReport'][0] + ): void { - $this->sendSmsReportWithHttpInfo($campaignId, $sendReport); + $this->sendSmsReportWithHttpInfo($campaignId, $sendReport, $contentType); } /** * Operation sendSmsReportWithHttpInfo * - * Send an SMS campaign's report + * Send an SMS campaign's report * * @param int $campaignId id of the campaign (required) - * @param \Brevo\Client\Model\SendReport $sendReport Values for send a report (required) + * @param \Brevo\Client\Models\SendReport $sendReport Values for send a report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendSmsReport'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function sendSmsReportWithHttpInfo($campaignId, $sendReport) + public function sendSmsReportWithHttpInfo( + int $campaignId, + \Brevo\Client\Models\SendReport $sendReport, + string $contentType = self::contentTypes['sendSmsReport'][0] + ): array { - $returnType = ''; - $request = $this->sendSmsReportRequest($campaignId, $sendReport); + $request = $this->sendSmsReportRequest($campaignId, $sendReport, $contentType); try { $options = $this->createHttpClientOption(); @@ -1861,26 +2390,21 @@ public function sendSmsReportWithHttpInfo($campaignId, $sendReport) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -1889,7 +2413,7 @@ public function sendSmsReportWithHttpInfo($campaignId, $sendReport) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1897,7 +2421,7 @@ public function sendSmsReportWithHttpInfo($campaignId, $sendReport) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1910,17 +2434,22 @@ public function sendSmsReportWithHttpInfo($campaignId, $sendReport) /** * Operation sendSmsReportAsync * - * Send an SMS campaign's report + * Send an SMS campaign's report * * @param int $campaignId id of the campaign (required) - * @param \Brevo\Client\Model\SendReport $sendReport Values for send a report (required) + * @param \Brevo\Client\Models\SendReport $sendReport Values for send a report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendSmsReport'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendSmsReportAsync($campaignId, $sendReport) + public function sendSmsReportAsync( + int $campaignId, + \Brevo\Client\Models\SendReport $sendReport, + string $contentType = self::contentTypes['sendSmsReport'][0] + ): PromiseInterface { - return $this->sendSmsReportAsyncWithHttpInfo($campaignId, $sendReport) + return $this->sendSmsReportAsyncWithHttpInfo($campaignId, $sendReport, $contentType) ->then( function ($response) { return $response[0]; @@ -1931,18 +2460,24 @@ function ($response) { /** * Operation sendSmsReportAsyncWithHttpInfo * - * Send an SMS campaign's report + * Send an SMS campaign's report * * @param int $campaignId id of the campaign (required) - * @param \Brevo\Client\Model\SendReport $sendReport Values for send a report (required) + * @param \Brevo\Client\Models\SendReport $sendReport Values for send a report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendSmsReport'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendSmsReportAsyncWithHttpInfo($campaignId, $sendReport) + public function sendSmsReportAsyncWithHttpInfo( + $campaignId, + $sendReport, + string $contentType = self::contentTypes['sendSmsReport'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->sendSmsReportRequest($campaignId, $sendReport); + $request = $this->sendSmsReportRequest($campaignId, $sendReport, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1961,7 +2496,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1971,26 +2506,34 @@ function ($exception) { * Create request for operation 'sendSmsReport' * * @param int $campaignId id of the campaign (required) - * @param \Brevo\Client\Model\SendReport $sendReport Values for send a report (required) + * @param \Brevo\Client\Models\SendReport $sendReport Values for send a report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendSmsReport'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function sendSmsReportRequest($campaignId, $sendReport) + public function sendSmsReportRequest( + $campaignId, + $sendReport, + string $contentType = self::contentTypes['sendSmsReport'][0] + ): Request { + // verify the required parameter 'campaignId' is set if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $campaignId when calling sendSmsReport' ); } + // verify the required parameter 'sendReport' is set if ($sendReport === null || (is_array($sendReport) && count($sendReport) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $sendReport when calling sendSmsReport' ); } + $resourcePath = '/smsCampaigns/{campaignId}/sendReport'; $formParams = []; $queryParams = []; @@ -1999,6 +2542,7 @@ protected function sendSmsReportRequest($campaignId, $sendReport) $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( @@ -2008,56 +2552,42 @@ protected function sendSmsReportRequest($campaignId, $sendReport) ); } - // 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'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($sendReport)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($sendReport)); + } else { + $httpBody = $sendReport; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2083,10 +2613,11 @@ protected function sendSmsReportRequest($campaignId, $sendReport) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2098,15 +2629,20 @@ protected function sendSmsReportRequest($campaignId, $sendReport) * Send a test SMS campaign * * @param int $campaignId Id of the SMS campaign (required) - * @param \Brevo\Client\Model\SendTestSms $phoneNumber Mobile number of the recipient with the country code. This number must belong to one of your contacts in Brevo account and must not be blacklisted (required) + * @param \Brevo\Client\Models\SendTestSms $sendTestSms Mobile number of the recipient with the country code. This number **must belong to one of your contacts in Brevo account and must not be blacklisted** (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestSms'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function sendTestSms($campaignId, $phoneNumber) + public function sendTestSms( + int $campaignId, + \Brevo\Client\Models\SendTestSms $sendTestSms, + string $contentType = self::contentTypes['sendTestSms'][0] + ): void { - $this->sendTestSmsWithHttpInfo($campaignId, $phoneNumber); + $this->sendTestSmsWithHttpInfo($campaignId, $sendTestSms, $contentType); } /** @@ -2115,16 +2651,20 @@ public function sendTestSms($campaignId, $phoneNumber) * Send a test SMS campaign * * @param int $campaignId Id of the SMS campaign (required) - * @param \Brevo\Client\Model\SendTestSms $phoneNumber Mobile number of the recipient with the country code. This number must belong to one of your contacts in Brevo account and must not be blacklisted (required) + * @param \Brevo\Client\Models\SendTestSms $sendTestSms Mobile number of the recipient with the country code. This number **must belong to one of your contacts in Brevo account and must not be blacklisted** (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestSms'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function sendTestSmsWithHttpInfo($campaignId, $phoneNumber) + public function sendTestSmsWithHttpInfo( + int $campaignId, + \Brevo\Client\Models\SendTestSms $sendTestSms, + string $contentType = self::contentTypes['sendTestSms'][0] + ): array { - $returnType = ''; - $request = $this->sendTestSmsRequest($campaignId, $phoneNumber); + $request = $this->sendTestSmsRequest($campaignId, $sendTestSms, $contentType); try { $options = $this->createHttpClientOption(); @@ -2133,26 +2673,21 @@ public function sendTestSmsWithHttpInfo($campaignId, $phoneNumber) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -2161,7 +2696,7 @@ public function sendTestSmsWithHttpInfo($campaignId, $phoneNumber) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\PostSendSmsTestFailed', + '\Brevo\Client\Models\PostSendSmsTestFailed', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2169,7 +2704,7 @@ public function sendTestSmsWithHttpInfo($campaignId, $phoneNumber) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2185,14 +2720,19 @@ public function sendTestSmsWithHttpInfo($campaignId, $phoneNumber) * Send a test SMS campaign * * @param int $campaignId Id of the SMS campaign (required) - * @param \Brevo\Client\Model\SendTestSms $phoneNumber Mobile number of the recipient with the country code. This number must belong to one of your contacts in Brevo account and must not be blacklisted (required) + * @param \Brevo\Client\Models\SendTestSms $sendTestSms Mobile number of the recipient with the country code. This number **must belong to one of your contacts in Brevo account and must not be blacklisted** (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestSms'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendTestSmsAsync($campaignId, $phoneNumber) + public function sendTestSmsAsync( + int $campaignId, + \Brevo\Client\Models\SendTestSms $sendTestSms, + string $contentType = self::contentTypes['sendTestSms'][0] + ): PromiseInterface { - return $this->sendTestSmsAsyncWithHttpInfo($campaignId, $phoneNumber) + return $this->sendTestSmsAsyncWithHttpInfo($campaignId, $sendTestSms, $contentType) ->then( function ($response) { return $response[0]; @@ -2206,15 +2746,21 @@ function ($response) { * Send a test SMS campaign * * @param int $campaignId Id of the SMS campaign (required) - * @param \Brevo\Client\Model\SendTestSms $phoneNumber Mobile number of the recipient with the country code. This number must belong to one of your contacts in Brevo account and must not be blacklisted (required) + * @param \Brevo\Client\Models\SendTestSms $sendTestSms Mobile number of the recipient with the country code. This number **must belong to one of your contacts in Brevo account and must not be blacklisted** (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestSms'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendTestSmsAsyncWithHttpInfo($campaignId, $phoneNumber) + public function sendTestSmsAsyncWithHttpInfo( + $campaignId, + $sendTestSms, + string $contentType = self::contentTypes['sendTestSms'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->sendTestSmsRequest($campaignId, $phoneNumber); + $request = $this->sendTestSmsRequest($campaignId, $sendTestSms, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2233,7 +2779,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2243,26 +2789,34 @@ function ($exception) { * Create request for operation 'sendTestSms' * * @param int $campaignId Id of the SMS campaign (required) - * @param \Brevo\Client\Model\SendTestSms $phoneNumber Mobile number of the recipient with the country code. This number must belong to one of your contacts in Brevo account and must not be blacklisted (required) + * @param \Brevo\Client\Models\SendTestSms $sendTestSms Mobile number of the recipient with the country code. This number **must belong to one of your contacts in Brevo account and must not be blacklisted** (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestSms'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function sendTestSmsRequest($campaignId, $phoneNumber) + public function sendTestSmsRequest( + $campaignId, + $sendTestSms, + string $contentType = self::contentTypes['sendTestSms'][0] + ): Request { + // verify the required parameter 'campaignId' is set if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $campaignId when calling sendTestSms' ); } - // verify the required parameter 'phoneNumber' is set - if ($phoneNumber === null || (is_array($phoneNumber) && count($phoneNumber) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $phoneNumber when calling sendTestSms' + + // verify the required parameter 'sendTestSms' is set + if ($sendTestSms === null || (is_array($sendTestSms) && count($sendTestSms) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $sendTestSms when calling sendTestSms' ); } + $resourcePath = '/smsCampaigns/{campaignId}/sendTest'; $formParams = []; $queryParams = []; @@ -2271,6 +2825,7 @@ protected function sendTestSmsRequest($campaignId, $phoneNumber) $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( @@ -2280,56 +2835,42 @@ protected function sendTestSmsRequest($campaignId, $phoneNumber) ); } - // body params - $_tempBody = null; - if (isset($phoneNumber)) { - $_tempBody = $phoneNumber; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($sendTestSms)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($sendTestSms)); + } else { + $httpBody = $sendTestSms; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2355,10 +2896,11 @@ protected function sendTestSmsRequest($campaignId, $phoneNumber) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2370,15 +2912,20 @@ protected function sendTestSmsRequest($campaignId, $phoneNumber) * Update an SMS campaign * * @param int $campaignId id of the SMS campaign (required) - * @param \Brevo\Client\Model\UpdateSmsCampaign $updateSmsCampaign Values to update an SMS Campaign (required) + * @param \Brevo\Client\Models\UpdateSmsCampaign $updateSmsCampaign Values to update an SMS Campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSmsCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function updateSmsCampaign($campaignId, $updateSmsCampaign) + public function updateSmsCampaign( + int $campaignId, + \Brevo\Client\Models\UpdateSmsCampaign $updateSmsCampaign, + string $contentType = self::contentTypes['updateSmsCampaign'][0] + ): void { - $this->updateSmsCampaignWithHttpInfo($campaignId, $updateSmsCampaign); + $this->updateSmsCampaignWithHttpInfo($campaignId, $updateSmsCampaign, $contentType); } /** @@ -2387,16 +2934,20 @@ public function updateSmsCampaign($campaignId, $updateSmsCampaign) * Update an SMS campaign * * @param int $campaignId id of the SMS campaign (required) - * @param \Brevo\Client\Model\UpdateSmsCampaign $updateSmsCampaign Values to update an SMS Campaign (required) + * @param \Brevo\Client\Models\UpdateSmsCampaign $updateSmsCampaign Values to update an SMS Campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSmsCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function updateSmsCampaignWithHttpInfo($campaignId, $updateSmsCampaign) + public function updateSmsCampaignWithHttpInfo( + int $campaignId, + \Brevo\Client\Models\UpdateSmsCampaign $updateSmsCampaign, + string $contentType = self::contentTypes['updateSmsCampaign'][0] + ): array { - $returnType = ''; - $request = $this->updateSmsCampaignRequest($campaignId, $updateSmsCampaign); + $request = $this->updateSmsCampaignRequest($campaignId, $updateSmsCampaign, $contentType); try { $options = $this->createHttpClientOption(); @@ -2405,26 +2956,21 @@ public function updateSmsCampaignWithHttpInfo($campaignId, $updateSmsCampaign) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -2433,7 +2979,7 @@ public function updateSmsCampaignWithHttpInfo($campaignId, $updateSmsCampaign) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2441,7 +2987,7 @@ public function updateSmsCampaignWithHttpInfo($campaignId, $updateSmsCampaign) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2457,14 +3003,19 @@ public function updateSmsCampaignWithHttpInfo($campaignId, $updateSmsCampaign) * Update an SMS campaign * * @param int $campaignId id of the SMS campaign (required) - * @param \Brevo\Client\Model\UpdateSmsCampaign $updateSmsCampaign Values to update an SMS Campaign (required) + * @param \Brevo\Client\Models\UpdateSmsCampaign $updateSmsCampaign Values to update an SMS Campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSmsCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateSmsCampaignAsync($campaignId, $updateSmsCampaign) + public function updateSmsCampaignAsync( + int $campaignId, + \Brevo\Client\Models\UpdateSmsCampaign $updateSmsCampaign, + string $contentType = self::contentTypes['updateSmsCampaign'][0] + ): PromiseInterface { - return $this->updateSmsCampaignAsyncWithHttpInfo($campaignId, $updateSmsCampaign) + return $this->updateSmsCampaignAsyncWithHttpInfo($campaignId, $updateSmsCampaign, $contentType) ->then( function ($response) { return $response[0]; @@ -2478,15 +3029,21 @@ function ($response) { * Update an SMS campaign * * @param int $campaignId id of the SMS campaign (required) - * @param \Brevo\Client\Model\UpdateSmsCampaign $updateSmsCampaign Values to update an SMS Campaign (required) + * @param \Brevo\Client\Models\UpdateSmsCampaign $updateSmsCampaign Values to update an SMS Campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSmsCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateSmsCampaignAsyncWithHttpInfo($campaignId, $updateSmsCampaign) + public function updateSmsCampaignAsyncWithHttpInfo( + $campaignId, + $updateSmsCampaign, + string $contentType = self::contentTypes['updateSmsCampaign'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->updateSmsCampaignRequest($campaignId, $updateSmsCampaign); + $request = $this->updateSmsCampaignRequest($campaignId, $updateSmsCampaign, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2505,7 +3062,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2515,26 +3072,34 @@ function ($exception) { * Create request for operation 'updateSmsCampaign' * * @param int $campaignId id of the SMS campaign (required) - * @param \Brevo\Client\Model\UpdateSmsCampaign $updateSmsCampaign Values to update an SMS Campaign (required) + * @param \Brevo\Client\Models\UpdateSmsCampaign $updateSmsCampaign Values to update an SMS Campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSmsCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updateSmsCampaignRequest($campaignId, $updateSmsCampaign) + public function updateSmsCampaignRequest( + $campaignId, + $updateSmsCampaign, + string $contentType = self::contentTypes['updateSmsCampaign'][0] + ): Request { + // verify the required parameter 'campaignId' is set if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $campaignId when calling updateSmsCampaign' ); } + // verify the required parameter 'updateSmsCampaign' is set if ($updateSmsCampaign === null || (is_array($updateSmsCampaign) && count($updateSmsCampaign) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $updateSmsCampaign when calling updateSmsCampaign' ); } + $resourcePath = '/smsCampaigns/{campaignId}'; $formParams = []; $queryParams = []; @@ -2543,6 +3108,7 @@ protected function updateSmsCampaignRequest($campaignId, $updateSmsCampaign) $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( @@ -2552,56 +3118,42 @@ protected function updateSmsCampaignRequest($campaignId, $updateSmsCampaign) ); } - // 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'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($updateSmsCampaign)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($updateSmsCampaign)); + } else { + $httpBody = $updateSmsCampaign; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2627,10 +3179,11 @@ protected function updateSmsCampaignRequest($campaignId, $updateSmsCampaign) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2639,36 +3192,45 @@ protected function updateSmsCampaignRequest($campaignId, $updateSmsCampaign) /** * Operation updateSmsCampaignStatus * - * Update a campaign's status + * Update a campaign's status * * @param int $campaignId id of the campaign (required) - * @param \Brevo\Client\Model\UpdateCampaignStatus $status Status of the campaign. (required) + * @param \Brevo\Client\Models\UpdateCampaignStatus $status Status of the campaign. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSmsCampaignStatus'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function updateSmsCampaignStatus($campaignId, $status) + public function updateSmsCampaignStatus( + int $campaignId, + \Brevo\Client\Models\UpdateCampaignStatus $status, + string $contentType = self::contentTypes['updateSmsCampaignStatus'][0] + ): void { - $this->updateSmsCampaignStatusWithHttpInfo($campaignId, $status); + $this->updateSmsCampaignStatusWithHttpInfo($campaignId, $status, $contentType); } /** * Operation updateSmsCampaignStatusWithHttpInfo * - * Update a campaign's status + * Update a campaign's status * * @param int $campaignId id of the campaign (required) - * @param \Brevo\Client\Model\UpdateCampaignStatus $status Status of the campaign. (required) + * @param \Brevo\Client\Models\UpdateCampaignStatus $status Status of the campaign. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSmsCampaignStatus'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function updateSmsCampaignStatusWithHttpInfo($campaignId, $status) + public function updateSmsCampaignStatusWithHttpInfo( + int $campaignId, + \Brevo\Client\Models\UpdateCampaignStatus $status, + string $contentType = self::contentTypes['updateSmsCampaignStatus'][0] + ): array { - $returnType = ''; - $request = $this->updateSmsCampaignStatusRequest($campaignId, $status); + $request = $this->updateSmsCampaignStatusRequest($campaignId, $status, $contentType); try { $options = $this->createHttpClientOption(); @@ -2677,26 +3239,21 @@ public function updateSmsCampaignStatusWithHttpInfo($campaignId, $status) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -2705,7 +3262,7 @@ public function updateSmsCampaignStatusWithHttpInfo($campaignId, $status) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2713,7 +3270,7 @@ public function updateSmsCampaignStatusWithHttpInfo($campaignId, $status) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2726,17 +3283,22 @@ public function updateSmsCampaignStatusWithHttpInfo($campaignId, $status) /** * Operation updateSmsCampaignStatusAsync * - * Update a campaign's status + * Update a campaign's status * * @param int $campaignId id of the campaign (required) - * @param \Brevo\Client\Model\UpdateCampaignStatus $status Status of the campaign. (required) + * @param \Brevo\Client\Models\UpdateCampaignStatus $status Status of the campaign. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSmsCampaignStatus'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateSmsCampaignStatusAsync($campaignId, $status) + public function updateSmsCampaignStatusAsync( + int $campaignId, + \Brevo\Client\Models\UpdateCampaignStatus $status, + string $contentType = self::contentTypes['updateSmsCampaignStatus'][0] + ): PromiseInterface { - return $this->updateSmsCampaignStatusAsyncWithHttpInfo($campaignId, $status) + return $this->updateSmsCampaignStatusAsyncWithHttpInfo($campaignId, $status, $contentType) ->then( function ($response) { return $response[0]; @@ -2747,18 +3309,24 @@ function ($response) { /** * Operation updateSmsCampaignStatusAsyncWithHttpInfo * - * Update a campaign's status + * Update a campaign's status * * @param int $campaignId id of the campaign (required) - * @param \Brevo\Client\Model\UpdateCampaignStatus $status Status of the campaign. (required) + * @param \Brevo\Client\Models\UpdateCampaignStatus $status Status of the campaign. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSmsCampaignStatus'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateSmsCampaignStatusAsyncWithHttpInfo($campaignId, $status) + public function updateSmsCampaignStatusAsyncWithHttpInfo( + $campaignId, + $status, + string $contentType = self::contentTypes['updateSmsCampaignStatus'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->updateSmsCampaignStatusRequest($campaignId, $status); + $request = $this->updateSmsCampaignStatusRequest($campaignId, $status, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2777,7 +3345,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2787,26 +3355,34 @@ function ($exception) { * Create request for operation 'updateSmsCampaignStatus' * * @param int $campaignId id of the campaign (required) - * @param \Brevo\Client\Model\UpdateCampaignStatus $status Status of the campaign. (required) + * @param \Brevo\Client\Models\UpdateCampaignStatus $status Status of the campaign. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSmsCampaignStatus'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updateSmsCampaignStatusRequest($campaignId, $status) + public function updateSmsCampaignStatusRequest( + $campaignId, + $status, + string $contentType = self::contentTypes['updateSmsCampaignStatus'][0] + ): Request { + // verify the required parameter 'campaignId' is set if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $campaignId when calling updateSmsCampaignStatus' ); } + // verify the required parameter 'status' is set if ($status === null || (is_array($status) && count($status) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $status when calling updateSmsCampaignStatus' ); } + $resourcePath = '/smsCampaigns/{campaignId}/status'; $formParams = []; $queryParams = []; @@ -2815,6 +3391,7 @@ protected function updateSmsCampaignStatusRequest($campaignId, $status) $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( @@ -2824,56 +3401,42 @@ protected function updateSmsCampaignStatusRequest($campaignId, $status) ); } - // 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'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($status)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($status)); + } else { + $httpBody = $status; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2899,10 +3462,11 @@ protected function updateSmsCampaignStatusRequest($campaignId, $status) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2914,7 +3478,7 @@ protected function updateSmsCampaignStatusRequest($campaignId, $status) * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/SendersApi.php b/lib/Api/SendersApi.php index 8da7a97..13ce863 100644 --- a/lib/Api/SendersApi.php +++ b/lib/Api/SendersApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'deleteSender' => [ + 'application/json', + ], + 'getIps' => [ + 'application/json', + ], + 'getIpsFromSender' => [ + 'application/json', + ], + 'getSenders' => [ + 'application/json', + ], + 'updateSender' => [ + 'application/json', + ], + 'validateSenderByOTP' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -92,15 +146,19 @@ public function getConfig() * * Create a new sender * - * @param \Brevo\Client\Model\CreateSender $sender sender's name (optional) + * @param \Brevo\Client\Models\CreateSender|null $sender sender's name (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSender'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreateSenderModel + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateSenderModel|\Brevo\Client\Models\ErrorModel */ - public function createSender($sender = null) + public function createSender( + ?\Brevo\Client\Models\CreateSender $sender = null, + string $contentType = self::contentTypes['createSender'][0] + ): \Brevo\Client\Models\CreateSenderModel { - list($response) = $this->createSenderWithHttpInfo($sender); + list($response) = $this->createSenderWithHttpInfo($sender, $contentType); return $response; } @@ -109,16 +167,19 @@ public function createSender($sender = null) * * Create a new sender * - * @param \Brevo\Client\Model\CreateSender $sender sender's name (optional) + * @param \Brevo\Client\Models\CreateSender|null $sender sender's name (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSender'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreateSenderModel, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateSenderModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function createSenderWithHttpInfo($sender = null) + public function createSenderWithHttpInfo( + ?\Brevo\Client\Models\CreateSender $sender = null, + string $contentType = self::contentTypes['createSender'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreateSenderModel'; - $request = $this->createSenderRequest($sender); + $request = $this->createSenderRequest($sender, $contentType); try { $options = $this->createHttpClientOption(); @@ -127,34 +188,111 @@ public function createSenderWithHttpInfo($sender = null) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreateSenderModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateSenderModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateSenderModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreateSenderModel'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -169,7 +307,7 @@ public function createSenderWithHttpInfo($sender = null) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreateSenderModel', + '\Brevo\Client\Models\CreateSenderModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -177,7 +315,7 @@ public function createSenderWithHttpInfo($sender = null) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -192,14 +330,18 @@ public function createSenderWithHttpInfo($sender = null) * * Create a new sender * - * @param \Brevo\Client\Model\CreateSender $sender sender's name (optional) + * @param \Brevo\Client\Models\CreateSender|null $sender sender's name (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSender'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createSenderAsync($sender = null) + public function createSenderAsync( + ?\Brevo\Client\Models\CreateSender $sender = null, + string $contentType = self::contentTypes['createSender'][0] + ): PromiseInterface { - return $this->createSenderAsyncWithHttpInfo($sender) + return $this->createSenderAsyncWithHttpInfo($sender, $contentType) ->then( function ($response) { return $response[0]; @@ -212,25 +354,29 @@ function ($response) { * * Create a new sender * - * @param \Brevo\Client\Model\CreateSender $sender sender's name (optional) + * @param \Brevo\Client\Models\CreateSender|null $sender sender's name (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSender'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createSenderAsyncWithHttpInfo($sender = null) + public function createSenderAsyncWithHttpInfo( + $sender = null, + string $contentType = self::contentTypes['createSender'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreateSenderModel'; - $request = $this->createSenderRequest($sender); + $returnType = '\Brevo\Client\Models\CreateSenderModel'; + $request = $this->createSenderRequest($sender, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -253,7 +399,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -262,14 +408,20 @@ function ($exception) { /** * Create request for operation 'createSender' * - * @param \Brevo\Client\Model\CreateSender $sender sender's name (optional) + * @param \Brevo\Client\Models\CreateSender|null $sender sender's name (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSender'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createSenderRequest($sender = null) + public function createSenderRequest( + $sender = null, + string $contentType = self::contentTypes['createSender'][0] + ): Request { + + $resourcePath = '/senders'; $formParams = []; $queryParams = []; @@ -279,56 +431,43 @@ protected function createSenderRequest($sender = null) - // 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'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($sender)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($sender)); + } else { + $httpBody = $sender; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -354,10 +493,11 @@ protected function createSenderRequest($sender = null) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -369,14 +509,18 @@ protected function createSenderRequest($sender = null) * Delete a sender * * @param int $senderId Id of the sender (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSender'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function deleteSender($senderId) + public function deleteSender( + int $senderId, + string $contentType = self::contentTypes['deleteSender'][0] + ): void { - $this->deleteSenderWithHttpInfo($senderId); + $this->deleteSenderWithHttpInfo($senderId, $contentType); } /** @@ -385,15 +529,18 @@ public function deleteSender($senderId) * Delete a sender * * @param int $senderId Id of the sender (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSender'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteSenderWithHttpInfo($senderId) + public function deleteSenderWithHttpInfo( + int $senderId, + string $contentType = self::contentTypes['deleteSender'][0] + ): array { - $returnType = ''; - $request = $this->deleteSenderRequest($senderId); + $request = $this->deleteSenderRequest($senderId, $contentType); try { $options = $this->createHttpClientOption(); @@ -402,43 +549,38 @@ public function deleteSenderWithHttpInfo($senderId) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -454,13 +596,17 @@ public function deleteSenderWithHttpInfo($senderId) * Delete a sender * * @param int $senderId Id of the sender (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSender'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteSenderAsync($senderId) + public function deleteSenderAsync( + int $senderId, + string $contentType = self::contentTypes['deleteSender'][0] + ): PromiseInterface { - return $this->deleteSenderAsyncWithHttpInfo($senderId) + return $this->deleteSenderAsyncWithHttpInfo($senderId, $contentType) ->then( function ($response) { return $response[0]; @@ -474,14 +620,19 @@ function ($response) { * Delete a sender * * @param int $senderId Id of the sender (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSender'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteSenderAsyncWithHttpInfo($senderId) + public function deleteSenderAsyncWithHttpInfo( + $senderId, + string $contentType = self::contentTypes['deleteSender'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->deleteSenderRequest($senderId); + $request = $this->deleteSenderRequest($senderId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -500,7 +651,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -510,19 +661,25 @@ function ($exception) { * Create request for operation 'deleteSender' * * @param int $senderId Id of the sender (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSender'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function deleteSenderRequest($senderId) + public function deleteSenderRequest( + $senderId, + string $contentType = self::contentTypes['deleteSender'][0] + ): Request { + // verify the required parameter 'senderId' is set if ($senderId === null || (is_array($senderId) && count($senderId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $senderId when calling deleteSender' ); } + $resourcePath = '/senders/{senderId}'; $formParams = []; $queryParams = []; @@ -531,6 +688,7 @@ protected function deleteSenderRequest($senderId) $multipart = false; + // path params if ($senderId !== null) { $resourcePath = str_replace( @@ -540,53 +698,35 @@ protected function deleteSenderRequest($senderId) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -612,10 +752,11 @@ protected function deleteSenderRequest($senderId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -626,14 +767,17 @@ protected function deleteSenderRequest($senderId) * * Get all the dedicated IPs for your account * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIps'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetIps + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetIps */ - public function getIps() + public function getIps( + string $contentType = self::contentTypes['getIps'][0] + ): \Brevo\Client\Models\GetIps { - list($response) = $this->getIpsWithHttpInfo(); + list($response) = $this->getIpsWithHttpInfo($contentType); return $response; } @@ -642,15 +786,17 @@ public function getIps() * * Get all the dedicated IPs for your account * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIps'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetIps, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetIps, HTTP status code, HTTP response headers (array of strings) */ - public function getIpsWithHttpInfo() + public function getIpsWithHttpInfo( + string $contentType = self::contentTypes['getIps'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetIps'; - $request = $this->getIpsRequest(); + $request = $this->getIpsRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -659,34 +805,84 @@ public function getIpsWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetIps', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetIps' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetIps', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetIps'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -701,7 +897,7 @@ public function getIpsWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetIps', + '\Brevo\Client\Models\GetIps', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -716,13 +912,16 @@ public function getIpsWithHttpInfo() * * Get all the dedicated IPs for your account * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIps'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getIpsAsync() + public function getIpsAsync( + string $contentType = self::contentTypes['getIps'][0] + ): PromiseInterface { - return $this->getIpsAsyncWithHttpInfo() + return $this->getIpsAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -735,24 +934,27 @@ function ($response) { * * Get all the dedicated IPs for your account * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIps'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getIpsAsyncWithHttpInfo() + public function getIpsAsyncWithHttpInfo( + string $contentType = self::contentTypes['getIps'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetIps'; - $request = $this->getIpsRequest(); + $returnType = '\Brevo\Client\Models\GetIps'; + $request = $this->getIpsRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -775,7 +977,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -784,13 +986,17 @@ function ($exception) { /** * Create request for operation 'getIps' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIps'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getIpsRequest() + public function getIpsRequest( + string $contentType = self::contentTypes['getIps'][0] + ): Request { + $resourcePath = '/senders/ips'; $formParams = []; $queryParams = []; @@ -800,53 +1006,36 @@ protected function getIpsRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -872,10 +1061,11 @@ protected function getIpsRequest() $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -887,14 +1077,18 @@ protected function getIpsRequest() * Get all the dedicated IPs for a sender * * @param int $senderId Id of the sender (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIpsFromSender'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetIpsFromSender + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetIpsFromSender|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function getIpsFromSender($senderId) + public function getIpsFromSender( + int $senderId, + string $contentType = self::contentTypes['getIpsFromSender'][0] + ): \Brevo\Client\Models\GetIpsFromSender { - list($response) = $this->getIpsFromSenderWithHttpInfo($senderId); + list($response) = $this->getIpsFromSenderWithHttpInfo($senderId, $contentType); return $response; } @@ -904,15 +1098,18 @@ public function getIpsFromSender($senderId) * Get all the dedicated IPs for a sender * * @param int $senderId Id of the sender (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIpsFromSender'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetIpsFromSender, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetIpsFromSender|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getIpsFromSenderWithHttpInfo($senderId) + public function getIpsFromSenderWithHttpInfo( + int $senderId, + string $contentType = self::contentTypes['getIpsFromSender'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetIpsFromSender'; - $request = $this->getIpsFromSenderRequest($senderId); + $request = $this->getIpsFromSenderRequest($senderId, $contentType); try { $options = $this->createHttpClientOption(); @@ -921,34 +1118,138 @@ public function getIpsFromSenderWithHttpInfo($senderId) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetIpsFromSender', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetIpsFromSender' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetIpsFromSender', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetIpsFromSender'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -963,23 +1264,23 @@ public function getIpsFromSenderWithHttpInfo($senderId) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetIpsFromSender', + '\Brevo\Client\Models\GetIpsFromSender', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -995,13 +1296,17 @@ public function getIpsFromSenderWithHttpInfo($senderId) * Get all the dedicated IPs for a sender * * @param int $senderId Id of the sender (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIpsFromSender'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getIpsFromSenderAsync($senderId) + public function getIpsFromSenderAsync( + int $senderId, + string $contentType = self::contentTypes['getIpsFromSender'][0] + ): PromiseInterface { - return $this->getIpsFromSenderAsyncWithHttpInfo($senderId) + return $this->getIpsFromSenderAsyncWithHttpInfo($senderId, $contentType) ->then( function ($response) { return $response[0]; @@ -1015,24 +1320,28 @@ function ($response) { * Get all the dedicated IPs for a sender * * @param int $senderId Id of the sender (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIpsFromSender'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getIpsFromSenderAsyncWithHttpInfo($senderId) + public function getIpsFromSenderAsyncWithHttpInfo( + $senderId, + string $contentType = self::contentTypes['getIpsFromSender'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetIpsFromSender'; - $request = $this->getIpsFromSenderRequest($senderId); + $returnType = '\Brevo\Client\Models\GetIpsFromSender'; + $request = $this->getIpsFromSenderRequest($senderId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1055,7 +1364,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1065,19 +1374,25 @@ function ($exception) { * Create request for operation 'getIpsFromSender' * * @param int $senderId Id of the sender (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIpsFromSender'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getIpsFromSenderRequest($senderId) + public function getIpsFromSenderRequest( + $senderId, + string $contentType = self::contentTypes['getIpsFromSender'][0] + ): Request { + // verify the required parameter 'senderId' is set if ($senderId === null || (is_array($senderId) && count($senderId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $senderId when calling getIpsFromSender' ); } + $resourcePath = '/senders/{senderId}/ips'; $formParams = []; $queryParams = []; @@ -1086,6 +1401,7 @@ protected function getIpsFromSenderRequest($senderId) $multipart = false; + // path params if ($senderId !== null) { $resourcePath = str_replace( @@ -1095,53 +1411,35 @@ protected function getIpsFromSenderRequest($senderId) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1167,10 +1465,11 @@ protected function getIpsFromSenderRequest($senderId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1181,16 +1480,21 @@ protected function getIpsFromSenderRequest($senderId) * * 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|null $ip Filter your senders for a specific ip. **Available for dedicated IP usage only** (optional) + * @param string|null $domain Filter your senders for a specific domain (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSenders'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetSendersList + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetSendersList|\Brevo\Client\Models\ErrorModel */ - public function getSenders($ip = null, $domain = null) + public function getSenders( + ?string $ip = null, + ?string $domain = null, + string $contentType = self::contentTypes['getSenders'][0] + ): \Brevo\Client\Models\GetSendersList { - list($response) = $this->getSendersWithHttpInfo($ip, $domain); + list($response) = $this->getSendersWithHttpInfo($ip, $domain, $contentType); return $response; } @@ -1199,17 +1503,21 @@ 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|null $ip Filter your senders for a specific ip. **Available for dedicated IP usage only** (optional) + * @param string|null $domain Filter your senders for a specific domain (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSenders'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetSendersList, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetSendersList|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getSendersWithHttpInfo($ip = null, $domain = null) + public function getSendersWithHttpInfo( + ?string $ip = null, + ?string $domain = null, + string $contentType = self::contentTypes['getSenders'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetSendersList'; - $request = $this->getSendersRequest($ip, $domain); + $request = $this->getSendersRequest($ip, $domain, $contentType); try { $options = $this->createHttpClientOption(); @@ -1218,34 +1526,111 @@ public function getSendersWithHttpInfo($ip = null, $domain = null) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetSendersList', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetSendersList' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetSendersList', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetSendersList'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1260,7 +1645,7 @@ public function getSendersWithHttpInfo($ip = null, $domain = null) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetSendersList', + '\Brevo\Client\Models\GetSendersList', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1268,7 +1653,7 @@ public function getSendersWithHttpInfo($ip = null, $domain = null) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1283,15 +1668,20 @@ public function getSendersWithHttpInfo($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|null $ip Filter your senders for a specific ip. **Available for dedicated IP usage only** (optional) + * @param string|null $domain Filter your senders for a specific domain (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSenders'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getSendersAsync($ip = null, $domain = null) + public function getSendersAsync( + ?string $ip = null, + ?string $domain = null, + string $contentType = self::contentTypes['getSenders'][0] + ): PromiseInterface { - return $this->getSendersAsyncWithHttpInfo($ip, $domain) + return $this->getSendersAsyncWithHttpInfo($ip, $domain, $contentType) ->then( function ($response) { return $response[0]; @@ -1304,26 +1694,31 @@ function ($response) { * * 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|null $ip Filter your senders for a specific ip. **Available for dedicated IP usage only** (optional) + * @param string|null $domain Filter your senders for a specific domain (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSenders'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getSendersAsyncWithHttpInfo($ip = null, $domain = null) + public function getSendersAsyncWithHttpInfo( + $ip = null, + $domain = null, + string $contentType = self::contentTypes['getSenders'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetSendersList'; - $request = $this->getSendersRequest($ip, $domain); + $returnType = '\Brevo\Client\Models\GetSendersList'; + $request = $this->getSendersRequest($ip, $domain, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1346,7 +1741,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1355,15 +1750,23 @@ function ($exception) { /** * 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) + * @param string|null $ip Filter your senders for a specific ip. **Available for dedicated IP usage only** (optional) + * @param string|null $domain Filter your senders for a specific domain (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSenders'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getSendersRequest($ip = null, $domain = null) + public function getSendersRequest( + $ip = null, + $domain = null, + string $contentType = self::contentTypes['getSenders'][0] + ): Request { + + + $resourcePath = '/senders'; $formParams = []; $queryParams = []; @@ -1372,62 +1775,55 @@ protected function getSendersRequest($ip = null, $domain = null) $multipart = false; // query params - if ($ip !== null) { - $queryParams['ip'] = ObjectSerializer::toQueryValue($ip); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $ip, + 'ip', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($domain !== null) { - $queryParams['domain'] = ObjectSerializer::toQueryValue($domain); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $domain, + 'domain', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1453,10 +1849,11 @@ protected function getSendersRequest($ip = null, $domain = null) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1468,15 +1865,20 @@ protected function getSendersRequest($ip = null, $domain = null) * Update a sender * * @param int $senderId Id of the sender (required) - * @param \Brevo\Client\Model\UpdateSender $sender sender's name (optional) + * @param \Brevo\Client\Models\UpdateSender|null $sender sender's name (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSender'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function updateSender($senderId, $sender = null) + public function updateSender( + int $senderId, + ?\Brevo\Client\Models\UpdateSender $sender = null, + string $contentType = self::contentTypes['updateSender'][0] + ): void { - $this->updateSenderWithHttpInfo($senderId, $sender); + $this->updateSenderWithHttpInfo($senderId, $sender, $contentType); } /** @@ -1485,16 +1887,20 @@ public function updateSender($senderId, $sender = null) * Update a sender * * @param int $senderId Id of the sender (required) - * @param \Brevo\Client\Model\UpdateSender $sender sender's name (optional) + * @param \Brevo\Client\Models\UpdateSender|null $sender sender's name (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSender'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function updateSenderWithHttpInfo($senderId, $sender = null) + public function updateSenderWithHttpInfo( + int $senderId, + ?\Brevo\Client\Models\UpdateSender $sender = null, + string $contentType = self::contentTypes['updateSender'][0] + ): array { - $returnType = ''; - $request = $this->updateSenderRequest($senderId, $sender); + $request = $this->updateSenderRequest($senderId, $sender, $contentType); try { $options = $this->createHttpClientOption(); @@ -1503,26 +1909,21 @@ public function updateSenderWithHttpInfo($senderId, $sender = null) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -1531,7 +1932,7 @@ public function updateSenderWithHttpInfo($senderId, $sender = null) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1539,7 +1940,7 @@ public function updateSenderWithHttpInfo($senderId, $sender = null) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1555,14 +1956,19 @@ public function updateSenderWithHttpInfo($senderId, $sender = null) * Update a sender * * @param int $senderId Id of the sender (required) - * @param \Brevo\Client\Model\UpdateSender $sender sender's name (optional) + * @param \Brevo\Client\Models\UpdateSender|null $sender sender's name (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSender'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateSenderAsync($senderId, $sender = null) + public function updateSenderAsync( + int $senderId, + ?\Brevo\Client\Models\UpdateSender $sender = null, + string $contentType = self::contentTypes['updateSender'][0] + ): PromiseInterface { - return $this->updateSenderAsyncWithHttpInfo($senderId, $sender) + return $this->updateSenderAsyncWithHttpInfo($senderId, $sender, $contentType) ->then( function ($response) { return $response[0]; @@ -1576,15 +1982,21 @@ function ($response) { * Update a sender * * @param int $senderId Id of the sender (required) - * @param \Brevo\Client\Model\UpdateSender $sender sender's name (optional) + * @param \Brevo\Client\Models\UpdateSender|null $sender sender's name (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSender'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateSenderAsyncWithHttpInfo($senderId, $sender = null) + public function updateSenderAsyncWithHttpInfo( + $senderId, + $sender = null, + string $contentType = self::contentTypes['updateSender'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->updateSenderRequest($senderId, $sender); + $request = $this->updateSenderRequest($senderId, $sender, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1603,7 +2015,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1613,20 +2025,28 @@ function ($exception) { * Create request for operation 'updateSender' * * @param int $senderId Id of the sender (required) - * @param \Brevo\Client\Model\UpdateSender $sender sender's name (optional) + * @param \Brevo\Client\Models\UpdateSender|null $sender sender's name (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSender'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updateSenderRequest($senderId, $sender = null) + public function updateSenderRequest( + $senderId, + $sender = null, + string $contentType = self::contentTypes['updateSender'][0] + ): Request { + // verify the required parameter 'senderId' is set if ($senderId === null || (is_array($senderId) && count($senderId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $senderId when calling updateSender' ); } + + $resourcePath = '/senders/{senderId}'; $formParams = []; $queryParams = []; @@ -1635,6 +2055,7 @@ protected function updateSenderRequest($senderId, $sender = null) $multipart = false; + // path params if ($senderId !== null) { $resourcePath = str_replace( @@ -1644,56 +2065,42 @@ protected function updateSenderRequest($senderId, $sender = null) ); } - // 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'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($sender)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($sender)); + } else { + $httpBody = $sender; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1719,10 +2126,11 @@ protected function updateSenderRequest($senderId, $sender = null) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1731,36 +2139,45 @@ protected function updateSenderRequest($senderId, $sender = null) /** * Operation validateSenderByOTP * - * Update a sender + * Validate Sender using OTP * * @param int $senderId Id of the sender (required) - * @param \Brevo\Client\Model\Otp $otp otp (optional) + * @param \Brevo\Client\Models\Otp|null $sender otp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateSenderByOTP'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function validateSenderByOTP($senderId, $otp = null) + public function validateSenderByOTP( + int $senderId, + ?\Brevo\Client\Models\Otp $sender = null, + string $contentType = self::contentTypes['validateSenderByOTP'][0] + ): void { - $this->validateSenderByOTPWithHttpInfo($senderId, $otp); + $this->validateSenderByOTPWithHttpInfo($senderId, $sender, $contentType); } /** * Operation validateSenderByOTPWithHttpInfo * - * Update a sender + * Validate Sender using OTP * * @param int $senderId Id of the sender (required) - * @param \Brevo\Client\Model\Otp $otp otp (optional) + * @param \Brevo\Client\Models\Otp|null $sender otp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateSenderByOTP'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function validateSenderByOTPWithHttpInfo($senderId, $otp = null) + public function validateSenderByOTPWithHttpInfo( + int $senderId, + ?\Brevo\Client\Models\Otp $sender = null, + string $contentType = self::contentTypes['validateSenderByOTP'][0] + ): array { - $returnType = ''; - $request = $this->validateSenderByOTPRequest($senderId, $otp); + $request = $this->validateSenderByOTPRequest($senderId, $sender, $contentType); try { $options = $this->createHttpClientOption(); @@ -1769,26 +2186,21 @@ public function validateSenderByOTPWithHttpInfo($senderId, $otp = null) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -1797,7 +2209,7 @@ public function validateSenderByOTPWithHttpInfo($senderId, $otp = null) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1805,7 +2217,7 @@ public function validateSenderByOTPWithHttpInfo($senderId, $otp = null) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1818,17 +2230,22 @@ public function validateSenderByOTPWithHttpInfo($senderId, $otp = null) /** * Operation validateSenderByOTPAsync * - * Update a sender + * Validate Sender using OTP * * @param int $senderId Id of the sender (required) - * @param \Brevo\Client\Model\Otp $otp otp (optional) + * @param \Brevo\Client\Models\Otp|null $sender otp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateSenderByOTP'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function validateSenderByOTPAsync($senderId, $otp = null) + public function validateSenderByOTPAsync( + int $senderId, + ?\Brevo\Client\Models\Otp $sender = null, + string $contentType = self::contentTypes['validateSenderByOTP'][0] + ): PromiseInterface { - return $this->validateSenderByOTPAsyncWithHttpInfo($senderId, $otp) + return $this->validateSenderByOTPAsyncWithHttpInfo($senderId, $sender, $contentType) ->then( function ($response) { return $response[0]; @@ -1839,18 +2256,24 @@ function ($response) { /** * Operation validateSenderByOTPAsyncWithHttpInfo * - * Update a sender + * Validate Sender using OTP * * @param int $senderId Id of the sender (required) - * @param \Brevo\Client\Model\Otp $otp otp (optional) + * @param \Brevo\Client\Models\Otp|null $sender otp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateSenderByOTP'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function validateSenderByOTPAsyncWithHttpInfo($senderId, $otp = null) + public function validateSenderByOTPAsyncWithHttpInfo( + $senderId, + $sender = null, + string $contentType = self::contentTypes['validateSenderByOTP'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->validateSenderByOTPRequest($senderId, $otp); + $request = $this->validateSenderByOTPRequest($senderId, $sender, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1869,7 +2292,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1879,20 +2302,28 @@ function ($exception) { * Create request for operation 'validateSenderByOTP' * * @param int $senderId Id of the sender (required) - * @param \Brevo\Client\Model\Otp $otp otp (optional) + * @param \Brevo\Client\Models\Otp|null $sender otp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateSenderByOTP'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function validateSenderByOTPRequest($senderId, $otp = null) + public function validateSenderByOTPRequest( + $senderId, + $sender = null, + string $contentType = self::contentTypes['validateSenderByOTP'][0] + ): Request { + // verify the required parameter 'senderId' is set if ($senderId === null || (is_array($senderId) && count($senderId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $senderId when calling validateSenderByOTP' ); } + + $resourcePath = '/senders/{senderId}/validate'; $formParams = []; $queryParams = []; @@ -1901,6 +2332,7 @@ protected function validateSenderByOTPRequest($senderId, $otp = null) $multipart = false; + // path params if ($senderId !== null) { $resourcePath = str_replace( @@ -1910,56 +2342,42 @@ protected function validateSenderByOTPRequest($senderId, $otp = null) ); } - // body params - $_tempBody = null; - if (isset($otp)) { - $_tempBody = $otp; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($sender)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($sender)); + } else { + $httpBody = $sender; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1985,10 +2403,11 @@ protected function validateSenderByOTPRequest($senderId, $otp = null) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2000,7 +2419,7 @@ protected function validateSenderByOTPRequest($senderId, $otp = null) * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/TasksApi.php b/lib/Api/TasksApi.php index 259ce0f..fbb4562 100644 --- a/lib/Api/TasksApi.php +++ b/lib/Api/TasksApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'crmTasksIdDelete' => [ + 'application/json', + ], + 'crmTasksIdGet' => [ + 'application/json', + ], + 'crmTasksIdPatch' => [ + 'application/json', + ], + 'crmTasksPost' => [ + 'application/json', + ], + 'crmTasktypesGet' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -92,27 +143,43 @@ public function getConfig() * * Get all tasks * - * @param string $filterType Filter by task type (ID) (optional) - * @param string $filterStatus Filter by task status (optional) - * @param string $filterDate Filter by date (optional) - * @param string $filterAssignTo Filter by assignTo id (optional) - * @param string $filterContacts Filter by contact ids (optional) - * @param string $filterDeals Filter by deals ids (optional) - * @param string $filterCompanies Filter by companies ids (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * @param string $sortBy The field used to sort field names. (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\TaskList + * @param string|null $filterType Filter by task type (ID) (optional) + * @param string|null $filterStatus Filter by task status (optional) + * @param string|null $filterDate Filter by date (optional) + * @param string|null $filterAssignTo Filter by the \"assignTo\" ID. You can utilize account emails for the \"assignTo\" attribute. (optional) + * @param string|null $filterContacts Filter by contact ids (optional) + * @param string|null $filterDeals Filter by deals ids (optional) + * @param string|null $filterCompanies Filter by companies ids (optional) + * @param int|null $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $offset Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string|null $sortBy The field used to sort field names. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksGet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\TaskList|\Brevo\Client\Models\ErrorModel */ - public function crmTasksGet($filterType = null, $filterStatus = null, $filterDate = null, $filterAssignTo = null, $filterContacts = null, $filterDeals = null, $filterCompanies = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null, $sortBy = null) + public function crmTasksGet( + ?string $filterType = null, + ?string $filterStatus = null, + ?string $filterDate = null, + ?string $filterAssignTo = null, + ?string $filterContacts = null, + ?string $filterDeals = null, + ?string $filterCompanies = null, + ?int $dateFrom = null, + ?int $dateTo = null, + ?int $offset = null, + ?int $limit = 50, + ?string $sort = null, + ?string $sortBy = null, + string $contentType = self::contentTypes['crmTasksGet'][0] + ): \Brevo\Client\Models\TaskList { - list($response) = $this->crmTasksGetWithHttpInfo($filterType, $filterStatus, $filterDate, $filterAssignTo, $filterContacts, $filterDeals, $filterCompanies, $dateFrom, $dateTo, $offset, $limit, $sort, $sortBy); + list($response) = $this->crmTasksGetWithHttpInfo($filterType, $filterStatus, $filterDate, $filterAssignTo, $filterContacts, $filterDeals, $filterCompanies, $dateFrom, $dateTo, $offset, $limit, $sort, $sortBy, $contentType); return $response; } @@ -121,28 +188,43 @@ public function crmTasksGet($filterType = null, $filterStatus = null, $filterDat * * Get all tasks * - * @param string $filterType Filter by task type (ID) (optional) - * @param string $filterStatus Filter by task status (optional) - * @param string $filterDate Filter by date (optional) - * @param string $filterAssignTo Filter by assignTo id (optional) - * @param string $filterContacts Filter by contact ids (optional) - * @param string $filterDeals Filter by deals ids (optional) - * @param string $filterCompanies Filter by companies ids (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * @param string $sortBy The field used to sort field names. (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\TaskList, HTTP status code, HTTP response headers (array of strings) + * @param string|null $filterType Filter by task type (ID) (optional) + * @param string|null $filterStatus Filter by task status (optional) + * @param string|null $filterDate Filter by date (optional) + * @param string|null $filterAssignTo Filter by the \"assignTo\" ID. You can utilize account emails for the \"assignTo\" attribute. (optional) + * @param string|null $filterContacts Filter by contact ids (optional) + * @param string|null $filterDeals Filter by deals ids (optional) + * @param string|null $filterCompanies Filter by companies ids (optional) + * @param int|null $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $offset Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string|null $sortBy The field used to sort field names. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksGet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\TaskList|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function crmTasksGetWithHttpInfo($filterType = null, $filterStatus = null, $filterDate = null, $filterAssignTo = null, $filterContacts = null, $filterDeals = null, $filterCompanies = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null, $sortBy = null) + public function crmTasksGetWithHttpInfo( + ?string $filterType = null, + ?string $filterStatus = null, + ?string $filterDate = null, + ?string $filterAssignTo = null, + ?string $filterContacts = null, + ?string $filterDeals = null, + ?string $filterCompanies = null, + ?int $dateFrom = null, + ?int $dateTo = null, + ?int $offset = null, + ?int $limit = 50, + ?string $sort = null, + ?string $sortBy = null, + string $contentType = self::contentTypes['crmTasksGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\TaskList'; - $request = $this->crmTasksGetRequest($filterType, $filterStatus, $filterDate, $filterAssignTo, $filterContacts, $filterDeals, $filterCompanies, $dateFrom, $dateTo, $offset, $limit, $sort, $sortBy); + $request = $this->crmTasksGetRequest($filterType, $filterStatus, $filterDate, $filterAssignTo, $filterContacts, $filterDeals, $filterCompanies, $dateFrom, $dateTo, $offset, $limit, $sort, $sortBy, $contentType); try { $options = $this->createHttpClientOption(); @@ -151,34 +233,111 @@ public function crmTasksGetWithHttpInfo($filterType = null, $filterStatus = null } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\TaskList', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\TaskList' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\TaskList', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\TaskList'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -193,7 +352,7 @@ public function crmTasksGetWithHttpInfo($filterType = null, $filterStatus = null case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\TaskList', + '\Brevo\Client\Models\TaskList', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -201,7 +360,7 @@ public function crmTasksGetWithHttpInfo($filterType = null, $filterStatus = null case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -216,26 +375,42 @@ public function crmTasksGetWithHttpInfo($filterType = null, $filterStatus = null * * Get all tasks * - * @param string $filterType Filter by task type (ID) (optional) - * @param string $filterStatus Filter by task status (optional) - * @param string $filterDate Filter by date (optional) - * @param string $filterAssignTo Filter by assignTo id (optional) - * @param string $filterContacts Filter by contact ids (optional) - * @param string $filterDeals Filter by deals ids (optional) - * @param string $filterCompanies Filter by companies ids (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * @param string $sortBy The field used to sort field names. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @param string|null $filterType Filter by task type (ID) (optional) + * @param string|null $filterStatus Filter by task status (optional) + * @param string|null $filterDate Filter by date (optional) + * @param string|null $filterAssignTo Filter by the \"assignTo\" ID. You can utilize account emails for the \"assignTo\" attribute. (optional) + * @param string|null $filterContacts Filter by contact ids (optional) + * @param string|null $filterDeals Filter by deals ids (optional) + * @param string|null $filterCompanies Filter by companies ids (optional) + * @param int|null $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $offset Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string|null $sortBy The field used to sort field names. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksGet'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmTasksGetAsync($filterType = null, $filterStatus = null, $filterDate = null, $filterAssignTo = null, $filterContacts = null, $filterDeals = null, $filterCompanies = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null, $sortBy = null) + public function crmTasksGetAsync( + ?string $filterType = null, + ?string $filterStatus = null, + ?string $filterDate = null, + ?string $filterAssignTo = null, + ?string $filterContacts = null, + ?string $filterDeals = null, + ?string $filterCompanies = null, + ?int $dateFrom = null, + ?int $dateTo = null, + ?int $offset = null, + ?int $limit = 50, + ?string $sort = null, + ?string $sortBy = null, + string $contentType = self::contentTypes['crmTasksGet'][0] + ): PromiseInterface { - return $this->crmTasksGetAsyncWithHttpInfo($filterType, $filterStatus, $filterDate, $filterAssignTo, $filterContacts, $filterDeals, $filterCompanies, $dateFrom, $dateTo, $offset, $limit, $sort, $sortBy) + return $this->crmTasksGetAsyncWithHttpInfo($filterType, $filterStatus, $filterDate, $filterAssignTo, $filterContacts, $filterDeals, $filterCompanies, $dateFrom, $dateTo, $offset, $limit, $sort, $sortBy, $contentType) ->then( function ($response) { return $response[0]; @@ -248,37 +423,53 @@ function ($response) { * * Get all tasks * - * @param string $filterType Filter by task type (ID) (optional) - * @param string $filterStatus Filter by task status (optional) - * @param string $filterDate Filter by date (optional) - * @param string $filterAssignTo Filter by assignTo id (optional) - * @param string $filterContacts Filter by contact ids (optional) - * @param string $filterDeals Filter by deals ids (optional) - * @param string $filterCompanies Filter by companies ids (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * @param string $sortBy The field used to sort field names. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @param string|null $filterType Filter by task type (ID) (optional) + * @param string|null $filterStatus Filter by task status (optional) + * @param string|null $filterDate Filter by date (optional) + * @param string|null $filterAssignTo Filter by the \"assignTo\" ID. You can utilize account emails for the \"assignTo\" attribute. (optional) + * @param string|null $filterContacts Filter by contact ids (optional) + * @param string|null $filterDeals Filter by deals ids (optional) + * @param string|null $filterCompanies Filter by companies ids (optional) + * @param int|null $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $offset Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string|null $sortBy The field used to sort field names. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksGet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmTasksGetAsyncWithHttpInfo($filterType = null, $filterStatus = null, $filterDate = null, $filterAssignTo = null, $filterContacts = null, $filterDeals = null, $filterCompanies = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null, $sortBy = null) + public function crmTasksGetAsyncWithHttpInfo( + $filterType = null, + $filterStatus = null, + $filterDate = null, + $filterAssignTo = null, + $filterContacts = null, + $filterDeals = null, + $filterCompanies = null, + $dateFrom = null, + $dateTo = null, + $offset = null, + $limit = 50, + $sort = null, + $sortBy = null, + string $contentType = self::contentTypes['crmTasksGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\TaskList'; - $request = $this->crmTasksGetRequest($filterType, $filterStatus, $filterDate, $filterAssignTo, $filterContacts, $filterDeals, $filterCompanies, $dateFrom, $dateTo, $offset, $limit, $sort, $sortBy); + $returnType = '\Brevo\Client\Models\TaskList'; + $request = $this->crmTasksGetRequest($filterType, $filterStatus, $filterDate, $filterAssignTo, $filterContacts, $filterDeals, $filterCompanies, $dateFrom, $dateTo, $offset, $limit, $sort, $sortBy, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -301,7 +492,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -310,26 +501,56 @@ function ($exception) { /** * Create request for operation 'crmTasksGet' * - * @param string $filterType Filter by task type (ID) (optional) - * @param string $filterStatus Filter by task status (optional) - * @param string $filterDate Filter by date (optional) - * @param string $filterAssignTo Filter by assignTo id (optional) - * @param string $filterContacts Filter by contact ids (optional) - * @param string $filterDeals Filter by deals ids (optional) - * @param string $filterCompanies Filter by companies ids (optional) - * @param int $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) - * @param int $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) - * @param int $offset Index of the first document of the page (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) - * @param string $sortBy The field used to sort field names. (optional) - * - * @throws \InvalidArgumentException + * @param string|null $filterType Filter by task type (ID) (optional) + * @param string|null $filterStatus Filter by task status (optional) + * @param string|null $filterDate Filter by date (optional) + * @param string|null $filterAssignTo Filter by the \"assignTo\" ID. You can utilize account emails for the \"assignTo\" attribute. (optional) + * @param string|null $filterContacts Filter by contact ids (optional) + * @param string|null $filterDeals Filter by deals ids (optional) + * @param string|null $filterCompanies Filter by companies ids (optional) + * @param int|null $dateFrom dateFrom to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $dateTo dateTo to date range filter type (timestamp in milliseconds) (optional) + * @param int|null $offset Index of the first document of the page (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param string|null $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed (optional) + * @param string|null $sortBy The field used to sort field names. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksGet'] to see the possible values for this operation + * + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmTasksGetRequest($filterType = null, $filterStatus = null, $filterDate = null, $filterAssignTo = null, $filterContacts = null, $filterDeals = null, $filterCompanies = null, $dateFrom = null, $dateTo = null, $offset = null, $limit = '50', $sort = null, $sortBy = null) + public function crmTasksGetRequest( + $filterType = null, + $filterStatus = null, + $filterDate = null, + $filterAssignTo = null, + $filterContacts = null, + $filterDeals = null, + $filterCompanies = null, + $dateFrom = null, + $dateTo = null, + $offset = null, + $limit = 50, + $sort = null, + $sortBy = null, + string $contentType = self::contentTypes['crmTasksGet'][0] + ): Request { + + + + + + + + + + + + + + $resourcePath = '/crm/tasks'; $formParams = []; $queryParams = []; @@ -338,106 +559,154 @@ protected function crmTasksGetRequest($filterType = null, $filterStatus = null, $multipart = false; // query params - if ($filterType !== null) { - $queryParams['filter[type]'] = ObjectSerializer::toQueryValue($filterType); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filterType, + 'filter[type]', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($filterStatus !== null) { - $queryParams['filter[status]'] = ObjectSerializer::toQueryValue($filterStatus); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filterStatus, + 'filter[status]', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($filterDate !== null) { - $queryParams['filter[date]'] = ObjectSerializer::toQueryValue($filterDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filterDate, + 'filter[date]', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($filterAssignTo !== null) { - $queryParams['filter[assignTo]'] = ObjectSerializer::toQueryValue($filterAssignTo); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filterAssignTo, + 'filter[assignTo]', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($filterContacts !== null) { - $queryParams['filter[contacts]'] = ObjectSerializer::toQueryValue($filterContacts); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filterContacts, + 'filter[contacts]', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($filterDeals !== null) { - $queryParams['filter[deals]'] = ObjectSerializer::toQueryValue($filterDeals); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filterDeals, + 'filter[deals]', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($filterCompanies !== null) { - $queryParams['filter[companies]'] = ObjectSerializer::toQueryValue($filterCompanies); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filterCompanies, + 'filter[companies]', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($dateFrom !== null) { - $queryParams['dateFrom'] = ObjectSerializer::toQueryValue($dateFrom); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $dateFrom, + 'dateFrom', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($dateTo !== null) { - $queryParams['dateTo'] = ObjectSerializer::toQueryValue($dateTo); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $dateTo, + 'dateTo', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sortBy !== null) { - $queryParams['sortBy'] = ObjectSerializer::toQueryValue($sortBy); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sortBy, + 'sortBy', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -463,10 +732,11 @@ protected function crmTasksGetRequest($filterType = null, $filterStatus = null, $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -478,14 +748,18 @@ protected function crmTasksGetRequest($filterType = null, $filterStatus = null, * Delete a task * * @param string $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksIdDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function crmTasksIdDelete($id) + public function crmTasksIdDelete( + string $id, + string $contentType = self::contentTypes['crmTasksIdDelete'][0] + ): void { - $this->crmTasksIdDeleteWithHttpInfo($id); + $this->crmTasksIdDeleteWithHttpInfo($id, $contentType); } /** @@ -494,15 +768,18 @@ public function crmTasksIdDelete($id) * Delete a task * * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksIdDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function crmTasksIdDeleteWithHttpInfo($id) + public function crmTasksIdDeleteWithHttpInfo( + string $id, + string $contentType = self::contentTypes['crmTasksIdDelete'][0] + ): array { - $returnType = ''; - $request = $this->crmTasksIdDeleteRequest($id); + $request = $this->crmTasksIdDeleteRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -511,26 +788,21 @@ public function crmTasksIdDeleteWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -539,7 +811,7 @@ public function crmTasksIdDeleteWithHttpInfo($id) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -547,7 +819,7 @@ public function crmTasksIdDeleteWithHttpInfo($id) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -563,13 +835,17 @@ public function crmTasksIdDeleteWithHttpInfo($id) * Delete a task * * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmTasksIdDeleteAsync($id) + public function crmTasksIdDeleteAsync( + string $id, + string $contentType = self::contentTypes['crmTasksIdDelete'][0] + ): PromiseInterface { - return $this->crmTasksIdDeleteAsyncWithHttpInfo($id) + return $this->crmTasksIdDeleteAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -583,14 +859,19 @@ function ($response) { * Delete a task * * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmTasksIdDeleteAsyncWithHttpInfo($id) + public function crmTasksIdDeleteAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['crmTasksIdDelete'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->crmTasksIdDeleteRequest($id); + $request = $this->crmTasksIdDeleteRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -609,7 +890,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -619,19 +900,25 @@ function ($exception) { * Create request for operation 'crmTasksIdDelete' * * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksIdDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmTasksIdDeleteRequest($id) + public function crmTasksIdDeleteRequest( + $id, + string $contentType = self::contentTypes['crmTasksIdDelete'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling crmTasksIdDelete' ); } + $resourcePath = '/crm/tasks/{id}'; $formParams = []; $queryParams = []; @@ -640,6 +927,7 @@ protected function crmTasksIdDeleteRequest($id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -649,53 +937,35 @@ protected function crmTasksIdDeleteRequest($id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -721,10 +991,11 @@ protected function crmTasksIdDeleteRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -736,14 +1007,18 @@ protected function crmTasksIdDeleteRequest($id) * Get a task * * @param string $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksIdGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\Task + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\Task|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function crmTasksIdGet($id) + public function crmTasksIdGet( + string $id, + string $contentType = self::contentTypes['crmTasksIdGet'][0] + ): \Brevo\Client\Models\Task { - list($response) = $this->crmTasksIdGetWithHttpInfo($id); + list($response) = $this->crmTasksIdGetWithHttpInfo($id, $contentType); return $response; } @@ -753,15 +1028,18 @@ public function crmTasksIdGet($id) * Get a task * * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksIdGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\Task, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\Task|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function crmTasksIdGetWithHttpInfo($id) + public function crmTasksIdGetWithHttpInfo( + string $id, + string $contentType = self::contentTypes['crmTasksIdGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\Task'; - $request = $this->crmTasksIdGetRequest($id); + $request = $this->crmTasksIdGetRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -770,34 +1048,138 @@ public function crmTasksIdGetWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\Task', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\Task' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\Task', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\Task'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -812,7 +1194,7 @@ public function crmTasksIdGetWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\Task', + '\Brevo\Client\Models\Task', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -820,7 +1202,7 @@ public function crmTasksIdGetWithHttpInfo($id) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -828,7 +1210,7 @@ public function crmTasksIdGetWithHttpInfo($id) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -844,13 +1226,17 @@ public function crmTasksIdGetWithHttpInfo($id) * Get a task * * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmTasksIdGetAsync($id) + public function crmTasksIdGetAsync( + string $id, + string $contentType = self::contentTypes['crmTasksIdGet'][0] + ): PromiseInterface { - return $this->crmTasksIdGetAsyncWithHttpInfo($id) + return $this->crmTasksIdGetAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -864,24 +1250,28 @@ function ($response) { * Get a task * * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmTasksIdGetAsyncWithHttpInfo($id) + public function crmTasksIdGetAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['crmTasksIdGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\Task'; - $request = $this->crmTasksIdGetRequest($id); + $returnType = '\Brevo\Client\Models\Task'; + $request = $this->crmTasksIdGetRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -904,7 +1294,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -914,19 +1304,25 @@ function ($exception) { * Create request for operation 'crmTasksIdGet' * * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksIdGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmTasksIdGetRequest($id) + public function crmTasksIdGetRequest( + $id, + string $contentType = self::contentTypes['crmTasksIdGet'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling crmTasksIdGet' ); } + $resourcePath = '/crm/tasks/{id}'; $formParams = []; $queryParams = []; @@ -935,6 +1331,7 @@ protected function crmTasksIdGetRequest($id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -944,53 +1341,35 @@ protected function crmTasksIdGetRequest($id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1016,10 +1395,11 @@ protected function crmTasksIdGetRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1031,15 +1411,20 @@ protected function crmTasksIdGetRequest($id) * Update a task * * @param string $id id (required) - * @param \Brevo\Client\Model\Body9 $body Updated task details. (required) + * @param \Brevo\Client\Models\CrmTasksIdPatchRequest $crmTasksIdPatchRequest Updated task details. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksIdPatch'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function crmTasksIdPatch($id, $body) + public function crmTasksIdPatch( + string $id, + \Brevo\Client\Models\CrmTasksIdPatchRequest $crmTasksIdPatchRequest, + string $contentType = self::contentTypes['crmTasksIdPatch'][0] + ): void { - $this->crmTasksIdPatchWithHttpInfo($id, $body); + $this->crmTasksIdPatchWithHttpInfo($id, $crmTasksIdPatchRequest, $contentType); } /** @@ -1048,16 +1433,20 @@ public function crmTasksIdPatch($id, $body) * Update a task * * @param string $id (required) - * @param \Brevo\Client\Model\Body9 $body Updated task details. (required) + * @param \Brevo\Client\Models\CrmTasksIdPatchRequest $crmTasksIdPatchRequest Updated task details. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksIdPatch'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function crmTasksIdPatchWithHttpInfo($id, $body) + public function crmTasksIdPatchWithHttpInfo( + string $id, + \Brevo\Client\Models\CrmTasksIdPatchRequest $crmTasksIdPatchRequest, + string $contentType = self::contentTypes['crmTasksIdPatch'][0] + ): array { - $returnType = ''; - $request = $this->crmTasksIdPatchRequest($id, $body); + $request = $this->crmTasksIdPatchRequest($id, $crmTasksIdPatchRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -1066,26 +1455,21 @@ public function crmTasksIdPatchWithHttpInfo($id, $body) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -1094,7 +1478,7 @@ public function crmTasksIdPatchWithHttpInfo($id, $body) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1102,7 +1486,7 @@ public function crmTasksIdPatchWithHttpInfo($id, $body) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1118,14 +1502,19 @@ public function crmTasksIdPatchWithHttpInfo($id, $body) * Update a task * * @param string $id (required) - * @param \Brevo\Client\Model\Body9 $body Updated task details. (required) + * @param \Brevo\Client\Models\CrmTasksIdPatchRequest $crmTasksIdPatchRequest Updated task details. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksIdPatch'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmTasksIdPatchAsync($id, $body) + public function crmTasksIdPatchAsync( + string $id, + \Brevo\Client\Models\CrmTasksIdPatchRequest $crmTasksIdPatchRequest, + string $contentType = self::contentTypes['crmTasksIdPatch'][0] + ): PromiseInterface { - return $this->crmTasksIdPatchAsyncWithHttpInfo($id, $body) + return $this->crmTasksIdPatchAsyncWithHttpInfo($id, $crmTasksIdPatchRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -1139,15 +1528,21 @@ function ($response) { * Update a task * * @param string $id (required) - * @param \Brevo\Client\Model\Body9 $body Updated task details. (required) + * @param \Brevo\Client\Models\CrmTasksIdPatchRequest $crmTasksIdPatchRequest Updated task details. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksIdPatch'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmTasksIdPatchAsyncWithHttpInfo($id, $body) + public function crmTasksIdPatchAsyncWithHttpInfo( + $id, + $crmTasksIdPatchRequest, + string $contentType = self::contentTypes['crmTasksIdPatch'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->crmTasksIdPatchRequest($id, $body); + $request = $this->crmTasksIdPatchRequest($id, $crmTasksIdPatchRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1166,7 +1561,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1176,26 +1571,34 @@ function ($exception) { * Create request for operation 'crmTasksIdPatch' * * @param string $id (required) - * @param \Brevo\Client\Model\Body9 $body Updated task details. (required) + * @param \Brevo\Client\Models\CrmTasksIdPatchRequest $crmTasksIdPatchRequest Updated task details. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksIdPatch'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmTasksIdPatchRequest($id, $body) + public function crmTasksIdPatchRequest( + $id, + $crmTasksIdPatchRequest, + string $contentType = self::contentTypes['crmTasksIdPatch'][0] + ): Request { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $id when calling crmTasksIdPatch' ); } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling crmTasksIdPatch' + + // verify the required parameter 'crmTasksIdPatchRequest' is set + if ($crmTasksIdPatchRequest === null || (is_array($crmTasksIdPatchRequest) && count($crmTasksIdPatchRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $crmTasksIdPatchRequest when calling crmTasksIdPatch' ); } + $resourcePath = '/crm/tasks/{id}'; $formParams = []; $queryParams = []; @@ -1204,6 +1607,7 @@ protected function crmTasksIdPatchRequest($id, $body) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1213,56 +1617,42 @@ protected function crmTasksIdPatchRequest($id, $body) ); } - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($crmTasksIdPatchRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($crmTasksIdPatchRequest)); + } else { + $httpBody = $crmTasksIdPatchRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1288,10 +1678,11 @@ protected function crmTasksIdPatchRequest($id, $body) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PATCH', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1302,15 +1693,19 @@ protected function crmTasksIdPatchRequest($id, $body) * * Create a task * - * @param \Brevo\Client\Model\Body8 $body Task name. (required) + * @param \Brevo\Client\Models\CrmTasksPostRequest $crmTasksPostRequest Task name. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksPost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\InlineResponse2012 + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CrmTasksPost201Response */ - public function crmTasksPost($body) + public function crmTasksPost( + \Brevo\Client\Models\CrmTasksPostRequest $crmTasksPostRequest, + string $contentType = self::contentTypes['crmTasksPost'][0] + ): \Brevo\Client\Models\CrmTasksPost201Response { - list($response) = $this->crmTasksPostWithHttpInfo($body); + list($response) = $this->crmTasksPostWithHttpInfo($crmTasksPostRequest, $contentType); return $response; } @@ -1319,16 +1714,19 @@ public function crmTasksPost($body) * * Create a task * - * @param \Brevo\Client\Model\Body8 $body Task name. (required) + * @param \Brevo\Client\Models\CrmTasksPostRequest $crmTasksPostRequest Task name. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksPost'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\InlineResponse2012, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CrmTasksPost201Response, HTTP status code, HTTP response headers (array of strings) */ - public function crmTasksPostWithHttpInfo($body) + public function crmTasksPostWithHttpInfo( + \Brevo\Client\Models\CrmTasksPostRequest $crmTasksPostRequest, + string $contentType = self::contentTypes['crmTasksPost'][0] + ): array { - $returnType = '\Brevo\Client\Model\InlineResponse2012'; - $request = $this->crmTasksPostRequest($body); + $request = $this->crmTasksPostRequest($crmTasksPostRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -1337,34 +1735,84 @@ public function crmTasksPostWithHttpInfo($body) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CrmTasksPost201Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CrmTasksPost201Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CrmTasksPost201Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CrmTasksPost201Response'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1379,7 +1827,7 @@ public function crmTasksPostWithHttpInfo($body) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\InlineResponse2012', + '\Brevo\Client\Models\CrmTasksPost201Response', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1394,14 +1842,18 @@ public function crmTasksPostWithHttpInfo($body) * * Create a task * - * @param \Brevo\Client\Model\Body8 $body Task name. (required) + * @param \Brevo\Client\Models\CrmTasksPostRequest $crmTasksPostRequest Task name. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmTasksPostAsync($body) + public function crmTasksPostAsync( + \Brevo\Client\Models\CrmTasksPostRequest $crmTasksPostRequest, + string $contentType = self::contentTypes['crmTasksPost'][0] + ): PromiseInterface { - return $this->crmTasksPostAsyncWithHttpInfo($body) + return $this->crmTasksPostAsyncWithHttpInfo($crmTasksPostRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -1414,25 +1866,29 @@ function ($response) { * * Create a task * - * @param \Brevo\Client\Model\Body8 $body Task name. (required) + * @param \Brevo\Client\Models\CrmTasksPostRequest $crmTasksPostRequest Task name. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmTasksPostAsyncWithHttpInfo($body) + public function crmTasksPostAsyncWithHttpInfo( + $crmTasksPostRequest, + string $contentType = self::contentTypes['crmTasksPost'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\InlineResponse2012'; - $request = $this->crmTasksPostRequest($body); + $returnType = '\Brevo\Client\Models\CrmTasksPost201Response'; + $request = $this->crmTasksPostRequest($crmTasksPostRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1455,7 +1911,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1464,20 +1920,26 @@ function ($exception) { /** * Create request for operation 'crmTasksPost' * - * @param \Brevo\Client\Model\Body8 $body Task name. (required) + * @param \Brevo\Client\Models\CrmTasksPostRequest $crmTasksPostRequest Task name. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasksPost'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmTasksPostRequest($body) + public function crmTasksPostRequest( + $crmTasksPostRequest, + string $contentType = self::contentTypes['crmTasksPost'][0] + ): Request { - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling crmTasksPost' + + // verify the required parameter 'crmTasksPostRequest' is set + if ($crmTasksPostRequest === null || (is_array($crmTasksPostRequest) && count($crmTasksPostRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $crmTasksPostRequest when calling crmTasksPost' ); } + $resourcePath = '/crm/tasks'; $formParams = []; $queryParams = []; @@ -1487,56 +1949,43 @@ protected function crmTasksPostRequest($body) - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($crmTasksPostRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($crmTasksPostRequest)); + } else { + $httpBody = $crmTasksPostRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1562,10 +2011,11 @@ protected function crmTasksPostRequest($body) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1576,14 +2026,17 @@ protected function crmTasksPostRequest($body) * * Get all task types * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasktypesGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\TaskTypes + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\TaskTypes */ - public function crmTasktypesGet() + public function crmTasktypesGet( + string $contentType = self::contentTypes['crmTasktypesGet'][0] + ): \Brevo\Client\Models\TaskTypes { - list($response) = $this->crmTasktypesGetWithHttpInfo(); + list($response) = $this->crmTasktypesGetWithHttpInfo($contentType); return $response; } @@ -1592,15 +2045,17 @@ public function crmTasktypesGet() * * Get all task types * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasktypesGet'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\TaskTypes, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\TaskTypes, HTTP status code, HTTP response headers (array of strings) */ - public function crmTasktypesGetWithHttpInfo() + public function crmTasktypesGetWithHttpInfo( + string $contentType = self::contentTypes['crmTasktypesGet'][0] + ): array { - $returnType = '\Brevo\Client\Model\TaskTypes'; - $request = $this->crmTasktypesGetRequest(); + $request = $this->crmTasktypesGetRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -1609,34 +2064,84 @@ public function crmTasktypesGetWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\TaskTypes', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\TaskTypes' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\TaskTypes', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\TaskTypes'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1651,7 +2156,7 @@ public function crmTasktypesGetWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\TaskTypes', + '\Brevo\Client\Models\TaskTypes', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1666,13 +2171,16 @@ public function crmTasktypesGetWithHttpInfo() * * Get all task types * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasktypesGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmTasktypesGetAsync() + public function crmTasktypesGetAsync( + string $contentType = self::contentTypes['crmTasktypesGet'][0] + ): PromiseInterface { - return $this->crmTasktypesGetAsyncWithHttpInfo() + return $this->crmTasktypesGetAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -1685,24 +2193,27 @@ function ($response) { * * Get all task types * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasktypesGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function crmTasktypesGetAsyncWithHttpInfo() + public function crmTasktypesGetAsyncWithHttpInfo( + string $contentType = self::contentTypes['crmTasktypesGet'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\TaskTypes'; - $request = $this->crmTasktypesGetRequest(); + $returnType = '\Brevo\Client\Models\TaskTypes'; + $request = $this->crmTasktypesGetRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1725,7 +2236,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1734,13 +2245,17 @@ function ($exception) { /** * Create request for operation 'crmTasktypesGet' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['crmTasktypesGet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function crmTasktypesGetRequest() + public function crmTasktypesGetRequest( + string $contentType = self::contentTypes['crmTasktypesGet'][0] + ): Request { + $resourcePath = '/crm/tasktypes'; $formParams = []; $queryParams = []; @@ -1750,53 +2265,36 @@ protected function crmTasktypesGetRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1822,10 +2320,11 @@ protected function crmTasktypesGetRequest() $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1837,7 +2336,7 @@ protected function crmTasktypesGetRequest() * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/TierApi.php b/lib/Api/TierApi.php new file mode 100644 index 0000000..66a154e --- /dev/null +++ b/lib/Api/TierApi.php @@ -0,0 +1,4549 @@ + [ + 'application/json', + ], + 'createTierGroup' => [ + 'application/json', + ], + 'deleteTierGroup' => [ + 'application/json', + ], + 'getListOfTierGroups' => [ + 'application/json', + ], + 'getLoyaltyProgramTier' => [ + 'application/json', + ], + 'getTierGroup' => [ + 'application/json', + ], + 'loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost' => [ + 'application/json', + ], + 'loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete' => [ + 'application/json', + ], + 'loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut' => [ + 'application/json', + ], + 'updateTierGroup' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation createTierForTierGroup + * + * Create new tier + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierGroupId Tier group Id (required) + * @param \Brevo\Client\Models\TierRequest $tierRequest tierRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTierForTierGroup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\Tier|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError + */ + public function createTierForTierGroup( + string $loyaltyProgramId, + string $tierGroupId, + \Brevo\Client\Models\TierRequest $tierRequest, + string $contentType = self::contentTypes['createTierForTierGroup'][0] + ): \Brevo\Client\Models\Tier + { + list($response) = $this->createTierForTierGroupWithHttpInfo($loyaltyProgramId, $tierGroupId, $tierRequest, $contentType); + return $response; + } + + /** + * Operation createTierForTierGroupWithHttpInfo + * + * Create new tier + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierGroupId Tier group Id (required) + * @param \Brevo\Client\Models\TierRequest $tierRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTierForTierGroup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\Tier|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError, HTTP status code, HTTP response headers (array of strings) + */ + public function createTierForTierGroupWithHttpInfo( + string $loyaltyProgramId, + string $tierGroupId, + \Brevo\Client\Models\TierRequest $tierRequest, + string $contentType = self::contentTypes['createTierForTierGroup'][0] + ): array + { + $request = $this->createTierForTierGroupRequest($loyaltyProgramId, $tierGroupId, $tierRequest, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\Tier', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\Tier' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\Tier', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ValidationError', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ValidationError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ValidationError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\Tier'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\Tier', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ValidationError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createTierForTierGroupAsync + * + * Create new tier + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierGroupId Tier group Id (required) + * @param \Brevo\Client\Models\TierRequest $tierRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTierForTierGroup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createTierForTierGroupAsync( + string $loyaltyProgramId, + string $tierGroupId, + \Brevo\Client\Models\TierRequest $tierRequest, + string $contentType = self::contentTypes['createTierForTierGroup'][0] + ): PromiseInterface + { + return $this->createTierForTierGroupAsyncWithHttpInfo($loyaltyProgramId, $tierGroupId, $tierRequest, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createTierForTierGroupAsyncWithHttpInfo + * + * Create new tier + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierGroupId Tier group Id (required) + * @param \Brevo\Client\Models\TierRequest $tierRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTierForTierGroup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createTierForTierGroupAsyncWithHttpInfo( + $loyaltyProgramId, + $tierGroupId, + $tierRequest, + string $contentType = self::contentTypes['createTierForTierGroup'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\Tier'; + $request = $this->createTierForTierGroupRequest($loyaltyProgramId, $tierGroupId, $tierRequest, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createTierForTierGroup' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierGroupId Tier group Id (required) + * @param \Brevo\Client\Models\TierRequest $tierRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTierForTierGroup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createTierForTierGroupRequest( + $loyaltyProgramId, + $tierGroupId, + $tierRequest, + string $contentType = self::contentTypes['createTierForTierGroup'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling createTierForTierGroup' + ); + } + + // verify the required parameter 'tierGroupId' is set + if ($tierGroupId === null || (is_array($tierGroupId) && count($tierGroupId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $tierGroupId when calling createTierForTierGroup' + ); + } + + // verify the required parameter 'tierRequest' is set + if ($tierRequest === null || (is_array($tierRequest) && count($tierRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $tierRequest when calling createTierForTierGroup' + ); + } + + + $resourcePath = '/loyalty/tier/programs/{loyaltyProgramId}/tier-groups/{tierGroupId}/tiers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + // path params + if ($tierGroupId !== null) { + $resourcePath = str_replace( + '{' . 'tierGroupId' . '}', + ObjectSerializer::toPathValue($tierGroupId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($tierRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($tierRequest)); + } else { + $httpBody = $tierRequest; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createTierGroup + * + * Create tier group + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateTierGroupRequest $createTierGroupRequest Subscription Member information (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTierGroup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\TierGroup|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ErrorResponse|\Brevo\Client\Models\ValidationError + */ + public function createTierGroup( + string $loyaltyProgramId, + \Brevo\Client\Models\CreateTierGroupRequest $createTierGroupRequest, + string $contentType = self::contentTypes['createTierGroup'][0] + ): \Brevo\Client\Models\TierGroup + { + list($response) = $this->createTierGroupWithHttpInfo($loyaltyProgramId, $createTierGroupRequest, $contentType); + return $response; + } + + /** + * Operation createTierGroupWithHttpInfo + * + * Create tier group + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateTierGroupRequest $createTierGroupRequest Subscription Member information (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTierGroup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\TierGroup|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ErrorResponse|\Brevo\Client\Models\ValidationError, HTTP status code, HTTP response headers (array of strings) + */ + public function createTierGroupWithHttpInfo( + string $loyaltyProgramId, + \Brevo\Client\Models\CreateTierGroupRequest $createTierGroupRequest, + string $contentType = self::contentTypes['createTierGroup'][0] + ): array + { + $request = $this->createTierGroupRequest($loyaltyProgramId, $createTierGroupRequest, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\TierGroup', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\TierGroup' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\TierGroup', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 409: + if (in_array('\Brevo\Client\Models\ErrorResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ValidationError', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ValidationError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ValidationError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\TierGroup'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\TierGroup', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ValidationError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createTierGroupAsync + * + * Create tier group + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateTierGroupRequest $createTierGroupRequest Subscription Member information (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTierGroup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createTierGroupAsync( + string $loyaltyProgramId, + \Brevo\Client\Models\CreateTierGroupRequest $createTierGroupRequest, + string $contentType = self::contentTypes['createTierGroup'][0] + ): PromiseInterface + { + return $this->createTierGroupAsyncWithHttpInfo($loyaltyProgramId, $createTierGroupRequest, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createTierGroupAsyncWithHttpInfo + * + * Create tier group + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateTierGroupRequest $createTierGroupRequest Subscription Member information (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTierGroup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createTierGroupAsyncWithHttpInfo( + $loyaltyProgramId, + $createTierGroupRequest, + string $contentType = self::contentTypes['createTierGroup'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\TierGroup'; + $request = $this->createTierGroupRequest($loyaltyProgramId, $createTierGroupRequest, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createTierGroup' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param \Brevo\Client\Models\CreateTierGroupRequest $createTierGroupRequest Subscription Member information (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTierGroup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createTierGroupRequest( + $loyaltyProgramId, + $createTierGroupRequest, + string $contentType = self::contentTypes['createTierGroup'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling createTierGroup' + ); + } + + // verify the required parameter 'createTierGroupRequest' is set + if ($createTierGroupRequest === null || (is_array($createTierGroupRequest) && count($createTierGroupRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $createTierGroupRequest when calling createTierGroup' + ); + } + + + $resourcePath = '/loyalty/tier/programs/{loyaltyProgramId}/tier-groups'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($createTierGroupRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createTierGroupRequest)); + } else { + $httpBody = $createTierGroupRequest; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteTierGroup + * + * Delete tier group + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierGroupId Tier group Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteTierGroup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return void + */ + public function deleteTierGroup( + string $loyaltyProgramId, + string $tierGroupId, + string $contentType = self::contentTypes['deleteTierGroup'][0] + ): void + { + $this->deleteTierGroupWithHttpInfo($loyaltyProgramId, $tierGroupId, $contentType); + } + + /** + * Operation deleteTierGroupWithHttpInfo + * + * Delete tier group + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierGroupId Tier group Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteTierGroup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteTierGroupWithHttpInfo( + string $loyaltyProgramId, + string $tierGroupId, + string $contentType = self::contentTypes['deleteTierGroup'][0] + ): array + { + $request = $this->deleteTierGroupRequest($loyaltyProgramId, $tierGroupId, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\UnauthorizedResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteTierGroupAsync + * + * Delete tier group + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierGroupId Tier group Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteTierGroup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteTierGroupAsync( + string $loyaltyProgramId, + string $tierGroupId, + string $contentType = self::contentTypes['deleteTierGroup'][0] + ): PromiseInterface + { + return $this->deleteTierGroupAsyncWithHttpInfo($loyaltyProgramId, $tierGroupId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteTierGroupAsyncWithHttpInfo + * + * Delete tier group + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierGroupId Tier group Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteTierGroup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteTierGroupAsyncWithHttpInfo( + $loyaltyProgramId, + $tierGroupId, + string $contentType = self::contentTypes['deleteTierGroup'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteTierGroupRequest($loyaltyProgramId, $tierGroupId, $contentType); + + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteTierGroup' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierGroupId Tier group Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteTierGroup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteTierGroupRequest( + $loyaltyProgramId, + $tierGroupId, + string $contentType = self::contentTypes['deleteTierGroup'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling deleteTierGroup' + ); + } + + // verify the required parameter 'tierGroupId' is set + if ($tierGroupId === null || (is_array($tierGroupId) && count($tierGroupId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $tierGroupId when calling deleteTierGroup' + ); + } + + + $resourcePath = '/loyalty/tier/programs/{loyaltyProgramId}/tier-groups/{tierGroupId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + // path params + if ($tierGroupId !== null) { + $resourcePath = str_replace( + '{' . 'tierGroupId' . '}', + ObjectSerializer::toPathValue($tierGroupId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getListOfTierGroups + * + * Get tier group page + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string|null $version Select 'active' to retrieve list of all tier groups which are live for clients. Select draft to retrieve list of all non deleted tier groups. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getListOfTierGroups'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\TierGroupPage|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\UnauthorizedResponse|\Brevo\Client\Models\ValidationError + */ + public function getListOfTierGroups( + string $loyaltyProgramId, + ?string $version = 'draft', + string $contentType = self::contentTypes['getListOfTierGroups'][0] + ): \Brevo\Client\Models\TierGroupPage + { + list($response) = $this->getListOfTierGroupsWithHttpInfo($loyaltyProgramId, $version, $contentType); + return $response; + } + + /** + * Operation getListOfTierGroupsWithHttpInfo + * + * Get tier group page + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string|null $version Select 'active' to retrieve list of all tier groups which are live for clients. Select draft to retrieve list of all non deleted tier groups. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getListOfTierGroups'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\TierGroupPage|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\UnauthorizedResponse|\Brevo\Client\Models\ValidationError, HTTP status code, HTTP response headers (array of strings) + */ + public function getListOfTierGroupsWithHttpInfo( + string $loyaltyProgramId, + ?string $version = 'draft', + string $contentType = self::contentTypes['getListOfTierGroups'][0] + ): array + { + $request = $this->getListOfTierGroupsRequest($loyaltyProgramId, $version, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\TierGroupPage', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\TierGroupPage' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\TierGroupPage', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\UnauthorizedResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\UnauthorizedResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\UnauthorizedResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ValidationError', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ValidationError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ValidationError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\TierGroupPage'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\TierGroupPage', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\UnauthorizedResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ValidationError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getListOfTierGroupsAsync + * + * Get tier group page + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string|null $version Select 'active' to retrieve list of all tier groups which are live for clients. Select draft to retrieve list of all non deleted tier groups. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getListOfTierGroups'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getListOfTierGroupsAsync( + string $loyaltyProgramId, + ?string $version = 'draft', + string $contentType = self::contentTypes['getListOfTierGroups'][0] + ): PromiseInterface + { + return $this->getListOfTierGroupsAsyncWithHttpInfo($loyaltyProgramId, $version, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getListOfTierGroupsAsyncWithHttpInfo + * + * Get tier group page + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string|null $version Select 'active' to retrieve list of all tier groups which are live for clients. Select draft to retrieve list of all non deleted tier groups. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getListOfTierGroups'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getListOfTierGroupsAsyncWithHttpInfo( + $loyaltyProgramId, + $version = 'draft', + string $contentType = self::contentTypes['getListOfTierGroups'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\TierGroupPage'; + $request = $this->getListOfTierGroupsRequest($loyaltyProgramId, $version, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getListOfTierGroups' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string|null $version Select 'active' to retrieve list of all tier groups which are live for clients. Select draft to retrieve list of all non deleted tier groups. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getListOfTierGroups'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getListOfTierGroupsRequest( + $loyaltyProgramId, + $version = 'draft', + string $contentType = self::contentTypes['getListOfTierGroups'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling getListOfTierGroups' + ); + } + + + + $resourcePath = '/loyalty/tier/programs/{loyaltyProgramId}/tier-groups'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $version, + 'version', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getLoyaltyProgramTier + * + * Get tier page + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string|null $version Select 'active' to retrieve list of all tiers which are live for clients. Select draft to retrieve list of all non deleted tiers. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLoyaltyProgramTier'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\LoyaltyTierPage|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError + */ + public function getLoyaltyProgramTier( + string $loyaltyProgramId, + ?string $version = 'draft', + string $contentType = self::contentTypes['getLoyaltyProgramTier'][0] + ): \Brevo\Client\Models\LoyaltyTierPage + { + list($response) = $this->getLoyaltyProgramTierWithHttpInfo($loyaltyProgramId, $version, $contentType); + return $response; + } + + /** + * Operation getLoyaltyProgramTierWithHttpInfo + * + * Get tier page + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string|null $version Select 'active' to retrieve list of all tiers which are live for clients. Select draft to retrieve list of all non deleted tiers. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLoyaltyProgramTier'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\LoyaltyTierPage|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError, HTTP status code, HTTP response headers (array of strings) + */ + public function getLoyaltyProgramTierWithHttpInfo( + string $loyaltyProgramId, + ?string $version = 'draft', + string $contentType = self::contentTypes['getLoyaltyProgramTier'][0] + ): array + { + $request = $this->getLoyaltyProgramTierRequest($loyaltyProgramId, $version, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\LoyaltyTierPage', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\LoyaltyTierPage' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\LoyaltyTierPage', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ValidationError', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ValidationError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ValidationError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\LoyaltyTierPage'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\LoyaltyTierPage', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ValidationError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getLoyaltyProgramTierAsync + * + * Get tier page + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string|null $version Select 'active' to retrieve list of all tiers which are live for clients. Select draft to retrieve list of all non deleted tiers. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLoyaltyProgramTier'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getLoyaltyProgramTierAsync( + string $loyaltyProgramId, + ?string $version = 'draft', + string $contentType = self::contentTypes['getLoyaltyProgramTier'][0] + ): PromiseInterface + { + return $this->getLoyaltyProgramTierAsyncWithHttpInfo($loyaltyProgramId, $version, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getLoyaltyProgramTierAsyncWithHttpInfo + * + * Get tier page + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string|null $version Select 'active' to retrieve list of all tiers which are live for clients. Select draft to retrieve list of all non deleted tiers. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLoyaltyProgramTier'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getLoyaltyProgramTierAsyncWithHttpInfo( + $loyaltyProgramId, + $version = 'draft', + string $contentType = self::contentTypes['getLoyaltyProgramTier'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\LoyaltyTierPage'; + $request = $this->getLoyaltyProgramTierRequest($loyaltyProgramId, $version, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getLoyaltyProgramTier' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string|null $version Select 'active' to retrieve list of all tiers which are live for clients. Select draft to retrieve list of all non deleted tiers. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLoyaltyProgramTier'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getLoyaltyProgramTierRequest( + $loyaltyProgramId, + $version = 'draft', + string $contentType = self::contentTypes['getLoyaltyProgramTier'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling getLoyaltyProgramTier' + ); + } + + + + $resourcePath = '/loyalty/tier/programs/{loyaltyProgramId}/tiers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $version, + 'version', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getTierGroup + * + * Get tier group by Id + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierGroupId Tier group Id (required) + * @param string|null $version Select active to retrieve active version of tier group. Select draft to retrieve latest changes in tier group. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTierGroup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\TierGroup|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\UnauthorizedResponse|\Brevo\Client\Models\ValidationError + */ + public function getTierGroup( + string $loyaltyProgramId, + string $tierGroupId, + ?string $version = 'draft', + string $contentType = self::contentTypes['getTierGroup'][0] + ): \Brevo\Client\Models\TierGroup + { + list($response) = $this->getTierGroupWithHttpInfo($loyaltyProgramId, $tierGroupId, $version, $contentType); + return $response; + } + + /** + * Operation getTierGroupWithHttpInfo + * + * Get tier group by Id + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierGroupId Tier group Id (required) + * @param string|null $version Select active to retrieve active version of tier group. Select draft to retrieve latest changes in tier group. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTierGroup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\TierGroup|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\UnauthorizedResponse|\Brevo\Client\Models\ValidationError, HTTP status code, HTTP response headers (array of strings) + */ + public function getTierGroupWithHttpInfo( + string $loyaltyProgramId, + string $tierGroupId, + ?string $version = 'draft', + string $contentType = self::contentTypes['getTierGroup'][0] + ): array + { + $request = $this->getTierGroupRequest($loyaltyProgramId, $tierGroupId, $version, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\TierGroup', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\TierGroup' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\TierGroup', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\UnauthorizedResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\UnauthorizedResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\UnauthorizedResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ValidationError', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ValidationError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ValidationError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\TierGroup'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\TierGroup', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\UnauthorizedResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ValidationError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getTierGroupAsync + * + * Get tier group by Id + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierGroupId Tier group Id (required) + * @param string|null $version Select active to retrieve active version of tier group. Select draft to retrieve latest changes in tier group. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTierGroup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getTierGroupAsync( + string $loyaltyProgramId, + string $tierGroupId, + ?string $version = 'draft', + string $contentType = self::contentTypes['getTierGroup'][0] + ): PromiseInterface + { + return $this->getTierGroupAsyncWithHttpInfo($loyaltyProgramId, $tierGroupId, $version, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTierGroupAsyncWithHttpInfo + * + * Get tier group by Id + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierGroupId Tier group Id (required) + * @param string|null $version Select active to retrieve active version of tier group. Select draft to retrieve latest changes in tier group. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTierGroup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getTierGroupAsyncWithHttpInfo( + $loyaltyProgramId, + $tierGroupId, + $version = 'draft', + string $contentType = self::contentTypes['getTierGroup'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\TierGroup'; + $request = $this->getTierGroupRequest($loyaltyProgramId, $tierGroupId, $version, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTierGroup' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierGroupId Tier group Id (required) + * @param string|null $version Select active to retrieve active version of tier group. Select draft to retrieve latest changes in tier group. (optional, default to 'draft') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTierGroup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getTierGroupRequest( + $loyaltyProgramId, + $tierGroupId, + $version = 'draft', + string $contentType = self::contentTypes['getTierGroup'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling getTierGroup' + ); + } + + // verify the required parameter 'tierGroupId' is set + if ($tierGroupId === null || (is_array($tierGroupId) && count($tierGroupId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $tierGroupId when calling getTierGroup' + ); + } + + + + $resourcePath = '/loyalty/tier/programs/{loyaltyProgramId}/tier-groups/{tierGroupId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $version, + 'version', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + // path params + if ($tierGroupId !== null) { + $resourcePath = str_replace( + '{' . 'tierGroupId' . '}', + ObjectSerializer::toPathValue($tierGroupId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost + * + * Add subscription to a tier + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contactId Contact Id (required) + * @param string $tierId Tier Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\TierForContact|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\UpdateTierGroup404Response|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError + */ + public function loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost( + string $loyaltyProgramId, + string $contactId, + string $tierId, + string $contentType = self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost'][0] + ): \Brevo\Client\Models\TierForContact + { + list($response) = $this->loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPostWithHttpInfo($loyaltyProgramId, $contactId, $tierId, $contentType); + return $response; + } + + /** + * Operation loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPostWithHttpInfo + * + * Add subscription to a tier + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contactId Contact Id (required) + * @param string $tierId Tier Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\TierForContact|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\UpdateTierGroup404Response|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError, HTTP status code, HTTP response headers (array of strings) + */ + public function loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPostWithHttpInfo( + string $loyaltyProgramId, + string $contactId, + string $tierId, + string $contentType = self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost'][0] + ): array + { + $request = $this->loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPostRequest($loyaltyProgramId, $contactId, $tierId, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\TierForContact', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\TierForContact' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\TierForContact', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\UpdateTierGroup404Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\UpdateTierGroup404Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\UpdateTierGroup404Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 409: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ValidationError', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ValidationError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ValidationError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\TierForContact'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\TierForContact', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\UpdateTierGroup404Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ValidationError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPostAsync + * + * Add subscription to a tier + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contactId Contact Id (required) + * @param string $tierId Tier Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPostAsync( + string $loyaltyProgramId, + string $contactId, + string $tierId, + string $contentType = self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost'][0] + ): PromiseInterface + { + return $this->loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPostAsyncWithHttpInfo($loyaltyProgramId, $contactId, $tierId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPostAsyncWithHttpInfo + * + * Add subscription to a tier + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contactId Contact Id (required) + * @param string $tierId Tier Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPostAsyncWithHttpInfo( + $loyaltyProgramId, + $contactId, + $tierId, + string $contentType = self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\TierForContact'; + $request = $this->loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPostRequest($loyaltyProgramId, $contactId, $tierId, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $contactId Contact Id (required) + * @param string $tierId Tier Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPostRequest( + $loyaltyProgramId, + $contactId, + $tierId, + string $contentType = self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost' + ); + } + + // verify the required parameter 'contactId' is set + if ($contactId === null || (is_array($contactId) && count($contactId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $contactId when calling loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost' + ); + } + + // verify the required parameter 'tierId' is set + if ($tierId === null || (is_array($tierId) && count($tierId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $tierId when calling loyaltyTierProgramsLoyaltyProgramIdContactsContactIdTiersTierIdPost' + ); + } + + + $resourcePath = '/loyalty/tier/programs/{loyaltyProgramId}/contacts/{contactId}/tiers/{tierId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + // path params + if ($contactId !== null) { + $resourcePath = str_replace( + '{' . 'contactId' . '}', + ObjectSerializer::toPathValue($contactId), + $resourcePath + ); + } + // path params + if ($tierId !== null) { + $resourcePath = str_replace( + '{' . 'tierId' . '}', + ObjectSerializer::toPathValue($tierId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete + * + * Delete tier + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierId Tier Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return void + */ + public function loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete( + string $loyaltyProgramId, + string $tierId, + string $contentType = self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete'][0] + ): void + { + $this->loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDeleteWithHttpInfo($loyaltyProgramId, $tierId, $contentType); + } + + /** + * Operation loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDeleteWithHttpInfo + * + * Delete tier + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierId Tier Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDeleteWithHttpInfo( + string $loyaltyProgramId, + string $tierId, + string $contentType = self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete'][0] + ): array + { + $request = $this->loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDeleteRequest($loyaltyProgramId, $tierId, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDeleteAsync + * + * Delete tier + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierId Tier Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDeleteAsync( + string $loyaltyProgramId, + string $tierId, + string $contentType = self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete'][0] + ): PromiseInterface + { + return $this->loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDeleteAsyncWithHttpInfo($loyaltyProgramId, $tierId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDeleteAsyncWithHttpInfo + * + * Delete tier + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierId Tier Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDeleteAsyncWithHttpInfo( + $loyaltyProgramId, + $tierId, + string $contentType = self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDeleteRequest($loyaltyProgramId, $tierId, $contentType); + + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierId Tier Id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDeleteRequest( + $loyaltyProgramId, + $tierId, + string $contentType = self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete' + ); + } + + // verify the required parameter 'tierId' is set + if ($tierId === null || (is_array($tierId) && count($tierId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $tierId when calling loyaltyTierProgramsLoyaltyProgramIdTiersTierIdDelete' + ); + } + + + $resourcePath = '/loyalty/tier/programs/{loyaltyProgramId}/tiers/{tierId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + // path params + if ($tierId !== null) { + $resourcePath = str_replace( + '{' . 'tierId' . '}', + ObjectSerializer::toPathValue($tierId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut + * + * Update tier + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierId Tier Id (required) + * @param \Brevo\Client\Models\TierRequest $tierRequest tierRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\Tier|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError + */ + public function loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut( + string $loyaltyProgramId, + string $tierId, + \Brevo\Client\Models\TierRequest $tierRequest, + string $contentType = self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut'][0] + ): \Brevo\Client\Models\Tier + { + list($response) = $this->loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPutWithHttpInfo($loyaltyProgramId, $tierId, $tierRequest, $contentType); + return $response; + } + + /** + * Operation loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPutWithHttpInfo + * + * Update tier + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierId Tier Id (required) + * @param \Brevo\Client\Models\TierRequest $tierRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\Tier|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\ValidationError, HTTP status code, HTTP response headers (array of strings) + */ + public function loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPutWithHttpInfo( + string $loyaltyProgramId, + string $tierId, + \Brevo\Client\Models\TierRequest $tierRequest, + string $contentType = self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut'][0] + ): array + { + $request = $this->loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPutRequest($loyaltyProgramId, $tierId, $tierRequest, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\Tier', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\Tier' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\Tier', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ValidationError', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ValidationError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ValidationError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\Tier'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\Tier', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ValidationError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPutAsync + * + * Update tier + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierId Tier Id (required) + * @param \Brevo\Client\Models\TierRequest $tierRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPutAsync( + string $loyaltyProgramId, + string $tierId, + \Brevo\Client\Models\TierRequest $tierRequest, + string $contentType = self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut'][0] + ): PromiseInterface + { + return $this->loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPutAsyncWithHttpInfo($loyaltyProgramId, $tierId, $tierRequest, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPutAsyncWithHttpInfo + * + * Update tier + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierId Tier Id (required) + * @param \Brevo\Client\Models\TierRequest $tierRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPutAsyncWithHttpInfo( + $loyaltyProgramId, + $tierId, + $tierRequest, + string $contentType = self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\Tier'; + $request = $this->loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPutRequest($loyaltyProgramId, $tierId, $tierRequest, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierId Tier Id (required) + * @param \Brevo\Client\Models\TierRequest $tierRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPutRequest( + $loyaltyProgramId, + $tierId, + $tierRequest, + string $contentType = self::contentTypes['loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut' + ); + } + + // verify the required parameter 'tierId' is set + if ($tierId === null || (is_array($tierId) && count($tierId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $tierId when calling loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut' + ); + } + + // verify the required parameter 'tierRequest' is set + if ($tierRequest === null || (is_array($tierRequest) && count($tierRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $tierRequest when calling loyaltyTierProgramsLoyaltyProgramIdTiersTierIdPut' + ); + } + + + $resourcePath = '/loyalty/tier/programs/{loyaltyProgramId}/tiers/{tierId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + // path params + if ($tierId !== null) { + $resourcePath = str_replace( + '{' . 'tierId' . '}', + ObjectSerializer::toPathValue($tierId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($tierRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($tierRequest)); + } else { + $httpBody = $tierRequest; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateTierGroup + * + * Update tier group + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierGroupId Tier group Id (required) + * @param \Brevo\Client\Models\UpdateTierGroupRequest $updateTierGroupRequest updateTierGroupRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTierGroup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\TierGroup|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\UnauthorizedResponse|\Brevo\Client\Models\UpdateTierGroup404Response|\Brevo\Client\Models\ErrorResponse|\Brevo\Client\Models\ValidationError + */ + public function updateTierGroup( + string $loyaltyProgramId, + string $tierGroupId, + \Brevo\Client\Models\UpdateTierGroupRequest $updateTierGroupRequest, + string $contentType = self::contentTypes['updateTierGroup'][0] + ): \Brevo\Client\Models\TierGroup + { + list($response) = $this->updateTierGroupWithHttpInfo($loyaltyProgramId, $tierGroupId, $updateTierGroupRequest, $contentType); + return $response; + } + + /** + * Operation updateTierGroupWithHttpInfo + * + * Update tier group + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierGroupId Tier group Id (required) + * @param \Brevo\Client\Models\UpdateTierGroupRequest $updateTierGroupRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTierGroup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\TierGroup|\Brevo\Client\Models\BadRequestPayload|\Brevo\Client\Models\UnauthorizedResponse|\Brevo\Client\Models\UpdateTierGroup404Response|\Brevo\Client\Models\ErrorResponse|\Brevo\Client\Models\ValidationError, HTTP status code, HTTP response headers (array of strings) + */ + public function updateTierGroupWithHttpInfo( + string $loyaltyProgramId, + string $tierGroupId, + \Brevo\Client\Models\UpdateTierGroupRequest $updateTierGroupRequest, + string $contentType = self::contentTypes['updateTierGroup'][0] + ): array + { + $request = $this->updateTierGroupRequest($loyaltyProgramId, $tierGroupId, $updateTierGroupRequest, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\TierGroup', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\TierGroup' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\TierGroup', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\BadRequestPayload', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\BadRequestPayload' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\BadRequestPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if (in_array('\Brevo\Client\Models\UnauthorizedResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\UnauthorizedResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\UnauthorizedResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\UpdateTierGroup404Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\UpdateTierGroup404Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\UpdateTierGroup404Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 409: + if (in_array('\Brevo\Client\Models\ErrorResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if (in_array('\Brevo\Client\Models\ValidationError', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ValidationError' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ValidationError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Brevo\Client\Models\TierGroup'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\TierGroup', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\BadRequestPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\UnauthorizedResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\UpdateTierGroup404Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ValidationError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateTierGroupAsync + * + * Update tier group + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierGroupId Tier group Id (required) + * @param \Brevo\Client\Models\UpdateTierGroupRequest $updateTierGroupRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTierGroup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateTierGroupAsync( + string $loyaltyProgramId, + string $tierGroupId, + \Brevo\Client\Models\UpdateTierGroupRequest $updateTierGroupRequest, + string $contentType = self::contentTypes['updateTierGroup'][0] + ): PromiseInterface + { + return $this->updateTierGroupAsyncWithHttpInfo($loyaltyProgramId, $tierGroupId, $updateTierGroupRequest, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateTierGroupAsyncWithHttpInfo + * + * Update tier group + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierGroupId Tier group Id (required) + * @param \Brevo\Client\Models\UpdateTierGroupRequest $updateTierGroupRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTierGroup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateTierGroupAsyncWithHttpInfo( + $loyaltyProgramId, + $tierGroupId, + $updateTierGroupRequest, + string $contentType = self::contentTypes['updateTierGroup'][0] + ): PromiseInterface + { + $returnType = '\Brevo\Client\Models\TierGroup'; + $request = $this->updateTierGroupRequest($loyaltyProgramId, $tierGroupId, $updateTierGroupRequest, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + 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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateTierGroup' + * + * @param string $loyaltyProgramId Loyalty Program Id (required) + * @param string $tierGroupId Tier group Id (required) + * @param \Brevo\Client\Models\UpdateTierGroupRequest $updateTierGroupRequest (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTierGroup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateTierGroupRequest( + $loyaltyProgramId, + $tierGroupId, + $updateTierGroupRequest, + string $contentType = self::contentTypes['updateTierGroup'][0] + ): Request + { + + // verify the required parameter 'loyaltyProgramId' is set + if ($loyaltyProgramId === null || (is_array($loyaltyProgramId) && count($loyaltyProgramId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $loyaltyProgramId when calling updateTierGroup' + ); + } + + // verify the required parameter 'tierGroupId' is set + if ($tierGroupId === null || (is_array($tierGroupId) && count($tierGroupId) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $tierGroupId when calling updateTierGroup' + ); + } + + // verify the required parameter 'updateTierGroupRequest' is set + if ($updateTierGroupRequest === null || (is_array($updateTierGroupRequest) && count($updateTierGroupRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $updateTierGroupRequest when calling updateTierGroup' + ); + } + + + $resourcePath = '/loyalty/tier/programs/{loyaltyProgramId}/tier-groups/{tierGroupId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($loyaltyProgramId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyProgramId' . '}', + ObjectSerializer::toPathValue($loyaltyProgramId), + $resourcePath + ); + } + // path params + if ($tierGroupId !== null) { + $resourcePath = str_replace( + '{' . 'tierGroupId' . '}', + ObjectSerializer::toPathValue($tierGroupId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($updateTierGroupRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($updateTierGroupRequest)); + } else { + $httpBody = $updateTierGroupRequest; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); + if ($apiKey !== null) { + $headers['partner-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $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/TransactionalEmailsApi.php b/lib/Api/TransactionalEmailsApi.php index ceca9c1..236463a 100644 --- a/lib/Api/TransactionalEmailsApi.php +++ b/lib/Api/TransactionalEmailsApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'createSmtpTemplate' => [ + 'application/json', + ], + 'deleteBlockedDomain' => [ + 'application/json', + ], + 'deleteHardbounces' => [ + 'application/json', + ], + 'deleteScheduledEmailById' => [ + 'application/json', + ], + 'deleteSmtpTemplate' => [ + 'application/json', + ], + 'getAggregatedSmtpReport' => [ + 'application/json', + ], + 'getBlockedDomains' => [ + 'application/json', + ], + 'getEmailEventReport' => [ + 'application/json', + ], + 'getScheduledEmailById' => [ + 'application/json', + ], + 'getSmtpReport' => [ + 'application/json', + ], + 'getSmtpTemplate' => [ + 'application/json', + ], + 'getSmtpTemplates' => [ + 'application/json', + ], + 'getTransacBlockedContacts' => [ + 'application/json', + ], + 'getTransacEmailContent' => [ + 'application/json', + ], + 'getTransacEmailsList' => [ + 'application/json', + ], + 'sendTestTemplate' => [ + 'application/json', + ], + 'sendTransacEmail' => [ + 'application/json', + ], + 'smtpBlockedContactsEmailDelete' => [ + 'application/json', + ], + 'smtpLogIdentifierDelete' => [ + 'application/json', + ], + 'updateSmtpTemplate' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -92,15 +188,19 @@ public function getConfig() * * Add a new domain to the list of blocked domains * - * @param \Brevo\Client\Model\BlockDomain $blockDomain blockDomain (required) + * @param \Brevo\Client\Models\BlockDomain $blockDomain Name of the domain to be blocked (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['blockNewDomain'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function blockNewDomain($blockDomain) + public function blockNewDomain( + \Brevo\Client\Models\BlockDomain $blockDomain, + string $contentType = self::contentTypes['blockNewDomain'][0] + ): void { - $this->blockNewDomainWithHttpInfo($blockDomain); + $this->blockNewDomainWithHttpInfo($blockDomain, $contentType); } /** @@ -108,16 +208,19 @@ public function blockNewDomain($blockDomain) * * Add a new domain to the list of blocked domains * - * @param \Brevo\Client\Model\BlockDomain $blockDomain (required) + * @param \Brevo\Client\Models\BlockDomain $blockDomain Name of the domain to be blocked (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['blockNewDomain'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function blockNewDomainWithHttpInfo($blockDomain) + public function blockNewDomainWithHttpInfo( + \Brevo\Client\Models\BlockDomain $blockDomain, + string $contentType = self::contentTypes['blockNewDomain'][0] + ): array { - $returnType = ''; - $request = $this->blockNewDomainRequest($blockDomain); + $request = $this->blockNewDomainRequest($blockDomain, $contentType); try { $options = $this->createHttpClientOption(); @@ -126,26 +229,21 @@ public function blockNewDomainWithHttpInfo($blockDomain) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -154,7 +252,7 @@ public function blockNewDomainWithHttpInfo($blockDomain) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -169,14 +267,18 @@ public function blockNewDomainWithHttpInfo($blockDomain) * * Add a new domain to the list of blocked domains * - * @param \Brevo\Client\Model\BlockDomain $blockDomain (required) + * @param \Brevo\Client\Models\BlockDomain $blockDomain Name of the domain to be blocked (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['blockNewDomain'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function blockNewDomainAsync($blockDomain) + public function blockNewDomainAsync( + \Brevo\Client\Models\BlockDomain $blockDomain, + string $contentType = self::contentTypes['blockNewDomain'][0] + ): PromiseInterface { - return $this->blockNewDomainAsyncWithHttpInfo($blockDomain) + return $this->blockNewDomainAsyncWithHttpInfo($blockDomain, $contentType) ->then( function ($response) { return $response[0]; @@ -189,15 +291,20 @@ function ($response) { * * Add a new domain to the list of blocked domains * - * @param \Brevo\Client\Model\BlockDomain $blockDomain (required) + * @param \Brevo\Client\Models\BlockDomain $blockDomain Name of the domain to be blocked (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['blockNewDomain'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function blockNewDomainAsyncWithHttpInfo($blockDomain) + public function blockNewDomainAsyncWithHttpInfo( + $blockDomain, + string $contentType = self::contentTypes['blockNewDomain'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->blockNewDomainRequest($blockDomain); + $request = $this->blockNewDomainRequest($blockDomain, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -216,7 +323,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -225,20 +332,26 @@ function ($exception) { /** * Create request for operation 'blockNewDomain' * - * @param \Brevo\Client\Model\BlockDomain $blockDomain (required) + * @param \Brevo\Client\Models\BlockDomain $blockDomain Name of the domain to be blocked (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['blockNewDomain'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function blockNewDomainRequest($blockDomain) + public function blockNewDomainRequest( + $blockDomain, + string $contentType = self::contentTypes['blockNewDomain'][0] + ): Request { + // verify the required parameter 'blockDomain' is set if ($blockDomain === null || (is_array($blockDomain) && count($blockDomain) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $blockDomain when calling blockNewDomain' ); } + $resourcePath = '/smtp/blockedDomains'; $formParams = []; $queryParams = []; @@ -248,56 +361,43 @@ protected function blockNewDomainRequest($blockDomain) - // body params - $_tempBody = null; - if (isset($blockDomain)) { - $_tempBody = $blockDomain; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($blockDomain)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($blockDomain)); + } else { + $httpBody = $blockDomain; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -323,10 +423,11 @@ protected function blockNewDomainRequest($blockDomain) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -337,15 +438,19 @@ protected function blockNewDomainRequest($blockDomain) * * Create an email template * - * @param \Brevo\Client\Model\CreateSmtpTemplate $smtpTemplate values to update in transactional email template (required) + * @param \Brevo\Client\Models\CreateSmtpTemplate $createSmtpTemplate values to update in transactional email template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSmtpTemplate'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreateModel + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateModel|\Brevo\Client\Models\ErrorModel */ - public function createSmtpTemplate($smtpTemplate) + public function createSmtpTemplate( + \Brevo\Client\Models\CreateSmtpTemplate $createSmtpTemplate, + string $contentType = self::contentTypes['createSmtpTemplate'][0] + ): \Brevo\Client\Models\CreateModel { - list($response) = $this->createSmtpTemplateWithHttpInfo($smtpTemplate); + list($response) = $this->createSmtpTemplateWithHttpInfo($createSmtpTemplate, $contentType); return $response; } @@ -354,16 +459,19 @@ public function createSmtpTemplate($smtpTemplate) * * Create an email template * - * @param \Brevo\Client\Model\CreateSmtpTemplate $smtpTemplate values to update in transactional email template (required) + * @param \Brevo\Client\Models\CreateSmtpTemplate $createSmtpTemplate values to update in transactional email template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSmtpTemplate'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function createSmtpTemplateWithHttpInfo($smtpTemplate) + public function createSmtpTemplateWithHttpInfo( + \Brevo\Client\Models\CreateSmtpTemplate $createSmtpTemplate, + string $contentType = self::contentTypes['createSmtpTemplate'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreateModel'; - $request = $this->createSmtpTemplateRequest($smtpTemplate); + $request = $this->createSmtpTemplateRequest($createSmtpTemplate, $contentType); try { $options = $this->createHttpClientOption(); @@ -372,34 +480,111 @@ public function createSmtpTemplateWithHttpInfo($smtpTemplate) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreateModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreateModel'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -414,7 +599,7 @@ public function createSmtpTemplateWithHttpInfo($smtpTemplate) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreateModel', + '\Brevo\Client\Models\CreateModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -422,7 +607,7 @@ public function createSmtpTemplateWithHttpInfo($smtpTemplate) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -437,14 +622,18 @@ public function createSmtpTemplateWithHttpInfo($smtpTemplate) * * Create an email template * - * @param \Brevo\Client\Model\CreateSmtpTemplate $smtpTemplate values to update in transactional email template (required) + * @param \Brevo\Client\Models\CreateSmtpTemplate $createSmtpTemplate values to update in transactional email template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSmtpTemplate'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createSmtpTemplateAsync($smtpTemplate) + public function createSmtpTemplateAsync( + \Brevo\Client\Models\CreateSmtpTemplate $createSmtpTemplate, + string $contentType = self::contentTypes['createSmtpTemplate'][0] + ): PromiseInterface { - return $this->createSmtpTemplateAsyncWithHttpInfo($smtpTemplate) + return $this->createSmtpTemplateAsyncWithHttpInfo($createSmtpTemplate, $contentType) ->then( function ($response) { return $response[0]; @@ -457,25 +646,29 @@ function ($response) { * * Create an email template * - * @param \Brevo\Client\Model\CreateSmtpTemplate $smtpTemplate values to update in transactional email template (required) + * @param \Brevo\Client\Models\CreateSmtpTemplate $createSmtpTemplate values to update in transactional email template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSmtpTemplate'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createSmtpTemplateAsyncWithHttpInfo($smtpTemplate) + public function createSmtpTemplateAsyncWithHttpInfo( + $createSmtpTemplate, + string $contentType = self::contentTypes['createSmtpTemplate'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreateModel'; - $request = $this->createSmtpTemplateRequest($smtpTemplate); + $returnType = '\Brevo\Client\Models\CreateModel'; + $request = $this->createSmtpTemplateRequest($createSmtpTemplate, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -498,7 +691,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -507,20 +700,26 @@ function ($exception) { /** * Create request for operation 'createSmtpTemplate' * - * @param \Brevo\Client\Model\CreateSmtpTemplate $smtpTemplate values to update in transactional email template (required) + * @param \Brevo\Client\Models\CreateSmtpTemplate $createSmtpTemplate values to update in transactional email template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSmtpTemplate'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createSmtpTemplateRequest($smtpTemplate) + public function createSmtpTemplateRequest( + $createSmtpTemplate, + string $contentType = self::contentTypes['createSmtpTemplate'][0] + ): Request { - // verify the required parameter 'smtpTemplate' is set - if ($smtpTemplate === null || (is_array($smtpTemplate) && count($smtpTemplate) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $smtpTemplate when calling createSmtpTemplate' + + // verify the required parameter 'createSmtpTemplate' is set + if ($createSmtpTemplate === null || (is_array($createSmtpTemplate) && count($createSmtpTemplate) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $createSmtpTemplate when calling createSmtpTemplate' ); } + $resourcePath = '/smtp/templates'; $formParams = []; $queryParams = []; @@ -530,56 +729,43 @@ protected function createSmtpTemplateRequest($smtpTemplate) - // 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'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($createSmtpTemplate)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createSmtpTemplate)); + } else { + $httpBody = $createSmtpTemplate; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -605,10 +791,11 @@ protected function createSmtpTemplateRequest($smtpTemplate) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -620,14 +807,18 @@ protected function createSmtpTemplateRequest($smtpTemplate) * Unblock an existing domain from the list of blocked domains * * @param string $domain The name of the domain to be deleted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteBlockedDomain'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function deleteBlockedDomain($domain) + public function deleteBlockedDomain( + string $domain, + string $contentType = self::contentTypes['deleteBlockedDomain'][0] + ): void { - $this->deleteBlockedDomainWithHttpInfo($domain); + $this->deleteBlockedDomainWithHttpInfo($domain, $contentType); } /** @@ -636,15 +827,18 @@ public function deleteBlockedDomain($domain) * Unblock an existing domain from the list of blocked domains * * @param string $domain The name of the domain to be deleted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteBlockedDomain'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteBlockedDomainWithHttpInfo($domain) + public function deleteBlockedDomainWithHttpInfo( + string $domain, + string $contentType = self::contentTypes['deleteBlockedDomain'][0] + ): array { - $returnType = ''; - $request = $this->deleteBlockedDomainRequest($domain); + $request = $this->deleteBlockedDomainRequest($domain, $contentType); try { $options = $this->createHttpClientOption(); @@ -653,35 +847,38 @@ public function deleteBlockedDomainWithHttpInfo($domain) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Brevo\Client\Models\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -697,13 +894,17 @@ public function deleteBlockedDomainWithHttpInfo($domain) * Unblock an existing domain from the list of blocked domains * * @param string $domain The name of the domain to be deleted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteBlockedDomain'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteBlockedDomainAsync($domain) + public function deleteBlockedDomainAsync( + string $domain, + string $contentType = self::contentTypes['deleteBlockedDomain'][0] + ): PromiseInterface { - return $this->deleteBlockedDomainAsyncWithHttpInfo($domain) + return $this->deleteBlockedDomainAsyncWithHttpInfo($domain, $contentType) ->then( function ($response) { return $response[0]; @@ -717,14 +918,19 @@ function ($response) { * Unblock an existing domain from the list of blocked domains * * @param string $domain The name of the domain to be deleted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteBlockedDomain'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteBlockedDomainAsyncWithHttpInfo($domain) + public function deleteBlockedDomainAsyncWithHttpInfo( + $domain, + string $contentType = self::contentTypes['deleteBlockedDomain'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->deleteBlockedDomainRequest($domain); + $request = $this->deleteBlockedDomainRequest($domain, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -743,7 +949,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -753,19 +959,25 @@ function ($exception) { * Create request for operation 'deleteBlockedDomain' * * @param string $domain The name of the domain to be deleted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteBlockedDomain'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function deleteBlockedDomainRequest($domain) + public function deleteBlockedDomainRequest( + $domain, + string $contentType = self::contentTypes['deleteBlockedDomain'][0] + ): Request { + // verify the required parameter 'domain' is set if ($domain === null || (is_array($domain) && count($domain) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $domain when calling deleteBlockedDomain' ); } + $resourcePath = '/smtp/blockedDomains/{domain}'; $formParams = []; $queryParams = []; @@ -774,6 +986,7 @@ protected function deleteBlockedDomainRequest($domain) $multipart = false; + // path params if ($domain !== null) { $resourcePath = str_replace( @@ -783,53 +996,35 @@ protected function deleteBlockedDomainRequest($domain) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -855,10 +1050,11 @@ protected function deleteBlockedDomainRequest($domain) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -869,15 +1065,19 @@ protected function deleteBlockedDomainRequest($domain) * * Delete hardbounces * - * @param \Brevo\Client\Model\DeleteHardbounces $deleteHardbounces values to delete hardbounces (optional) + * @param \Brevo\Client\Models\DeleteHardbounces|null $deleteHardbounces values to delete hardbounces (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteHardbounces'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function deleteHardbounces($deleteHardbounces = null) + public function deleteHardbounces( + ?\Brevo\Client\Models\DeleteHardbounces $deleteHardbounces = null, + string $contentType = self::contentTypes['deleteHardbounces'][0] + ): void { - $this->deleteHardbouncesWithHttpInfo($deleteHardbounces); + $this->deleteHardbouncesWithHttpInfo($deleteHardbounces, $contentType); } /** @@ -885,16 +1085,19 @@ public function deleteHardbounces($deleteHardbounces = null) * * Delete hardbounces * - * @param \Brevo\Client\Model\DeleteHardbounces $deleteHardbounces values to delete hardbounces (optional) + * @param \Brevo\Client\Models\DeleteHardbounces|null $deleteHardbounces values to delete hardbounces (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteHardbounces'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteHardbouncesWithHttpInfo($deleteHardbounces = null) + public function deleteHardbouncesWithHttpInfo( + ?\Brevo\Client\Models\DeleteHardbounces $deleteHardbounces = null, + string $contentType = self::contentTypes['deleteHardbounces'][0] + ): array { - $returnType = ''; - $request = $this->deleteHardbouncesRequest($deleteHardbounces); + $request = $this->deleteHardbouncesRequest($deleteHardbounces, $contentType); try { $options = $this->createHttpClientOption(); @@ -903,26 +1106,21 @@ public function deleteHardbouncesWithHttpInfo($deleteHardbounces = null) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -931,7 +1129,7 @@ public function deleteHardbouncesWithHttpInfo($deleteHardbounces = null) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -946,14 +1144,18 @@ public function deleteHardbouncesWithHttpInfo($deleteHardbounces = null) * * Delete hardbounces * - * @param \Brevo\Client\Model\DeleteHardbounces $deleteHardbounces values to delete hardbounces (optional) + * @param \Brevo\Client\Models\DeleteHardbounces|null $deleteHardbounces values to delete hardbounces (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteHardbounces'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteHardbouncesAsync($deleteHardbounces = null) + public function deleteHardbouncesAsync( + ?\Brevo\Client\Models\DeleteHardbounces $deleteHardbounces = null, + string $contentType = self::contentTypes['deleteHardbounces'][0] + ): PromiseInterface { - return $this->deleteHardbouncesAsyncWithHttpInfo($deleteHardbounces) + return $this->deleteHardbouncesAsyncWithHttpInfo($deleteHardbounces, $contentType) ->then( function ($response) { return $response[0]; @@ -966,15 +1168,20 @@ function ($response) { * * Delete hardbounces * - * @param \Brevo\Client\Model\DeleteHardbounces $deleteHardbounces values to delete hardbounces (optional) + * @param \Brevo\Client\Models\DeleteHardbounces|null $deleteHardbounces values to delete hardbounces (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteHardbounces'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteHardbouncesAsyncWithHttpInfo($deleteHardbounces = null) + public function deleteHardbouncesAsyncWithHttpInfo( + $deleteHardbounces = null, + string $contentType = self::contentTypes['deleteHardbounces'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->deleteHardbouncesRequest($deleteHardbounces); + $request = $this->deleteHardbouncesRequest($deleteHardbounces, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -993,7 +1200,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1002,14 +1209,20 @@ function ($exception) { /** * Create request for operation 'deleteHardbounces' * - * @param \Brevo\Client\Model\DeleteHardbounces $deleteHardbounces values to delete hardbounces (optional) + * @param \Brevo\Client\Models\DeleteHardbounces|null $deleteHardbounces values to delete hardbounces (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteHardbounces'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function deleteHardbouncesRequest($deleteHardbounces = null) + public function deleteHardbouncesRequest( + $deleteHardbounces = null, + string $contentType = self::contentTypes['deleteHardbounces'][0] + ): Request { + + $resourcePath = '/smtp/deleteHardbounces'; $formParams = []; $queryParams = []; @@ -1019,56 +1232,43 @@ protected function deleteHardbouncesRequest($deleteHardbounces = null) - // body params - $_tempBody = null; - if (isset($deleteHardbounces)) { - $_tempBody = $deleteHardbounces; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($deleteHardbounces)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($deleteHardbounces)); + } else { + $httpBody = $deleteHardbounces; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1094,10 +1294,11 @@ protected function deleteHardbouncesRequest($deleteHardbounces = null) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1109,14 +1310,18 @@ protected function deleteHardbouncesRequest($deleteHardbounces = null) * Delete scheduled emails by batchId or messageId * * @param string $identifier The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScheduledEmailById'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function deleteScheduledEmailById($identifier) + public function deleteScheduledEmailById( + string $identifier, + string $contentType = self::contentTypes['deleteScheduledEmailById'][0] + ): void { - $this->deleteScheduledEmailByIdWithHttpInfo($identifier); + $this->deleteScheduledEmailByIdWithHttpInfo($identifier, $contentType); } /** @@ -1125,15 +1330,18 @@ public function deleteScheduledEmailById($identifier) * Delete scheduled emails by batchId or messageId * * @param string $identifier The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScheduledEmailById'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteScheduledEmailByIdWithHttpInfo($identifier) + public function deleteScheduledEmailByIdWithHttpInfo( + string $identifier, + string $contentType = self::contentTypes['deleteScheduledEmailById'][0] + ): array { - $returnType = ''; - $request = $this->deleteScheduledEmailByIdRequest($identifier); + $request = $this->deleteScheduledEmailByIdRequest($identifier, $contentType); try { $options = $this->createHttpClientOption(); @@ -1142,26 +1350,21 @@ public function deleteScheduledEmailByIdWithHttpInfo($identifier) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -1170,7 +1373,7 @@ public function deleteScheduledEmailByIdWithHttpInfo($identifier) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1178,7 +1381,7 @@ public function deleteScheduledEmailByIdWithHttpInfo($identifier) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1194,13 +1397,17 @@ public function deleteScheduledEmailByIdWithHttpInfo($identifier) * Delete scheduled emails by batchId or messageId * * @param string $identifier The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScheduledEmailById'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteScheduledEmailByIdAsync($identifier) + public function deleteScheduledEmailByIdAsync( + string $identifier, + string $contentType = self::contentTypes['deleteScheduledEmailById'][0] + ): PromiseInterface { - return $this->deleteScheduledEmailByIdAsyncWithHttpInfo($identifier) + return $this->deleteScheduledEmailByIdAsyncWithHttpInfo($identifier, $contentType) ->then( function ($response) { return $response[0]; @@ -1214,14 +1421,19 @@ function ($response) { * Delete scheduled emails by batchId or messageId * * @param string $identifier The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScheduledEmailById'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteScheduledEmailByIdAsyncWithHttpInfo($identifier) + public function deleteScheduledEmailByIdAsyncWithHttpInfo( + $identifier, + string $contentType = self::contentTypes['deleteScheduledEmailById'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->deleteScheduledEmailByIdRequest($identifier); + $request = $this->deleteScheduledEmailByIdRequest($identifier, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1240,7 +1452,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1250,19 +1462,25 @@ function ($exception) { * Create request for operation 'deleteScheduledEmailById' * * @param string $identifier The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScheduledEmailById'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function deleteScheduledEmailByIdRequest($identifier) + public function deleteScheduledEmailByIdRequest( + $identifier, + string $contentType = self::contentTypes['deleteScheduledEmailById'][0] + ): Request { + // verify the required parameter 'identifier' is set if ($identifier === null || (is_array($identifier) && count($identifier) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $identifier when calling deleteScheduledEmailById' ); } + $resourcePath = '/smtp/email/{identifier}'; $formParams = []; $queryParams = []; @@ -1271,6 +1489,7 @@ protected function deleteScheduledEmailByIdRequest($identifier) $multipart = false; + // path params if ($identifier !== null) { $resourcePath = str_replace( @@ -1280,53 +1499,35 @@ protected function deleteScheduledEmailByIdRequest($identifier) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1352,10 +1553,11 @@ protected function deleteScheduledEmailByIdRequest($identifier) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1367,14 +1569,18 @@ protected function deleteScheduledEmailByIdRequest($identifier) * Delete an inactive email template * * @param int $templateId id of the template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmtpTemplate'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function deleteSmtpTemplate($templateId) + public function deleteSmtpTemplate( + int $templateId, + string $contentType = self::contentTypes['deleteSmtpTemplate'][0] + ): void { - $this->deleteSmtpTemplateWithHttpInfo($templateId); + $this->deleteSmtpTemplateWithHttpInfo($templateId, $contentType); } /** @@ -1383,15 +1589,18 @@ public function deleteSmtpTemplate($templateId) * Delete an inactive email template * * @param int $templateId id of the template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmtpTemplate'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteSmtpTemplateWithHttpInfo($templateId) + public function deleteSmtpTemplateWithHttpInfo( + int $templateId, + string $contentType = self::contentTypes['deleteSmtpTemplate'][0] + ): array { - $returnType = ''; - $request = $this->deleteSmtpTemplateRequest($templateId); + $request = $this->deleteSmtpTemplateRequest($templateId, $contentType); try { $options = $this->createHttpClientOption(); @@ -1400,43 +1609,38 @@ public function deleteSmtpTemplateWithHttpInfo($templateId) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1452,13 +1656,17 @@ public function deleteSmtpTemplateWithHttpInfo($templateId) * Delete an inactive email template * * @param int $templateId id of the template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmtpTemplate'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteSmtpTemplateAsync($templateId) + public function deleteSmtpTemplateAsync( + int $templateId, + string $contentType = self::contentTypes['deleteSmtpTemplate'][0] + ): PromiseInterface { - return $this->deleteSmtpTemplateAsyncWithHttpInfo($templateId) + return $this->deleteSmtpTemplateAsyncWithHttpInfo($templateId, $contentType) ->then( function ($response) { return $response[0]; @@ -1472,14 +1680,19 @@ function ($response) { * Delete an inactive email template * * @param int $templateId id of the template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmtpTemplate'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteSmtpTemplateAsyncWithHttpInfo($templateId) + public function deleteSmtpTemplateAsyncWithHttpInfo( + $templateId, + string $contentType = self::contentTypes['deleteSmtpTemplate'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->deleteSmtpTemplateRequest($templateId); + $request = $this->deleteSmtpTemplateRequest($templateId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1498,7 +1711,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1508,19 +1721,25 @@ function ($exception) { * Create request for operation 'deleteSmtpTemplate' * * @param int $templateId id of the template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmtpTemplate'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function deleteSmtpTemplateRequest($templateId) + public function deleteSmtpTemplateRequest( + $templateId, + string $contentType = self::contentTypes['deleteSmtpTemplate'][0] + ): Request { + // verify the required parameter 'templateId' is set if ($templateId === null || (is_array($templateId) && count($templateId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $templateId when calling deleteSmtpTemplate' ); } + $resourcePath = '/smtp/templates/{templateId}'; $formParams = []; $queryParams = []; @@ -1529,6 +1748,7 @@ protected function deleteSmtpTemplateRequest($templateId) $multipart = false; + // path params if ($templateId !== null) { $resourcePath = str_replace( @@ -1538,53 +1758,35 @@ protected function deleteSmtpTemplateRequest($templateId) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1610,10 +1812,11 @@ protected function deleteSmtpTemplateRequest($templateId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1624,18 +1827,25 @@ protected function deleteSmtpTemplateRequest($templateId) * * Get your transactional email activity aggregated over a period of time * - * @param string $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) - * @param string $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 string|null $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ (optional) + * @param string|null $tag Tag of the emails (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAggregatedSmtpReport'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetAggregatedReport + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetAggregatedReport|\Brevo\Client\Models\ErrorModel */ - public function getAggregatedSmtpReport($startDate = null, $endDate = null, $days = null, $tag = null) + public function getAggregatedSmtpReport( + ?string $startDate = null, + ?string $endDate = null, + ?int $days = null, + ?string $tag = null, + string $contentType = self::contentTypes['getAggregatedSmtpReport'][0] + ): \Brevo\Client\Models\GetAggregatedReport { - list($response) = $this->getAggregatedSmtpReportWithHttpInfo($startDate, $endDate, $days, $tag); + list($response) = $this->getAggregatedSmtpReportWithHttpInfo($startDate, $endDate, $days, $tag, $contentType); return $response; } @@ -1644,19 +1854,25 @@ public function getAggregatedSmtpReport($startDate = null, $endDate = null, $day * * Get your transactional email activity aggregated over a period of time * - * @param string $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) - * @param string $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 string|null $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ (optional) + * @param string|null $tag Tag of the emails (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAggregatedSmtpReport'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetAggregatedReport, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetAggregatedReport|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getAggregatedSmtpReportWithHttpInfo($startDate = null, $endDate = null, $days = null, $tag = null) + public function getAggregatedSmtpReportWithHttpInfo( + ?string $startDate = null, + ?string $endDate = null, + ?int $days = null, + ?string $tag = null, + string $contentType = self::contentTypes['getAggregatedSmtpReport'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetAggregatedReport'; - $request = $this->getAggregatedSmtpReportRequest($startDate, $endDate, $days, $tag); + $request = $this->getAggregatedSmtpReportRequest($startDate, $endDate, $days, $tag, $contentType); try { $options = $this->createHttpClientOption(); @@ -1665,34 +1881,111 @@ public function getAggregatedSmtpReportWithHttpInfo($startDate = null, $endDate } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetAggregatedReport', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetAggregatedReport' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetAggregatedReport', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetAggregatedReport'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1707,7 +2000,7 @@ public function getAggregatedSmtpReportWithHttpInfo($startDate = null, $endDate case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetAggregatedReport', + '\Brevo\Client\Models\GetAggregatedReport', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1715,7 +2008,7 @@ public function getAggregatedSmtpReportWithHttpInfo($startDate = null, $endDate case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1730,17 +2023,24 @@ public function getAggregatedSmtpReportWithHttpInfo($startDate = null, $endDate * * Get your transactional email activity aggregated over a period of time * - * @param string $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) - * @param string $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 string|null $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ (optional) + * @param string|null $tag Tag of the emails (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAggregatedSmtpReport'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getAggregatedSmtpReportAsync($startDate = null, $endDate = null, $days = null, $tag = null) + public function getAggregatedSmtpReportAsync( + ?string $startDate = null, + ?string $endDate = null, + ?int $days = null, + ?string $tag = null, + string $contentType = self::contentTypes['getAggregatedSmtpReport'][0] + ): PromiseInterface { - return $this->getAggregatedSmtpReportAsyncWithHttpInfo($startDate, $endDate, $days, $tag) + return $this->getAggregatedSmtpReportAsyncWithHttpInfo($startDate, $endDate, $days, $tag, $contentType) ->then( function ($response) { return $response[0]; @@ -1753,28 +2053,35 @@ function ($response) { * * Get your transactional email activity aggregated over a period of time * - * @param string $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) - * @param string $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 string|null $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ (optional) + * @param string|null $tag Tag of the emails (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAggregatedSmtpReport'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getAggregatedSmtpReportAsyncWithHttpInfo($startDate = null, $endDate = null, $days = null, $tag = null) + public function getAggregatedSmtpReportAsyncWithHttpInfo( + $startDate = null, + $endDate = null, + $days = null, + $tag = null, + string $contentType = self::contentTypes['getAggregatedSmtpReport'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetAggregatedReport'; - $request = $this->getAggregatedSmtpReportRequest($startDate, $endDate, $days, $tag); + $returnType = '\Brevo\Client\Models\GetAggregatedReport'; + $request = $this->getAggregatedSmtpReportRequest($startDate, $endDate, $days, $tag, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1797,7 +2104,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1806,17 +2113,29 @@ function ($exception) { /** * Create request for operation 'getAggregatedSmtpReport' * - * @param string $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) - * @param string $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 string|null $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ (optional) + * @param string|null $tag Tag of the emails (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAggregatedSmtpReport'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getAggregatedSmtpReportRequest($startDate = null, $endDate = null, $days = null, $tag = null) + public function getAggregatedSmtpReportRequest( + $startDate = null, + $endDate = null, + $days = null, + $tag = null, + string $contentType = self::contentTypes['getAggregatedSmtpReport'][0] + ): Request { + + + + + $resourcePath = '/smtp/statistics/aggregatedReport'; $formParams = []; $queryParams = []; @@ -1825,70 +2144,73 @@ protected function getAggregatedSmtpReportRequest($startDate = null, $endDate = $multipart = false; // query params - if ($startDate !== null) { - $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($endDate !== null) { - $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($days !== null) { - $queryParams['days'] = ObjectSerializer::toQueryValue($days); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $days, + 'days', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($tag !== null) { - $queryParams['tag'] = ObjectSerializer::toQueryValue($tag); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $tag, + 'tag', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1914,10 +2236,11 @@ protected function getAggregatedSmtpReportRequest($startDate = null, $endDate = $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1928,14 +2251,17 @@ protected function getAggregatedSmtpReportRequest($startDate = null, $endDate = * * Get the list of blocked domains * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlockedDomains'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetBlockedDomains + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetBlockedDomains */ - public function getBlockedDomains() + public function getBlockedDomains( + string $contentType = self::contentTypes['getBlockedDomains'][0] + ): \Brevo\Client\Models\GetBlockedDomains { - list($response) = $this->getBlockedDomainsWithHttpInfo(); + list($response) = $this->getBlockedDomainsWithHttpInfo($contentType); return $response; } @@ -1944,15 +2270,17 @@ public function getBlockedDomains() * * Get the list of blocked domains * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlockedDomains'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetBlockedDomains, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetBlockedDomains, HTTP status code, HTTP response headers (array of strings) */ - public function getBlockedDomainsWithHttpInfo() + public function getBlockedDomainsWithHttpInfo( + string $contentType = self::contentTypes['getBlockedDomains'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetBlockedDomains'; - $request = $this->getBlockedDomainsRequest(); + $request = $this->getBlockedDomainsRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -1961,34 +2289,84 @@ public function getBlockedDomainsWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetBlockedDomains', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetBlockedDomains' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetBlockedDomains', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetBlockedDomains'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2003,7 +2381,7 @@ public function getBlockedDomainsWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetBlockedDomains', + '\Brevo\Client\Models\GetBlockedDomains', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2018,13 +2396,16 @@ public function getBlockedDomainsWithHttpInfo() * * Get the list of blocked domains * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlockedDomains'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getBlockedDomainsAsync() + public function getBlockedDomainsAsync( + string $contentType = self::contentTypes['getBlockedDomains'][0] + ): PromiseInterface { - return $this->getBlockedDomainsAsyncWithHttpInfo() + return $this->getBlockedDomainsAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -2037,24 +2418,27 @@ function ($response) { * * Get the list of blocked domains * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlockedDomains'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getBlockedDomainsAsyncWithHttpInfo() + public function getBlockedDomainsAsyncWithHttpInfo( + string $contentType = self::contentTypes['getBlockedDomains'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetBlockedDomains'; - $request = $this->getBlockedDomainsRequest(); + $returnType = '\Brevo\Client\Models\GetBlockedDomains'; + $request = $this->getBlockedDomainsRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2077,7 +2461,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2086,13 +2470,17 @@ function ($exception) { /** * Create request for operation 'getBlockedDomains' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlockedDomains'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getBlockedDomainsRequest() + public function getBlockedDomainsRequest( + string $contentType = self::contentTypes['getBlockedDomains'][0] + ): Request { + $resourcePath = '/smtp/blockedDomains'; $formParams = []; $queryParams = []; @@ -2102,53 +2490,36 @@ protected function getBlockedDomainsRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2174,10 +2545,11 @@ protected function getBlockedDomainsRequest() $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2188,25 +2560,39 @@ protected function getBlockedDomainsRequest() * * Get all your transactional email activity (unaggregated events) * - * @param int $limit Number limitation for the result returned (optional, default to 2500) - * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) - * @param string $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetEmailEventReport + * @param int|null $limit Number limitation for the result returned (optional, default to 2500) + * @param int|null $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ (optional) + * @param string|null $email Filter the report for a specific email addresses (optional) + * @param string|null $event Filter the report for a specific event type (optional) + * @param string|null $tags Filter the report for tags (serialized and urlencoded array). To pass multiple tags, a format of string separated by commas is used such as **\"one, two, three\"** (optional) + * @param string|null $messageId Filter on a specific message id (optional) + * @param int|null $templateId Filter on a specific template id (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailEventReport'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetEmailEventReport|\Brevo\Client\Models\ErrorModel */ - public function getEmailEventReport($limit = '2500', $offset = '0', $startDate = null, $endDate = null, $days = null, $email = null, $event = null, $tags = null, $messageId = null, $templateId = null, $sort = 'desc') + public function getEmailEventReport( + ?int $limit = 2500, + ?int $offset = 0, + ?string $startDate = null, + ?string $endDate = null, + ?int $days = null, + ?string $email = null, + ?string $event = null, + ?string $tags = null, + ?string $messageId = null, + ?int $templateId = null, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getEmailEventReport'][0] + ): \Brevo\Client\Models\GetEmailEventReport { - list($response) = $this->getEmailEventReportWithHttpInfo($limit, $offset, $startDate, $endDate, $days, $email, $event, $tags, $messageId, $templateId, $sort); + list($response) = $this->getEmailEventReportWithHttpInfo($limit, $offset, $startDate, $endDate, $days, $email, $event, $tags, $messageId, $templateId, $sort, $contentType); return $response; } @@ -2215,26 +2601,39 @@ public function getEmailEventReport($limit = '2500', $offset = '0', $startDate = * * Get all your transactional email activity (unaggregated events) * - * @param int $limit Number limitation for the result returned (optional, default to 2500) - * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) - * @param string $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetEmailEventReport, HTTP status code, HTTP response headers (array of strings) + * @param int|null $limit Number limitation for the result returned (optional, default to 2500) + * @param int|null $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ (optional) + * @param string|null $email Filter the report for a specific email addresses (optional) + * @param string|null $event Filter the report for a specific event type (optional) + * @param string|null $tags Filter the report for tags (serialized and urlencoded array). To pass multiple tags, a format of string separated by commas is used such as **\"one, two, three\"** (optional) + * @param string|null $messageId Filter on a specific message id (optional) + * @param int|null $templateId Filter on a specific template id (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailEventReport'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetEmailEventReport|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getEmailEventReportWithHttpInfo($limit = '2500', $offset = '0', $startDate = null, $endDate = null, $days = null, $email = null, $event = null, $tags = null, $messageId = null, $templateId = null, $sort = 'desc') + public function getEmailEventReportWithHttpInfo( + ?int $limit = 2500, + ?int $offset = 0, + ?string $startDate = null, + ?string $endDate = null, + ?int $days = null, + ?string $email = null, + ?string $event = null, + ?string $tags = null, + ?string $messageId = null, + ?int $templateId = null, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getEmailEventReport'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetEmailEventReport'; - $request = $this->getEmailEventReportRequest($limit, $offset, $startDate, $endDate, $days, $email, $event, $tags, $messageId, $templateId, $sort); + $request = $this->getEmailEventReportRequest($limit, $offset, $startDate, $endDate, $days, $email, $event, $tags, $messageId, $templateId, $sort, $contentType); try { $options = $this->createHttpClientOption(); @@ -2243,34 +2642,111 @@ public function getEmailEventReportWithHttpInfo($limit = '2500', $offset = '0', } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetEmailEventReport', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetEmailEventReport' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetEmailEventReport', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetEmailEventReport'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2285,7 +2761,7 @@ public function getEmailEventReportWithHttpInfo($limit = '2500', $offset = '0', case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetEmailEventReport', + '\Brevo\Client\Models\GetEmailEventReport', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2293,7 +2769,7 @@ public function getEmailEventReportWithHttpInfo($limit = '2500', $offset = '0', case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2308,24 +2784,38 @@ public function getEmailEventReportWithHttpInfo($limit = '2500', $offset = '0', * * Get all your transactional email activity (unaggregated events) * - * @param int $limit Number limitation for the result returned (optional, default to 2500) - * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) - * @param string $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @param int|null $limit Number limitation for the result returned (optional, default to 2500) + * @param int|null $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ (optional) + * @param string|null $email Filter the report for a specific email addresses (optional) + * @param string|null $event Filter the report for a specific event type (optional) + * @param string|null $tags Filter the report for tags (serialized and urlencoded array). To pass multiple tags, a format of string separated by commas is used such as **\"one, two, three\"** (optional) + * @param string|null $messageId Filter on a specific message id (optional) + * @param int|null $templateId Filter on a specific template id (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailEventReport'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getEmailEventReportAsync($limit = '2500', $offset = '0', $startDate = null, $endDate = null, $days = null, $email = null, $event = null, $tags = null, $messageId = null, $templateId = null, $sort = 'desc') + public function getEmailEventReportAsync( + ?int $limit = 2500, + ?int $offset = 0, + ?string $startDate = null, + ?string $endDate = null, + ?int $days = null, + ?string $email = null, + ?string $event = null, + ?string $tags = null, + ?string $messageId = null, + ?int $templateId = null, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getEmailEventReport'][0] + ): PromiseInterface { - return $this->getEmailEventReportAsyncWithHttpInfo($limit, $offset, $startDate, $endDate, $days, $email, $event, $tags, $messageId, $templateId, $sort) + return $this->getEmailEventReportAsyncWithHttpInfo($limit, $offset, $startDate, $endDate, $days, $email, $event, $tags, $messageId, $templateId, $sort, $contentType) ->then( function ($response) { return $response[0]; @@ -2338,35 +2828,49 @@ function ($response) { * * Get all your transactional email activity (unaggregated events) * - * @param int $limit Number limitation for the result returned (optional, default to 2500) - * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) - * @param string $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @param int|null $limit Number limitation for the result returned (optional, default to 2500) + * @param int|null $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ (optional) + * @param string|null $email Filter the report for a specific email addresses (optional) + * @param string|null $event Filter the report for a specific event type (optional) + * @param string|null $tags Filter the report for tags (serialized and urlencoded array). To pass multiple tags, a format of string separated by commas is used such as **\"one, two, three\"** (optional) + * @param string|null $messageId Filter on a specific message id (optional) + * @param int|null $templateId Filter on a specific template id (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailEventReport'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getEmailEventReportAsyncWithHttpInfo($limit = '2500', $offset = '0', $startDate = null, $endDate = null, $days = null, $email = null, $event = null, $tags = null, $messageId = null, $templateId = null, $sort = 'desc') + public function getEmailEventReportAsyncWithHttpInfo( + $limit = 2500, + $offset = 0, + $startDate = null, + $endDate = null, + $days = null, + $email = null, + $event = null, + $tags = null, + $messageId = null, + $templateId = null, + $sort = 'desc', + string $contentType = self::contentTypes['getEmailEventReport'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetEmailEventReport'; - $request = $this->getEmailEventReportRequest($limit, $offset, $startDate, $endDate, $days, $email, $event, $tags, $messageId, $templateId, $sort); + $returnType = '\Brevo\Client\Models\GetEmailEventReport'; + $request = $this->getEmailEventReportRequest($limit, $offset, $startDate, $endDate, $days, $email, $event, $tags, $messageId, $templateId, $sort, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2389,7 +2893,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2398,29 +2902,54 @@ function ($exception) { /** * Create request for operation 'getEmailEventReport' * - * @param int $limit Number limitation for the result returned (optional, default to 2500) - * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) - * @param string $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException + * @param int|null $limit Number limitation for the result returned (optional, default to 2500) + * @param int|null $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ (optional) + * @param string|null $email Filter the report for a specific email addresses (optional) + * @param string|null $event Filter the report for a specific event type (optional) + * @param string|null $tags Filter the report for tags (serialized and urlencoded array). To pass multiple tags, a format of string separated by commas is used such as **\"one, two, three\"** (optional) + * @param string|null $messageId Filter on a specific message id (optional) + * @param int|null $templateId Filter on a specific template id (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailEventReport'] to see the possible values for this operation + * + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getEmailEventReportRequest($limit = '2500', $offset = '0', $startDate = null, $endDate = null, $days = null, $email = null, $event = null, $tags = null, $messageId = null, $templateId = null, $sort = 'desc') + public function getEmailEventReportRequest( + $limit = 2500, + $offset = 0, + $startDate = null, + $endDate = null, + $days = null, + $email = null, + $event = null, + $tags = null, + $messageId = null, + $templateId = null, + $sort = 'desc', + string $contentType = self::contentTypes['getEmailEventReport'][0] + ): Request { + if ($limit !== null && $limit > 5000) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getEmailEventReport, must be smaller than or equal to 5000.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getEmailEventReport, must be smaller than or equal to 5000.'); } if ($limit !== null && $limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getEmailEventReport, must be bigger than or equal to 0.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getEmailEventReport, must be bigger than or equal to 0.'); } + + + + + + + + + + $resourcePath = '/smtp/statistics/events'; @@ -2431,98 +2960,136 @@ protected function getEmailEventReportRequest($limit = '2500', $offset = '0', $s $multipart = false; // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($startDate !== null) { - $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($endDate !== null) { - $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($days !== null) { - $queryParams['days'] = ObjectSerializer::toQueryValue($days); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $days, + 'days', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($email !== null) { - $queryParams['email'] = ObjectSerializer::toQueryValue($email); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $email, + 'email', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($event !== null) { - $queryParams['event'] = ObjectSerializer::toQueryValue($event); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $event, + 'event', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($tags !== null) { - $queryParams['tags'] = ObjectSerializer::toQueryValue($tags); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $tags, + 'tags', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($messageId !== null) { - $queryParams['messageId'] = ObjectSerializer::toQueryValue($messageId); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $messageId, + 'messageId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($templateId !== null) { - $queryParams['templateId'] = ObjectSerializer::toQueryValue($templateId); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $templateId, + 'templateId', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2548,59 +3115,79 @@ protected function getEmailEventReportRequest($limit = '2500', $offset = '0', $s $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Operation getScheduledEmailByBatchId + * Operation getScheduledEmailById * - * Fetch scheduled emails by batchId + * Fetch scheduled emails by batchId or messageId * - * @param string $batchId The batchId of scheduled emails batch (Should be a valid UUIDv4) (required) - * @param \DateTime $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. (optional) - * @param \DateTime $endDate Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string $status Filter the records by `status` of the scheduled email batch or message. (optional) - * @param int $limit Number of documents returned per page (optional, default to 100) - * @param int $offset Index of the first document on the page (optional, default to 0) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetScheduledEmailByBatchId + * @param string $identifier The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. (required) + * @param \DateTime|null $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. (optional) + * @param \DateTime|null $endDate Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. Not valid when identifier is `messageId`. (optional, default to 'desc') + * @param string|null $status Filter the records by `status` of the scheduled email batch or message. Not valid when identifier is `messageId`. (optional) + * @param int|null $limit Number of documents returned per page. Not valid when identifier is `messageId`. (optional, default to 100) + * @param int|null $offset Index of the first document on the page. Not valid when identifier is `messageId`. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledEmailById'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetScheduledEmailById200Response|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function getScheduledEmailByBatchId($batchId, $startDate = null, $endDate = null, $sort = 'desc', $status = null, $limit = '100', $offset = '0') + public function getScheduledEmailById( + string $identifier, + ?\DateTime $startDate = null, + ?\DateTime $endDate = null, + ?string $sort = 'desc', + ?string $status = null, + ?int $limit = 100, + ?int $offset = 0, + string $contentType = self::contentTypes['getScheduledEmailById'][0] + ): \Brevo\Client\Models\GetScheduledEmailById200Response { - list($response) = $this->getScheduledEmailByBatchIdWithHttpInfo($batchId, $startDate, $endDate, $sort, $status, $limit, $offset); + list($response) = $this->getScheduledEmailByIdWithHttpInfo($identifier, $startDate, $endDate, $sort, $status, $limit, $offset, $contentType); return $response; } /** - * Operation getScheduledEmailByBatchIdWithHttpInfo + * Operation getScheduledEmailByIdWithHttpInfo * - * Fetch scheduled emails by batchId + * Fetch scheduled emails by batchId or messageId * - * @param string $batchId The batchId of scheduled emails batch (Should be a valid UUIDv4) (required) - * @param \DateTime $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. (optional) - * @param \DateTime $endDate Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string $status Filter the records by `status` of the scheduled email batch or message. (optional) - * @param int $limit Number of documents returned per page (optional, default to 100) - * @param int $offset Index of the first document on the page (optional, default to 0) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetScheduledEmailByBatchId, HTTP status code, HTTP response headers (array of strings) + * @param string $identifier The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. (required) + * @param \DateTime|null $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. (optional) + * @param \DateTime|null $endDate Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. Not valid when identifier is `messageId`. (optional, default to 'desc') + * @param string|null $status Filter the records by `status` of the scheduled email batch or message. Not valid when identifier is `messageId`. (optional) + * @param int|null $limit Number of documents returned per page. Not valid when identifier is `messageId`. (optional, default to 100) + * @param int|null $offset Index of the first document on the page. Not valid when identifier is `messageId`. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledEmailById'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetScheduledEmailById200Response|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getScheduledEmailByBatchIdWithHttpInfo($batchId, $startDate = null, $endDate = null, $sort = 'desc', $status = null, $limit = '100', $offset = '0') + public function getScheduledEmailByIdWithHttpInfo( + string $identifier, + ?\DateTime $startDate = null, + ?\DateTime $endDate = null, + ?string $sort = 'desc', + ?string $status = null, + ?int $limit = 100, + ?int $offset = 0, + string $contentType = self::contentTypes['getScheduledEmailById'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetScheduledEmailByBatchId'; - $request = $this->getScheduledEmailByBatchIdRequest($batchId, $startDate, $endDate, $sort, $status, $limit, $offset); + $request = $this->getScheduledEmailByIdRequest($identifier, $startDate, $endDate, $sort, $status, $limit, $offset, $contentType); try { $options = $this->createHttpClientOption(); @@ -2609,382 +3196,138 @@ public function getScheduledEmailByBatchIdWithHttpInfo($batchId, $startDate = nu } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { + } catch (ConnectException $e) { throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } + $statusCode = $response->getStatusCode(); - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } catch (ApiException $e) { - switch ($e->getCode()) { + switch($statusCode) { case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\GetScheduledEmailByBatchId', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getScheduledEmailByBatchIdAsync - * - * Fetch scheduled emails by batchId - * - * @param string $batchId The batchId of scheduled emails batch (Should be a valid UUIDv4) (required) - * @param \DateTime $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. (optional) - * @param \DateTime $endDate Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string $status Filter the records by `status` of the scheduled email batch or message. (optional) - * @param int $limit Number of documents returned per page (optional, default to 100) - * @param int $offset Index of the first document on the page (optional, default to 0) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScheduledEmailByBatchIdAsync($batchId, $startDate = null, $endDate = null, $sort = 'desc', $status = null, $limit = '100', $offset = '0') - { - return $this->getScheduledEmailByBatchIdAsyncWithHttpInfo($batchId, $startDate, $endDate, $sort, $status, $limit, $offset) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getScheduledEmailByBatchIdAsyncWithHttpInfo - * - * Fetch scheduled emails by batchId - * - * @param string $batchId The batchId of scheduled emails batch (Should be a valid UUIDv4) (required) - * @param \DateTime $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. (optional) - * @param \DateTime $endDate Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string $status Filter the records by `status` of the scheduled email batch or message. (optional) - * @param int $limit Number of documents returned per page (optional, default to 100) - * @param int $offset Index of the first document on the page (optional, default to 0) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScheduledEmailByBatchIdAsyncWithHttpInfo($batchId, $startDate = null, $endDate = null, $sort = 'desc', $status = null, $limit = '100', $offset = '0') - { - $returnType = '\Brevo\Client\Model\GetScheduledEmailByBatchId'; - $request = $this->getScheduledEmailByBatchIdRequest($batchId, $startDate, $endDate, $sort, $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 + if (in_array('\Brevo\Client\Models\GetScheduledEmailById200Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetScheduledEmailById200Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } return [ - ObjectSerializer::deserialize($content, $returnType, []), + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetScheduledEmailById200Response', []), $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 'getScheduledEmailByBatchId' - * - * @param string $batchId The batchId of scheduled emails batch (Should be a valid UUIDv4) (required) - * @param \DateTime $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. (optional) - * @param \DateTime $endDate Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string $status Filter the records by `status` of the scheduled email batch or message. (optional) - * @param int $limit Number of documents returned per page (optional, default to 100) - * @param int $offset Index of the first document on the page (optional, default to 0) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getScheduledEmailByBatchIdRequest($batchId, $startDate = null, $endDate = null, $sort = 'desc', $status = null, $limit = '100', $offset = '0') - { - // verify the required parameter 'batchId' is set - if ($batchId === null || (is_array($batchId) && count($batchId) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $batchId when calling getScheduledEmailByBatchId' - ); - } - if ($limit !== null && $limit > 500) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getScheduledEmailByBatchId, must be smaller than or equal to 500.'); - } - if ($limit !== null && $limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getScheduledEmailByBatchId, must be bigger than or equal to 0.'); - } - - - $resourcePath = '/smtp/emailStatus/{batchId}'; - $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 ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } - // query params - if ($status !== null) { - $queryParams['status'] = ObjectSerializer::toQueryValue($status); - } - // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } - // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } - - // path params - if ($batchId !== null) { - $resourcePath = str_replace( - '{' . 'batchId' . '}', - ObjectSerializer::toPathValue($batchId), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() ]; - } - // 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\Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('api-key'); - if ($apiKey !== null) { - $headers['api-key'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('partner-key'); - if ($apiKey !== null) { - $headers['partner-key'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getScheduledEmailByMessageId - * - * Fetch scheduled email by messageId - * - * @param string $messageId The messageId of scheduled email (required) - * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. (optional) - * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetScheduledEmailByMessageId - */ - public function getScheduledEmailByMessageId($messageId, $startDate = null, $endDate = null) - { - list($response) = $this->getScheduledEmailByMessageIdWithHttpInfo($messageId, $startDate, $endDate); - return $response; - } - - /** - * Operation getScheduledEmailByMessageIdWithHttpInfo - * - * Fetch scheduled email by messageId - * - * @param string $messageId The messageId of scheduled email (required) - * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. (optional) - * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetScheduledEmailByMessageId, HTTP status code, HTTP response headers (array of strings) - */ - public function getScheduledEmailByMessageIdWithHttpInfo($messageId, $startDate = null, $endDate = null) - { - $returnType = '\Brevo\Client\Model\GetScheduledEmailByMessageId'; - $request = $this->getScheduledEmailByMessageIdRequest($messageId, $startDate, $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 - ); - } + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } - $statusCode = $response->getStatusCode(); + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetScheduledEmailById200Response'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2999,7 +3342,7 @@ public function getScheduledEmailByMessageIdWithHttpInfo($messageId, $startDate case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetScheduledEmailByMessageId', + '\Brevo\Client\Models\GetScheduledEmailById200Response', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3007,7 +3350,7 @@ public function getScheduledEmailByMessageIdWithHttpInfo($messageId, $startDate case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3015,7 +3358,7 @@ public function getScheduledEmailByMessageIdWithHttpInfo($messageId, $startDate case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3026,20 +3369,34 @@ public function getScheduledEmailByMessageIdWithHttpInfo($messageId, $startDate } /** - * Operation getScheduledEmailByMessageIdAsync - * - * Fetch scheduled email by messageId + * Operation getScheduledEmailByIdAsync * - * @param string $messageId The messageId of scheduled email (required) - * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. (optional) - * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * Fetch scheduled emails by batchId or messageId * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @param string $identifier The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. (required) + * @param \DateTime|null $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. (optional) + * @param \DateTime|null $endDate Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. Not valid when identifier is `messageId`. (optional, default to 'desc') + * @param string|null $status Filter the records by `status` of the scheduled email batch or message. Not valid when identifier is `messageId`. (optional) + * @param int|null $limit Number of documents returned per page. Not valid when identifier is `messageId`. (optional, default to 100) + * @param int|null $offset Index of the first document on the page. Not valid when identifier is `messageId`. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledEmailById'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getScheduledEmailByMessageIdAsync($messageId, $startDate = null, $endDate = null) + public function getScheduledEmailByIdAsync( + string $identifier, + ?\DateTime $startDate = null, + ?\DateTime $endDate = null, + ?string $sort = 'desc', + ?string $status = null, + ?int $limit = 100, + ?int $offset = 0, + string $contentType = self::contentTypes['getScheduledEmailById'][0] + ): PromiseInterface { - return $this->getScheduledEmailByMessageIdAsyncWithHttpInfo($messageId, $startDate, $endDate) + return $this->getScheduledEmailByIdAsyncWithHttpInfo($identifier, $startDate, $endDate, $sort, $status, $limit, $offset, $contentType) ->then( function ($response) { return $response[0]; @@ -3048,31 +3405,45 @@ function ($response) { } /** - * Operation getScheduledEmailByMessageIdAsyncWithHttpInfo - * - * Fetch scheduled email by messageId + * Operation getScheduledEmailByIdAsyncWithHttpInfo * - * @param string $messageId The messageId of scheduled email (required) - * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. (optional) - * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * Fetch scheduled emails by batchId or messageId * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @param string $identifier The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. (required) + * @param \DateTime|null $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. (optional) + * @param \DateTime|null $endDate Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. Not valid when identifier is `messageId`. (optional, default to 'desc') + * @param string|null $status Filter the records by `status` of the scheduled email batch or message. Not valid when identifier is `messageId`. (optional) + * @param int|null $limit Number of documents returned per page. Not valid when identifier is `messageId`. (optional, default to 100) + * @param int|null $offset Index of the first document on the page. Not valid when identifier is `messageId`. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledEmailById'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getScheduledEmailByMessageIdAsyncWithHttpInfo($messageId, $startDate = null, $endDate = null) + public function getScheduledEmailByIdAsyncWithHttpInfo( + $identifier, + $startDate = null, + $endDate = null, + $sort = 'desc', + $status = null, + $limit = 100, + $offset = 0, + string $contentType = self::contentTypes['getScheduledEmailById'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetScheduledEmailByMessageId'; - $request = $this->getScheduledEmailByMessageIdRequest($messageId, $startDate, $endDate); + $returnType = '\Brevo\Client\Models\GetScheduledEmailById200Response'; + $request = $this->getScheduledEmailByIdRequest($identifier, $startDate, $endDate, $sort, $status, $limit, $offset, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3095,32 +3466,60 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); } /** - * Create request for operation 'getScheduledEmailByMessageId' - * - * @param string $messageId The messageId of scheduled email (required) - * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. (optional) - * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * Create request for operation 'getScheduledEmailById' * - * @throws \InvalidArgumentException + * @param string $identifier The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. (required) + * @param \DateTime|null $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. (optional) + * @param \DateTime|null $endDate Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. Not valid when identifier is `messageId`. (optional, default to 'desc') + * @param string|null $status Filter the records by `status` of the scheduled email batch or message. Not valid when identifier is `messageId`. (optional) + * @param int|null $limit Number of documents returned per page. Not valid when identifier is `messageId`. (optional, default to 100) + * @param int|null $offset Index of the first document on the page. Not valid when identifier is `messageId`. (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledEmailById'] to see the possible values for this operation + * + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getScheduledEmailByMessageIdRequest($messageId, $startDate = null, $endDate = null) + public function getScheduledEmailByIdRequest( + $identifier, + $startDate = null, + $endDate = null, + $sort = 'desc', + $status = null, + $limit = 100, + $offset = 0, + string $contentType = self::contentTypes['getScheduledEmailById'][0] + ): Request { - // verify the required parameter 'messageId' is set - if ($messageId === null || (is_array($messageId) && count($messageId) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $messageId when calling getScheduledEmailByMessageId' + + // verify the required parameter 'identifier' is set + if ($identifier === null || (is_array($identifier) && count($identifier) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $identifier when calling getScheduledEmailById' ); } - $resourcePath = '/smtp/emailStatus/{messageId}'; + + + + + if ($limit !== null && $limit > 500) { + throw new InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getScheduledEmailById, must be smaller than or equal to 500.'); + } + if ($limit !== null && $limit < 0) { + throw new InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getScheduledEmailById, must be bigger than or equal to 0.'); + } + + + + $resourcePath = '/smtp/emailStatus/{identifier}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -3128,70 +3527,99 @@ protected function getScheduledEmailByMessageIdRequest($messageId, $startDate = $multipart = false; // query params - if ($startDate !== null) { - $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($endDate !== null) { - $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $status, + 'status', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // path params - if ($messageId !== null) { + if ($identifier !== null) { $resourcePath = str_replace( - '{' . 'messageId' . '}', - ObjectSerializer::toPathValue($messageId), + '{' . 'identifier' . '}', + ObjectSerializer::toPathValue($identifier), $resourcePath ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3217,10 +3645,11 @@ protected function getScheduledEmailByMessageIdRequest($messageId, $startDate = $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3231,21 +3660,31 @@ protected function getScheduledEmailByMessageIdRequest($messageId, $startDate = * * Get your transactional email activity aggregated per day * - * @param int $limit Number of documents returned per page (optional, default to 10) - * @param int $offset Index of the first document on the page (optional, default to 0) - * @param string $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD) (optional) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetReports + * @param int|null $limit Number of documents returned per page (optional, default to 10) + * @param int|null $offset Index of the first document on the page (optional, default to 0) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD) (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD) (optional) + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ (optional) + * @param string|null $tag Tag of the emails (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmtpReport'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetReports|\Brevo\Client\Models\ErrorModel */ - public function getSmtpReport($limit = '10', $offset = '0', $startDate = null, $endDate = null, $days = null, $tag = null, $sort = 'desc') + public function getSmtpReport( + ?int $limit = 10, + ?int $offset = 0, + ?string $startDate = null, + ?string $endDate = null, + ?int $days = null, + ?string $tag = null, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getSmtpReport'][0] + ): \Brevo\Client\Models\GetReports { - list($response) = $this->getSmtpReportWithHttpInfo($limit, $offset, $startDate, $endDate, $days, $tag, $sort); + list($response) = $this->getSmtpReportWithHttpInfo($limit, $offset, $startDate, $endDate, $days, $tag, $sort, $contentType); return $response; } @@ -3254,22 +3693,31 @@ public function getSmtpReport($limit = '10', $offset = '0', $startDate = null, $ * * Get your transactional email activity aggregated per day * - * @param int $limit Number of documents returned per page (optional, default to 10) - * @param int $offset Index of the first document on the page (optional, default to 0) - * @param string $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD) (optional) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetReports, HTTP status code, HTTP response headers (array of strings) + * @param int|null $limit Number of documents returned per page (optional, default to 10) + * @param int|null $offset Index of the first document on the page (optional, default to 0) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD) (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD) (optional) + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ (optional) + * @param string|null $tag Tag of the emails (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmtpReport'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetReports|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getSmtpReportWithHttpInfo($limit = '10', $offset = '0', $startDate = null, $endDate = null, $days = null, $tag = null, $sort = 'desc') + public function getSmtpReportWithHttpInfo( + ?int $limit = 10, + ?int $offset = 0, + ?string $startDate = null, + ?string $endDate = null, + ?int $days = null, + ?string $tag = null, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getSmtpReport'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetReports'; - $request = $this->getSmtpReportRequest($limit, $offset, $startDate, $endDate, $days, $tag, $sort); + $request = $this->getSmtpReportRequest($limit, $offset, $startDate, $endDate, $days, $tag, $sort, $contentType); try { $options = $this->createHttpClientOption(); @@ -3278,34 +3726,111 @@ public function getSmtpReportWithHttpInfo($limit = '10', $offset = '0', $startDa } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetReports', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetReports' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetReports', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetReports'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3320,7 +3845,7 @@ public function getSmtpReportWithHttpInfo($limit = '10', $offset = '0', $startDa case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetReports', + '\Brevo\Client\Models\GetReports', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3328,7 +3853,7 @@ public function getSmtpReportWithHttpInfo($limit = '10', $offset = '0', $startDa case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3343,20 +3868,30 @@ public function getSmtpReportWithHttpInfo($limit = '10', $offset = '0', $startDa * * Get your transactional email activity aggregated per day * - * @param int $limit Number of documents returned per page (optional, default to 10) - * @param int $offset Index of the first document on the page (optional, default to 0) - * @param string $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD) (optional) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @param int|null $limit Number of documents returned per page (optional, default to 10) + * @param int|null $offset Index of the first document on the page (optional, default to 0) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD) (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD) (optional) + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ (optional) + * @param string|null $tag Tag of the emails (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmtpReport'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getSmtpReportAsync($limit = '10', $offset = '0', $startDate = null, $endDate = null, $days = null, $tag = null, $sort = 'desc') + public function getSmtpReportAsync( + ?int $limit = 10, + ?int $offset = 0, + ?string $startDate = null, + ?string $endDate = null, + ?int $days = null, + ?string $tag = null, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getSmtpReport'][0] + ): PromiseInterface { - return $this->getSmtpReportAsyncWithHttpInfo($limit, $offset, $startDate, $endDate, $days, $tag, $sort) + return $this->getSmtpReportAsyncWithHttpInfo($limit, $offset, $startDate, $endDate, $days, $tag, $sort, $contentType) ->then( function ($response) { return $response[0]; @@ -3369,31 +3904,41 @@ function ($response) { * * Get your transactional email activity aggregated per day * - * @param int $limit Number of documents returned per page (optional, default to 10) - * @param int $offset Index of the first document on the page (optional, default to 0) - * @param string $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD) (optional) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @param int|null $limit Number of documents returned per page (optional, default to 10) + * @param int|null $offset Index of the first document on the page (optional, default to 0) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD) (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD) (optional) + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ (optional) + * @param string|null $tag Tag of the emails (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmtpReport'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getSmtpReportAsyncWithHttpInfo($limit = '10', $offset = '0', $startDate = null, $endDate = null, $days = null, $tag = null, $sort = 'desc') + public function getSmtpReportAsyncWithHttpInfo( + $limit = 10, + $offset = 0, + $startDate = null, + $endDate = null, + $days = null, + $tag = null, + $sort = 'desc', + string $contentType = self::contentTypes['getSmtpReport'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetReports'; - $request = $this->getSmtpReportRequest($limit, $offset, $startDate, $endDate, $days, $tag, $sort); + $returnType = '\Brevo\Client\Models\GetReports'; + $request = $this->getSmtpReportRequest($limit, $offset, $startDate, $endDate, $days, $tag, $sort, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3416,7 +3961,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3425,25 +3970,42 @@ function ($exception) { /** * Create request for operation 'getSmtpReport' * - * @param int $limit Number of documents returned per page (optional, default to 10) - * @param int $offset Index of the first document on the page (optional, default to 0) - * @param string $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD) (optional) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents returned per page (optional, default to 10) + * @param int|null $offset Index of the first document on the page (optional, default to 0) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD) (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD) (optional) + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ (optional) + * @param string|null $tag Tag of the emails (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmtpReport'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getSmtpReportRequest($limit = '10', $offset = '0', $startDate = null, $endDate = null, $days = null, $tag = null, $sort = 'desc') + public function getSmtpReportRequest( + $limit = 10, + $offset = 0, + $startDate = null, + $endDate = null, + $days = null, + $tag = null, + $sort = 'desc', + string $contentType = self::contentTypes['getSmtpReport'][0] + ): Request { + if ($limit !== null && $limit > 30) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getSmtpReport, must be smaller than or equal to 30.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getSmtpReport, must be smaller than or equal to 30.'); } if ($limit !== null && $limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getSmtpReport, must be bigger than or equal to 0.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getSmtpReport, must be bigger than or equal to 0.'); } + + + + + + $resourcePath = '/smtp/statistics/reports'; @@ -3454,82 +4016,100 @@ protected function getSmtpReportRequest($limit = '10', $offset = '0', $startDate $multipart = false; // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($startDate !== null) { - $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($endDate !== null) { - $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($days !== null) { - $queryParams['days'] = ObjectSerializer::toQueryValue($days); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $days, + 'days', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($tag !== null) { - $queryParams['tag'] = ObjectSerializer::toQueryValue($tag); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $tag, + 'tag', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3555,10 +4135,11 @@ protected function getSmtpReportRequest($limit = '10', $offset = '0', $startDate $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3570,14 +4151,18 @@ protected function getSmtpReportRequest($limit = '10', $offset = '0', $startDate * Returns the template information * * @param int $templateId id of the template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmtpTemplate'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetSmtpTemplateOverview + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetSmtpTemplateOverview|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function getSmtpTemplate($templateId) + public function getSmtpTemplate( + int $templateId, + string $contentType = self::contentTypes['getSmtpTemplate'][0] + ): \Brevo\Client\Models\GetSmtpTemplateOverview { - list($response) = $this->getSmtpTemplateWithHttpInfo($templateId); + list($response) = $this->getSmtpTemplateWithHttpInfo($templateId, $contentType); return $response; } @@ -3587,15 +4172,18 @@ public function getSmtpTemplate($templateId) * Returns the template information * * @param int $templateId id of the template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmtpTemplate'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetSmtpTemplateOverview, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetSmtpTemplateOverview|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getSmtpTemplateWithHttpInfo($templateId) + public function getSmtpTemplateWithHttpInfo( + int $templateId, + string $contentType = self::contentTypes['getSmtpTemplate'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetSmtpTemplateOverview'; - $request = $this->getSmtpTemplateRequest($templateId); + $request = $this->getSmtpTemplateRequest($templateId, $contentType); try { $options = $this->createHttpClientOption(); @@ -3604,34 +4192,138 @@ public function getSmtpTemplateWithHttpInfo($templateId) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetSmtpTemplateOverview', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetSmtpTemplateOverview' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetSmtpTemplateOverview', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetSmtpTemplateOverview'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3646,23 +4338,23 @@ public function getSmtpTemplateWithHttpInfo($templateId) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetSmtpTemplateOverview', + '\Brevo\Client\Models\GetSmtpTemplateOverview', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3678,13 +4370,17 @@ public function getSmtpTemplateWithHttpInfo($templateId) * Returns the template information * * @param int $templateId id of the template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmtpTemplate'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getSmtpTemplateAsync($templateId) + public function getSmtpTemplateAsync( + int $templateId, + string $contentType = self::contentTypes['getSmtpTemplate'][0] + ): PromiseInterface { - return $this->getSmtpTemplateAsyncWithHttpInfo($templateId) + return $this->getSmtpTemplateAsyncWithHttpInfo($templateId, $contentType) ->then( function ($response) { return $response[0]; @@ -3698,24 +4394,28 @@ function ($response) { * Returns the template information * * @param int $templateId id of the template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmtpTemplate'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getSmtpTemplateAsyncWithHttpInfo($templateId) + public function getSmtpTemplateAsyncWithHttpInfo( + $templateId, + string $contentType = self::contentTypes['getSmtpTemplate'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetSmtpTemplateOverview'; - $request = $this->getSmtpTemplateRequest($templateId); + $returnType = '\Brevo\Client\Models\GetSmtpTemplateOverview'; + $request = $this->getSmtpTemplateRequest($templateId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3738,7 +4438,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3748,19 +4448,25 @@ function ($exception) { * Create request for operation 'getSmtpTemplate' * * @param int $templateId id of the template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmtpTemplate'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getSmtpTemplateRequest($templateId) + public function getSmtpTemplateRequest( + $templateId, + string $contentType = self::contentTypes['getSmtpTemplate'][0] + ): Request { + // verify the required parameter 'templateId' is set if ($templateId === null || (is_array($templateId) && count($templateId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $templateId when calling getSmtpTemplate' ); } + $resourcePath = '/smtp/templates/{templateId}'; $formParams = []; $queryParams = []; @@ -3769,6 +4475,7 @@ protected function getSmtpTemplateRequest($templateId) $multipart = false; + // path params if ($templateId !== null) { $resourcePath = str_replace( @@ -3778,53 +4485,35 @@ protected function getSmtpTemplateRequest($templateId) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3850,10 +4539,11 @@ protected function getSmtpTemplateRequest($templateId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3864,18 +4554,25 @@ protected function getSmtpTemplateRequest($templateId) * * Get the list of email 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param bool|null $templateStatus Filter on the status of the template. Active = true, inactive = false (optional) + * @param int|null $limit Number of documents returned per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmtpTemplates'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetSmtpTemplates + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetSmtpTemplates|\Brevo\Client\Models\ErrorModel */ - public function getSmtpTemplates($templateStatus = null, $limit = '50', $offset = '0', $sort = 'desc') + public function getSmtpTemplates( + ?bool $templateStatus = null, + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getSmtpTemplates'][0] + ): \Brevo\Client\Models\GetSmtpTemplates { - list($response) = $this->getSmtpTemplatesWithHttpInfo($templateStatus, $limit, $offset, $sort); + list($response) = $this->getSmtpTemplatesWithHttpInfo($templateStatus, $limit, $offset, $sort, $contentType); return $response; } @@ -3884,19 +4581,25 @@ public function getSmtpTemplates($templateStatus = null, $limit = '50', $offset * * Get the list of email 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param bool|null $templateStatus Filter on the status of the template. Active = true, inactive = false (optional) + * @param int|null $limit Number of documents returned per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmtpTemplates'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetSmtpTemplates, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetSmtpTemplates|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getSmtpTemplatesWithHttpInfo($templateStatus = null, $limit = '50', $offset = '0', $sort = 'desc') + public function getSmtpTemplatesWithHttpInfo( + ?bool $templateStatus = null, + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getSmtpTemplates'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetSmtpTemplates'; - $request = $this->getSmtpTemplatesRequest($templateStatus, $limit, $offset, $sort); + $request = $this->getSmtpTemplatesRequest($templateStatus, $limit, $offset, $sort, $contentType); try { $options = $this->createHttpClientOption(); @@ -3905,34 +4608,111 @@ public function getSmtpTemplatesWithHttpInfo($templateStatus = null, $limit = '5 } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetSmtpTemplates', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetSmtpTemplates' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetSmtpTemplates', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetSmtpTemplates'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3947,7 +4727,7 @@ public function getSmtpTemplatesWithHttpInfo($templateStatus = null, $limit = '5 case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetSmtpTemplates', + '\Brevo\Client\Models\GetSmtpTemplates', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3955,7 +4735,7 @@ public function getSmtpTemplatesWithHttpInfo($templateStatus = null, $limit = '5 case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3970,17 +4750,24 @@ public function getSmtpTemplatesWithHttpInfo($templateStatus = null, $limit = '5 * * Get the list of email 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param bool|null $templateStatus Filter on the status of the template. Active = true, inactive = false (optional) + * @param int|null $limit Number of documents returned per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmtpTemplates'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getSmtpTemplatesAsync($templateStatus = null, $limit = '50', $offset = '0', $sort = 'desc') + public function getSmtpTemplatesAsync( + ?bool $templateStatus = null, + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getSmtpTemplates'][0] + ): PromiseInterface { - return $this->getSmtpTemplatesAsyncWithHttpInfo($templateStatus, $limit, $offset, $sort) + return $this->getSmtpTemplatesAsyncWithHttpInfo($templateStatus, $limit, $offset, $sort, $contentType) ->then( function ($response) { return $response[0]; @@ -3993,28 +4780,35 @@ function ($response) { * * Get the list of email 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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param bool|null $templateStatus Filter on the status of the template. Active = true, inactive = false (optional) + * @param int|null $limit Number of documents returned per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmtpTemplates'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getSmtpTemplatesAsyncWithHttpInfo($templateStatus = null, $limit = '50', $offset = '0', $sort = 'desc') + public function getSmtpTemplatesAsyncWithHttpInfo( + $templateStatus = null, + $limit = 50, + $offset = 0, + $sort = 'desc', + string $contentType = self::contentTypes['getSmtpTemplates'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetSmtpTemplates'; - $request = $this->getSmtpTemplatesRequest($templateStatus, $limit, $offset, $sort); + $returnType = '\Brevo\Client\Models\GetSmtpTemplates'; + $request = $this->getSmtpTemplatesRequest($templateStatus, $limit, $offset, $sort, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4037,7 +4831,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4046,22 +4840,33 @@ function ($exception) { /** * 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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param bool|null $templateStatus Filter on the status of the template. Active = true, inactive = false (optional) + * @param int|null $limit Number of documents returned per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmtpTemplates'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getSmtpTemplatesRequest($templateStatus = null, $limit = '50', $offset = '0', $sort = 'desc') + public function getSmtpTemplatesRequest( + $templateStatus = null, + $limit = 50, + $offset = 0, + $sort = 'desc', + string $contentType = self::contentTypes['getSmtpTemplates'][0] + ): Request { + + if ($limit !== null && $limit > 1000) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getSmtpTemplates, must be smaller than or equal to 1000.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getSmtpTemplates, must be smaller than or equal to 1000.'); } if ($limit !== null && $limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getSmtpTemplates, must be bigger than or equal to 0.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getSmtpTemplates, must be bigger than or equal to 0.'); } + + $resourcePath = '/smtp/templates'; @@ -4072,70 +4877,73 @@ protected function getSmtpTemplatesRequest($templateStatus = null, $limit = '50' $multipart = false; // query params - if ($templateStatus !== null) { - $queryParams['templateStatus'] = ObjectSerializer::toQueryValue($templateStatus); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $templateStatus, + 'templateStatus', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4161,10 +4969,11 @@ protected function getSmtpTemplatesRequest($templateStatus = null, $limit = '50' $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4175,20 +4984,29 @@ protected function getSmtpTemplatesRequest($templateStatus = null, $limit = '50' * * Get the list of blocked or unsubscribed transactional contacts * - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the blocked or unsubscribed contacts (optional) - * @param string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the blocked or unsubscribed contacts (optional) - * @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 string[] $senders Comma separated list of emails of the senders from which contacts are blocked or unsubscribed (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetTransacBlockedContacts + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the blocked or unsubscribed contacts (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the blocked or unsubscribed contacts (optional) + * @param int|null $limit Number of documents returned per page (optional, default to 50) + * @param int|null $offset Index of the first document on the page (optional, default to 0) + * @param string[]|null $senders Comma separated list of emails of the senders from which contacts are blocked or unsubscribed (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacBlockedContacts'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetTransacBlockedContacts|\Brevo\Client\Models\ErrorModel */ - public function getTransacBlockedContacts($startDate = null, $endDate = null, $limit = '50', $offset = '0', $senders = null, $sort = 'desc') + public function getTransacBlockedContacts( + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 50, + ?int $offset = 0, + ?array $senders = null, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getTransacBlockedContacts'][0] + ): \Brevo\Client\Models\GetTransacBlockedContacts { - list($response) = $this->getTransacBlockedContactsWithHttpInfo($startDate, $endDate, $limit, $offset, $senders, $sort); + list($response) = $this->getTransacBlockedContactsWithHttpInfo($startDate, $endDate, $limit, $offset, $senders, $sort, $contentType); return $response; } @@ -4197,21 +5015,29 @@ public function getTransacBlockedContacts($startDate = null, $endDate = null, $l * * Get the list of blocked or unsubscribed transactional contacts * - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the blocked or unsubscribed contacts (optional) - * @param string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the blocked or unsubscribed contacts (optional) - * @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 string[] $senders Comma separated list of emails of the senders from which contacts are blocked or unsubscribed (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetTransacBlockedContacts, HTTP status code, HTTP response headers (array of strings) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the blocked or unsubscribed contacts (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the blocked or unsubscribed contacts (optional) + * @param int|null $limit Number of documents returned per page (optional, default to 50) + * @param int|null $offset Index of the first document on the page (optional, default to 0) + * @param string[]|null $senders Comma separated list of emails of the senders from which contacts are blocked or unsubscribed (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacBlockedContacts'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetTransacBlockedContacts|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getTransacBlockedContactsWithHttpInfo($startDate = null, $endDate = null, $limit = '50', $offset = '0', $senders = null, $sort = 'desc') + public function getTransacBlockedContactsWithHttpInfo( + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 50, + ?int $offset = 0, + ?array $senders = null, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getTransacBlockedContacts'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetTransacBlockedContacts'; - $request = $this->getTransacBlockedContactsRequest($startDate, $endDate, $limit, $offset, $senders, $sort); + $request = $this->getTransacBlockedContactsRequest($startDate, $endDate, $limit, $offset, $senders, $sort, $contentType); try { $options = $this->createHttpClientOption(); @@ -4220,34 +5046,111 @@ public function getTransacBlockedContactsWithHttpInfo($startDate = null, $endDat } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetTransacBlockedContacts', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetTransacBlockedContacts' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetTransacBlockedContacts', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetTransacBlockedContacts'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -4262,7 +5165,7 @@ public function getTransacBlockedContactsWithHttpInfo($startDate = null, $endDat case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetTransacBlockedContacts', + '\Brevo\Client\Models\GetTransacBlockedContacts', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4270,7 +5173,7 @@ public function getTransacBlockedContactsWithHttpInfo($startDate = null, $endDat case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4285,19 +5188,28 @@ public function getTransacBlockedContactsWithHttpInfo($startDate = null, $endDat * * Get the list of blocked or unsubscribed transactional contacts * - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the blocked or unsubscribed contacts (optional) - * @param string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the blocked or unsubscribed contacts (optional) - * @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 string[] $senders Comma separated list of emails of the senders from which contacts are blocked or unsubscribed (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the blocked or unsubscribed contacts (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the blocked or unsubscribed contacts (optional) + * @param int|null $limit Number of documents returned per page (optional, default to 50) + * @param int|null $offset Index of the first document on the page (optional, default to 0) + * @param string[]|null $senders Comma separated list of emails of the senders from which contacts are blocked or unsubscribed (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacBlockedContacts'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getTransacBlockedContactsAsync($startDate = null, $endDate = null, $limit = '50', $offset = '0', $senders = null, $sort = 'desc') + public function getTransacBlockedContactsAsync( + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 50, + ?int $offset = 0, + ?array $senders = null, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getTransacBlockedContacts'][0] + ): PromiseInterface { - return $this->getTransacBlockedContactsAsyncWithHttpInfo($startDate, $endDate, $limit, $offset, $senders, $sort) + return $this->getTransacBlockedContactsAsyncWithHttpInfo($startDate, $endDate, $limit, $offset, $senders, $sort, $contentType) ->then( function ($response) { return $response[0]; @@ -4310,30 +5222,39 @@ function ($response) { * * Get the list of blocked or unsubscribed transactional contacts * - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the blocked or unsubscribed contacts (optional) - * @param string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the blocked or unsubscribed contacts (optional) - * @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 string[] $senders Comma separated list of emails of the senders from which contacts are blocked or unsubscribed (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the blocked or unsubscribed contacts (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the blocked or unsubscribed contacts (optional) + * @param int|null $limit Number of documents returned per page (optional, default to 50) + * @param int|null $offset Index of the first document on the page (optional, default to 0) + * @param string[]|null $senders Comma separated list of emails of the senders from which contacts are blocked or unsubscribed (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacBlockedContacts'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getTransacBlockedContactsAsyncWithHttpInfo($startDate = null, $endDate = null, $limit = '50', $offset = '0', $senders = null, $sort = 'desc') + public function getTransacBlockedContactsAsyncWithHttpInfo( + $startDate = null, + $endDate = null, + $limit = 50, + $offset = 0, + $senders = null, + $sort = 'desc', + string $contentType = self::contentTypes['getTransacBlockedContacts'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetTransacBlockedContacts'; - $request = $this->getTransacBlockedContactsRequest($startDate, $endDate, $limit, $offset, $senders, $sort); + $returnType = '\Brevo\Client\Models\GetTransacBlockedContacts'; + $request = $this->getTransacBlockedContactsRequest($startDate, $endDate, $limit, $offset, $senders, $sort, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4356,7 +5277,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4365,24 +5286,39 @@ function ($exception) { /** * Create request for operation 'getTransacBlockedContacts' * - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the blocked or unsubscribed contacts (optional) - * @param string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the blocked or unsubscribed contacts (optional) - * @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 string[] $senders Comma separated list of emails of the senders from which contacts are blocked or unsubscribed (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the blocked or unsubscribed contacts (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the blocked or unsubscribed contacts (optional) + * @param int|null $limit Number of documents returned per page (optional, default to 50) + * @param int|null $offset Index of the first document on the page (optional, default to 0) + * @param string[]|null $senders Comma separated list of emails of the senders from which contacts are blocked or unsubscribed (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacBlockedContacts'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getTransacBlockedContactsRequest($startDate = null, $endDate = null, $limit = '50', $offset = '0', $senders = null, $sort = 'desc') + public function getTransacBlockedContactsRequest( + $startDate = null, + $endDate = null, + $limit = 50, + $offset = 0, + $senders = null, + $sort = 'desc', + string $contentType = self::contentTypes['getTransacBlockedContacts'][0] + ): Request { + + + if ($limit !== null && $limit > 100) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getTransacBlockedContacts, must be smaller than or equal to 100.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getTransacBlockedContacts, must be smaller than or equal to 100.'); } if ($limit !== null && $limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getTransacBlockedContacts, must be bigger than or equal to 0.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getTransacBlockedContacts, must be bigger than or equal to 0.'); } + + + $resourcePath = '/smtp/blockedContacts'; @@ -4393,81 +5329,91 @@ protected function getTransacBlockedContactsRequest($startDate = null, $endDate $multipart = false; // query params - if ($startDate !== null) { - $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($endDate !== null) { - $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if (is_array($senders)) { - $queryParams['senders'] = $senders; - } else - if ($senders !== null) { - $queryParams['senders'] = ObjectSerializer::toQueryValue($senders); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $senders, + 'senders', // param base name + 'array', // openApiType + 'form', // style + false, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4493,10 +5439,11 @@ protected function getTransacBlockedContactsRequest($startDate = null, $endDate $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4508,14 +5455,18 @@ protected function getTransacBlockedContactsRequest($startDate = null, $endDate * Get the personalized content of a sent transactional email * * @param string $uuid Unique id of the transactional email that has been sent to a particular contact (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacEmailContent'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetTransacEmailContent + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetTransacEmailContent */ - public function getTransacEmailContent($uuid) + public function getTransacEmailContent( + string $uuid, + string $contentType = self::contentTypes['getTransacEmailContent'][0] + ): \Brevo\Client\Models\GetTransacEmailContent { - list($response) = $this->getTransacEmailContentWithHttpInfo($uuid); + list($response) = $this->getTransacEmailContentWithHttpInfo($uuid, $contentType); return $response; } @@ -4525,15 +5476,18 @@ public function getTransacEmailContent($uuid) * Get the personalized content of a sent transactional email * * @param string $uuid Unique id of the transactional email that has been sent to a particular contact (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacEmailContent'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetTransacEmailContent, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetTransacEmailContent, HTTP status code, HTTP response headers (array of strings) */ - public function getTransacEmailContentWithHttpInfo($uuid) + public function getTransacEmailContentWithHttpInfo( + string $uuid, + string $contentType = self::contentTypes['getTransacEmailContent'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetTransacEmailContent'; - $request = $this->getTransacEmailContentRequest($uuid); + $request = $this->getTransacEmailContentRequest($uuid, $contentType); try { $options = $this->createHttpClientOption(); @@ -4542,34 +5496,84 @@ public function getTransacEmailContentWithHttpInfo($uuid) } 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 + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetTransacEmailContent', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetTransacEmailContent' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetTransacEmailContent', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetTransacEmailContent'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -4584,7 +5588,7 @@ public function getTransacEmailContentWithHttpInfo($uuid) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetTransacEmailContent', + '\Brevo\Client\Models\GetTransacEmailContent', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4600,13 +5604,17 @@ public function getTransacEmailContentWithHttpInfo($uuid) * Get the personalized content of a sent transactional email * * @param string $uuid Unique id of the transactional email that has been sent to a particular contact (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacEmailContent'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getTransacEmailContentAsync($uuid) + public function getTransacEmailContentAsync( + string $uuid, + string $contentType = self::contentTypes['getTransacEmailContent'][0] + ): PromiseInterface { - return $this->getTransacEmailContentAsyncWithHttpInfo($uuid) + return $this->getTransacEmailContentAsyncWithHttpInfo($uuid, $contentType) ->then( function ($response) { return $response[0]; @@ -4620,24 +5628,28 @@ function ($response) { * Get the personalized content of a sent transactional email * * @param string $uuid Unique id of the transactional email that has been sent to a particular contact (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacEmailContent'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getTransacEmailContentAsyncWithHttpInfo($uuid) + public function getTransacEmailContentAsyncWithHttpInfo( + $uuid, + string $contentType = self::contentTypes['getTransacEmailContent'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetTransacEmailContent'; - $request = $this->getTransacEmailContentRequest($uuid); + $returnType = '\Brevo\Client\Models\GetTransacEmailContent'; + $request = $this->getTransacEmailContentRequest($uuid, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4660,7 +5672,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4670,19 +5682,25 @@ function ($exception) { * Create request for operation 'getTransacEmailContent' * * @param string $uuid Unique id of the transactional email that has been sent to a particular contact (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacEmailContent'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getTransacEmailContentRequest($uuid) + public function getTransacEmailContentRequest( + $uuid, + string $contentType = self::contentTypes['getTransacEmailContent'][0] + ): Request { + // verify the required parameter 'uuid' is set if ($uuid === null || (is_array($uuid) && count($uuid) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $uuid when calling getTransacEmailContent' ); } + $resourcePath = '/smtp/emails/{uuid}'; $formParams = []; $queryParams = []; @@ -4691,6 +5709,7 @@ protected function getTransacEmailContentRequest($uuid) $multipart = false; + // path params if ($uuid !== null) { $resourcePath = str_replace( @@ -4700,53 +5719,35 @@ protected function getTransacEmailContentRequest($uuid) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4772,10 +5773,11 @@ protected function getTransacEmailContentRequest($uuid) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4786,22 +5788,33 @@ protected function getTransacEmailContentRequest($uuid) * * Get the list of transactional emails on the basis of allowed filters * - * @param string $email Mandatory if templateId and messageId are not passed in query filters. Email address to which transactional email has been sent. (optional) - * @param int $templateId Mandatory if email and messageId are not passed in query filters. Id of the template that was used to compose transactional email. (optional) - * @param string $messageId Mandatory if templateId and email are not passed in query filters. Message ID of the transactional email sent. (optional) - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param int $limit Number of documents returned per page (optional, default to 500) - * @param int $offset Index of the first document in the page (optional, default to 0) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetTransacEmailsList + * @param string|null $email **Mandatory if templateId and messageId are not passed in query filters.** Email address to which transactional email has been sent. (optional) + * @param int|null $templateId **Mandatory if email and messageId are not passed in query filters.** Id of the template that was used to compose transactional email. (optional) + * @param string|null $messageId **Mandatory if templateId and email are not passed in query filters.** Message ID of the transactional email sent. (optional) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the list. **Maximum time period that can be selected is one month**. (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the list. **Maximum time period that can be selected is one month.** (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param int|null $limit Number of documents returned per page (optional, default to 500) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacEmailsList'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetTransacEmailsList|\Brevo\Client\Models\ErrorModel */ - public function getTransacEmailsList($email = null, $templateId = null, $messageId = null, $startDate = null, $endDate = null, $sort = 'desc', $limit = '500', $offset = '0') + public function getTransacEmailsList( + ?string $email = null, + ?int $templateId = null, + ?string $messageId = null, + ?string $startDate = null, + ?string $endDate = null, + ?string $sort = 'desc', + ?int $limit = 500, + ?int $offset = 0, + string $contentType = self::contentTypes['getTransacEmailsList'][0] + ): \Brevo\Client\Models\GetTransacEmailsList { - list($response) = $this->getTransacEmailsListWithHttpInfo($email, $templateId, $messageId, $startDate, $endDate, $sort, $limit, $offset); + list($response) = $this->getTransacEmailsListWithHttpInfo($email, $templateId, $messageId, $startDate, $endDate, $sort, $limit, $offset, $contentType); return $response; } @@ -4810,23 +5823,33 @@ public function getTransacEmailsList($email = null, $templateId = null, $message * * Get the list of transactional emails on the basis of allowed filters * - * @param string $email Mandatory if templateId and messageId are not passed in query filters. Email address to which transactional email has been sent. (optional) - * @param int $templateId Mandatory if email and messageId are not passed in query filters. Id of the template that was used to compose transactional email. (optional) - * @param string $messageId Mandatory if templateId and email are not passed in query filters. Message ID of the transactional email sent. (optional) - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param int $limit Number of documents returned per page (optional, default to 500) - * @param int $offset Index of the first document in the page (optional, default to 0) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetTransacEmailsList, HTTP status code, HTTP response headers (array of strings) + * @param string|null $email **Mandatory if templateId and messageId are not passed in query filters.** Email address to which transactional email has been sent. (optional) + * @param int|null $templateId **Mandatory if email and messageId are not passed in query filters.** Id of the template that was used to compose transactional email. (optional) + * @param string|null $messageId **Mandatory if templateId and email are not passed in query filters.** Message ID of the transactional email sent. (optional) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the list. **Maximum time period that can be selected is one month**. (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the list. **Maximum time period that can be selected is one month.** (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param int|null $limit Number of documents returned per page (optional, default to 500) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacEmailsList'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetTransacEmailsList|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getTransacEmailsListWithHttpInfo($email = null, $templateId = null, $messageId = null, $startDate = null, $endDate = null, $sort = 'desc', $limit = '500', $offset = '0') + public function getTransacEmailsListWithHttpInfo( + ?string $email = null, + ?int $templateId = null, + ?string $messageId = null, + ?string $startDate = null, + ?string $endDate = null, + ?string $sort = 'desc', + ?int $limit = 500, + ?int $offset = 0, + string $contentType = self::contentTypes['getTransacEmailsList'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetTransacEmailsList'; - $request = $this->getTransacEmailsListRequest($email, $templateId, $messageId, $startDate, $endDate, $sort, $limit, $offset); + $request = $this->getTransacEmailsListRequest($email, $templateId, $messageId, $startDate, $endDate, $sort, $limit, $offset, $contentType); try { $options = $this->createHttpClientOption(); @@ -4835,34 +5858,111 @@ public function getTransacEmailsListWithHttpInfo($email = null, $templateId = nu } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetTransacEmailsList', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetTransacEmailsList' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetTransacEmailsList', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetTransacEmailsList'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -4877,7 +5977,7 @@ public function getTransacEmailsListWithHttpInfo($email = null, $templateId = nu case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetTransacEmailsList', + '\Brevo\Client\Models\GetTransacEmailsList', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4885,7 +5985,7 @@ public function getTransacEmailsListWithHttpInfo($email = null, $templateId = nu case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4900,21 +6000,32 @@ public function getTransacEmailsListWithHttpInfo($email = null, $templateId = nu * * Get the list of transactional emails on the basis of allowed filters * - * @param string $email Mandatory if templateId and messageId are not passed in query filters. Email address to which transactional email has been sent. (optional) - * @param int $templateId Mandatory if email and messageId are not passed in query filters. Id of the template that was used to compose transactional email. (optional) - * @param string $messageId Mandatory if templateId and email are not passed in query filters. Message ID of the transactional email sent. (optional) - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param int $limit Number of documents returned 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 + * @param string|null $email **Mandatory if templateId and messageId are not passed in query filters.** Email address to which transactional email has been sent. (optional) + * @param int|null $templateId **Mandatory if email and messageId are not passed in query filters.** Id of the template that was used to compose transactional email. (optional) + * @param string|null $messageId **Mandatory if templateId and email are not passed in query filters.** Message ID of the transactional email sent. (optional) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the list. **Maximum time period that can be selected is one month**. (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the list. **Maximum time period that can be selected is one month.** (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param int|null $limit Number of documents returned per page (optional, default to 500) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacEmailsList'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getTransacEmailsListAsync($email = null, $templateId = null, $messageId = null, $startDate = null, $endDate = null, $sort = 'desc', $limit = '500', $offset = '0') + public function getTransacEmailsListAsync( + ?string $email = null, + ?int $templateId = null, + ?string $messageId = null, + ?string $startDate = null, + ?string $endDate = null, + ?string $sort = 'desc', + ?int $limit = 500, + ?int $offset = 0, + string $contentType = self::contentTypes['getTransacEmailsList'][0] + ): PromiseInterface { - return $this->getTransacEmailsListAsyncWithHttpInfo($email, $templateId, $messageId, $startDate, $endDate, $sort, $limit, $offset) + return $this->getTransacEmailsListAsyncWithHttpInfo($email, $templateId, $messageId, $startDate, $endDate, $sort, $limit, $offset, $contentType) ->then( function ($response) { return $response[0]; @@ -4927,32 +6038,43 @@ function ($response) { * * Get the list of transactional emails on the basis of allowed filters * - * @param string $email Mandatory if templateId and messageId are not passed in query filters. Email address to which transactional email has been sent. (optional) - * @param int $templateId Mandatory if email and messageId are not passed in query filters. Id of the template that was used to compose transactional email. (optional) - * @param string $messageId Mandatory if templateId and email are not passed in query filters. Message ID of the transactional email sent. (optional) - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param int $limit Number of documents returned 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 + * @param string|null $email **Mandatory if templateId and messageId are not passed in query filters.** Email address to which transactional email has been sent. (optional) + * @param int|null $templateId **Mandatory if email and messageId are not passed in query filters.** Id of the template that was used to compose transactional email. (optional) + * @param string|null $messageId **Mandatory if templateId and email are not passed in query filters.** Message ID of the transactional email sent. (optional) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the list. **Maximum time period that can be selected is one month**. (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the list. **Maximum time period that can be selected is one month.** (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param int|null $limit Number of documents returned per page (optional, default to 500) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacEmailsList'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getTransacEmailsListAsyncWithHttpInfo($email = null, $templateId = null, $messageId = null, $startDate = null, $endDate = null, $sort = 'desc', $limit = '500', $offset = '0') + public function getTransacEmailsListAsyncWithHttpInfo( + $email = null, + $templateId = null, + $messageId = null, + $startDate = null, + $endDate = null, + $sort = 'desc', + $limit = 500, + $offset = 0, + string $contentType = self::contentTypes['getTransacEmailsList'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetTransacEmailsList'; - $request = $this->getTransacEmailsListRequest($email, $templateId, $messageId, $startDate, $endDate, $sort, $limit, $offset); + $returnType = '\Brevo\Client\Models\GetTransacEmailsList'; + $request = $this->getTransacEmailsListRequest($email, $templateId, $messageId, $startDate, $endDate, $sort, $limit, $offset, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4975,7 +6097,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4984,26 +6106,45 @@ function ($exception) { /** * Create request for operation 'getTransacEmailsList' * - * @param string $email Mandatory if templateId and messageId are not passed in query filters. Email address to which transactional email has been sent. (optional) - * @param int $templateId Mandatory if email and messageId are not passed in query filters. Id of the template that was used to compose transactional email. (optional) - * @param string $messageId Mandatory if templateId and email are not passed in query filters. Message ID of the transactional email sent. (optional) - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param int $limit Number of documents returned per page (optional, default to 500) - * @param int $offset Index of the first document in the page (optional, default to 0) - * - * @throws \InvalidArgumentException + * @param string|null $email **Mandatory if templateId and messageId are not passed in query filters.** Email address to which transactional email has been sent. (optional) + * @param int|null $templateId **Mandatory if email and messageId are not passed in query filters.** Id of the template that was used to compose transactional email. (optional) + * @param string|null $messageId **Mandatory if templateId and email are not passed in query filters.** Message ID of the transactional email sent. (optional) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the list. **Maximum time period that can be selected is one month**. (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the list. **Maximum time period that can be selected is one month.** (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param int|null $limit Number of documents returned per page (optional, default to 500) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacEmailsList'] to see the possible values for this operation + * + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getTransacEmailsListRequest($email = null, $templateId = null, $messageId = null, $startDate = null, $endDate = null, $sort = 'desc', $limit = '500', $offset = '0') + public function getTransacEmailsListRequest( + $email = null, + $templateId = null, + $messageId = null, + $startDate = null, + $endDate = null, + $sort = 'desc', + $limit = 500, + $offset = 0, + string $contentType = self::contentTypes['getTransacEmailsList'][0] + ): Request { + + + + + + + if ($limit !== null && $limit > 1000) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getTransacEmailsList, must be smaller than or equal to 1000.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getTransacEmailsList, must be smaller than or equal to 1000.'); } if ($limit !== null && $limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getTransacEmailsList, must be bigger than or equal to 0.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling TransactionalEmailsApi.getTransacEmailsList, must be bigger than or equal to 0.'); } + $resourcePath = '/smtp/emails'; @@ -5014,86 +6155,109 @@ protected function getTransacEmailsListRequest($email = null, $templateId = null $multipart = false; // query params - if ($email !== null) { - $queryParams['email'] = ObjectSerializer::toQueryValue($email); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $email, + 'email', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($templateId !== null) { - $queryParams['templateId'] = ObjectSerializer::toQueryValue($templateId); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $templateId, + 'templateId', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($messageId !== null) { - $queryParams['messageId'] = ObjectSerializer::toQueryValue($messageId); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $messageId, + 'messageId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($startDate !== null) { - $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($endDate !== null) { - $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5119,10 +6283,11 @@ protected function getTransacEmailsListRequest($email = null, $templateId = null $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5134,15 +6299,20 @@ protected function getTransacEmailsListRequest($email = null, $templateId = null * Send a template to your test list * * @param int $templateId Id of the template (required) - * @param \Brevo\Client\Model\SendTestEmail $sendTestEmail sendTestEmail (required) + * @param \Brevo\Client\Models\SendTestEmail $sendTestEmail sendTestEmail (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestTemplate'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function sendTestTemplate($templateId, $sendTestEmail) + public function sendTestTemplate( + int $templateId, + \Brevo\Client\Models\SendTestEmail $sendTestEmail, + string $contentType = self::contentTypes['sendTestTemplate'][0] + ): void { - $this->sendTestTemplateWithHttpInfo($templateId, $sendTestEmail); + $this->sendTestTemplateWithHttpInfo($templateId, $sendTestEmail, $contentType); } /** @@ -5151,16 +6321,20 @@ public function sendTestTemplate($templateId, $sendTestEmail) * Send a template to your test list * * @param int $templateId Id of the template (required) - * @param \Brevo\Client\Model\SendTestEmail $sendTestEmail (required) + * @param \Brevo\Client\Models\SendTestEmail $sendTestEmail (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestTemplate'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function sendTestTemplateWithHttpInfo($templateId, $sendTestEmail) + public function sendTestTemplateWithHttpInfo( + int $templateId, + \Brevo\Client\Models\SendTestEmail $sendTestEmail, + string $contentType = self::contentTypes['sendTestTemplate'][0] + ): array { - $returnType = ''; - $request = $this->sendTestTemplateRequest($templateId, $sendTestEmail); + $request = $this->sendTestTemplateRequest($templateId, $sendTestEmail, $contentType); try { $options = $this->createHttpClientOption(); @@ -5169,26 +6343,21 @@ public function sendTestTemplateWithHttpInfo($templateId, $sendTestEmail) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -5197,7 +6366,7 @@ public function sendTestTemplateWithHttpInfo($templateId, $sendTestEmail) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\PostSendFailed', + '\Brevo\Client\Models\PostSendFailed', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5205,7 +6374,7 @@ public function sendTestTemplateWithHttpInfo($templateId, $sendTestEmail) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5221,14 +6390,19 @@ public function sendTestTemplateWithHttpInfo($templateId, $sendTestEmail) * Send a template to your test list * * @param int $templateId Id of the template (required) - * @param \Brevo\Client\Model\SendTestEmail $sendTestEmail (required) + * @param \Brevo\Client\Models\SendTestEmail $sendTestEmail (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestTemplate'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendTestTemplateAsync($templateId, $sendTestEmail) + public function sendTestTemplateAsync( + int $templateId, + \Brevo\Client\Models\SendTestEmail $sendTestEmail, + string $contentType = self::contentTypes['sendTestTemplate'][0] + ): PromiseInterface { - return $this->sendTestTemplateAsyncWithHttpInfo($templateId, $sendTestEmail) + return $this->sendTestTemplateAsyncWithHttpInfo($templateId, $sendTestEmail, $contentType) ->then( function ($response) { return $response[0]; @@ -5242,15 +6416,21 @@ function ($response) { * Send a template to your test list * * @param int $templateId Id of the template (required) - * @param \Brevo\Client\Model\SendTestEmail $sendTestEmail (required) + * @param \Brevo\Client\Models\SendTestEmail $sendTestEmail (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestTemplate'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendTestTemplateAsyncWithHttpInfo($templateId, $sendTestEmail) + public function sendTestTemplateAsyncWithHttpInfo( + $templateId, + $sendTestEmail, + string $contentType = self::contentTypes['sendTestTemplate'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->sendTestTemplateRequest($templateId, $sendTestEmail); + $request = $this->sendTestTemplateRequest($templateId, $sendTestEmail, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5269,7 +6449,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5279,26 +6459,34 @@ function ($exception) { * Create request for operation 'sendTestTemplate' * * @param int $templateId Id of the template (required) - * @param \Brevo\Client\Model\SendTestEmail $sendTestEmail (required) + * @param \Brevo\Client\Models\SendTestEmail $sendTestEmail (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestTemplate'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function sendTestTemplateRequest($templateId, $sendTestEmail) + public function sendTestTemplateRequest( + $templateId, + $sendTestEmail, + string $contentType = self::contentTypes['sendTestTemplate'][0] + ): Request { + // verify the required parameter 'templateId' is set if ($templateId === null || (is_array($templateId) && count($templateId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $templateId when calling sendTestTemplate' ); } + // verify the required parameter 'sendTestEmail' is set if ($sendTestEmail === null || (is_array($sendTestEmail) && count($sendTestEmail) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $sendTestEmail when calling sendTestTemplate' ); } + $resourcePath = '/smtp/templates/{templateId}/sendTest'; $formParams = []; $queryParams = []; @@ -5307,6 +6495,7 @@ protected function sendTestTemplateRequest($templateId, $sendTestEmail) $multipart = false; + // path params if ($templateId !== null) { $resourcePath = str_replace( @@ -5316,56 +6505,42 @@ protected function sendTestTemplateRequest($templateId, $sendTestEmail) ); } - // 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'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($sendTestEmail)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($sendTestEmail)); + } else { + $httpBody = $sendTestEmail; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5391,10 +6566,11 @@ protected function sendTestTemplateRequest($templateId, $sendTestEmail) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5405,15 +6581,19 @@ protected function sendTestTemplateRequest($templateId, $sendTestEmail) * * Send a transactional email * - * @param \Brevo\Client\Model\SendSmtpEmail $sendSmtpEmail Values to send a transactional email (required) + * @param \Brevo\Client\Models\SendSmtpEmail $sendSmtpEmail Values to send a transactional email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTransacEmail'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreateSmtpEmail + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateSmtpEmail|\Brevo\Client\Models\ScheduleSmtpEmail|\Brevo\Client\Models\ErrorModel */ - public function sendTransacEmail($sendSmtpEmail) + public function sendTransacEmail( + \Brevo\Client\Models\SendSmtpEmail $sendSmtpEmail, + string $contentType = self::contentTypes['sendTransacEmail'][0] + ): \Brevo\Client\Models\CreateSmtpEmail { - list($response) = $this->sendTransacEmailWithHttpInfo($sendSmtpEmail); + list($response) = $this->sendTransacEmailWithHttpInfo($sendSmtpEmail, $contentType); return $response; } @@ -5422,16 +6602,19 @@ public function sendTransacEmail($sendSmtpEmail) * * Send a transactional email * - * @param \Brevo\Client\Model\SendSmtpEmail $sendSmtpEmail Values to send a transactional email (required) + * @param \Brevo\Client\Models\SendSmtpEmail $sendSmtpEmail Values to send a transactional email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTransacEmail'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreateSmtpEmail, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateSmtpEmail|\Brevo\Client\Models\ScheduleSmtpEmail|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function sendTransacEmailWithHttpInfo($sendSmtpEmail) + public function sendTransacEmailWithHttpInfo( + \Brevo\Client\Models\SendSmtpEmail $sendSmtpEmail, + string $contentType = self::contentTypes['sendTransacEmail'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreateSmtpEmail'; - $request = $this->sendTransacEmailRequest($sendSmtpEmail); + $request = $this->sendTransacEmailRequest($sendSmtpEmail, $contentType); try { $options = $this->createHttpClientOption(); @@ -5440,34 +6623,138 @@ public function sendTransacEmailWithHttpInfo($sendSmtpEmail) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreateSmtpEmail', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateSmtpEmail' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateSmtpEmail', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 202: + if (in_array('\Brevo\Client\Models\ScheduleSmtpEmail', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ScheduleSmtpEmail' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ScheduleSmtpEmail', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreateSmtpEmail'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -5482,7 +6769,7 @@ public function sendTransacEmailWithHttpInfo($sendSmtpEmail) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreateSmtpEmail', + '\Brevo\Client\Models\CreateSmtpEmail', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5490,7 +6777,7 @@ public function sendTransacEmailWithHttpInfo($sendSmtpEmail) case 202: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ScheduleSmtpEmail', + '\Brevo\Client\Models\ScheduleSmtpEmail', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5498,7 +6785,7 @@ public function sendTransacEmailWithHttpInfo($sendSmtpEmail) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5513,14 +6800,18 @@ public function sendTransacEmailWithHttpInfo($sendSmtpEmail) * * Send a transactional email * - * @param \Brevo\Client\Model\SendSmtpEmail $sendSmtpEmail Values to send a transactional email (required) + * @param \Brevo\Client\Models\SendSmtpEmail $sendSmtpEmail Values to send a transactional email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTransacEmail'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendTransacEmailAsync($sendSmtpEmail) + public function sendTransacEmailAsync( + \Brevo\Client\Models\SendSmtpEmail $sendSmtpEmail, + string $contentType = self::contentTypes['sendTransacEmail'][0] + ): PromiseInterface { - return $this->sendTransacEmailAsyncWithHttpInfo($sendSmtpEmail) + return $this->sendTransacEmailAsyncWithHttpInfo($sendSmtpEmail, $contentType) ->then( function ($response) { return $response[0]; @@ -5533,25 +6824,29 @@ function ($response) { * * Send a transactional email * - * @param \Brevo\Client\Model\SendSmtpEmail $sendSmtpEmail Values to send a transactional email (required) + * @param \Brevo\Client\Models\SendSmtpEmail $sendSmtpEmail Values to send a transactional email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTransacEmail'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendTransacEmailAsyncWithHttpInfo($sendSmtpEmail) + public function sendTransacEmailAsyncWithHttpInfo( + $sendSmtpEmail, + string $contentType = self::contentTypes['sendTransacEmail'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreateSmtpEmail'; - $request = $this->sendTransacEmailRequest($sendSmtpEmail); + $returnType = '\Brevo\Client\Models\CreateSmtpEmail'; + $request = $this->sendTransacEmailRequest($sendSmtpEmail, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5574,7 +6869,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5583,20 +6878,26 @@ function ($exception) { /** * Create request for operation 'sendTransacEmail' * - * @param \Brevo\Client\Model\SendSmtpEmail $sendSmtpEmail Values to send a transactional email (required) + * @param \Brevo\Client\Models\SendSmtpEmail $sendSmtpEmail Values to send a transactional email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTransacEmail'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function sendTransacEmailRequest($sendSmtpEmail) + public function sendTransacEmailRequest( + $sendSmtpEmail, + string $contentType = self::contentTypes['sendTransacEmail'][0] + ): Request { + // verify the required parameter 'sendSmtpEmail' is set if ($sendSmtpEmail === null || (is_array($sendSmtpEmail) && count($sendSmtpEmail) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $sendSmtpEmail when calling sendTransacEmail' ); } + $resourcePath = '/smtp/email'; $formParams = []; $queryParams = []; @@ -5606,56 +6907,43 @@ protected function sendTransacEmailRequest($sendSmtpEmail) - // body params - $_tempBody = null; - if (isset($sendSmtpEmail)) { - $_tempBody = $sendSmtpEmail; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($sendSmtpEmail)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($sendSmtpEmail)); + } else { + $httpBody = $sendSmtpEmail; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5681,10 +6969,11 @@ protected function sendTransacEmailRequest($sendSmtpEmail) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5696,14 +6985,18 @@ protected function sendTransacEmailRequest($sendSmtpEmail) * Unblock or resubscribe a transactional contact * * @param string $email contact email (urlencoded) to unblock. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['smtpBlockedContactsEmailDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function smtpBlockedContactsEmailDelete($email) + public function smtpBlockedContactsEmailDelete( + string $email, + string $contentType = self::contentTypes['smtpBlockedContactsEmailDelete'][0] + ): void { - $this->smtpBlockedContactsEmailDeleteWithHttpInfo($email); + $this->smtpBlockedContactsEmailDeleteWithHttpInfo($email, $contentType); } /** @@ -5712,15 +7005,18 @@ public function smtpBlockedContactsEmailDelete($email) * Unblock or resubscribe a transactional contact * * @param string $email contact email (urlencoded) to unblock. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['smtpBlockedContactsEmailDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function smtpBlockedContactsEmailDeleteWithHttpInfo($email) + public function smtpBlockedContactsEmailDeleteWithHttpInfo( + string $email, + string $contentType = self::contentTypes['smtpBlockedContactsEmailDelete'][0] + ): array { - $returnType = ''; - $request = $this->smtpBlockedContactsEmailDeleteRequest($email); + $request = $this->smtpBlockedContactsEmailDeleteRequest($email, $contentType); try { $options = $this->createHttpClientOption(); @@ -5729,26 +7025,21 @@ public function smtpBlockedContactsEmailDeleteWithHttpInfo($email) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -5757,7 +7048,7 @@ public function smtpBlockedContactsEmailDeleteWithHttpInfo($email) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5765,7 +7056,7 @@ public function smtpBlockedContactsEmailDeleteWithHttpInfo($email) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5781,13 +7072,17 @@ public function smtpBlockedContactsEmailDeleteWithHttpInfo($email) * Unblock or resubscribe a transactional contact * * @param string $email contact email (urlencoded) to unblock. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['smtpBlockedContactsEmailDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function smtpBlockedContactsEmailDeleteAsync($email) + public function smtpBlockedContactsEmailDeleteAsync( + string $email, + string $contentType = self::contentTypes['smtpBlockedContactsEmailDelete'][0] + ): PromiseInterface { - return $this->smtpBlockedContactsEmailDeleteAsyncWithHttpInfo($email) + return $this->smtpBlockedContactsEmailDeleteAsyncWithHttpInfo($email, $contentType) ->then( function ($response) { return $response[0]; @@ -5801,14 +7096,19 @@ function ($response) { * Unblock or resubscribe a transactional contact * * @param string $email contact email (urlencoded) to unblock. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['smtpBlockedContactsEmailDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function smtpBlockedContactsEmailDeleteAsyncWithHttpInfo($email) + public function smtpBlockedContactsEmailDeleteAsyncWithHttpInfo( + $email, + string $contentType = self::contentTypes['smtpBlockedContactsEmailDelete'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->smtpBlockedContactsEmailDeleteRequest($email); + $request = $this->smtpBlockedContactsEmailDeleteRequest($email, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5827,7 +7127,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5837,19 +7137,25 @@ function ($exception) { * Create request for operation 'smtpBlockedContactsEmailDelete' * * @param string $email contact email (urlencoded) to unblock. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['smtpBlockedContactsEmailDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function smtpBlockedContactsEmailDeleteRequest($email) + public function smtpBlockedContactsEmailDeleteRequest( + $email, + string $contentType = self::contentTypes['smtpBlockedContactsEmailDelete'][0] + ): Request { + // verify the required parameter 'email' is set if ($email === null || (is_array($email) && count($email) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $email when calling smtpBlockedContactsEmailDelete' ); } + $resourcePath = '/smtp/blockedContacts/{email}'; $formParams = []; $queryParams = []; @@ -5858,6 +7164,7 @@ protected function smtpBlockedContactsEmailDeleteRequest($email) $multipart = false; + // path params if ($email !== null) { $resourcePath = str_replace( @@ -5867,53 +7174,35 @@ protected function smtpBlockedContactsEmailDeleteRequest($email) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5939,10 +7228,11 @@ protected function smtpBlockedContactsEmailDeleteRequest($email) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5954,14 +7244,18 @@ protected function smtpBlockedContactsEmailDeleteRequest($email) * Delete an SMTP transactional log * * @param string $identifier MessageId or Email of the transactional log(s) to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['smtpLogIdentifierDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function smtpLogIdentifierDelete($identifier) + public function smtpLogIdentifierDelete( + string $identifier, + string $contentType = self::contentTypes['smtpLogIdentifierDelete'][0] + ): void { - $this->smtpLogIdentifierDeleteWithHttpInfo($identifier); + $this->smtpLogIdentifierDeleteWithHttpInfo($identifier, $contentType); } /** @@ -5970,15 +7264,18 @@ public function smtpLogIdentifierDelete($identifier) * Delete an SMTP transactional log * * @param string $identifier MessageId or Email of the transactional log(s) to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['smtpLogIdentifierDelete'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function smtpLogIdentifierDeleteWithHttpInfo($identifier) + public function smtpLogIdentifierDeleteWithHttpInfo( + string $identifier, + string $contentType = self::contentTypes['smtpLogIdentifierDelete'][0] + ): array { - $returnType = ''; - $request = $this->smtpLogIdentifierDeleteRequest($identifier); + $request = $this->smtpLogIdentifierDeleteRequest($identifier, $contentType); try { $options = $this->createHttpClientOption(); @@ -5987,43 +7284,38 @@ public function smtpLogIdentifierDeleteWithHttpInfo($identifier) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6039,13 +7331,17 @@ public function smtpLogIdentifierDeleteWithHttpInfo($identifier) * Delete an SMTP transactional log * * @param string $identifier MessageId or Email of the transactional log(s) to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['smtpLogIdentifierDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function smtpLogIdentifierDeleteAsync($identifier) + public function smtpLogIdentifierDeleteAsync( + string $identifier, + string $contentType = self::contentTypes['smtpLogIdentifierDelete'][0] + ): PromiseInterface { - return $this->smtpLogIdentifierDeleteAsyncWithHttpInfo($identifier) + return $this->smtpLogIdentifierDeleteAsyncWithHttpInfo($identifier, $contentType) ->then( function ($response) { return $response[0]; @@ -6059,14 +7355,19 @@ function ($response) { * Delete an SMTP transactional log * * @param string $identifier MessageId or Email of the transactional log(s) to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['smtpLogIdentifierDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function smtpLogIdentifierDeleteAsyncWithHttpInfo($identifier) + public function smtpLogIdentifierDeleteAsyncWithHttpInfo( + $identifier, + string $contentType = self::contentTypes['smtpLogIdentifierDelete'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->smtpLogIdentifierDeleteRequest($identifier); + $request = $this->smtpLogIdentifierDeleteRequest($identifier, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6085,7 +7386,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6095,19 +7396,25 @@ function ($exception) { * Create request for operation 'smtpLogIdentifierDelete' * * @param string $identifier MessageId or Email of the transactional log(s) to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['smtpLogIdentifierDelete'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function smtpLogIdentifierDeleteRequest($identifier) + public function smtpLogIdentifierDeleteRequest( + $identifier, + string $contentType = self::contentTypes['smtpLogIdentifierDelete'][0] + ): Request { + // verify the required parameter 'identifier' is set if ($identifier === null || (is_array($identifier) && count($identifier) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $identifier when calling smtpLogIdentifierDelete' ); } + $resourcePath = '/smtp/log/{identifier}'; $formParams = []; $queryParams = []; @@ -6116,6 +7423,7 @@ protected function smtpLogIdentifierDeleteRequest($identifier) $multipart = false; + // path params if ($identifier !== null) { $resourcePath = str_replace( @@ -6125,53 +7433,35 @@ protected function smtpLogIdentifierDeleteRequest($identifier) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6197,10 +7487,11 @@ protected function smtpLogIdentifierDeleteRequest($identifier) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6212,15 +7503,20 @@ protected function smtpLogIdentifierDeleteRequest($identifier) * Update an email template * * @param int $templateId id of the template (required) - * @param \Brevo\Client\Model\UpdateSmtpTemplate $smtpTemplate values to update in transactional email template (required) + * @param \Brevo\Client\Models\UpdateSmtpTemplate $updateSmtpTemplate values to update in transactional email template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSmtpTemplate'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function updateSmtpTemplate($templateId, $smtpTemplate) + public function updateSmtpTemplate( + int $templateId, + \Brevo\Client\Models\UpdateSmtpTemplate $updateSmtpTemplate, + string $contentType = self::contentTypes['updateSmtpTemplate'][0] + ): void { - $this->updateSmtpTemplateWithHttpInfo($templateId, $smtpTemplate); + $this->updateSmtpTemplateWithHttpInfo($templateId, $updateSmtpTemplate, $contentType); } /** @@ -6229,16 +7525,20 @@ public function updateSmtpTemplate($templateId, $smtpTemplate) * Update an email template * * @param int $templateId id of the template (required) - * @param \Brevo\Client\Model\UpdateSmtpTemplate $smtpTemplate values to update in transactional email template (required) + * @param \Brevo\Client\Models\UpdateSmtpTemplate $updateSmtpTemplate values to update in transactional email template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSmtpTemplate'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function updateSmtpTemplateWithHttpInfo($templateId, $smtpTemplate) + public function updateSmtpTemplateWithHttpInfo( + int $templateId, + \Brevo\Client\Models\UpdateSmtpTemplate $updateSmtpTemplate, + string $contentType = self::contentTypes['updateSmtpTemplate'][0] + ): array { - $returnType = ''; - $request = $this->updateSmtpTemplateRequest($templateId, $smtpTemplate); + $request = $this->updateSmtpTemplateRequest($templateId, $updateSmtpTemplate, $contentType); try { $options = $this->createHttpClientOption(); @@ -6247,26 +7547,21 @@ public function updateSmtpTemplateWithHttpInfo($templateId, $smtpTemplate) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -6275,7 +7570,7 @@ public function updateSmtpTemplateWithHttpInfo($templateId, $smtpTemplate) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6283,7 +7578,7 @@ public function updateSmtpTemplateWithHttpInfo($templateId, $smtpTemplate) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6299,14 +7594,19 @@ public function updateSmtpTemplateWithHttpInfo($templateId, $smtpTemplate) * Update an email template * * @param int $templateId id of the template (required) - * @param \Brevo\Client\Model\UpdateSmtpTemplate $smtpTemplate values to update in transactional email template (required) + * @param \Brevo\Client\Models\UpdateSmtpTemplate $updateSmtpTemplate values to update in transactional email template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSmtpTemplate'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateSmtpTemplateAsync($templateId, $smtpTemplate) + public function updateSmtpTemplateAsync( + int $templateId, + \Brevo\Client\Models\UpdateSmtpTemplate $updateSmtpTemplate, + string $contentType = self::contentTypes['updateSmtpTemplate'][0] + ): PromiseInterface { - return $this->updateSmtpTemplateAsyncWithHttpInfo($templateId, $smtpTemplate) + return $this->updateSmtpTemplateAsyncWithHttpInfo($templateId, $updateSmtpTemplate, $contentType) ->then( function ($response) { return $response[0]; @@ -6320,15 +7620,21 @@ function ($response) { * Update an email template * * @param int $templateId id of the template (required) - * @param \Brevo\Client\Model\UpdateSmtpTemplate $smtpTemplate values to update in transactional email template (required) + * @param \Brevo\Client\Models\UpdateSmtpTemplate $updateSmtpTemplate values to update in transactional email template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSmtpTemplate'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateSmtpTemplateAsyncWithHttpInfo($templateId, $smtpTemplate) + public function updateSmtpTemplateAsyncWithHttpInfo( + $templateId, + $updateSmtpTemplate, + string $contentType = self::contentTypes['updateSmtpTemplate'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->updateSmtpTemplateRequest($templateId, $smtpTemplate); + $request = $this->updateSmtpTemplateRequest($templateId, $updateSmtpTemplate, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6347,7 +7653,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6357,26 +7663,34 @@ function ($exception) { * Create request for operation 'updateSmtpTemplate' * * @param int $templateId id of the template (required) - * @param \Brevo\Client\Model\UpdateSmtpTemplate $smtpTemplate values to update in transactional email template (required) + * @param \Brevo\Client\Models\UpdateSmtpTemplate $updateSmtpTemplate values to update in transactional email template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSmtpTemplate'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updateSmtpTemplateRequest($templateId, $smtpTemplate) + public function updateSmtpTemplateRequest( + $templateId, + $updateSmtpTemplate, + string $contentType = self::contentTypes['updateSmtpTemplate'][0] + ): Request { + // verify the required parameter 'templateId' is set if ($templateId === null || (is_array($templateId) && count($templateId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $templateId when calling updateSmtpTemplate' ); } - // verify the required parameter 'smtpTemplate' is set - if ($smtpTemplate === null || (is_array($smtpTemplate) && count($smtpTemplate) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $smtpTemplate when calling updateSmtpTemplate' + + // verify the required parameter 'updateSmtpTemplate' is set + if ($updateSmtpTemplate === null || (is_array($updateSmtpTemplate) && count($updateSmtpTemplate) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $updateSmtpTemplate when calling updateSmtpTemplate' ); } + $resourcePath = '/smtp/templates/{templateId}'; $formParams = []; $queryParams = []; @@ -6385,6 +7699,7 @@ protected function updateSmtpTemplateRequest($templateId, $smtpTemplate) $multipart = false; + // path params if ($templateId !== null) { $resourcePath = str_replace( @@ -6394,56 +7709,42 @@ protected function updateSmtpTemplateRequest($templateId, $smtpTemplate) ); } - // 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'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($updateSmtpTemplate)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($updateSmtpTemplate)); + } else { + $httpBody = $updateSmtpTemplate; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6469,10 +7770,11 @@ protected function updateSmtpTemplateRequest($templateId, $smtpTemplate) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6484,7 +7786,7 @@ protected function updateSmtpTemplateRequest($templateId, $smtpTemplate) * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/TransactionalSMSApi.php b/lib/Api/TransactionalSMSApi.php index c046b63..8b2996f 100644 --- a/lib/Api/TransactionalSMSApi.php +++ b/lib/Api/TransactionalSMSApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'getTransacAggregatedSmsReport' => [ + 'application/json', + ], + 'getTransacSmsReport' => [ + 'application/json', + ], + 'sendTransacSms' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -92,23 +137,35 @@ public function getConfig() * * Get all your SMS activity (unaggregated events) * - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) - * @param string $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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report (optional) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param int|null $days Number of days in the past including today (positive integer). **Not compatible with 'startDate' and 'endDate'** (optional) + * @param string|null $phoneNumber Filter the report for a specific phone number (optional) + * @param string|null $event Filter the report for specific events (optional) + * @param string|null $tags Filter the report for specific tags passed as a serialized urlencoded array (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsEvents'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetSmsEventReport + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetSmsEventReport|\Brevo\Client\Models\ErrorModel */ - public function getSmsEvents($limit = '50', $startDate = null, $endDate = null, $offset = '0', $days = null, $phoneNumber = null, $event = null, $tags = null, $sort = 'desc') + public function getSmsEvents( + ?int $limit = 50, + ?string $startDate = null, + ?string $endDate = null, + ?int $offset = 0, + ?int $days = null, + ?string $phoneNumber = null, + ?string $event = null, + ?string $tags = null, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getSmsEvents'][0] + ): \Brevo\Client\Models\GetSmsEventReport { - list($response) = $this->getSmsEventsWithHttpInfo($limit, $startDate, $endDate, $offset, $days, $phoneNumber, $event, $tags, $sort); + list($response) = $this->getSmsEventsWithHttpInfo($limit, $startDate, $endDate, $offset, $days, $phoneNumber, $event, $tags, $sort, $contentType); return $response; } @@ -117,24 +174,35 @@ public function getSmsEvents($limit = '50', $startDate = null, $endDate = null, * * Get all your SMS activity (unaggregated events) * - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) - * @param string $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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report (optional) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param int|null $days Number of days in the past including today (positive integer). **Not compatible with 'startDate' and 'endDate'** (optional) + * @param string|null $phoneNumber Filter the report for a specific phone number (optional) + * @param string|null $event Filter the report for specific events (optional) + * @param string|null $tags Filter the report for specific tags passed as a serialized urlencoded array (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsEvents'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetSmsEventReport, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetSmsEventReport|\Brevo\Client\Models\ErrorModel, 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, $sort = 'desc') + public function getSmsEventsWithHttpInfo( + ?int $limit = 50, + ?string $startDate = null, + ?string $endDate = null, + ?int $offset = 0, + ?int $days = null, + ?string $phoneNumber = null, + ?string $event = null, + ?string $tags = null, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getSmsEvents'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetSmsEventReport'; - $request = $this->getSmsEventsRequest($limit, $startDate, $endDate, $offset, $days, $phoneNumber, $event, $tags, $sort); + $request = $this->getSmsEventsRequest($limit, $startDate, $endDate, $offset, $days, $phoneNumber, $event, $tags, $sort, $contentType); try { $options = $this->createHttpClientOption(); @@ -143,34 +211,111 @@ public function getSmsEventsWithHttpInfo($limit = '50', $startDate = null, $endD } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetSmsEventReport', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetSmsEventReport' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetSmsEventReport', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetSmsEventReport'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -185,7 +330,7 @@ public function getSmsEventsWithHttpInfo($limit = '50', $startDate = null, $endD case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetSmsEventReport', + '\Brevo\Client\Models\GetSmsEventReport', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -193,7 +338,7 @@ public function getSmsEventsWithHttpInfo($limit = '50', $startDate = null, $endD case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -208,22 +353,34 @@ public function getSmsEventsWithHttpInfo($limit = '50', $startDate = null, $endD * * Get all your SMS activity (unaggregated events) * - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) - * @param string $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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report (optional) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param int|null $days Number of days in the past including today (positive integer). **Not compatible with 'startDate' and 'endDate'** (optional) + * @param string|null $phoneNumber Filter the report for a specific phone number (optional) + * @param string|null $event Filter the report for specific events (optional) + * @param string|null $tags Filter the report for specific tags passed as a serialized urlencoded array (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsEvents'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getSmsEventsAsync($limit = '50', $startDate = null, $endDate = null, $offset = '0', $days = null, $phoneNumber = null, $event = null, $tags = null, $sort = 'desc') + public function getSmsEventsAsync( + ?int $limit = 50, + ?string $startDate = null, + ?string $endDate = null, + ?int $offset = 0, + ?int $days = null, + ?string $phoneNumber = null, + ?string $event = null, + ?string $tags = null, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getSmsEvents'][0] + ): PromiseInterface { - return $this->getSmsEventsAsyncWithHttpInfo($limit, $startDate, $endDate, $offset, $days, $phoneNumber, $event, $tags, $sort) + return $this->getSmsEventsAsyncWithHttpInfo($limit, $startDate, $endDate, $offset, $days, $phoneNumber, $event, $tags, $sort, $contentType) ->then( function ($response) { return $response[0]; @@ -236,33 +393,45 @@ function ($response) { * * Get all your SMS activity (unaggregated events) * - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) - * @param string $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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report (optional) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param int|null $days Number of days in the past including today (positive integer). **Not compatible with 'startDate' and 'endDate'** (optional) + * @param string|null $phoneNumber Filter the report for a specific phone number (optional) + * @param string|null $event Filter the report for specific events (optional) + * @param string|null $tags Filter the report for specific tags passed as a serialized urlencoded array (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsEvents'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getSmsEventsAsyncWithHttpInfo($limit = '50', $startDate = null, $endDate = null, $offset = '0', $days = null, $phoneNumber = null, $event = null, $tags = null, $sort = 'desc') + public function getSmsEventsAsyncWithHttpInfo( + $limit = 50, + $startDate = null, + $endDate = null, + $offset = 0, + $days = null, + $phoneNumber = null, + $event = null, + $tags = null, + $sort = 'desc', + string $contentType = self::contentTypes['getSmsEvents'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetSmsEventReport'; - $request = $this->getSmsEventsRequest($limit, $startDate, $endDate, $offset, $days, $phoneNumber, $event, $tags, $sort); + $returnType = '\Brevo\Client\Models\GetSmsEventReport'; + $request = $this->getSmsEventsRequest($limit, $startDate, $endDate, $offset, $days, $phoneNumber, $event, $tags, $sort, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -285,7 +454,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -294,24 +463,48 @@ function ($exception) { /** * Create request for operation 'getSmsEvents' * - * @param int $limit Number of documents per page (optional, default to 50) - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) - * @param string $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 string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report (optional) + * @param int|null $offset Index of the first document of the page (optional, default to 0) + * @param int|null $days Number of days in the past including today (positive integer). **Not compatible with 'startDate' and 'endDate'** (optional) + * @param string|null $phoneNumber Filter the report for a specific phone number (optional) + * @param string|null $event Filter the report for specific events (optional) + * @param string|null $tags Filter the report for specific tags passed as a serialized urlencoded array (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsEvents'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @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, $sort = 'desc') + public function getSmsEventsRequest( + $limit = 50, + $startDate = null, + $endDate = null, + $offset = 0, + $days = null, + $phoneNumber = null, + $event = null, + $tags = null, + $sort = 'desc', + string $contentType = self::contentTypes['getSmsEvents'][0] + ): Request { + if ($limit !== null && $limit > 100) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling TransactionalSMSApi.getSmsEvents, must be smaller than or equal to 100.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling TransactionalSMSApi.getSmsEvents, must be smaller than or equal to 100.'); } + if ($limit !== null && $limit < 0) { + throw new InvalidArgumentException('invalid value for "$limit" when calling TransactionalSMSApi.getSmsEvents, must be bigger than or equal to 0.'); + } + + + + + + + + $resourcePath = '/transactionalSMS/statistics/events'; @@ -322,90 +515,118 @@ protected function getSmsEventsRequest($limit = '50', $startDate = null, $endDat $multipart = false; // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($startDate !== null) { - $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($endDate !== null) { - $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($days !== null) { - $queryParams['days'] = ObjectSerializer::toQueryValue($days); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $days, + 'days', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($phoneNumber !== null) { - $queryParams['phoneNumber'] = ObjectSerializer::toQueryValue($phoneNumber); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $phoneNumber, + 'phoneNumber', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($event !== null) { - $queryParams['event'] = ObjectSerializer::toQueryValue($event); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $event, + 'event', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($tags !== null) { - $queryParams['tags'] = ObjectSerializer::toQueryValue($tags); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $tags, + 'tags', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -431,10 +652,11 @@ protected function getSmsEventsRequest($limit = '50', $startDate = null, $endDat $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -445,18 +667,25 @@ protected function getSmsEventsRequest($limit = '50', $startDate = null, $endDat * * Get your SMS activity aggregated over a period of time * - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) - * @param string $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) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report (optional) + * @param int|null $days Number of days in the past including today (positive integer). **Not compatible with startDate and endDate** (optional) + * @param string|null $tag Filter on a tag (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacAggregatedSmsReport'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetTransacAggregatedSmsReport + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetTransacAggregatedSmsReport|\Brevo\Client\Models\ErrorModel */ - public function getTransacAggregatedSmsReport($startDate = null, $endDate = null, $days = null, $tag = null) + public function getTransacAggregatedSmsReport( + ?string $startDate = null, + ?string $endDate = null, + ?int $days = null, + ?string $tag = null, + string $contentType = self::contentTypes['getTransacAggregatedSmsReport'][0] + ): \Brevo\Client\Models\GetTransacAggregatedSmsReport { - list($response) = $this->getTransacAggregatedSmsReportWithHttpInfo($startDate, $endDate, $days, $tag); + list($response) = $this->getTransacAggregatedSmsReportWithHttpInfo($startDate, $endDate, $days, $tag, $contentType); return $response; } @@ -465,19 +694,25 @@ public function getTransacAggregatedSmsReport($startDate = null, $endDate = null * * Get your SMS activity aggregated over a period of time * - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) - * @param string $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) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report (optional) + * @param int|null $days Number of days in the past including today (positive integer). **Not compatible with startDate and endDate** (optional) + * @param string|null $tag Filter on a tag (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacAggregatedSmsReport'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetTransacAggregatedSmsReport, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetTransacAggregatedSmsReport|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getTransacAggregatedSmsReportWithHttpInfo($startDate = null, $endDate = null, $days = null, $tag = null) + public function getTransacAggregatedSmsReportWithHttpInfo( + ?string $startDate = null, + ?string $endDate = null, + ?int $days = null, + ?string $tag = null, + string $contentType = self::contentTypes['getTransacAggregatedSmsReport'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetTransacAggregatedSmsReport'; - $request = $this->getTransacAggregatedSmsReportRequest($startDate, $endDate, $days, $tag); + $request = $this->getTransacAggregatedSmsReportRequest($startDate, $endDate, $days, $tag, $contentType); try { $options = $this->createHttpClientOption(); @@ -486,34 +721,111 @@ public function getTransacAggregatedSmsReportWithHttpInfo($startDate = null, $en } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetTransacAggregatedSmsReport', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetTransacAggregatedSmsReport' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetTransacAggregatedSmsReport', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetTransacAggregatedSmsReport'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -528,7 +840,7 @@ public function getTransacAggregatedSmsReportWithHttpInfo($startDate = null, $en case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetTransacAggregatedSmsReport', + '\Brevo\Client\Models\GetTransacAggregatedSmsReport', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -536,7 +848,7 @@ public function getTransacAggregatedSmsReportWithHttpInfo($startDate = null, $en case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -551,17 +863,24 @@ public function getTransacAggregatedSmsReportWithHttpInfo($startDate = null, $en * * Get your SMS activity aggregated over a period of time * - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) - * @param string $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) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report (optional) + * @param int|null $days Number of days in the past including today (positive integer). **Not compatible with startDate and endDate** (optional) + * @param string|null $tag Filter on a tag (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacAggregatedSmsReport'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getTransacAggregatedSmsReportAsync($startDate = null, $endDate = null, $days = null, $tag = null) + public function getTransacAggregatedSmsReportAsync( + ?string $startDate = null, + ?string $endDate = null, + ?int $days = null, + ?string $tag = null, + string $contentType = self::contentTypes['getTransacAggregatedSmsReport'][0] + ): PromiseInterface { - return $this->getTransacAggregatedSmsReportAsyncWithHttpInfo($startDate, $endDate, $days, $tag) + return $this->getTransacAggregatedSmsReportAsyncWithHttpInfo($startDate, $endDate, $days, $tag, $contentType) ->then( function ($response) { return $response[0]; @@ -574,28 +893,35 @@ function ($response) { * * Get your SMS activity aggregated over a period of time * - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) - * @param string $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) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report (optional) + * @param int|null $days Number of days in the past including today (positive integer). **Not compatible with startDate and endDate** (optional) + * @param string|null $tag Filter on a tag (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacAggregatedSmsReport'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getTransacAggregatedSmsReportAsyncWithHttpInfo($startDate = null, $endDate = null, $days = null, $tag = null) + public function getTransacAggregatedSmsReportAsyncWithHttpInfo( + $startDate = null, + $endDate = null, + $days = null, + $tag = null, + string $contentType = self::contentTypes['getTransacAggregatedSmsReport'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetTransacAggregatedSmsReport'; - $request = $this->getTransacAggregatedSmsReportRequest($startDate, $endDate, $days, $tag); + $returnType = '\Brevo\Client\Models\GetTransacAggregatedSmsReport'; + $request = $this->getTransacAggregatedSmsReportRequest($startDate, $endDate, $days, $tag, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -618,7 +944,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -627,17 +953,29 @@ function ($exception) { /** * Create request for operation 'getTransacAggregatedSmsReport' * - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) - * @param string $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) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report (optional) + * @param int|null $days Number of days in the past including today (positive integer). **Not compatible with startDate and endDate** (optional) + * @param string|null $tag Filter on a tag (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacAggregatedSmsReport'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getTransacAggregatedSmsReportRequest($startDate = null, $endDate = null, $days = null, $tag = null) + public function getTransacAggregatedSmsReportRequest( + $startDate = null, + $endDate = null, + $days = null, + $tag = null, + string $contentType = self::contentTypes['getTransacAggregatedSmsReport'][0] + ): Request { + + + + + $resourcePath = '/transactionalSMS/statistics/aggregatedReport'; $formParams = []; $queryParams = []; @@ -646,70 +984,73 @@ protected function getTransacAggregatedSmsReportRequest($startDate = null, $endD $multipart = false; // query params - if ($startDate !== null) { - $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($endDate !== null) { - $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($days !== null) { - $queryParams['days'] = ObjectSerializer::toQueryValue($days); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $days, + 'days', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($tag !== null) { - $queryParams['tag'] = ObjectSerializer::toQueryValue($tag); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $tag, + 'tag', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -735,10 +1076,11 @@ protected function getTransacAggregatedSmsReportRequest($startDate = null, $endD $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -749,19 +1091,27 @@ protected function getTransacAggregatedSmsReportRequest($startDate = null, $endD * * Get your SMS activity aggregated per day * - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report (optional) + * @param int|null $days Number of days in the past including today (positive integer). **Not compatible with 'startDate' and 'endDate'** (optional) + * @param string|null $tag Filter on a tag (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacSmsReport'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetTransacSmsReport + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetTransacSmsReport|\Brevo\Client\Models\ErrorModel */ - public function getTransacSmsReport($startDate = null, $endDate = null, $days = null, $tag = null, $sort = 'desc') + public function getTransacSmsReport( + ?string $startDate = null, + ?string $endDate = null, + ?int $days = null, + ?string $tag = null, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getTransacSmsReport'][0] + ): \Brevo\Client\Models\GetTransacSmsReport { - list($response) = $this->getTransacSmsReportWithHttpInfo($startDate, $endDate, $days, $tag, $sort); + list($response) = $this->getTransacSmsReportWithHttpInfo($startDate, $endDate, $days, $tag, $sort, $contentType); return $response; } @@ -770,20 +1120,27 @@ public function getTransacSmsReport($startDate = null, $endDate = null, $days = * * Get your SMS activity aggregated per day * - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report (optional) + * @param int|null $days Number of days in the past including today (positive integer). **Not compatible with 'startDate' and 'endDate'** (optional) + * @param string|null $tag Filter on a tag (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacSmsReport'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetTransacSmsReport, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetTransacSmsReport|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getTransacSmsReportWithHttpInfo($startDate = null, $endDate = null, $days = null, $tag = null, $sort = 'desc') + public function getTransacSmsReportWithHttpInfo( + ?string $startDate = null, + ?string $endDate = null, + ?int $days = null, + ?string $tag = null, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getTransacSmsReport'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetTransacSmsReport'; - $request = $this->getTransacSmsReportRequest($startDate, $endDate, $days, $tag, $sort); + $request = $this->getTransacSmsReportRequest($startDate, $endDate, $days, $tag, $sort, $contentType); try { $options = $this->createHttpClientOption(); @@ -792,34 +1149,111 @@ public function getTransacSmsReportWithHttpInfo($startDate = null, $endDate = nu } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetTransacSmsReport', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetTransacSmsReport' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetTransacSmsReport', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetTransacSmsReport'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -834,7 +1268,7 @@ public function getTransacSmsReportWithHttpInfo($startDate = null, $endDate = nu case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetTransacSmsReport', + '\Brevo\Client\Models\GetTransacSmsReport', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -842,7 +1276,7 @@ public function getTransacSmsReportWithHttpInfo($startDate = null, $endDate = nu case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -857,18 +1291,26 @@ public function getTransacSmsReportWithHttpInfo($startDate = null, $endDate = nu * * Get your SMS activity aggregated per day * - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report (optional) + * @param int|null $days Number of days in the past including today (positive integer). **Not compatible with 'startDate' and 'endDate'** (optional) + * @param string|null $tag Filter on a tag (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacSmsReport'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getTransacSmsReportAsync($startDate = null, $endDate = null, $days = null, $tag = null, $sort = 'desc') + public function getTransacSmsReportAsync( + ?string $startDate = null, + ?string $endDate = null, + ?int $days = null, + ?string $tag = null, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getTransacSmsReport'][0] + ): PromiseInterface { - return $this->getTransacSmsReportAsyncWithHttpInfo($startDate, $endDate, $days, $tag, $sort) + return $this->getTransacSmsReportAsyncWithHttpInfo($startDate, $endDate, $days, $tag, $sort, $contentType) ->then( function ($response) { return $response[0]; @@ -881,29 +1323,37 @@ function ($response) { * * Get your SMS activity aggregated per day * - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report (optional) + * @param int|null $days Number of days in the past including today (positive integer). **Not compatible with 'startDate' and 'endDate'** (optional) + * @param string|null $tag Filter on a tag (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacSmsReport'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getTransacSmsReportAsyncWithHttpInfo($startDate = null, $endDate = null, $days = null, $tag = null, $sort = 'desc') + public function getTransacSmsReportAsyncWithHttpInfo( + $startDate = null, + $endDate = null, + $days = null, + $tag = null, + $sort = 'desc', + string $contentType = self::contentTypes['getTransacSmsReport'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetTransacSmsReport'; - $request = $this->getTransacSmsReportRequest($startDate, $endDate, $days, $tag, $sort); + $returnType = '\Brevo\Client\Models\GetTransacSmsReport'; + $request = $this->getTransacSmsReportRequest($startDate, $endDate, $days, $tag, $sort, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -926,7 +1376,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -935,18 +1385,32 @@ function ($exception) { /** * Create request for operation 'getTransacSmsReport' * - * @param string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) - * @param string $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) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the report (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the report (optional) + * @param int|null $days Number of days in the past including today (positive integer). **Not compatible with 'startDate' and 'endDate'** (optional) + * @param string|null $tag Filter on a tag (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransacSmsReport'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getTransacSmsReportRequest($startDate = null, $endDate = null, $days = null, $tag = null, $sort = 'desc') + public function getTransacSmsReportRequest( + $startDate = null, + $endDate = null, + $days = null, + $tag = null, + $sort = 'desc', + string $contentType = self::contentTypes['getTransacSmsReport'][0] + ): Request { + + + + + + $resourcePath = '/transactionalSMS/statistics/reports'; $formParams = []; $queryParams = []; @@ -955,74 +1419,82 @@ protected function getTransacSmsReportRequest($startDate = null, $endDate = null $multipart = false; // query params - if ($startDate !== null) { - $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($endDate !== null) { - $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($days !== null) { - $queryParams['days'] = ObjectSerializer::toQueryValue($days); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $days, + 'days', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($tag !== null) { - $queryParams['tag'] = ObjectSerializer::toQueryValue($tag); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $tag, + 'tag', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1048,10 +1520,11 @@ protected function getTransacSmsReportRequest($startDate = null, $endDate = null $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1062,15 +1535,19 @@ protected function getTransacSmsReportRequest($startDate = null, $endDate = null * * Send SMS message to a mobile number * - * @param \Brevo\Client\Model\SendTransacSms $sendTransacSms Values to send a transactional SMS (required) + * @param \Brevo\Client\Models\SendTransacSms $sendTransacSms Values to send a transactional SMS (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTransacSms'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\SendSms + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\SendSms|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function sendTransacSms($sendTransacSms) + public function sendTransacSms( + \Brevo\Client\Models\SendTransacSms $sendTransacSms, + string $contentType = self::contentTypes['sendTransacSms'][0] + ): \Brevo\Client\Models\SendSms { - list($response) = $this->sendTransacSmsWithHttpInfo($sendTransacSms); + list($response) = $this->sendTransacSmsWithHttpInfo($sendTransacSms, $contentType); return $response; } @@ -1079,16 +1556,19 @@ public function sendTransacSms($sendTransacSms) * * Send SMS message to a mobile number * - * @param \Brevo\Client\Model\SendTransacSms $sendTransacSms Values to send a transactional SMS (required) + * @param \Brevo\Client\Models\SendTransacSms $sendTransacSms Values to send a transactional SMS (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTransacSms'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\SendSms, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\SendSms|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function sendTransacSmsWithHttpInfo($sendTransacSms) + public function sendTransacSmsWithHttpInfo( + \Brevo\Client\Models\SendTransacSms $sendTransacSms, + string $contentType = self::contentTypes['sendTransacSms'][0] + ): array { - $returnType = '\Brevo\Client\Model\SendSms'; - $request = $this->sendTransacSmsRequest($sendTransacSms); + $request = $this->sendTransacSmsRequest($sendTransacSms, $contentType); try { $options = $this->createHttpClientOption(); @@ -1097,34 +1577,138 @@ public function sendTransacSmsWithHttpInfo($sendTransacSms) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\SendSms', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\SendSms' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\SendSms', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\SendSms'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1139,7 +1723,7 @@ public function sendTransacSmsWithHttpInfo($sendTransacSms) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\SendSms', + '\Brevo\Client\Models\SendSms', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1147,7 +1731,7 @@ public function sendTransacSmsWithHttpInfo($sendTransacSms) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1155,7 +1739,7 @@ public function sendTransacSmsWithHttpInfo($sendTransacSms) case 402: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1170,14 +1754,18 @@ public function sendTransacSmsWithHttpInfo($sendTransacSms) * * Send SMS message to a mobile number * - * @param \Brevo\Client\Model\SendTransacSms $sendTransacSms Values to send a transactional SMS (required) + * @param \Brevo\Client\Models\SendTransacSms $sendTransacSms Values to send a transactional SMS (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTransacSms'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendTransacSmsAsync($sendTransacSms) + public function sendTransacSmsAsync( + \Brevo\Client\Models\SendTransacSms $sendTransacSms, + string $contentType = self::contentTypes['sendTransacSms'][0] + ): PromiseInterface { - return $this->sendTransacSmsAsyncWithHttpInfo($sendTransacSms) + return $this->sendTransacSmsAsyncWithHttpInfo($sendTransacSms, $contentType) ->then( function ($response) { return $response[0]; @@ -1190,25 +1778,29 @@ function ($response) { * * Send SMS message to a mobile number * - * @param \Brevo\Client\Model\SendTransacSms $sendTransacSms Values to send a transactional SMS (required) + * @param \Brevo\Client\Models\SendTransacSms $sendTransacSms Values to send a transactional SMS (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTransacSms'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendTransacSmsAsyncWithHttpInfo($sendTransacSms) + public function sendTransacSmsAsyncWithHttpInfo( + $sendTransacSms, + string $contentType = self::contentTypes['sendTransacSms'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\SendSms'; - $request = $this->sendTransacSmsRequest($sendTransacSms); + $returnType = '\Brevo\Client\Models\SendSms'; + $request = $this->sendTransacSmsRequest($sendTransacSms, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1231,7 +1823,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1240,20 +1832,26 @@ function ($exception) { /** * Create request for operation 'sendTransacSms' * - * @param \Brevo\Client\Model\SendTransacSms $sendTransacSms Values to send a transactional SMS (required) + * @param \Brevo\Client\Models\SendTransacSms $sendTransacSms Values to send a transactional SMS (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTransacSms'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function sendTransacSmsRequest($sendTransacSms) + public function sendTransacSmsRequest( + $sendTransacSms, + string $contentType = self::contentTypes['sendTransacSms'][0] + ): Request { + // verify the required parameter 'sendTransacSms' is set if ($sendTransacSms === null || (is_array($sendTransacSms) && count($sendTransacSms) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $sendTransacSms when calling sendTransacSms' ); } + $resourcePath = '/transactionalSMS/sms'; $formParams = []; $queryParams = []; @@ -1263,56 +1861,43 @@ protected function sendTransacSmsRequest($sendTransacSms) - // body params - $_tempBody = null; - if (isset($sendTransacSms)) { - $_tempBody = $sendTransacSms; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($sendTransacSms)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($sendTransacSms)); + } else { + $httpBody = $sendTransacSms; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1338,10 +1923,11 @@ protected function sendTransacSmsRequest($sendTransacSms) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1353,7 +1939,7 @@ protected function sendTransacSmsRequest($sendTransacSms) * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/TransactionalWhatsAppApi.php b/lib/Api/TransactionalWhatsAppApi.php index 3bec4c2..524e389 100644 --- a/lib/Api/TransactionalWhatsAppApi.php +++ b/lib/Api/TransactionalWhatsAppApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'sendWhatsappMessage' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -92,22 +131,33 @@ public function getConfig() * * Get all your WhatsApp activity (unaggregated events) * - * @param int $limit Number limitation for the result returned (optional, default to 2500) - * @param int $offset Beginning point in the list to retrieve from (optional, default to 0) - * @param string $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) - * @param string $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 $contactNumber Filter results for specific contact (WhatsApp Number with country code. Example, 85264318721) (optional) - * @param string $event Filter the report for a specific event type (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number limitation for the result returned (optional, default to 2500) + * @param int|null $offset Beginning point in the list to retrieve from (optional, default to 0) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ (optional) + * @param string|null $contactNumber Filter results for specific contact (WhatsApp Number with country code. Example, 85264318721) (optional) + * @param string|null $event Filter the report for a specific event type (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsappEventReport'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetWhatsappEventReport + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetWhatsappEventReport|\Brevo\Client\Models\ErrorModel */ - public function getWhatsappEventReport($limit = '2500', $offset = '0', $startDate = null, $endDate = null, $days = null, $contactNumber = null, $event = null, $sort = 'desc') + public function getWhatsappEventReport( + ?int $limit = 2500, + ?int $offset = 0, + ?string $startDate = null, + ?string $endDate = null, + ?int $days = null, + ?string $contactNumber = null, + ?string $event = null, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getWhatsappEventReport'][0] + ): \Brevo\Client\Models\GetWhatsappEventReport { - list($response) = $this->getWhatsappEventReportWithHttpInfo($limit, $offset, $startDate, $endDate, $days, $contactNumber, $event, $sort); + list($response) = $this->getWhatsappEventReportWithHttpInfo($limit, $offset, $startDate, $endDate, $days, $contactNumber, $event, $sort, $contentType); return $response; } @@ -116,23 +166,33 @@ public function getWhatsappEventReport($limit = '2500', $offset = '0', $startDat * * Get all your WhatsApp activity (unaggregated events) * - * @param int $limit Number limitation for the result returned (optional, default to 2500) - * @param int $offset Beginning point in the list to retrieve from (optional, default to 0) - * @param string $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) - * @param string $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 $contactNumber Filter results for specific contact (WhatsApp Number with country code. Example, 85264318721) (optional) - * @param string $event Filter the report for a specific event type (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number limitation for the result returned (optional, default to 2500) + * @param int|null $offset Beginning point in the list to retrieve from (optional, default to 0) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ (optional) + * @param string|null $contactNumber Filter results for specific contact (WhatsApp Number with country code. Example, 85264318721) (optional) + * @param string|null $event Filter the report for a specific event type (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsappEventReport'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetWhatsappEventReport, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetWhatsappEventReport|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getWhatsappEventReportWithHttpInfo($limit = '2500', $offset = '0', $startDate = null, $endDate = null, $days = null, $contactNumber = null, $event = null, $sort = 'desc') + public function getWhatsappEventReportWithHttpInfo( + ?int $limit = 2500, + ?int $offset = 0, + ?string $startDate = null, + ?string $endDate = null, + ?int $days = null, + ?string $contactNumber = null, + ?string $event = null, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getWhatsappEventReport'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetWhatsappEventReport'; - $request = $this->getWhatsappEventReportRequest($limit, $offset, $startDate, $endDate, $days, $contactNumber, $event, $sort); + $request = $this->getWhatsappEventReportRequest($limit, $offset, $startDate, $endDate, $days, $contactNumber, $event, $sort, $contentType); try { $options = $this->createHttpClientOption(); @@ -141,34 +201,111 @@ public function getWhatsappEventReportWithHttpInfo($limit = '2500', $offset = '0 } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetWhatsappEventReport', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetWhatsappEventReport' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetWhatsappEventReport', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetWhatsappEventReport'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -183,7 +320,7 @@ public function getWhatsappEventReportWithHttpInfo($limit = '2500', $offset = '0 case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetWhatsappEventReport', + '\Brevo\Client\Models\GetWhatsappEventReport', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -191,7 +328,7 @@ public function getWhatsappEventReportWithHttpInfo($limit = '2500', $offset = '0 case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -206,21 +343,32 @@ public function getWhatsappEventReportWithHttpInfo($limit = '2500', $offset = '0 * * Get all your WhatsApp activity (unaggregated events) * - * @param int $limit Number limitation for the result returned (optional, default to 2500) - * @param int $offset Beginning point in the list to retrieve from (optional, default to 0) - * @param string $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) - * @param string $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 $contactNumber Filter results for specific contact (WhatsApp Number with country code. Example, 85264318721) (optional) - * @param string $event Filter the report for a specific event type (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number limitation for the result returned (optional, default to 2500) + * @param int|null $offset Beginning point in the list to retrieve from (optional, default to 0) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ (optional) + * @param string|null $contactNumber Filter results for specific contact (WhatsApp Number with country code. Example, 85264318721) (optional) + * @param string|null $event Filter the report for a specific event type (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsappEventReport'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getWhatsappEventReportAsync($limit = '2500', $offset = '0', $startDate = null, $endDate = null, $days = null, $contactNumber = null, $event = null, $sort = 'desc') + public function getWhatsappEventReportAsync( + ?int $limit = 2500, + ?int $offset = 0, + ?string $startDate = null, + ?string $endDate = null, + ?int $days = null, + ?string $contactNumber = null, + ?string $event = null, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getWhatsappEventReport'][0] + ): PromiseInterface { - return $this->getWhatsappEventReportAsyncWithHttpInfo($limit, $offset, $startDate, $endDate, $days, $contactNumber, $event, $sort) + return $this->getWhatsappEventReportAsyncWithHttpInfo($limit, $offset, $startDate, $endDate, $days, $contactNumber, $event, $sort, $contentType) ->then( function ($response) { return $response[0]; @@ -233,32 +381,43 @@ function ($response) { * * Get all your WhatsApp activity (unaggregated events) * - * @param int $limit Number limitation for the result returned (optional, default to 2500) - * @param int $offset Beginning point in the list to retrieve from (optional, default to 0) - * @param string $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) - * @param string $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 $contactNumber Filter results for specific contact (WhatsApp Number with country code. Example, 85264318721) (optional) - * @param string $event Filter the report for a specific event type (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number limitation for the result returned (optional, default to 2500) + * @param int|null $offset Beginning point in the list to retrieve from (optional, default to 0) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ (optional) + * @param string|null $contactNumber Filter results for specific contact (WhatsApp Number with country code. Example, 85264318721) (optional) + * @param string|null $event Filter the report for a specific event type (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsappEventReport'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getWhatsappEventReportAsyncWithHttpInfo($limit = '2500', $offset = '0', $startDate = null, $endDate = null, $days = null, $contactNumber = null, $event = null, $sort = 'desc') + public function getWhatsappEventReportAsyncWithHttpInfo( + $limit = 2500, + $offset = 0, + $startDate = null, + $endDate = null, + $days = null, + $contactNumber = null, + $event = null, + $sort = 'desc', + string $contentType = self::contentTypes['getWhatsappEventReport'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetWhatsappEventReport'; - $request = $this->getWhatsappEventReportRequest($limit, $offset, $startDate, $endDate, $days, $contactNumber, $event, $sort); + $returnType = '\Brevo\Client\Models\GetWhatsappEventReport'; + $request = $this->getWhatsappEventReportRequest($limit, $offset, $startDate, $endDate, $days, $contactNumber, $event, $sort, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -281,7 +440,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -290,26 +449,45 @@ function ($exception) { /** * Create request for operation 'getWhatsappEventReport' * - * @param int $limit Number limitation for the result returned (optional, default to 2500) - * @param int $offset Beginning point in the list to retrieve from (optional, default to 0) - * @param string $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) - * @param string $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 $contactNumber Filter results for specific contact (WhatsApp Number with country code. Example, 85264318721) (optional) - * @param string $event Filter the report for a specific event type (optional) - * @param string $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param int|null $limit Number limitation for the result returned (optional, default to 2500) + * @param int|null $offset Beginning point in the list to retrieve from (optional, default to 0) + * @param string|null $startDate **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param string|null $endDate **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ (optional) + * @param string|null $contactNumber Filter results for specific contact (WhatsApp Number with country code. Example, 85264318721) (optional) + * @param string|null $event Filter the report for a specific event type (optional) + * @param string|null $sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsappEventReport'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getWhatsappEventReportRequest($limit = '2500', $offset = '0', $startDate = null, $endDate = null, $days = null, $contactNumber = null, $event = null, $sort = 'desc') + public function getWhatsappEventReportRequest( + $limit = 2500, + $offset = 0, + $startDate = null, + $endDate = null, + $days = null, + $contactNumber = null, + $event = null, + $sort = 'desc', + string $contentType = self::contentTypes['getWhatsappEventReport'][0] + ): Request { + if ($limit !== null && $limit > 5000) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling TransactionalWhatsAppApi.getWhatsappEventReport, must be smaller than or equal to 5000.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling TransactionalWhatsAppApi.getWhatsappEventReport, must be smaller than or equal to 5000.'); } if ($limit !== null && $limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling TransactionalWhatsAppApi.getWhatsappEventReport, must be bigger than or equal to 0.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling TransactionalWhatsAppApi.getWhatsappEventReport, must be bigger than or equal to 0.'); } + + + + + + + $resourcePath = '/whatsapp/statistics/events'; @@ -320,86 +498,109 @@ protected function getWhatsappEventReportRequest($limit = '2500', $offset = '0', $multipart = false; // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($startDate !== null) { - $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($endDate !== null) { - $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($days !== null) { - $queryParams['days'] = ObjectSerializer::toQueryValue($days); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $days, + 'days', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($contactNumber !== null) { - $queryParams['contactNumber'] = ObjectSerializer::toQueryValue($contactNumber); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $contactNumber, + 'contactNumber', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($event !== null) { - $queryParams['event'] = ObjectSerializer::toQueryValue($event); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $event, + 'event', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -425,10 +626,11 @@ protected function getWhatsappEventReportRequest($limit = '2500', $offset = '0', $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -439,15 +641,19 @@ protected function getWhatsappEventReportRequest($limit = '2500', $offset = '0', * * Send a WhatsApp message * - * @param \Brevo\Client\Model\SendWhatsappMessage $sendWhatsappMessage Values to send WhatsApp message (required) + * @param \Brevo\Client\Models\SendWhatsappMessageRequest $sendWhatsappMessageRequest Values to send WhatsApp message (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendWhatsappMessage'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\InlineResponse2014 + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\SendWhatsappMessage201Response|\Brevo\Client\Models\ErrorModel */ - public function sendWhatsappMessage($sendWhatsappMessage) + public function sendWhatsappMessage( + \Brevo\Client\Models\SendWhatsappMessageRequest $sendWhatsappMessageRequest, + string $contentType = self::contentTypes['sendWhatsappMessage'][0] + ): \Brevo\Client\Models\SendWhatsappMessage201Response { - list($response) = $this->sendWhatsappMessageWithHttpInfo($sendWhatsappMessage); + list($response) = $this->sendWhatsappMessageWithHttpInfo($sendWhatsappMessageRequest, $contentType); return $response; } @@ -456,16 +662,19 @@ public function sendWhatsappMessage($sendWhatsappMessage) * * Send a WhatsApp message * - * @param \Brevo\Client\Model\SendWhatsappMessage $sendWhatsappMessage Values to send WhatsApp message (required) + * @param \Brevo\Client\Models\SendWhatsappMessageRequest $sendWhatsappMessageRequest Values to send WhatsApp message (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendWhatsappMessage'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\InlineResponse2014, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\SendWhatsappMessage201Response|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function sendWhatsappMessageWithHttpInfo($sendWhatsappMessage) + public function sendWhatsappMessageWithHttpInfo( + \Brevo\Client\Models\SendWhatsappMessageRequest $sendWhatsappMessageRequest, + string $contentType = self::contentTypes['sendWhatsappMessage'][0] + ): array { - $returnType = '\Brevo\Client\Model\InlineResponse2014'; - $request = $this->sendWhatsappMessageRequest($sendWhatsappMessage); + $request = $this->sendWhatsappMessageRequest($sendWhatsappMessageRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -474,34 +683,111 @@ public function sendWhatsappMessageWithHttpInfo($sendWhatsappMessage) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\SendWhatsappMessage201Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\SendWhatsappMessage201Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\SendWhatsappMessage201Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\SendWhatsappMessage201Response'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -516,7 +802,7 @@ public function sendWhatsappMessageWithHttpInfo($sendWhatsappMessage) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\InlineResponse2014', + '\Brevo\Client\Models\SendWhatsappMessage201Response', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -524,7 +810,7 @@ public function sendWhatsappMessageWithHttpInfo($sendWhatsappMessage) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -539,14 +825,18 @@ public function sendWhatsappMessageWithHttpInfo($sendWhatsappMessage) * * Send a WhatsApp message * - * @param \Brevo\Client\Model\SendWhatsappMessage $sendWhatsappMessage Values to send WhatsApp message (required) + * @param \Brevo\Client\Models\SendWhatsappMessageRequest $sendWhatsappMessageRequest Values to send WhatsApp message (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendWhatsappMessage'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendWhatsappMessageAsync($sendWhatsappMessage) + public function sendWhatsappMessageAsync( + \Brevo\Client\Models\SendWhatsappMessageRequest $sendWhatsappMessageRequest, + string $contentType = self::contentTypes['sendWhatsappMessage'][0] + ): PromiseInterface { - return $this->sendWhatsappMessageAsyncWithHttpInfo($sendWhatsappMessage) + return $this->sendWhatsappMessageAsyncWithHttpInfo($sendWhatsappMessageRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -559,25 +849,29 @@ function ($response) { * * Send a WhatsApp message * - * @param \Brevo\Client\Model\SendWhatsappMessage $sendWhatsappMessage Values to send WhatsApp message (required) + * @param \Brevo\Client\Models\SendWhatsappMessageRequest $sendWhatsappMessageRequest Values to send WhatsApp message (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendWhatsappMessage'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendWhatsappMessageAsyncWithHttpInfo($sendWhatsappMessage) + public function sendWhatsappMessageAsyncWithHttpInfo( + $sendWhatsappMessageRequest, + string $contentType = self::contentTypes['sendWhatsappMessage'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\InlineResponse2014'; - $request = $this->sendWhatsappMessageRequest($sendWhatsappMessage); + $returnType = '\Brevo\Client\Models\SendWhatsappMessage201Response'; + $request = $this->sendWhatsappMessageRequest($sendWhatsappMessageRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -600,7 +894,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -609,20 +903,26 @@ function ($exception) { /** * Create request for operation 'sendWhatsappMessage' * - * @param \Brevo\Client\Model\SendWhatsappMessage $sendWhatsappMessage Values to send WhatsApp message (required) + * @param \Brevo\Client\Models\SendWhatsappMessageRequest $sendWhatsappMessageRequest Values to send WhatsApp message (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendWhatsappMessage'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function sendWhatsappMessageRequest($sendWhatsappMessage) + public function sendWhatsappMessageRequest( + $sendWhatsappMessageRequest, + string $contentType = self::contentTypes['sendWhatsappMessage'][0] + ): Request { - // verify the required parameter 'sendWhatsappMessage' is set - if ($sendWhatsappMessage === null || (is_array($sendWhatsappMessage) && count($sendWhatsappMessage) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $sendWhatsappMessage when calling sendWhatsappMessage' + + // verify the required parameter 'sendWhatsappMessageRequest' is set + if ($sendWhatsappMessageRequest === null || (is_array($sendWhatsappMessageRequest) && count($sendWhatsappMessageRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $sendWhatsappMessageRequest when calling sendWhatsappMessage' ); } + $resourcePath = '/whatsapp/sendMessage'; $formParams = []; $queryParams = []; @@ -632,56 +932,43 @@ protected function sendWhatsappMessageRequest($sendWhatsappMessage) - // body params - $_tempBody = null; - if (isset($sendWhatsappMessage)) { - $_tempBody = $sendWhatsappMessage; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($sendWhatsappMessageRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($sendWhatsappMessageRequest)); + } else { + $httpBody = $sendWhatsappMessageRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -707,10 +994,11 @@ protected function sendWhatsappMessageRequest($sendWhatsappMessage) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -722,7 +1010,7 @@ protected function sendWhatsappMessageRequest($sendWhatsappMessage) * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/UserApi.php b/lib/Api/UserApi.php index 34298d7..31816b3 100644 --- a/lib/Api/UserApi.php +++ b/lib/Api/UserApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'getInvitedUsersList' => [ + 'application/json', + ], + 'getUserPermission' => [ + 'application/json', + ], + 'inviteuser' => [ + 'application/json', + ], + 'putRevokeUserPermission' => [ + 'application/json', + ], + 'putresendcancelinvitation' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -92,15 +143,19 @@ public function getConfig() * * Update permission for a user * - * @param \Brevo\Client\Model\Inviteuser $updatePermissions Values to update permissions for an invited user (required) + * @param \Brevo\Client\Models\Inviteuser $inviteuser Values to create an invitation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editUserPermission'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\Inviteuser + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\UpdateUserResponse|\Brevo\Client\Models\ErrorModel */ - public function editUserPermission($updatePermissions) + public function editUserPermission( + \Brevo\Client\Models\Inviteuser $inviteuser, + string $contentType = self::contentTypes['editUserPermission'][0] + ): \Brevo\Client\Models\UpdateUserResponse { - list($response) = $this->editUserPermissionWithHttpInfo($updatePermissions); + list($response) = $this->editUserPermissionWithHttpInfo($inviteuser, $contentType); return $response; } @@ -109,16 +164,19 @@ public function editUserPermission($updatePermissions) * * Update permission for a user * - * @param \Brevo\Client\Model\Inviteuser $updatePermissions Values to update permissions for an invited user (required) + * @param \Brevo\Client\Models\Inviteuser $inviteuser Values to create an invitation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editUserPermission'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\Inviteuser, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\UpdateUserResponse|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function editUserPermissionWithHttpInfo($updatePermissions) + public function editUserPermissionWithHttpInfo( + \Brevo\Client\Models\Inviteuser $inviteuser, + string $contentType = self::contentTypes['editUserPermission'][0] + ): array { - $returnType = '\Brevo\Client\Model\Inviteuser'; - $request = $this->editUserPermissionRequest($updatePermissions); + $request = $this->editUserPermissionRequest($inviteuser, $contentType); try { $options = $this->createHttpClientOption(); @@ -127,34 +185,111 @@ public function editUserPermissionWithHttpInfo($updatePermissions) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\UpdateUserResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\UpdateUserResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\UpdateUserResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\UpdateUserResponse'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -169,15 +304,15 @@ public function editUserPermissionWithHttpInfo($updatePermissions) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\Inviteuser', + '\Brevo\Client\Models\UpdateUserResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 403: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -192,14 +327,18 @@ public function editUserPermissionWithHttpInfo($updatePermissions) * * Update permission for a user * - * @param \Brevo\Client\Model\Inviteuser $updatePermissions Values to update permissions for an invited user (required) + * @param \Brevo\Client\Models\Inviteuser $inviteuser Values to create an invitation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editUserPermission'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function editUserPermissionAsync($updatePermissions) + public function editUserPermissionAsync( + \Brevo\Client\Models\Inviteuser $inviteuser, + string $contentType = self::contentTypes['editUserPermission'][0] + ): PromiseInterface { - return $this->editUserPermissionAsyncWithHttpInfo($updatePermissions) + return $this->editUserPermissionAsyncWithHttpInfo($inviteuser, $contentType) ->then( function ($response) { return $response[0]; @@ -212,25 +351,29 @@ function ($response) { * * Update permission for a user * - * @param \Brevo\Client\Model\Inviteuser $updatePermissions Values to update permissions for an invited user (required) + * @param \Brevo\Client\Models\Inviteuser $inviteuser Values to create an invitation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editUserPermission'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function editUserPermissionAsyncWithHttpInfo($updatePermissions) + public function editUserPermissionAsyncWithHttpInfo( + $inviteuser, + string $contentType = self::contentTypes['editUserPermission'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\Inviteuser'; - $request = $this->editUserPermissionRequest($updatePermissions); + $returnType = '\Brevo\Client\Models\UpdateUserResponse'; + $request = $this->editUserPermissionRequest($inviteuser, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -253,7 +396,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -262,20 +405,26 @@ function ($exception) { /** * Create request for operation 'editUserPermission' * - * @param \Brevo\Client\Model\Inviteuser $updatePermissions Values to update permissions for an invited user (required) + * @param \Brevo\Client\Models\Inviteuser $inviteuser Values to create an invitation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editUserPermission'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function editUserPermissionRequest($updatePermissions) + public function editUserPermissionRequest( + $inviteuser, + string $contentType = self::contentTypes['editUserPermission'][0] + ): Request { - // verify the required parameter 'updatePermissions' is set - if ($updatePermissions === null || (is_array($updatePermissions) && count($updatePermissions) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $updatePermissions when calling editUserPermission' + + // verify the required parameter 'inviteuser' is set + if ($inviteuser === null || (is_array($inviteuser) && count($inviteuser) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $inviteuser when calling editUserPermission' ); } + $resourcePath = '/organization/user/update/permissions'; $formParams = []; $queryParams = []; @@ -285,56 +434,43 @@ protected function editUserPermissionRequest($updatePermissions) - // body params - $_tempBody = null; - if (isset($updatePermissions)) { - $_tempBody = $updatePermissions; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($inviteuser)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($inviteuser)); + } else { + $httpBody = $inviteuser; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -360,10 +496,11 @@ protected function editUserPermissionRequest($updatePermissions) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -374,14 +511,17 @@ protected function editUserPermissionRequest($updatePermissions) * * Get the list of all your users * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInvitedUsersList'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetInvitedUsersList + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetInvitedUsersList|\Brevo\Client\Models\ErrorModel */ - public function getInvitedUsersList() + public function getInvitedUsersList( + string $contentType = self::contentTypes['getInvitedUsersList'][0] + ): \Brevo\Client\Models\GetInvitedUsersList { - list($response) = $this->getInvitedUsersListWithHttpInfo(); + list($response) = $this->getInvitedUsersListWithHttpInfo($contentType); return $response; } @@ -390,15 +530,17 @@ public function getInvitedUsersList() * * Get the list of all your users * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInvitedUsersList'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetInvitedUsersList, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetInvitedUsersList|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getInvitedUsersListWithHttpInfo() + public function getInvitedUsersListWithHttpInfo( + string $contentType = self::contentTypes['getInvitedUsersList'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetInvitedUsersList'; - $request = $this->getInvitedUsersListRequest(); + $request = $this->getInvitedUsersListRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -407,34 +549,111 @@ public function getInvitedUsersListWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetInvitedUsersList', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetInvitedUsersList' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetInvitedUsersList', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetInvitedUsersList'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -449,7 +668,7 @@ public function getInvitedUsersListWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetInvitedUsersList', + '\Brevo\Client\Models\GetInvitedUsersList', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -457,7 +676,7 @@ public function getInvitedUsersListWithHttpInfo() case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -472,13 +691,16 @@ public function getInvitedUsersListWithHttpInfo() * * Get the list of all your users * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInvitedUsersList'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getInvitedUsersListAsync() + public function getInvitedUsersListAsync( + string $contentType = self::contentTypes['getInvitedUsersList'][0] + ): PromiseInterface { - return $this->getInvitedUsersListAsyncWithHttpInfo() + return $this->getInvitedUsersListAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -491,24 +713,27 @@ function ($response) { * * Get the list of all your users * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInvitedUsersList'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getInvitedUsersListAsyncWithHttpInfo() + public function getInvitedUsersListAsyncWithHttpInfo( + string $contentType = self::contentTypes['getInvitedUsersList'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetInvitedUsersList'; - $request = $this->getInvitedUsersListRequest(); + $returnType = '\Brevo\Client\Models\GetInvitedUsersList'; + $request = $this->getInvitedUsersListRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -531,7 +756,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -540,13 +765,17 @@ function ($exception) { /** * Create request for operation 'getInvitedUsersList' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInvitedUsersList'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getInvitedUsersListRequest() + public function getInvitedUsersListRequest( + string $contentType = self::contentTypes['getInvitedUsersList'][0] + ): Request { + $resourcePath = '/organization/invited/users'; $formParams = []; $queryParams = []; @@ -556,53 +785,36 @@ protected function getInvitedUsersListRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -628,10 +840,11 @@ protected function getInvitedUsersListRequest() $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -643,14 +856,18 @@ protected function getInvitedUsersListRequest() * Check user permission * * @param string $email Email of the invited user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserPermission'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetUserPermission + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetUserPermission|\Brevo\Client\Models\ErrorModel */ - public function getUserPermission($email) + public function getUserPermission( + string $email, + string $contentType = self::contentTypes['getUserPermission'][0] + ): \Brevo\Client\Models\GetUserPermission { - list($response) = $this->getUserPermissionWithHttpInfo($email); + list($response) = $this->getUserPermissionWithHttpInfo($email, $contentType); return $response; } @@ -660,15 +877,18 @@ public function getUserPermission($email) * Check user permission * * @param string $email Email of the invited user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserPermission'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetUserPermission, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetUserPermission|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getUserPermissionWithHttpInfo($email) + public function getUserPermissionWithHttpInfo( + string $email, + string $contentType = self::contentTypes['getUserPermission'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetUserPermission'; - $request = $this->getUserPermissionRequest($email); + $request = $this->getUserPermissionRequest($email, $contentType); try { $options = $this->createHttpClientOption(); @@ -677,34 +897,111 @@ public function getUserPermissionWithHttpInfo($email) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetUserPermission', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetUserPermission' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetUserPermission', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetUserPermission'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -719,7 +1016,7 @@ public function getUserPermissionWithHttpInfo($email) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetUserPermission', + '\Brevo\Client\Models\GetUserPermission', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -727,7 +1024,7 @@ public function getUserPermissionWithHttpInfo($email) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -743,13 +1040,17 @@ public function getUserPermissionWithHttpInfo($email) * Check user permission * * @param string $email Email of the invited user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserPermission'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getUserPermissionAsync($email) + public function getUserPermissionAsync( + string $email, + string $contentType = self::contentTypes['getUserPermission'][0] + ): PromiseInterface { - return $this->getUserPermissionAsyncWithHttpInfo($email) + return $this->getUserPermissionAsyncWithHttpInfo($email, $contentType) ->then( function ($response) { return $response[0]; @@ -763,24 +1064,28 @@ function ($response) { * Check user permission * * @param string $email Email of the invited user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserPermission'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getUserPermissionAsyncWithHttpInfo($email) + public function getUserPermissionAsyncWithHttpInfo( + $email, + string $contentType = self::contentTypes['getUserPermission'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetUserPermission'; - $request = $this->getUserPermissionRequest($email); + $returnType = '\Brevo\Client\Models\GetUserPermission'; + $request = $this->getUserPermissionRequest($email, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -803,7 +1108,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -813,19 +1118,25 @@ function ($exception) { * Create request for operation 'getUserPermission' * * @param string $email Email of the invited user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserPermission'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getUserPermissionRequest($email) + public function getUserPermissionRequest( + $email, + string $contentType = self::contentTypes['getUserPermission'][0] + ): Request { + // verify the required parameter 'email' is set if ($email === null || (is_array($email) && count($email) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $email when calling getUserPermission' ); } + $resourcePath = '/organization/user/{email}/permissions'; $formParams = []; $queryParams = []; @@ -834,6 +1145,7 @@ protected function getUserPermissionRequest($email) $multipart = false; + // path params if ($email !== null) { $resourcePath = str_replace( @@ -843,53 +1155,35 @@ protected function getUserPermissionRequest($email) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -915,10 +1209,11 @@ protected function getUserPermissionRequest($email) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -929,15 +1224,19 @@ protected function getUserPermissionRequest($email) * * Send invitation to user * - * @param \Brevo\Client\Model\Inviteuser $sendInvitation Values to create an invitation (required) + * @param \Brevo\Client\Models\Inviteuser $inviteuser Values to create an invitation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['inviteuser'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\Inviteuser + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\InviteuserResponse|\Brevo\Client\Models\ErrorModel */ - public function inviteuser($sendInvitation) + public function inviteuser( + \Brevo\Client\Models\Inviteuser $inviteuser, + string $contentType = self::contentTypes['inviteuser'][0] + ): \Brevo\Client\Models\InviteuserResponse { - list($response) = $this->inviteuserWithHttpInfo($sendInvitation); + list($response) = $this->inviteuserWithHttpInfo($inviteuser, $contentType); return $response; } @@ -946,16 +1245,19 @@ public function inviteuser($sendInvitation) * * Send invitation to user * - * @param \Brevo\Client\Model\Inviteuser $sendInvitation Values to create an invitation (required) + * @param \Brevo\Client\Models\Inviteuser $inviteuser Values to create an invitation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['inviteuser'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\Inviteuser, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\InviteuserResponse|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function inviteuserWithHttpInfo($sendInvitation) + public function inviteuserWithHttpInfo( + \Brevo\Client\Models\Inviteuser $inviteuser, + string $contentType = self::contentTypes['inviteuser'][0] + ): array { - $returnType = '\Brevo\Client\Model\Inviteuser'; - $request = $this->inviteuserRequest($sendInvitation); + $request = $this->inviteuserRequest($inviteuser, $contentType); try { $options = $this->createHttpClientOption(); @@ -964,34 +1266,111 @@ public function inviteuserWithHttpInfo($sendInvitation) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\InviteuserResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\InviteuserResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\InviteuserResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\InviteuserResponse'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1006,7 +1385,7 @@ public function inviteuserWithHttpInfo($sendInvitation) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\Inviteuser', + '\Brevo\Client\Models\InviteuserResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1014,7 +1393,7 @@ public function inviteuserWithHttpInfo($sendInvitation) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1029,14 +1408,18 @@ public function inviteuserWithHttpInfo($sendInvitation) * * Send invitation to user * - * @param \Brevo\Client\Model\Inviteuser $sendInvitation Values to create an invitation (required) + * @param \Brevo\Client\Models\Inviteuser $inviteuser Values to create an invitation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['inviteuser'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function inviteuserAsync($sendInvitation) + public function inviteuserAsync( + \Brevo\Client\Models\Inviteuser $inviteuser, + string $contentType = self::contentTypes['inviteuser'][0] + ): PromiseInterface { - return $this->inviteuserAsyncWithHttpInfo($sendInvitation) + return $this->inviteuserAsyncWithHttpInfo($inviteuser, $contentType) ->then( function ($response) { return $response[0]; @@ -1049,25 +1432,29 @@ function ($response) { * * Send invitation to user * - * @param \Brevo\Client\Model\Inviteuser $sendInvitation Values to create an invitation (required) + * @param \Brevo\Client\Models\Inviteuser $inviteuser Values to create an invitation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['inviteuser'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function inviteuserAsyncWithHttpInfo($sendInvitation) + public function inviteuserAsyncWithHttpInfo( + $inviteuser, + string $contentType = self::contentTypes['inviteuser'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\Inviteuser'; - $request = $this->inviteuserRequest($sendInvitation); + $returnType = '\Brevo\Client\Models\InviteuserResponse'; + $request = $this->inviteuserRequest($inviteuser, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1090,7 +1477,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1099,20 +1486,26 @@ function ($exception) { /** * Create request for operation 'inviteuser' * - * @param \Brevo\Client\Model\Inviteuser $sendInvitation Values to create an invitation (required) + * @param \Brevo\Client\Models\Inviteuser $inviteuser Values to create an invitation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['inviteuser'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function inviteuserRequest($sendInvitation) + public function inviteuserRequest( + $inviteuser, + string $contentType = self::contentTypes['inviteuser'][0] + ): Request { - // verify the required parameter 'sendInvitation' is set - if ($sendInvitation === null || (is_array($sendInvitation) && count($sendInvitation) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $sendInvitation when calling inviteuser' + + // verify the required parameter 'inviteuser' is set + if ($inviteuser === null || (is_array($inviteuser) && count($inviteuser) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $inviteuser when calling inviteuser' ); } + $resourcePath = '/organization/user/invitation/send'; $formParams = []; $queryParams = []; @@ -1122,56 +1515,43 @@ protected function inviteuserRequest($sendInvitation) - // body params - $_tempBody = null; - if (isset($sendInvitation)) { - $_tempBody = $sendInvitation; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($inviteuser)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($inviteuser)); + } else { + $httpBody = $inviteuser; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1197,10 +1577,11 @@ protected function inviteuserRequest($sendInvitation) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1212,14 +1593,18 @@ protected function inviteuserRequest($sendInvitation) * Revoke user permission * * @param string $email Email of the invited user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putRevokeUserPermission'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\PutRevokeUserPermission + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\PutRevokeUserPermissionResponse|\Brevo\Client\Models\ErrorModel */ - public function putRevokeUserPermission($email) + public function putRevokeUserPermission( + string $email, + string $contentType = self::contentTypes['putRevokeUserPermission'][0] + ): \Brevo\Client\Models\PutRevokeUserPermissionResponse { - list($response) = $this->putRevokeUserPermissionWithHttpInfo($email); + list($response) = $this->putRevokeUserPermissionWithHttpInfo($email, $contentType); return $response; } @@ -1229,15 +1614,18 @@ public function putRevokeUserPermission($email) * Revoke user permission * * @param string $email Email of the invited user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putRevokeUserPermission'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\PutRevokeUserPermission, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\PutRevokeUserPermissionResponse|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function putRevokeUserPermissionWithHttpInfo($email) + public function putRevokeUserPermissionWithHttpInfo( + string $email, + string $contentType = self::contentTypes['putRevokeUserPermission'][0] + ): array { - $returnType = '\Brevo\Client\Model\PutRevokeUserPermission'; - $request = $this->putRevokeUserPermissionRequest($email); + $request = $this->putRevokeUserPermissionRequest($email, $contentType); try { $options = $this->createHttpClientOption(); @@ -1246,34 +1634,111 @@ public function putRevokeUserPermissionWithHttpInfo($email) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\PutRevokeUserPermissionResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\PutRevokeUserPermissionResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\PutRevokeUserPermissionResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\PutRevokeUserPermissionResponse'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1288,7 +1753,7 @@ public function putRevokeUserPermissionWithHttpInfo($email) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\PutRevokeUserPermission', + '\Brevo\Client\Models\PutRevokeUserPermissionResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1296,7 +1761,7 @@ public function putRevokeUserPermissionWithHttpInfo($email) case 403: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1312,13 +1777,17 @@ public function putRevokeUserPermissionWithHttpInfo($email) * Revoke user permission * * @param string $email Email of the invited user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putRevokeUserPermission'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function putRevokeUserPermissionAsync($email) + public function putRevokeUserPermissionAsync( + string $email, + string $contentType = self::contentTypes['putRevokeUserPermission'][0] + ): PromiseInterface { - return $this->putRevokeUserPermissionAsyncWithHttpInfo($email) + return $this->putRevokeUserPermissionAsyncWithHttpInfo($email, $contentType) ->then( function ($response) { return $response[0]; @@ -1332,24 +1801,28 @@ function ($response) { * Revoke user permission * * @param string $email Email of the invited user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putRevokeUserPermission'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function putRevokeUserPermissionAsyncWithHttpInfo($email) + public function putRevokeUserPermissionAsyncWithHttpInfo( + $email, + string $contentType = self::contentTypes['putRevokeUserPermission'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\PutRevokeUserPermission'; - $request = $this->putRevokeUserPermissionRequest($email); + $returnType = '\Brevo\Client\Models\PutRevokeUserPermissionResponse'; + $request = $this->putRevokeUserPermissionRequest($email, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1372,7 +1845,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1382,19 +1855,25 @@ function ($exception) { * Create request for operation 'putRevokeUserPermission' * * @param string $email Email of the invited user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putRevokeUserPermission'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function putRevokeUserPermissionRequest($email) + public function putRevokeUserPermissionRequest( + $email, + string $contentType = self::contentTypes['putRevokeUserPermission'][0] + ): Request { + // verify the required parameter 'email' is set if ($email === null || (is_array($email) && count($email) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $email when calling putRevokeUserPermission' ); } + $resourcePath = '/organization/user/invitation/revoke/{email}'; $formParams = []; $queryParams = []; @@ -1403,6 +1882,7 @@ protected function putRevokeUserPermissionRequest($email) $multipart = false; + // path params if ($email !== null) { $resourcePath = str_replace( @@ -1412,53 +1892,35 @@ protected function putRevokeUserPermissionRequest($email) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1484,10 +1946,11 @@ protected function putRevokeUserPermissionRequest($email) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1500,14 +1963,19 @@ protected function putRevokeUserPermissionRequest($email) * * @param string $action action (required) * @param string $email Email of the invited user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putresendcancelinvitation'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\Putresendcancelinvitation + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\PutresendcancelinvitationResponse|\Brevo\Client\Models\ErrorModel */ - public function putresendcancelinvitation($action, $email) + public function putresendcancelinvitation( + string $action, + string $email, + string $contentType = self::contentTypes['putresendcancelinvitation'][0] + ): \Brevo\Client\Models\PutresendcancelinvitationResponse { - list($response) = $this->putresendcancelinvitationWithHttpInfo($action, $email); + list($response) = $this->putresendcancelinvitationWithHttpInfo($action, $email, $contentType); return $response; } @@ -1518,15 +1986,19 @@ public function putresendcancelinvitation($action, $email) * * @param string $action action (required) * @param string $email Email of the invited user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putresendcancelinvitation'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\Putresendcancelinvitation, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\PutresendcancelinvitationResponse|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function putresendcancelinvitationWithHttpInfo($action, $email) + public function putresendcancelinvitationWithHttpInfo( + string $action, + string $email, + string $contentType = self::contentTypes['putresendcancelinvitation'][0] + ): array { - $returnType = '\Brevo\Client\Model\Putresendcancelinvitation'; - $request = $this->putresendcancelinvitationRequest($action, $email); + $request = $this->putresendcancelinvitationRequest($action, $email, $contentType); try { $options = $this->createHttpClientOption(); @@ -1535,34 +2007,111 @@ public function putresendcancelinvitationWithHttpInfo($action, $email) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\PutresendcancelinvitationResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\PutresendcancelinvitationResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\PutresendcancelinvitationResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\PutresendcancelinvitationResponse'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1577,7 +2126,7 @@ public function putresendcancelinvitationWithHttpInfo($action, $email) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\Putresendcancelinvitation', + '\Brevo\Client\Models\PutresendcancelinvitationResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1585,7 +2134,7 @@ public function putresendcancelinvitationWithHttpInfo($action, $email) case 403: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1602,13 +2151,18 @@ public function putresendcancelinvitationWithHttpInfo($action, $email) * * @param string $action action (required) * @param string $email Email of the invited user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putresendcancelinvitation'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function putresendcancelinvitationAsync($action, $email) + public function putresendcancelinvitationAsync( + string $action, + string $email, + string $contentType = self::contentTypes['putresendcancelinvitation'][0] + ): PromiseInterface { - return $this->putresendcancelinvitationAsyncWithHttpInfo($action, $email) + return $this->putresendcancelinvitationAsyncWithHttpInfo($action, $email, $contentType) ->then( function ($response) { return $response[0]; @@ -1623,24 +2177,29 @@ function ($response) { * * @param string $action action (required) * @param string $email Email of the invited user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putresendcancelinvitation'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function putresendcancelinvitationAsyncWithHttpInfo($action, $email) + public function putresendcancelinvitationAsyncWithHttpInfo( + $action, + $email, + string $contentType = self::contentTypes['putresendcancelinvitation'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\Putresendcancelinvitation'; - $request = $this->putresendcancelinvitationRequest($action, $email); + $returnType = '\Brevo\Client\Models\PutresendcancelinvitationResponse'; + $request = $this->putresendcancelinvitationRequest($action, $email, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1663,7 +2222,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1674,25 +2233,33 @@ function ($exception) { * * @param string $action action (required) * @param string $email Email of the invited user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putresendcancelinvitation'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function putresendcancelinvitationRequest($action, $email) + public function putresendcancelinvitationRequest( + $action, + $email, + string $contentType = self::contentTypes['putresendcancelinvitation'][0] + ): Request { + // verify the required parameter 'action' is set if ($action === null || (is_array($action) && count($action) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $action when calling putresendcancelinvitation' ); } + // verify the required parameter 'email' is set if ($email === null || (is_array($email) && count($email) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $email when calling putresendcancelinvitation' ); } + $resourcePath = '/organization/user/invitation/{action}/{email}'; $formParams = []; $queryParams = []; @@ -1701,6 +2268,7 @@ protected function putresendcancelinvitationRequest($action, $email) $multipart = false; + // path params if ($action !== null) { $resourcePath = str_replace( @@ -1718,53 +2286,35 @@ protected function putresendcancelinvitationRequest($action, $email) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1790,10 +2340,11 @@ protected function putresendcancelinvitationRequest($action, $email) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1805,7 +2356,7 @@ protected function putresendcancelinvitationRequest($action, $email) * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/WebhooksApi.php b/lib/Api/WebhooksApi.php index 67c6096..6488f4f 100644 --- a/lib/Api/WebhooksApi.php +++ b/lib/Api/WebhooksApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'deleteWebhook' => [ + 'application/json', + ], + 'exportWebhooksHistory' => [ + 'application/json', + ], + 'getWebhook' => [ + 'application/json', + ], + 'getWebhooks' => [ + 'application/json', + ], + 'updateWebhook' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -92,15 +143,19 @@ public function getConfig() * * Create a webhook * - * @param \Brevo\Client\Model\CreateWebhook $createWebhook Values to create a webhook (required) + * @param \Brevo\Client\Models\CreateWebhook $createWebhook Values to create a webhook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhook'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreateModel + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateModel|\Brevo\Client\Models\ErrorModel */ - public function createWebhook($createWebhook) + public function createWebhook( + \Brevo\Client\Models\CreateWebhook $createWebhook, + string $contentType = self::contentTypes['createWebhook'][0] + ): \Brevo\Client\Models\CreateModel { - list($response) = $this->createWebhookWithHttpInfo($createWebhook); + list($response) = $this->createWebhookWithHttpInfo($createWebhook, $contentType); return $response; } @@ -109,16 +164,19 @@ public function createWebhook($createWebhook) * * Create a webhook * - * @param \Brevo\Client\Model\CreateWebhook $createWebhook Values to create a webhook (required) + * @param \Brevo\Client\Models\CreateWebhook $createWebhook Values to create a webhook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhook'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function createWebhookWithHttpInfo($createWebhook) + public function createWebhookWithHttpInfo( + \Brevo\Client\Models\CreateWebhook $createWebhook, + string $contentType = self::contentTypes['createWebhook'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreateModel'; - $request = $this->createWebhookRequest($createWebhook); + $request = $this->createWebhookRequest($createWebhook, $contentType); try { $options = $this->createHttpClientOption(); @@ -127,34 +185,111 @@ public function createWebhookWithHttpInfo($createWebhook) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreateModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreateModel'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -169,7 +304,7 @@ public function createWebhookWithHttpInfo($createWebhook) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreateModel', + '\Brevo\Client\Models\CreateModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -177,7 +312,7 @@ public function createWebhookWithHttpInfo($createWebhook) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -192,14 +327,18 @@ public function createWebhookWithHttpInfo($createWebhook) * * Create a webhook * - * @param \Brevo\Client\Model\CreateWebhook $createWebhook Values to create a webhook (required) + * @param \Brevo\Client\Models\CreateWebhook $createWebhook Values to create a webhook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhook'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createWebhookAsync($createWebhook) + public function createWebhookAsync( + \Brevo\Client\Models\CreateWebhook $createWebhook, + string $contentType = self::contentTypes['createWebhook'][0] + ): PromiseInterface { - return $this->createWebhookAsyncWithHttpInfo($createWebhook) + return $this->createWebhookAsyncWithHttpInfo($createWebhook, $contentType) ->then( function ($response) { return $response[0]; @@ -212,25 +351,29 @@ function ($response) { * * Create a webhook * - * @param \Brevo\Client\Model\CreateWebhook $createWebhook Values to create a webhook (required) + * @param \Brevo\Client\Models\CreateWebhook $createWebhook Values to create a webhook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhook'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createWebhookAsyncWithHttpInfo($createWebhook) + public function createWebhookAsyncWithHttpInfo( + $createWebhook, + string $contentType = self::contentTypes['createWebhook'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreateModel'; - $request = $this->createWebhookRequest($createWebhook); + $returnType = '\Brevo\Client\Models\CreateModel'; + $request = $this->createWebhookRequest($createWebhook, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -253,7 +396,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -262,20 +405,26 @@ function ($exception) { /** * Create request for operation 'createWebhook' * - * @param \Brevo\Client\Model\CreateWebhook $createWebhook Values to create a webhook (required) + * @param \Brevo\Client\Models\CreateWebhook $createWebhook Values to create a webhook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhook'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createWebhookRequest($createWebhook) + public function createWebhookRequest( + $createWebhook, + string $contentType = self::contentTypes['createWebhook'][0] + ): Request { + // verify the required parameter 'createWebhook' is set if ($createWebhook === null || (is_array($createWebhook) && count($createWebhook) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $createWebhook when calling createWebhook' ); } + $resourcePath = '/webhooks'; $formParams = []; $queryParams = []; @@ -285,56 +434,43 @@ protected function createWebhookRequest($createWebhook) - // body params - $_tempBody = null; - if (isset($createWebhook)) { - $_tempBody = $createWebhook; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($createWebhook)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createWebhook)); + } else { + $httpBody = $createWebhook; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -360,10 +496,11 @@ protected function createWebhookRequest($createWebhook) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -375,14 +512,18 @@ protected function createWebhookRequest($createWebhook) * Delete a webhook * * @param int $webhookId Id of the webhook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhook'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function deleteWebhook($webhookId) + public function deleteWebhook( + int $webhookId, + string $contentType = self::contentTypes['deleteWebhook'][0] + ): void { - $this->deleteWebhookWithHttpInfo($webhookId); + $this->deleteWebhookWithHttpInfo($webhookId, $contentType); } /** @@ -391,15 +532,18 @@ public function deleteWebhook($webhookId) * Delete a webhook * * @param int $webhookId Id of the webhook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhook'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteWebhookWithHttpInfo($webhookId) + public function deleteWebhookWithHttpInfo( + int $webhookId, + string $contentType = self::contentTypes['deleteWebhook'][0] + ): array { - $returnType = ''; - $request = $this->deleteWebhookRequest($webhookId); + $request = $this->deleteWebhookRequest($webhookId, $contentType); try { $options = $this->createHttpClientOption(); @@ -408,43 +552,38 @@ public function deleteWebhookWithHttpInfo($webhookId) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -460,13 +599,17 @@ public function deleteWebhookWithHttpInfo($webhookId) * Delete a webhook * * @param int $webhookId Id of the webhook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhook'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteWebhookAsync($webhookId) + public function deleteWebhookAsync( + int $webhookId, + string $contentType = self::contentTypes['deleteWebhook'][0] + ): PromiseInterface { - return $this->deleteWebhookAsyncWithHttpInfo($webhookId) + return $this->deleteWebhookAsyncWithHttpInfo($webhookId, $contentType) ->then( function ($response) { return $response[0]; @@ -480,14 +623,19 @@ function ($response) { * Delete a webhook * * @param int $webhookId Id of the webhook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhook'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteWebhookAsyncWithHttpInfo($webhookId) + public function deleteWebhookAsyncWithHttpInfo( + $webhookId, + string $contentType = self::contentTypes['deleteWebhook'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->deleteWebhookRequest($webhookId); + $request = $this->deleteWebhookRequest($webhookId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -506,7 +654,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -516,19 +664,25 @@ function ($exception) { * Create request for operation 'deleteWebhook' * * @param int $webhookId Id of the webhook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhook'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function deleteWebhookRequest($webhookId) + public function deleteWebhookRequest( + $webhookId, + string $contentType = self::contentTypes['deleteWebhook'][0] + ): Request { + // verify the required parameter 'webhookId' is set if ($webhookId === null || (is_array($webhookId) && count($webhookId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $webhookId when calling deleteWebhook' ); } + $resourcePath = '/webhooks/{webhookId}'; $formParams = []; $queryParams = []; @@ -537,6 +691,7 @@ protected function deleteWebhookRequest($webhookId) $multipart = false; + // path params if ($webhookId !== null) { $resourcePath = str_replace( @@ -546,53 +701,35 @@ protected function deleteWebhookRequest($webhookId) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -618,10 +755,11 @@ protected function deleteWebhookRequest($webhookId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -632,15 +770,19 @@ protected function deleteWebhookRequest($webhookId) * * Export all webhook events * - * @param \Brevo\Client\Model\ExportWebhooksHistory $exportWebhookHistory Values to submit for webhooks history (required) + * @param \Brevo\Client\Models\ExportWebhooksHistoryRequest $exportWebhooksHistoryRequest Values to submit for webhooks history (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportWebhooksHistory'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreatedProcessId + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreatedProcessId|\Brevo\Client\Models\ErrorModel */ - public function exportWebhooksHistory($exportWebhookHistory) + public function exportWebhooksHistory( + \Brevo\Client\Models\ExportWebhooksHistoryRequest $exportWebhooksHistoryRequest, + string $contentType = self::contentTypes['exportWebhooksHistory'][0] + ): \Brevo\Client\Models\CreatedProcessId { - list($response) = $this->exportWebhooksHistoryWithHttpInfo($exportWebhookHistory); + list($response) = $this->exportWebhooksHistoryWithHttpInfo($exportWebhooksHistoryRequest, $contentType); return $response; } @@ -649,16 +791,19 @@ public function exportWebhooksHistory($exportWebhookHistory) * * Export all webhook events * - * @param \Brevo\Client\Model\ExportWebhooksHistory $exportWebhookHistory Values to submit for webhooks history (required) + * @param \Brevo\Client\Models\ExportWebhooksHistoryRequest $exportWebhooksHistoryRequest Values to submit for webhooks history (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportWebhooksHistory'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreatedProcessId, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreatedProcessId|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function exportWebhooksHistoryWithHttpInfo($exportWebhookHistory) + public function exportWebhooksHistoryWithHttpInfo( + \Brevo\Client\Models\ExportWebhooksHistoryRequest $exportWebhooksHistoryRequest, + string $contentType = self::contentTypes['exportWebhooksHistory'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreatedProcessId'; - $request = $this->exportWebhooksHistoryRequest($exportWebhookHistory); + $request = $this->exportWebhooksHistoryRequest($exportWebhooksHistoryRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -667,34 +812,111 @@ public function exportWebhooksHistoryWithHttpInfo($exportWebhookHistory) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 202: + if (in_array('\Brevo\Client\Models\CreatedProcessId', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreatedProcessId' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreatedProcessId', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreatedProcessId'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -709,7 +931,7 @@ public function exportWebhooksHistoryWithHttpInfo($exportWebhookHistory) case 202: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreatedProcessId', + '\Brevo\Client\Models\CreatedProcessId', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -717,7 +939,7 @@ public function exportWebhooksHistoryWithHttpInfo($exportWebhookHistory) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -732,14 +954,18 @@ public function exportWebhooksHistoryWithHttpInfo($exportWebhookHistory) * * Export all webhook events * - * @param \Brevo\Client\Model\ExportWebhooksHistory $exportWebhookHistory Values to submit for webhooks history (required) + * @param \Brevo\Client\Models\ExportWebhooksHistoryRequest $exportWebhooksHistoryRequest Values to submit for webhooks history (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportWebhooksHistory'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function exportWebhooksHistoryAsync($exportWebhookHistory) + public function exportWebhooksHistoryAsync( + \Brevo\Client\Models\ExportWebhooksHistoryRequest $exportWebhooksHistoryRequest, + string $contentType = self::contentTypes['exportWebhooksHistory'][0] + ): PromiseInterface { - return $this->exportWebhooksHistoryAsyncWithHttpInfo($exportWebhookHistory) + return $this->exportWebhooksHistoryAsyncWithHttpInfo($exportWebhooksHistoryRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -752,25 +978,29 @@ function ($response) { * * Export all webhook events * - * @param \Brevo\Client\Model\ExportWebhooksHistory $exportWebhookHistory Values to submit for webhooks history (required) + * @param \Brevo\Client\Models\ExportWebhooksHistoryRequest $exportWebhooksHistoryRequest Values to submit for webhooks history (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportWebhooksHistory'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function exportWebhooksHistoryAsyncWithHttpInfo($exportWebhookHistory) + public function exportWebhooksHistoryAsyncWithHttpInfo( + $exportWebhooksHistoryRequest, + string $contentType = self::contentTypes['exportWebhooksHistory'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreatedProcessId'; - $request = $this->exportWebhooksHistoryRequest($exportWebhookHistory); + $returnType = '\Brevo\Client\Models\CreatedProcessId'; + $request = $this->exportWebhooksHistoryRequest($exportWebhooksHistoryRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -793,7 +1023,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -802,20 +1032,26 @@ function ($exception) { /** * Create request for operation 'exportWebhooksHistory' * - * @param \Brevo\Client\Model\ExportWebhooksHistory $exportWebhookHistory Values to submit for webhooks history (required) + * @param \Brevo\Client\Models\ExportWebhooksHistoryRequest $exportWebhooksHistoryRequest Values to submit for webhooks history (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportWebhooksHistory'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function exportWebhooksHistoryRequest($exportWebhookHistory) + public function exportWebhooksHistoryRequest( + $exportWebhooksHistoryRequest, + string $contentType = self::contentTypes['exportWebhooksHistory'][0] + ): Request { - // verify the required parameter 'exportWebhookHistory' is set - if ($exportWebhookHistory === null || (is_array($exportWebhookHistory) && count($exportWebhookHistory) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $exportWebhookHistory when calling exportWebhooksHistory' + + // verify the required parameter 'exportWebhooksHistoryRequest' is set + if ($exportWebhooksHistoryRequest === null || (is_array($exportWebhooksHistoryRequest) && count($exportWebhooksHistoryRequest) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $exportWebhooksHistoryRequest when calling exportWebhooksHistory' ); } + $resourcePath = '/webhooks/export'; $formParams = []; $queryParams = []; @@ -825,56 +1061,43 @@ protected function exportWebhooksHistoryRequest($exportWebhookHistory) - // body params - $_tempBody = null; - if (isset($exportWebhookHistory)) { - $_tempBody = $exportWebhookHistory; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($exportWebhooksHistoryRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($exportWebhooksHistoryRequest)); + } else { + $httpBody = $exportWebhooksHistoryRequest; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -900,10 +1123,11 @@ protected function exportWebhooksHistoryRequest($exportWebhookHistory) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -915,14 +1139,18 @@ protected function exportWebhooksHistoryRequest($exportWebhookHistory) * Get a webhook details * * @param int $webhookId Id of the webhook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhook'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetWebhook + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetWebhook|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function getWebhook($webhookId) + public function getWebhook( + int $webhookId, + string $contentType = self::contentTypes['getWebhook'][0] + ): \Brevo\Client\Models\GetWebhook { - list($response) = $this->getWebhookWithHttpInfo($webhookId); + list($response) = $this->getWebhookWithHttpInfo($webhookId, $contentType); return $response; } @@ -932,15 +1160,18 @@ public function getWebhook($webhookId) * Get a webhook details * * @param int $webhookId Id of the webhook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhook'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetWebhook, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetWebhook|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getWebhookWithHttpInfo($webhookId) + public function getWebhookWithHttpInfo( + int $webhookId, + string $contentType = self::contentTypes['getWebhook'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetWebhook'; - $request = $this->getWebhookRequest($webhookId); + $request = $this->getWebhookRequest($webhookId, $contentType); try { $options = $this->createHttpClientOption(); @@ -949,34 +1180,138 @@ public function getWebhookWithHttpInfo($webhookId) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetWebhook', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetWebhook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetWebhook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetWebhook'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -991,23 +1326,23 @@ public function getWebhookWithHttpInfo($webhookId) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetWebhook', + '\Brevo\Client\Models\GetWebhook', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1023,13 +1358,17 @@ public function getWebhookWithHttpInfo($webhookId) * Get a webhook details * * @param int $webhookId Id of the webhook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhook'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getWebhookAsync($webhookId) + public function getWebhookAsync( + int $webhookId, + string $contentType = self::contentTypes['getWebhook'][0] + ): PromiseInterface { - return $this->getWebhookAsyncWithHttpInfo($webhookId) + return $this->getWebhookAsyncWithHttpInfo($webhookId, $contentType) ->then( function ($response) { return $response[0]; @@ -1043,24 +1382,28 @@ function ($response) { * Get a webhook details * * @param int $webhookId Id of the webhook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhook'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getWebhookAsyncWithHttpInfo($webhookId) + public function getWebhookAsyncWithHttpInfo( + $webhookId, + string $contentType = self::contentTypes['getWebhook'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetWebhook'; - $request = $this->getWebhookRequest($webhookId); + $returnType = '\Brevo\Client\Models\GetWebhook'; + $request = $this->getWebhookRequest($webhookId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1083,7 +1426,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1093,19 +1436,25 @@ function ($exception) { * Create request for operation 'getWebhook' * * @param int $webhookId Id of the webhook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhook'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getWebhookRequest($webhookId) + public function getWebhookRequest( + $webhookId, + string $contentType = self::contentTypes['getWebhook'][0] + ): Request { + // verify the required parameter 'webhookId' is set if ($webhookId === null || (is_array($webhookId) && count($webhookId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $webhookId when calling getWebhook' ); } + $resourcePath = '/webhooks/{webhookId}'; $formParams = []; $queryParams = []; @@ -1114,6 +1463,7 @@ protected function getWebhookRequest($webhookId) $multipart = false; + // path params if ($webhookId !== null) { $resourcePath = str_replace( @@ -1123,53 +1473,35 @@ protected function getWebhookRequest($webhookId) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1195,10 +1527,11 @@ protected function getWebhookRequest($webhookId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1209,16 +1542,21 @@ protected function getWebhookRequest($webhookId) * * Get all webhooks * - * @param string $type Filter on webhook type (optional, default to transactional) - * @param string $sort Sort the results in the ascending/descending order of webhook creation (optional, default to desc) + * @param string|null $type Filter on webhook type (optional, default to 'transactional') + * @param string|null $sort Sort the results in the ascending/descending order of webhook creation (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhooks'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetWebhooks + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetWebhooks|\Brevo\Client\Models\ErrorModel */ - public function getWebhooks($type = 'transactional', $sort = 'desc') + public function getWebhooks( + ?string $type = 'transactional', + ?string $sort = 'desc', + string $contentType = self::contentTypes['getWebhooks'][0] + ): \Brevo\Client\Models\GetWebhooks { - list($response) = $this->getWebhooksWithHttpInfo($type, $sort); + list($response) = $this->getWebhooksWithHttpInfo($type, $sort, $contentType); return $response; } @@ -1227,17 +1565,21 @@ public function getWebhooks($type = 'transactional', $sort = 'desc') * * Get all webhooks * - * @param string $type Filter on webhook type (optional, default to transactional) - * @param string $sort Sort the results in the ascending/descending order of webhook creation (optional, default to desc) + * @param string|null $type Filter on webhook type (optional, default to 'transactional') + * @param string|null $sort Sort the results in the ascending/descending order of webhook creation (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhooks'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetWebhooks, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetWebhooks|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getWebhooksWithHttpInfo($type = 'transactional', $sort = 'desc') + public function getWebhooksWithHttpInfo( + ?string $type = 'transactional', + ?string $sort = 'desc', + string $contentType = self::contentTypes['getWebhooks'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetWebhooks'; - $request = $this->getWebhooksRequest($type, $sort); + $request = $this->getWebhooksRequest($type, $sort, $contentType); try { $options = $this->createHttpClientOption(); @@ -1246,34 +1588,111 @@ public function getWebhooksWithHttpInfo($type = 'transactional', $sort = 'desc') } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetWebhooks', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetWebhooks' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetWebhooks', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetWebhooks'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1288,7 +1707,7 @@ public function getWebhooksWithHttpInfo($type = 'transactional', $sort = 'desc') case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetWebhooks', + '\Brevo\Client\Models\GetWebhooks', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1296,7 +1715,7 @@ public function getWebhooksWithHttpInfo($type = 'transactional', $sort = 'desc') case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1311,15 +1730,20 @@ public function getWebhooksWithHttpInfo($type = 'transactional', $sort = 'desc') * * Get all webhooks * - * @param string $type Filter on webhook type (optional, default to transactional) - * @param string $sort Sort the results in the ascending/descending order of webhook creation (optional, default to desc) + * @param string|null $type Filter on webhook type (optional, default to 'transactional') + * @param string|null $sort Sort the results in the ascending/descending order of webhook creation (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhooks'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getWebhooksAsync($type = 'transactional', $sort = 'desc') + public function getWebhooksAsync( + ?string $type = 'transactional', + ?string $sort = 'desc', + string $contentType = self::contentTypes['getWebhooks'][0] + ): PromiseInterface { - return $this->getWebhooksAsyncWithHttpInfo($type, $sort) + return $this->getWebhooksAsyncWithHttpInfo($type, $sort, $contentType) ->then( function ($response) { return $response[0]; @@ -1332,26 +1756,31 @@ function ($response) { * * Get all webhooks * - * @param string $type Filter on webhook type (optional, default to transactional) - * @param string $sort Sort the results in the ascending/descending order of webhook creation (optional, default to desc) + * @param string|null $type Filter on webhook type (optional, default to 'transactional') + * @param string|null $sort Sort the results in the ascending/descending order of webhook creation (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhooks'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getWebhooksAsyncWithHttpInfo($type = 'transactional', $sort = 'desc') + public function getWebhooksAsyncWithHttpInfo( + $type = 'transactional', + $sort = 'desc', + string $contentType = self::contentTypes['getWebhooks'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetWebhooks'; - $request = $this->getWebhooksRequest($type, $sort); + $returnType = '\Brevo\Client\Models\GetWebhooks'; + $request = $this->getWebhooksRequest($type, $sort, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1374,7 +1803,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1383,15 +1812,23 @@ function ($exception) { /** * Create request for operation 'getWebhooks' * - * @param string $type Filter on webhook type (optional, default to transactional) - * @param string $sort Sort the results in the ascending/descending order of webhook creation (optional, default to desc) + * @param string|null $type Filter on webhook type (optional, default to 'transactional') + * @param string|null $sort Sort the results in the ascending/descending order of webhook creation (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhooks'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getWebhooksRequest($type = 'transactional', $sort = 'desc') + public function getWebhooksRequest( + $type = 'transactional', + $sort = 'desc', + string $contentType = self::contentTypes['getWebhooks'][0] + ): Request { + + + $resourcePath = '/webhooks'; $formParams = []; $queryParams = []; @@ -1400,62 +1837,55 @@ protected function getWebhooksRequest($type = 'transactional', $sort = 'desc') $multipart = false; // query params - if ($type !== null) { - $queryParams['type'] = ObjectSerializer::toQueryValue($type); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $type, + 'type', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1481,10 +1911,11 @@ protected function getWebhooksRequest($type = 'transactional', $sort = 'desc') $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1496,15 +1927,20 @@ protected function getWebhooksRequest($type = 'transactional', $sort = 'desc') * Update a webhook * * @param int $webhookId Id of the webhook (required) - * @param \Brevo\Client\Model\UpdateWebhook $updateWebhook Values to update a webhook (required) + * @param \Brevo\Client\Models\UpdateWebhook $updateWebhook Values to update a webhook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhook'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function updateWebhook($webhookId, $updateWebhook) + public function updateWebhook( + int $webhookId, + \Brevo\Client\Models\UpdateWebhook $updateWebhook, + string $contentType = self::contentTypes['updateWebhook'][0] + ): void { - $this->updateWebhookWithHttpInfo($webhookId, $updateWebhook); + $this->updateWebhookWithHttpInfo($webhookId, $updateWebhook, $contentType); } /** @@ -1513,16 +1949,20 @@ public function updateWebhook($webhookId, $updateWebhook) * Update a webhook * * @param int $webhookId Id of the webhook (required) - * @param \Brevo\Client\Model\UpdateWebhook $updateWebhook Values to update a webhook (required) + * @param \Brevo\Client\Models\UpdateWebhook $updateWebhook Values to update a webhook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhook'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function updateWebhookWithHttpInfo($webhookId, $updateWebhook) + public function updateWebhookWithHttpInfo( + int $webhookId, + \Brevo\Client\Models\UpdateWebhook $updateWebhook, + string $contentType = self::contentTypes['updateWebhook'][0] + ): array { - $returnType = ''; - $request = $this->updateWebhookRequest($webhookId, $updateWebhook); + $request = $this->updateWebhookRequest($webhookId, $updateWebhook, $contentType); try { $options = $this->createHttpClientOption(); @@ -1531,26 +1971,21 @@ public function updateWebhookWithHttpInfo($webhookId, $updateWebhook) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -1559,7 +1994,7 @@ public function updateWebhookWithHttpInfo($webhookId, $updateWebhook) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1567,7 +2002,7 @@ public function updateWebhookWithHttpInfo($webhookId, $updateWebhook) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1583,14 +2018,19 @@ public function updateWebhookWithHttpInfo($webhookId, $updateWebhook) * Update a webhook * * @param int $webhookId Id of the webhook (required) - * @param \Brevo\Client\Model\UpdateWebhook $updateWebhook Values to update a webhook (required) + * @param \Brevo\Client\Models\UpdateWebhook $updateWebhook Values to update a webhook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhook'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateWebhookAsync($webhookId, $updateWebhook) + public function updateWebhookAsync( + int $webhookId, + \Brevo\Client\Models\UpdateWebhook $updateWebhook, + string $contentType = self::contentTypes['updateWebhook'][0] + ): PromiseInterface { - return $this->updateWebhookAsyncWithHttpInfo($webhookId, $updateWebhook) + return $this->updateWebhookAsyncWithHttpInfo($webhookId, $updateWebhook, $contentType) ->then( function ($response) { return $response[0]; @@ -1604,15 +2044,21 @@ function ($response) { * Update a webhook * * @param int $webhookId Id of the webhook (required) - * @param \Brevo\Client\Model\UpdateWebhook $updateWebhook Values to update a webhook (required) + * @param \Brevo\Client\Models\UpdateWebhook $updateWebhook Values to update a webhook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhook'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateWebhookAsyncWithHttpInfo($webhookId, $updateWebhook) + public function updateWebhookAsyncWithHttpInfo( + $webhookId, + $updateWebhook, + string $contentType = self::contentTypes['updateWebhook'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->updateWebhookRequest($webhookId, $updateWebhook); + $request = $this->updateWebhookRequest($webhookId, $updateWebhook, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1631,7 +2077,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1641,26 +2087,34 @@ function ($exception) { * Create request for operation 'updateWebhook' * * @param int $webhookId Id of the webhook (required) - * @param \Brevo\Client\Model\UpdateWebhook $updateWebhook Values to update a webhook (required) + * @param \Brevo\Client\Models\UpdateWebhook $updateWebhook Values to update a webhook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhook'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updateWebhookRequest($webhookId, $updateWebhook) + public function updateWebhookRequest( + $webhookId, + $updateWebhook, + string $contentType = self::contentTypes['updateWebhook'][0] + ): Request { + // verify the required parameter 'webhookId' is set if ($webhookId === null || (is_array($webhookId) && count($webhookId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $webhookId when calling updateWebhook' ); } + // verify the required parameter 'updateWebhook' is set if ($updateWebhook === null || (is_array($updateWebhook) && count($updateWebhook) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $updateWebhook when calling updateWebhook' ); } + $resourcePath = '/webhooks/{webhookId}'; $formParams = []; $queryParams = []; @@ -1669,6 +2123,7 @@ protected function updateWebhookRequest($webhookId, $updateWebhook) $multipart = false; + // path params if ($webhookId !== null) { $resourcePath = str_replace( @@ -1678,56 +2133,42 @@ protected function updateWebhookRequest($webhookId, $updateWebhook) ); } - // 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'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($updateWebhook)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($updateWebhook)); + } else { + $httpBody = $updateWebhook; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1753,10 +2194,11 @@ protected function updateWebhookRequest($webhookId, $updateWebhook) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1768,7 +2210,7 @@ protected function updateWebhookRequest($webhookId, $updateWebhook) * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/Api/WhatsAppCampaignsApi.php b/lib/Api/WhatsAppCampaignsApi.php index e6430a0..d9ba2d5 100644 --- a/lib/Api/WhatsAppCampaignsApi.php +++ b/lib/Api/WhatsAppCampaignsApi.php @@ -1,39 +1,41 @@ [ + 'application/json', + ], + 'createWhatsAppTemplate' => [ + 'application/json', + ], + 'deleteWhatsAppCampaign' => [ + 'application/json', + ], + 'getWhatsAppCampaign' => [ + 'application/json', + ], + 'getWhatsAppCampaigns' => [ + 'application/json', + ], + 'getWhatsAppConfig' => [ + 'application/json', + ], + 'getWhatsAppTemplates' => [ + 'application/json', + ], + 'sendWhatsAppTemplateApproval' => [ + 'application/json', + ], + 'updateWhatsAppCampaign' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, - HeaderSelector $selector = null + HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; } /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -92,15 +152,19 @@ public function getConfig() * * Create and Send a WhatsApp campaign * - * @param \Brevo\Client\Model\CreateWhatsAppCampaign $whatsAppCampaigns Values to create a campaign (required) + * @param \Brevo\Client\Models\CreateWhatsAppCampaign $createWhatsAppCampaign Values to create a WhatsApp Campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWhatsAppCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreateModel + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateModel|\Brevo\Client\Models\ErrorModel */ - public function createWhatsAppCampaign($whatsAppCampaigns) + public function createWhatsAppCampaign( + \Brevo\Client\Models\CreateWhatsAppCampaign $createWhatsAppCampaign, + string $contentType = self::contentTypes['createWhatsAppCampaign'][0] + ): \Brevo\Client\Models\CreateModel { - list($response) = $this->createWhatsAppCampaignWithHttpInfo($whatsAppCampaigns); + list($response) = $this->createWhatsAppCampaignWithHttpInfo($createWhatsAppCampaign, $contentType); return $response; } @@ -109,16 +173,19 @@ public function createWhatsAppCampaign($whatsAppCampaigns) * * Create and Send a WhatsApp campaign * - * @param \Brevo\Client\Model\CreateWhatsAppCampaign $whatsAppCampaigns Values to create a campaign (required) + * @param \Brevo\Client\Models\CreateWhatsAppCampaign $createWhatsAppCampaign Values to create a WhatsApp Campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWhatsAppCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function createWhatsAppCampaignWithHttpInfo($whatsAppCampaigns) + public function createWhatsAppCampaignWithHttpInfo( + \Brevo\Client\Models\CreateWhatsAppCampaign $createWhatsAppCampaign, + string $contentType = self::contentTypes['createWhatsAppCampaign'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreateModel'; - $request = $this->createWhatsAppCampaignRequest($whatsAppCampaigns); + $request = $this->createWhatsAppCampaignRequest($createWhatsAppCampaign, $contentType); try { $options = $this->createHttpClientOption(); @@ -127,34 +194,111 @@ public function createWhatsAppCampaignWithHttpInfo($whatsAppCampaigns) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreateModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreateModel'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -169,7 +313,7 @@ public function createWhatsAppCampaignWithHttpInfo($whatsAppCampaigns) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreateModel', + '\Brevo\Client\Models\CreateModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -177,7 +321,7 @@ public function createWhatsAppCampaignWithHttpInfo($whatsAppCampaigns) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -192,14 +336,18 @@ public function createWhatsAppCampaignWithHttpInfo($whatsAppCampaigns) * * Create and Send a WhatsApp campaign * - * @param \Brevo\Client\Model\CreateWhatsAppCampaign $whatsAppCampaigns Values to create a campaign (required) + * @param \Brevo\Client\Models\CreateWhatsAppCampaign $createWhatsAppCampaign Values to create a WhatsApp Campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWhatsAppCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createWhatsAppCampaignAsync($whatsAppCampaigns) + public function createWhatsAppCampaignAsync( + \Brevo\Client\Models\CreateWhatsAppCampaign $createWhatsAppCampaign, + string $contentType = self::contentTypes['createWhatsAppCampaign'][0] + ): PromiseInterface { - return $this->createWhatsAppCampaignAsyncWithHttpInfo($whatsAppCampaigns) + return $this->createWhatsAppCampaignAsyncWithHttpInfo($createWhatsAppCampaign, $contentType) ->then( function ($response) { return $response[0]; @@ -212,25 +360,29 @@ function ($response) { * * Create and Send a WhatsApp campaign * - * @param \Brevo\Client\Model\CreateWhatsAppCampaign $whatsAppCampaigns Values to create a campaign (required) + * @param \Brevo\Client\Models\CreateWhatsAppCampaign $createWhatsAppCampaign Values to create a WhatsApp Campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWhatsAppCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createWhatsAppCampaignAsyncWithHttpInfo($whatsAppCampaigns) + public function createWhatsAppCampaignAsyncWithHttpInfo( + $createWhatsAppCampaign, + string $contentType = self::contentTypes['createWhatsAppCampaign'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreateModel'; - $request = $this->createWhatsAppCampaignRequest($whatsAppCampaigns); + $returnType = '\Brevo\Client\Models\CreateModel'; + $request = $this->createWhatsAppCampaignRequest($createWhatsAppCampaign, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -253,7 +405,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -262,20 +414,26 @@ function ($exception) { /** * Create request for operation 'createWhatsAppCampaign' * - * @param \Brevo\Client\Model\CreateWhatsAppCampaign $whatsAppCampaigns Values to create a campaign (required) + * @param \Brevo\Client\Models\CreateWhatsAppCampaign $createWhatsAppCampaign Values to create a WhatsApp Campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWhatsAppCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createWhatsAppCampaignRequest($whatsAppCampaigns) + public function createWhatsAppCampaignRequest( + $createWhatsAppCampaign, + string $contentType = self::contentTypes['createWhatsAppCampaign'][0] + ): Request { - // verify the required parameter 'whatsAppCampaigns' is set - if ($whatsAppCampaigns === null || (is_array($whatsAppCampaigns) && count($whatsAppCampaigns) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $whatsAppCampaigns when calling createWhatsAppCampaign' + + // verify the required parameter 'createWhatsAppCampaign' is set + if ($createWhatsAppCampaign === null || (is_array($createWhatsAppCampaign) && count($createWhatsAppCampaign) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $createWhatsAppCampaign when calling createWhatsAppCampaign' ); } + $resourcePath = '/whatsappCampaigns'; $formParams = []; $queryParams = []; @@ -285,56 +443,43 @@ protected function createWhatsAppCampaignRequest($whatsAppCampaigns) - // body params - $_tempBody = null; - if (isset($whatsAppCampaigns)) { - $_tempBody = $whatsAppCampaigns; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($createWhatsAppCampaign)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createWhatsAppCampaign)); + } else { + $httpBody = $createWhatsAppCampaign; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -360,10 +505,11 @@ protected function createWhatsAppCampaignRequest($whatsAppCampaigns) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -374,15 +520,19 @@ protected function createWhatsAppCampaignRequest($whatsAppCampaigns) * * Create a WhatsApp template * - * @param \Brevo\Client\Model\CreateWhatsAppTemplate $whatsAppTemplates Values to create a template (required) + * @param \Brevo\Client\Models\CreateWhatsAppTemplate $createWhatsAppTemplate Values to create a WhatsApp template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWhatsAppTemplate'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\CreateModel + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\CreateModel|\Brevo\Client\Models\ErrorModel */ - public function createWhatsAppTemplate($whatsAppTemplates) + public function createWhatsAppTemplate( + \Brevo\Client\Models\CreateWhatsAppTemplate $createWhatsAppTemplate, + string $contentType = self::contentTypes['createWhatsAppTemplate'][0] + ): \Brevo\Client\Models\CreateModel { - list($response) = $this->createWhatsAppTemplateWithHttpInfo($whatsAppTemplates); + list($response) = $this->createWhatsAppTemplateWithHttpInfo($createWhatsAppTemplate, $contentType); return $response; } @@ -391,16 +541,19 @@ public function createWhatsAppTemplate($whatsAppTemplates) * * Create a WhatsApp template * - * @param \Brevo\Client\Model\CreateWhatsAppTemplate $whatsAppTemplates Values to create a template (required) + * @param \Brevo\Client\Models\CreateWhatsAppTemplate $createWhatsAppTemplate Values to create a WhatsApp template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWhatsAppTemplate'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\CreateModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function createWhatsAppTemplateWithHttpInfo($whatsAppTemplates) + public function createWhatsAppTemplateWithHttpInfo( + \Brevo\Client\Models\CreateWhatsAppTemplate $createWhatsAppTemplate, + string $contentType = self::contentTypes['createWhatsAppTemplate'][0] + ): array { - $returnType = '\Brevo\Client\Model\CreateModel'; - $request = $this->createWhatsAppTemplateRequest($whatsAppTemplates); + $request = $this->createWhatsAppTemplateRequest($createWhatsAppTemplate, $contentType); try { $options = $this->createHttpClientOption(); @@ -409,34 +562,111 @@ public function createWhatsAppTemplateWithHttpInfo($whatsAppTemplates) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if (in_array('\Brevo\Client\Models\CreateModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\CreateModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\CreateModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\CreateModel'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -451,7 +681,7 @@ public function createWhatsAppTemplateWithHttpInfo($whatsAppTemplates) case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\CreateModel', + '\Brevo\Client\Models\CreateModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -459,7 +689,7 @@ public function createWhatsAppTemplateWithHttpInfo($whatsAppTemplates) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -474,14 +704,18 @@ public function createWhatsAppTemplateWithHttpInfo($whatsAppTemplates) * * Create a WhatsApp template * - * @param \Brevo\Client\Model\CreateWhatsAppTemplate $whatsAppTemplates Values to create a template (required) + * @param \Brevo\Client\Models\CreateWhatsAppTemplate $createWhatsAppTemplate Values to create a WhatsApp template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWhatsAppTemplate'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createWhatsAppTemplateAsync($whatsAppTemplates) + public function createWhatsAppTemplateAsync( + \Brevo\Client\Models\CreateWhatsAppTemplate $createWhatsAppTemplate, + string $contentType = self::contentTypes['createWhatsAppTemplate'][0] + ): PromiseInterface { - return $this->createWhatsAppTemplateAsyncWithHttpInfo($whatsAppTemplates) + return $this->createWhatsAppTemplateAsyncWithHttpInfo($createWhatsAppTemplate, $contentType) ->then( function ($response) { return $response[0]; @@ -494,25 +728,29 @@ function ($response) { * * Create a WhatsApp template * - * @param \Brevo\Client\Model\CreateWhatsAppTemplate $whatsAppTemplates Values to create a template (required) + * @param \Brevo\Client\Models\CreateWhatsAppTemplate $createWhatsAppTemplate Values to create a WhatsApp template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWhatsAppTemplate'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function createWhatsAppTemplateAsyncWithHttpInfo($whatsAppTemplates) + public function createWhatsAppTemplateAsyncWithHttpInfo( + $createWhatsAppTemplate, + string $contentType = self::contentTypes['createWhatsAppTemplate'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\CreateModel'; - $request = $this->createWhatsAppTemplateRequest($whatsAppTemplates); + $returnType = '\Brevo\Client\Models\CreateModel'; + $request = $this->createWhatsAppTemplateRequest($createWhatsAppTemplate, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -535,7 +773,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -544,21 +782,27 @@ function ($exception) { /** * Create request for operation 'createWhatsAppTemplate' * - * @param \Brevo\Client\Model\CreateWhatsAppTemplate $whatsAppTemplates Values to create a template (required) + * @param \Brevo\Client\Models\CreateWhatsAppTemplate $createWhatsAppTemplate Values to create a WhatsApp template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWhatsAppTemplate'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createWhatsAppTemplateRequest($whatsAppTemplates) + public function createWhatsAppTemplateRequest( + $createWhatsAppTemplate, + string $contentType = self::contentTypes['createWhatsAppTemplate'][0] + ): Request { - // verify the required parameter 'whatsAppTemplates' is set - if ($whatsAppTemplates === null || (is_array($whatsAppTemplates) && count($whatsAppTemplates) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $whatsAppTemplates when calling createWhatsAppTemplate' + + // verify the required parameter 'createWhatsAppTemplate' is set + if ($createWhatsAppTemplate === null || (is_array($createWhatsAppTemplate) && count($createWhatsAppTemplate) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $createWhatsAppTemplate when calling createWhatsAppTemplate' ); } - $resourcePath = '/whatsppCampaigns/template'; + + $resourcePath = '/whatsappCampaigns/template'; $formParams = []; $queryParams = []; $headerParams = []; @@ -567,56 +811,43 @@ protected function createWhatsAppTemplateRequest($whatsAppTemplates) - // body params - $_tempBody = null; - if (isset($whatsAppTemplates)) { - $_tempBody = $whatsAppTemplates; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($createWhatsAppTemplate)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createWhatsAppTemplate)); + } else { + $httpBody = $createWhatsAppTemplate; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -642,10 +873,11 @@ protected function createWhatsAppTemplateRequest($whatsAppTemplates) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -657,14 +889,18 @@ protected function createWhatsAppTemplateRequest($whatsAppTemplates) * Delete a WhatsApp campaign * * @param int $campaignId id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWhatsAppCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function deleteWhatsAppCampaign($campaignId) + public function deleteWhatsAppCampaign( + int $campaignId, + string $contentType = self::contentTypes['deleteWhatsAppCampaign'][0] + ): void { - $this->deleteWhatsAppCampaignWithHttpInfo($campaignId); + $this->deleteWhatsAppCampaignWithHttpInfo($campaignId, $contentType); } /** @@ -673,15 +909,18 @@ public function deleteWhatsAppCampaign($campaignId) * Delete a WhatsApp campaign * * @param int $campaignId id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWhatsAppCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteWhatsAppCampaignWithHttpInfo($campaignId) + public function deleteWhatsAppCampaignWithHttpInfo( + int $campaignId, + string $contentType = self::contentTypes['deleteWhatsAppCampaign'][0] + ): array { - $returnType = ''; - $request = $this->deleteWhatsAppCampaignRequest($campaignId); + $request = $this->deleteWhatsAppCampaignRequest($campaignId, $contentType); try { $options = $this->createHttpClientOption(); @@ -690,26 +929,21 @@ public function deleteWhatsAppCampaignWithHttpInfo($campaignId) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -718,7 +952,7 @@ public function deleteWhatsAppCampaignWithHttpInfo($campaignId) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -726,7 +960,7 @@ public function deleteWhatsAppCampaignWithHttpInfo($campaignId) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -742,13 +976,17 @@ public function deleteWhatsAppCampaignWithHttpInfo($campaignId) * Delete a WhatsApp campaign * * @param int $campaignId id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWhatsAppCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteWhatsAppCampaignAsync($campaignId) + public function deleteWhatsAppCampaignAsync( + int $campaignId, + string $contentType = self::contentTypes['deleteWhatsAppCampaign'][0] + ): PromiseInterface { - return $this->deleteWhatsAppCampaignAsyncWithHttpInfo($campaignId) + return $this->deleteWhatsAppCampaignAsyncWithHttpInfo($campaignId, $contentType) ->then( function ($response) { return $response[0]; @@ -762,14 +1000,19 @@ function ($response) { * Delete a WhatsApp campaign * * @param int $campaignId id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWhatsAppCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function deleteWhatsAppCampaignAsyncWithHttpInfo($campaignId) + public function deleteWhatsAppCampaignAsyncWithHttpInfo( + $campaignId, + string $contentType = self::contentTypes['deleteWhatsAppCampaign'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->deleteWhatsAppCampaignRequest($campaignId); + $request = $this->deleteWhatsAppCampaignRequest($campaignId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -788,7 +1031,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -798,19 +1041,25 @@ function ($exception) { * Create request for operation 'deleteWhatsAppCampaign' * * @param int $campaignId id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWhatsAppCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function deleteWhatsAppCampaignRequest($campaignId) + public function deleteWhatsAppCampaignRequest( + $campaignId, + string $contentType = self::contentTypes['deleteWhatsAppCampaign'][0] + ): Request { + // verify the required parameter 'campaignId' is set if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $campaignId when calling deleteWhatsAppCampaign' ); } + $resourcePath = '/whatsappCampaigns/{campaignId}'; $formParams = []; $queryParams = []; @@ -819,6 +1068,7 @@ protected function deleteWhatsAppCampaignRequest($campaignId) $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( @@ -828,53 +1078,35 @@ protected function deleteWhatsAppCampaignRequest($campaignId) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -900,10 +1132,11 @@ protected function deleteWhatsAppCampaignRequest($campaignId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -915,14 +1148,18 @@ protected function deleteWhatsAppCampaignRequest($campaignId) * Get a WhatsApp campaign * * @param int $campaignId Id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsAppCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetWhatsappCampaignOverview + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetWhatsappCampaignOverview|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel */ - public function getWhatsAppCampaign($campaignId) + public function getWhatsAppCampaign( + int $campaignId, + string $contentType = self::contentTypes['getWhatsAppCampaign'][0] + ): \Brevo\Client\Models\GetWhatsappCampaignOverview { - list($response) = $this->getWhatsAppCampaignWithHttpInfo($campaignId); + list($response) = $this->getWhatsAppCampaignWithHttpInfo($campaignId, $contentType); return $response; } @@ -932,15 +1169,18 @@ public function getWhatsAppCampaign($campaignId) * Get a WhatsApp campaign * * @param int $campaignId Id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsAppCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetWhatsappCampaignOverview, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetWhatsappCampaignOverview|\Brevo\Client\Models\ErrorModel|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getWhatsAppCampaignWithHttpInfo($campaignId) + public function getWhatsAppCampaignWithHttpInfo( + int $campaignId, + string $contentType = self::contentTypes['getWhatsAppCampaign'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetWhatsappCampaignOverview'; - $request = $this->getWhatsAppCampaignRequest($campaignId); + $request = $this->getWhatsAppCampaignRequest($campaignId, $contentType); try { $options = $this->createHttpClientOption(); @@ -949,34 +1189,138 @@ public function getWhatsAppCampaignWithHttpInfo($campaignId) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetWhatsappCampaignOverview', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetWhatsappCampaignOverview' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetWhatsappCampaignOverview', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetWhatsappCampaignOverview'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -991,7 +1335,7 @@ public function getWhatsAppCampaignWithHttpInfo($campaignId) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetWhatsappCampaignOverview', + '\Brevo\Client\Models\GetWhatsappCampaignOverview', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -999,7 +1343,7 @@ public function getWhatsAppCampaignWithHttpInfo($campaignId) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1007,7 +1351,7 @@ public function getWhatsAppCampaignWithHttpInfo($campaignId) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1023,13 +1367,17 @@ public function getWhatsAppCampaignWithHttpInfo($campaignId) * Get a WhatsApp campaign * * @param int $campaignId Id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsAppCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getWhatsAppCampaignAsync($campaignId) + public function getWhatsAppCampaignAsync( + int $campaignId, + string $contentType = self::contentTypes['getWhatsAppCampaign'][0] + ): PromiseInterface { - return $this->getWhatsAppCampaignAsyncWithHttpInfo($campaignId) + return $this->getWhatsAppCampaignAsyncWithHttpInfo($campaignId, $contentType) ->then( function ($response) { return $response[0]; @@ -1043,24 +1391,28 @@ function ($response) { * Get a WhatsApp campaign * * @param int $campaignId Id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsAppCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getWhatsAppCampaignAsyncWithHttpInfo($campaignId) + public function getWhatsAppCampaignAsyncWithHttpInfo( + $campaignId, + string $contentType = self::contentTypes['getWhatsAppCampaign'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetWhatsappCampaignOverview'; - $request = $this->getWhatsAppCampaignRequest($campaignId); + $returnType = '\Brevo\Client\Models\GetWhatsappCampaignOverview'; + $request = $this->getWhatsAppCampaignRequest($campaignId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1083,7 +1435,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1093,19 +1445,25 @@ function ($exception) { * Create request for operation 'getWhatsAppCampaign' * * @param int $campaignId Id of the campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsAppCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getWhatsAppCampaignRequest($campaignId) + public function getWhatsAppCampaignRequest( + $campaignId, + string $contentType = self::contentTypes['getWhatsAppCampaign'][0] + ): Request { + // verify the required parameter 'campaignId' is set if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $campaignId when calling getWhatsAppCampaign' ); } + $resourcePath = '/whatsappCampaigns/{campaignId}'; $formParams = []; $queryParams = []; @@ -1114,6 +1472,7 @@ protected function getWhatsAppCampaignRequest($campaignId) $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( @@ -1123,53 +1482,35 @@ protected function getWhatsAppCampaignRequest($campaignId) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1195,10 +1536,11 @@ protected function getWhatsAppCampaignRequest($campaignId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1209,19 +1551,27 @@ protected function getWhatsAppCampaignRequest($campaignId) * * Return all your created WhatsApp campaigns * - * @param string $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the campaigns created. **Prefer to pass your timezone in date-time format for accurate result** (optional) - * @param string $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the campaigns created. **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 in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param string|null $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the WhatsApp campaigns created. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param string|null $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the WhatsApp campaigns created. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsAppCampaigns'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetWhatsappCampaigns + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetWhatsappCampaigns|\Brevo\Client\Models\ErrorModel */ - public function getWhatsAppCampaigns($startDate = null, $endDate = null, $limit = '50', $offset = '0', $sort = 'desc') + public function getWhatsAppCampaigns( + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getWhatsAppCampaigns'][0] + ): \Brevo\Client\Models\GetWhatsappCampaigns { - list($response) = $this->getWhatsAppCampaignsWithHttpInfo($startDate, $endDate, $limit, $offset, $sort); + list($response) = $this->getWhatsAppCampaignsWithHttpInfo($startDate, $endDate, $limit, $offset, $sort, $contentType); return $response; } @@ -1230,20 +1580,27 @@ public function getWhatsAppCampaigns($startDate = null, $endDate = null, $limit * * Return all your created WhatsApp campaigns * - * @param string $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the campaigns created. **Prefer to pass your timezone in date-time format for accurate result** (optional) - * @param string $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the campaigns created. **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 in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param string|null $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the WhatsApp campaigns created. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param string|null $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the WhatsApp campaigns created. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsAppCampaigns'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetWhatsappCampaigns, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetWhatsappCampaigns|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getWhatsAppCampaignsWithHttpInfo($startDate = null, $endDate = null, $limit = '50', $offset = '0', $sort = 'desc') + public function getWhatsAppCampaignsWithHttpInfo( + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getWhatsAppCampaigns'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetWhatsappCampaigns'; - $request = $this->getWhatsAppCampaignsRequest($startDate, $endDate, $limit, $offset, $sort); + $request = $this->getWhatsAppCampaignsRequest($startDate, $endDate, $limit, $offset, $sort, $contentType); try { $options = $this->createHttpClientOption(); @@ -1252,34 +1609,111 @@ public function getWhatsAppCampaignsWithHttpInfo($startDate = null, $endDate = n } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetWhatsappCampaigns', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetWhatsappCampaigns' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetWhatsappCampaigns', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetWhatsappCampaigns'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1294,7 +1728,7 @@ public function getWhatsAppCampaignsWithHttpInfo($startDate = null, $endDate = n case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetWhatsappCampaigns', + '\Brevo\Client\Models\GetWhatsappCampaigns', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1302,7 +1736,7 @@ public function getWhatsAppCampaignsWithHttpInfo($startDate = null, $endDate = n case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1317,18 +1751,26 @@ public function getWhatsAppCampaignsWithHttpInfo($startDate = null, $endDate = n * * Return all your created WhatsApp campaigns * - * @param string $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the campaigns created. **Prefer to pass your timezone in date-time format for accurate result** (optional) - * @param string $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the campaigns created. **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 in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param string|null $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the WhatsApp campaigns created. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param string|null $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the WhatsApp campaigns created. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsAppCampaigns'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getWhatsAppCampaignsAsync($startDate = null, $endDate = null, $limit = '50', $offset = '0', $sort = 'desc') + public function getWhatsAppCampaignsAsync( + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + string $contentType = self::contentTypes['getWhatsAppCampaigns'][0] + ): PromiseInterface { - return $this->getWhatsAppCampaignsAsyncWithHttpInfo($startDate, $endDate, $limit, $offset, $sort) + return $this->getWhatsAppCampaignsAsyncWithHttpInfo($startDate, $endDate, $limit, $offset, $sort, $contentType) ->then( function ($response) { return $response[0]; @@ -1341,29 +1783,37 @@ function ($response) { * * Return all your created WhatsApp campaigns * - * @param string $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the campaigns created. **Prefer to pass your timezone in date-time format for accurate result** (optional) - * @param string $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the campaigns created. **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 in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param string|null $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the WhatsApp campaigns created. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param string|null $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the WhatsApp campaigns created. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsAppCampaigns'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getWhatsAppCampaignsAsyncWithHttpInfo($startDate = null, $endDate = null, $limit = '50', $offset = '0', $sort = 'desc') + public function getWhatsAppCampaignsAsyncWithHttpInfo( + $startDate = null, + $endDate = null, + $limit = 50, + $offset = 0, + $sort = 'desc', + string $contentType = self::contentTypes['getWhatsAppCampaigns'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetWhatsappCampaigns'; - $request = $this->getWhatsAppCampaignsRequest($startDate, $endDate, $limit, $offset, $sort); + $returnType = '\Brevo\Client\Models\GetWhatsappCampaigns'; + $request = $this->getWhatsAppCampaignsRequest($startDate, $endDate, $limit, $offset, $sort, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1386,7 +1836,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1395,23 +1845,36 @@ function ($exception) { /** * Create request for operation 'getWhatsAppCampaigns' * - * @param string $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the campaigns created. **Prefer to pass your timezone in date-time format for accurate result** (optional) - * @param string $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the campaigns created. **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 in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed (optional, default to desc) + * @param string|null $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the WhatsApp campaigns created. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param string|null $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the WhatsApp campaigns created. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsAppCampaigns'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getWhatsAppCampaignsRequest($startDate = null, $endDate = null, $limit = '50', $offset = '0', $sort = 'desc') + public function getWhatsAppCampaignsRequest( + $startDate = null, + $endDate = null, + $limit = 50, + $offset = 0, + $sort = 'desc', + string $contentType = self::contentTypes['getWhatsAppCampaigns'][0] + ): Request { + + + if ($limit !== null && $limit > 100) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling WhatsAppCampaignsApi.getWhatsAppCampaigns, must be smaller than or equal to 100.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling WhatsAppCampaignsApi.getWhatsAppCampaigns, must be smaller than or equal to 100.'); } if ($limit !== null && $limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling WhatsAppCampaignsApi.getWhatsAppCampaigns, must be bigger than or equal to 0.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling WhatsAppCampaignsApi.getWhatsAppCampaigns, must be bigger than or equal to 0.'); } + + $resourcePath = '/whatsappCampaigns'; @@ -1422,74 +1885,82 @@ protected function getWhatsAppCampaignsRequest($startDate = null, $endDate = nul $multipart = false; // query params - if ($startDate !== null) { - $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($endDate !== null) { - $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1515,10 +1986,11 @@ protected function getWhatsAppCampaignsRequest($startDate = null, $endDate = nul $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1529,14 +2001,17 @@ protected function getWhatsAppCampaignsRequest($startDate = null, $endDate = nul * * Get your WhatsApp API account information * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsAppConfig'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetWhatsAppConfig + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetWhatsAppConfig|\Brevo\Client\Models\ErrorModel */ - public function getWhatsAppConfig() + public function getWhatsAppConfig( + string $contentType = self::contentTypes['getWhatsAppConfig'][0] + ): \Brevo\Client\Models\GetWhatsAppConfig { - list($response) = $this->getWhatsAppConfigWithHttpInfo(); + list($response) = $this->getWhatsAppConfigWithHttpInfo($contentType); return $response; } @@ -1545,15 +2020,17 @@ public function getWhatsAppConfig() * * Get your WhatsApp API account information * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsAppConfig'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetWhatsAppConfig, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetWhatsAppConfig|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getWhatsAppConfigWithHttpInfo() + public function getWhatsAppConfigWithHttpInfo( + string $contentType = self::contentTypes['getWhatsAppConfig'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetWhatsAppConfig'; - $request = $this->getWhatsAppConfigRequest(); + $request = $this->getWhatsAppConfigRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -1562,34 +2039,111 @@ public function getWhatsAppConfigWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetWhatsAppConfig', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetWhatsAppConfig' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetWhatsAppConfig', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetWhatsAppConfig'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1604,7 +2158,7 @@ public function getWhatsAppConfigWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetWhatsAppConfig', + '\Brevo\Client\Models\GetWhatsAppConfig', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1612,7 +2166,7 @@ public function getWhatsAppConfigWithHttpInfo() case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1627,13 +2181,16 @@ public function getWhatsAppConfigWithHttpInfo() * * Get your WhatsApp API account information * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsAppConfig'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getWhatsAppConfigAsync() + public function getWhatsAppConfigAsync( + string $contentType = self::contentTypes['getWhatsAppConfig'][0] + ): PromiseInterface { - return $this->getWhatsAppConfigAsyncWithHttpInfo() + return $this->getWhatsAppConfigAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -1646,24 +2203,27 @@ function ($response) { * * Get your WhatsApp API account information * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsAppConfig'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getWhatsAppConfigAsyncWithHttpInfo() + public function getWhatsAppConfigAsyncWithHttpInfo( + string $contentType = self::contentTypes['getWhatsAppConfig'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetWhatsAppConfig'; - $request = $this->getWhatsAppConfigRequest(); + $returnType = '\Brevo\Client\Models\GetWhatsAppConfig'; + $request = $this->getWhatsAppConfigRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1686,7 +2246,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1695,13 +2255,17 @@ function ($exception) { /** * Create request for operation 'getWhatsAppConfig' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsAppConfig'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getWhatsAppConfigRequest() + public function getWhatsAppConfigRequest( + string $contentType = self::contentTypes['getWhatsAppConfig'][0] + ): Request { + $resourcePath = '/whatsappCampaigns/config'; $formParams = []; $queryParams = []; @@ -1711,53 +2275,36 @@ protected function getWhatsAppConfigRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1783,10 +2330,11 @@ protected function getWhatsAppConfigRequest() $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1797,20 +2345,29 @@ protected function getWhatsAppConfigRequest() * * Return all your created WhatsApp templates * - * @param string $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** (optional) - * @param string $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **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 in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string $source source of the template (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Brevo\Client\Model\GetWATemplates + * @param string|null $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param string|null $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string|null $source source of the template (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsAppTemplates'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Brevo\Client\Models\GetWhatsappTemplates|\Brevo\Client\Models\ErrorModel */ - public function getWhatsAppTemplates($startDate = null, $endDate = null, $limit = '50', $offset = '0', $sort = 'desc', $source = null) + public function getWhatsAppTemplates( + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + ?string $source = null, + string $contentType = self::contentTypes['getWhatsAppTemplates'][0] + ): \Brevo\Client\Models\GetWhatsappTemplates { - list($response) = $this->getWhatsAppTemplatesWithHttpInfo($startDate, $endDate, $limit, $offset, $sort, $source); + list($response) = $this->getWhatsAppTemplatesWithHttpInfo($startDate, $endDate, $limit, $offset, $sort, $source, $contentType); return $response; } @@ -1819,21 +2376,29 @@ public function getWhatsAppTemplates($startDate = null, $endDate = null, $limit * * Return all your created WhatsApp templates * - * @param string $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** (optional) - * @param string $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **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 in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string $source source of the template (optional) - * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Brevo\Client\Model\GetWATemplates, HTTP status code, HTTP response headers (array of strings) + * @param string|null $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param string|null $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string|null $source source of the template (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsAppTemplates'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Brevo\Client\Models\GetWhatsappTemplates|\Brevo\Client\Models\ErrorModel, HTTP status code, HTTP response headers (array of strings) */ - public function getWhatsAppTemplatesWithHttpInfo($startDate = null, $endDate = null, $limit = '50', $offset = '0', $sort = 'desc', $source = null) + public function getWhatsAppTemplatesWithHttpInfo( + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + ?string $source = null, + string $contentType = self::contentTypes['getWhatsAppTemplates'][0] + ): array { - $returnType = '\Brevo\Client\Model\GetWATemplates'; - $request = $this->getWhatsAppTemplatesRequest($startDate, $endDate, $limit, $offset, $sort, $source); + $request = $this->getWhatsAppTemplatesRequest($startDate, $endDate, $limit, $offset, $sort, $source, $contentType); try { $options = $this->createHttpClientOption(); @@ -1842,34 +2407,111 @@ public function getWhatsAppTemplatesWithHttpInfo($startDate = null, $endDate = n } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if (in_array('\Brevo\Client\Models\GetWhatsappTemplates', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\GetWhatsappTemplates' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\GetWhatsappTemplates', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if (in_array('\Brevo\Client\Models\ErrorModel', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Brevo\Client\Models\ErrorModel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Brevo\Client\Models\ErrorModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $returnType = '\Brevo\Client\Models\GetWhatsappTemplates'; + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1884,7 +2526,7 @@ public function getWhatsAppTemplatesWithHttpInfo($startDate = null, $endDate = n case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\GetWATemplates', + '\Brevo\Client\Models\GetWhatsappTemplates', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1892,7 +2534,7 @@ public function getWhatsAppTemplatesWithHttpInfo($startDate = null, $endDate = n case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1907,19 +2549,28 @@ public function getWhatsAppTemplatesWithHttpInfo($startDate = null, $endDate = n * * Return all your created WhatsApp templates * - * @param string $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** (optional) - * @param string $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **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 in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string $source source of the template (optional) + * @param string|null $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param string|null $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string|null $source source of the template (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsAppTemplates'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getWhatsAppTemplatesAsync($startDate = null, $endDate = null, $limit = '50', $offset = '0', $sort = 'desc', $source = null) + public function getWhatsAppTemplatesAsync( + ?string $startDate = null, + ?string $endDate = null, + ?int $limit = 50, + ?int $offset = 0, + ?string $sort = 'desc', + ?string $source = null, + string $contentType = self::contentTypes['getWhatsAppTemplates'][0] + ): PromiseInterface { - return $this->getWhatsAppTemplatesAsyncWithHttpInfo($startDate, $endDate, $limit, $offset, $sort, $source) + return $this->getWhatsAppTemplatesAsyncWithHttpInfo($startDate, $endDate, $limit, $offset, $sort, $source, $contentType) ->then( function ($response) { return $response[0]; @@ -1932,30 +2583,39 @@ function ($response) { * * Return all your created WhatsApp templates * - * @param string $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** (optional) - * @param string $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **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 in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string $source source of the template (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @param string|null $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param string|null $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string|null $source source of the template (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsAppTemplates'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function getWhatsAppTemplatesAsyncWithHttpInfo($startDate = null, $endDate = null, $limit = '50', $offset = '0', $sort = 'desc', $source = null) + public function getWhatsAppTemplatesAsyncWithHttpInfo( + $startDate = null, + $endDate = null, + $limit = 50, + $offset = 0, + $sort = 'desc', + $source = null, + string $contentType = self::contentTypes['getWhatsAppTemplates'][0] + ): PromiseInterface { - $returnType = '\Brevo\Client\Model\GetWATemplates'; - $request = $this->getWhatsAppTemplatesRequest($startDate, $endDate, $limit, $offset, $sort, $source); + $returnType = '\Brevo\Client\Models\GetWhatsappTemplates'; + $request = $this->getWhatsAppTemplatesRequest($startDate, $endDate, $limit, $offset, $sort, $source, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1978,7 +2638,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1987,24 +2647,39 @@ function ($exception) { /** * Create request for operation 'getWhatsAppTemplates' * - * @param string $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** (optional) - * @param string $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **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 in the page (optional, default to 0) - * @param string $sort Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed (optional, default to desc) - * @param string $source source of the template (optional) + * @param string|null $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param string|null $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result** (optional) + * @param int|null $limit Number of documents per page (optional, default to 50) + * @param int|null $offset Index of the first document in the page (optional, default to 0) + * @param string|null $sort Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed (optional, default to 'desc') + * @param string|null $source source of the template (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWhatsAppTemplates'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getWhatsAppTemplatesRequest($startDate = null, $endDate = null, $limit = '50', $offset = '0', $sort = 'desc', $source = null) + public function getWhatsAppTemplatesRequest( + $startDate = null, + $endDate = null, + $limit = 50, + $offset = 0, + $sort = 'desc', + $source = null, + string $contentType = self::contentTypes['getWhatsAppTemplates'][0] + ): Request { + + + if ($limit !== null && $limit > 100) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling WhatsAppCampaignsApi.getWhatsAppTemplates, must be smaller than or equal to 100.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling WhatsAppCampaignsApi.getWhatsAppTemplates, must be smaller than or equal to 100.'); } if ($limit !== null && $limit < 0) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling WhatsAppCampaignsApi.getWhatsAppTemplates, must be bigger than or equal to 0.'); + throw new InvalidArgumentException('invalid value for "$limit" when calling WhatsAppCampaignsApi.getWhatsAppTemplates, must be bigger than or equal to 0.'); } + + + $resourcePath = '/whatsappCampaigns/template-list'; @@ -2015,78 +2690,91 @@ protected function getWhatsAppTemplatesRequest($startDate = null, $endDate = nul $multipart = false; // query params - if ($startDate !== null) { - $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($endDate !== null) { - $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($offset !== null) { - $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($source !== null) { - $queryParams['source'] = ObjectSerializer::toQueryValue($source); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $source, + 'source', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2112,10 +2800,11 @@ protected function getWhatsAppTemplatesRequest($startDate = null, $endDate = nul $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2126,15 +2815,19 @@ protected function getWhatsAppTemplatesRequest($startDate = null, $endDate = nul * * Send your WhatsApp template for approval * - * @param int $templateId id of the campaign (required) + * @param int $templateId id of the template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendWhatsAppTemplateApproval'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function sendWhatsAppTemplateApproval($templateId) + public function sendWhatsAppTemplateApproval( + int $templateId, + string $contentType = self::contentTypes['sendWhatsAppTemplateApproval'][0] + ): void { - $this->sendWhatsAppTemplateApprovalWithHttpInfo($templateId); + $this->sendWhatsAppTemplateApprovalWithHttpInfo($templateId, $contentType); } /** @@ -2142,16 +2835,19 @@ public function sendWhatsAppTemplateApproval($templateId) * * Send your WhatsApp template for approval * - * @param int $templateId id of the campaign (required) + * @param int $templateId id of the template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendWhatsAppTemplateApproval'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function sendWhatsAppTemplateApprovalWithHttpInfo($templateId) + public function sendWhatsAppTemplateApprovalWithHttpInfo( + int $templateId, + string $contentType = self::contentTypes['sendWhatsAppTemplateApproval'][0] + ): array { - $returnType = ''; - $request = $this->sendWhatsAppTemplateApprovalRequest($templateId); + $request = $this->sendWhatsAppTemplateApprovalRequest($templateId, $contentType); try { $options = $this->createHttpClientOption(); @@ -2160,26 +2856,21 @@ public function sendWhatsAppTemplateApprovalWithHttpInfo($templateId) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -2188,7 +2879,7 @@ public function sendWhatsAppTemplateApprovalWithHttpInfo($templateId) case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2203,14 +2894,18 @@ public function sendWhatsAppTemplateApprovalWithHttpInfo($templateId) * * Send your WhatsApp template for approval * - * @param int $templateId id of the campaign (required) + * @param int $templateId id of the template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendWhatsAppTemplateApproval'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendWhatsAppTemplateApprovalAsync($templateId) + public function sendWhatsAppTemplateApprovalAsync( + int $templateId, + string $contentType = self::contentTypes['sendWhatsAppTemplateApproval'][0] + ): PromiseInterface { - return $this->sendWhatsAppTemplateApprovalAsyncWithHttpInfo($templateId) + return $this->sendWhatsAppTemplateApprovalAsyncWithHttpInfo($templateId, $contentType) ->then( function ($response) { return $response[0]; @@ -2223,15 +2918,20 @@ function ($response) { * * Send your WhatsApp template for approval * - * @param int $templateId id of the campaign (required) + * @param int $templateId id of the template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendWhatsAppTemplateApproval'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function sendWhatsAppTemplateApprovalAsyncWithHttpInfo($templateId) + public function sendWhatsAppTemplateApprovalAsyncWithHttpInfo( + $templateId, + string $contentType = self::contentTypes['sendWhatsAppTemplateApproval'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->sendWhatsAppTemplateApprovalRequest($templateId); + $request = $this->sendWhatsAppTemplateApprovalRequest($templateId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2250,7 +2950,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2259,20 +2959,26 @@ function ($exception) { /** * Create request for operation 'sendWhatsAppTemplateApproval' * - * @param int $templateId id of the campaign (required) + * @param int $templateId id of the template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendWhatsAppTemplateApproval'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function sendWhatsAppTemplateApprovalRequest($templateId) + public function sendWhatsAppTemplateApprovalRequest( + $templateId, + string $contentType = self::contentTypes['sendWhatsAppTemplateApproval'][0] + ): Request { + // verify the required parameter 'templateId' is set if ($templateId === null || (is_array($templateId) && count($templateId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $templateId when calling sendWhatsAppTemplateApproval' ); } + $resourcePath = '/whatsappCampaigns/template/approval/{templateId}'; $formParams = []; $queryParams = []; @@ -2281,6 +2987,7 @@ protected function sendWhatsAppTemplateApprovalRequest($templateId) $multipart = false; + // path params if ($templateId !== null) { $resourcePath = str_replace( @@ -2290,53 +2997,35 @@ protected function sendWhatsAppTemplateApprovalRequest($templateId) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2362,10 +3051,11 @@ protected function sendWhatsAppTemplateApprovalRequest($templateId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2376,16 +3066,21 @@ protected function sendWhatsAppTemplateApprovalRequest($templateId) * * Update a WhatsApp campaign * - * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\UpdateWhatsAppCampaign $whatsAppCampaign values to update WhatsApp Campaign (optional) + * @param int $campaignId id of the campaign (required) + * @param \Brevo\Client\Models\UpdateWhatsAppCampaign $updateWhatsAppCampaign Values to update a WhatsApp Campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWhatsAppCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return void */ - public function updateWhatsAppCampaign($campaignId, $whatsAppCampaign = null) + public function updateWhatsAppCampaign( + int $campaignId, + \Brevo\Client\Models\UpdateWhatsAppCampaign $updateWhatsAppCampaign, + string $contentType = self::contentTypes['updateWhatsAppCampaign'][0] + ): void { - $this->updateWhatsAppCampaignWithHttpInfo($campaignId, $whatsAppCampaign); + $this->updateWhatsAppCampaignWithHttpInfo($campaignId, $updateWhatsAppCampaign, $contentType); } /** @@ -2393,17 +3088,21 @@ public function updateWhatsAppCampaign($campaignId, $whatsAppCampaign = null) * * Update a WhatsApp campaign * - * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\UpdateWhatsAppCampaign $whatsAppCampaign values to update WhatsApp Campaign (optional) + * @param int $campaignId id of the campaign (required) + * @param \Brevo\Client\Models\UpdateWhatsAppCampaign $updateWhatsAppCampaign Values to update a WhatsApp Campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWhatsAppCampaign'] to see the possible values for this operation * - * @throws \Brevo\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function updateWhatsAppCampaignWithHttpInfo($campaignId, $whatsAppCampaign = null) + public function updateWhatsAppCampaignWithHttpInfo( + int $campaignId, + \Brevo\Client\Models\UpdateWhatsAppCampaign $updateWhatsAppCampaign, + string $contentType = self::contentTypes['updateWhatsAppCampaign'][0] + ): array { - $returnType = ''; - $request = $this->updateWhatsAppCampaignRequest($campaignId, $whatsAppCampaign); + $request = $this->updateWhatsAppCampaignRequest($campaignId, $updateWhatsAppCampaign, $contentType); try { $options = $this->createHttpClientOption(); @@ -2412,26 +3111,21 @@ public function updateWhatsAppCampaignWithHttpInfo($campaignId, $whatsAppCampaig } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + 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()]; @@ -2440,15 +3134,7 @@ public function updateWhatsAppCampaignWithHttpInfo($campaignId, $whatsAppCampaig case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Brevo\Client\Model\ErrorModel', + '\Brevo\Client\Models\ErrorModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2463,15 +3149,20 @@ public function updateWhatsAppCampaignWithHttpInfo($campaignId, $whatsAppCampaig * * Update a WhatsApp campaign * - * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\UpdateWhatsAppCampaign $whatsAppCampaign values to update WhatsApp Campaign (optional) + * @param int $campaignId id of the campaign (required) + * @param \Brevo\Client\Models\UpdateWhatsAppCampaign $updateWhatsAppCampaign Values to update a WhatsApp Campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWhatsAppCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateWhatsAppCampaignAsync($campaignId, $whatsAppCampaign = null) + public function updateWhatsAppCampaignAsync( + int $campaignId, + \Brevo\Client\Models\UpdateWhatsAppCampaign $updateWhatsAppCampaign, + string $contentType = self::contentTypes['updateWhatsAppCampaign'][0] + ): PromiseInterface { - return $this->updateWhatsAppCampaignAsyncWithHttpInfo($campaignId, $whatsAppCampaign) + return $this->updateWhatsAppCampaignAsyncWithHttpInfo($campaignId, $updateWhatsAppCampaign, $contentType) ->then( function ($response) { return $response[0]; @@ -2484,16 +3175,22 @@ function ($response) { * * Update a WhatsApp campaign * - * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\UpdateWhatsAppCampaign $whatsAppCampaign values to update WhatsApp Campaign (optional) + * @param int $campaignId id of the campaign (required) + * @param \Brevo\Client\Models\UpdateWhatsAppCampaign $updateWhatsAppCampaign Values to update a WhatsApp Campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWhatsAppCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function updateWhatsAppCampaignAsyncWithHttpInfo($campaignId, $whatsAppCampaign = null) + public function updateWhatsAppCampaignAsyncWithHttpInfo( + $campaignId, + $updateWhatsAppCampaign, + string $contentType = self::contentTypes['updateWhatsAppCampaign'][0] + ): PromiseInterface { $returnType = ''; - $request = $this->updateWhatsAppCampaignRequest($campaignId, $whatsAppCampaign); + $request = $this->updateWhatsAppCampaignRequest($campaignId, $updateWhatsAppCampaign, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2512,7 +3209,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2521,21 +3218,35 @@ function ($exception) { /** * Create request for operation 'updateWhatsAppCampaign' * - * @param int $campaignId Id of the campaign (required) - * @param \Brevo\Client\Model\UpdateWhatsAppCampaign $whatsAppCampaign values to update WhatsApp Campaign (optional) + * @param int $campaignId id of the campaign (required) + * @param \Brevo\Client\Models\UpdateWhatsAppCampaign $updateWhatsAppCampaign Values to update a WhatsApp Campaign (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWhatsAppCampaign'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updateWhatsAppCampaignRequest($campaignId, $whatsAppCampaign = null) + public function updateWhatsAppCampaignRequest( + $campaignId, + $updateWhatsAppCampaign, + string $contentType = self::contentTypes['updateWhatsAppCampaign'][0] + ): Request { + // verify the required parameter 'campaignId' is set if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $campaignId when calling updateWhatsAppCampaign' ); } + // verify the required parameter 'updateWhatsAppCampaign' is set + if ($updateWhatsAppCampaign === null || (is_array($updateWhatsAppCampaign) && count($updateWhatsAppCampaign) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $updateWhatsAppCampaign when calling updateWhatsAppCampaign' + ); + } + + $resourcePath = '/whatsappCampaigns/{campaignId}'; $formParams = []; $queryParams = []; @@ -2544,6 +3255,7 @@ protected function updateWhatsAppCampaignRequest($campaignId, $whatsAppCampaign $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( @@ -2553,56 +3265,42 @@ protected function updateWhatsAppCampaignRequest($campaignId, $whatsAppCampaign ); } - // body params - $_tempBody = null; - if (isset($whatsAppCampaign)) { - $_tempBody = $whatsAppCampaign; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($updateWhatsAppCampaign)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($updateWhatsAppCampaign)); + } else { + $httpBody = $updateWhatsAppCampaign; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2628,10 +3326,11 @@ protected function updateWhatsAppCampaignRequest($campaignId, $whatsAppCampaign $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2643,7 +3342,7 @@ protected function updateWhatsAppCampaignRequest($campaignId, $whatsAppCampaign * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/lib/ApiException.php b/lib/ApiException.php index 4469789..793c615 100644 --- a/lib/ApiException.php +++ b/lib/ApiException.php @@ -1,76 +1,74 @@ responseHeaders = $responseHeaders; @@ -80,9 +78,9 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ - public function getResponseHeaders() + public function getResponseHeaders(): ?array { return $this->responseHeaders; } @@ -90,31 +88,31 @@ public function getResponseHeaders() /** * Gets the HTTP body of the server response either as Json or string * - * @return mixed HTTP body of the server response either as \stdClass or string + * @return stdClass|string|null HTTP body of the server response either as \stdClass or string */ - public function getResponseBody() + public function getResponseBody(): stdClass|string|null { return $this->responseBody; } /** - * Sets the deseralized response object (during deserialization) + * Sets the deserialized response object (during deserialization) * * @param mixed $obj Deserialized response object * * @return void */ - public function setResponseObject($obj) + public function setResponseObject(mixed $obj): void { $this->responseObject = $obj; } /** - * Gets the deseralized response object (during deserialization) + * Gets the deserialized response object (during deserialization) * * @return mixed the deserialized response object */ - public function getResponseObject() + public function getResponseObject(): mixed { return $this->responseObject; } diff --git a/lib/Configuration.php b/lib/Configuration.php index 802870f..a9c8e02 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -1,118 +1,127 @@ tempFolderPath = sys_get_temp_dir(); - $this->userAgent = 'brevo_clientAPI/v' . $GLOBALS['version'] . '/php'; } /** @@ -131,7 +139,7 @@ public function __construct() * * @return $this */ - public function setApiKey($apiKeyIdentifier, $key) + public function setApiKey(string $apiKeyIdentifier, string $key): static { $this->apiKeys[$apiKeyIdentifier] = $key; return $this; @@ -142,11 +150,11 @@ public function setApiKey($apiKeyIdentifier, $key) * * @param string $apiKeyIdentifier API key identifier (authentication scheme) * - * @return string API key or token + * @return null|string API key or token */ - public function getApiKey($apiKeyIdentifier) + public function getApiKey(string $apiKeyIdentifier): ?string { - return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; + return $this->apiKeys[$apiKeyIdentifier] ?? null; } /** @@ -157,7 +165,7 @@ public function getApiKey($apiKeyIdentifier) * * @return $this */ - public function setApiKeyPrefix($apiKeyIdentifier, $prefix) + public function setApiKeyPrefix(string $apiKeyIdentifier, string $prefix): static { $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; return $this; @@ -168,11 +176,11 @@ public function setApiKeyPrefix($apiKeyIdentifier, $prefix) * * @param string $apiKeyIdentifier API key identifier (authentication scheme) * - * @return string + * @return null|string */ - public function getApiKeyPrefix($apiKeyIdentifier) + public function getApiKeyPrefix(string $apiKeyIdentifier): ?string { - return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; + return $this->apiKeyPrefixes[$apiKeyIdentifier] ?? null; } /** @@ -182,7 +190,7 @@ public function getApiKeyPrefix($apiKeyIdentifier) * * @return $this */ - public function setAccessToken($accessToken) + public function setAccessToken(string $accessToken): static { $this->accessToken = $accessToken; return $this; @@ -193,11 +201,35 @@ public function setAccessToken($accessToken) * * @return string Access token for OAuth */ - public function getAccessToken() + public function getAccessToken(): string { return $this->accessToken; } + /** + * Sets boolean format for query string. + * + * @param string $booleanFormat Boolean format for query string + * + * @return $this + */ + public function setBooleanFormatForQueryString(string $booleanFormat): static + { + $this->booleanFormatForQueryString = $booleanFormat; + + return $this; + } + + /** + * Gets boolean format for query string. + * + * @return string Boolean format for query string + */ + public function getBooleanFormatForQueryString(): string + { + return $this->booleanFormatForQueryString; + } + /** * Sets the username for HTTP basic authentication * @@ -205,7 +237,7 @@ public function getAccessToken() * * @return $this */ - public function setUsername($username) + public function setUsername(string $username): static { $this->username = $username; return $this; @@ -216,7 +248,7 @@ public function setUsername($username) * * @return string Username for HTTP basic authentication */ - public function getUsername() + public function getUsername(): string { return $this->username; } @@ -228,7 +260,7 @@ public function getUsername() * * @return $this */ - public function setPassword($password) + public function setPassword(string $password): static { $this->password = $password; return $this; @@ -239,7 +271,7 @@ public function setPassword($password) * * @return string Password for HTTP basic authentication */ - public function getPassword() + public function getPassword(): string { return $this->password; } @@ -251,7 +283,7 @@ public function getPassword() * * @return $this */ - public function setHost($host) + public function setHost(string $host): static { $this->host = $host; return $this; @@ -262,7 +294,7 @@ public function setHost($host) * * @return string Host */ - public function getHost() + public function getHost(): string { return $this->host; } @@ -272,15 +304,11 @@ public function getHost() * * @param string $userAgent the user agent of the api client * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return $this */ - public function setUserAgent($userAgent) + public function setUserAgent(string $userAgent): static { - if (!is_string($userAgent)) { - throw new \InvalidArgumentException('User-agent must be a string.'); - } - $this->userAgent = $userAgent; return $this; } @@ -290,7 +318,7 @@ public function setUserAgent($userAgent) * * @return string user agent */ - public function getUserAgent() + public function getUserAgent(): string { return $this->userAgent; } @@ -302,7 +330,7 @@ public function getUserAgent() * * @return $this */ - public function setDebug($debug) + public function setDebug(bool $debug): static { $this->debug = $debug; return $this; @@ -313,7 +341,7 @@ public function setDebug($debug) * * @return bool */ - public function getDebug() + public function getDebug(): bool { return $this->debug; } @@ -325,7 +353,7 @@ public function getDebug() * * @return $this */ - public function setDebugFile($debugFile) + public function setDebugFile(string $debugFile): static { $this->debugFile = $debugFile; return $this; @@ -336,7 +364,7 @@ public function setDebugFile($debugFile) * * @return string */ - public function getDebugFile() + public function getDebugFile(): string { return $this->debugFile; } @@ -348,7 +376,7 @@ public function getDebugFile() * * @return $this */ - public function setTempFolderPath($tempFolderPath) + public function setTempFolderPath(string $tempFolderPath): static { $this->tempFolderPath = $tempFolderPath; return $this; @@ -359,7 +387,7 @@ public function setTempFolderPath($tempFolderPath) * * @return string Temp folder path */ - public function getTempFolderPath() + public function getTempFolderPath(): string { return $this->tempFolderPath; } @@ -369,7 +397,7 @@ public function getTempFolderPath() * * @return Configuration */ - public static function getDefaultConfiguration() + public static function getDefaultConfiguration(): Configuration { if (self::$defaultConfiguration === null) { self::$defaultConfiguration = new Configuration(); @@ -379,13 +407,13 @@ public static function getDefaultConfiguration() } /** - * Sets the detault configuration instance + * Sets the default configuration instance * * @param Configuration $config An instance of the Configuration Object * * @return void */ - public static function setDefaultConfiguration(Configuration $config) + public static function setDefaultConfiguration(Configuration $config): void { self::$defaultConfiguration = $config; } @@ -395,12 +423,13 @@ public static function setDefaultConfiguration(Configuration $config) * * @return string The report for debugging */ - public static function toDebugReport() + public static function toDebugReport(): string { $report = 'PHP SDK (Brevo\Client) Debug Report:' . PHP_EOL; $report .= ' OS: ' . php_uname() . PHP_EOL; $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; - $report .= ' OpenAPI Spec Version: 3.0.0' . PHP_EOL; + $report .= ' The version of the OpenAPI document: 3.0.0' . PHP_EOL; + $report .= ' SDK Package Version: 3.0.0' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; @@ -411,9 +440,9 @@ public static function toDebugReport() * * @param string $apiKeyIdentifier name of apikey * - * @return string API key with the prefix + * @return null|string API key with the prefix */ - public function getApiKeyWithPrefix($apiKeyIdentifier) + public function getApiKeyWithPrefix(string $apiKeyIdentifier): ?string { $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); $apiKey = $this->getApiKey($apiKeyIdentifier); @@ -430,4 +459,70 @@ public function getApiKeyWithPrefix($apiKeyIdentifier) return $keyWithPrefix; } + + /** + * Returns an array of host settings + * + * @return array an array of host settings + */ + public function getHostSettings(): array + { + return [ + [ + "url" => "https://api.brevo.com/v3", + "description" => "No description provided", + ] + ]; + } + + /** + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, int $hostIndex, array $variables = null): string + { + if (null === $variables) { + $variables = []; + } + + // check array index out of bound + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); + } + + $host = $hostSettings[$hostIndex]; + $url = $host["url"]; + + // go through variable and assign a value + foreach ($host["variables"] ?? [] as $name => $variable) { + if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + $url = str_replace("{".$name."}", $variables[$name], $url); + } else { + throw new InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); + } + } else { + // use default value + $url = str_replace("{".$name."}", $variable["default_value"], $url); + } + } + + return $url; + } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings(int $index, ?array $variables = null): string + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } } diff --git a/lib/HeaderSelector.php b/lib/HeaderSelector.php index 34df7df..4bf6f1a 100644 --- a/lib/HeaderSelector.php +++ b/lib/HeaderSelector.php @@ -1,52 +1,48 @@ selectContentTypeHeader($contentTypes); + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } + + $headers['Content-Type'] = $contentType; + } + return $headers; } /** - * @param string[] $accept - * @return array + * Return the header 'Accept' based on an array of Accept provided. + * + * @param string[] $accept Array of header + * + * @return null|string Accept (e.g. application/json) */ - public function selectHeadersForMultipart($accept) + private function selectAcceptHeader(array $accept): ?string { - $headers = $this->selectHeaders($accept, []); + # filter out empty entries + $accept = array_filter($accept); - unset($headers['Content-Type']); - return $headers; + if (count($accept) === 0) { + return null; + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + if (count($headersWithJson) === 0) { + return implode(',', $accept); + } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); } /** - * Return the header 'Accept' based on an array of Accept provided + * Given an Accept header, returns an associative array splitting the header and its weight * - * @param string[] $accept Array of header + * @param string $header "Accept" Header * - * @return string Accept (e.g. application/json) + * @return array with the header and its weight */ - private function selectAcceptHeader($accept) + private function getHeaderAndWeight(string $header): array { - if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) { - return null; - } elseif (preg_grep("/application\/json/i", $accept)) { - return 'application/json'; + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; } else { - return implode(',', $accept); + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); } /** - * Return the content type based on an array of content-type provided + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) * - * @param string[] $contentType Array fo content-type + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) * - * @return string Content-Type (e.g. application/json) + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int */ - private function selectContentTypeHeader($contentType) + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int { - 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); + if ($currentWeight <= 1) { + return 1; } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; + } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); } } - diff --git a/lib/Models/AbTestCampaignResult.php b/lib/Models/AbTestCampaignResult.php index 8146788..89f4355 100644 --- a/lib/Models/AbTestCampaignResult.php +++ b/lib/Models/AbTestCampaignResult.php @@ -2,61 +2,63 @@ /** * AbTestCampaignResult * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * AbTestCampaignResult Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class AbTestCampaignResult implements ModelInterface, ArrayAccess +class AbTestCampaignResult extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'abTestCampaignResult'; + protected static string $openAPIModelName = 'abTestCampaignResult'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'winningVersion' => 'string', 'winningCriteria' => 'string', 'winningSubjectLine' => 'string', @@ -70,9 +72,9 @@ class AbTestCampaignResult implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'winningVersion' => null, 'winningCriteria' => null, 'winningSubjectLine' => null, @@ -84,32 +86,35 @@ class AbTestCampaignResult implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'winningVersion' => false, + 'winningCriteria' => false, + 'winningSubjectLine' => false, + 'openRate' => false, + 'clickRate' => false, + 'winningVersionRate' => false, + 'statistics' => false, + 'clickedLinks' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'winningVersion' => 'winningVersion', 'winningCriteria' => 'winningCriteria', 'winningSubjectLine' => 'winningSubjectLine', @@ -123,9 +128,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'winningVersion' => 'setWinningVersion', 'winningCriteria' => 'setWinningCriteria', 'winningSubjectLine' => 'setWinningSubjectLine', @@ -139,9 +144,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'winningVersion' => 'getWinningVersion', 'winningCriteria' => 'getWinningCriteria', 'winningSubjectLine' => 'getWinningSubjectLine', @@ -156,9 +161,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -166,9 +171,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -176,32 +181,20 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const WINNING_VERSION_NOT_AVAILABLE = 'notAvailable'; - const WINNING_VERSION_PENDING = 'pending'; - const WINNING_VERSION_TIE = 'tie'; - const WINNING_VERSION_A = 'A'; - const WINNING_VERSION_B = 'B'; - const WINNING_CRITERIA_OPEN = 'Open'; - const WINNING_CRITERIA_CLICK = 'Click'; - - + public const WINNING_VERSION_NOT_AVAILABLE = 'notAvailable'; + public const WINNING_VERSION_PENDING = 'pending'; + public const WINNING_VERSION_TIE = 'tie'; + public const WINNING_VERSION_A = 'A'; + public const WINNING_VERSION_B = 'B'; + public const WINNING_CRITERIA_OPEN = 'Open'; + public const WINNING_CRITERIA_CLICK = 'Click'; /** * Gets allowable values of the enum @@ -232,45 +225,44 @@ public function getWinningCriteriaAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['winningVersion'] = isset($data['winningVersion']) ? $data['winningVersion'] : null; - $this->container['winningCriteria'] = isset($data['winningCriteria']) ? $data['winningCriteria'] : null; - $this->container['winningSubjectLine'] = isset($data['winningSubjectLine']) ? $data['winningSubjectLine'] : null; - $this->container['openRate'] = isset($data['openRate']) ? $data['openRate'] : null; - $this->container['clickRate'] = isset($data['clickRate']) ? $data['clickRate'] : null; - $this->container['winningVersionRate'] = isset($data['winningVersionRate']) ? $data['winningVersionRate'] : null; - $this->container['statistics'] = isset($data['statistics']) ? $data['statistics'] : null; - $this->container['clickedLinks'] = isset($data['clickedLinks']) ? $data['clickedLinks'] : null; + $this->setIfExists('winningVersion', $data ?? [], null); + $this->setIfExists('winningCriteria', $data ?? [], null); + $this->setIfExists('winningSubjectLine', $data ?? [], null); + $this->setIfExists('openRate', $data ?? [], null); + $this->setIfExists('clickRate', $data ?? [], null); + $this->setIfExists('winningVersionRate', $data ?? [], null); + $this->setIfExists('statistics', $data ?? [], null); + $this->setIfExists('clickedLinks', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; $allowedValues = $this->getWinningVersionAllowableValues(); if (!is_null($this->container['winningVersion']) && !in_array($this->container['winningVersion'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'winningVersion', must be one of '%s'", + "invalid value '%s' for 'winningVersion', must be one of '%s'", + $this->container['winningVersion'], implode("', '", $allowedValues) ); } @@ -278,7 +270,8 @@ public function listInvalidProperties() $allowedValues = $this->getWinningCriteriaAllowableValues(); if (!is_null($this->container['winningCriteria']) && !in_array($this->container['winningCriteria'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'winningCriteria', must be one of '%s'", + "invalid value '%s' for 'winningCriteria', must be one of '%s'", + $this->container['winningCriteria'], implode("', '", $allowedValues) ); } @@ -286,24 +279,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets winningVersion * - * @return string + * @return string|null */ - public function getWinningVersion() + public function getWinningVersion(): ?string { return $this->container['winningVersion']; } @@ -311,17 +292,21 @@ public function getWinningVersion() /** * Sets winningVersion * - * @param string $winningVersion Winning Campaign Info. pending = Campaign has been picked for sending and winning version is yet to be decided, tie = A tie happened between both the versions, notAvailable = Campaign has not yet been picked for sending. + * @param string|null $winningVersion Winning Campaign Info. pending = Campaign has been picked for sending and winning version is yet to be decided, tie = A tie happened between both the versions, notAvailable = Campaign has not yet been picked for sending. * * @return $this */ - public function setWinningVersion($winningVersion) + public function setWinningVersion(?string $winningVersion): static { + if (is_null($winningVersion)) { + throw new InvalidArgumentException('non-nullable winningVersion cannot be null'); + } $allowedValues = $this->getWinningVersionAllowableValues(); - if (!is_null($winningVersion) && !in_array($winningVersion, $allowedValues, true)) { - throw new \InvalidArgumentException( + if (!in_array($winningVersion, $allowedValues, true)) { + throw new InvalidArgumentException( sprintf( - "Invalid value for 'winningVersion', must be one of '%s'", + "Invalid value '%s' for 'winningVersion', must be one of '%s'", + $winningVersion, implode("', '", $allowedValues) ) ); @@ -334,9 +319,9 @@ public function setWinningVersion($winningVersion) /** * Gets winningCriteria * - * @return string + * @return string|null */ - public function getWinningCriteria() + public function getWinningCriteria(): ?string { return $this->container['winningCriteria']; } @@ -344,17 +329,21 @@ public function getWinningCriteria() /** * Sets winningCriteria * - * @param string $winningCriteria Criteria choosen for winning version (Open/Click) + * @param string|null $winningCriteria Criteria choosen for winning version (Open/Click) * * @return $this */ - public function setWinningCriteria($winningCriteria) + public function setWinningCriteria(?string $winningCriteria): static { + if (is_null($winningCriteria)) { + throw new InvalidArgumentException('non-nullable winningCriteria cannot be null'); + } $allowedValues = $this->getWinningCriteriaAllowableValues(); - if (!is_null($winningCriteria) && !in_array($winningCriteria, $allowedValues, true)) { - throw new \InvalidArgumentException( + if (!in_array($winningCriteria, $allowedValues, true)) { + throw new InvalidArgumentException( sprintf( - "Invalid value for 'winningCriteria', must be one of '%s'", + "Invalid value '%s' for 'winningCriteria', must be one of '%s'", + $winningCriteria, implode("', '", $allowedValues) ) ); @@ -367,9 +356,9 @@ public function setWinningCriteria($winningCriteria) /** * Gets winningSubjectLine * - * @return string + * @return string|null */ - public function getWinningSubjectLine() + public function getWinningSubjectLine(): ?string { return $this->container['winningSubjectLine']; } @@ -377,12 +366,15 @@ public function getWinningSubjectLine() /** * Sets winningSubjectLine * - * @param string $winningSubjectLine Subject Line of current winning version + * @param string|null $winningSubjectLine Subject Line of current winning version * * @return $this */ - public function setWinningSubjectLine($winningSubjectLine) + public function setWinningSubjectLine(?string $winningSubjectLine): static { + if (is_null($winningSubjectLine)) { + throw new InvalidArgumentException('non-nullable winningSubjectLine cannot be null'); + } $this->container['winningSubjectLine'] = $winningSubjectLine; return $this; @@ -391,9 +383,9 @@ public function setWinningSubjectLine($winningSubjectLine) /** * Gets openRate * - * @return string + * @return string|null */ - public function getOpenRate() + public function getOpenRate(): ?string { return $this->container['openRate']; } @@ -401,12 +393,15 @@ public function getOpenRate() /** * Sets openRate * - * @param string $openRate Open rate for current winning version + * @param string|null $openRate Open rate for current winning version * * @return $this */ - public function setOpenRate($openRate) + public function setOpenRate(?string $openRate): static { + if (is_null($openRate)) { + throw new InvalidArgumentException('non-nullable openRate cannot be null'); + } $this->container['openRate'] = $openRate; return $this; @@ -415,9 +410,9 @@ public function setOpenRate($openRate) /** * Gets clickRate * - * @return string + * @return string|null */ - public function getClickRate() + public function getClickRate(): ?string { return $this->container['clickRate']; } @@ -425,12 +420,15 @@ public function getClickRate() /** * Sets clickRate * - * @param string $clickRate Click rate for current winning version + * @param string|null $clickRate Click rate for current winning version * * @return $this */ - public function setClickRate($clickRate) + public function setClickRate(?string $clickRate): static { + if (is_null($clickRate)) { + throw new InvalidArgumentException('non-nullable clickRate cannot be null'); + } $this->container['clickRate'] = $clickRate; return $this; @@ -439,9 +437,9 @@ public function setClickRate($clickRate) /** * Gets winningVersionRate * - * @return string + * @return string|null */ - public function getWinningVersionRate() + public function getWinningVersionRate(): ?string { return $this->container['winningVersionRate']; } @@ -449,12 +447,15 @@ public function getWinningVersionRate() /** * Sets winningVersionRate * - * @param string $winningVersionRate Open/Click rate for the winner version + * @param string|null $winningVersionRate Open/Click rate for the winner version * * @return $this */ - public function setWinningVersionRate($winningVersionRate) + public function setWinningVersionRate(?string $winningVersionRate): static { + if (is_null($winningVersionRate)) { + throw new InvalidArgumentException('non-nullable winningVersionRate cannot be null'); + } $this->container['winningVersionRate'] = $winningVersionRate; return $this; @@ -463,9 +464,9 @@ public function setWinningVersionRate($winningVersionRate) /** * Gets statistics * - * @return \Brevo\Client\Models\AbTestCampaignResultStatistics + * @return \Brevo\Client\Models\AbTestCampaignResultStatistics|null */ - public function getStatistics() + public function getStatistics(): ?\Brevo\Client\Models\AbTestCampaignResultStatistics { return $this->container['statistics']; } @@ -473,12 +474,15 @@ public function getStatistics() /** * Sets statistics * - * @param \Brevo\Client\Models\AbTestCampaignResultStatistics $statistics statistics + * @param \Brevo\Client\Models\AbTestCampaignResultStatistics|null $statistics statistics * * @return $this */ - public function setStatistics($statistics) + public function setStatistics(?\Brevo\Client\Models\AbTestCampaignResultStatistics $statistics): static { + if (is_null($statistics)) { + throw new InvalidArgumentException('non-nullable statistics cannot be null'); + } $this->container['statistics'] = $statistics; return $this; @@ -487,9 +491,9 @@ public function setStatistics($statistics) /** * Gets clickedLinks * - * @return \Brevo\Client\Models\AbTestCampaignResultClickedLinks + * @return \Brevo\Client\Models\AbTestCampaignResultClickedLinks|null */ - public function getClickedLinks() + public function getClickedLinks(): ?\Brevo\Client\Models\AbTestCampaignResultClickedLinks { return $this->container['clickedLinks']; } @@ -497,89 +501,19 @@ public function getClickedLinks() /** * Sets clickedLinks * - * @param \Brevo\Client\Models\AbTestCampaignResultClickedLinks $clickedLinks clickedLinks + * @param \Brevo\Client\Models\AbTestCampaignResultClickedLinks|null $clickedLinks clickedLinks * * @return $this */ - public function setClickedLinks($clickedLinks) + public function setClickedLinks(?\Brevo\Client\Models\AbTestCampaignResultClickedLinks $clickedLinks): static { + if (is_null($clickedLinks)) { + throw new InvalidArgumentException('non-nullable clickedLinks cannot be null'); + } $this->container['clickedLinks'] = $clickedLinks; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/AbTestCampaignResultClickedLinks.php b/lib/Models/AbTestCampaignResultClickedLinks.php index 897d99b..ca8bc17 100644 --- a/lib/Models/AbTestCampaignResultClickedLinks.php +++ b/lib/Models/AbTestCampaignResultClickedLinks.php @@ -2,102 +2,101 @@ /** * AbTestCampaignResultClickedLinks * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * AbTestCampaignResultClickedLinks Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class AbTestCampaignResultClickedLinks implements ModelInterface, ArrayAccess +class AbTestCampaignResultClickedLinks extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'abTestCampaignResult_clickedLinks'; + protected static string $openAPIModelName = 'abTestCampaignResult_clickedLinks'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'versionA' => '\Brevo\Client\Models\AbTestVersionClicks', - 'versionB' => '\Brevo\Client\Models\AbTestVersionClicks' + protected static array $openAPITypes = [ + 'versionA' => '\Brevo\Client\Models\AbTestVersionClicksInner[]', + 'versionB' => '\Brevo\Client\Models\AbTestVersionClicksInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'versionA' => null, 'versionB' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'versionA' => false, + 'versionB' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'versionA' => 'Version A', 'versionB' => 'Version B' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'versionA' => 'setVersionA', 'versionB' => 'setVersionB' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'versionA' => 'getVersionA', 'versionB' => 'getVersionB' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,52 +145,38 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['versionA'] = isset($data['versionA']) ? $data['versionA'] : null; - $this->container['versionB'] = isset($data['versionB']) ? $data['versionB'] : null; + $this->setIfExists('versionA', $data ?? [], null); + $this->setIfExists('versionB', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -204,24 +189,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets versionA * - * @return \Brevo\Client\Models\AbTestVersionClicks + * @return \Brevo\Client\Models\AbTestVersionClicksInner[] */ - public function getVersionA() + public function getVersionA(): array { return $this->container['versionA']; } @@ -229,12 +202,15 @@ public function getVersionA() /** * Sets versionA * - * @param \Brevo\Client\Models\AbTestVersionClicks $versionA versionA + * @param \Brevo\Client\Models\AbTestVersionClicksInner[] $versionA Information on clicked links for a particular version * * @return $this */ - public function setVersionA($versionA) + public function setVersionA(array $versionA): static { + if (is_null($versionA)) { + throw new InvalidArgumentException('non-nullable versionA cannot be null'); + } $this->container['versionA'] = $versionA; return $this; @@ -243,9 +219,9 @@ public function setVersionA($versionA) /** * Gets versionB * - * @return \Brevo\Client\Models\AbTestVersionClicks + * @return \Brevo\Client\Models\AbTestVersionClicksInner[] */ - public function getVersionB() + public function getVersionB(): array { return $this->container['versionB']; } @@ -253,89 +229,19 @@ public function getVersionB() /** * Sets versionB * - * @param \Brevo\Client\Models\AbTestVersionClicks $versionB versionB + * @param \Brevo\Client\Models\AbTestVersionClicksInner[] $versionB Information on clicked links for a particular version * * @return $this */ - public function setVersionB($versionB) + public function setVersionB(array $versionB): static { + if (is_null($versionB)) { + throw new InvalidArgumentException('non-nullable versionB cannot be null'); + } $this->container['versionB'] = $versionB; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/AbTestCampaignResultStatistics.php b/lib/Models/AbTestCampaignResultStatistics.php index 5323fe2..48efca7 100644 --- a/lib/Models/AbTestCampaignResultStatistics.php +++ b/lib/Models/AbTestCampaignResultStatistics.php @@ -2,61 +2,63 @@ /** * AbTestCampaignResultStatistics * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * AbTestCampaignResultStatistics Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class AbTestCampaignResultStatistics implements ModelInterface, ArrayAccess +class AbTestCampaignResultStatistics extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'abTestCampaignResult_statistics'; + protected static string $openAPIModelName = 'abTestCampaignResult_statistics'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'openers' => '\Brevo\Client\Models\AbTestVersionStats', 'clicks' => '\Brevo\Client\Models\AbTestVersionStats', 'unsubscribed' => '\Brevo\Client\Models\AbTestVersionStats', @@ -68,9 +70,9 @@ class AbTestCampaignResultStatistics implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'openers' => null, 'clicks' => null, 'unsubscribed' => null, @@ -80,32 +82,33 @@ class AbTestCampaignResultStatistics implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'openers' => false, + 'clicks' => false, + 'unsubscribed' => false, + 'hardBounces' => false, + 'softBounces' => false, + 'complaints' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'openers' => 'openers', 'clicks' => 'clicks', 'unsubscribed' => 'unsubscribed', @@ -117,9 +120,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'openers' => 'setOpeners', 'clicks' => 'setClicks', 'unsubscribed' => 'setUnsubscribed', @@ -131,9 +134,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'openers' => 'getOpeners', 'clicks' => 'getClicks', 'unsubscribed' => 'getUnsubscribed', @@ -146,9 +149,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -156,9 +159,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -166,56 +169,42 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['openers'] = isset($data['openers']) ? $data['openers'] : null; - $this->container['clicks'] = isset($data['clicks']) ? $data['clicks'] : null; - $this->container['unsubscribed'] = isset($data['unsubscribed']) ? $data['unsubscribed'] : null; - $this->container['hardBounces'] = isset($data['hardBounces']) ? $data['hardBounces'] : null; - $this->container['softBounces'] = isset($data['softBounces']) ? $data['softBounces'] : null; - $this->container['complaints'] = isset($data['complaints']) ? $data['complaints'] : null; + $this->setIfExists('openers', $data ?? [], null); + $this->setIfExists('clicks', $data ?? [], null); + $this->setIfExists('unsubscribed', $data ?? [], null); + $this->setIfExists('hardBounces', $data ?? [], null); + $this->setIfExists('softBounces', $data ?? [], null); + $this->setIfExists('complaints', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -240,24 +229,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets openers * * @return \Brevo\Client\Models\AbTestVersionStats */ - public function getOpeners() + public function getOpeners(): \Brevo\Client\Models\AbTestVersionStats { return $this->container['openers']; } @@ -269,8 +246,11 @@ public function getOpeners() * * @return $this */ - public function setOpeners($openers) + public function setOpeners(\Brevo\Client\Models\AbTestVersionStats $openers): static { + if (is_null($openers)) { + throw new InvalidArgumentException('non-nullable openers cannot be null'); + } $this->container['openers'] = $openers; return $this; @@ -281,7 +261,7 @@ public function setOpeners($openers) * * @return \Brevo\Client\Models\AbTestVersionStats */ - public function getClicks() + public function getClicks(): \Brevo\Client\Models\AbTestVersionStats { return $this->container['clicks']; } @@ -293,8 +273,11 @@ public function getClicks() * * @return $this */ - public function setClicks($clicks) + public function setClicks(\Brevo\Client\Models\AbTestVersionStats $clicks): static { + if (is_null($clicks)) { + throw new InvalidArgumentException('non-nullable clicks cannot be null'); + } $this->container['clicks'] = $clicks; return $this; @@ -305,7 +288,7 @@ public function setClicks($clicks) * * @return \Brevo\Client\Models\AbTestVersionStats */ - public function getUnsubscribed() + public function getUnsubscribed(): \Brevo\Client\Models\AbTestVersionStats { return $this->container['unsubscribed']; } @@ -317,8 +300,11 @@ public function getUnsubscribed() * * @return $this */ - public function setUnsubscribed($unsubscribed) + public function setUnsubscribed(\Brevo\Client\Models\AbTestVersionStats $unsubscribed): static { + if (is_null($unsubscribed)) { + throw new InvalidArgumentException('non-nullable unsubscribed cannot be null'); + } $this->container['unsubscribed'] = $unsubscribed; return $this; @@ -329,7 +315,7 @@ public function setUnsubscribed($unsubscribed) * * @return \Brevo\Client\Models\AbTestVersionStats */ - public function getHardBounces() + public function getHardBounces(): \Brevo\Client\Models\AbTestVersionStats { return $this->container['hardBounces']; } @@ -341,8 +327,11 @@ public function getHardBounces() * * @return $this */ - public function setHardBounces($hardBounces) + public function setHardBounces(\Brevo\Client\Models\AbTestVersionStats $hardBounces): static { + if (is_null($hardBounces)) { + throw new InvalidArgumentException('non-nullable hardBounces cannot be null'); + } $this->container['hardBounces'] = $hardBounces; return $this; @@ -353,7 +342,7 @@ public function setHardBounces($hardBounces) * * @return \Brevo\Client\Models\AbTestVersionStats */ - public function getSoftBounces() + public function getSoftBounces(): \Brevo\Client\Models\AbTestVersionStats { return $this->container['softBounces']; } @@ -365,8 +354,11 @@ public function getSoftBounces() * * @return $this */ - public function setSoftBounces($softBounces) + public function setSoftBounces(\Brevo\Client\Models\AbTestVersionStats $softBounces): static { + if (is_null($softBounces)) { + throw new InvalidArgumentException('non-nullable softBounces cannot be null'); + } $this->container['softBounces'] = $softBounces; return $this; @@ -377,7 +369,7 @@ public function setSoftBounces($softBounces) * * @return \Brevo\Client\Models\AbTestVersionStats */ - public function getComplaints() + public function getComplaints(): \Brevo\Client\Models\AbTestVersionStats { return $this->container['complaints']; } @@ -389,85 +381,15 @@ public function getComplaints() * * @return $this */ - public function setComplaints($complaints) + public function setComplaints(\Brevo\Client\Models\AbTestVersionStats $complaints): static { + if (is_null($complaints)) { + throw new InvalidArgumentException('non-nullable complaints cannot be null'); + } $this->container['complaints'] = $complaints; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/AbTestVersionClicks.php b/lib/Models/AbTestVersionClicks.php deleted file mode 100644 index cc38086..0000000 --- a/lib/Models/AbTestVersionClicks.php +++ /dev/null @@ -1,281 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/AbTestVersionClicksInner.php b/lib/Models/AbTestVersionClicksInner.php index 4d60191..02a440f 100644 --- a/lib/Models/AbTestVersionClicksInner.php +++ b/lib/Models/AbTestVersionClicksInner.php @@ -2,61 +2,63 @@ /** * AbTestVersionClicksInner * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * AbTestVersionClicksInner Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class AbTestVersionClicksInner implements ModelInterface, ArrayAccess +class AbTestVersionClicksInner extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'abTestVersionClicks_inner'; + protected static string $openAPIModelName = 'abTestVersionClicks_inner'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'link' => 'string', 'clicksCount' => 'int', 'clickRate' => 'string' @@ -65,41 +67,39 @@ class AbTestVersionClicksInner implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'link' => null, 'clicksCount' => 'int64', 'clickRate' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'link' => false, + 'clicksCount' => false, + 'clickRate' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'link' => 'link', 'clicksCount' => 'clicksCount', 'clickRate' => 'clickRate' @@ -108,9 +108,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'link' => 'setLink', 'clicksCount' => 'setClicksCount', 'clickRate' => 'setClickRate' @@ -119,9 +119,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'link' => 'getLink', 'clicksCount' => 'getClicksCount', 'clickRate' => 'getClickRate' @@ -131,9 +131,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -141,9 +141,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -151,53 +151,39 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['link'] = isset($data['link']) ? $data['link'] : null; - $this->container['clicksCount'] = isset($data['clicksCount']) ? $data['clicksCount'] : null; - $this->container['clickRate'] = isset($data['clickRate']) ? $data['clickRate'] : null; + $this->setIfExists('link', $data ?? [], null); + $this->setIfExists('clicksCount', $data ?? [], null); + $this->setIfExists('clickRate', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -213,24 +199,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets link * * @return string */ - public function getLink() + public function getLink(): string { return $this->container['link']; } @@ -242,8 +216,11 @@ public function getLink() * * @return $this */ - public function setLink($link) + public function setLink(string $link): static { + if (is_null($link)) { + throw new InvalidArgumentException('non-nullable link cannot be null'); + } $this->container['link'] = $link; return $this; @@ -254,7 +231,7 @@ public function setLink($link) * * @return int */ - public function getClicksCount() + public function getClicksCount(): int { return $this->container['clicksCount']; } @@ -266,8 +243,11 @@ public function getClicksCount() * * @return $this */ - public function setClicksCount($clicksCount) + public function setClicksCount(int $clicksCount): static { + if (is_null($clicksCount)) { + throw new InvalidArgumentException('non-nullable clicksCount cannot be null'); + } $this->container['clicksCount'] = $clicksCount; return $this; @@ -278,7 +258,7 @@ public function setClicksCount($clicksCount) * * @return string */ - public function getClickRate() + public function getClickRate(): string { return $this->container['clickRate']; } @@ -290,85 +270,15 @@ public function getClickRate() * * @return $this */ - public function setClickRate($clickRate) + public function setClickRate(string $clickRate): static { + if (is_null($clickRate)) { + throw new InvalidArgumentException('non-nullable clickRate cannot be null'); + } $this->container['clickRate'] = $clickRate; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/AbTestVersionStats.php b/lib/Models/AbTestVersionStats.php index a0e81c9..0711e4d 100644 --- a/lib/Models/AbTestVersionStats.php +++ b/lib/Models/AbTestVersionStats.php @@ -2,62 +2,64 @@ /** * AbTestVersionStats * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * AbTestVersionStats Class Doc Comment * - * @category Class * @description Percentage of a particular event for both versions * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class AbTestVersionStats implements ModelInterface, ArrayAccess +class AbTestVersionStats extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'abTestVersionStats'; + protected static string $openAPIModelName = 'abTestVersionStats'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'versionA' => 'string', 'versionB' => 'string' ]; @@ -65,40 +67,37 @@ class AbTestVersionStats implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'versionA' => null, 'versionB' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'versionA' => false, + 'versionB' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'versionA' => 'Version A', 'versionB' => 'Version B' ]; @@ -106,9 +105,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'versionA' => 'setVersionA', 'versionB' => 'setVersionB' ]; @@ -116,9 +115,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'versionA' => 'getVersionA', 'versionB' => 'getVersionB' ]; @@ -127,9 +126,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -137,9 +136,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -147,52 +146,38 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['versionA'] = isset($data['versionA']) ? $data['versionA'] : null; - $this->container['versionB'] = isset($data['versionB']) ? $data['versionB'] : null; + $this->setIfExists('versionA', $data ?? [], null); + $this->setIfExists('versionB', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -205,24 +190,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets versionA * * @return string */ - public function getVersionA() + public function getVersionA(): string { return $this->container['versionA']; } @@ -234,8 +207,11 @@ public function getVersionA() * * @return $this */ - public function setVersionA($versionA) + public function setVersionA(string $versionA): static { + if (is_null($versionA)) { + throw new InvalidArgumentException('non-nullable versionA cannot be null'); + } $this->container['versionA'] = $versionA; return $this; @@ -246,7 +222,7 @@ public function setVersionA($versionA) * * @return string */ - public function getVersionB() + public function getVersionB(): string { return $this->container['versionB']; } @@ -258,85 +234,15 @@ public function getVersionB() * * @return $this */ - public function setVersionB($versionB) + public function setVersionB(string $versionB): static { + if (is_null($versionB)) { + throw new InvalidArgumentException('non-nullable versionB cannot be null'); + } $this->container['versionB'] = $versionB; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/AbstractModel.php b/lib/Models/AbstractModel.php new file mode 100644 index 0000000..e78f067 --- /dev/null +++ b/lib/Models/AbstractModel.php @@ -0,0 +1,255 @@ + + */ + protected static array $openAPINullables = []; + + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + protected function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + protected function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + protected function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } + + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + +} diff --git a/lib/Models/AddChildDomain.php b/lib/Models/AddChildDomain.php deleted file mode 100644 index 0bb96d1..0000000 --- a/lib/Models/AddChildDomain.php +++ /dev/null @@ -1,305 +0,0 @@ - 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'domain' => 'domain' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'domain' => 'setDomain' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - '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 - */ - public function __construct(array $data = null) - { - $this->container['domain'] = isset($data['domain']) ? $data['domain'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets domain - * - * @return string - */ - public function getDomain() - { - return $this->container['domain']; - } - - /** - * Sets domain - * - * @param string $domain Sender domain to add for a specific child account - * - * @return $this - */ - public function setDomain($domain) - { - $this->container['domain'] = $domain; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/AddContactToList.php b/lib/Models/AddContactToList.php deleted file mode 100644 index c3bd132..0000000 --- a/lib/Models/AddContactToList.php +++ /dev/null @@ -1,335 +0,0 @@ - 'string[]', - 'ids' => 'int[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'emails' => 'email', - 'ids' => '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'emails' => 'emails', - 'ids' => 'ids' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'emails' => 'setEmails', - 'ids' => 'setIds' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'emails' => 'getEmails', - 'ids' => 'getIds' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['emails'] = isset($data['emails']) ? $data['emails'] : null; - $this->container['ids'] = isset($data['ids']) ? $data['ids'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets emails - * - * @return string[] - */ - public function getEmails() - { - return $this->container['emails']; - } - - /** - * Sets emails - * - * @param string[] $emails Mandatory if IDs are not passed, ignored otherwise. Emails to add to a list. You can pass a maximum of 150 emails for addition in one request. If you need to add the emails in bulk, please prefer /contacts/import api. - * - * @return $this - */ - public function setEmails($emails) - { - $this->container['emails'] = $emails; - - return $this; - } - - /** - * Gets ids - * - * @return int[] - */ - public function getIds() - { - return $this->container['ids']; - } - - /** - * Sets ids - * - * @param int[] $ids Mandatory if Emails are not passed, ignored otherwise. Emails to add to a list. You can pass a maximum of 150 emails for addition in one request. If you need to add the emails in bulk, please prefer /contacts/import api. - * - * @return $this - */ - public function setIds($ids) - { - $this->container['ids'] = $ids; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/AddContactToListByEmails.php b/lib/Models/AddContactToListByEmails.php new file mode 100644 index 0000000..71c4208 --- /dev/null +++ b/lib/Models/AddContactToListByEmails.php @@ -0,0 +1,222 @@ + + */ +class AddContactToListByEmails extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'addContactToListByEmails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'emails' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'emails' => 'email' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'emails' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'emails' => 'emails' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'emails' => 'setEmails' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('emails', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['emails']) && (count($this->container['emails']) > 150)) { + $invalidProperties[] = "invalid value for 'emails', number of items must be less than or equal to 150."; + } + + if (!is_null($this->container['emails']) && (count($this->container['emails']) < 1)) { + $invalidProperties[] = "invalid value for 'emails', number of items must be greater than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Gets emails + * + * @return string[]|null + */ + public function getEmails(): ?array + { + return $this->container['emails']; + } + + /** + * Sets emails + * + * @param string[]|null $emails Emails to add to a list. You can pass a **maximum of 150 emails** for addition in one request. **_If you need to add the emails in bulk, please prefer /contacts/import api._** + * + * @return $this + */ + public function setEmails(?array $emails): static + { + if (is_null($emails)) { + throw new InvalidArgumentException('non-nullable emails cannot be null'); + } + + if ((count($emails) > 150)) { + throw new InvalidArgumentException('invalid value for $emails when calling AddContactToListByEmails., number of items must be less than or equal to 150.'); + } + if ((count($emails) < 1)) { + throw new InvalidArgumentException('invalid length for $emails when calling AddContactToListByEmails., number of items must be greater than or equal to 1.'); + } + $this->container['emails'] = $emails; + + return $this; + } +} + + diff --git a/lib/Models/AddContactToListByExtIDs.php b/lib/Models/AddContactToListByExtIDs.php new file mode 100644 index 0000000..2d1f8b2 --- /dev/null +++ b/lib/Models/AddContactToListByExtIDs.php @@ -0,0 +1,222 @@ + + */ +class AddContactToListByExtIDs extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'addContactToListByExtIDs'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'extIds' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'extIds' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'extIds' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'extIds' => 'extIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'extIds' => 'setExtIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'extIds' => 'getExtIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('extIds', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['extIds']) && (count($this->container['extIds']) > 150)) { + $invalidProperties[] = "invalid value for 'extIds', number of items must be less than or equal to 150."; + } + + if (!is_null($this->container['extIds']) && (count($this->container['extIds']) < 1)) { + $invalidProperties[] = "invalid value for 'extIds', number of items must be greater than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Gets extIds + * + * @return string[]|null + */ + public function getExtIds(): ?array + { + return $this->container['extIds']; + } + + /** + * Sets extIds + * + * @param string[]|null $extIds EXT_ID attributes to add to a list. You can pass a **maximum of 150 EXT_ID attributes** for addition in one request. **_If you need to add the emails in bulk, please prefer /contacts/import api._** + * + * @return $this + */ + public function setExtIds(?array $extIds): static + { + if (is_null($extIds)) { + throw new InvalidArgumentException('non-nullable extIds cannot be null'); + } + + if ((count($extIds) > 150)) { + throw new InvalidArgumentException('invalid value for $extIds when calling AddContactToListByExtIDs., number of items must be less than or equal to 150.'); + } + if ((count($extIds) < 1)) { + throw new InvalidArgumentException('invalid length for $extIds when calling AddContactToListByExtIDs., number of items must be greater than or equal to 1.'); + } + $this->container['extIds'] = $extIds; + + return $this; + } +} + + diff --git a/lib/Models/AddContactToListByIDs.php b/lib/Models/AddContactToListByIDs.php new file mode 100644 index 0000000..deaff7f --- /dev/null +++ b/lib/Models/AddContactToListByIDs.php @@ -0,0 +1,222 @@ + + */ +class AddContactToListByIDs extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'addContactToListByIDs'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'ids' => 'int[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'ids' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'ids' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'ids' => 'ids' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'ids' => 'setIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'ids' => 'getIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('ids', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['ids']) && (count($this->container['ids']) > 150)) { + $invalidProperties[] = "invalid value for 'ids', number of items must be less than or equal to 150."; + } + + if (!is_null($this->container['ids']) && (count($this->container['ids']) < 1)) { + $invalidProperties[] = "invalid value for 'ids', number of items must be greater than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Gets ids + * + * @return int[]|null + */ + public function getIds(): ?array + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param int[]|null $ids IDs to add to a list. You can pass a **maximum of 150 IDs** for addition in one request. **_If you need to add the emails in bulk, please prefer /contacts/import api._** + * + * @return $this + */ + public function setIds(?array $ids): static + { + if (is_null($ids)) { + throw new InvalidArgumentException('non-nullable ids cannot be null'); + } + + if ((count($ids) > 150)) { + throw new InvalidArgumentException('invalid value for $ids when calling AddContactToListByIDs., number of items must be less than or equal to 150.'); + } + if ((count($ids) < 1)) { + throw new InvalidArgumentException('invalid length for $ids when calling AddContactToListByIDs., number of items must be greater than or equal to 1.'); + } + $this->container['ids'] = $ids; + + return $this; + } +} + + diff --git a/lib/Models/AddContactToListRequest.php b/lib/Models/AddContactToListRequest.php new file mode 100644 index 0000000..3aaf142 --- /dev/null +++ b/lib/Models/AddContactToListRequest.php @@ -0,0 +1,320 @@ + + */ +class AddContactToListRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'addContactToList_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'emails' => 'string[]', + 'ids' => 'int[]', + 'extIds' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'emails' => 'email', + 'ids' => 'int64', + 'extIds' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'emails' => false, + 'ids' => false, + 'extIds' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'emails' => 'emails', + 'ids' => 'ids', + 'extIds' => 'extIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'emails' => 'setEmails', + 'ids' => 'setIds', + 'extIds' => 'setExtIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'emails' => 'getEmails', + 'ids' => 'getIds', + 'extIds' => 'getExtIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('emails', $data ?? [], null); + $this->setIfExists('ids', $data ?? [], null); + $this->setIfExists('extIds', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['emails']) && (count($this->container['emails']) > 150)) { + $invalidProperties[] = "invalid value for 'emails', number of items must be less than or equal to 150."; + } + + if (!is_null($this->container['emails']) && (count($this->container['emails']) < 1)) { + $invalidProperties[] = "invalid value for 'emails', number of items must be greater than or equal to 1."; + } + + if (!is_null($this->container['ids']) && (count($this->container['ids']) > 150)) { + $invalidProperties[] = "invalid value for 'ids', number of items must be less than or equal to 150."; + } + + if (!is_null($this->container['ids']) && (count($this->container['ids']) < 1)) { + $invalidProperties[] = "invalid value for 'ids', number of items must be greater than or equal to 1."; + } + + if (!is_null($this->container['extIds']) && (count($this->container['extIds']) > 150)) { + $invalidProperties[] = "invalid value for 'extIds', number of items must be less than or equal to 150."; + } + + if (!is_null($this->container['extIds']) && (count($this->container['extIds']) < 1)) { + $invalidProperties[] = "invalid value for 'extIds', number of items must be greater than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Gets emails + * + * @return string[]|null + */ + public function getEmails(): ?array + { + return $this->container['emails']; + } + + /** + * Sets emails + * + * @param string[]|null $emails Emails to add to a list. You can pass a **maximum of 150 emails** for addition in one request. **_If you need to add the emails in bulk, please prefer /contacts/import api._** + * + * @return $this + */ + public function setEmails(?array $emails): static + { + if (is_null($emails)) { + throw new InvalidArgumentException('non-nullable emails cannot be null'); + } + + if ((count($emails) > 150)) { + throw new InvalidArgumentException('invalid value for $emails when calling AddContactToListRequest., number of items must be less than or equal to 150.'); + } + if ((count($emails) < 1)) { + throw new InvalidArgumentException('invalid length for $emails when calling AddContactToListRequest., number of items must be greater than or equal to 1.'); + } + $this->container['emails'] = $emails; + + return $this; + } + + /** + * Gets ids + * + * @return int[]|null + */ + public function getIds(): ?array + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param int[]|null $ids IDs to add to a list. You can pass a **maximum of 150 IDs** for addition in one request. **_If you need to add the emails in bulk, please prefer /contacts/import api._** + * + * @return $this + */ + public function setIds(?array $ids): static + { + if (is_null($ids)) { + throw new InvalidArgumentException('non-nullable ids cannot be null'); + } + + if ((count($ids) > 150)) { + throw new InvalidArgumentException('invalid value for $ids when calling AddContactToListRequest., number of items must be less than or equal to 150.'); + } + if ((count($ids) < 1)) { + throw new InvalidArgumentException('invalid length for $ids when calling AddContactToListRequest., number of items must be greater than or equal to 1.'); + } + $this->container['ids'] = $ids; + + return $this; + } + + /** + * Gets extIds + * + * @return string[]|null + */ + public function getExtIds(): ?array + { + return $this->container['extIds']; + } + + /** + * Sets extIds + * + * @param string[]|null $extIds EXT_ID attributes to add to a list. You can pass a **maximum of 150 EXT_ID attributes** for addition in one request. **_If you need to add the emails in bulk, please prefer /contacts/import api._** + * + * @return $this + */ + public function setExtIds(?array $extIds): static + { + if (is_null($extIds)) { + throw new InvalidArgumentException('non-nullable extIds cannot be null'); + } + + if ((count($extIds) > 150)) { + throw new InvalidArgumentException('invalid value for $extIds when calling AddContactToListRequest., number of items must be less than or equal to 150.'); + } + if ((count($extIds) < 1)) { + throw new InvalidArgumentException('invalid length for $extIds when calling AddContactToListRequest., number of items must be greater than or equal to 1.'); + } + $this->container['extIds'] = $extIds; + + return $this; + } +} + + diff --git a/lib/Models/AddCredits.php b/lib/Models/AddCredits.php deleted file mode 100644 index a98993d..0000000 --- a/lib/Models/AddCredits.php +++ /dev/null @@ -1,335 +0,0 @@ - 'int', - 'email' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'sms' => 'int64', - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'sms' => 'sms', - 'email' => 'email' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'sms' => 'setSms', - 'email' => 'setEmail' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'sms' => 'getSms', - '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 - */ - public function __construct(array $data = null) - { - $this->container['sms'] = isset($data['sms']) ? $data['sms'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets sms - * - * @return int - */ - public function getSms() - { - return $this->container['sms']; - } - - /** - * 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) - { - $this->container['sms'] = $sms; - - return $this; - } - - /** - * Gets email - * - * @return int - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * 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) - { - $this->container['email'] = $email; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/AttributeRewardPayload.php b/lib/Models/AttributeRewardPayload.php new file mode 100644 index 0000000..382b99b --- /dev/null +++ b/lib/Models/AttributeRewardPayload.php @@ -0,0 +1,278 @@ + + */ +class AttributeRewardPayload extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'attributeRewardPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'rewardId' => 'string', + 'contactId' => 'float', + 'loyaltySubscriptionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'rewardId' => 'uuid', + 'contactId' => null, + 'loyaltySubscriptionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'rewardId' => false, + 'contactId' => false, + 'loyaltySubscriptionId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'rewardId' => 'rewardId', + 'contactId' => 'contactId', + 'loyaltySubscriptionId' => 'loyaltySubscriptionId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'rewardId' => 'setRewardId', + 'contactId' => 'setContactId', + 'loyaltySubscriptionId' => 'setLoyaltySubscriptionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'rewardId' => 'getRewardId', + 'contactId' => 'getContactId', + 'loyaltySubscriptionId' => 'getLoyaltySubscriptionId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('rewardId', $data ?? [], null); + $this->setIfExists('contactId', $data ?? [], null); + $this->setIfExists('loyaltySubscriptionId', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['rewardId'] === null) { + $invalidProperties[] = "'rewardId' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets rewardId + * + * @return string + */ + public function getRewardId(): string + { + return $this->container['rewardId']; + } + + /** + * Sets rewardId + * + * @param string $rewardId Reward id + * + * @return $this + */ + public function setRewardId(string $rewardId): static + { + if (is_null($rewardId)) { + throw new InvalidArgumentException('non-nullable rewardId cannot be null'); + } + $this->container['rewardId'] = $rewardId; + + return $this; + } + + /** + * Gets contactId + * + * @return float|null + */ + public function getContactId(): ?float + { + return $this->container['contactId']; + } + + /** + * Sets contactId + * + * @param float|null $contactId Contact to attribute the reward + * + * @return $this + */ + public function setContactId(?float $contactId): static + { + if (is_null($contactId)) { + throw new InvalidArgumentException('non-nullable contactId cannot be null'); + } + $this->container['contactId'] = $contactId; + + return $this; + } + + /** + * Gets loyaltySubscriptionId + * + * @return string|null + */ + public function getLoyaltySubscriptionId(): ?string + { + return $this->container['loyaltySubscriptionId']; + } + + /** + * Sets loyaltySubscriptionId + * + * @param string|null $loyaltySubscriptionId One of contactId or loyaltySubscriptionId is required + * + * @return $this + */ + public function setLoyaltySubscriptionId(?string $loyaltySubscriptionId): static + { + if (is_null($loyaltySubscriptionId)) { + throw new InvalidArgumentException('non-nullable loyaltySubscriptionId cannot be null'); + } + $this->container['loyaltySubscriptionId'] = $loyaltySubscriptionId; + + return $this; + } +} + + diff --git a/lib/Models/AttributedRewardFailedConditionErrorResponse.php b/lib/Models/AttributedRewardFailedConditionErrorResponse.php new file mode 100644 index 0000000..3eb7093 --- /dev/null +++ b/lib/Models/AttributedRewardFailedConditionErrorResponse.php @@ -0,0 +1,207 @@ + + */ +class AttributedRewardFailedConditionErrorResponse extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'attributedRewardFailedConditionErrorResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'error' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'error' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'error' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'error' => 'getError' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets error + * + * @return string|null + */ + public function getError(): ?string + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string|null $error error + * + * @return $this + */ + public function setError(?string $error): static + { + if (is_null($error)) { + throw new InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } +} + + diff --git a/lib/Models/AuthenticateDomainModel.php b/lib/Models/AuthenticateDomainModel.php index 96bf782..b94716a 100644 --- a/lib/Models/AuthenticateDomainModel.php +++ b/lib/Models/AuthenticateDomainModel.php @@ -2,61 +2,63 @@ /** * AuthenticateDomainModel * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * AuthenticateDomainModel Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class AuthenticateDomainModel implements ModelInterface, ArrayAccess +class AuthenticateDomainModel extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'authenticateDomainModel'; + protected static string $openAPIModelName = 'authenticateDomainModel'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'domainName' => 'string', 'message' => 'string' ]; @@ -64,40 +66,37 @@ class AuthenticateDomainModel implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'domainName' => null, 'message' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'domainName' => false, + 'message' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'domainName' => 'domain_name', 'message' => 'message' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'domainName' => 'setDomainName', 'message' => 'setMessage' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'domainName' => 'getDomainName', 'message' => 'getMessage' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,52 +145,38 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['domainName'] = isset($data['domainName']) ? $data['domainName'] : null; - $this->container['message'] = isset($data['message']) ? $data['message'] : null; + $this->setIfExists('domainName', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -204,24 +189,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets domainName * * @return string */ - public function getDomainName() + public function getDomainName(): string { return $this->container['domainName']; } @@ -233,8 +206,11 @@ public function getDomainName() * * @return $this */ - public function setDomainName($domainName) + public function setDomainName(string $domainName): static { + if (is_null($domainName)) { + throw new InvalidArgumentException('non-nullable domainName cannot be null'); + } $this->container['domainName'] = $domainName; return $this; @@ -245,7 +221,7 @@ public function setDomainName($domainName) * * @return string */ - public function getMessage() + public function getMessage(): string { return $this->container['message']; } @@ -257,85 +233,15 @@ public function getMessage() * * @return $this */ - public function setMessage($message) + public function setMessage(string $message): static { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/BadRequestPayload.php b/lib/Models/BadRequestPayload.php new file mode 100644 index 0000000..90f6f61 --- /dev/null +++ b/lib/Models/BadRequestPayload.php @@ -0,0 +1,207 @@ + + */ +class BadRequestPayload extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'badRequestPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'error' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'error' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'error' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'error' => 'getError' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets error + * + * @return string|null + */ + public function getError(): ?string + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string|null $error Readable message associated to the failure + * + * @return $this + */ + public function setError(?string $error): static + { + if (is_null($error)) { + throw new InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } +} + + diff --git a/lib/Models/Balance.php b/lib/Models/Balance.php new file mode 100644 index 0000000..7e9a658 --- /dev/null +++ b/lib/Models/Balance.php @@ -0,0 +1,275 @@ + + */ +class Balance extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'balance'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'loyaltyProgramId' => 'string', + 'contactId' => 'int', + 'balances' => '\Brevo\Client\Models\BalanceBalancesInner[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'loyaltyProgramId' => 'uuid', + 'contactId' => null, + 'balances' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'loyaltyProgramId' => false, + 'contactId' => false, + 'balances' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'loyaltyProgramId' => 'loyaltyProgramId', + 'contactId' => 'contactId', + 'balances' => 'balances' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'loyaltyProgramId' => 'setLoyaltyProgramId', + 'contactId' => 'setContactId', + 'balances' => 'setBalances' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'loyaltyProgramId' => 'getLoyaltyProgramId', + 'contactId' => 'getContactId', + 'balances' => 'getBalances' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('loyaltyProgramId', $data ?? [], null); + $this->setIfExists('contactId', $data ?? [], null); + $this->setIfExists('balances', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets loyaltyProgramId + * + * @return string|null + */ + public function getLoyaltyProgramId(): ?string + { + return $this->container['loyaltyProgramId']; + } + + /** + * Sets loyaltyProgramId + * + * @param string|null $loyaltyProgramId Loyalty program Id + * + * @return $this + */ + public function setLoyaltyProgramId(?string $loyaltyProgramId): static + { + if (is_null($loyaltyProgramId)) { + throw new InvalidArgumentException('non-nullable loyaltyProgramId cannot be null'); + } + $this->container['loyaltyProgramId'] = $loyaltyProgramId; + + return $this; + } + + /** + * Gets contactId + * + * @return int|null + */ + public function getContactId(): ?int + { + return $this->container['contactId']; + } + + /** + * Sets contactId + * + * @param int|null $contactId Contact Id associated with the balance + * + * @return $this + */ + public function setContactId(?int $contactId): static + { + if (is_null($contactId)) { + throw new InvalidArgumentException('non-nullable contactId cannot be null'); + } + $this->container['contactId'] = $contactId; + + return $this; + } + + /** + * Gets balances + * + * @return \Brevo\Client\Models\BalanceBalancesInner[]|null + */ + public function getBalances(): ?array + { + return $this->container['balances']; + } + + /** + * Sets balances + * + * @param \Brevo\Client\Models\BalanceBalancesInner[]|null $balances List of balances + * + * @return $this + */ + public function setBalances(?array $balances): static + { + if (is_null($balances)) { + throw new InvalidArgumentException('non-nullable balances cannot be null'); + } + $this->container['balances'] = $balances; + + return $this; + } +} + + diff --git a/lib/Models/BalanceBalancesInner.php b/lib/Models/BalanceBalancesInner.php new file mode 100644 index 0000000..8e29d0c --- /dev/null +++ b/lib/Models/BalanceBalancesInner.php @@ -0,0 +1,241 @@ + + */ +class BalanceBalancesInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'balance_balances_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'balanceDefinitionId' => 'string', + 'value' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'balanceDefinitionId' => 'uuid', + 'value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'balanceDefinitionId' => false, + 'value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'balanceDefinitionId' => 'balanceDefinitionId', + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'balanceDefinitionId' => 'setBalanceDefinitionId', + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'balanceDefinitionId' => 'getBalanceDefinitionId', + 'value' => 'getValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('balanceDefinitionId', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets balanceDefinitionId + * + * @return string|null + */ + public function getBalanceDefinitionId(): ?string + { + return $this->container['balanceDefinitionId']; + } + + /** + * Sets balanceDefinitionId + * + * @param string|null $balanceDefinitionId Balance definition Id + * + * @return $this + */ + public function setBalanceDefinitionId(?string $balanceDefinitionId): static + { + if (is_null($balanceDefinitionId)) { + throw new InvalidArgumentException('non-nullable balanceDefinitionId cannot be null'); + } + $this->container['balanceDefinitionId'] = $balanceDefinitionId; + + return $this; + } + + /** + * Gets value + * + * @return float|null + */ + public function getValue(): ?float + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param float|null $value The monetary value corresponding to the current balance + * + * @return $this + */ + public function setValue(?float $value): static + { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } + $this->container['value'] = $value; + + return $this; + } +} + + diff --git a/lib/Models/BalanceDefinition.php b/lib/Models/BalanceDefinition.php new file mode 100644 index 0000000..670f197 --- /dev/null +++ b/lib/Models/BalanceDefinition.php @@ -0,0 +1,821 @@ + + */ +class BalanceDefinition extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'balanceDefinition'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'description' => 'string', + 'meta' => 'object', + 'unit' => 'string', + 'minAmount' => 'float', + 'maxAmount' => 'float', + 'maximumCreditAmountLimit' => 'float', + 'maximumDebitAmountLimit' => 'float', + 'balanceOptionAmountOvertakingStrategy' => 'string', + 'balanceOptionCreditRounding' => 'string', + 'balanceOptionDebitRounding' => 'string', + 'balanceAvailabilityDurationValue' => 'float', + 'balanceAvailabilityDurationUnit' => 'string', + 'balanceAvailabilityDurationModifier' => 'string', + 'balanceExpirationDate' => '\DateTime', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'uuid', + 'name' => null, + 'description' => null, + 'meta' => null, + 'unit' => null, + 'minAmount' => null, + 'maxAmount' => null, + 'maximumCreditAmountLimit' => null, + 'maximumDebitAmountLimit' => null, + 'balanceOptionAmountOvertakingStrategy' => null, + 'balanceOptionCreditRounding' => null, + 'balanceOptionDebitRounding' => null, + 'balanceAvailabilityDurationValue' => null, + 'balanceAvailabilityDurationUnit' => null, + 'balanceAvailabilityDurationModifier' => null, + 'balanceExpirationDate' => 'date-time', + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'description' => false, + 'meta' => false, + 'unit' => false, + 'minAmount' => false, + 'maxAmount' => false, + 'maximumCreditAmountLimit' => false, + 'maximumDebitAmountLimit' => false, + 'balanceOptionAmountOvertakingStrategy' => false, + 'balanceOptionCreditRounding' => false, + 'balanceOptionDebitRounding' => false, + 'balanceAvailabilityDurationValue' => false, + 'balanceAvailabilityDurationUnit' => false, + 'balanceAvailabilityDurationModifier' => false, + 'balanceExpirationDate' => false, + 'createdAt' => false, + 'updatedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'description' => 'description', + 'meta' => 'meta', + 'unit' => 'unit', + 'minAmount' => 'minAmount', + 'maxAmount' => 'maxAmount', + 'maximumCreditAmountLimit' => 'maximumCreditAmountLimit', + 'maximumDebitAmountLimit' => 'maximumDebitAmountLimit', + 'balanceOptionAmountOvertakingStrategy' => 'balanceOptionAmountOvertakingStrategy', + 'balanceOptionCreditRounding' => 'balanceOptionCreditRounding', + 'balanceOptionDebitRounding' => 'balanceOptionDebitRounding', + 'balanceAvailabilityDurationValue' => 'balanceAvailabilityDurationValue', + 'balanceAvailabilityDurationUnit' => 'balanceAvailabilityDurationUnit', + 'balanceAvailabilityDurationModifier' => 'balanceAvailabilityDurationModifier', + 'balanceExpirationDate' => 'balanceExpirationDate', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'description' => 'setDescription', + 'meta' => 'setMeta', + 'unit' => 'setUnit', + 'minAmount' => 'setMinAmount', + 'maxAmount' => 'setMaxAmount', + 'maximumCreditAmountLimit' => 'setMaximumCreditAmountLimit', + 'maximumDebitAmountLimit' => 'setMaximumDebitAmountLimit', + 'balanceOptionAmountOvertakingStrategy' => 'setBalanceOptionAmountOvertakingStrategy', + 'balanceOptionCreditRounding' => 'setBalanceOptionCreditRounding', + 'balanceOptionDebitRounding' => 'setBalanceOptionDebitRounding', + 'balanceAvailabilityDurationValue' => 'setBalanceAvailabilityDurationValue', + 'balanceAvailabilityDurationUnit' => 'setBalanceAvailabilityDurationUnit', + 'balanceAvailabilityDurationModifier' => 'setBalanceAvailabilityDurationModifier', + 'balanceExpirationDate' => 'setBalanceExpirationDate', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'description' => 'getDescription', + 'meta' => 'getMeta', + 'unit' => 'getUnit', + 'minAmount' => 'getMinAmount', + 'maxAmount' => 'getMaxAmount', + 'maximumCreditAmountLimit' => 'getMaximumCreditAmountLimit', + 'maximumDebitAmountLimit' => 'getMaximumDebitAmountLimit', + 'balanceOptionAmountOvertakingStrategy' => 'getBalanceOptionAmountOvertakingStrategy', + 'balanceOptionCreditRounding' => 'getBalanceOptionCreditRounding', + 'balanceOptionDebitRounding' => 'getBalanceOptionDebitRounding', + 'balanceAvailabilityDurationValue' => 'getBalanceAvailabilityDurationValue', + 'balanceAvailabilityDurationUnit' => 'getBalanceAvailabilityDurationUnit', + 'balanceAvailabilityDurationModifier' => 'getBalanceAvailabilityDurationModifier', + 'balanceExpirationDate' => 'getBalanceExpirationDate', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const BALANCE_AVAILABILITY_DURATION_MODIFIER_START_OF_PERIOD = 'startOfPeriod'; + public const BALANCE_AVAILABILITY_DURATION_MODIFIER_END_OF_PERIOD = 'endOfPeriod'; + public const BALANCE_AVAILABILITY_DURATION_MODIFIER_NO_MODIFICATION = 'noModification'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getBalanceAvailabilityDurationModifierAllowableValues() + { + return [ + self::BALANCE_AVAILABILITY_DURATION_MODIFIER_START_OF_PERIOD, + self::BALANCE_AVAILABILITY_DURATION_MODIFIER_END_OF_PERIOD, + self::BALANCE_AVAILABILITY_DURATION_MODIFIER_NO_MODIFICATION, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('meta', $data ?? [], null); + $this->setIfExists('unit', $data ?? [], null); + $this->setIfExists('minAmount', $data ?? [], null); + $this->setIfExists('maxAmount', $data ?? [], null); + $this->setIfExists('maximumCreditAmountLimit', $data ?? [], null); + $this->setIfExists('maximumDebitAmountLimit', $data ?? [], null); + $this->setIfExists('balanceOptionAmountOvertakingStrategy', $data ?? [], null); + $this->setIfExists('balanceOptionCreditRounding', $data ?? [], null); + $this->setIfExists('balanceOptionDebitRounding', $data ?? [], null); + $this->setIfExists('balanceAvailabilityDurationValue', $data ?? [], null); + $this->setIfExists('balanceAvailabilityDurationUnit', $data ?? [], null); + $this->setIfExists('balanceAvailabilityDurationModifier', $data ?? [], null); + $this->setIfExists('balanceExpirationDate', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = $this->getBalanceAvailabilityDurationModifierAllowableValues(); + if (!is_null($this->container['balanceAvailabilityDurationModifier']) && !in_array($this->container['balanceAvailabilityDurationModifier'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'balanceAvailabilityDurationModifier', must be one of '%s'", + $this->container['balanceAvailabilityDurationModifier'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique identifier for the balance definition. + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name for the balance definition + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Description for the balance definition + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets meta + * + * @return object|null + */ + public function getMeta(): ?object + { + return $this->container['meta']; + } + + /** + * Sets meta + * + * @param object|null $meta Additional metadata related to the balance definition. + * + * @return $this + */ + public function setMeta(?object $meta): static + { + if (is_null($meta)) { + throw new InvalidArgumentException('non-nullable meta cannot be null'); + } + $this->container['meta'] = $meta; + + return $this; + } + + /** + * Gets unit + * + * @return string|null + */ + public function getUnit(): ?string + { + return $this->container['unit']; + } + + /** + * Sets unit + * + * @param string|null $unit The unit for this balance definition + * + * @return $this + */ + public function setUnit(?string $unit): static + { + if (is_null($unit)) { + throw new InvalidArgumentException('non-nullable unit cannot be null'); + } + $this->container['unit'] = $unit; + + return $this; + } + + /** + * Gets minAmount + * + * @return float|null + */ + public function getMinAmount(): ?float + { + return $this->container['minAmount']; + } + + /** + * Sets minAmount + * + * @param float|null $minAmount Minimum possible amount for balance + * + * @return $this + */ + public function setMinAmount(?float $minAmount): static + { + if (is_null($minAmount)) { + throw new InvalidArgumentException('non-nullable minAmount cannot be null'); + } + $this->container['minAmount'] = $minAmount; + + return $this; + } + + /** + * Gets maxAmount + * + * @return float|null + */ + public function getMaxAmount(): ?float + { + return $this->container['maxAmount']; + } + + /** + * Sets maxAmount + * + * @param float|null $maxAmount Maximum possible amount for balance + * + * @return $this + */ + public function setMaxAmount(?float $maxAmount): static + { + if (is_null($maxAmount)) { + throw new InvalidArgumentException('non-nullable maxAmount cannot be null'); + } + $this->container['maxAmount'] = $maxAmount; + + return $this; + } + + /** + * Gets maximumCreditAmountLimit + * + * @return float|null + */ + public function getMaximumCreditAmountLimit(): ?float + { + return $this->container['maximumCreditAmountLimit']; + } + + /** + * Sets maximumCreditAmountLimit + * + * @param float|null $maximumCreditAmountLimit Maximum credit amount limit per operation + * + * @return $this + */ + public function setMaximumCreditAmountLimit(?float $maximumCreditAmountLimit): static + { + if (is_null($maximumCreditAmountLimit)) { + throw new InvalidArgumentException('non-nullable maximumCreditAmountLimit cannot be null'); + } + $this->container['maximumCreditAmountLimit'] = $maximumCreditAmountLimit; + + return $this; + } + + /** + * Gets maximumDebitAmountLimit + * + * @return float|null + */ + public function getMaximumDebitAmountLimit(): ?float + { + return $this->container['maximumDebitAmountLimit']; + } + + /** + * Sets maximumDebitAmountLimit + * + * @param float|null $maximumDebitAmountLimit Maximum debit amount limit per operation + * + * @return $this + */ + public function setMaximumDebitAmountLimit(?float $maximumDebitAmountLimit): static + { + if (is_null($maximumDebitAmountLimit)) { + throw new InvalidArgumentException('non-nullable maximumDebitAmountLimit cannot be null'); + } + $this->container['maximumDebitAmountLimit'] = $maximumDebitAmountLimit; + + return $this; + } + + /** + * Gets balanceOptionAmountOvertakingStrategy + * + * @return string|null + */ + public function getBalanceOptionAmountOvertakingStrategy(): ?string + { + return $this->container['balanceOptionAmountOvertakingStrategy']; + } + + /** + * Sets balanceOptionAmountOvertakingStrategy + * + * @param string|null $balanceOptionAmountOvertakingStrategy Partial enables partial credit of balance if maximum balance limit is reaching. Strict enables rejection of transaction if it will breach the max credit amount limit. + * + * @return $this + */ + public function setBalanceOptionAmountOvertakingStrategy(?string $balanceOptionAmountOvertakingStrategy): static + { + if (is_null($balanceOptionAmountOvertakingStrategy)) { + throw new InvalidArgumentException('non-nullable balanceOptionAmountOvertakingStrategy cannot be null'); + } + $this->container['balanceOptionAmountOvertakingStrategy'] = $balanceOptionAmountOvertakingStrategy; + + return $this; + } + + /** + * Gets balanceOptionCreditRounding + * + * @return string|null + */ + public function getBalanceOptionCreditRounding(): ?string + { + return $this->container['balanceOptionCreditRounding']; + } + + /** + * Sets balanceOptionCreditRounding + * + * @param string|null $balanceOptionCreditRounding balanceOptionCreditRounding + * + * @return $this + */ + public function setBalanceOptionCreditRounding(?string $balanceOptionCreditRounding): static + { + if (is_null($balanceOptionCreditRounding)) { + throw new InvalidArgumentException('non-nullable balanceOptionCreditRounding cannot be null'); + } + $this->container['balanceOptionCreditRounding'] = $balanceOptionCreditRounding; + + return $this; + } + + /** + * Gets balanceOptionDebitRounding + * + * @return string|null + */ + public function getBalanceOptionDebitRounding(): ?string + { + return $this->container['balanceOptionDebitRounding']; + } + + /** + * Sets balanceOptionDebitRounding + * + * @param string|null $balanceOptionDebitRounding balanceOptionDebitRounding + * + * @return $this + */ + public function setBalanceOptionDebitRounding(?string $balanceOptionDebitRounding): static + { + if (is_null($balanceOptionDebitRounding)) { + throw new InvalidArgumentException('non-nullable balanceOptionDebitRounding cannot be null'); + } + $this->container['balanceOptionDebitRounding'] = $balanceOptionDebitRounding; + + return $this; + } + + /** + * Gets balanceAvailabilityDurationValue + * + * @return float|null + */ + public function getBalanceAvailabilityDurationValue(): ?float + { + return $this->container['balanceAvailabilityDurationValue']; + } + + /** + * Sets balanceAvailabilityDurationValue + * + * @param float|null $balanceAvailabilityDurationValue Number of days/weeks/month/year for balance expiry + * + * @return $this + */ + public function setBalanceAvailabilityDurationValue(?float $balanceAvailabilityDurationValue): static + { + if (is_null($balanceAvailabilityDurationValue)) { + throw new InvalidArgumentException('non-nullable balanceAvailabilityDurationValue cannot be null'); + } + $this->container['balanceAvailabilityDurationValue'] = $balanceAvailabilityDurationValue; + + return $this; + } + + /** + * Gets balanceAvailabilityDurationUnit + * + * @return string|null + */ + public function getBalanceAvailabilityDurationUnit(): ?string + { + return $this->container['balanceAvailabilityDurationUnit']; + } + + /** + * Sets balanceAvailabilityDurationUnit + * + * @param string|null $balanceAvailabilityDurationUnit Unit of time for the balance's availability (e.g., day/week/month/year). + * + * @return $this + */ + public function setBalanceAvailabilityDurationUnit(?string $balanceAvailabilityDurationUnit): static + { + if (is_null($balanceAvailabilityDurationUnit)) { + throw new InvalidArgumentException('non-nullable balanceAvailabilityDurationUnit cannot be null'); + } + $this->container['balanceAvailabilityDurationUnit'] = $balanceAvailabilityDurationUnit; + + return $this; + } + + /** + * Gets balanceAvailabilityDurationModifier + * + * @return string|null + */ + public function getBalanceAvailabilityDurationModifier(): ?string + { + return $this->container['balanceAvailabilityDurationModifier']; + } + + /** + * Sets balanceAvailabilityDurationModifier + * + * @param string|null $balanceAvailabilityDurationModifier startOfPeriod depicts the balancy expiry on start of day/week/month/year. endOfPeriod depicts the balancy expiry on end of day/week/month/year + * + * @return $this + */ + public function setBalanceAvailabilityDurationModifier(?string $balanceAvailabilityDurationModifier): static + { + if (is_null($balanceAvailabilityDurationModifier)) { + throw new InvalidArgumentException('non-nullable balanceAvailabilityDurationModifier cannot be null'); + } + $allowedValues = $this->getBalanceAvailabilityDurationModifierAllowableValues(); + if (!in_array($balanceAvailabilityDurationModifier, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'balanceAvailabilityDurationModifier', must be one of '%s'", + $balanceAvailabilityDurationModifier, + implode("', '", $allowedValues) + ) + ); + } + $this->container['balanceAvailabilityDurationModifier'] = $balanceAvailabilityDurationModifier; + + return $this; + } + + /** + * Gets balanceExpirationDate + * + * @return \DateTime|null + */ + public function getBalanceExpirationDate(): ?\DateTime + { + return $this->container['balanceExpirationDate']; + } + + /** + * Sets balanceExpirationDate + * + * @param \DateTime|null $balanceExpirationDate Date when the balance expires and can no longer be used, in dd/mm format. The balance will be expired when this date appears next in the calendar and only one of balanceExpirationDate or balance availability fields can be used. + * + * @return $this + */ + public function setBalanceExpirationDate(?\DateTime $balanceExpirationDate): static + { + if (is_null($balanceExpirationDate)) { + throw new InvalidArgumentException('non-nullable balanceExpirationDate cannot be null'); + } + $this->container['balanceExpirationDate'] = $balanceExpirationDate; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt createdAt + * + * @return $this + */ + public function setCreatedAt(?\DateTime $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt(): ?\DateTime + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt updatedAt + * + * @return $this + */ + public function setUpdatedAt(?\DateTime $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } +} + + diff --git a/lib/Models/BalanceDefinitionIdDoesNotExist.php b/lib/Models/BalanceDefinitionIdDoesNotExist.php new file mode 100644 index 0000000..24ab052 --- /dev/null +++ b/lib/Models/BalanceDefinitionIdDoesNotExist.php @@ -0,0 +1,207 @@ + + */ +class BalanceDefinitionIdDoesNotExist extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'balanceDefinitionIdDoesNotExist'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'error' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'error' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'error' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'error' => 'getError' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets error + * + * @return string|null + */ + public function getError(): ?string + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string|null $error Provided balance definition id does not exist + * + * @return $this + */ + public function setError(?string $error): static + { + if (is_null($error)) { + throw new InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } +} + + diff --git a/lib/Models/BalanceDefinitionPage.php b/lib/Models/BalanceDefinitionPage.php new file mode 100644 index 0000000..e0ae186 --- /dev/null +++ b/lib/Models/BalanceDefinitionPage.php @@ -0,0 +1,207 @@ + + */ +class BalanceDefinitionPage extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'balanceDefinitionPage'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'items' => '\Brevo\Client\Models\BalanceDefinition[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'items' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'items' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'items' => 'items' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'items' => 'setItems' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'items' => 'getItems' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('items', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets items + * + * @return \Brevo\Client\Models\BalanceDefinition[]|null + */ + public function getItems(): ?array + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \Brevo\Client\Models\BalanceDefinition[]|null $items Balance definition list + * + * @return $this + */ + public function setItems(?array $items): static + { + if (is_null($items)) { + throw new InvalidArgumentException('non-nullable items cannot be null'); + } + $this->container['items'] = $items; + + return $this; + } +} + + diff --git a/lib/Models/BalanceLimit.php b/lib/Models/BalanceLimit.php new file mode 100644 index 0000000..3629448 --- /dev/null +++ b/lib/Models/BalanceLimit.php @@ -0,0 +1,450 @@ + + */ +class BalanceLimit extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'balanceLimit'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'constraintType' => 'string', + 'transactionType' => 'string', + 'durationValue' => 'int', + 'durationUnit' => 'string', + 'value' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'constraintType' => null, + 'transactionType' => null, + 'durationValue' => null, + 'durationUnit' => null, + 'value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'constraintType' => false, + 'transactionType' => false, + 'durationValue' => false, + 'durationUnit' => false, + 'value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'constraintType' => 'constraintType', + 'transactionType' => 'transactionType', + 'durationValue' => 'durationValue', + 'durationUnit' => 'durationUnit', + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'constraintType' => 'setConstraintType', + 'transactionType' => 'setTransactionType', + 'durationValue' => 'setDurationValue', + 'durationUnit' => 'setDurationUnit', + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'constraintType' => 'getConstraintType', + 'transactionType' => 'getTransactionType', + 'durationValue' => 'getDurationValue', + 'durationUnit' => 'getDurationUnit', + 'value' => 'getValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const CONSTRAINT_TYPE_AMOUNT = 'amount'; + public const CONSTRAINT_TYPE_TRANSACTION = 'transaction'; + public const TRANSACTION_TYPE_DEBIT = 'debit'; + public const TRANSACTION_TYPE_CREDIT = 'credit'; + public const DURATION_UNIT_DAY = 'day'; + public const DURATION_UNIT_WEEK = 'week'; + public const DURATION_UNIT_MONTH = 'month'; + public const DURATION_UNIT_YEAR = 'year'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getConstraintTypeAllowableValues() + { + return [ + self::CONSTRAINT_TYPE_AMOUNT, + self::CONSTRAINT_TYPE_TRANSACTION, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTransactionTypeAllowableValues() + { + return [ + self::TRANSACTION_TYPE_DEBIT, + self::TRANSACTION_TYPE_CREDIT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDurationUnitAllowableValues() + { + return [ + self::DURATION_UNIT_DAY, + self::DURATION_UNIT_WEEK, + self::DURATION_UNIT_MONTH, + self::DURATION_UNIT_YEAR, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('constraintType', $data ?? [], 'amount'); + $this->setIfExists('transactionType', $data ?? [], 'debit'); + $this->setIfExists('durationValue', $data ?? [], null); + $this->setIfExists('durationUnit', $data ?? [], 'day'); + $this->setIfExists('value', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = $this->getConstraintTypeAllowableValues(); + if (!is_null($this->container['constraintType']) && !in_array($this->container['constraintType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'constraintType', must be one of '%s'", + $this->container['constraintType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getTransactionTypeAllowableValues(); + if (!is_null($this->container['transactionType']) && !in_array($this->container['transactionType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'transactionType', must be one of '%s'", + $this->container['transactionType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDurationUnitAllowableValues(); + if (!is_null($this->container['durationUnit']) && !in_array($this->container['durationUnit'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'durationUnit', must be one of '%s'", + $this->container['durationUnit'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets constraintType + * + * @return string|null + */ + public function getConstraintType(): ?string + { + return $this->container['constraintType']; + } + + /** + * Sets constraintType + * + * @param string|null $constraintType Select amount to define constraints on amount and transaction to define constraints on transaction + * + * @return $this + */ + public function setConstraintType(?string $constraintType): static + { + if (is_null($constraintType)) { + throw new InvalidArgumentException('non-nullable constraintType cannot be null'); + } + $allowedValues = $this->getConstraintTypeAllowableValues(); + if (!in_array($constraintType, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'constraintType', must be one of '%s'", + $constraintType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['constraintType'] = $constraintType; + + return $this; + } + + /** + * Gets transactionType + * + * @return string|null + */ + public function getTransactionType(): ?string + { + return $this->container['transactionType']; + } + + /** + * Sets transactionType + * + * @param string|null $transactionType Select debit to configure limit for debit transaction type. Select credit to configure limit for credit transaction type + * + * @return $this + */ + public function setTransactionType(?string $transactionType): static + { + if (is_null($transactionType)) { + throw new InvalidArgumentException('non-nullable transactionType cannot be null'); + } + $allowedValues = $this->getTransactionTypeAllowableValues(); + if (!in_array($transactionType, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'transactionType', must be one of '%s'", + $transactionType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['transactionType'] = $transactionType; + + return $this; + } + + /** + * Gets durationValue + * + * @return int|null + */ + public function getDurationValue(): ?int + { + return $this->container['durationValue']; + } + + /** + * Sets durationValue + * + * @param int|null $durationValue Number of days/weeks/month/year for balance limit + * + * @return $this + */ + public function setDurationValue(?int $durationValue): static + { + if (is_null($durationValue)) { + throw new InvalidArgumentException('non-nullable durationValue cannot be null'); + } + $this->container['durationValue'] = $durationValue; + + return $this; + } + + /** + * Gets durationUnit + * + * @return string|null + */ + public function getDurationUnit(): ?string + { + return $this->container['durationUnit']; + } + + /** + * Sets durationUnit + * + * @param string|null $durationUnit Unit for the balance's availability + * + * @return $this + */ + public function setDurationUnit(?string $durationUnit): static + { + if (is_null($durationUnit)) { + throw new InvalidArgumentException('non-nullable durationUnit cannot be null'); + } + $allowedValues = $this->getDurationUnitAllowableValues(); + if (!in_array($durationUnit, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'durationUnit', must be one of '%s'", + $durationUnit, + implode("', '", $allowedValues) + ) + ); + } + $this->container['durationUnit'] = $durationUnit; + + return $this; + } + + /** + * Gets value + * + * @return float|null + */ + public function getValue(): ?float + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param float|null $value The value or amount associated with the balance limit. + * + * @return $this + */ + public function setValue(?float $value): static + { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } + $this->container['value'] = $value; + + return $this; + } +} + + diff --git a/lib/Models/BalanceLimitPayload.php b/lib/Models/BalanceLimitPayload.php new file mode 100644 index 0000000..d914f89 --- /dev/null +++ b/lib/Models/BalanceLimitPayload.php @@ -0,0 +1,484 @@ + + */ +class BalanceLimitPayload extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'balanceLimitPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'transactionType' => 'string', + 'durationValue' => 'int', + 'durationUnit' => 'string', + 'value' => 'float', + 'constraintType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'uuid', + 'transactionType' => null, + 'durationValue' => null, + 'durationUnit' => null, + 'value' => null, + 'constraintType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'transactionType' => false, + 'durationValue' => false, + 'durationUnit' => false, + 'value' => false, + 'constraintType' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'transactionType' => 'transactionType', + 'durationValue' => 'durationValue', + 'durationUnit' => 'durationUnit', + 'value' => 'value', + 'constraintType' => 'constraintType' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'transactionType' => 'setTransactionType', + 'durationValue' => 'setDurationValue', + 'durationUnit' => 'setDurationUnit', + 'value' => 'setValue', + 'constraintType' => 'setConstraintType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'transactionType' => 'getTransactionType', + 'durationValue' => 'getDurationValue', + 'durationUnit' => 'getDurationUnit', + 'value' => 'getValue', + 'constraintType' => 'getConstraintType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const TRANSACTION_TYPE_DEBIT = 'debit'; + public const TRANSACTION_TYPE_CREDIT = 'credit'; + public const DURATION_UNIT_DAY = 'day'; + public const DURATION_UNIT_WEEK = 'week'; + public const DURATION_UNIT_MONTH = 'month'; + public const DURATION_UNIT_YEAR = 'year'; + public const CONSTRAINT_TYPE_AMOUNT = 'amount'; + public const CONSTRAINT_TYPE_TRANSACTION = 'transaction'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTransactionTypeAllowableValues() + { + return [ + self::TRANSACTION_TYPE_DEBIT, + self::TRANSACTION_TYPE_CREDIT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDurationUnitAllowableValues() + { + return [ + self::DURATION_UNIT_DAY, + self::DURATION_UNIT_WEEK, + self::DURATION_UNIT_MONTH, + self::DURATION_UNIT_YEAR, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getConstraintTypeAllowableValues() + { + return [ + self::CONSTRAINT_TYPE_AMOUNT, + self::CONSTRAINT_TYPE_TRANSACTION, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('transactionType', $data ?? [], null); + $this->setIfExists('durationValue', $data ?? [], null); + $this->setIfExists('durationUnit', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('constraintType', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = $this->getTransactionTypeAllowableValues(); + if (!is_null($this->container['transactionType']) && !in_array($this->container['transactionType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'transactionType', must be one of '%s'", + $this->container['transactionType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDurationUnitAllowableValues(); + if (!is_null($this->container['durationUnit']) && !in_array($this->container['durationUnit'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'durationUnit', must be one of '%s'", + $this->container['durationUnit'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getConstraintTypeAllowableValues(); + if (!is_null($this->container['constraintType']) && !in_array($this->container['constraintType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'constraintType', must be one of '%s'", + $this->container['constraintType'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique identifier for the balance limit in UUID format. + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets transactionType + * + * @return string|null + */ + public function getTransactionType(): ?string + { + return $this->container['transactionType']; + } + + /** + * Sets transactionType + * + * @param string|null $transactionType transactionType + * + * @return $this + */ + public function setTransactionType(?string $transactionType): static + { + if (is_null($transactionType)) { + throw new InvalidArgumentException('non-nullable transactionType cannot be null'); + } + $allowedValues = $this->getTransactionTypeAllowableValues(); + if (!in_array($transactionType, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'transactionType', must be one of '%s'", + $transactionType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['transactionType'] = $transactionType; + + return $this; + } + + /** + * Gets durationValue + * + * @return int|null + */ + public function getDurationValue(): ?int + { + return $this->container['durationValue']; + } + + /** + * Sets durationValue + * + * @param int|null $durationValue Number of days/weeks/month/year for balance expiry + * + * @return $this + */ + public function setDurationValue(?int $durationValue): static + { + if (is_null($durationValue)) { + throw new InvalidArgumentException('non-nullable durationValue cannot be null'); + } + $this->container['durationValue'] = $durationValue; + + return $this; + } + + /** + * Gets durationUnit + * + * @return string|null + */ + public function getDurationUnit(): ?string + { + return $this->container['durationUnit']; + } + + /** + * Sets durationUnit + * + * @param string|null $durationUnit Unit of time for the balance's availability (e.g., day/week/month/year). + * + * @return $this + */ + public function setDurationUnit(?string $durationUnit): static + { + if (is_null($durationUnit)) { + throw new InvalidArgumentException('non-nullable durationUnit cannot be null'); + } + $allowedValues = $this->getDurationUnitAllowableValues(); + if (!in_array($durationUnit, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'durationUnit', must be one of '%s'", + $durationUnit, + implode("', '", $allowedValues) + ) + ); + } + $this->container['durationUnit'] = $durationUnit; + + return $this; + } + + /** + * Gets value + * + * @return float|null + */ + public function getValue(): ?float + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param float|null $value The value or amount associated with the balance limit. + * + * @return $this + */ + public function setValue(?float $value): static + { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets constraintType + * + * @return string|null + */ + public function getConstraintType(): ?string + { + return $this->container['constraintType']; + } + + /** + * Sets constraintType + * + * @param string|null $constraintType Defines the type of constraint imposed by the balance limit. + * + * @return $this + */ + public function setConstraintType(?string $constraintType): static + { + if (is_null($constraintType)) { + throw new InvalidArgumentException('non-nullable constraintType cannot be null'); + } + $allowedValues = $this->getConstraintTypeAllowableValues(); + if (!in_array($constraintType, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'constraintType', must be one of '%s'", + $constraintType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['constraintType'] = $constraintType; + + return $this; + } +} + + diff --git a/lib/Models/BalancePage.php b/lib/Models/BalancePage.php new file mode 100644 index 0000000..c688c38 --- /dev/null +++ b/lib/Models/BalancePage.php @@ -0,0 +1,207 @@ + + */ +class BalancePage extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'balancePage'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'balance' => '\Brevo\Client\Models\Balance' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'balance' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'balance' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'balance' => 'balance' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'balance' => 'setBalance' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'balance' => 'getBalance' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('balance', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets balance + * + * @return \Brevo\Client\Models\Balance|null + */ + public function getBalance(): ?\Brevo\Client\Models\Balance + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param \Brevo\Client\Models\Balance|null $balance balance + * + * @return $this + */ + public function setBalance(?\Brevo\Client\Models\Balance $balance): static + { + if (is_null($balance)) { + throw new InvalidArgumentException('non-nullable balance cannot be null'); + } + $this->container['balance'] = $balance; + + return $this; + } +} + + diff --git a/lib/Models/BlockDomain.php b/lib/Models/BlockDomain.php index 5f12045..eb96fe1 100644 --- a/lib/Models/BlockDomain.php +++ b/lib/Models/BlockDomain.php @@ -2,118 +2,116 @@ /** * BlockDomain * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * BlockDomain Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class BlockDomain implements ModelInterface, ArrayAccess +class BlockDomain extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'blockDomain'; + protected static string $openAPIModelName = 'blockDomain'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'domain' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'domain' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'domain' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'domain' => 'domain' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'domain' => 'setDomain' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'domain' => 'getDomain' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,51 +139,37 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['domain'] = isset($data['domain']) ? $data['domain'] : null; + $this->setIfExists('domain', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -195,24 +179,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets domain * * @return string */ - public function getDomain() + public function getDomain(): string { return $this->container['domain']; } @@ -224,85 +196,15 @@ public function getDomain() * * @return $this */ - public function setDomain($domain) + public function setDomain(string $domain): static { + if (is_null($domain)) { + throw new InvalidArgumentException('non-nullable domain cannot be null'); + } $this->container['domain'] = $domain; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/Body.php b/lib/Models/Body.php deleted file mode 100644 index 28f5e2b..0000000 --- a/lib/Models/Body.php +++ /dev/null @@ -1,338 +0,0 @@ - 'string', - 'subAccountIds' => 'int[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'groupName' => null, - 'subAccountIds' => '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'groupName' => 'groupName', - 'subAccountIds' => 'subAccountIds' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'groupName' => 'setGroupName', - 'subAccountIds' => 'setSubAccountIds' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'groupName' => 'getGroupName', - 'subAccountIds' => 'getSubAccountIds' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['groupName'] = isset($data['groupName']) ? $data['groupName'] : null; - $this->container['subAccountIds'] = isset($data['subAccountIds']) ? $data['subAccountIds'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['groupName'] === null) { - $invalidProperties[] = "'groupName' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets groupName - * - * @return string - */ - public function getGroupName() - { - return $this->container['groupName']; - } - - /** - * Sets groupName - * - * @param string $groupName The name of the group of sub-accounts - * - * @return $this - */ - public function setGroupName($groupName) - { - $this->container['groupName'] = $groupName; - - return $this; - } - - /** - * Gets subAccountIds - * - * @return int[] - */ - public function getSubAccountIds() - { - return $this->container['subAccountIds']; - } - - /** - * Sets subAccountIds - * - * @param int[] $subAccountIds Pass the list of sub-account Ids to be included in the group - * - * @return $this - */ - public function setSubAccountIds($subAccountIds) - { - $this->container['subAccountIds'] = $subAccountIds; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/Body1.php b/lib/Models/Body1.php deleted file mode 100644 index 87b3031..0000000 --- a/lib/Models/Body1.php +++ /dev/null @@ -1,338 +0,0 @@ - 'string', - 'subAccountIds' => 'int[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'groupName' => null, - 'subAccountIds' => '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'groupName' => 'groupName', - 'subAccountIds' => 'subAccountIds' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'groupName' => 'setGroupName', - 'subAccountIds' => 'setSubAccountIds' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'groupName' => 'getGroupName', - 'subAccountIds' => 'getSubAccountIds' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['groupName'] = isset($data['groupName']) ? $data['groupName'] : null; - $this->container['subAccountIds'] = isset($data['subAccountIds']) ? $data['subAccountIds'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['groupName'] === null) { - $invalidProperties[] = "'groupName' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets groupName - * - * @return string - */ - public function getGroupName() - { - return $this->container['groupName']; - } - - /** - * Sets groupName - * - * @param string $groupName The name of the group of sub-accounts - * - * @return $this - */ - public function setGroupName($groupName) - { - $this->container['groupName'] = $groupName; - - return $this; - } - - /** - * Gets subAccountIds - * - * @return int[] - */ - public function getSubAccountIds() - { - return $this->container['subAccountIds']; - } - - /** - * Sets subAccountIds - * - * @param int[] $subAccountIds Pass the list of sub-account Ids to be included in the group - * - * @return $this - */ - public function setSubAccountIds($subAccountIds) - { - $this->container['subAccountIds'] = $subAccountIds; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/Body10.php b/lib/Models/Body10.php deleted file mode 100644 index 9d22131..0000000 --- a/lib/Models/Body10.php +++ /dev/null @@ -1,461 +0,0 @@ - 'string', - 'text' => 'string', - 'agentId' => 'string', - 'receivedFrom' => 'string', - 'agentEmail' => 'string', - 'agentName' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'visitorId' => null, - 'text' => null, - 'agentId' => null, - 'receivedFrom' => null, - 'agentEmail' => 'email', - 'agentName' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'visitorId' => 'visitorId', - 'text' => 'text', - 'agentId' => 'agentId', - 'receivedFrom' => 'receivedFrom', - 'agentEmail' => 'agentEmail', - 'agentName' => 'agentName' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'visitorId' => 'setVisitorId', - 'text' => 'setText', - 'agentId' => 'setAgentId', - 'receivedFrom' => 'setReceivedFrom', - 'agentEmail' => 'setAgentEmail', - 'agentName' => 'setAgentName' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'visitorId' => 'getVisitorId', - 'text' => 'getText', - 'agentId' => 'getAgentId', - 'receivedFrom' => 'getReceivedFrom', - 'agentEmail' => 'getAgentEmail', - 'agentName' => 'getAgentName' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['visitorId'] = isset($data['visitorId']) ? $data['visitorId'] : null; - $this->container['text'] = isset($data['text']) ? $data['text'] : null; - $this->container['agentId'] = isset($data['agentId']) ? $data['agentId'] : null; - $this->container['receivedFrom'] = isset($data['receivedFrom']) ? $data['receivedFrom'] : null; - $this->container['agentEmail'] = isset($data['agentEmail']) ? $data['agentEmail'] : null; - $this->container['agentName'] = isset($data['agentName']) ? $data['agentName'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['visitorId'] === null) { - $invalidProperties[] = "'visitorId' can't be null"; - } - if ($this->container['text'] === null) { - $invalidProperties[] = "'text' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets visitorId - * - * @return string - */ - public function getVisitorId() - { - return $this->container['visitorId']; - } - - /** - * Sets visitorId - * - * @param string $visitorId visitor’s ID received from a webhook or generated by you to bind existing user account to Conversations - * - * @return $this - */ - public function setVisitorId($visitorId) - { - $this->container['visitorId'] = $visitorId; - - return $this; - } - - /** - * Gets text - * - * @return string - */ - public function getText() - { - return $this->container['text']; - } - - /** - * Sets text - * - * @param string $text message text - * - * @return $this - */ - public function setText($text) - { - $this->container['text'] = $text; - - return $this; - } - - /** - * Gets agentId - * - * @return string - */ - public function getAgentId() - { - return $this->container['agentId']; - } - - /** - * Sets agentId - * - * @param string $agentId agent ID. It can be found on agent’s page or received from a webhook. Alternatively, you can use `agentEmail` + `agentName` + `receivedFrom` instead (all 3 fields required). - * - * @return $this - */ - public function setAgentId($agentId) - { - $this->container['agentId'] = $agentId; - - return $this; - } - - /** - * Gets receivedFrom - * - * @return string - */ - public function getReceivedFrom() - { - return $this->container['receivedFrom']; - } - - /** - * Sets receivedFrom - * - * @param string $receivedFrom mark your messages to distinguish messages created by you from the others. - * - * @return $this - */ - public function setReceivedFrom($receivedFrom) - { - $this->container['receivedFrom'] = $receivedFrom; - - return $this; - } - - /** - * Gets agentEmail - * - * @return string - */ - public function getAgentEmail() - { - return $this->container['agentEmail']; - } - - /** - * Sets agentEmail - * - * @param string $agentEmail agent email. When sending messages from a standalone system, it’s hard to maintain a 1-to-1 relationship between the users of both systems. In this case, an agent can be specified by their email address. - * - * @return $this - */ - public function setAgentEmail($agentEmail) - { - $this->container['agentEmail'] = $agentEmail; - - return $this; - } - - /** - * Gets agentName - * - * @return string - */ - public function getAgentName() - { - return $this->container['agentName']; - } - - /** - * Sets agentName - * - * @param string $agentName agent name - * - * @return $this - */ - public function setAgentName($agentName) - { - $this->container['agentName'] = $agentName; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/Body11.php b/lib/Models/Body11.php deleted file mode 100644 index ae655cc..0000000 --- a/lib/Models/Body11.php +++ /dev/null @@ -1,308 +0,0 @@ - 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'text' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'text' => 'text' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'text' => 'setText' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'text' => 'getText' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['text'] = isset($data['text']) ? $data['text'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['text'] === null) { - $invalidProperties[] = "'text' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets text - * - * @return string - */ - public function getText() - { - return $this->container['text']; - } - - /** - * Sets text - * - * @param string $text edited message text - * - * @return $this - */ - public function setText($text) - { - $this->container['text'] = $text; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/Body12.php b/lib/Models/Body12.php deleted file mode 100644 index 7f03191..0000000 --- a/lib/Models/Body12.php +++ /dev/null @@ -1,401 +0,0 @@ - 'string', - 'text' => 'string', - 'agentId' => 'string', - 'groupId' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'visitorId' => null, - 'text' => null, - 'agentId' => null, - 'groupId' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'visitorId' => 'visitorId', - 'text' => 'text', - 'agentId' => 'agentId', - 'groupId' => 'groupId' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'visitorId' => 'setVisitorId', - 'text' => 'setText', - 'agentId' => 'setAgentId', - 'groupId' => 'setGroupId' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'visitorId' => 'getVisitorId', - 'text' => 'getText', - 'agentId' => 'getAgentId', - 'groupId' => 'getGroupId' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['visitorId'] = isset($data['visitorId']) ? $data['visitorId'] : null; - $this->container['text'] = isset($data['text']) ? $data['text'] : null; - $this->container['agentId'] = isset($data['agentId']) ? $data['agentId'] : null; - $this->container['groupId'] = isset($data['groupId']) ? $data['groupId'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['visitorId'] === null) { - $invalidProperties[] = "'visitorId' can't be null"; - } - if ($this->container['text'] === null) { - $invalidProperties[] = "'text' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets visitorId - * - * @return string - */ - public function getVisitorId() - { - return $this->container['visitorId']; - } - - /** - * Sets visitorId - * - * @param string $visitorId visitor’s ID received from a webhook or generated by you to bind existing user account to Conversations - * - * @return $this - */ - public function setVisitorId($visitorId) - { - $this->container['visitorId'] = $visitorId; - - return $this; - } - - /** - * Gets text - * - * @return string - */ - public function getText() - { - return $this->container['text']; - } - - /** - * Sets text - * - * @param string $text message text - * - * @return $this - */ - public function setText($text) - { - $this->container['text'] = $text; - - return $this; - } - - /** - * Gets agentId - * - * @return string - */ - public function getAgentId() - { - return $this->container['agentId']; - } - - /** - * Sets agentId - * - * @param string $agentId agent ID. It can be found on agent’s page or received from a webhook. Optional if `groupId` is set. - * - * @return $this - */ - public function setAgentId($agentId) - { - $this->container['agentId'] = $agentId; - - return $this; - } - - /** - * Gets groupId - * - * @return string - */ - public function getGroupId() - { - return $this->container['groupId']; - } - - /** - * Sets groupId - * - * @param string $groupId group ID. It can be found on group’s page. Optional if `agentId` is set. - * - * @return $this - */ - public function setGroupId($groupId) - { - $this->container['groupId'] = $groupId; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/Body13.php b/lib/Models/Body13.php deleted file mode 100644 index b3cca88..0000000 --- a/lib/Models/Body13.php +++ /dev/null @@ -1,308 +0,0 @@ - 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'text' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'text' => 'text' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'text' => 'setText' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'text' => 'getText' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['text'] = isset($data['text']) ? $data['text'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['text'] === null) { - $invalidProperties[] = "'text' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets text - * - * @return string - */ - public function getText() - { - return $this->container['text']; - } - - /** - * Sets text - * - * @param string $text edited message text - * - * @return $this - */ - public function setText($text) - { - $this->container['text'] = $text; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/Body14.php b/lib/Models/Body14.php deleted file mode 100644 index 6dbfeb0..0000000 --- a/lib/Models/Body14.php +++ /dev/null @@ -1,395 +0,0 @@ - 'string', - 'receivedFrom' => 'string', - 'agentEmail' => 'string', - 'agentName' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'agentId' => null, - 'receivedFrom' => null, - 'agentEmail' => 'email', - 'agentName' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'agentId' => 'agentId', - 'receivedFrom' => 'receivedFrom', - 'agentEmail' => 'agentEmail', - 'agentName' => 'agentName' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'agentId' => 'setAgentId', - 'receivedFrom' => 'setReceivedFrom', - 'agentEmail' => 'setAgentEmail', - 'agentName' => 'setAgentName' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'agentId' => 'getAgentId', - 'receivedFrom' => 'getReceivedFrom', - 'agentEmail' => 'getAgentEmail', - 'agentName' => 'getAgentName' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['agentId'] = isset($data['agentId']) ? $data['agentId'] : null; - $this->container['receivedFrom'] = isset($data['receivedFrom']) ? $data['receivedFrom'] : null; - $this->container['agentEmail'] = isset($data['agentEmail']) ? $data['agentEmail'] : null; - $this->container['agentName'] = isset($data['agentName']) ? $data['agentName'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets agentId - * - * @return string - */ - public function getAgentId() - { - return $this->container['agentId']; - } - - /** - * Sets agentId - * - * @param string $agentId agent ID. It can be found on agent’s page or received from a webhook. Alternatively, you can use `agentEmail` + `agentName` + `receivedFrom` instead (all 3 fields required). - * - * @return $this - */ - public function setAgentId($agentId) - { - $this->container['agentId'] = $agentId; - - return $this; - } - - /** - * Gets receivedFrom - * - * @return string - */ - public function getReceivedFrom() - { - return $this->container['receivedFrom']; - } - - /** - * Sets receivedFrom - * - * @param string $receivedFrom mark your messages to distinguish messages created by you from the others. - * - * @return $this - */ - public function setReceivedFrom($receivedFrom) - { - $this->container['receivedFrom'] = $receivedFrom; - - return $this; - } - - /** - * Gets agentEmail - * - * @return string - */ - public function getAgentEmail() - { - return $this->container['agentEmail']; - } - - /** - * Sets agentEmail - * - * @param string $agentEmail agent email. When sending online pings from a standalone system, it’s hard to maintain a 1-to-1 relationship between the users of both systems. In this case, an agent can be specified by their email address. If there’s no agent with the specified email address in your Brevo organization, a dummy agent will be created automatically. - * - * @return $this - */ - public function setAgentEmail($agentEmail) - { - $this->container['agentEmail'] = $agentEmail; - - return $this; - } - - /** - * Gets agentName - * - * @return string - */ - public function getAgentName() - { - return $this->container['agentName']; - } - - /** - * Sets agentName - * - * @param string $agentName agent name. - * - * @return $this - */ - public function setAgentName($agentName) - { - $this->container['agentName'] = $agentName; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/Body2.php b/lib/Models/Body2.php deleted file mode 100644 index 8ab4bc2..0000000 --- a/lib/Models/Body2.php +++ /dev/null @@ -1,368 +0,0 @@ - 'string', - 'attributes' => 'object', - 'countryCode' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'name' => null, - 'attributes' => null, - 'countryCode' => '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'name' => 'name', - 'attributes' => 'attributes', - 'countryCode' => 'countryCode' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'name' => 'setName', - 'attributes' => 'setAttributes', - 'countryCode' => 'setCountryCode' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'name' => 'getName', - 'attributes' => 'getAttributes', - 'countryCode' => 'getCountryCode' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['attributes'] = isset($data['attributes']) ? $data['attributes'] : null; - $this->container['countryCode'] = isset($data['countryCode']) ? $data['countryCode'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Name of company - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets attributes - * - * @return object - */ - public function getAttributes() - { - return $this->container['attributes']; - } - - /** - * Sets attributes - * - * @param object $attributes Attributes for company creation - * - * @return $this - */ - public function setAttributes($attributes) - { - $this->container['attributes'] = $attributes; - - return $this; - } - - /** - * Gets countryCode - * - * @return int - */ - public function getCountryCode() - { - return $this->container['countryCode']; - } - - /** - * Sets countryCode - * - * @param int $countryCode Country code if phone_number is passed in attributes. - * - * @return $this - */ - public function setCountryCode($countryCode) - { - $this->container['countryCode'] = $countryCode; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/Body3.php b/lib/Models/Body3.php deleted file mode 100644 index 27eb898..0000000 --- a/lib/Models/Body3.php +++ /dev/null @@ -1,365 +0,0 @@ - 'string', - 'attributes' => 'object', - 'countryCode' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'name' => null, - 'attributes' => null, - 'countryCode' => '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'name' => 'name', - 'attributes' => 'attributes', - 'countryCode' => 'countryCode' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'name' => 'setName', - 'attributes' => 'setAttributes', - 'countryCode' => 'setCountryCode' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'name' => 'getName', - 'attributes' => 'getAttributes', - 'countryCode' => 'getCountryCode' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['attributes'] = isset($data['attributes']) ? $data['attributes'] : null; - $this->container['countryCode'] = isset($data['countryCode']) ? $data['countryCode'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Name of company - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets attributes - * - * @return object - */ - public function getAttributes() - { - return $this->container['attributes']; - } - - /** - * Sets attributes - * - * @param object $attributes Attributes for company update - * - * @return $this - */ - public function setAttributes($attributes) - { - $this->container['attributes'] = $attributes; - - return $this; - } - - /** - * Gets countryCode - * - * @return int - */ - public function getCountryCode() - { - return $this->container['countryCode']; - } - - /** - * Sets countryCode - * - * @param int $countryCode Country code if phone_number is passed in attributes. - * - * @return $this - */ - public function setCountryCode($countryCode) - { - $this->container['countryCode'] = $countryCode; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/Body4.php b/lib/Models/Body4.php deleted file mode 100644 index 8ff2089..0000000 --- a/lib/Models/Body4.php +++ /dev/null @@ -1,395 +0,0 @@ - 'int[]', - 'unlinkContactIds' => 'int[]', - 'linkDealsIds' => 'string[]', - 'unlinkDealsIds' => 'string[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'linkContactIds' => 'int64', - 'unlinkContactIds' => 'int64', - 'linkDealsIds' => null, - 'unlinkDealsIds' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'linkContactIds' => 'linkContactIds', - 'unlinkContactIds' => 'unlinkContactIds', - 'linkDealsIds' => 'linkDealsIds', - 'unlinkDealsIds' => 'unlinkDealsIds' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'linkContactIds' => 'setLinkContactIds', - 'unlinkContactIds' => 'setUnlinkContactIds', - 'linkDealsIds' => 'setLinkDealsIds', - 'unlinkDealsIds' => 'setUnlinkDealsIds' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'linkContactIds' => 'getLinkContactIds', - 'unlinkContactIds' => 'getUnlinkContactIds', - 'linkDealsIds' => 'getLinkDealsIds', - 'unlinkDealsIds' => 'getUnlinkDealsIds' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['linkContactIds'] = isset($data['linkContactIds']) ? $data['linkContactIds'] : null; - $this->container['unlinkContactIds'] = isset($data['unlinkContactIds']) ? $data['unlinkContactIds'] : null; - $this->container['linkDealsIds'] = isset($data['linkDealsIds']) ? $data['linkDealsIds'] : null; - $this->container['unlinkDealsIds'] = isset($data['unlinkDealsIds']) ? $data['unlinkDealsIds'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets linkContactIds - * - * @return int[] - */ - public function getLinkContactIds() - { - return $this->container['linkContactIds']; - } - - /** - * Sets linkContactIds - * - * @param int[] $linkContactIds Contact ids for contacts to be linked with company - * - * @return $this - */ - public function setLinkContactIds($linkContactIds) - { - $this->container['linkContactIds'] = $linkContactIds; - - return $this; - } - - /** - * Gets unlinkContactIds - * - * @return int[] - */ - public function getUnlinkContactIds() - { - return $this->container['unlinkContactIds']; - } - - /** - * Sets unlinkContactIds - * - * @param int[] $unlinkContactIds Contact ids for contacts to be unlinked from company - * - * @return $this - */ - public function setUnlinkContactIds($unlinkContactIds) - { - $this->container['unlinkContactIds'] = $unlinkContactIds; - - return $this; - } - - /** - * Gets linkDealsIds - * - * @return string[] - */ - public function getLinkDealsIds() - { - return $this->container['linkDealsIds']; - } - - /** - * Sets linkDealsIds - * - * @param string[] $linkDealsIds Deals ids for deals to be linked with company - * - * @return $this - */ - public function setLinkDealsIds($linkDealsIds) - { - $this->container['linkDealsIds'] = $linkDealsIds; - - return $this; - } - - /** - * Gets unlinkDealsIds - * - * @return string[] - */ - public function getUnlinkDealsIds() - { - return $this->container['unlinkDealsIds']; - } - - /** - * Sets unlinkDealsIds - * - * @param string[] $unlinkDealsIds Deals ids for deals to be unlinked from company - * - * @return $this - */ - public function setUnlinkDealsIds($unlinkDealsIds) - { - $this->container['unlinkDealsIds'] = $unlinkDealsIds; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/Body5.php b/lib/Models/Body5.php deleted file mode 100644 index ca95aee..0000000 --- a/lib/Models/Body5.php +++ /dev/null @@ -1,338 +0,0 @@ - 'string', - 'attributes' => 'object' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'name' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'name' => 'name', - 'attributes' => 'attributes' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'name' => 'setName', - 'attributes' => 'setAttributes' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'name' => 'getName', - '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 - */ - public function __construct(array $data = null) - { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['attributes'] = isset($data['attributes']) ? $data['attributes'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Name of deal - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets attributes - * - * @return object - */ - public function getAttributes() - { - return $this->container['attributes']; - } - - /** - * Sets attributes - * - * @param object $attributes Attributes for deal creation If you want to create a deal on a specific pipeline and stage you can use the following attributes `pipeline` and `deal_stage`. Pipeline and deal_stage are ids you can fetch using this endpoint `/crm/pipeline/details/{pipelineID}` - * - * @return $this - */ - public function setAttributes($attributes) - { - $this->container['attributes'] = $attributes; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/Body6.php b/lib/Models/Body6.php deleted file mode 100644 index 4048ce3..0000000 --- a/lib/Models/Body6.php +++ /dev/null @@ -1,335 +0,0 @@ - 'string', - 'attributes' => 'object' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'name' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'name' => 'name', - 'attributes' => 'attributes' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'name' => 'setName', - 'attributes' => 'setAttributes' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'name' => 'getName', - '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 - */ - public function __construct(array $data = null) - { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['attributes'] = isset($data['attributes']) ? $data['attributes'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Name of deal - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets attributes - * - * @return object - */ - public function getAttributes() - { - return $this->container['attributes']; - } - - /** - * Sets attributes - * - * @param object $attributes Attributes for deal update If you wish to update the pipeline of a deal you need to provide the `pipeline` and the `deal_stage`. Pipeline and deal_stage are ids you can fetch using this endpoint `/crm/pipeline/details/{pipelineID}` - * - * @return $this - */ - public function setAttributes($attributes) - { - $this->container['attributes'] = $attributes; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/Body7.php b/lib/Models/Body7.php deleted file mode 100644 index e592cda..0000000 --- a/lib/Models/Body7.php +++ /dev/null @@ -1,395 +0,0 @@ - 'int[]', - 'unlinkContactIds' => 'int[]', - 'linkCompanyIds' => 'string[]', - 'unlinkCompanyIds' => 'string[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'linkContactIds' => 'int64', - 'unlinkContactIds' => 'int64', - 'linkCompanyIds' => null, - 'unlinkCompanyIds' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'linkContactIds' => 'linkContactIds', - 'unlinkContactIds' => 'unlinkContactIds', - 'linkCompanyIds' => 'linkCompanyIds', - 'unlinkCompanyIds' => 'unlinkCompanyIds' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'linkContactIds' => 'setLinkContactIds', - 'unlinkContactIds' => 'setUnlinkContactIds', - 'linkCompanyIds' => 'setLinkCompanyIds', - 'unlinkCompanyIds' => 'setUnlinkCompanyIds' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'linkContactIds' => 'getLinkContactIds', - 'unlinkContactIds' => 'getUnlinkContactIds', - 'linkCompanyIds' => 'getLinkCompanyIds', - 'unlinkCompanyIds' => 'getUnlinkCompanyIds' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['linkContactIds'] = isset($data['linkContactIds']) ? $data['linkContactIds'] : null; - $this->container['unlinkContactIds'] = isset($data['unlinkContactIds']) ? $data['unlinkContactIds'] : null; - $this->container['linkCompanyIds'] = isset($data['linkCompanyIds']) ? $data['linkCompanyIds'] : null; - $this->container['unlinkCompanyIds'] = isset($data['unlinkCompanyIds']) ? $data['unlinkCompanyIds'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets linkContactIds - * - * @return int[] - */ - public function getLinkContactIds() - { - return $this->container['linkContactIds']; - } - - /** - * Sets linkContactIds - * - * @param int[] $linkContactIds Contact ids for contacts to be linked with deal - * - * @return $this - */ - public function setLinkContactIds($linkContactIds) - { - $this->container['linkContactIds'] = $linkContactIds; - - return $this; - } - - /** - * Gets unlinkContactIds - * - * @return int[] - */ - public function getUnlinkContactIds() - { - return $this->container['unlinkContactIds']; - } - - /** - * Sets unlinkContactIds - * - * @param int[] $unlinkContactIds Contact ids for contacts to be unlinked from deal - * - * @return $this - */ - public function setUnlinkContactIds($unlinkContactIds) - { - $this->container['unlinkContactIds'] = $unlinkContactIds; - - return $this; - } - - /** - * Gets linkCompanyIds - * - * @return string[] - */ - public function getLinkCompanyIds() - { - return $this->container['linkCompanyIds']; - } - - /** - * Sets linkCompanyIds - * - * @param string[] $linkCompanyIds Company ids to be linked with deal - * - * @return $this - */ - public function setLinkCompanyIds($linkCompanyIds) - { - $this->container['linkCompanyIds'] = $linkCompanyIds; - - return $this; - } - - /** - * Gets unlinkCompanyIds - * - * @return string[] - */ - public function getUnlinkCompanyIds() - { - return $this->container['unlinkCompanyIds']; - } - - /** - * Sets unlinkCompanyIds - * - * @param string[] $unlinkCompanyIds Company ids to be unlinked from deal - * - * @return $this - */ - public function setUnlinkCompanyIds($unlinkCompanyIds) - { - $this->container['unlinkCompanyIds'] = $unlinkCompanyIds; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/Body9.php b/lib/Models/Body9.php deleted file mode 100644 index eb47b5f..0000000 --- a/lib/Models/Body9.php +++ /dev/null @@ -1,575 +0,0 @@ - 'string', - 'duration' => 'int', - 'taskTypeId' => 'string', - 'date' => '\DateTime', - 'notes' => 'string', - 'done' => 'bool', - 'assignToId' => 'string', - 'contactsIds' => 'int[]', - 'dealsIds' => 'string[]', - 'companiesIds' => 'string[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'name' => null, - 'duration' => null, - 'taskTypeId' => null, - 'date' => 'date-time', - 'notes' => null, - 'done' => null, - 'assignToId' => null, - 'contactsIds' => null, - 'dealsIds' => null, - 'companiesIds' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'name' => 'name', - 'duration' => 'duration', - 'taskTypeId' => 'taskTypeId', - 'date' => 'date', - 'notes' => 'notes', - 'done' => 'done', - 'assignToId' => 'assignToId', - 'contactsIds' => 'contactsIds', - 'dealsIds' => 'dealsIds', - 'companiesIds' => 'companiesIds' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'name' => 'setName', - 'duration' => 'setDuration', - 'taskTypeId' => 'setTaskTypeId', - 'date' => 'setDate', - 'notes' => 'setNotes', - 'done' => 'setDone', - 'assignToId' => 'setAssignToId', - 'contactsIds' => 'setContactsIds', - 'dealsIds' => 'setDealsIds', - 'companiesIds' => 'setCompaniesIds' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'name' => 'getName', - 'duration' => 'getDuration', - 'taskTypeId' => 'getTaskTypeId', - 'date' => 'getDate', - 'notes' => 'getNotes', - 'done' => 'getDone', - 'assignToId' => 'getAssignToId', - 'contactsIds' => 'getContactsIds', - 'dealsIds' => 'getDealsIds', - 'companiesIds' => 'getCompaniesIds' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['duration'] = isset($data['duration']) ? $data['duration'] : null; - $this->container['taskTypeId'] = isset($data['taskTypeId']) ? $data['taskTypeId'] : null; - $this->container['date'] = isset($data['date']) ? $data['date'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['done'] = isset($data['done']) ? $data['done'] : null; - $this->container['assignToId'] = isset($data['assignToId']) ? $data['assignToId'] : null; - $this->container['contactsIds'] = isset($data['contactsIds']) ? $data['contactsIds'] : null; - $this->container['dealsIds'] = isset($data['dealsIds']) ? $data['dealsIds'] : null; - $this->container['companiesIds'] = isset($data['companiesIds']) ? $data['companiesIds'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Name of task - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets duration - * - * @return int - */ - public function getDuration() - { - return $this->container['duration']; - } - - /** - * Sets duration - * - * @param int $duration Duration of task in milliseconds [1 minute = 60000 ms] - * - * @return $this - */ - public function setDuration($duration) - { - $this->container['duration'] = $duration; - - return $this; - } - - /** - * Gets taskTypeId - * - * @return string - */ - public function getTaskTypeId() - { - return $this->container['taskTypeId']; - } - - /** - * Sets taskTypeId - * - * @param string $taskTypeId Id for type of task e.g Call / Email / Meeting etc. - * - * @return $this - */ - public function setTaskTypeId($taskTypeId) - { - $this->container['taskTypeId'] = $taskTypeId; - - return $this; - } - - /** - * Gets date - * - * @return \DateTime - */ - public function getDate() - { - return $this->container['date']; - } - - /** - * Sets date - * - * @param \DateTime $date Task date/time - * - * @return $this - */ - public function setDate($date) - { - $this->container['date'] = $date; - - return $this; - } - - /** - * Gets notes - * - * @return string - */ - public function getNotes() - { - return $this->container['notes']; - } - - /** - * Sets notes - * - * @param string $notes Notes added to a task - * - * @return $this - */ - public function setNotes($notes) - { - $this->container['notes'] = $notes; - - return $this; - } - - /** - * Gets done - * - * @return bool - */ - public function getDone() - { - return $this->container['done']; - } - - /** - * Sets done - * - * @param bool $done Task marked as done - * - * @return $this - */ - public function setDone($done) - { - $this->container['done'] = $done; - - return $this; - } - - /** - * Gets assignToId - * - * @return string - */ - public function getAssignToId() - { - return $this->container['assignToId']; - } - - /** - * Sets assignToId - * - * @param string $assignToId User id to whom task is assigned - * - * @return $this - */ - public function setAssignToId($assignToId) - { - $this->container['assignToId'] = $assignToId; - - return $this; - } - - /** - * Gets contactsIds - * - * @return int[] - */ - public function getContactsIds() - { - return $this->container['contactsIds']; - } - - /** - * Sets contactsIds - * - * @param int[] $contactsIds Contact ids for contacts linked to this task - * - * @return $this - */ - public function setContactsIds($contactsIds) - { - $this->container['contactsIds'] = $contactsIds; - - return $this; - } - - /** - * Gets dealsIds - * - * @return string[] - */ - public function getDealsIds() - { - return $this->container['dealsIds']; - } - - /** - * Sets dealsIds - * - * @param string[] $dealsIds Deal ids for deals a task is linked to - * - * @return $this - */ - public function setDealsIds($dealsIds) - { - $this->container['dealsIds'] = $dealsIds; - - return $this; - } - - /** - * Gets companiesIds - * - * @return string[] - */ - public function getCompaniesIds() - { - return $this->container['companiesIds']; - } - - /** - * Sets companiesIds - * - * @param string[] $companiesIds Companies ids for companies a task is linked to - * - * @return $this - */ - public function setCompaniesIds($companiesIds) - { - $this->container['companiesIds'] = $companiesIds; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/BodyVariablesItems.php b/lib/Models/BodyVariablesItems.php deleted file mode 100644 index 047706f..0000000 --- a/lib/Models/BodyVariablesItems.php +++ /dev/null @@ -1,280 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/CancelledTransaction.php b/lib/Models/CancelledTransaction.php new file mode 100644 index 0000000..da51b50 --- /dev/null +++ b/lib/Models/CancelledTransaction.php @@ -0,0 +1,587 @@ + + */ +class CancelledTransaction extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'cancelledTransaction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'status' => 'string', + 'amount' => 'float', + 'meta' => 'object', + 'rejectedAt' => '\DateTime', + 'rejectReason' => 'string', + 'expirationDate' => '\DateTime', + 'completedAt' => '\DateTime', + 'cancelledAt' => '\DateTime', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'uuid', + 'status' => null, + 'amount' => null, + 'meta' => null, + 'rejectedAt' => 'date-time', + 'rejectReason' => null, + 'expirationDate' => 'date-time', + 'completedAt' => 'date-time', + 'cancelledAt' => 'date-time', + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'status' => false, + 'amount' => false, + 'meta' => false, + 'rejectedAt' => false, + 'rejectReason' => false, + 'expirationDate' => false, + 'completedAt' => false, + 'cancelledAt' => false, + 'createdAt' => false, + 'updatedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'status' => 'status', + 'amount' => 'amount', + 'meta' => 'meta', + 'rejectedAt' => 'rejectedAt', + 'rejectReason' => 'rejectReason', + 'expirationDate' => 'expirationDate', + 'completedAt' => 'completedAt', + 'cancelledAt' => 'cancelledAt', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'status' => 'setStatus', + 'amount' => 'setAmount', + 'meta' => 'setMeta', + 'rejectedAt' => 'setRejectedAt', + 'rejectReason' => 'setRejectReason', + 'expirationDate' => 'setExpirationDate', + 'completedAt' => 'setCompletedAt', + 'cancelledAt' => 'setCancelledAt', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'status' => 'getStatus', + 'amount' => 'getAmount', + 'meta' => 'getMeta', + 'rejectedAt' => 'getRejectedAt', + 'rejectReason' => 'getRejectReason', + 'expirationDate' => 'getExpirationDate', + 'completedAt' => 'getCompletedAt', + 'cancelledAt' => 'getCancelledAt', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const STATUS_CANCELLED = 'cancelled'; + public const STATUS_COMPLETED = 'completed'; + public const STATUS_REJECTED = 'rejected'; + public const STATUS_DRAFT = 'draft'; + public const STATUS_EXPIRED = 'expired'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_CANCELLED, + self::STATUS_COMPLETED, + self::STATUS_REJECTED, + self::STATUS_DRAFT, + self::STATUS_EXPIRED, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('meta', $data ?? [], null); + $this->setIfExists('rejectedAt', $data ?? [], null); + $this->setIfExists('rejectReason', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('completedAt', $data ?? [], null); + $this->setIfExists('cancelledAt', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique identifier for the transaction. + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus(): ?string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Current status of the transaction, indicating its state (draft/complete/cancelled/rejected/expired) + * + * @return $this + */ + public function setStatus(?string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount(): ?float + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount The monetary value of the transaction. + * + * @return $this + */ + public function setAmount(?float $amount): static + { + if (is_null($amount)) { + throw new InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets meta + * + * @return object|null + */ + public function getMeta(): ?object + { + return $this->container['meta']; + } + + /** + * Sets meta + * + * @param object|null $meta Additional metadata related to the transaction + * + * @return $this + */ + public function setMeta(?object $meta): static + { + if (is_null($meta)) { + throw new InvalidArgumentException('non-nullable meta cannot be null'); + } + $this->container['meta'] = $meta; + + return $this; + } + + /** + * Gets rejectedAt + * + * @return \DateTime|null + */ + public function getRejectedAt(): ?\DateTime + { + return $this->container['rejectedAt']; + } + + /** + * Sets rejectedAt + * + * @param \DateTime|null $rejectedAt Timestamp indicating when the transaction was rejected + * + * @return $this + */ + public function setRejectedAt(?\DateTime $rejectedAt): static + { + if (is_null($rejectedAt)) { + throw new InvalidArgumentException('non-nullable rejectedAt cannot be null'); + } + $this->container['rejectedAt'] = $rejectedAt; + + return $this; + } + + /** + * Gets rejectReason + * + * @return string|null + */ + public function getRejectReason(): ?string + { + return $this->container['rejectReason']; + } + + /** + * Sets rejectReason + * + * @param string|null $rejectReason Reason for rejecting the transaction + * + * @return $this + */ + public function setRejectReason(?string $rejectReason): static + { + if (is_null($rejectReason)) { + throw new InvalidArgumentException('non-nullable rejectReason cannot be null'); + } + $this->container['rejectReason'] = $rejectReason; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate(): ?\DateTime + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Date when the transaction expires if not completed. + * + * @return $this + */ + public function setExpirationDate(?\DateTime $expirationDate): static + { + if (is_null($expirationDate)) { + throw new InvalidArgumentException('non-nullable expirationDate cannot be null'); + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets completedAt + * + * @return \DateTime|null + */ + public function getCompletedAt(): ?\DateTime + { + return $this->container['completedAt']; + } + + /** + * Sets completedAt + * + * @param \DateTime|null $completedAt completedAt + * + * @return $this + */ + public function setCompletedAt(?\DateTime $completedAt): static + { + if (is_null($completedAt)) { + throw new InvalidArgumentException('non-nullable completedAt cannot be null'); + } + $this->container['completedAt'] = $completedAt; + + return $this; + } + + /** + * Gets cancelledAt + * + * @return \DateTime|null + */ + public function getCancelledAt(): ?\DateTime + { + return $this->container['cancelledAt']; + } + + /** + * Sets cancelledAt + * + * @param \DateTime|null $cancelledAt cancelledAt + * + * @return $this + */ + public function setCancelledAt(?\DateTime $cancelledAt): static + { + if (is_null($cancelledAt)) { + throw new InvalidArgumentException('non-nullable cancelledAt cannot be null'); + } + $this->container['cancelledAt'] = $cancelledAt; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt createdAt + * + * @return $this + */ + public function setCreatedAt(?\DateTime $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt(): ?\DateTime + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt updatedAt + * + * @return $this + */ + public function setUpdatedAt(?\DateTime $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } +} + + diff --git a/lib/Models/Cart.php b/lib/Models/Cart.php new file mode 100644 index 0000000..bb995e1 --- /dev/null +++ b/lib/Models/Cart.php @@ -0,0 +1,280 @@ + + */ +class Cart extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'cart'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'currency' => 'string', + 'specificAmount' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'currency' => null, + 'specificAmount' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'currency' => false, + 'specificAmount' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'currency' => 'currency', + 'specificAmount' => 'specificAmount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'currency' => 'setCurrency', + 'specificAmount' => 'setSpecificAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'currency' => 'getCurrency', + 'specificAmount' => 'getSpecificAmount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const CURRENCY_EUR = 'EUR'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCurrencyAllowableValues() + { + return [ + self::CURRENCY_EUR, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('specificAmount', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + $allowedValues = $this->getCurrencyAllowableValues(); + if (!is_null($this->container['currency']) && !in_array($this->container['currency'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'currency', must be one of '%s'", + $this->container['currency'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['specificAmount'] === null) { + $invalidProperties[] = "'specificAmount' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets currency + * + * @return string + */ + public function getCurrency(): string + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string $currency Currency code for the payment amount. + * + * @return $this + */ + public function setCurrency(string $currency): static + { + if (is_null($currency)) { + throw new InvalidArgumentException('non-nullable currency cannot be null'); + } + $allowedValues = $this->getCurrencyAllowableValues(); + if (!in_array($currency, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'currency', must be one of '%s'", + $currency, + implode("', '", $allowedValues) + ) + ); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets specificAmount + * + * @return int + */ + public function getSpecificAmount(): int + { + return $this->container['specificAmount']; + } + + /** + * Sets specificAmount + * + * @param int $specificAmount Payment amount, in cents. e.g. if you want to request €12.00, then the amount in cents is 1200. + * + * @return $this + */ + public function setSpecificAmount(int $specificAmount): static + { + if (is_null($specificAmount)) { + throw new InvalidArgumentException('non-nullable specificAmount cannot be null'); + } + $this->container['specificAmount'] = $specificAmount; + + return $this; + } +} + + diff --git a/lib/Models/CompaniesIdPatchRequest.php b/lib/Models/CompaniesIdPatchRequest.php new file mode 100644 index 0000000..371b179 --- /dev/null +++ b/lib/Models/CompaniesIdPatchRequest.php @@ -0,0 +1,275 @@ + + */ +class CompaniesIdPatchRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_companies__id__patch_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'attributes' => 'object', + 'countryCode' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'attributes' => null, + 'countryCode' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'attributes' => false, + 'countryCode' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'attributes' => 'attributes', + 'countryCode' => 'countryCode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'attributes' => 'setAttributes', + 'countryCode' => 'setCountryCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'attributes' => 'getAttributes', + 'countryCode' => 'getCountryCode' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('countryCode', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of company + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets attributes + * + * @return object|null + */ + public function getAttributes(): ?object + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param object|null $attributes Attributes for company update + * + * @return $this + */ + public function setAttributes(?object $attributes): static + { + if (is_null($attributes)) { + throw new InvalidArgumentException('non-nullable attributes cannot be null'); + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets countryCode + * + * @return int|null + */ + public function getCountryCode(): ?int + { + return $this->container['countryCode']; + } + + /** + * Sets countryCode + * + * @param int|null $countryCode Country code if phone_number is passed in attributes. + * + * @return $this + */ + public function setCountryCode(?int $countryCode): static + { + if (is_null($countryCode)) { + throw new InvalidArgumentException('non-nullable countryCode cannot be null'); + } + $this->container['countryCode'] = $countryCode; + + return $this; + } +} + + diff --git a/lib/Models/CompaniesImportPost200Response.php b/lib/Models/CompaniesImportPost200Response.php new file mode 100644 index 0000000..0e61615 --- /dev/null +++ b/lib/Models/CompaniesImportPost200Response.php @@ -0,0 +1,207 @@ + + */ +class CompaniesImportPost200Response extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_companies_import_post_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'processId' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'processId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'processId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'processId' => 'processId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'processId' => 'setProcessId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('processId', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets processId + * + * @return int|null + */ + public function getProcessId(): ?int + { + return $this->container['processId']; + } + + /** + * Sets processId + * + * @param int|null $processId The ID of the import process + * + * @return $this + */ + public function setProcessId(?int $processId): static + { + if (is_null($processId)) { + throw new InvalidArgumentException('non-nullable processId cannot be null'); + } + $this->container['processId'] = $processId; + + return $this; + } +} + + diff --git a/lib/Models/CompaniesImportPost400Response.php b/lib/Models/CompaniesImportPost400Response.php new file mode 100644 index 0000000..12061c4 --- /dev/null +++ b/lib/Models/CompaniesImportPost400Response.php @@ -0,0 +1,207 @@ + + */ +class CompaniesImportPost400Response extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_companies_import_post_400_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage(): ?string + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return $this + */ + public function setMessage(?string $message): static + { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } +} + + diff --git a/lib/Models/CompaniesLinkUnlinkIdPatchRequest.php b/lib/Models/CompaniesLinkUnlinkIdPatchRequest.php new file mode 100644 index 0000000..dde0bc2 --- /dev/null +++ b/lib/Models/CompaniesLinkUnlinkIdPatchRequest.php @@ -0,0 +1,309 @@ + + */ +class CompaniesLinkUnlinkIdPatchRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_companies_link_unlink__id__patch_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'linkContactIds' => 'int[]', + 'unlinkContactIds' => 'int[]', + 'linkDealsIds' => 'string[]', + 'unlinkDealsIds' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'linkContactIds' => 'int64', + 'unlinkContactIds' => 'int64', + 'linkDealsIds' => null, + 'unlinkDealsIds' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'linkContactIds' => false, + 'unlinkContactIds' => false, + 'linkDealsIds' => false, + 'unlinkDealsIds' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'linkContactIds' => 'linkContactIds', + 'unlinkContactIds' => 'unlinkContactIds', + 'linkDealsIds' => 'linkDealsIds', + 'unlinkDealsIds' => 'unlinkDealsIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'linkContactIds' => 'setLinkContactIds', + 'unlinkContactIds' => 'setUnlinkContactIds', + 'linkDealsIds' => 'setLinkDealsIds', + 'unlinkDealsIds' => 'setUnlinkDealsIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'linkContactIds' => 'getLinkContactIds', + 'unlinkContactIds' => 'getUnlinkContactIds', + 'linkDealsIds' => 'getLinkDealsIds', + 'unlinkDealsIds' => 'getUnlinkDealsIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('linkContactIds', $data ?? [], null); + $this->setIfExists('unlinkContactIds', $data ?? [], null); + $this->setIfExists('linkDealsIds', $data ?? [], null); + $this->setIfExists('unlinkDealsIds', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets linkContactIds + * + * @return int[]|null + */ + public function getLinkContactIds(): ?array + { + return $this->container['linkContactIds']; + } + + /** + * Sets linkContactIds + * + * @param int[]|null $linkContactIds Contact ids for contacts to be linked with company + * + * @return $this + */ + public function setLinkContactIds(?array $linkContactIds): static + { + if (is_null($linkContactIds)) { + throw new InvalidArgumentException('non-nullable linkContactIds cannot be null'); + } + $this->container['linkContactIds'] = $linkContactIds; + + return $this; + } + + /** + * Gets unlinkContactIds + * + * @return int[]|null + */ + public function getUnlinkContactIds(): ?array + { + return $this->container['unlinkContactIds']; + } + + /** + * Sets unlinkContactIds + * + * @param int[]|null $unlinkContactIds Contact ids for contacts to be unlinked from company + * + * @return $this + */ + public function setUnlinkContactIds(?array $unlinkContactIds): static + { + if (is_null($unlinkContactIds)) { + throw new InvalidArgumentException('non-nullable unlinkContactIds cannot be null'); + } + $this->container['unlinkContactIds'] = $unlinkContactIds; + + return $this; + } + + /** + * Gets linkDealsIds + * + * @return string[]|null + */ + public function getLinkDealsIds(): ?array + { + return $this->container['linkDealsIds']; + } + + /** + * Sets linkDealsIds + * + * @param string[]|null $linkDealsIds Deal ids for deals to be linked with company + * + * @return $this + */ + public function setLinkDealsIds(?array $linkDealsIds): static + { + if (is_null($linkDealsIds)) { + throw new InvalidArgumentException('non-nullable linkDealsIds cannot be null'); + } + $this->container['linkDealsIds'] = $linkDealsIds; + + return $this; + } + + /** + * Gets unlinkDealsIds + * + * @return string[]|null + */ + public function getUnlinkDealsIds(): ?array + { + return $this->container['unlinkDealsIds']; + } + + /** + * Sets unlinkDealsIds + * + * @param string[]|null $unlinkDealsIds Deal ids for deals to be unlinked from company + * + * @return $this + */ + public function setUnlinkDealsIds(?array $unlinkDealsIds): static + { + if (is_null($unlinkDealsIds)) { + throw new InvalidArgumentException('non-nullable unlinkDealsIds cannot be null'); + } + $this->container['unlinkDealsIds'] = $unlinkDealsIds; + + return $this; + } +} + + diff --git a/lib/Models/CompaniesList.php b/lib/Models/CompaniesList.php index c2c9a52..4941737 100644 --- a/lib/Models/CompaniesList.php +++ b/lib/Models/CompaniesList.php @@ -2,119 +2,117 @@ /** * CompaniesList * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CompaniesList Class Doc Comment * - * @category Class * @description List of companies * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CompaniesList implements ModelInterface, ArrayAccess +class CompaniesList extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'CompaniesList'; + protected static string $openAPIModelName = 'CompaniesList'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'items' => '\Brevo\Client\Models\Company[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'items' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'items' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'items' => 'items' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'items' => 'setItems' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'items' => 'getItems' ]; @@ -122,9 +120,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -132,9 +130,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -142,75 +140,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['items'] = isset($data['items']) ? $data['items'] : null; + $this->setIfExists('items', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets items * - * @return \Brevo\Client\Models\Company[] + * @return \Brevo\Client\Models\Company[]|null */ - public function getItems() + public function getItems(): ?array { return $this->container['items']; } @@ -218,89 +190,19 @@ public function getItems() /** * Sets items * - * @param \Brevo\Client\Models\Company[] $items List of compaies + * @param \Brevo\Client\Models\Company[]|null $items List of compaies * * @return $this */ - public function setItems($items) + public function setItems(?array $items): static { + if (is_null($items)) { + throw new InvalidArgumentException('non-nullable items cannot be null'); + } $this->container['items'] = $items; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CompaniesPost200Response.php b/lib/Models/CompaniesPost200Response.php new file mode 100644 index 0000000..22ec027 --- /dev/null +++ b/lib/Models/CompaniesPost200Response.php @@ -0,0 +1,211 @@ + + */ +class CompaniesPost200Response extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_companies_post_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Unique company id + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } +} + + diff --git a/lib/Models/CompaniesPostRequest.php b/lib/Models/CompaniesPostRequest.php new file mode 100644 index 0000000..bf5d8d2 --- /dev/null +++ b/lib/Models/CompaniesPostRequest.php @@ -0,0 +1,346 @@ + + */ +class CompaniesPostRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_companies_post_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'attributes' => 'object', + 'countryCode' => 'int', + 'linkedContactsIds' => 'int[]', + 'linkedDealsIds' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'attributes' => null, + 'countryCode' => 'int64', + 'linkedContactsIds' => 'int64', + 'linkedDealsIds' => 'objectID' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'attributes' => false, + 'countryCode' => false, + 'linkedContactsIds' => false, + 'linkedDealsIds' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'attributes' => 'attributes', + 'countryCode' => 'countryCode', + 'linkedContactsIds' => 'linkedContactsIds', + 'linkedDealsIds' => 'linkedDealsIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'attributes' => 'setAttributes', + 'countryCode' => 'setCountryCode', + 'linkedContactsIds' => 'setLinkedContactsIds', + 'linkedDealsIds' => 'setLinkedDealsIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'attributes' => 'getAttributes', + 'countryCode' => 'getCountryCode', + 'linkedContactsIds' => 'getLinkedContactsIds', + 'linkedDealsIds' => 'getLinkedDealsIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('countryCode', $data ?? [], null); + $this->setIfExists('linkedContactsIds', $data ?? [], null); + $this->setIfExists('linkedDealsIds', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Name of company + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets attributes + * + * @return object|null + */ + public function getAttributes(): ?object + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param object|null $attributes Attributes for company creation + * + * @return $this + */ + public function setAttributes(?object $attributes): static + { + if (is_null($attributes)) { + throw new InvalidArgumentException('non-nullable attributes cannot be null'); + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets countryCode + * + * @return int|null + */ + public function getCountryCode(): ?int + { + return $this->container['countryCode']; + } + + /** + * Sets countryCode + * + * @param int|null $countryCode Country code if phone_number is passed in attributes. + * + * @return $this + */ + public function setCountryCode(?int $countryCode): static + { + if (is_null($countryCode)) { + throw new InvalidArgumentException('non-nullable countryCode cannot be null'); + } + $this->container['countryCode'] = $countryCode; + + return $this; + } + + /** + * Gets linkedContactsIds + * + * @return int[]|null + */ + public function getLinkedContactsIds(): ?array + { + return $this->container['linkedContactsIds']; + } + + /** + * Sets linkedContactsIds + * + * @param int[]|null $linkedContactsIds Contact ids to be linked with company + * + * @return $this + */ + public function setLinkedContactsIds(?array $linkedContactsIds): static + { + if (is_null($linkedContactsIds)) { + throw new InvalidArgumentException('non-nullable linkedContactsIds cannot be null'); + } + $this->container['linkedContactsIds'] = $linkedContactsIds; + + return $this; + } + + /** + * Gets linkedDealsIds + * + * @return string[]|null + */ + public function getLinkedDealsIds(): ?array + { + return $this->container['linkedDealsIds']; + } + + /** + * Sets linkedDealsIds + * + * @param string[]|null $linkedDealsIds Deal ids to be linked with company + * + * @return $this + */ + public function setLinkedDealsIds(?array $linkedDealsIds): static + { + if (is_null($linkedDealsIds)) { + throw new InvalidArgumentException('non-nullable linkedDealsIds cannot be null'); + } + $this->container['linkedDealsIds'] = $linkedDealsIds; + + return $this; + } +} + + diff --git a/lib/Models/Company.php b/lib/Models/Company.php index 6e85243..d30d926 100644 --- a/lib/Models/Company.php +++ b/lib/Models/Company.php @@ -2,62 +2,64 @@ /** * Company * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * Company Class Doc Comment * - * @category Class * @description Company Details * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class Company implements ModelInterface, ArrayAccess +class Company extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'Company'; + protected static string $openAPIModelName = 'Company'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'string', 'attributes' => 'object', 'linkedContactsIds' => 'int[]', @@ -67,9 +69,9 @@ class Company implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => null, 'attributes' => null, 'linkedContactsIds' => null, @@ -77,32 +79,31 @@ class Company implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'attributes' => false, + 'linkedContactsIds' => false, + 'linkedDealsIds' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'attributes' => 'attributes', 'linkedContactsIds' => 'linkedContactsIds', @@ -112,9 +113,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'attributes' => 'setAttributes', 'linkedContactsIds' => 'setLinkedContactsIds', @@ -124,9 +125,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'attributes' => 'getAttributes', 'linkedContactsIds' => 'getLinkedContactsIds', @@ -137,9 +138,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -147,9 +148,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -157,78 +158,52 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['attributes'] = isset($data['attributes']) ? $data['attributes'] : null; - $this->container['linkedContactsIds'] = isset($data['linkedContactsIds']) ? $data['linkedContactsIds'] : null; - $this->container['linkedDealsIds'] = isset($data['linkedDealsIds']) ? $data['linkedDealsIds'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('linkedContactsIds', $data ?? [], null); + $this->setIfExists('linkedDealsIds', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * - * @return string + * @return string|null */ - public function getId() + public function getId(): ?string { return $this->container['id']; } @@ -236,12 +211,15 @@ public function getId() /** * Sets id * - * @param string $id Unique company id + * @param string|null $id Unique comoany id * * @return $this */ - public function setId($id) + public function setId(?string $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -250,9 +228,9 @@ public function setId($id) /** * Gets attributes * - * @return object + * @return object|null */ - public function getAttributes() + public function getAttributes(): ?object { return $this->container['attributes']; } @@ -260,12 +238,15 @@ public function getAttributes() /** * Sets attributes * - * @param object $attributes Company attributes with values + * @param object|null $attributes Company attributes with values * * @return $this */ - public function setAttributes($attributes) + public function setAttributes(?object $attributes): static { + if (is_null($attributes)) { + throw new InvalidArgumentException('non-nullable attributes cannot be null'); + } $this->container['attributes'] = $attributes; return $this; @@ -274,9 +255,9 @@ public function setAttributes($attributes) /** * Gets linkedContactsIds * - * @return int[] + * @return int[]|null */ - public function getLinkedContactsIds() + public function getLinkedContactsIds(): ?array { return $this->container['linkedContactsIds']; } @@ -284,12 +265,15 @@ public function getLinkedContactsIds() /** * Sets linkedContactsIds * - * @param int[] $linkedContactsIds Contact ids for contacts linked to this company + * @param int[]|null $linkedContactsIds Contact ids for contacts linked to this company * * @return $this */ - public function setLinkedContactsIds($linkedContactsIds) + public function setLinkedContactsIds(?array $linkedContactsIds): static { + if (is_null($linkedContactsIds)) { + throw new InvalidArgumentException('non-nullable linkedContactsIds cannot be null'); + } $this->container['linkedContactsIds'] = $linkedContactsIds; return $this; @@ -298,9 +282,9 @@ public function setLinkedContactsIds($linkedContactsIds) /** * Gets linkedDealsIds * - * @return string[] + * @return string[]|null */ - public function getLinkedDealsIds() + public function getLinkedDealsIds(): ?array { return $this->container['linkedDealsIds']; } @@ -308,89 +292,19 @@ public function getLinkedDealsIds() /** * Sets linkedDealsIds * - * @param string[] $linkedDealsIds Deals ids for companies linked to this company + * @param string[]|null $linkedDealsIds Deals ids for companies linked to this company * * @return $this */ - public function setLinkedDealsIds($linkedDealsIds) + public function setLinkedDealsIds(?array $linkedDealsIds): static { + if (is_null($linkedDealsIds)) { + throw new InvalidArgumentException('non-nullable linkedDealsIds cannot be null'); + } $this->container['linkedDealsIds'] = $linkedDealsIds; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CompanyAttributes.php b/lib/Models/CompanyAttributes.php deleted file mode 100644 index 92c6b51..0000000 --- a/lib/Models/CompanyAttributes.php +++ /dev/null @@ -1,281 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/CompanyAttributesInner.php b/lib/Models/CompanyAttributesInner.php index 86bb34f..25a2f41 100644 --- a/lib/Models/CompanyAttributesInner.php +++ b/lib/Models/CompanyAttributesInner.php @@ -2,62 +2,64 @@ /** * CompanyAttributesInner * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CompanyAttributesInner Class Doc Comment * - * @category Class * @description List of attributes * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CompanyAttributesInner implements ModelInterface, ArrayAccess +class CompanyAttributesInner extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'CompanyAttributes_inner'; + protected static string $openAPIModelName = 'CompanyAttributes_inner'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'internalName' => 'string', 'label' => 'string', 'attributeTypeName' => 'string', @@ -68,9 +70,9 @@ class CompanyAttributesInner implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'internalName' => null, 'label' => null, 'attributeTypeName' => null, @@ -79,32 +81,32 @@ class CompanyAttributesInner implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'internalName' => false, + 'label' => false, + 'attributeTypeName' => false, + 'attributeOptions' => false, + 'isRequired' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'internalName' => 'internalName', 'label' => 'label', 'attributeTypeName' => 'attributeTypeName', @@ -115,9 +117,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'internalName' => 'setInternalName', 'label' => 'setLabel', 'attributeTypeName' => 'setAttributeTypeName', @@ -128,9 +130,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'internalName' => 'getInternalName', 'label' => 'getLabel', 'attributeTypeName' => 'getAttributeTypeName', @@ -142,9 +144,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -152,9 +154,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -162,79 +164,53 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['internalName'] = isset($data['internalName']) ? $data['internalName'] : null; - $this->container['label'] = isset($data['label']) ? $data['label'] : null; - $this->container['attributeTypeName'] = isset($data['attributeTypeName']) ? $data['attributeTypeName'] : null; - $this->container['attributeOptions'] = isset($data['attributeOptions']) ? $data['attributeOptions'] : null; - $this->container['isRequired'] = isset($data['isRequired']) ? $data['isRequired'] : null; + $this->setIfExists('internalName', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); + $this->setIfExists('attributeTypeName', $data ?? [], null); + $this->setIfExists('attributeOptions', $data ?? [], null); + $this->setIfExists('isRequired', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets internalName * - * @return string + * @return string|null */ - public function getInternalName() + public function getInternalName(): ?string { return $this->container['internalName']; } @@ -242,12 +218,15 @@ public function getInternalName() /** * Sets internalName * - * @param string $internalName internalName + * @param string|null $internalName internalName * * @return $this */ - public function setInternalName($internalName) + public function setInternalName(?string $internalName): static { + if (is_null($internalName)) { + throw new InvalidArgumentException('non-nullable internalName cannot be null'); + } $this->container['internalName'] = $internalName; return $this; @@ -256,9 +235,9 @@ public function setInternalName($internalName) /** * Gets label * - * @return string + * @return string|null */ - public function getLabel() + public function getLabel(): ?string { return $this->container['label']; } @@ -266,12 +245,15 @@ public function getLabel() /** * Sets label * - * @param string $label label + * @param string|null $label label * * @return $this */ - public function setLabel($label) + public function setLabel(?string $label): static { + if (is_null($label)) { + throw new InvalidArgumentException('non-nullable label cannot be null'); + } $this->container['label'] = $label; return $this; @@ -280,9 +262,9 @@ public function setLabel($label) /** * Gets attributeTypeName * - * @return string + * @return string|null */ - public function getAttributeTypeName() + public function getAttributeTypeName(): ?string { return $this->container['attributeTypeName']; } @@ -290,12 +272,15 @@ public function getAttributeTypeName() /** * Sets attributeTypeName * - * @param string $attributeTypeName attributeTypeName + * @param string|null $attributeTypeName attributeTypeName * * @return $this */ - public function setAttributeTypeName($attributeTypeName) + public function setAttributeTypeName(?string $attributeTypeName): static { + if (is_null($attributeTypeName)) { + throw new InvalidArgumentException('non-nullable attributeTypeName cannot be null'); + } $this->container['attributeTypeName'] = $attributeTypeName; return $this; @@ -304,9 +289,9 @@ public function setAttributeTypeName($attributeTypeName) /** * Gets attributeOptions * - * @return object[] + * @return object[]|null */ - public function getAttributeOptions() + public function getAttributeOptions(): ?array { return $this->container['attributeOptions']; } @@ -314,12 +299,15 @@ public function getAttributeOptions() /** * Sets attributeOptions * - * @param object[] $attributeOptions attributeOptions + * @param object[]|null $attributeOptions attributeOptions * * @return $this */ - public function setAttributeOptions($attributeOptions) + public function setAttributeOptions(?array $attributeOptions): static { + if (is_null($attributeOptions)) { + throw new InvalidArgumentException('non-nullable attributeOptions cannot be null'); + } $this->container['attributeOptions'] = $attributeOptions; return $this; @@ -328,9 +316,9 @@ public function setAttributeOptions($attributeOptions) /** * Gets isRequired * - * @return bool + * @return bool|null */ - public function getIsRequired() + public function getIsRequired(): ?bool { return $this->container['isRequired']; } @@ -338,89 +326,19 @@ public function getIsRequired() /** * Sets isRequired * - * @param bool $isRequired isRequired + * @param bool|null $isRequired isRequired * * @return $this */ - public function setIsRequired($isRequired) + public function setIsRequired(?bool $isRequired): static { + if (is_null($isRequired)) { + throw new InvalidArgumentException('non-nullable isRequired cannot be null'); + } $this->container['isRequired'] = $isRequired; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CompleteTransactionPayload.php b/lib/Models/CompleteTransactionPayload.php new file mode 100644 index 0000000..798cd2f --- /dev/null +++ b/lib/Models/CompleteTransactionPayload.php @@ -0,0 +1,207 @@ + + */ +class CompleteTransactionPayload extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'completeTransactionPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'balanceExpiryInMinutes' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'balanceExpiryInMinutes' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'balanceExpiryInMinutes' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'balanceExpiryInMinutes' => 'balanceExpiryInMinutes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'balanceExpiryInMinutes' => 'setBalanceExpiryInMinutes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'balanceExpiryInMinutes' => 'getBalanceExpiryInMinutes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('balanceExpiryInMinutes', $data ?? [], 0); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets balanceExpiryInMinutes + * + * @return float|null + */ + public function getBalanceExpiryInMinutes(): ?float + { + return $this->container['balanceExpiryInMinutes']; + } + + /** + * Sets balanceExpiryInMinutes + * + * @param float|null $balanceExpiryInMinutes Adds expiry in minutes to the balance on completion of transaction + * + * @return $this + */ + public function setBalanceExpiryInMinutes(?float $balanceExpiryInMinutes): static + { + if (is_null($balanceExpiryInMinutes)) { + throw new InvalidArgumentException('non-nullable balanceExpiryInMinutes cannot be null'); + } + $this->container['balanceExpiryInMinutes'] = $balanceExpiryInMinutes; + + return $this; + } +} + + diff --git a/lib/Models/CompletedTransaction.php b/lib/Models/CompletedTransaction.php new file mode 100644 index 0000000..0cd1d4f --- /dev/null +++ b/lib/Models/CompletedTransaction.php @@ -0,0 +1,587 @@ + + */ +class CompletedTransaction extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'completedTransaction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'status' => 'string', + 'amount' => 'float', + 'meta' => 'object', + 'rejectedAt' => '\DateTime', + 'rejectReason' => 'string', + 'expirationDate' => '\DateTime', + 'completedAt' => '\DateTime', + 'cancelledAt' => '\DateTime', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'uuid', + 'status' => null, + 'amount' => null, + 'meta' => null, + 'rejectedAt' => 'date-time', + 'rejectReason' => null, + 'expirationDate' => 'date-time', + 'completedAt' => 'date-time', + 'cancelledAt' => 'date-time', + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'status' => false, + 'amount' => false, + 'meta' => false, + 'rejectedAt' => false, + 'rejectReason' => false, + 'expirationDate' => false, + 'completedAt' => false, + 'cancelledAt' => false, + 'createdAt' => false, + 'updatedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'status' => 'status', + 'amount' => 'amount', + 'meta' => 'meta', + 'rejectedAt' => 'rejectedAt', + 'rejectReason' => 'rejectReason', + 'expirationDate' => 'expirationDate', + 'completedAt' => 'completedAt', + 'cancelledAt' => 'cancelledAt', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'status' => 'setStatus', + 'amount' => 'setAmount', + 'meta' => 'setMeta', + 'rejectedAt' => 'setRejectedAt', + 'rejectReason' => 'setRejectReason', + 'expirationDate' => 'setExpirationDate', + 'completedAt' => 'setCompletedAt', + 'cancelledAt' => 'setCancelledAt', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'status' => 'getStatus', + 'amount' => 'getAmount', + 'meta' => 'getMeta', + 'rejectedAt' => 'getRejectedAt', + 'rejectReason' => 'getRejectReason', + 'expirationDate' => 'getExpirationDate', + 'completedAt' => 'getCompletedAt', + 'cancelledAt' => 'getCancelledAt', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const STATUS_COMPLETED = 'completed'; + public const STATUS_REJECTED = 'rejected'; + public const STATUS_CANCELLED = 'cancelled'; + public const STATUS_DRAFT = 'draft'; + public const STATUS_EXPIRED = 'expired'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_COMPLETED, + self::STATUS_REJECTED, + self::STATUS_CANCELLED, + self::STATUS_DRAFT, + self::STATUS_EXPIRED, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('meta', $data ?? [], null); + $this->setIfExists('rejectedAt', $data ?? [], null); + $this->setIfExists('rejectReason', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('completedAt', $data ?? [], null); + $this->setIfExists('cancelledAt', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique identifier for the transaction. + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus(): ?string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Current status of the transaction, indicating its state (draft/complete/cancelled/rejected/expired) + * + * @return $this + */ + public function setStatus(?string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount(): ?float + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount The monetary value of the transaction. + * + * @return $this + */ + public function setAmount(?float $amount): static + { + if (is_null($amount)) { + throw new InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets meta + * + * @return object|null + */ + public function getMeta(): ?object + { + return $this->container['meta']; + } + + /** + * Sets meta + * + * @param object|null $meta Additional metadata related to the transaction + * + * @return $this + */ + public function setMeta(?object $meta): static + { + if (is_null($meta)) { + throw new InvalidArgumentException('non-nullable meta cannot be null'); + } + $this->container['meta'] = $meta; + + return $this; + } + + /** + * Gets rejectedAt + * + * @return \DateTime|null + */ + public function getRejectedAt(): ?\DateTime + { + return $this->container['rejectedAt']; + } + + /** + * Sets rejectedAt + * + * @param \DateTime|null $rejectedAt Timestamp indicating when the transaction was rejected + * + * @return $this + */ + public function setRejectedAt(?\DateTime $rejectedAt): static + { + if (is_null($rejectedAt)) { + throw new InvalidArgumentException('non-nullable rejectedAt cannot be null'); + } + $this->container['rejectedAt'] = $rejectedAt; + + return $this; + } + + /** + * Gets rejectReason + * + * @return string|null + */ + public function getRejectReason(): ?string + { + return $this->container['rejectReason']; + } + + /** + * Sets rejectReason + * + * @param string|null $rejectReason Reason for rejecting the transaction + * + * @return $this + */ + public function setRejectReason(?string $rejectReason): static + { + if (is_null($rejectReason)) { + throw new InvalidArgumentException('non-nullable rejectReason cannot be null'); + } + $this->container['rejectReason'] = $rejectReason; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate(): ?\DateTime + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Date when the transaction expires if not completed. + * + * @return $this + */ + public function setExpirationDate(?\DateTime $expirationDate): static + { + if (is_null($expirationDate)) { + throw new InvalidArgumentException('non-nullable expirationDate cannot be null'); + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets completedAt + * + * @return \DateTime|null + */ + public function getCompletedAt(): ?\DateTime + { + return $this->container['completedAt']; + } + + /** + * Sets completedAt + * + * @param \DateTime|null $completedAt completedAt + * + * @return $this + */ + public function setCompletedAt(?\DateTime $completedAt): static + { + if (is_null($completedAt)) { + throw new InvalidArgumentException('non-nullable completedAt cannot be null'); + } + $this->container['completedAt'] = $completedAt; + + return $this; + } + + /** + * Gets cancelledAt + * + * @return \DateTime|null + */ + public function getCancelledAt(): ?\DateTime + { + return $this->container['cancelledAt']; + } + + /** + * Sets cancelledAt + * + * @param \DateTime|null $cancelledAt cancelledAt + * + * @return $this + */ + public function setCancelledAt(?\DateTime $cancelledAt): static + { + if (is_null($cancelledAt)) { + throw new InvalidArgumentException('non-nullable cancelledAt cannot be null'); + } + $this->container['cancelledAt'] = $cancelledAt; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt createdAt + * + * @return $this + */ + public function setCreatedAt(?\DateTime $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt(): ?\DateTime + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt updatedAt + * + * @return $this + */ + public function setUpdatedAt(?\DateTime $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } +} + + diff --git a/lib/Models/ComponentItems.php b/lib/Models/ComponentItems.php index 63777bf..2840e25 100644 --- a/lib/Models/ComponentItems.php +++ b/lib/Models/ComponentItems.php @@ -2,61 +2,63 @@ /** * ComponentItems * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * ComponentItems Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class ComponentItems implements ModelInterface, ArrayAccess +class ComponentItems extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'componentItems'; + protected static string $openAPIModelName = 'componentItems'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'type' => 'string', 'text' => 'string' ]; @@ -64,40 +66,37 @@ class ComponentItems implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'type' => null, 'text' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'text' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'type' => 'type', 'text' => 'text' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'type' => 'setType', 'text' => 'setText' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'type' => 'getType', 'text' => 'getText' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +145,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['text'] = isset($data['text']) ? $data['text'] : null; + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets type * - * @return string + * @return string|null */ - public function getType() + public function getType(): ?string { return $this->container['type']; } @@ -223,12 +196,15 @@ public function getType() /** * Sets type * - * @param string $type type + * @param string|null $type type * * @return $this */ - public function setType($type) + public function setType(?string $type): static { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -237,9 +213,9 @@ public function setType($type) /** * Gets text * - * @return string + * @return string|null */ - public function getText() + public function getText(): ?string { return $this->container['text']; } @@ -247,89 +223,19 @@ public function getText() /** * Sets text * - * @param string $text text + * @param string|null $text text * * @return $this */ - public function setText($text) + public function setText(?string $text): static { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } $this->container['text'] = $text; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/Configuration.php b/lib/Models/Configuration.php new file mode 100644 index 0000000..32da739 --- /dev/null +++ b/lib/Models/Configuration.php @@ -0,0 +1,211 @@ + + */ +class Configuration extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'configuration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'customSuccessUrl' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'customSuccessUrl' => 'url' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'customSuccessUrl' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'customSuccessUrl' => 'customSuccessUrl' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'customSuccessUrl' => 'setCustomSuccessUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'customSuccessUrl' => 'getCustomSuccessUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('customSuccessUrl', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['customSuccessUrl'] === null) { + $invalidProperties[] = "'customSuccessUrl' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets customSuccessUrl + * + * @return string + */ + public function getCustomSuccessUrl(): string + { + return $this->container['customSuccessUrl']; + } + + /** + * Sets customSuccessUrl + * + * @param string $customSuccessUrl Absolute URL of the custom success page. + * + * @return $this + */ + public function setCustomSuccessUrl(string $customSuccessUrl): static + { + if (is_null($customSuccessUrl)) { + throw new InvalidArgumentException('non-nullable customSuccessUrl cannot be null'); + } + $this->container['customSuccessUrl'] = $customSuccessUrl; + + return $this; + } +} + + diff --git a/lib/Models/Contact.php b/lib/Models/Contact.php deleted file mode 100644 index a81f6f7..0000000 --- a/lib/Models/Contact.php +++ /dev/null @@ -1,518 +0,0 @@ - 'object', - 'email' => 'string', - 'assignToId' => 'string', - 'contactsId' => 'int', - 'crmLists' => 'object', - 'attributes' => 'object', - 'createdAt' => '\DateTime', - 'updatedAt' => '\DateTime' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'virtualNextTask' => null, - 'email' => null, - 'assignToId' => null, - 'contactsId' => null, - 'crmLists' => null, - 'attributes' => null, - 'createdAt' => 'date-time', - 'updatedAt' => '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'virtualNextTask' => 'virtualNextTask', - 'email' => 'email', - 'assignToId' => 'assignToId', - 'contactsId' => 'contactsId', - 'crmLists' => 'crmLists', - 'attributes' => 'attributes', - 'createdAt' => 'createdAt', - 'updatedAt' => 'updatedAt' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'virtualNextTask' => 'setVirtualNextTask', - 'email' => 'setEmail', - 'assignToId' => 'setAssignToId', - 'contactsId' => 'setContactsId', - 'crmLists' => 'setCrmLists', - 'attributes' => 'setAttributes', - 'createdAt' => 'setCreatedAt', - 'updatedAt' => 'setUpdatedAt' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'virtualNextTask' => 'getVirtualNextTask', - 'email' => 'getEmail', - 'assignToId' => 'getAssignToId', - 'contactsId' => 'getContactsId', - 'crmLists' => 'getCrmLists', - 'attributes' => 'getAttributes', - 'createdAt' => 'getCreatedAt', - 'updatedAt' => 'getUpdatedAt' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['virtualNextTask'] = isset($data['virtualNextTask']) ? $data['virtualNextTask'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['assignToId'] = isset($data['assignToId']) ? $data['assignToId'] : null; - $this->container['contactsId'] = isset($data['contactsId']) ? $data['contactsId'] : null; - $this->container['crmLists'] = isset($data['crmLists']) ? $data['crmLists'] : null; - $this->container['attributes'] = isset($data['attributes']) ? $data['attributes'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['updatedAt'] = isset($data['updatedAt']) ? $data['updatedAt'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['email'] === null) { - $invalidProperties[] = "'email' can't be null"; - } - if ($this->container['crmLists'] === null) { - $invalidProperties[] = "'crmLists' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets virtualNextTask - * - * @return object - */ - public function getVirtualNextTask() - { - return $this->container['virtualNextTask']; - } - - /** - * Sets virtualNextTask - * - * @param object $virtualNextTask Next incomplete task of contact - * - * @return $this - */ - public function setVirtualNextTask($virtualNextTask) - { - $this->container['virtualNextTask'] = $virtualNextTask; - - return $this; - } - - /** - * Gets email - * - * @return string - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string $email Contact email - * - * @return $this - */ - public function setEmail($email) - { - $this->container['email'] = $email; - - return $this; - } - - /** - * Gets assignToId - * - * @return string - */ - public function getAssignToId() - { - return $this->container['assignToId']; - } - - /** - * Sets assignToId - * - * @param string $assignToId User id to whom contact is assigned - * - * @return $this - */ - public function setAssignToId($assignToId) - { - $this->container['assignToId'] = $assignToId; - - return $this; - } - - /** - * Gets contactsId - * - * @return int - */ - public function getContactsId() - { - return $this->container['contactsId']; - } - - /** - * Sets contactsId - * - * @param int $contactsId Contact id - * - * @return $this - */ - public function setContactsId($contactsId) - { - $this->container['contactsId'] = $contactsId; - - return $this; - } - - /** - * Gets crmLists - * - * @return object - */ - public function getCrmLists() - { - return $this->container['crmLists']; - } - - /** - * Sets crmLists - * - * @param object $crmLists CRM lists in which contact is added - * - * @return $this - */ - public function setCrmLists($crmLists) - { - $this->container['crmLists'] = $crmLists; - - return $this; - } - - /** - * Gets attributes - * - * @return object - */ - public function getAttributes() - { - return $this->container['attributes']; - } - - /** - * Sets attributes - * - * @param object $attributes Contact attributes e.g firstname / lastname / SMS etc. - * - * @return $this - */ - public function setAttributes($attributes) - { - $this->container['attributes'] = $attributes; - - return $this; - } - - /** - * Gets createdAt - * - * @return \DateTime - */ - public function getCreatedAt() - { - return $this->container['createdAt']; - } - - /** - * Sets createdAt - * - * @param \DateTime $createdAt Contact created date/time - * - * @return $this - */ - public function setCreatedAt($createdAt) - { - $this->container['createdAt'] = $createdAt; - - return $this; - } - - /** - * Gets updatedAt - * - * @return \DateTime - */ - public function getUpdatedAt() - { - return $this->container['updatedAt']; - } - - /** - * Sets updatedAt - * - * @param \DateTime $updatedAt Contact updated date/time - * - * @return $this - */ - public function setUpdatedAt($updatedAt) - { - $this->container['updatedAt'] = $updatedAt; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/ContactBalances.php b/lib/Models/ContactBalances.php new file mode 100644 index 0000000..04afc59 --- /dev/null +++ b/lib/Models/ContactBalances.php @@ -0,0 +1,321 @@ + + */ +class ContactBalances extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'contactBalances'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'loyaltyProgramId' => 'string', + 'balanceDefinitionId' => 'string', + 'count' => 'int', + 'balances' => '\Brevo\Client\Models\ContactBalancesBalancesInner[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'loyaltyProgramId' => 'uuid', + 'balanceDefinitionId' => 'uuid', + 'count' => null, + 'balances' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'loyaltyProgramId' => false, + 'balanceDefinitionId' => false, + 'count' => false, + 'balances' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'loyaltyProgramId' => 'loyaltyProgramId', + 'balanceDefinitionId' => 'balanceDefinitionId', + 'count' => 'count', + 'balances' => 'balances' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'loyaltyProgramId' => 'setLoyaltyProgramId', + 'balanceDefinitionId' => 'setBalanceDefinitionId', + 'count' => 'setCount', + 'balances' => 'setBalances' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'loyaltyProgramId' => 'getLoyaltyProgramId', + 'balanceDefinitionId' => 'getBalanceDefinitionId', + 'count' => 'getCount', + 'balances' => 'getBalances' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('loyaltyProgramId', $data ?? [], null); + $this->setIfExists('balanceDefinitionId', $data ?? [], null); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('balances', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['loyaltyProgramId'] === null) { + $invalidProperties[] = "'loyaltyProgramId' can't be null"; + } + if ($this->container['balanceDefinitionId'] === null) { + $invalidProperties[] = "'balanceDefinitionId' can't be null"; + } + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + if ($this->container['balances'] === null) { + $invalidProperties[] = "'balances' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets loyaltyProgramId + * + * @return string + */ + public function getLoyaltyProgramId(): string + { + return $this->container['loyaltyProgramId']; + } + + /** + * Sets loyaltyProgramId + * + * @param string $loyaltyProgramId Unique identifier for the loyalty program. + * + * @return $this + */ + public function setLoyaltyProgramId(string $loyaltyProgramId): static + { + if (is_null($loyaltyProgramId)) { + throw new InvalidArgumentException('non-nullable loyaltyProgramId cannot be null'); + } + $this->container['loyaltyProgramId'] = $loyaltyProgramId; + + return $this; + } + + /** + * Gets balanceDefinitionId + * + * @return string + */ + public function getBalanceDefinitionId(): string + { + return $this->container['balanceDefinitionId']; + } + + /** + * Sets balanceDefinitionId + * + * @param string $balanceDefinitionId Unique identifier for the balance definition. + * + * @return $this + */ + public function setBalanceDefinitionId(string $balanceDefinitionId): static + { + if (is_null($balanceDefinitionId)) { + throw new InvalidArgumentException('non-nullable balanceDefinitionId cannot be null'); + } + $this->container['balanceDefinitionId'] = $balanceDefinitionId; + + return $this; + } + + /** + * Gets count + * + * @return int + */ + public function getCount(): int + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count Total count of balances. + * + * @return $this + */ + public function setCount(int $count): static + { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets balances + * + * @return \Brevo\Client\Models\ContactBalancesBalancesInner[] + */ + public function getBalances(): array + { + return $this->container['balances']; + } + + /** + * Sets balances + * + * @param \Brevo\Client\Models\ContactBalancesBalancesInner[] $balances balances + * + * @return $this + */ + public function setBalances(array $balances): static + { + if (is_null($balances)) { + throw new InvalidArgumentException('non-nullable balances cannot be null'); + } + $this->container['balances'] = $balances; + + return $this; + } +} + + diff --git a/lib/Models/ContactBalancesBalancesInner.php b/lib/Models/ContactBalancesBalancesInner.php new file mode 100644 index 0000000..7f27d0c --- /dev/null +++ b/lib/Models/ContactBalancesBalancesInner.php @@ -0,0 +1,321 @@ + + */ +class ContactBalancesBalancesInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'contactBalances_balances_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'contactId' => 'int', + 'value' => 'int', + 'updatedAt' => '\DateTime', + 'loyaltySubscriptionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'contactId' => null, + 'value' => null, + 'updatedAt' => 'date-time', + 'loyaltySubscriptionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'contactId' => false, + 'value' => false, + 'updatedAt' => false, + 'loyaltySubscriptionId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'contactId' => 'contactId', + 'value' => 'value', + 'updatedAt' => 'updatedAt', + 'loyaltySubscriptionId' => 'loyaltySubscriptionId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'contactId' => 'setContactId', + 'value' => 'setValue', + 'updatedAt' => 'setUpdatedAt', + 'loyaltySubscriptionId' => 'setLoyaltySubscriptionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'contactId' => 'getContactId', + 'value' => 'getValue', + 'updatedAt' => 'getUpdatedAt', + 'loyaltySubscriptionId' => 'getLoyaltySubscriptionId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('contactId', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('loyaltySubscriptionId', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['contactId'] === null) { + $invalidProperties[] = "'contactId' can't be null"; + } + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + if ($this->container['updatedAt'] === null) { + $invalidProperties[] = "'updatedAt' can't be null"; + } + if ($this->container['loyaltySubscriptionId'] === null) { + $invalidProperties[] = "'loyaltySubscriptionId' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets contactId + * + * @return int + */ + public function getContactId(): int + { + return $this->container['contactId']; + } + + /** + * Sets contactId + * + * @param int $contactId Unique identifier for the contact. + * + * @return $this + */ + public function setContactId(int $contactId): static + { + if (is_null($contactId)) { + throw new InvalidArgumentException('non-nullable contactId cannot be null'); + } + $this->container['contactId'] = $contactId; + + return $this; + } + + /** + * Gets value + * + * @return int + */ + public function getValue(): int + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param int $value Total balance value associated with the contact. + * + * @return $this + */ + public function setValue(int $value): static + { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime + */ + public function getUpdatedAt(): \DateTime + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime $updatedAt Timestamp of the last update to the contact's balance record. + * + * @return $this + */ + public function setUpdatedAt(\DateTime $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets loyaltySubscriptionId + * + * @return string + */ + public function getLoyaltySubscriptionId(): string + { + return $this->container['loyaltySubscriptionId']; + } + + /** + * Sets loyaltySubscriptionId + * + * @param string $loyaltySubscriptionId Identifier for the contact's loyalty subscription. + * + * @return $this + */ + public function setLoyaltySubscriptionId(string $loyaltySubscriptionId): static + { + if (is_null($loyaltySubscriptionId)) { + throw new InvalidArgumentException('non-nullable loyaltySubscriptionId cannot be null'); + } + $this->container['loyaltySubscriptionId'] = $loyaltySubscriptionId; + + return $this; + } +} + + diff --git a/lib/Models/ContactErrorModel.php b/lib/Models/ContactErrorModel.php new file mode 100644 index 0000000..990b154 --- /dev/null +++ b/lib/Models/ContactErrorModel.php @@ -0,0 +1,325 @@ + + */ +class ContactErrorModel extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'contactErrorModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'code' => 'string', + 'message' => 'string', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'code' => null, + 'message' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'code' => false, + 'message' => false, + 'metadata' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'code' => 'code', + 'message' => 'message', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'code' => 'setCode', + 'message' => 'setMessage', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'code' => 'getCode', + 'message' => 'getMessage', + 'metadata' => 'getMetadata' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const CODE_INVALID_PARAMETER = 'invalid_parameter'; + public const CODE_MISSING_PARAMETER = 'missing_parameter'; + public const CODE_DOCUMENT_NOT_FOUND = 'document_not_found'; + public const CODE_ACCOUNT_IN_PROCESS = 'account_in_process'; + public const CODE_DUPLICATE_PARAMETER = 'duplicate_parameter'; + public const CODE_METHOD_NOT_ALLOWED = 'method_not_allowed'; + public const CODE_OUT_OF_RANGE = 'out_of_range'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCodeAllowableValues() + { + return [ + self::CODE_INVALID_PARAMETER, + self::CODE_MISSING_PARAMETER, + self::CODE_DOCUMENT_NOT_FOUND, + self::CODE_ACCOUNT_IN_PROCESS, + self::CODE_DUPLICATE_PARAMETER, + self::CODE_METHOD_NOT_ALLOWED, + self::CODE_OUT_OF_RANGE, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['code'] === null) { + $invalidProperties[] = "'code' can't be null"; + } + $allowedValues = $this->getCodeAllowableValues(); + if (!is_null($this->container['code']) && !in_array($this->container['code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'code', must be one of '%s'", + $this->container['code'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets code + * + * @return string + */ + public function getCode(): string + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string $code Error code displayed in case of a failure + * + * @return $this + */ + public function setCode(string $code): static + { + if (is_null($code)) { + throw new InvalidArgumentException('non-nullable code cannot be null'); + } + $allowedValues = $this->getCodeAllowableValues(); + if (!in_array($code, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'code', must be one of '%s'", + $code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage(): string + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message Readable message associated to the failure + * + * @return $this + */ + public function setMessage(string $message): static + { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata(): ?object + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata Additional information about the error + * + * @return $this + */ + public function setMetadata(?object $metadata): static + { + if (is_null($metadata)) { + throw new InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } +} + + diff --git a/lib/Models/ContactIdInvalidResponse.php b/lib/Models/ContactIdInvalidResponse.php new file mode 100644 index 0000000..b83140c --- /dev/null +++ b/lib/Models/ContactIdInvalidResponse.php @@ -0,0 +1,207 @@ + + */ +class ContactIdInvalidResponse extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'contactIdInvalidResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'error' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'error' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'error' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'error' => 'getError' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets error + * + * @return string|null + */ + public function getError(): ?string + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string|null $error Readable message associated to the failure + * + * @return $this + */ + public function setError(?string $error): static + { + if (is_null($error)) { + throw new InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } +} + + diff --git a/lib/Models/ConversationsAgentOnlinePingPostRequest.php b/lib/Models/ConversationsAgentOnlinePingPostRequest.php new file mode 100644 index 0000000..124b7ba --- /dev/null +++ b/lib/Models/ConversationsAgentOnlinePingPostRequest.php @@ -0,0 +1,337 @@ + + */ +class ConversationsAgentOnlinePingPostRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_conversations_agentOnlinePing_post_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'agentId' => 'mixed', + 'receivedFrom' => 'mixed', + 'agentEmail' => 'mixed', + 'agentName' => 'mixed' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'agentId' => null, + 'receivedFrom' => null, + 'agentEmail' => null, + 'agentName' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'agentId' => true, + 'receivedFrom' => true, + 'agentEmail' => true, + 'agentName' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'agentId' => 'agentId', + 'receivedFrom' => 'receivedFrom', + 'agentEmail' => 'agentEmail', + 'agentName' => 'agentName' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'agentId' => 'setAgentId', + 'receivedFrom' => 'setReceivedFrom', + 'agentEmail' => 'setAgentEmail', + 'agentName' => 'setAgentName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'agentId' => 'getAgentId', + 'receivedFrom' => 'getReceivedFrom', + 'agentEmail' => 'getAgentEmail', + 'agentName' => 'getAgentName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('agentId', $data ?? [], null); + $this->setIfExists('receivedFrom', $data ?? [], null); + $this->setIfExists('agentEmail', $data ?? [], null); + $this->setIfExists('agentName', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets agentId + * + * @return mixed|null + */ + public function getAgentId(): mixed + { + return $this->container['agentId']; + } + + /** + * Sets agentId + * + * @param mixed|null $agentId agent ID. It can be found on agent’s page or received from a webhook. Alternatively, you can use `agentEmail` + `agentName` + `receivedFrom` instead (all 3 fields required). + * + * @return $this + */ + public function setAgentId(mixed $agentId): static + { + if (is_null($agentId)) { + array_push($this->openAPINullablesSetToNull, 'agentId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('agentId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['agentId'] = $agentId; + + return $this; + } + + /** + * Gets receivedFrom + * + * @return mixed|null + */ + public function getReceivedFrom(): mixed + { + return $this->container['receivedFrom']; + } + + /** + * Sets receivedFrom + * + * @param mixed|null $receivedFrom mark your messages to distinguish messages created by you from the others. + * + * @return $this + */ + public function setReceivedFrom(mixed $receivedFrom): static + { + if (is_null($receivedFrom)) { + array_push($this->openAPINullablesSetToNull, 'receivedFrom'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('receivedFrom', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['receivedFrom'] = $receivedFrom; + + return $this; + } + + /** + * Gets agentEmail + * + * @return mixed|null + */ + public function getAgentEmail(): mixed + { + return $this->container['agentEmail']; + } + + /** + * Sets agentEmail + * + * @param mixed|null $agentEmail agent email. When sending online pings from a standalone system, it’s hard to maintain a 1-to-1 relationship between the users of both systems. In this case, an agent can be specified by their email address. If there’s no agent with the specified email address in your Brevo organization, a dummy agent will be created automatically. + * + * @return $this + */ + public function setAgentEmail(mixed $agentEmail): static + { + if (is_null($agentEmail)) { + array_push($this->openAPINullablesSetToNull, 'agentEmail'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('agentEmail', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['agentEmail'] = $agentEmail; + + return $this; + } + + /** + * Gets agentName + * + * @return mixed|null + */ + public function getAgentName(): mixed + { + return $this->container['agentName']; + } + + /** + * Sets agentName + * + * @param mixed|null $agentName agent name + * + * @return $this + */ + public function setAgentName(mixed $agentName): static + { + if (is_null($agentName)) { + array_push($this->openAPINullablesSetToNull, 'agentName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('agentName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['agentName'] = $agentName; + + return $this; + } +} + + diff --git a/lib/Models/ConversationsMessage.php b/lib/Models/ConversationsMessage.php index 4e32b5d..a1ec678 100644 --- a/lib/Models/ConversationsMessage.php +++ b/lib/Models/ConversationsMessage.php @@ -2,62 +2,64 @@ /** * ConversationsMessage * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * ConversationsMessage Class Doc Comment * - * @category Class * @description a Conversations message * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class ConversationsMessage implements ModelInterface, ArrayAccess +class ConversationsMessage extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ConversationsMessage'; + protected static string $openAPIModelName = 'ConversationsMessage'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'string', 'type' => 'string', 'text' => 'string', @@ -73,9 +75,9 @@ class ConversationsMessage implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => null, 'type' => null, 'text' => null, @@ -89,32 +91,37 @@ class ConversationsMessage implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'type' => false, + 'text' => false, + 'visitorId' => false, + 'agentId' => false, + 'agentName' => false, + 'createdAt' => false, + 'isPushed' => false, + 'receivedFrom' => false, + 'file' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'type' => 'type', 'text' => 'text', @@ -130,9 +137,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'type' => 'setType', 'text' => 'setText', @@ -148,9 +155,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'type' => 'getType', 'text' => 'getText', @@ -167,9 +174,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -177,9 +184,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -187,27 +194,15 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const TYPE_AGENT = 'agent'; - const TYPE_VISITOR = 'visitor'; - - + public const TYPE_AGENT = 'agent'; + public const TYPE_VISITOR = 'visitor'; /** * Gets allowable values of the enum @@ -222,47 +217,46 @@ public function getTypeAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['text'] = isset($data['text']) ? $data['text'] : null; - $this->container['visitorId'] = isset($data['visitorId']) ? $data['visitorId'] : null; - $this->container['agentId'] = isset($data['agentId']) ? $data['agentId'] : null; - $this->container['agentName'] = isset($data['agentName']) ? $data['agentName'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['isPushed'] = isset($data['isPushed']) ? $data['isPushed'] : null; - $this->container['receivedFrom'] = isset($data['receivedFrom']) ? $data['receivedFrom'] : null; - $this->container['file'] = isset($data['file']) ? $data['file'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('visitorId', $data ?? [], null); + $this->setIfExists('agentId', $data ?? [], null); + $this->setIfExists('agentName', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('isPushed', $data ?? [], null); + $this->setIfExists('receivedFrom', $data ?? [], null); + $this->setIfExists('file', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; $allowedValues = $this->getTypeAllowableValues(); if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], implode("', '", $allowedValues) ); } @@ -274,24 +268,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * - * @return string + * @return string|null */ - public function getId() + public function getId(): ?string { return $this->container['id']; } @@ -299,12 +281,15 @@ public function getId() /** * Sets id * - * @param string $id Message ID. It can be used for further manipulations with the message. + * @param string|null $id Message ID. It can be used for further manipulations with the message. * * @return $this */ - public function setId($id) + public function setId(?string $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -313,9 +298,9 @@ public function setId($id) /** * Gets type * - * @return string + * @return string|null */ - public function getType() + public function getType(): ?string { return $this->container['type']; } @@ -323,17 +308,21 @@ public function getType() /** * Sets type * - * @param string $type `\"agent\"` for agents’ messages, `\"visitor\"` for visitors’ messages. + * @param string|null $type `\"agent\"` for agents’ messages, `\"visitor\"` for visitors’ messages. * * @return $this */ - public function setType($type) + public function setType(?string $type): static { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($type) && !in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( sprintf( - "Invalid value for 'type', must be one of '%s'", + "Invalid value '%s' for 'type', must be one of '%s'", + $type, implode("', '", $allowedValues) ) ); @@ -346,9 +335,9 @@ public function setType($type) /** * Gets text * - * @return string + * @return string|null */ - public function getText() + public function getText(): ?string { return $this->container['text']; } @@ -356,12 +345,15 @@ public function getText() /** * Sets text * - * @param string $text Message text or name of the attached file + * @param string|null $text Message text or name of the attached file * * @return $this */ - public function setText($text) + public function setText(?string $text): static { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } $this->container['text'] = $text; return $this; @@ -370,9 +362,9 @@ public function setText($text) /** * Gets visitorId * - * @return string + * @return string|null */ - public function getVisitorId() + public function getVisitorId(): ?string { return $this->container['visitorId']; } @@ -380,12 +372,15 @@ public function getVisitorId() /** * Sets visitorId * - * @param string $visitorId visitor’s ID + * @param string|null $visitorId visitor’s ID * * @return $this */ - public function setVisitorId($visitorId) + public function setVisitorId(?string $visitorId): static { + if (is_null($visitorId)) { + throw new InvalidArgumentException('non-nullable visitorId cannot be null'); + } $this->container['visitorId'] = $visitorId; return $this; @@ -394,9 +389,9 @@ public function setVisitorId($visitorId) /** * Gets agentId * - * @return string + * @return string|null */ - public function getAgentId() + public function getAgentId(): ?string { return $this->container['agentId']; } @@ -404,12 +399,15 @@ public function getAgentId() /** * Sets agentId * - * @param string $agentId ID of the agent on whose behalf the message was sent (only in messages sent by an agent). + * @param string|null $agentId ID of the agent on whose behalf the message was sent (only in messages sent by an agent). * * @return $this */ - public function setAgentId($agentId) + public function setAgentId(?string $agentId): static { + if (is_null($agentId)) { + throw new InvalidArgumentException('non-nullable agentId cannot be null'); + } $this->container['agentId'] = $agentId; return $this; @@ -418,9 +416,9 @@ public function setAgentId($agentId) /** * Gets agentName * - * @return string + * @return string|null */ - public function getAgentName() + public function getAgentName(): ?string { return $this->container['agentName']; } @@ -428,12 +426,15 @@ public function getAgentName() /** * Sets agentName * - * @param string $agentName Agent’s name as displayed to the visitor. Only in the messages sent by an agent. + * @param string|null $agentName Agent’s name as displayed to the visitor. Only in the messages sent by an agent. * * @return $this */ - public function setAgentName($agentName) + public function setAgentName(?string $agentName): static { + if (is_null($agentName)) { + throw new InvalidArgumentException('non-nullable agentName cannot be null'); + } $this->container['agentName'] = $agentName; return $this; @@ -442,9 +443,9 @@ public function setAgentName($agentName) /** * Gets createdAt * - * @return int + * @return int|null */ - public function getCreatedAt() + public function getCreatedAt(): ?int { return $this->container['createdAt']; } @@ -452,15 +453,18 @@ public function getCreatedAt() /** * Sets createdAt * - * @param int $createdAt Timestamp in milliseconds. + * @param int|null $createdAt Timestamp in milliseconds. * * @return $this */ - public function setCreatedAt($createdAt) + public function setCreatedAt(?int $createdAt): static { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } - if (!is_null($createdAt) && ($createdAt < 0)) { - throw new \InvalidArgumentException('invalid value for $createdAt when calling ConversationsMessage., must be bigger than or equal to 0.'); + if (($createdAt < 0)) { + throw new InvalidArgumentException('invalid value for $createdAt when calling ConversationsMessage., must be bigger than or equal to 0.'); } $this->container['createdAt'] = $createdAt; @@ -471,9 +475,9 @@ public function setCreatedAt($createdAt) /** * Gets isPushed * - * @return bool + * @return bool|null */ - public function getIsPushed() + public function getIsPushed(): ?bool { return $this->container['isPushed']; } @@ -481,12 +485,15 @@ public function getIsPushed() /** * Sets isPushed * - * @param bool $isPushed `true` for pushed messages + * @param bool|null $isPushed `true` for pushed messages * * @return $this */ - public function setIsPushed($isPushed) + public function setIsPushed(?bool $isPushed): static { + if (is_null($isPushed)) { + throw new InvalidArgumentException('non-nullable isPushed cannot be null'); + } $this->container['isPushed'] = $isPushed; return $this; @@ -495,9 +502,9 @@ public function setIsPushed($isPushed) /** * Gets receivedFrom * - * @return string + * @return string|null */ - public function getReceivedFrom() + public function getReceivedFrom(): ?string { return $this->container['receivedFrom']; } @@ -505,12 +512,15 @@ public function getReceivedFrom() /** * Sets receivedFrom * - * @param string $receivedFrom In two-way integrations, messages sent via REST API can be marked with receivedFrom property and then filtered out when received in a webhook to avoid infinite loop. + * @param string|null $receivedFrom In two-way integrations, messages sent via REST API can be marked with receivedFrom property and then filtered out when received in a webhook to avoid infinite loop. * * @return $this */ - public function setReceivedFrom($receivedFrom) + public function setReceivedFrom(?string $receivedFrom): static { + if (is_null($receivedFrom)) { + throw new InvalidArgumentException('non-nullable receivedFrom cannot be null'); + } $this->container['receivedFrom'] = $receivedFrom; return $this; @@ -519,9 +529,9 @@ public function setReceivedFrom($receivedFrom) /** * Gets file * - * @return \Brevo\Client\Models\ConversationsMessageFile + * @return \Brevo\Client\Models\ConversationsMessageFile|null */ - public function getFile() + public function getFile(): ?\Brevo\Client\Models\ConversationsMessageFile { return $this->container['file']; } @@ -529,89 +539,19 @@ public function getFile() /** * Sets file * - * @param \Brevo\Client\Models\ConversationsMessageFile $file file + * @param \Brevo\Client\Models\ConversationsMessageFile|null $file file * * @return $this */ - public function setFile($file) + public function setFile(?\Brevo\Client\Models\ConversationsMessageFile $file): static { + if (is_null($file)) { + throw new InvalidArgumentException('non-nullable file cannot be null'); + } $this->container['file'] = $file; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/ConversationsMessageFile.php b/lib/Models/ConversationsMessageFile.php index dda1d0a..c02abf3 100644 --- a/lib/Models/ConversationsMessageFile.php +++ b/lib/Models/ConversationsMessageFile.php @@ -2,61 +2,63 @@ /** * ConversationsMessageFile * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * ConversationsMessageFile Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class ConversationsMessageFile implements ModelInterface, ArrayAccess +class ConversationsMessageFile extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ConversationsMessage_file'; + protected static string $openAPIModelName = 'ConversationsMessage_file'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'filename' => 'string', 'size' => 'int', 'isImage' => 'bool', @@ -67,9 +69,9 @@ class ConversationsMessageFile implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'filename' => null, 'size' => 'int64', 'isImage' => null, @@ -78,32 +80,32 @@ class ConversationsMessageFile implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'filename' => false, + 'size' => false, + 'isImage' => false, + 'url' => false, + 'imageInfo' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'filename' => 'filename', 'size' => 'size', 'isImage' => 'isImage', @@ -114,9 +116,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'filename' => 'setFilename', 'size' => 'setSize', 'isImage' => 'setIsImage', @@ -127,9 +129,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'filename' => 'getFilename', 'size' => 'getSize', 'isImage' => 'getIsImage', @@ -141,9 +143,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -151,9 +153,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -161,55 +163,41 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['filename'] = isset($data['filename']) ? $data['filename'] : null; - $this->container['size'] = isset($data['size']) ? $data['size'] : null; - $this->container['isImage'] = isset($data['isImage']) ? $data['isImage'] : null; - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['imageInfo'] = isset($data['imageInfo']) ? $data['imageInfo'] : null; + $this->setIfExists('filename', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('isImage', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('imageInfo', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -220,24 +208,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets filename * - * @return string + * @return string|null */ - public function getFilename() + public function getFilename(): ?string { return $this->container['filename']; } @@ -245,12 +221,15 @@ public function getFilename() /** * Sets filename * - * @param string $filename Name of the file + * @param string|null $filename Name of the file * * @return $this */ - public function setFilename($filename) + public function setFilename(?string $filename): static { + if (is_null($filename)) { + throw new InvalidArgumentException('non-nullable filename cannot be null'); + } $this->container['filename'] = $filename; return $this; @@ -259,9 +238,9 @@ public function setFilename($filename) /** * Gets size * - * @return int + * @return int|null */ - public function getSize() + public function getSize(): ?int { return $this->container['size']; } @@ -269,15 +248,18 @@ public function getSize() /** * Sets size * - * @param int $size Size in bytes + * @param int|null $size Size in bytes * * @return $this */ - public function setSize($size) + public function setSize(?int $size): static { + if (is_null($size)) { + throw new InvalidArgumentException('non-nullable size cannot be null'); + } - if (!is_null($size) && ($size < 0)) { - throw new \InvalidArgumentException('invalid value for $size when calling ConversationsMessageFile., must be bigger than or equal to 0.'); + if (($size < 0)) { + throw new InvalidArgumentException('invalid value for $size when calling ConversationsMessageFile., must be bigger than or equal to 0.'); } $this->container['size'] = $size; @@ -288,9 +270,9 @@ public function setSize($size) /** * Gets isImage * - * @return bool + * @return bool|null */ - public function getIsImage() + public function getIsImage(): ?bool { return $this->container['isImage']; } @@ -298,12 +280,15 @@ public function getIsImage() /** * Sets isImage * - * @param bool $isImage Whether the file is an image + * @param bool|null $isImage Whether the file is an image * * @return $this */ - public function setIsImage($isImage) + public function setIsImage(?bool $isImage): static { + if (is_null($isImage)) { + throw new InvalidArgumentException('non-nullable isImage cannot be null'); + } $this->container['isImage'] = $isImage; return $this; @@ -312,9 +297,9 @@ public function setIsImage($isImage) /** * Gets url * - * @return string + * @return string|null */ - public function getUrl() + public function getUrl(): ?string { return $this->container['url']; } @@ -322,12 +307,15 @@ public function getUrl() /** * Sets url * - * @param string $url URL of the file + * @param string|null $url URL of the file * * @return $this */ - public function setUrl($url) + public function setUrl(?string $url): static { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } $this->container['url'] = $url; return $this; @@ -336,9 +324,9 @@ public function setUrl($url) /** * Gets imageInfo * - * @return \Brevo\Client\Models\ConversationsMessageFileImageInfo + * @return \Brevo\Client\Models\ConversationsMessageFileImageInfo|null */ - public function getImageInfo() + public function getImageInfo(): ?\Brevo\Client\Models\ConversationsMessageFileImageInfo { return $this->container['imageInfo']; } @@ -346,89 +334,19 @@ public function getImageInfo() /** * Sets imageInfo * - * @param \Brevo\Client\Models\ConversationsMessageFileImageInfo $imageInfo imageInfo + * @param \Brevo\Client\Models\ConversationsMessageFileImageInfo|null $imageInfo imageInfo * * @return $this */ - public function setImageInfo($imageInfo) + public function setImageInfo(?\Brevo\Client\Models\ConversationsMessageFileImageInfo $imageInfo): static { + if (is_null($imageInfo)) { + throw new InvalidArgumentException('non-nullable imageInfo cannot be null'); + } $this->container['imageInfo'] = $imageInfo; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/ConversationsMessageFileImageInfo.php b/lib/Models/ConversationsMessageFileImageInfo.php index a83a9b6..aa0175c 100644 --- a/lib/Models/ConversationsMessageFileImageInfo.php +++ b/lib/Models/ConversationsMessageFileImageInfo.php @@ -2,62 +2,64 @@ /** * ConversationsMessageFileImageInfo * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * ConversationsMessageFileImageInfo Class Doc Comment * - * @category Class * @description image info is passed in case the file is an image * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class ConversationsMessageFileImageInfo implements ModelInterface, ArrayAccess +class ConversationsMessageFileImageInfo extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ConversationsMessage_file_imageInfo'; + protected static string $openAPIModelName = 'ConversationsMessage_file_imageInfo'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'width' => 'int', 'height' => 'int', 'previewUrl' => 'string' @@ -66,41 +68,39 @@ class ConversationsMessageFileImageInfo implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'width' => 'int64', 'height' => 'int64', 'previewUrl' => 'url' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'width' => false, + 'height' => false, + 'previewUrl' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'width' => 'width', 'height' => 'height', 'previewUrl' => 'previewUrl' @@ -109,9 +109,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'width' => 'setWidth', 'height' => 'setHeight', 'previewUrl' => 'setPreviewUrl' @@ -120,9 +120,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'width' => 'getWidth', 'height' => 'getHeight', 'previewUrl' => 'getPreviewUrl' @@ -132,9 +132,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -142,9 +142,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -152,53 +152,39 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['width'] = isset($data['width']) ? $data['width'] : null; - $this->container['height'] = isset($data['height']) ? $data['height'] : null; - $this->container['previewUrl'] = isset($data['previewUrl']) ? $data['previewUrl'] : null; + $this->setIfExists('width', $data ?? [], null); + $this->setIfExists('height', $data ?? [], null); + $this->setIfExists('previewUrl', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -213,24 +199,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets width * - * @return int + * @return int|null */ - public function getWidth() + public function getWidth(): ?int { return $this->container['width']; } @@ -238,15 +212,18 @@ public function getWidth() /** * Sets width * - * @param int $width Width of the image + * @param int|null $width Width of the image * * @return $this */ - public function setWidth($width) + public function setWidth(?int $width): static { + if (is_null($width)) { + throw new InvalidArgumentException('non-nullable width cannot be null'); + } - if (!is_null($width) && ($width < 0)) { - throw new \InvalidArgumentException('invalid value for $width when calling ConversationsMessageFileImageInfo., must be bigger than or equal to 0.'); + if (($width < 0)) { + throw new InvalidArgumentException('invalid value for $width when calling ConversationsMessageFileImageInfo., must be bigger than or equal to 0.'); } $this->container['width'] = $width; @@ -257,9 +234,9 @@ public function setWidth($width) /** * Gets height * - * @return int + * @return int|null */ - public function getHeight() + public function getHeight(): ?int { return $this->container['height']; } @@ -267,15 +244,18 @@ public function getHeight() /** * Sets height * - * @param int $height height of the image + * @param int|null $height height of the image * * @return $this */ - public function setHeight($height) + public function setHeight(?int $height): static { + if (is_null($height)) { + throw new InvalidArgumentException('non-nullable height cannot be null'); + } - if (!is_null($height) && ($height < 0)) { - throw new \InvalidArgumentException('invalid value for $height when calling ConversationsMessageFileImageInfo., must be bigger than or equal to 0.'); + if (($height < 0)) { + throw new InvalidArgumentException('invalid value for $height when calling ConversationsMessageFileImageInfo., must be bigger than or equal to 0.'); } $this->container['height'] = $height; @@ -286,9 +266,9 @@ public function setHeight($height) /** * Gets previewUrl * - * @return string + * @return string|null */ - public function getPreviewUrl() + public function getPreviewUrl(): ?string { return $this->container['previewUrl']; } @@ -296,89 +276,19 @@ public function getPreviewUrl() /** * Sets previewUrl * - * @param string $previewUrl URL of the preview + * @param string|null $previewUrl URL of the preview * * @return $this */ - public function setPreviewUrl($previewUrl) + public function setPreviewUrl(?string $previewUrl): static { + if (is_null($previewUrl)) { + throw new InvalidArgumentException('non-nullable previewUrl cannot be null'); + } $this->container['previewUrl'] = $previewUrl; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/ConversationsMessagesIdPutRequest.php b/lib/Models/ConversationsMessagesIdPutRequest.php new file mode 100644 index 0000000..efde6c1 --- /dev/null +++ b/lib/Models/ConversationsMessagesIdPutRequest.php @@ -0,0 +1,210 @@ + + */ +class ConversationsMessagesIdPutRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_conversations_messages__id__put_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'text' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'text' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'text' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'text' => 'text' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'text' => 'setText' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'text' => 'getText' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('text', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['text'] === null) { + $invalidProperties[] = "'text' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets text + * + * @return string + */ + public function getText(): string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string $text edited message text + * + * @return $this + */ + public function setText(string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + $this->container['text'] = $text; + + return $this; + } +} + + diff --git a/lib/Models/ConversationsMessagesPostRequest.php b/lib/Models/ConversationsMessagesPostRequest.php new file mode 100644 index 0000000..4982ec0 --- /dev/null +++ b/lib/Models/ConversationsMessagesPostRequest.php @@ -0,0 +1,425 @@ + + */ +class ConversationsMessagesPostRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_conversations_messages_post_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'visitorId' => 'mixed', + 'text' => 'mixed', + 'agentId' => 'mixed', + 'receivedFrom' => 'mixed', + 'agentEmail' => 'mixed', + 'agentName' => 'mixed' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'visitorId' => null, + 'text' => null, + 'agentId' => null, + 'receivedFrom' => null, + 'agentEmail' => null, + 'agentName' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'visitorId' => true, + 'text' => true, + 'agentId' => true, + 'receivedFrom' => true, + 'agentEmail' => true, + 'agentName' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'visitorId' => 'visitorId', + 'text' => 'text', + 'agentId' => 'agentId', + 'receivedFrom' => 'receivedFrom', + 'agentEmail' => 'agentEmail', + 'agentName' => 'agentName' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'visitorId' => 'setVisitorId', + 'text' => 'setText', + 'agentId' => 'setAgentId', + 'receivedFrom' => 'setReceivedFrom', + 'agentEmail' => 'setAgentEmail', + 'agentName' => 'setAgentName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'visitorId' => 'getVisitorId', + 'text' => 'getText', + 'agentId' => 'getAgentId', + 'receivedFrom' => 'getReceivedFrom', + 'agentEmail' => 'getAgentEmail', + 'agentName' => 'getAgentName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('visitorId', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('agentId', $data ?? [], null); + $this->setIfExists('receivedFrom', $data ?? [], null); + $this->setIfExists('agentEmail', $data ?? [], null); + $this->setIfExists('agentName', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['visitorId'] === null) { + $invalidProperties[] = "'visitorId' can't be null"; + } + if ($this->container['text'] === null) { + $invalidProperties[] = "'text' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets visitorId + * + * @return mixed + */ + public function getVisitorId(): mixed + { + return $this->container['visitorId']; + } + + /** + * Sets visitorId + * + * @param mixed $visitorId visitor’s ID received from a webhook or generated by you to bind existing user account to Conversations + * + * @return $this + */ + public function setVisitorId(mixed $visitorId): static + { + if (is_null($visitorId)) { + array_push($this->openAPINullablesSetToNull, 'visitorId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('visitorId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['visitorId'] = $visitorId; + + return $this; + } + + /** + * Gets text + * + * @return mixed + */ + public function getText(): mixed + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param mixed $text message text + * + * @return $this + */ + public function setText(mixed $text): static + { + if (is_null($text)) { + array_push($this->openAPINullablesSetToNull, 'text'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('text', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets agentId + * + * @return mixed|null + */ + public function getAgentId(): mixed + { + return $this->container['agentId']; + } + + /** + * Sets agentId + * + * @param mixed|null $agentId agent ID. It can be found on agent’s page or received from a webhook. Alternatively, you can use `agentEmail` + `agentName` + `receivedFrom` instead (all 3 fields required). + * + * @return $this + */ + public function setAgentId(mixed $agentId): static + { + if (is_null($agentId)) { + array_push($this->openAPINullablesSetToNull, 'agentId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('agentId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['agentId'] = $agentId; + + return $this; + } + + /** + * Gets receivedFrom + * + * @return mixed|null + */ + public function getReceivedFrom(): mixed + { + return $this->container['receivedFrom']; + } + + /** + * Sets receivedFrom + * + * @param mixed|null $receivedFrom mark your messages to distinguish messages created by you from the others. + * + * @return $this + */ + public function setReceivedFrom(mixed $receivedFrom): static + { + if (is_null($receivedFrom)) { + array_push($this->openAPINullablesSetToNull, 'receivedFrom'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('receivedFrom', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['receivedFrom'] = $receivedFrom; + + return $this; + } + + /** + * Gets agentEmail + * + * @return mixed|null + */ + public function getAgentEmail(): mixed + { + return $this->container['agentEmail']; + } + + /** + * Sets agentEmail + * + * @param mixed|null $agentEmail agent email. When sending messages from a standalone system, it’s hard to maintain a 1-to-1 relationship between the users of both systems. In this case, an agent can be specified by their email address. + * + * @return $this + */ + public function setAgentEmail(mixed $agentEmail): static + { + if (is_null($agentEmail)) { + array_push($this->openAPINullablesSetToNull, 'agentEmail'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('agentEmail', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['agentEmail'] = $agentEmail; + + return $this; + } + + /** + * Gets agentName + * + * @return mixed|null + */ + public function getAgentName(): mixed + { + return $this->container['agentName']; + } + + /** + * Sets agentName + * + * @param mixed|null $agentName agent name + * + * @return $this + */ + public function setAgentName(mixed $agentName): static + { + if (is_null($agentName)) { + array_push($this->openAPINullablesSetToNull, 'agentName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('agentName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['agentName'] = $agentName; + + return $this; + } +} + + diff --git a/lib/Models/ConversationsPushedMessagesPostRequest.php b/lib/Models/ConversationsPushedMessagesPostRequest.php new file mode 100644 index 0000000..576c76a --- /dev/null +++ b/lib/Models/ConversationsPushedMessagesPostRequest.php @@ -0,0 +1,343 @@ + + */ +class ConversationsPushedMessagesPostRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_conversations_pushedMessages_post_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'visitorId' => 'mixed', + 'text' => 'mixed', + 'agentId' => 'mixed', + 'groupId' => 'mixed' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'visitorId' => null, + 'text' => null, + 'agentId' => null, + 'groupId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'visitorId' => true, + 'text' => true, + 'agentId' => true, + 'groupId' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'visitorId' => 'visitorId', + 'text' => 'text', + 'agentId' => 'agentId', + 'groupId' => 'groupId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'visitorId' => 'setVisitorId', + 'text' => 'setText', + 'agentId' => 'setAgentId', + 'groupId' => 'setGroupId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'visitorId' => 'getVisitorId', + 'text' => 'getText', + 'agentId' => 'getAgentId', + 'groupId' => 'getGroupId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('visitorId', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('agentId', $data ?? [], null); + $this->setIfExists('groupId', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['visitorId'] === null) { + $invalidProperties[] = "'visitorId' can't be null"; + } + if ($this->container['text'] === null) { + $invalidProperties[] = "'text' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets visitorId + * + * @return mixed + */ + public function getVisitorId(): mixed + { + return $this->container['visitorId']; + } + + /** + * Sets visitorId + * + * @param mixed $visitorId visitor’s ID received from a webhook or generated by you to bind existing user account to Conversations + * + * @return $this + */ + public function setVisitorId(mixed $visitorId): static + { + if (is_null($visitorId)) { + array_push($this->openAPINullablesSetToNull, 'visitorId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('visitorId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['visitorId'] = $visitorId; + + return $this; + } + + /** + * Gets text + * + * @return mixed + */ + public function getText(): mixed + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param mixed $text message text + * + * @return $this + */ + public function setText(mixed $text): static + { + if (is_null($text)) { + array_push($this->openAPINullablesSetToNull, 'text'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('text', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets agentId + * + * @return mixed|null + */ + public function getAgentId(): mixed + { + return $this->container['agentId']; + } + + /** + * Sets agentId + * + * @param mixed|null $agentId agent ID. It can be found on agent’s page or received from a webhook. + * + * @return $this + */ + public function setAgentId(mixed $agentId): static + { + if (is_null($agentId)) { + array_push($this->openAPINullablesSetToNull, 'agentId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('agentId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['agentId'] = $agentId; + + return $this; + } + + /** + * Gets groupId + * + * @return mixed|null + */ + public function getGroupId(): mixed + { + return $this->container['groupId']; + } + + /** + * Sets groupId + * + * @param mixed|null $groupId group ID. It can be found on group’s page. + * + * @return $this + */ + public function setGroupId(mixed $groupId): static + { + if (is_null($groupId)) { + array_push($this->openAPINullablesSetToNull, 'groupId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('groupId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['groupId'] = $groupId; + + return $this; + } +} + + diff --git a/lib/Models/ConversionSourceMetrics.php b/lib/Models/ConversionSourceMetrics.php new file mode 100644 index 0000000..7d6f17b --- /dev/null +++ b/lib/Models/ConversionSourceMetrics.php @@ -0,0 +1,390 @@ + + */ +class ConversionSourceMetrics extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ConversionSourceMetrics'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'float', + 'conversionSource' => 'string', + 'ordersCount' => 'float', + 'revenue' => 'float', + 'averageBasket' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'integer', + 'conversionSource' => null, + 'ordersCount' => 'integer', + 'revenue' => 'float', + 'averageBasket' => 'float' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'conversionSource' => false, + 'ordersCount' => false, + 'revenue' => false, + 'averageBasket' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'conversionSource' => 'conversionSource', + 'ordersCount' => 'ordersCount', + 'revenue' => 'revenue', + 'averageBasket' => 'averageBasket' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'conversionSource' => 'setConversionSource', + 'ordersCount' => 'setOrdersCount', + 'revenue' => 'setRevenue', + 'averageBasket' => 'setAverageBasket' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'conversionSource' => 'getConversionSource', + 'ordersCount' => 'getOrdersCount', + 'revenue' => 'getRevenue', + 'averageBasket' => 'getAverageBasket' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const CONVERSION_SOURCE_EMAIL_CAMPAIGN = 'email_campaign'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getConversionSourceAllowableValues() + { + return [ + self::CONVERSION_SOURCE_EMAIL_CAMPAIGN, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('conversionSource', $data ?? [], null); + $this->setIfExists('ordersCount', $data ?? [], null); + $this->setIfExists('revenue', $data ?? [], null); + $this->setIfExists('averageBasket', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['conversionSource'] === null) { + $invalidProperties[] = "'conversionSource' can't be null"; + } + $allowedValues = $this->getConversionSourceAllowableValues(); + if (!is_null($this->container['conversionSource']) && !in_array($this->container['conversionSource'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'conversionSource', must be one of '%s'", + $this->container['conversionSource'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['ordersCount'] === null) { + $invalidProperties[] = "'ordersCount' can't be null"; + } + if ($this->container['revenue'] === null) { + $invalidProperties[] = "'revenue' can't be null"; + } + if ($this->container['averageBasket'] === null) { + $invalidProperties[] = "'averageBasket' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets id + * + * @return float + */ + public function getId(): float + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param float $id id + * + * @return $this + */ + public function setId(float $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets conversionSource + * + * @return string + */ + public function getConversionSource(): string + { + return $this->container['conversionSource']; + } + + /** + * Sets conversionSource + * + * @param string $conversionSource conversionSource + * + * @return $this + */ + public function setConversionSource(string $conversionSource): static + { + if (is_null($conversionSource)) { + throw new InvalidArgumentException('non-nullable conversionSource cannot be null'); + } + $allowedValues = $this->getConversionSourceAllowableValues(); + if (!in_array($conversionSource, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'conversionSource', must be one of '%s'", + $conversionSource, + implode("', '", $allowedValues) + ) + ); + } + $this->container['conversionSource'] = $conversionSource; + + return $this; + } + + /** + * Gets ordersCount + * + * @return float + */ + public function getOrdersCount(): float + { + return $this->container['ordersCount']; + } + + /** + * Sets ordersCount + * + * @param float $ordersCount ordersCount + * + * @return $this + */ + public function setOrdersCount(float $ordersCount): static + { + if (is_null($ordersCount)) { + throw new InvalidArgumentException('non-nullable ordersCount cannot be null'); + } + $this->container['ordersCount'] = $ordersCount; + + return $this; + } + + /** + * Gets revenue + * + * @return float + */ + public function getRevenue(): float + { + return $this->container['revenue']; + } + + /** + * Sets revenue + * + * @param float $revenue revenue + * + * @return $this + */ + public function setRevenue(float $revenue): static + { + if (is_null($revenue)) { + throw new InvalidArgumentException('non-nullable revenue cannot be null'); + } + $this->container['revenue'] = $revenue; + + return $this; + } + + /** + * Gets averageBasket + * + * @return float + */ + public function getAverageBasket(): float + { + return $this->container['averageBasket']; + } + + /** + * Sets averageBasket + * + * @param float $averageBasket averageBasket + * + * @return $this + */ + public function setAverageBasket(float $averageBasket): static + { + if (is_null($averageBasket)) { + throw new InvalidArgumentException('non-nullable averageBasket cannot be null'); + } + $this->container['averageBasket'] = $averageBasket; + + return $this; + } +} + + diff --git a/lib/Models/ConversionSourceProduct.php b/lib/Models/ConversionSourceProduct.php new file mode 100644 index 0000000..d7181ba --- /dev/null +++ b/lib/Models/ConversionSourceProduct.php @@ -0,0 +1,448 @@ + + */ +class ConversionSourceProduct extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ConversionSourceProduct'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'sku' => 'string', + 'price' => 'float', + 'url' => 'string', + 'imageUrl' => 'string', + 'ordersCount' => 'int', + 'revenue' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'sku' => null, + 'price' => 'float', + 'url' => null, + 'imageUrl' => null, + 'ordersCount' => null, + 'revenue' => 'float' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'sku' => false, + 'price' => false, + 'url' => false, + 'imageUrl' => false, + 'ordersCount' => false, + 'revenue' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'sku' => 'sku', + 'price' => 'price', + 'url' => 'url', + 'imageUrl' => 'imageUrl', + 'ordersCount' => 'ordersCount', + 'revenue' => 'revenue' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'sku' => 'setSku', + 'price' => 'setPrice', + 'url' => 'setUrl', + 'imageUrl' => 'setImageUrl', + 'ordersCount' => 'setOrdersCount', + 'revenue' => 'setRevenue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'sku' => 'getSku', + 'price' => 'getPrice', + 'url' => 'getUrl', + 'imageUrl' => 'getImageUrl', + 'ordersCount' => 'getOrdersCount', + 'revenue' => 'getRevenue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('sku', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('ordersCount', $data ?? [], null); + $this->setIfExists('revenue', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets sku + * + * @return string|null + */ + public function getSku(): ?string + { + return $this->container['sku']; + } + + /** + * Sets sku + * + * @param string|null $sku sku + * + * @return $this + */ + public function setSku(?string $sku): static + { + if (is_null($sku)) { + throw new InvalidArgumentException('non-nullable sku cannot be null'); + } + $this->container['sku'] = $sku; + + return $this; + } + + /** + * Gets price + * + * @return float|null + */ + public function getPrice(): ?float + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param float|null $price price + * + * @return $this + */ + public function setPrice(?float $price): static + { + if (is_null($price)) { + throw new InvalidArgumentException('non-nullable price cannot be null'); + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl(): ?string + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url url + * + * @return $this + */ + public function setUrl(?string $url): static + { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets imageUrl + * + * @return string|null + */ + public function getImageUrl(): ?string + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl imageUrl + * + * @return $this + */ + public function setImageUrl(?string $imageUrl): static + { + if (is_null($imageUrl)) { + throw new InvalidArgumentException('non-nullable imageUrl cannot be null'); + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets ordersCount + * + * @return int|null + */ + public function getOrdersCount(): ?int + { + return $this->container['ordersCount']; + } + + /** + * Sets ordersCount + * + * @param int|null $ordersCount ordersCount + * + * @return $this + */ + public function setOrdersCount(?int $ordersCount): static + { + if (is_null($ordersCount)) { + throw new InvalidArgumentException('non-nullable ordersCount cannot be null'); + } + $this->container['ordersCount'] = $ordersCount; + + return $this; + } + + /** + * Gets revenue + * + * @return float|null + */ + public function getRevenue(): ?float + { + return $this->container['revenue']; + } + + /** + * Sets revenue + * + * @param float|null $revenue revenue + * + * @return $this + */ + public function setRevenue(?float $revenue): static + { + if (is_null($revenue)) { + throw new InvalidArgumentException('non-nullable revenue cannot be null'); + } + $this->container['revenue'] = $revenue; + + return $this; + } +} + + diff --git a/lib/Models/CorporateGroupDetailsResponse.php b/lib/Models/CorporateGroupDetailsResponse.php new file mode 100644 index 0000000..e2d5685 --- /dev/null +++ b/lib/Models/CorporateGroupDetailsResponse.php @@ -0,0 +1,275 @@ + + */ +class CorporateGroupDetailsResponse extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'corporateGroupDetailsResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'group' => '\Brevo\Client\Models\CorporateGroupDetailsResponseGroup', + 'subAccounts' => '\Brevo\Client\Models\CorporateGroupDetailsResponseSubAccountsInner[]', + 'users' => '\Brevo\Client\Models\CorporateGroupDetailsResponseUsersInner[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'group' => null, + 'subAccounts' => null, + 'users' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'group' => false, + 'subAccounts' => false, + 'users' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'group' => 'group', + 'subAccounts' => 'sub-accounts', + 'users' => 'users' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'group' => 'setGroup', + 'subAccounts' => 'setSubAccounts', + 'users' => 'setUsers' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'group' => 'getGroup', + 'subAccounts' => 'getSubAccounts', + 'users' => 'getUsers' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('group', $data ?? [], null); + $this->setIfExists('subAccounts', $data ?? [], null); + $this->setIfExists('users', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets group + * + * @return \Brevo\Client\Models\CorporateGroupDetailsResponseGroup|null + */ + public function getGroup(): ?\Brevo\Client\Models\CorporateGroupDetailsResponseGroup + { + return $this->container['group']; + } + + /** + * Sets group + * + * @param \Brevo\Client\Models\CorporateGroupDetailsResponseGroup|null $group group + * + * @return $this + */ + public function setGroup(?\Brevo\Client\Models\CorporateGroupDetailsResponseGroup $group): static + { + if (is_null($group)) { + throw new InvalidArgumentException('non-nullable group cannot be null'); + } + $this->container['group'] = $group; + + return $this; + } + + /** + * Gets subAccounts + * + * @return \Brevo\Client\Models\CorporateGroupDetailsResponseSubAccountsInner[]|null + */ + public function getSubAccounts(): ?array + { + return $this->container['subAccounts']; + } + + /** + * Sets subAccounts + * + * @param \Brevo\Client\Models\CorporateGroupDetailsResponseSubAccountsInner[]|null $subAccounts subAccounts + * + * @return $this + */ + public function setSubAccounts(?array $subAccounts): static + { + if (is_null($subAccounts)) { + throw new InvalidArgumentException('non-nullable subAccounts cannot be null'); + } + $this->container['subAccounts'] = $subAccounts; + + return $this; + } + + /** + * Gets users + * + * @return \Brevo\Client\Models\CorporateGroupDetailsResponseUsersInner[]|null + */ + public function getUsers(): ?array + { + return $this->container['users']; + } + + /** + * Sets users + * + * @param \Brevo\Client\Models\CorporateGroupDetailsResponseUsersInner[]|null $users users + * + * @return $this + */ + public function setUsers(?array $users): static + { + if (is_null($users)) { + throw new InvalidArgumentException('non-nullable users cannot be null'); + } + $this->container['users'] = $users; + + return $this; + } +} + + diff --git a/lib/Models/CorporateGroupDetailsResponseGroup.php b/lib/Models/CorporateGroupDetailsResponseGroup.php new file mode 100644 index 0000000..87b8b8a --- /dev/null +++ b/lib/Models/CorporateGroupDetailsResponseGroup.php @@ -0,0 +1,275 @@ + + */ +class CorporateGroupDetailsResponseGroup extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'corporateGroupDetailsResponse_group'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'groupName' => 'string', + 'createdAt' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'groupName' => null, + 'createdAt' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'groupName' => false, + 'createdAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'groupName' => 'groupName', + 'createdAt' => 'createdAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'groupName' => 'setGroupName', + 'createdAt' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'groupName' => 'getGroupName', + 'createdAt' => 'getCreatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('groupName', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Group id + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets groupName + * + * @return string|null + */ + public function getGroupName(): ?string + { + return $this->container['groupName']; + } + + /** + * Sets groupName + * + * @param string|null $groupName Name of the group + * + * @return $this + */ + public function setGroupName(?string $groupName): static + { + if (is_null($groupName)) { + throw new InvalidArgumentException('non-nullable groupName cannot be null'); + } + $this->container['groupName'] = $groupName; + + return $this; + } + + /** + * Gets createdAt + * + * @return string|null + */ + public function getCreatedAt(): ?string + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param string|null $createdAt Group creation date + * + * @return $this + */ + public function setCreatedAt(?string $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } +} + + diff --git a/lib/Models/CorporateGroupDetailsResponseSubAccountsInner.php b/lib/Models/CorporateGroupDetailsResponseSubAccountsInner.php new file mode 100644 index 0000000..8d68218 --- /dev/null +++ b/lib/Models/CorporateGroupDetailsResponseSubAccountsInner.php @@ -0,0 +1,275 @@ + + */ +class CorporateGroupDetailsResponseSubAccountsInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'corporateGroupDetailsResponse_sub_accounts_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'companyName' => 'string', + 'createdAt' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'int64', + 'companyName' => null, + 'createdAt' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'companyName' => false, + 'createdAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'companyName' => 'companyName', + 'createdAt' => 'createdAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'companyName' => 'setCompanyName', + 'createdAt' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'companyName' => 'getCompanyName', + 'createdAt' => 'getCreatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('companyName', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets id + * + * @return int|null + */ + public function getId(): ?int + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int|null $id Id of the sub-account organzation + * + * @return $this + */ + public function setId(?int $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets companyName + * + * @return string|null + */ + public function getCompanyName(): ?string + { + return $this->container['companyName']; + } + + /** + * Sets companyName + * + * @param string|null $companyName Name of the sub-account organzation + * + * @return $this + */ + public function setCompanyName(?string $companyName): static + { + if (is_null($companyName)) { + throw new InvalidArgumentException('non-nullable companyName cannot be null'); + } + $this->container['companyName'] = $companyName; + + return $this; + } + + /** + * Gets createdAt + * + * @return string|null + */ + public function getCreatedAt(): ?string + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param string|null $createdAt Creation date of the sub-account organzation + * + * @return $this + */ + public function setCreatedAt(?string $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } +} + + diff --git a/lib/Models/CorporateGroupDetailsResponseUsersInner.php b/lib/Models/CorporateGroupDetailsResponseUsersInner.php new file mode 100644 index 0000000..d4ca9a0 --- /dev/null +++ b/lib/Models/CorporateGroupDetailsResponseUsersInner.php @@ -0,0 +1,275 @@ + + */ +class CorporateGroupDetailsResponseUsersInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'corporateGroupDetailsResponse_users_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'email' => 'string', + 'lastName' => 'string', + 'firstName' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'email' => null, + 'lastName' => null, + 'firstName' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'lastName' => false, + 'firstName' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'email' => 'email', + 'lastName' => 'lastName', + 'firstName' => 'firstName' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'email' => 'setEmail', + 'lastName' => 'setLastName', + 'firstName' => 'setFirstName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'email' => 'getEmail', + 'lastName' => 'getLastName', + 'firstName' => 'getFirstName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('lastName', $data ?? [], null); + $this->setIfExists('firstName', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail(): ?string + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Email address of the user + * + * @return $this + */ + public function setEmail(?string $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets lastName + * + * @return string|null + */ + public function getLastName(): ?string + { + return $this->container['lastName']; + } + + /** + * Sets lastName + * + * @param string|null $lastName Last name of the user + * + * @return $this + */ + public function setLastName(?string $lastName): static + { + if (is_null($lastName)) { + throw new InvalidArgumentException('non-nullable lastName cannot be null'); + } + $this->container['lastName'] = $lastName; + + return $this; + } + + /** + * Gets firstName + * + * @return string|null + */ + public function getFirstName(): ?string + { + return $this->container['firstName']; + } + + /** + * Sets firstName + * + * @param string|null $firstName First name of the user + * + * @return $this + */ + public function setFirstName(?string $firstName): static + { + if (is_null($firstName)) { + throw new InvalidArgumentException('non-nullable firstName cannot be null'); + } + $this->container['firstName'] = $firstName; + + return $this; + } +} + + diff --git a/lib/Models/CorporateGroupIdPutRequest.php b/lib/Models/CorporateGroupIdPutRequest.php new file mode 100644 index 0000000..230ce8d --- /dev/null +++ b/lib/Models/CorporateGroupIdPutRequest.php @@ -0,0 +1,241 @@ + + */ +class CorporateGroupIdPutRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_corporate_group__id__put_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'groupName' => 'string', + 'subAccountIds' => 'int[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'groupName' => null, + 'subAccountIds' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'groupName' => false, + 'subAccountIds' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'groupName' => 'groupName', + 'subAccountIds' => 'subAccountIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'groupName' => 'setGroupName', + 'subAccountIds' => 'setSubAccountIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'groupName' => 'getGroupName', + 'subAccountIds' => 'getSubAccountIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('groupName', $data ?? [], null); + $this->setIfExists('subAccountIds', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets groupName + * + * @return string|null + */ + public function getGroupName(): ?string + { + return $this->container['groupName']; + } + + /** + * Sets groupName + * + * @param string|null $groupName The name of the group of sub-accounts + * + * @return $this + */ + public function setGroupName(?string $groupName): static + { + if (is_null($groupName)) { + throw new InvalidArgumentException('non-nullable groupName cannot be null'); + } + $this->container['groupName'] = $groupName; + + return $this; + } + + /** + * Gets subAccountIds + * + * @return int[]|null + */ + public function getSubAccountIds(): ?array + { + return $this->container['subAccountIds']; + } + + /** + * Sets subAccountIds + * + * @param int[]|null $subAccountIds Pass the list of sub-account Ids to be included in the group + * + * @return $this + */ + public function setSubAccountIds(?array $subAccountIds): static + { + if (is_null($subAccountIds)) { + throw new InvalidArgumentException('non-nullable subAccountIds cannot be null'); + } + $this->container['subAccountIds'] = $subAccountIds; + + return $this; + } +} + + diff --git a/lib/Models/CorporateGroupPost201Response.php b/lib/Models/CorporateGroupPost201Response.php new file mode 100644 index 0000000..9a3f361 --- /dev/null +++ b/lib/Models/CorporateGroupPost201Response.php @@ -0,0 +1,207 @@ + + */ +class CorporateGroupPost201Response extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_corporate_group_post_201_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } +} + + diff --git a/lib/Models/CorporateGroupPostRequest.php b/lib/Models/CorporateGroupPostRequest.php new file mode 100644 index 0000000..bd25320 --- /dev/null +++ b/lib/Models/CorporateGroupPostRequest.php @@ -0,0 +1,244 @@ + + */ +class CorporateGroupPostRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_corporate_group_post_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'groupName' => 'string', + 'subAccountIds' => 'int[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'groupName' => null, + 'subAccountIds' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'groupName' => false, + 'subAccountIds' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'groupName' => 'groupName', + 'subAccountIds' => 'subAccountIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'groupName' => 'setGroupName', + 'subAccountIds' => 'setSubAccountIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'groupName' => 'getGroupName', + 'subAccountIds' => 'getSubAccountIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('groupName', $data ?? [], null); + $this->setIfExists('subAccountIds', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['groupName'] === null) { + $invalidProperties[] = "'groupName' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets groupName + * + * @return string + */ + public function getGroupName(): string + { + return $this->container['groupName']; + } + + /** + * Sets groupName + * + * @param string $groupName The name of the group of sub-accounts + * + * @return $this + */ + public function setGroupName(string $groupName): static + { + if (is_null($groupName)) { + throw new InvalidArgumentException('non-nullable groupName cannot be null'); + } + $this->container['groupName'] = $groupName; + + return $this; + } + + /** + * Gets subAccountIds + * + * @return int[]|null + */ + public function getSubAccountIds(): ?array + { + return $this->container['subAccountIds']; + } + + /** + * Sets subAccountIds + * + * @param int[]|null $subAccountIds Pass the list of sub-account Ids to be included in the group + * + * @return $this + */ + public function setSubAccountIds(?array $subAccountIds): static + { + if (is_null($subAccountIds)) { + throw new InvalidArgumentException('non-nullable subAccountIds cannot be null'); + } + $this->container['subAccountIds'] = $subAccountIds; + + return $this; + } +} + + diff --git a/lib/Models/CorporateGroupUnlinkGroupIdSubAccountsPutRequest.php b/lib/Models/CorporateGroupUnlinkGroupIdSubAccountsPutRequest.php new file mode 100644 index 0000000..a012786 --- /dev/null +++ b/lib/Models/CorporateGroupUnlinkGroupIdSubAccountsPutRequest.php @@ -0,0 +1,210 @@ + + */ +class CorporateGroupUnlinkGroupIdSubAccountsPutRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_corporate_group_unlink__groupId__subAccounts_put_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'subAccountIds' => 'int[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'subAccountIds' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'subAccountIds' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'subAccountIds' => 'subAccountIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'subAccountIds' => 'setSubAccountIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'subAccountIds' => 'getSubAccountIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('subAccountIds', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['subAccountIds'] === null) { + $invalidProperties[] = "'subAccountIds' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets subAccountIds + * + * @return int[] + */ + public function getSubAccountIds(): array + { + return $this->container['subAccountIds']; + } + + /** + * Sets subAccountIds + * + * @param int[] $subAccountIds List of sub-account ids + * + * @return $this + */ + public function setSubAccountIds(array $subAccountIds): static + { + if (is_null($subAccountIds)) { + throw new InvalidArgumentException('non-nullable subAccountIds cannot be null'); + } + $this->container['subAccountIds'] = $subAccountIds; + + return $this; + } +} + + diff --git a/lib/Models/CorporateIpGet200ResponseInner.php b/lib/Models/CorporateIpGet200ResponseInner.php new file mode 100644 index 0000000..0131c62 --- /dev/null +++ b/lib/Models/CorporateIpGet200ResponseInner.php @@ -0,0 +1,275 @@ + + */ +class CorporateIpGet200ResponseInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_corporate_ip_get_200_response_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'ip' => 'string', + 'domain' => 'string', + 'transactional' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'ip' => null, + 'domain' => null, + 'transactional' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'ip' => false, + 'domain' => false, + 'transactional' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'ip' => 'ip', + 'domain' => 'domain', + 'transactional' => 'transactional' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'ip' => 'setIp', + 'domain' => 'setDomain', + 'transactional' => 'setTransactional' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'ip' => 'getIp', + 'domain' => 'getDomain', + 'transactional' => 'getTransactional' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('ip', $data ?? [], null); + $this->setIfExists('domain', $data ?? [], null); + $this->setIfExists('transactional', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets ip + * + * @return string|null + */ + public function getIp(): ?string + { + return $this->container['ip']; + } + + /** + * Sets ip + * + * @param string|null $ip ip + * + * @return $this + */ + public function setIp(?string $ip): static + { + if (is_null($ip)) { + throw new InvalidArgumentException('non-nullable ip cannot be null'); + } + $this->container['ip'] = $ip; + + return $this; + } + + /** + * Gets domain + * + * @return string|null + */ + public function getDomain(): ?string + { + return $this->container['domain']; + } + + /** + * Sets domain + * + * @param string|null $domain domain + * + * @return $this + */ + public function setDomain(?string $domain): static + { + if (is_null($domain)) { + throw new InvalidArgumentException('non-nullable domain cannot be null'); + } + $this->container['domain'] = $domain; + + return $this; + } + + /** + * Gets transactional + * + * @return bool|null + */ + public function getTransactional(): ?bool + { + return $this->container['transactional']; + } + + /** + * Sets transactional + * + * @param bool|null $transactional transactional + * + * @return $this + */ + public function setTransactional(?bool $transactional): static + { + if (is_null($transactional)) { + throw new InvalidArgumentException('non-nullable transactional cannot be null'); + } + $this->container['transactional'] = $transactional; + + return $this; + } +} + + diff --git a/lib/Models/CorporateSsoTokenPostRequest.php b/lib/Models/CorporateSsoTokenPostRequest.php new file mode 100644 index 0000000..3a8e377 --- /dev/null +++ b/lib/Models/CorporateSsoTokenPostRequest.php @@ -0,0 +1,210 @@ + + */ +class CorporateSsoTokenPostRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_corporate_ssoToken_post_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'email' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'email' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'email' => 'email' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'email' => 'setEmail' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('email', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['email'] === null) { + $invalidProperties[] = "'email' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets email + * + * @return string + */ + public function getEmail(): string + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string $email User email of admin account + * + * @return $this + */ + public function setEmail(string $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } +} + + diff --git a/lib/Models/CorporateSubAccountIpAssociatePostRequest.php b/lib/Models/CorporateSubAccountIpAssociatePostRequest.php new file mode 100644 index 0000000..5d7166e --- /dev/null +++ b/lib/Models/CorporateSubAccountIpAssociatePostRequest.php @@ -0,0 +1,247 @@ + + */ +class CorporateSubAccountIpAssociatePostRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_corporate_subAccount_ip_associate_post_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'ip' => 'string', + 'ids' => 'int[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'ip' => null, + 'ids' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'ip' => false, + 'ids' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'ip' => 'ip', + 'ids' => 'ids' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'ip' => 'setIp', + 'ids' => 'setIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'ip' => 'getIp', + 'ids' => 'getIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('ip', $data ?? [], null); + $this->setIfExists('ids', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['ip'] === null) { + $invalidProperties[] = "'ip' can't be null"; + } + if ($this->container['ids'] === null) { + $invalidProperties[] = "'ids' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets ip + * + * @return string + */ + public function getIp(): string + { + return $this->container['ip']; + } + + /** + * Sets ip + * + * @param string $ip IP address + * + * @return $this + */ + public function setIp(string $ip): static + { + if (is_null($ip)) { + throw new InvalidArgumentException('non-nullable ip cannot be null'); + } + $this->container['ip'] = $ip; + + return $this; + } + + /** + * Gets ids + * + * @return int[] + */ + public function getIds(): array + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param int[] $ids Pass the list of sub-account Ids to be associated with the IP address + * + * @return $this + */ + public function setIds(array $ids): static + { + if (is_null($ids)) { + throw new InvalidArgumentException('non-nullable ids cannot be null'); + } + $this->container['ids'] = $ids; + + return $this; + } +} + + diff --git a/lib/Models/CorporateSubAccountIpDissociatePutRequest.php b/lib/Models/CorporateSubAccountIpDissociatePutRequest.php new file mode 100644 index 0000000..3779a67 --- /dev/null +++ b/lib/Models/CorporateSubAccountIpDissociatePutRequest.php @@ -0,0 +1,247 @@ + + */ +class CorporateSubAccountIpDissociatePutRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_corporate_subAccount_ip_dissociate_put_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'ip' => 'string', + 'ids' => 'int[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'ip' => null, + 'ids' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'ip' => false, + 'ids' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'ip' => 'ip', + 'ids' => 'ids' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'ip' => 'setIp', + 'ids' => 'setIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'ip' => 'getIp', + 'ids' => 'getIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('ip', $data ?? [], null); + $this->setIfExists('ids', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['ip'] === null) { + $invalidProperties[] = "'ip' can't be null"; + } + if ($this->container['ids'] === null) { + $invalidProperties[] = "'ids' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets ip + * + * @return string + */ + public function getIp(): string + { + return $this->container['ip']; + } + + /** + * Sets ip + * + * @param string $ip IP address + * + * @return $this + */ + public function setIp(string $ip): static + { + if (is_null($ip)) { + throw new InvalidArgumentException('non-nullable ip cannot be null'); + } + $this->container['ip'] = $ip; + + return $this; + } + + /** + * Gets ids + * + * @return int[] + */ + public function getIds(): array + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param int[] $ids Pass the list of sub-account Ids to be dissociated from the IP address + * + * @return $this + */ + public function setIds(array $ids): static + { + if (is_null($ids)) { + throw new InvalidArgumentException('non-nullable ids cannot be null'); + } + $this->container['ids'] = $ids; + + return $this; + } +} + + diff --git a/lib/Models/CorporateSubAccountKeyPostRequest.php b/lib/Models/CorporateSubAccountKeyPostRequest.php new file mode 100644 index 0000000..796c9bd --- /dev/null +++ b/lib/Models/CorporateSubAccountKeyPostRequest.php @@ -0,0 +1,247 @@ + + */ +class CorporateSubAccountKeyPostRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_corporate_subAccount_key_post_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'int64', + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets id + * + * @return int + */ + public function getId(): int + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id Id of the sub-account organization + * + * @return $this + */ + public function setId(int $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Name of the API key + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } +} + + diff --git a/lib/Models/CorporateSubAccountSsoTokenPostRequest.php b/lib/Models/CorporateSubAccountSsoTokenPostRequest.php new file mode 100644 index 0000000..726e421 --- /dev/null +++ b/lib/Models/CorporateSubAccountSsoTokenPostRequest.php @@ -0,0 +1,358 @@ + + */ +class CorporateSubAccountSsoTokenPostRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_corporate_subAccount_ssoToken_post_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'email' => 'string', + 'target' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'int64', + 'email' => null, + 'target' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'email' => false, + 'target' => false, + 'url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'email' => 'email', + 'target' => 'target', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'email' => 'setEmail', + 'target' => 'setTarget', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'email' => 'getEmail', + 'target' => 'getTarget', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const TARGET_AUTOMATION = 'automation'; + public const TARGET_EMAIL_CAMPAIGN = 'email_campaign'; + public const TARGET_CONTACTS = 'contacts'; + public const TARGET_LANDING_PAGES = 'landing_pages'; + public const TARGET_EMAIL_TRANSACTIONAL = 'email_transactional'; + public const TARGET_SENDERS = 'senders'; + public const TARGET_SMS_CAMPAIGN = 'sms_campaign'; + public const TARGET_SMS_TRANSACTIONAL = 'sms_transactional'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTargetAllowableValues() + { + return [ + self::TARGET_AUTOMATION, + self::TARGET_EMAIL_CAMPAIGN, + self::TARGET_CONTACTS, + self::TARGET_LANDING_PAGES, + self::TARGET_EMAIL_TRANSACTIONAL, + self::TARGET_SENDERS, + self::TARGET_SMS_CAMPAIGN, + self::TARGET_SMS_TRANSACTIONAL, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('target', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + $allowedValues = $this->getTargetAllowableValues(); + if (!is_null($this->container['target']) && !in_array($this->container['target'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'target', must be one of '%s'", + $this->container['target'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets id + * + * @return int + */ + public function getId(): int + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id Id of the sub-account organization + * + * @return $this + */ + public function setId(int $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail(): ?string + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email User email of sub-account organization + * + * @return $this + */ + public function setEmail(?string $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets target + * + * @return string|null + */ + public function getTarget(): ?string + { + return $this->container['target']; + } + + /** + * Sets target + * + * @param string|null $target **Set target after login success** * **automation** - Redirect to Automation after login * **email_campaign** - Redirect to Email Campaign after login * **contacts** - Redirect to Contacts after login * **landing_pages** - Redirect to Landing Pages after login * **email_transactional** - Redirect to Email Transactional after login * **senders** - Redirect to Senders after login * **sms_campaign** - Redirect to Sms Campaign after login * **sms_transactional** - Redirect to Sms Transactional after login + * + * @return $this + */ + public function setTarget(?string $target): static + { + if (is_null($target)) { + throw new InvalidArgumentException('non-nullable target cannot be null'); + } + $allowedValues = $this->getTargetAllowableValues(); + if (!in_array($target, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'target', must be one of '%s'", + $target, + implode("', '", $allowedValues) + ) + ); + } + $this->container['target'] = $target; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl(): ?string + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url Set the full target URL after login success. The user will land directly on this target URL after login + * + * @return $this + */ + public function setUrl(?string $url): static + { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } +} + + diff --git a/lib/Models/CorporateUserEmailPermissionsPutRequest.php b/lib/Models/CorporateUserEmailPermissionsPutRequest.php new file mode 100644 index 0000000..348bba4 --- /dev/null +++ b/lib/Models/CorporateUserEmailPermissionsPutRequest.php @@ -0,0 +1,247 @@ + + */ +class CorporateUserEmailPermissionsPutRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_corporate_user__email__permissions_put_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'allFeaturesAccess' => 'bool', + 'privileges' => '\Brevo\Client\Models\CorporateUserEmailPermissionsPutRequestPrivilegesInner[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'allFeaturesAccess' => null, + 'privileges' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'allFeaturesAccess' => false, + 'privileges' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'allFeaturesAccess' => 'all_features_access', + 'privileges' => 'privileges' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'allFeaturesAccess' => 'setAllFeaturesAccess', + 'privileges' => 'setPrivileges' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'allFeaturesAccess' => 'getAllFeaturesAccess', + 'privileges' => 'getPrivileges' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('allFeaturesAccess', $data ?? [], null); + $this->setIfExists('privileges', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['allFeaturesAccess'] === null) { + $invalidProperties[] = "'allFeaturesAccess' can't be null"; + } + if ($this->container['privileges'] === null) { + $invalidProperties[] = "'privileges' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets allFeaturesAccess + * + * @return bool + */ + public function getAllFeaturesAccess(): bool + { + return $this->container['allFeaturesAccess']; + } + + /** + * Sets allFeaturesAccess + * + * @param bool $allFeaturesAccess All access to the features + * + * @return $this + */ + public function setAllFeaturesAccess(bool $allFeaturesAccess): static + { + if (is_null($allFeaturesAccess)) { + throw new InvalidArgumentException('non-nullable allFeaturesAccess cannot be null'); + } + $this->container['allFeaturesAccess'] = $allFeaturesAccess; + + return $this; + } + + /** + * Gets privileges + * + * @return \Brevo\Client\Models\CorporateUserEmailPermissionsPutRequestPrivilegesInner[] + */ + public function getPrivileges(): array + { + return $this->container['privileges']; + } + + /** + * Sets privileges + * + * @param \Brevo\Client\Models\CorporateUserEmailPermissionsPutRequestPrivilegesInner[] $privileges privileges + * + * @return $this + */ + public function setPrivileges(array $privileges): static + { + if (is_null($privileges)) { + throw new InvalidArgumentException('non-nullable privileges cannot be null'); + } + $this->container['privileges'] = $privileges; + + return $this; + } +} + + diff --git a/lib/Models/CorporateUserEmailPermissionsPutRequestPrivilegesInner.php b/lib/Models/CorporateUserEmailPermissionsPutRequestPrivilegesInner.php new file mode 100644 index 0000000..ad26ced --- /dev/null +++ b/lib/Models/CorporateUserEmailPermissionsPutRequestPrivilegesInner.php @@ -0,0 +1,326 @@ + + */ +class CorporateUserEmailPermissionsPutRequestPrivilegesInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_corporate_user__email__permissions_put_request_privileges_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'feature' => 'string', + 'permissions' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'feature' => null, + 'permissions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'feature' => false, + 'permissions' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'feature' => 'feature', + 'permissions' => 'permissions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'feature' => 'setFeature', + 'permissions' => 'setPermissions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'feature' => 'getFeature', + 'permissions' => 'getPermissions' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const FEATURE_USER_MANAGEMENT = 'user_management'; + public const FEATURE_API = 'api'; + public const FEATURE_MY_PLAN = 'my_plan'; + public const FEATURE_APPS_MANAGEMENT = 'apps_management'; + public const FEATURE_ANALYTICS = 'analytics'; + public const FEATURE_SUB_ORGANIZATION_GROUPS = 'sub_organization_groups'; + public const FEATURE_CREATE_SUB_ORGANIZATIONS = 'create_sub_organizations'; + public const FEATURE_MANAGE_SUB_ORGANIZATIONS = 'manage_sub_organizations'; + public const FEATURE_SECURITY = 'security'; + public const PERMISSIONS_ALL = 'all'; + public const PERMISSIONS_NONE = 'none'; + public const PERMISSIONS_CREATE = 'create'; + public const PERMISSIONS_EDIT_DELETE = 'edit_delete'; + public const PERMISSIONS_CREATE_ALERTS = 'create_alerts'; + public const PERMISSIONS_DOWNLOAD_DATA = 'download_data'; + public const PERMISSIONS_MY_LOOKS = 'my_looks'; + public const PERMISSIONS_EXPLORE_CREATE = 'explore_create'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFeatureAllowableValues() + { + return [ + self::FEATURE_USER_MANAGEMENT, + self::FEATURE_API, + self::FEATURE_MY_PLAN, + self::FEATURE_APPS_MANAGEMENT, + self::FEATURE_ANALYTICS, + self::FEATURE_SUB_ORGANIZATION_GROUPS, + self::FEATURE_CREATE_SUB_ORGANIZATIONS, + self::FEATURE_MANAGE_SUB_ORGANIZATIONS, + self::FEATURE_SECURITY, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getPermissionsAllowableValues() + { + return [ + self::PERMISSIONS_ALL, + self::PERMISSIONS_NONE, + self::PERMISSIONS_CREATE, + self::PERMISSIONS_EDIT_DELETE, + self::PERMISSIONS_CREATE_ALERTS, + self::PERMISSIONS_DOWNLOAD_DATA, + self::PERMISSIONS_MY_LOOKS, + self::PERMISSIONS_EXPLORE_CREATE, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('feature', $data ?? [], null); + $this->setIfExists('permissions', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = $this->getFeatureAllowableValues(); + if (!is_null($this->container['feature']) && !in_array($this->container['feature'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'feature', must be one of '%s'", + $this->container['feature'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets feature + * + * @return string|null + */ + public function getFeature(): ?string + { + return $this->container['feature']; + } + + /** + * Sets feature + * + * @param string|null $feature feature name + * + * @return $this + */ + public function setFeature(?string $feature): static + { + if (is_null($feature)) { + throw new InvalidArgumentException('non-nullable feature cannot be null'); + } + $allowedValues = $this->getFeatureAllowableValues(); + if (!in_array($feature, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'feature', must be one of '%s'", + $feature, + implode("', '", $allowedValues) + ) + ); + } + $this->container['feature'] = $feature; + + return $this; + } + + /** + * Gets permissions + * + * @return string[]|null + */ + public function getPermissions(): ?array + { + return $this->container['permissions']; + } + + /** + * Sets permissions + * + * @param string[]|null $permissions Permission for the feature + * + * @return $this + */ + public function setPermissions(?array $permissions): static + { + if (is_null($permissions)) { + throw new InvalidArgumentException('non-nullable permissions cannot be null'); + } + $allowedValues = $this->getPermissionsAllowableValues(); + if (array_diff($permissions, $allowedValues)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value for 'permissions', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['permissions'] = $permissions; + + return $this; + } +} + + diff --git a/lib/Models/CorporateUserInvitationActionEmailPut200Response.php b/lib/Models/CorporateUserInvitationActionEmailPut200Response.php new file mode 100644 index 0000000..3a8c584 --- /dev/null +++ b/lib/Models/CorporateUserInvitationActionEmailPut200Response.php @@ -0,0 +1,207 @@ + + */ +class CorporateUserInvitationActionEmailPut200Response extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_corporate_user_invitation__action___email__put_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage(): ?string + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message Action success message + * + * @return $this + */ + public function setMessage(?string $message): static + { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } +} + + diff --git a/lib/Models/CreateApiKeyRequest.php b/lib/Models/CreateApiKeyRequest.php deleted file mode 100644 index edf6659..0000000 --- a/lib/Models/CreateApiKeyRequest.php +++ /dev/null @@ -1,338 +0,0 @@ - 'int', - 'name' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => 'int64', - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'name' => 'name' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'name' => 'setName' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - '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 - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return int - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param int $id Id of the sub-account organization - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Name of the API key - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/CreateApiKeyResponse.php b/lib/Models/CreateApiKeyResponse.php index 2076727..92cb4c9 100644 --- a/lib/Models/CreateApiKeyResponse.php +++ b/lib/Models/CreateApiKeyResponse.php @@ -2,61 +2,63 @@ /** * CreateApiKeyResponse * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateApiKeyResponse Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateApiKeyResponse implements ModelInterface, ArrayAccess +class CreateApiKeyResponse extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createApiKeyResponse'; + protected static string $openAPIModelName = 'createApiKeyResponse'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'status' => 'string', 'key' => 'string' ]; @@ -64,40 +66,37 @@ class CreateApiKeyResponse implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'status' => null, 'key' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'status' => false, + 'key' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'status' => 'status', 'key' => 'key' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'status' => 'setStatus', 'key' => 'setKey' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'status' => 'getStatus', 'key' => 'getKey' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +145,56 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['key'] = isset($data['key']) ? $data['key'] : null; + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('key', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + if ($this->container['key'] === null) { + $invalidProperties[] = "'key' can't be null"; + } return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets status * * @return string */ - public function getStatus() + public function getStatus(): string { return $this->container['status']; } @@ -227,8 +206,11 @@ public function getStatus() * * @return $this */ - public function setStatus($status) + public function setStatus(string $status): static { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -239,7 +221,7 @@ public function setStatus($status) * * @return string */ - public function getKey() + public function getKey(): string { return $this->container['key']; } @@ -247,89 +229,19 @@ public function getKey() /** * Sets key * - * @param string $key API Key + * @param string $key API key * * @return $this */ - public function setKey($key) + public function setKey(string $key): static { + if (is_null($key)) { + throw new InvalidArgumentException('non-nullable key cannot be null'); + } $this->container['key'] = $key; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateAttribute.php b/lib/Models/CreateAttribute.php index 048d5da..58430ef 100644 --- a/lib/Models/CreateAttribute.php +++ b/lib/Models/CreateAttribute.php @@ -2,133 +2,140 @@ /** * CreateAttribute * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateAttribute Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateAttribute implements ModelInterface, ArrayAccess +class CreateAttribute extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createAttribute'; + protected static string $openAPIModelName = 'createAttribute'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'value' => 'string', 'isRecurring' => 'bool', - 'enumeration' => '\Brevo\Client\Models\CreateAttributeEnumeration[]', + 'enumeration' => '\Brevo\Client\Models\CreateAttributeEnumerationInner[]', + 'multiCategoryOptions' => 'string[]', 'type' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'value' => null, 'isRecurring' => null, 'enumeration' => null, + 'multiCategoryOptions' => null, 'type' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'value' => false, + 'isRecurring' => false, + 'enumeration' => false, + 'multiCategoryOptions' => false, + 'type' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'value' => 'value', 'isRecurring' => 'isRecurring', 'enumeration' => 'enumeration', + 'multiCategoryOptions' => 'multiCategoryOptions', 'type' => 'type' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'value' => 'setValue', 'isRecurring' => 'setIsRecurring', 'enumeration' => 'setEnumeration', + 'multiCategoryOptions' => 'setMultiCategoryOptions', 'type' => 'setType' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'value' => 'getValue', 'isRecurring' => 'getIsRecurring', 'enumeration' => 'getEnumeration', + 'multiCategoryOptions' => 'getMultiCategoryOptions', 'type' => 'getType' ]; @@ -136,9 +143,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +153,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,31 +163,20 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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'; - const TYPE_BOOLEAN = 'boolean'; - const TYPE_ID = 'id'; - const TYPE_CATEGORY = 'category'; - - + public const TYPE_TEXT = 'text'; + public const TYPE_DATE = 'date'; + public const TYPE_FLOAT = 'float'; + public const TYPE_BOOLEAN = 'boolean'; + public const TYPE_ID = 'id'; + public const TYPE_CATEGORY = 'category'; + public const TYPE_MULTIPLE_CHOICE = 'multiple-choice'; /** * Gets allowable values of the enum @@ -196,44 +192,45 @@ public function getTypeAllowableValues() self::TYPE_BOOLEAN, self::TYPE_ID, self::TYPE_CATEGORY, + self::TYPE_MULTIPLE_CHOICE, ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['value'] = isset($data['value']) ? $data['value'] : null; - $this->container['isRecurring'] = isset($data['isRecurring']) ? $data['isRecurring'] : null; - $this->container['enumeration'] = isset($data['enumeration']) ? $data['enumeration'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('isRecurring', $data ?? [], null); + $this->setIfExists('enumeration', $data ?? [], null); + $this->setIfExists('multiCategoryOptions', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; $allowedValues = $this->getTypeAllowableValues(); if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], implode("', '", $allowedValues) ); } @@ -241,24 +238,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets value * - * @return string + * @return string|null */ - public function getValue() + public function getValue(): ?string { return $this->container['value']; } @@ -266,12 +251,15 @@ 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|null $value Value of the attribute. **Use only if the attribute's category is 'calculated' or 'global'** * * @return $this */ - public function setValue($value) + public function setValue(?string $value): static { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -280,9 +268,9 @@ public function setValue($value) /** * Gets isRecurring * - * @return bool + * @return bool|null */ - public function getIsRecurring() + public function getIsRecurring(): ?bool { return $this->container['isRecurring']; } @@ -290,12 +278,15 @@ public function getIsRecurring() /** * Sets isRecurring * - * @param bool $isRecurring Type of the attribute. Use only if the attribute's category is 'calculated' or 'global' + * @param bool|null $isRecurring Type of the attribute. **Use only if the attribute's category is 'calculated' or 'global'** * * @return $this */ - public function setIsRecurring($isRecurring) + public function setIsRecurring(?bool $isRecurring): static { + if (is_null($isRecurring)) { + throw new InvalidArgumentException('non-nullable isRecurring cannot be null'); + } $this->container['isRecurring'] = $isRecurring; return $this; @@ -304,9 +295,9 @@ public function setIsRecurring($isRecurring) /** * Gets enumeration * - * @return \Brevo\Client\Models\CreateAttributeEnumeration[] + * @return \Brevo\Client\Models\CreateAttributeEnumerationInner[]|null */ - public function getEnumeration() + public function getEnumeration(): ?array { return $this->container['enumeration']; } @@ -314,121 +305,82 @@ public function getEnumeration() /** * Sets enumeration * - * @param \Brevo\Client\Models\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\"}] + * @param \Brevo\Client\Models\CreateAttributeEnumerationInner[]|null $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) + public function setEnumeration(?array $enumeration): static { + if (is_null($enumeration)) { + throw new InvalidArgumentException('non-nullable enumeration cannot be null'); + } $this->container['enumeration'] = $enumeration; return $this; } /** - * Gets type + * Gets multiCategoryOptions * - * @return string + * @return string[]|null */ - public function getType() + public function getMultiCategoryOptions(): ?array { - return $this->container['type']; + return $this->container['multiCategoryOptions']; } /** - * Sets type + * Sets multiCategoryOptions * - * @param string $type Type of the attribute. Use only if the attribute's category is 'normal', 'category' or 'transactional' ( type 'boolean' is only available if the category is 'normal' attribute, type 'id' is only available if the category is 'transactional' attribute & type 'category' is only available if the category is 'category' attribute ) + * @param string[]|null $multiCategoryOptions List of options you want to add for multiple-choice attribute. **Use only if the attribute's category is \"normal\" and attribute's type is \"multiple-choice\".** For example: **[\"USA\",\"INDIA\"]** * * @return $this */ - public function setType($type) + public function setMultiCategoryOptions(?array $multiCategoryOptions): static { - $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($type) && !in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'type', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); + if (is_null($multiCategoryOptions)) { + throw new InvalidArgumentException('non-nullable multiCategoryOptions cannot be null'); } - $this->container['type'] = $type; + $this->container['multiCategoryOptions'] = $multiCategoryOptions; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } /** - * Gets offset. - * - * @param integer $offset Offset + * Gets type * - * @return mixed + * @return string|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function getType(): ?string { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container['type']; } /** - * Sets value based on offset. + * Sets type * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param string|null $type Type of the attribute. **Use only if the attribute's category is 'normal', 'category' or 'transactional'** Type **boolean and multiple-choice** is only available if the category is **normal** attribute Type **id** is only available if the category is **transactional** attribute Type **category** is only available if the category is **category** attribute * - * @return void + * @return $this */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function setType(?string $type): static { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) ); } + $this->container['type'] = $type; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/CreateAttributeEnumeration.php b/lib/Models/CreateAttributeEnumeration.php deleted file mode 100644 index e74494b..0000000 --- a/lib/Models/CreateAttributeEnumeration.php +++ /dev/null @@ -1,341 +0,0 @@ - 'int', - 'label' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'value' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'value' => 'value', - 'label' => 'label' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'value' => 'setValue', - 'label' => 'setLabel' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'value' => 'getValue', - '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 - */ - public function __construct(array $data = null) - { - $this->container['value'] = isset($data['value']) ? $data['value'] : null; - $this->container['label'] = isset($data['label']) ? $data['label'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['value'] === null) { - $invalidProperties[] = "'value' can't be null"; - } - if ($this->container['label'] === null) { - $invalidProperties[] = "'label' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets value - * - * @return int - */ - public function getValue() - { - return $this->container['value']; - } - - /** - * Sets value - * - * @param int $value Id of the value - * - * @return $this - */ - public function setValue($value) - { - $this->container['value'] = $value; - - return $this; - } - - /** - * Gets label - * - * @return string - */ - public function getLabel() - { - return $this->container['label']; - } - - /** - * Sets label - * - * @param string $label Label of the value - * - * @return $this - */ - public function setLabel($label) - { - $this->container['label'] = $label; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/CreateAttributeEnumerationInner.php b/lib/Models/CreateAttributeEnumerationInner.php new file mode 100644 index 0000000..41c2770 --- /dev/null +++ b/lib/Models/CreateAttributeEnumerationInner.php @@ -0,0 +1,247 @@ + + */ +class CreateAttributeEnumerationInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createAttribute_enumeration_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'value' => 'int', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'value' => null, + 'label' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'value' => false, + 'label' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'value' => 'value', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'value' => 'setValue', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'value' => 'getValue', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets value + * + * @return int + */ + public function getValue(): int + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param int $value Id of the value + * + * @return $this + */ + public function setValue(int $value): static + { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets label + * + * @return string + */ + public function getLabel(): string + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string $label Label of the value + * + * @return $this + */ + public function setLabel(string $label): static + { + if (is_null($label)) { + throw new InvalidArgumentException('non-nullable label cannot be null'); + } + $this->container['label'] = $label; + + return $this; + } +} + + diff --git a/lib/Models/CreateBalanceDefinitionPayload.php b/lib/Models/CreateBalanceDefinitionPayload.php new file mode 100644 index 0000000..9addace --- /dev/null +++ b/lib/Models/CreateBalanceDefinitionPayload.php @@ -0,0 +1,933 @@ + + */ +class CreateBalanceDefinitionPayload extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createBalanceDefinitionPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'unit' => 'string', + 'description' => 'string', + 'meta' => 'object', + 'minAmount' => 'float', + 'maxAmount' => 'float', + 'maxCreditAmountLimit' => 'float', + 'maxDebitAmountLimit' => 'float', + 'balanceOptionAmountOvertakingStrategy' => 'string', + 'balanceOptionCreditRounding' => 'string', + 'balanceOptionDebitRounding' => 'string', + 'balanceAvailabilityDurationValue' => 'float', + 'balanceAvailabilityDurationUnit' => 'string', + 'balanceAvailabilityDurationModifier' => 'string', + 'balanceExpirationDate' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'unit' => null, + 'description' => null, + 'meta' => null, + 'minAmount' => null, + 'maxAmount' => null, + 'maxCreditAmountLimit' => null, + 'maxDebitAmountLimit' => null, + 'balanceOptionAmountOvertakingStrategy' => null, + 'balanceOptionCreditRounding' => null, + 'balanceOptionDebitRounding' => null, + 'balanceAvailabilityDurationValue' => null, + 'balanceAvailabilityDurationUnit' => null, + 'balanceAvailabilityDurationModifier' => null, + 'balanceExpirationDate' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'unit' => false, + 'description' => false, + 'meta' => false, + 'minAmount' => false, + 'maxAmount' => false, + 'maxCreditAmountLimit' => false, + 'maxDebitAmountLimit' => false, + 'balanceOptionAmountOvertakingStrategy' => false, + 'balanceOptionCreditRounding' => false, + 'balanceOptionDebitRounding' => false, + 'balanceAvailabilityDurationValue' => false, + 'balanceAvailabilityDurationUnit' => false, + 'balanceAvailabilityDurationModifier' => false, + 'balanceExpirationDate' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'unit' => 'unit', + 'description' => 'description', + 'meta' => 'meta', + 'minAmount' => 'minAmount', + 'maxAmount' => 'maxAmount', + 'maxCreditAmountLimit' => 'maxCreditAmountLimit', + 'maxDebitAmountLimit' => 'maxDebitAmountLimit', + 'balanceOptionAmountOvertakingStrategy' => 'balanceOptionAmountOvertakingStrategy', + 'balanceOptionCreditRounding' => 'balanceOptionCreditRounding', + 'balanceOptionDebitRounding' => 'balanceOptionDebitRounding', + 'balanceAvailabilityDurationValue' => 'balanceAvailabilityDurationValue', + 'balanceAvailabilityDurationUnit' => 'balanceAvailabilityDurationUnit', + 'balanceAvailabilityDurationModifier' => 'balanceAvailabilityDurationModifier', + 'balanceExpirationDate' => 'balanceExpirationDate' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'unit' => 'setUnit', + 'description' => 'setDescription', + 'meta' => 'setMeta', + 'minAmount' => 'setMinAmount', + 'maxAmount' => 'setMaxAmount', + 'maxCreditAmountLimit' => 'setMaxCreditAmountLimit', + 'maxDebitAmountLimit' => 'setMaxDebitAmountLimit', + 'balanceOptionAmountOvertakingStrategy' => 'setBalanceOptionAmountOvertakingStrategy', + 'balanceOptionCreditRounding' => 'setBalanceOptionCreditRounding', + 'balanceOptionDebitRounding' => 'setBalanceOptionDebitRounding', + 'balanceAvailabilityDurationValue' => 'setBalanceAvailabilityDurationValue', + 'balanceAvailabilityDurationUnit' => 'setBalanceAvailabilityDurationUnit', + 'balanceAvailabilityDurationModifier' => 'setBalanceAvailabilityDurationModifier', + 'balanceExpirationDate' => 'setBalanceExpirationDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'unit' => 'getUnit', + 'description' => 'getDescription', + 'meta' => 'getMeta', + 'minAmount' => 'getMinAmount', + 'maxAmount' => 'getMaxAmount', + 'maxCreditAmountLimit' => 'getMaxCreditAmountLimit', + 'maxDebitAmountLimit' => 'getMaxDebitAmountLimit', + 'balanceOptionAmountOvertakingStrategy' => 'getBalanceOptionAmountOvertakingStrategy', + 'balanceOptionCreditRounding' => 'getBalanceOptionCreditRounding', + 'balanceOptionDebitRounding' => 'getBalanceOptionDebitRounding', + 'balanceAvailabilityDurationValue' => 'getBalanceAvailabilityDurationValue', + 'balanceAvailabilityDurationUnit' => 'getBalanceAvailabilityDurationUnit', + 'balanceAvailabilityDurationModifier' => 'getBalanceAvailabilityDurationModifier', + 'balanceExpirationDate' => 'getBalanceExpirationDate' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const UNIT_POINTS = 'points'; + public const UNIT_EUR = 'EUR'; + public const UNIT_USD = 'USD'; + public const UNIT_MXN = 'MXN'; + public const UNIT_GBP = 'GBP'; + public const UNIT_INR = 'INR'; + public const UNIT_CAD = 'CAD'; + public const UNIT_SGD = 'SGD'; + public const UNIT_RON = 'RON'; + public const UNIT_JPY = 'JPY'; + public const UNIT_MYR = 'MYR'; + public const UNIT_CLP = 'CLP'; + public const UNIT_PEN = 'PEN'; + public const UNIT_MAD = 'MAD'; + public const UNIT_AUD = 'AUD'; + public const UNIT_CHF = 'CHF'; + public const UNIT_BRL = 'BRL'; + public const BALANCE_OPTION_AMOUNT_OVERTAKING_STRATEGY_STRICT = 'strict'; + public const BALANCE_OPTION_AMOUNT_OVERTAKING_STRATEGY_PARTIAL = 'partial'; + public const BALANCE_OPTION_CREDIT_ROUNDING_NATURAL = 'natural'; + public const BALANCE_OPTION_CREDIT_ROUNDING_UPPER = 'upper'; + public const BALANCE_OPTION_CREDIT_ROUNDING_LOWER = 'lower'; + public const BALANCE_OPTION_DEBIT_ROUNDING_NATURAL = 'natural'; + public const BALANCE_OPTION_DEBIT_ROUNDING_UPPER = 'upper'; + public const BALANCE_OPTION_DEBIT_ROUNDING_LOWER = 'lower'; + public const BALANCE_AVAILABILITY_DURATION_UNIT_DAY = 'day'; + public const BALANCE_AVAILABILITY_DURATION_UNIT_WEEK = 'week'; + public const BALANCE_AVAILABILITY_DURATION_UNIT_MONTH = 'month'; + public const BALANCE_AVAILABILITY_DURATION_UNIT_YEAR = 'year'; + public const BALANCE_AVAILABILITY_DURATION_MODIFIER_START_OF_PERIOD = 'startOfPeriod'; + public const BALANCE_AVAILABILITY_DURATION_MODIFIER_END_OF_PERIOD = 'endOfPeriod'; + public const BALANCE_AVAILABILITY_DURATION_MODIFIER_NO_MODIFICATION = 'noModification'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getUnitAllowableValues() + { + return [ + self::UNIT_POINTS, + self::UNIT_EUR, + self::UNIT_USD, + self::UNIT_MXN, + self::UNIT_GBP, + self::UNIT_INR, + self::UNIT_CAD, + self::UNIT_SGD, + self::UNIT_RON, + self::UNIT_JPY, + self::UNIT_MYR, + self::UNIT_CLP, + self::UNIT_PEN, + self::UNIT_MAD, + self::UNIT_AUD, + self::UNIT_CHF, + self::UNIT_BRL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getBalanceOptionAmountOvertakingStrategyAllowableValues() + { + return [ + self::BALANCE_OPTION_AMOUNT_OVERTAKING_STRATEGY_STRICT, + self::BALANCE_OPTION_AMOUNT_OVERTAKING_STRATEGY_PARTIAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getBalanceOptionCreditRoundingAllowableValues() + { + return [ + self::BALANCE_OPTION_CREDIT_ROUNDING_NATURAL, + self::BALANCE_OPTION_CREDIT_ROUNDING_UPPER, + self::BALANCE_OPTION_CREDIT_ROUNDING_LOWER, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getBalanceOptionDebitRoundingAllowableValues() + { + return [ + self::BALANCE_OPTION_DEBIT_ROUNDING_NATURAL, + self::BALANCE_OPTION_DEBIT_ROUNDING_UPPER, + self::BALANCE_OPTION_DEBIT_ROUNDING_LOWER, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getBalanceAvailabilityDurationUnitAllowableValues() + { + return [ + self::BALANCE_AVAILABILITY_DURATION_UNIT_DAY, + self::BALANCE_AVAILABILITY_DURATION_UNIT_WEEK, + self::BALANCE_AVAILABILITY_DURATION_UNIT_MONTH, + self::BALANCE_AVAILABILITY_DURATION_UNIT_YEAR, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getBalanceAvailabilityDurationModifierAllowableValues() + { + return [ + self::BALANCE_AVAILABILITY_DURATION_MODIFIER_START_OF_PERIOD, + self::BALANCE_AVAILABILITY_DURATION_MODIFIER_END_OF_PERIOD, + self::BALANCE_AVAILABILITY_DURATION_MODIFIER_NO_MODIFICATION, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('unit', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('meta', $data ?? [], null); + $this->setIfExists('minAmount', $data ?? [], null); + $this->setIfExists('maxAmount', $data ?? [], null); + $this->setIfExists('maxCreditAmountLimit', $data ?? [], null); + $this->setIfExists('maxDebitAmountLimit', $data ?? [], null); + $this->setIfExists('balanceOptionAmountOvertakingStrategy', $data ?? [], 'strict'); + $this->setIfExists('balanceOptionCreditRounding', $data ?? [], 'natural'); + $this->setIfExists('balanceOptionDebitRounding', $data ?? [], 'natural'); + $this->setIfExists('balanceAvailabilityDurationValue', $data ?? [], null); + $this->setIfExists('balanceAvailabilityDurationUnit', $data ?? [], 'day'); + $this->setIfExists('balanceAvailabilityDurationModifier', $data ?? [], 'noModification'); + $this->setIfExists('balanceExpirationDate', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['unit'] === null) { + $invalidProperties[] = "'unit' can't be null"; + } + $allowedValues = $this->getUnitAllowableValues(); + if (!is_null($this->container['unit']) && !in_array($this->container['unit'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'unit', must be one of '%s'", + $this->container['unit'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getBalanceOptionAmountOvertakingStrategyAllowableValues(); + if (!is_null($this->container['balanceOptionAmountOvertakingStrategy']) && !in_array($this->container['balanceOptionAmountOvertakingStrategy'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'balanceOptionAmountOvertakingStrategy', must be one of '%s'", + $this->container['balanceOptionAmountOvertakingStrategy'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getBalanceOptionCreditRoundingAllowableValues(); + if (!is_null($this->container['balanceOptionCreditRounding']) && !in_array($this->container['balanceOptionCreditRounding'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'balanceOptionCreditRounding', must be one of '%s'", + $this->container['balanceOptionCreditRounding'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getBalanceOptionDebitRoundingAllowableValues(); + if (!is_null($this->container['balanceOptionDebitRounding']) && !in_array($this->container['balanceOptionDebitRounding'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'balanceOptionDebitRounding', must be one of '%s'", + $this->container['balanceOptionDebitRounding'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getBalanceAvailabilityDurationUnitAllowableValues(); + if (!is_null($this->container['balanceAvailabilityDurationUnit']) && !in_array($this->container['balanceAvailabilityDurationUnit'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'balanceAvailabilityDurationUnit', must be one of '%s'", + $this->container['balanceAvailabilityDurationUnit'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getBalanceAvailabilityDurationModifierAllowableValues(); + if (!is_null($this->container['balanceAvailabilityDurationModifier']) && !in_array($this->container['balanceAvailabilityDurationModifier'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'balanceAvailabilityDurationModifier', must be one of '%s'", + $this->container['balanceAvailabilityDurationModifier'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Name for the balance + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets unit + * + * @return string + */ + public function getUnit(): string + { + return $this->container['unit']; + } + + /** + * Sets unit + * + * @param string $unit The unit for this balance definition. + * + * @return $this + */ + public function setUnit(string $unit): static + { + if (is_null($unit)) { + throw new InvalidArgumentException('non-nullable unit cannot be null'); + } + $allowedValues = $this->getUnitAllowableValues(); + if (!in_array($unit, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'unit', must be one of '%s'", + $unit, + implode("', '", $allowedValues) + ) + ); + } + $this->container['unit'] = $unit; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Description for the balance + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets meta + * + * @return object|null + */ + public function getMeta(): ?object + { + return $this->container['meta']; + } + + /** + * Sets meta + * + * @param object|null $meta Additional metadata related to the balance definition. + * + * @return $this + */ + public function setMeta(?object $meta): static + { + if (is_null($meta)) { + throw new InvalidArgumentException('non-nullable meta cannot be null'); + } + $this->container['meta'] = $meta; + + return $this; + } + + /** + * Gets minAmount + * + * @return float|null + */ + public function getMinAmount(): ?float + { + return $this->container['minAmount']; + } + + /** + * Sets minAmount + * + * @param float|null $minAmount Minimum possible amount for balance + * + * @return $this + */ + public function setMinAmount(?float $minAmount): static + { + if (is_null($minAmount)) { + throw new InvalidArgumentException('non-nullable minAmount cannot be null'); + } + $this->container['minAmount'] = $minAmount; + + return $this; + } + + /** + * Gets maxAmount + * + * @return float|null + */ + public function getMaxAmount(): ?float + { + return $this->container['maxAmount']; + } + + /** + * Sets maxAmount + * + * @param float|null $maxAmount Maximum possible amount for balance + * + * @return $this + */ + public function setMaxAmount(?float $maxAmount): static + { + if (is_null($maxAmount)) { + throw new InvalidArgumentException('non-nullable maxAmount cannot be null'); + } + $this->container['maxAmount'] = $maxAmount; + + return $this; + } + + /** + * Gets maxCreditAmountLimit + * + * @return float|null + */ + public function getMaxCreditAmountLimit(): ?float + { + return $this->container['maxCreditAmountLimit']; + } + + /** + * Sets maxCreditAmountLimit + * + * @param float|null $maxCreditAmountLimit Maximum credit amount limit per operation + * + * @return $this + */ + public function setMaxCreditAmountLimit(?float $maxCreditAmountLimit): static + { + if (is_null($maxCreditAmountLimit)) { + throw new InvalidArgumentException('non-nullable maxCreditAmountLimit cannot be null'); + } + $this->container['maxCreditAmountLimit'] = $maxCreditAmountLimit; + + return $this; + } + + /** + * Gets maxDebitAmountLimit + * + * @return float|null + */ + public function getMaxDebitAmountLimit(): ?float + { + return $this->container['maxDebitAmountLimit']; + } + + /** + * Sets maxDebitAmountLimit + * + * @param float|null $maxDebitAmountLimit Maximum debit amount limit per operation + * + * @return $this + */ + public function setMaxDebitAmountLimit(?float $maxDebitAmountLimit): static + { + if (is_null($maxDebitAmountLimit)) { + throw new InvalidArgumentException('non-nullable maxDebitAmountLimit cannot be null'); + } + $this->container['maxDebitAmountLimit'] = $maxDebitAmountLimit; + + return $this; + } + + /** + * Gets balanceOptionAmountOvertakingStrategy + * + * @return string|null + */ + public function getBalanceOptionAmountOvertakingStrategy(): ?string + { + return $this->container['balanceOptionAmountOvertakingStrategy']; + } + + /** + * Sets balanceOptionAmountOvertakingStrategy + * + * @param string|null $balanceOptionAmountOvertakingStrategy Select partial to enable partial credit of balance if maximum balance limit is reaching. Select strict to reject the transaction if it will breach the max credit amount limit. + * + * @return $this + */ + public function setBalanceOptionAmountOvertakingStrategy(?string $balanceOptionAmountOvertakingStrategy): static + { + if (is_null($balanceOptionAmountOvertakingStrategy)) { + throw new InvalidArgumentException('non-nullable balanceOptionAmountOvertakingStrategy cannot be null'); + } + $allowedValues = $this->getBalanceOptionAmountOvertakingStrategyAllowableValues(); + if (!in_array($balanceOptionAmountOvertakingStrategy, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'balanceOptionAmountOvertakingStrategy', must be one of '%s'", + $balanceOptionAmountOvertakingStrategy, + implode("', '", $allowedValues) + ) + ); + } + $this->container['balanceOptionAmountOvertakingStrategy'] = $balanceOptionAmountOvertakingStrategy; + + return $this; + } + + /** + * Gets balanceOptionCreditRounding + * + * @return string|null + */ + public function getBalanceOptionCreditRounding(): ?string + { + return $this->container['balanceOptionCreditRounding']; + } + + /** + * Sets balanceOptionCreditRounding + * + * @param string|null $balanceOptionCreditRounding Select natural to round to nearest integer. Select upper to round up . Select lower to round down + * + * @return $this + */ + public function setBalanceOptionCreditRounding(?string $balanceOptionCreditRounding): static + { + if (is_null($balanceOptionCreditRounding)) { + throw new InvalidArgumentException('non-nullable balanceOptionCreditRounding cannot be null'); + } + $allowedValues = $this->getBalanceOptionCreditRoundingAllowableValues(); + if (!in_array($balanceOptionCreditRounding, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'balanceOptionCreditRounding', must be one of '%s'", + $balanceOptionCreditRounding, + implode("', '", $allowedValues) + ) + ); + } + $this->container['balanceOptionCreditRounding'] = $balanceOptionCreditRounding; + + return $this; + } + + /** + * Gets balanceOptionDebitRounding + * + * @return string|null + */ + public function getBalanceOptionDebitRounding(): ?string + { + return $this->container['balanceOptionDebitRounding']; + } + + /** + * Sets balanceOptionDebitRounding + * + * @param string|null $balanceOptionDebitRounding Select natural to round to nearest integer. Select upper to round up . Select lower to round down + * + * @return $this + */ + public function setBalanceOptionDebitRounding(?string $balanceOptionDebitRounding): static + { + if (is_null($balanceOptionDebitRounding)) { + throw new InvalidArgumentException('non-nullable balanceOptionDebitRounding cannot be null'); + } + $allowedValues = $this->getBalanceOptionDebitRoundingAllowableValues(); + if (!in_array($balanceOptionDebitRounding, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'balanceOptionDebitRounding', must be one of '%s'", + $balanceOptionDebitRounding, + implode("', '", $allowedValues) + ) + ); + } + $this->container['balanceOptionDebitRounding'] = $balanceOptionDebitRounding; + + return $this; + } + + /** + * Gets balanceAvailabilityDurationValue + * + * @return float|null + */ + public function getBalanceAvailabilityDurationValue(): ?float + { + return $this->container['balanceAvailabilityDurationValue']; + } + + /** + * Sets balanceAvailabilityDurationValue + * + * @param float|null $balanceAvailabilityDurationValue Number of days/weeks/month/year for balance expiry + * + * @return $this + */ + public function setBalanceAvailabilityDurationValue(?float $balanceAvailabilityDurationValue): static + { + if (is_null($balanceAvailabilityDurationValue)) { + throw new InvalidArgumentException('non-nullable balanceAvailabilityDurationValue cannot be null'); + } + $this->container['balanceAvailabilityDurationValue'] = $balanceAvailabilityDurationValue; + + return $this; + } + + /** + * Gets balanceAvailabilityDurationUnit + * + * @return string|null + */ + public function getBalanceAvailabilityDurationUnit(): ?string + { + return $this->container['balanceAvailabilityDurationUnit']; + } + + /** + * Sets balanceAvailabilityDurationUnit + * + * @param string|null $balanceAvailabilityDurationUnit Unit for balance expiry (e.g., day/week/month/year). + * + * @return $this + */ + public function setBalanceAvailabilityDurationUnit(?string $balanceAvailabilityDurationUnit): static + { + if (is_null($balanceAvailabilityDurationUnit)) { + throw new InvalidArgumentException('non-nullable balanceAvailabilityDurationUnit cannot be null'); + } + $allowedValues = $this->getBalanceAvailabilityDurationUnitAllowableValues(); + if (!in_array($balanceAvailabilityDurationUnit, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'balanceAvailabilityDurationUnit', must be one of '%s'", + $balanceAvailabilityDurationUnit, + implode("', '", $allowedValues) + ) + ); + } + $this->container['balanceAvailabilityDurationUnit'] = $balanceAvailabilityDurationUnit; + + return $this; + } + + /** + * Gets balanceAvailabilityDurationModifier + * + * @return string|null + */ + public function getBalanceAvailabilityDurationModifier(): ?string + { + return $this->container['balanceAvailabilityDurationModifier']; + } + + /** + * Sets balanceAvailabilityDurationModifier + * + * @param string|null $balanceAvailabilityDurationModifier Select startOfPeriod to configure balance expiry on start of day/week/month/year. Select endOfPeriod to configure balance expiry on end of day/week/month/year, else select noModification + * + * @return $this + */ + public function setBalanceAvailabilityDurationModifier(?string $balanceAvailabilityDurationModifier): static + { + if (is_null($balanceAvailabilityDurationModifier)) { + throw new InvalidArgumentException('non-nullable balanceAvailabilityDurationModifier cannot be null'); + } + $allowedValues = $this->getBalanceAvailabilityDurationModifierAllowableValues(); + if (!in_array($balanceAvailabilityDurationModifier, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'balanceAvailabilityDurationModifier', must be one of '%s'", + $balanceAvailabilityDurationModifier, + implode("', '", $allowedValues) + ) + ); + } + $this->container['balanceAvailabilityDurationModifier'] = $balanceAvailabilityDurationModifier; + + return $this; + } + + /** + * Gets balanceExpirationDate + * + * @return string|null + */ + public function getBalanceExpirationDate(): ?string + { + return $this->container['balanceExpirationDate']; + } + + /** + * Sets balanceExpirationDate + * + * @param string|null $balanceExpirationDate Date when the balance expires and can no longer be used, in dd/mm format. The balance will be expired when this date appears next in the calendar and only one of balanceExpirationDate or balance availability fields can be used. + * + * @return $this + */ + public function setBalanceExpirationDate(?string $balanceExpirationDate): static + { + if (is_null($balanceExpirationDate)) { + throw new InvalidArgumentException('non-nullable balanceExpirationDate cannot be null'); + } + $this->container['balanceExpirationDate'] = $balanceExpirationDate; + + return $this; + } +} + + diff --git a/lib/Models/CreateCategoryModel.php b/lib/Models/CreateCategoryModel.php index 03cfd89..5196cad 100644 --- a/lib/Models/CreateCategoryModel.php +++ b/lib/Models/CreateCategoryModel.php @@ -2,118 +2,116 @@ /** * CreateCategoryModel * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateCategoryModel Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateCategoryModel implements ModelInterface, ArrayAccess +class CreateCategoryModel extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createCategoryModel'; + protected static string $openAPIModelName = 'createCategoryModel'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,75 +139,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->setIfExists('id', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * - * @return int + * @return int|null */ - public function getId() + public function getId(): ?int { return $this->container['id']; } @@ -217,89 +189,19 @@ public function getId() /** * Sets id * - * @param int $id ID of the category when a new category is created + * @param int|null $id ID of the category when a new category is created * * @return $this */ - public function setId($id) + public function setId(?int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateChild.php b/lib/Models/CreateChild.php deleted file mode 100644 index 4a7fec7..0000000 --- a/lib/Models/CreateChild.php +++ /dev/null @@ -1,510 +0,0 @@ - 'string', - 'firstName' => 'string', - 'lastName' => 'string', - 'companyName' => 'string', - 'password' => 'string', - 'language' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'email' => 'email', - 'firstName' => null, - 'lastName' => null, - 'companyName' => null, - 'password' => 'password', - 'language' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'email' => 'email', - 'firstName' => 'firstName', - 'lastName' => 'lastName', - 'companyName' => 'companyName', - 'password' => 'password', - 'language' => 'language' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'email' => 'setEmail', - 'firstName' => 'setFirstName', - 'lastName' => 'setLastName', - 'companyName' => 'setCompanyName', - 'password' => 'setPassword', - 'language' => 'setLanguage' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'email' => 'getEmail', - 'firstName' => 'getFirstName', - 'lastName' => 'getLastName', - 'companyName' => 'getCompanyName', - 'password' => 'getPassword', - 'language' => 'getLanguage' - ]; - - /** - * 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'; - const LANGUAGE_IT = 'it'; - const LANGUAGE_DE = 'de'; - const LANGUAGE_EN = 'en'; - - - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getLanguageAllowableValues() - { - return [ - self::LANGUAGE_FR, - self::LANGUAGE_ES, - self::LANGUAGE_PT, - self::LANGUAGE_IT, - self::LANGUAGE_DE, - self::LANGUAGE_EN, - ]; - } - - - /** - * 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['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['firstName'] = isset($data['firstName']) ? $data['firstName'] : null; - $this->container['lastName'] = isset($data['lastName']) ? $data['lastName'] : null; - $this->container['companyName'] = isset($data['companyName']) ? $data['companyName'] : null; - $this->container['password'] = isset($data['password']) ? $data['password'] : null; - $this->container['language'] = isset($data['language']) ? $data['language'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['email'] === null) { - $invalidProperties[] = "'email' can't be null"; - } - if ($this->container['firstName'] === null) { - $invalidProperties[] = "'firstName' can't be null"; - } - if ($this->container['lastName'] === null) { - $invalidProperties[] = "'lastName' can't be null"; - } - if ($this->container['companyName'] === null) { - $invalidProperties[] = "'companyName' can't be null"; - } - if ($this->container['password'] === null) { - $invalidProperties[] = "'password' can't be null"; - } - $allowedValues = $this->getLanguageAllowableValues(); - if (!is_null($this->container['language']) && !in_array($this->container['language'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value for 'language', must be one of '%s'", - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets email - * - * @return string - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string $email Email address to create the child account - * - * @return $this - */ - public function setEmail($email) - { - $this->container['email'] = $email; - - return $this; - } - - /** - * Gets firstName - * - * @return string - */ - public function getFirstName() - { - return $this->container['firstName']; - } - - /** - * Sets firstName - * - * @param string $firstName First name to use to create the child account - * - * @return $this - */ - public function setFirstName($firstName) - { - $this->container['firstName'] = $firstName; - - return $this; - } - - /** - * Gets lastName - * - * @return string - */ - public function getLastName() - { - return $this->container['lastName']; - } - - /** - * Sets lastName - * - * @param string $lastName Last name to use to create the child account - * - * @return $this - */ - public function setLastName($lastName) - { - $this->container['lastName'] = $lastName; - - return $this; - } - - /** - * Gets companyName - * - * @return string - */ - public function getCompanyName() - { - return $this->container['companyName']; - } - - /** - * Sets companyName - * - * @param string $companyName Company name to use to create the child account - * - * @return $this - */ - public function setCompanyName($companyName) - { - $this->container['companyName'] = $companyName; - - return $this; - } - - /** - * Gets password - * - * @return string - */ - public function getPassword() - { - return $this->container['password']; - } - - /** - * Sets password - * - * @param string $password Password for the child account to login - * - * @return $this - */ - public function setPassword($password) - { - $this->container['password'] = $password; - - return $this; - } - - /** - * Gets language - * - * @return string - */ - public function getLanguage() - { - return $this->container['language']; - } - - /** - * Sets language - * - * @param string $language Language of the child account - * - * @return $this - */ - public function setLanguage($language) - { - $allowedValues = $this->getLanguageAllowableValues(); - if (!is_null($language) && !in_array($language, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'language', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['language'] = $language; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/CreateContact.php b/lib/Models/CreateContact.php index fde87aa..9998048 100644 --- a/lib/Models/CreateContact.php +++ b/lib/Models/CreateContact.php @@ -2,64 +2,66 @@ /** * CreateContact * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateContact Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateContact implements ModelInterface, ArrayAccess +class CreateContact extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createContact'; + protected static string $openAPIModelName = 'createContact'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'email' => 'string', 'extId' => 'string', - 'attributes' => 'object', + 'attributes' => 'array', 'emailBlacklisted' => 'bool', 'smsBlacklisted' => 'bool', 'listIds' => 'int[]', @@ -70,9 +72,9 @@ class CreateContact implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'email' => 'email', 'extId' => null, 'attributes' => null, @@ -84,32 +86,35 @@ class CreateContact implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'extId' => false, + 'attributes' => false, + 'emailBlacklisted' => false, + 'smsBlacklisted' => false, + 'listIds' => false, + 'updateEnabled' => false, + 'smtpBlacklistSender' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'email' => 'email', 'extId' => 'ext_id', 'attributes' => 'attributes', @@ -123,9 +128,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'email' => 'setEmail', 'extId' => 'setExtId', 'attributes' => 'setAttributes', @@ -139,9 +144,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'email' => 'getEmail', 'extId' => 'getExtId', 'attributes' => 'getAttributes', @@ -156,9 +161,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -166,9 +171,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -176,82 +181,56 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['extId'] = isset($data['extId']) ? $data['extId'] : null; - $this->container['attributes'] = isset($data['attributes']) ? $data['attributes'] : null; - $this->container['emailBlacklisted'] = isset($data['emailBlacklisted']) ? $data['emailBlacklisted'] : null; - $this->container['smsBlacklisted'] = isset($data['smsBlacklisted']) ? $data['smsBlacklisted'] : null; - $this->container['listIds'] = isset($data['listIds']) ? $data['listIds'] : null; - $this->container['updateEnabled'] = isset($data['updateEnabled']) ? $data['updateEnabled'] : false; - $this->container['smtpBlacklistSender'] = isset($data['smtpBlacklistSender']) ? $data['smtpBlacklistSender'] : null; + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('extId', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('emailBlacklisted', $data ?? [], null); + $this->setIfExists('smsBlacklisted', $data ?? [], null); + $this->setIfExists('listIds', $data ?? [], null); + $this->setIfExists('updateEnabled', $data ?? [], false); + $this->setIfExists('smtpBlacklistSender', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets email * - * @return string + * @return string|null */ - public function getEmail() + public function getEmail(): ?string { return $this->container['email']; } @@ -259,12 +238,15 @@ public function getEmail() /** * Sets email * - * @param string $email Email address of the user. Mandatory if \"SMS\" field is not passed in \"attributes\" parameter. Mobile Number in \"SMS\" field should be passed with proper country code. For example {\"SMS\":\"+91xxxxxxxxxx\"} or {\"SMS\":\"0091xxxxxxxxxx\"} + * @param string|null $email Email address of the user. **Mandatory if \"ext_id\" & \"SMS\" field is not passed.** * * @return $this */ - public function setEmail($email) + public function setEmail(?string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -273,9 +255,9 @@ public function setEmail($email) /** * Gets extId * - * @return string + * @return string|null */ - public function getExtId() + public function getExtId(): ?string { return $this->container['extId']; } @@ -283,12 +265,15 @@ public function getExtId() /** * Sets extId * - * @param string $extId Pass your own Id to create a contact. + * @param string|null $extId Pass your own Id to create a contact. * * @return $this */ - public function setExtId($extId) + public function setExtId(?string $extId): static { + if (is_null($extId)) { + throw new InvalidArgumentException('non-nullable extId cannot be null'); + } $this->container['extId'] = $extId; return $this; @@ -297,9 +282,9 @@ public function setExtId($extId) /** * Gets attributes * - * @return object + * @return array|null */ - public function getAttributes() + public function getAttributes(): ?array { return $this->container['attributes']; } @@ -307,12 +292,15 @@ public function getAttributes() /** * Sets attributes * - * @param object $attributes Pass the set of attributes and their values. The attribute's parameter should be passed in capital letter while creating a contact. Values that don't match the attribute type (e.g. text or string in a date attribute) will be ignored.These attributes must be present in your Brevo account. For eg. {\"FNAME\":\"Elly\", \"LNAME\":\"Roger\"} + * @param array|null $attributes Pass the set of attributes and their values. The attribute's parameter should be passed in capital letter while creating a contact. Values that don't match the attribute type (e.g. text or string in a date attribute) will be ignored. **These attributes must be present in your Brevo account.**. For eg: **{\"FNAME\":\"Elly\", \"LNAME\":\"Roger\", \"COUNTRIES\":[\"India\",\"China\"]}** * * @return $this */ - public function setAttributes($attributes) + public function setAttributes(?array $attributes): static { + if (is_null($attributes)) { + throw new InvalidArgumentException('non-nullable attributes cannot be null'); + } $this->container['attributes'] = $attributes; return $this; @@ -321,9 +309,9 @@ public function setAttributes($attributes) /** * Gets emailBlacklisted * - * @return bool + * @return bool|null */ - public function getEmailBlacklisted() + public function getEmailBlacklisted(): ?bool { return $this->container['emailBlacklisted']; } @@ -331,12 +319,15 @@ public function getEmailBlacklisted() /** * Sets emailBlacklisted * - * @param bool $emailBlacklisted Set this field to blacklist the contact for emails (emailBlacklisted = true) + * @param bool|null $emailBlacklisted Set this field to blacklist the contact for emails (emailBlacklisted = true) * * @return $this */ - public function setEmailBlacklisted($emailBlacklisted) + public function setEmailBlacklisted(?bool $emailBlacklisted): static { + if (is_null($emailBlacklisted)) { + throw new InvalidArgumentException('non-nullable emailBlacklisted cannot be null'); + } $this->container['emailBlacklisted'] = $emailBlacklisted; return $this; @@ -345,9 +336,9 @@ public function setEmailBlacklisted($emailBlacklisted) /** * Gets smsBlacklisted * - * @return bool + * @return bool|null */ - public function getSmsBlacklisted() + public function getSmsBlacklisted(): ?bool { return $this->container['smsBlacklisted']; } @@ -355,12 +346,15 @@ public function getSmsBlacklisted() /** * Sets smsBlacklisted * - * @param bool $smsBlacklisted Set this field to blacklist the contact for SMS (smsBlacklisted = true) + * @param bool|null $smsBlacklisted Set this field to blacklist the contact for SMS (smsBlacklisted = true) * * @return $this */ - public function setSmsBlacklisted($smsBlacklisted) + public function setSmsBlacklisted(?bool $smsBlacklisted): static { + if (is_null($smsBlacklisted)) { + throw new InvalidArgumentException('non-nullable smsBlacklisted cannot be null'); + } $this->container['smsBlacklisted'] = $smsBlacklisted; return $this; @@ -369,9 +363,9 @@ public function setSmsBlacklisted($smsBlacklisted) /** * Gets listIds * - * @return int[] + * @return int[]|null */ - public function getListIds() + public function getListIds(): ?array { return $this->container['listIds']; } @@ -379,12 +373,15 @@ public function getListIds() /** * Sets listIds * - * @param int[] $listIds Ids of the lists to add the contact to + * @param int[]|null $listIds Ids of the lists to add the contact to * * @return $this */ - public function setListIds($listIds) + public function setListIds(?array $listIds): static { + if (is_null($listIds)) { + throw new InvalidArgumentException('non-nullable listIds cannot be null'); + } $this->container['listIds'] = $listIds; return $this; @@ -393,9 +390,9 @@ public function setListIds($listIds) /** * Gets updateEnabled * - * @return bool + * @return bool|null */ - public function getUpdateEnabled() + public function getUpdateEnabled(): ?bool { return $this->container['updateEnabled']; } @@ -403,12 +400,15 @@ public function getUpdateEnabled() /** * Sets updateEnabled * - * @param bool $updateEnabled Facilitate to update the existing contact in the same request (updateEnabled = true) + * @param bool|null $updateEnabled Facilitate to update the existing contact in the same request (updateEnabled = true) * * @return $this */ - public function setUpdateEnabled($updateEnabled) + public function setUpdateEnabled(?bool $updateEnabled): static { + if (is_null($updateEnabled)) { + throw new InvalidArgumentException('non-nullable updateEnabled cannot be null'); + } $this->container['updateEnabled'] = $updateEnabled; return $this; @@ -417,9 +417,9 @@ public function setUpdateEnabled($updateEnabled) /** * Gets smtpBlacklistSender * - * @return string[] + * @return string[]|null */ - public function getSmtpBlacklistSender() + public function getSmtpBlacklistSender(): ?array { return $this->container['smtpBlacklistSender']; } @@ -427,89 +427,19 @@ public function getSmtpBlacklistSender() /** * Sets smtpBlacklistSender * - * @param string[] $smtpBlacklistSender transactional email forbidden sender for contact. Use only for email Contact ( only available if updateEnabled = true ) + * @param string[]|null $smtpBlacklistSender transactional email forbidden sender for contact. Use only for email Contact ( only available if updateEnabled = true ) * * @return $this */ - public function setSmtpBlacklistSender($smtpBlacklistSender) + public function setSmtpBlacklistSender(?array $smtpBlacklistSender): static { + if (is_null($smtpBlacklistSender)) { + throw new InvalidArgumentException('non-nullable smtpBlacklistSender cannot be null'); + } $this->container['smtpBlacklistSender'] = $smtpBlacklistSender; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateCouponCollection.php b/lib/Models/CreateCouponCollection.php deleted file mode 100644 index e9760b7..0000000 --- a/lib/Models/CreateCouponCollection.php +++ /dev/null @@ -1,341 +0,0 @@ - 'object', - 'defaultCoupon' => 'object' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'name' => null, - 'defaultCoupon' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'name' => 'name', - 'defaultCoupon' => 'defaultCoupon' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'name' => 'setName', - 'defaultCoupon' => 'setDefaultCoupon' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'name' => 'getName', - 'defaultCoupon' => 'getDefaultCoupon' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['defaultCoupon'] = isset($data['defaultCoupon']) ? $data['defaultCoupon'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['defaultCoupon'] === null) { - $invalidProperties[] = "'defaultCoupon' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets name - * - * @return object - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param object $name Name of the collection with no white spaces between words - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets defaultCoupon - * - * @return object - */ - public function getDefaultCoupon() - { - return $this->container['defaultCoupon']; - } - - /** - * Sets defaultCoupon - * - * @param object $defaultCoupon A default coupon to be used in case there are no coupons left - * - * @return $this - */ - public function setDefaultCoupon($defaultCoupon) - { - $this->container['defaultCoupon'] = $defaultCoupon; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/CreateCouponCollection201Response.php b/lib/Models/CreateCouponCollection201Response.php new file mode 100644 index 0000000..b461003 --- /dev/null +++ b/lib/Models/CreateCouponCollection201Response.php @@ -0,0 +1,210 @@ + + */ +class CreateCouponCollection201Response extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createCouponCollection_201_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'uuidv4' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The id of the created collection + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } +} + + diff --git a/lib/Models/CreateCouponCollectionRequest.php b/lib/Models/CreateCouponCollectionRequest.php new file mode 100644 index 0000000..2a5eda4 --- /dev/null +++ b/lib/Models/CreateCouponCollectionRequest.php @@ -0,0 +1,349 @@ + + */ +class CreateCouponCollectionRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createCouponCollection_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'defaultCoupon' => 'string', + 'expirationDate' => '\DateTime', + 'remainingDaysAlert' => 'int', + 'remainingCouponsAlert' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'defaultCoupon' => null, + 'expirationDate' => 'date-time', + 'remainingDaysAlert' => null, + 'remainingCouponsAlert' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'defaultCoupon' => false, + 'expirationDate' => false, + 'remainingDaysAlert' => false, + 'remainingCouponsAlert' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'defaultCoupon' => 'defaultCoupon', + 'expirationDate' => 'expirationDate', + 'remainingDaysAlert' => 'remainingDaysAlert', + 'remainingCouponsAlert' => 'remainingCouponsAlert' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'defaultCoupon' => 'setDefaultCoupon', + 'expirationDate' => 'setExpirationDate', + 'remainingDaysAlert' => 'setRemainingDaysAlert', + 'remainingCouponsAlert' => 'setRemainingCouponsAlert' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'defaultCoupon' => 'getDefaultCoupon', + 'expirationDate' => 'getExpirationDate', + 'remainingDaysAlert' => 'getRemainingDaysAlert', + 'remainingCouponsAlert' => 'getRemainingCouponsAlert' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('defaultCoupon', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('remainingDaysAlert', $data ?? [], null); + $this->setIfExists('remainingCouponsAlert', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['defaultCoupon'] === null) { + $invalidProperties[] = "'defaultCoupon' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Name of the coupons collection + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets defaultCoupon + * + * @return string + */ + public function getDefaultCoupon(): string + { + return $this->container['defaultCoupon']; + } + + /** + * Sets defaultCoupon + * + * @param string $defaultCoupon Default coupons collection name + * + * @return $this + */ + public function setDefaultCoupon(string $defaultCoupon): static + { + if (is_null($defaultCoupon)) { + throw new InvalidArgumentException('non-nullable defaultCoupon cannot be null'); + } + $this->container['defaultCoupon'] = $defaultCoupon; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate(): ?\DateTime + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Specify an expiration date for the coupon collection in RFC3339 format. Use null to remove the expiration date. + * + * @return $this + */ + public function setExpirationDate(?\DateTime $expirationDate): static + { + if (is_null($expirationDate)) { + throw new InvalidArgumentException('non-nullable expirationDate cannot be null'); + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets remainingDaysAlert + * + * @return int|null + */ + public function getRemainingDaysAlert(): ?int + { + return $this->container['remainingDaysAlert']; + } + + /** + * Sets remainingDaysAlert + * + * @param int|null $remainingDaysAlert Send a notification alert (email) when the remaining days until the expiration date are equal or fall bellow this number. Use null to disable alerts. + * + * @return $this + */ + public function setRemainingDaysAlert(?int $remainingDaysAlert): static + { + if (is_null($remainingDaysAlert)) { + throw new InvalidArgumentException('non-nullable remainingDaysAlert cannot be null'); + } + $this->container['remainingDaysAlert'] = $remainingDaysAlert; + + return $this; + } + + /** + * Gets remainingCouponsAlert + * + * @return int|null + */ + public function getRemainingCouponsAlert(): ?int + { + return $this->container['remainingCouponsAlert']; + } + + /** + * Sets remainingCouponsAlert + * + * @param int|null $remainingCouponsAlert Send a notification alert (email) when the remaining coupons count is equal or fall bellow this number. Use null to disable alerts. + * + * @return $this + */ + public function setRemainingCouponsAlert(?int $remainingCouponsAlert): static + { + if (is_null($remainingCouponsAlert)) { + throw new InvalidArgumentException('non-nullable remainingCouponsAlert cannot be null'); + } + $this->container['remainingCouponsAlert'] = $remainingCouponsAlert; + + return $this; + } +} + + diff --git a/lib/Models/CreateCoupons.php b/lib/Models/CreateCoupons.php deleted file mode 100644 index 281ab6a..0000000 --- a/lib/Models/CreateCoupons.php +++ /dev/null @@ -1,341 +0,0 @@ - 'string', - 'coupons' => 'string[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'collectionId' => 'uuidv4', - 'coupons' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'collectionId' => 'collectionId', - 'coupons' => 'coupons' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'collectionId' => 'setCollectionId', - 'coupons' => 'setCoupons' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'collectionId' => 'getCollectionId', - 'coupons' => 'getCoupons' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['collectionId'] = isset($data['collectionId']) ? $data['collectionId'] : null; - $this->container['coupons'] = isset($data['coupons']) ? $data['coupons'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['collectionId'] === null) { - $invalidProperties[] = "'collectionId' can't be null"; - } - if ($this->container['coupons'] === null) { - $invalidProperties[] = "'coupons' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets collectionId - * - * @return string - */ - public function getCollectionId() - { - return $this->container['collectionId']; - } - - /** - * Sets collectionId - * - * @param string $collectionId The id of the coupon collection for which the coupons will be created - * - * @return $this - */ - public function setCollectionId($collectionId) - { - $this->container['collectionId'] = $collectionId; - - return $this; - } - - /** - * Gets coupons - * - * @return string[] - */ - public function getCoupons() - { - return $this->container['coupons']; - } - - /** - * Sets coupons - * - * @param string[] $coupons coupons - * - * @return $this - */ - public function setCoupons($coupons) - { - $this->container['coupons'] = $coupons; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/CreateCouponsRequest.php b/lib/Models/CreateCouponsRequest.php new file mode 100644 index 0000000..4c23c48 --- /dev/null +++ b/lib/Models/CreateCouponsRequest.php @@ -0,0 +1,262 @@ + + */ +class CreateCouponsRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createCoupons_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'collectionId' => 'string', + 'coupons' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'collectionId' => 'uuidv4', + 'coupons' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'collectionId' => false, + 'coupons' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'collectionId' => 'collectionId', + 'coupons' => 'coupons' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'collectionId' => 'setCollectionId', + 'coupons' => 'setCoupons' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'collectionId' => 'getCollectionId', + 'coupons' => 'getCoupons' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('collectionId', $data ?? [], null); + $this->setIfExists('coupons', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['collectionId'] === null) { + $invalidProperties[] = "'collectionId' can't be null"; + } + if ($this->container['coupons'] === null) { + $invalidProperties[] = "'coupons' can't be null"; + } + if ((count($this->container['coupons']) > 1000)) { + $invalidProperties[] = "invalid value for 'coupons', number of items must be less than or equal to 1000."; + } + + if ((count($this->container['coupons']) < 1)) { + $invalidProperties[] = "invalid value for 'coupons', number of items must be greater than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Gets collectionId + * + * @return string + */ + public function getCollectionId(): string + { + return $this->container['collectionId']; + } + + /** + * Sets collectionId + * + * @param string $collectionId The id of the coupon collection for which the coupons will be created + * + * @return $this + */ + public function setCollectionId(string $collectionId): static + { + if (is_null($collectionId)) { + throw new InvalidArgumentException('non-nullable collectionId cannot be null'); + } + $this->container['collectionId'] = $collectionId; + + return $this; + } + + /** + * Gets coupons + * + * @return string[] + */ + public function getCoupons(): array + { + return $this->container['coupons']; + } + + /** + * Sets coupons + * + * @param string[] $coupons coupons + * + * @return $this + */ + public function setCoupons(array $coupons): static + { + if (is_null($coupons)) { + throw new InvalidArgumentException('non-nullable coupons cannot be null'); + } + + if ((count($coupons) > 1000)) { + throw new InvalidArgumentException('invalid value for $coupons when calling CreateCouponsRequest., number of items must be less than or equal to 1000.'); + } + if ((count($coupons) < 1)) { + throw new InvalidArgumentException('invalid length for $coupons when calling CreateCouponsRequest., number of items must be greater than or equal to 1.'); + } + $this->container['coupons'] = $coupons; + + return $this; + } +} + + diff --git a/lib/Models/CreateDoiContact.php b/lib/Models/CreateDoiContact.php index 5163293..1749481 100644 --- a/lib/Models/CreateDoiContact.php +++ b/lib/Models/CreateDoiContact.php @@ -2,153 +2,156 @@ /** * CreateDoiContact * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateDoiContact Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateDoiContact implements ModelInterface, ArrayAccess +class CreateDoiContact extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createDoiContact'; + protected static string $openAPIModelName = 'createDoiContact'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'email' => 'string', - 'attributes' => 'object', 'includeListIds' => 'int[]', - 'excludeListIds' => 'int[]', 'templateId' => 'int', - 'redirectionUrl' => 'string' + 'redirectionUrl' => 'string', + 'attributes' => 'array', + 'excludeListIds' => 'int[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'email' => 'email', - 'attributes' => null, 'includeListIds' => 'int64', - 'excludeListIds' => 'int64', 'templateId' => 'int64', - 'redirectionUrl' => 'url' + 'redirectionUrl' => 'url', + 'attributes' => null, + 'excludeListIds' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'includeListIds' => false, + 'templateId' => false, + 'redirectionUrl' => false, + 'attributes' => false, + 'excludeListIds' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'email' => 'email', - 'attributes' => 'attributes', 'includeListIds' => 'includeListIds', - 'excludeListIds' => 'excludeListIds', 'templateId' => 'templateId', - 'redirectionUrl' => 'redirectionUrl' + 'redirectionUrl' => 'redirectionUrl', + 'attributes' => 'attributes', + 'excludeListIds' => 'excludeListIds' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'email' => 'setEmail', - 'attributes' => 'setAttributes', 'includeListIds' => 'setIncludeListIds', - 'excludeListIds' => 'setExcludeListIds', 'templateId' => 'setTemplateId', - 'redirectionUrl' => 'setRedirectionUrl' + 'redirectionUrl' => 'setRedirectionUrl', + 'attributes' => 'setAttributes', + 'excludeListIds' => 'setExcludeListIds' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'email' => 'getEmail', - 'attributes' => 'getAttributes', 'includeListIds' => 'getIncludeListIds', - 'excludeListIds' => 'getExcludeListIds', 'templateId' => 'getTemplateId', - 'redirectionUrl' => 'getRedirectionUrl' + 'redirectionUrl' => 'getRedirectionUrl', + 'attributes' => 'getAttributes', + 'excludeListIds' => 'getExcludeListIds' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -156,9 +159,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -166,56 +169,42 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['attributes'] = isset($data['attributes']) ? $data['attributes'] : null; - $this->container['includeListIds'] = isset($data['includeListIds']) ? $data['includeListIds'] : null; - $this->container['excludeListIds'] = isset($data['excludeListIds']) ? $data['excludeListIds'] : null; - $this->container['templateId'] = isset($data['templateId']) ? $data['templateId'] : null; - $this->container['redirectionUrl'] = isset($data['redirectionUrl']) ? $data['redirectionUrl'] : null; + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('includeListIds', $data ?? [], null); + $this->setIfExists('templateId', $data ?? [], null); + $this->setIfExists('redirectionUrl', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('excludeListIds', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -234,24 +223,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets email * * @return string */ - public function getEmail() + public function getEmail(): string { return $this->container['email']; } @@ -263,43 +240,22 @@ public function getEmail() * * @return $this */ - public function setEmail($email) + public function setEmail(string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; } - /** - * Gets attributes - * - * @return object - */ - public function getAttributes() - { - return $this->container['attributes']; - } - - /** - * Sets attributes - * - * @param object $attributes Pass the set of attributes and their values. These attributes must be present in your Brevo account. For eg. {'FNAME':'Elly', 'LNAME':'Roger'} - * - * @return $this - */ - public function setAttributes($attributes) - { - $this->container['attributes'] = $attributes; - - return $this; - } - /** * Gets includeListIds * * @return int[] */ - public function getIncludeListIds() + public function getIncludeListIds(): array { return $this->container['includeListIds']; } @@ -311,43 +267,22 @@ public function getIncludeListIds() * * @return $this */ - public function setIncludeListIds($includeListIds) + public function setIncludeListIds(array $includeListIds): static { + if (is_null($includeListIds)) { + throw new InvalidArgumentException('non-nullable includeListIds cannot be null'); + } $this->container['includeListIds'] = $includeListIds; return $this; } - /** - * Gets excludeListIds - * - * @return int[] - */ - public function getExcludeListIds() - { - return $this->container['excludeListIds']; - } - - /** - * Sets excludeListIds - * - * @param int[] $excludeListIds Lists under user account where contact should not be added - * - * @return $this - */ - public function setExcludeListIds($excludeListIds) - { - $this->container['excludeListIds'] = $excludeListIds; - - return $this; - } - /** * Gets templateId * * @return int */ - public function getTemplateId() + public function getTemplateId(): int { return $this->container['templateId']; } @@ -359,8 +294,11 @@ public function getTemplateId() * * @return $this */ - public function setTemplateId($templateId) + public function setTemplateId(int $templateId): static { + if (is_null($templateId)) { + throw new InvalidArgumentException('non-nullable templateId cannot be null'); + } $this->container['templateId'] = $templateId; return $this; @@ -371,7 +309,7 @@ public function setTemplateId($templateId) * * @return string */ - public function getRedirectionUrl() + public function getRedirectionUrl(): string { return $this->container['redirectionUrl']; } @@ -379,88 +317,72 @@ public function getRedirectionUrl() /** * Sets redirectionUrl * - * @param string $redirectionUrl URL of the web page that user will be redirected to after clicking on the double opt in URL. When editing your DOI template you can reference this URL by using the tag {{ params.DOIurl }}. + * @param string $redirectionUrl URL of the web page that user will be redirected to after clicking on the double opt in URL. When editing your DOI template you can reference this URL by using the tag **{{ params.DOIurl }}**. * * @return $this */ - public function setRedirectionUrl($redirectionUrl) + public function setRedirectionUrl(string $redirectionUrl): static { + if (is_null($redirectionUrl)) { + throw new InvalidArgumentException('non-nullable redirectionUrl cannot be null'); + } $this->container['redirectionUrl'] = $redirectionUrl; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } /** - * Gets offset. - * - * @param integer $offset Offset + * Gets attributes * - * @return mixed + * @return array|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function getAttributes(): ?array { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container['attributes']; } /** - * Sets value based on offset. + * Sets attributes * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param array|null $attributes Pass the set of attributes and their values. **These attributes must be present in your Brevo account**. For eg. **{'FNAME':'Elly', 'LNAME':'Roger', 'COUNTRIES':['India','China']}** * - * @return void + * @return $this */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function setAttributes(?array $attributes): static { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; + if (is_null($attributes)) { + throw new InvalidArgumentException('non-nullable attributes cannot be null'); } + $this->container['attributes'] = $attributes; + + return $this; } /** - * Unsets offset. - * - * @param integer $offset Offset + * Gets excludeListIds * - * @return void + * @return int[]|null */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) + public function getExcludeListIds(): ?array { - unset($this->container[$offset]); + return $this->container['excludeListIds']; } /** - * Gets the string presentation of the object + * Sets excludeListIds * - * @return string + * @param int[]|null $excludeListIds Lists under user account where contact should not be added + * + * @return $this */ - public function __toString() + public function setExcludeListIds(?array $excludeListIds): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($excludeListIds)) { + throw new InvalidArgumentException('non-nullable excludeListIds cannot be null'); } + $this->container['excludeListIds'] = $excludeListIds; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/CreateDoiContactAttributesValue.php b/lib/Models/CreateDoiContactAttributesValue.php new file mode 100644 index 0000000..ead7de1 --- /dev/null +++ b/lib/Models/CreateDoiContactAttributesValue.php @@ -0,0 +1,179 @@ + + */ +class CreateDoiContactAttributesValue extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createDoiContact_attributes_value'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } +} + + diff --git a/lib/Models/CreateDomain.php b/lib/Models/CreateDomain.php index 5026ecb..3e861e7 100644 --- a/lib/Models/CreateDomain.php +++ b/lib/Models/CreateDomain.php @@ -2,118 +2,116 @@ /** * CreateDomain * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateDomain Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateDomain implements ModelInterface, ArrayAccess +class CreateDomain extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createDomain'; + protected static string $openAPIModelName = 'createDomain'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,51 +139,37 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('name', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -195,24 +179,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -224,85 +196,15 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateDomainModel.php b/lib/Models/CreateDomainModel.php index 7f0f3cd..92d402a 100644 --- a/lib/Models/CreateDomainModel.php +++ b/lib/Models/CreateDomainModel.php @@ -2,63 +2,66 @@ /** * CreateDomainModel * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateDomainModel Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateDomainModel implements ModelInterface, ArrayAccess +class CreateDomainModel extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createDomainModel'; + protected static string $openAPIModelName = 'createDomainModel'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'domainName' => 'string', + 'domainProvider' => 'string', 'message' => 'string', 'dnsRecords' => '\Brevo\Client\Models\CreateDomainModelDnsRecords' ]; @@ -66,44 +69,46 @@ class CreateDomainModel implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'domainName' => null, + 'domainProvider' => null, 'message' => null, 'dnsRecords' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'domainName' => false, + 'domainProvider' => false, + 'message' => false, + 'dnsRecords' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'domainName' => 'domain_name', + 'domainProvider' => 'domain_provider', 'message' => 'message', 'dnsRecords' => 'dns_records' ]; @@ -111,11 +116,12 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'domainName' => 'setDomainName', + 'domainProvider' => 'setDomainProvider', 'message' => 'setMessage', 'dnsRecords' => 'setDnsRecords' ]; @@ -123,11 +129,12 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'domainName' => 'getDomainName', + 'domainProvider' => 'getDomainProvider', 'message' => 'getMessage', 'dnsRecords' => 'getDnsRecords' ]; @@ -136,9 +143,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +153,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,54 +163,41 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['domainName'] = isset($data['domainName']) ? $data['domainName'] : null; - $this->container['message'] = isset($data['message']) ? $data['message'] : null; - $this->container['dnsRecords'] = isset($data['dnsRecords']) ? $data['dnsRecords'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('domainName', $data ?? [], null); + $this->setIfExists('domainProvider', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('dnsRecords', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -213,24 +207,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -242,8 +224,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -252,9 +237,9 @@ public function setId($id) /** * Gets domainName * - * @return string + * @return string|null */ - public function getDomainName() + public function getDomainName(): ?string { return $this->container['domainName']; } @@ -262,136 +247,99 @@ public function getDomainName() /** * Sets domainName * - * @param string $domainName Domain + * @param string|null $domainName Domain * * @return $this */ - public function setDomainName($domainName) + public function setDomainName(?string $domainName): static { + if (is_null($domainName)) { + throw new InvalidArgumentException('non-nullable domainName cannot be null'); + } $this->container['domainName'] = $domainName; return $this; } /** - * Gets message + * Gets domainProvider * - * @return string + * @return string|null */ - public function getMessage() + public function getDomainProvider(): ?string { - return $this->container['message']; + return $this->container['domainProvider']; } /** - * Sets message + * Sets domainProvider * - * @param string $message Success message + * @param string|null $domainProvider Domain Provider * * @return $this */ - public function setMessage($message) + public function setDomainProvider(?string $domainProvider): static { - $this->container['message'] = $message; + if (is_null($domainProvider)) { + throw new InvalidArgumentException('non-nullable domainProvider cannot be null'); + } + $this->container['domainProvider'] = $domainProvider; return $this; } /** - * Gets dnsRecords + * Gets message * - * @return \Brevo\Client\Models\CreateDomainModelDnsRecords + * @return string|null */ - public function getDnsRecords() + public function getMessage(): ?string { - return $this->container['dnsRecords']; + return $this->container['message']; } /** - * Sets dnsRecords + * Sets message * - * @param \Brevo\Client\Models\CreateDomainModelDnsRecords $dnsRecords dnsRecords + * @param string|null $message Success message * * @return $this */ - public function setDnsRecords($dnsRecords) + public function setMessage(?string $message): static { - $this->container['dnsRecords'] = $dnsRecords; + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 + * Gets dnsRecords * - * @return void + * @return \Brevo\Client\Models\CreateDomainModelDnsRecords|null */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function getDnsRecords(): ?\Brevo\Client\Models\CreateDomainModelDnsRecords { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } + return $this->container['dnsRecords']; } /** - * Unsets offset. - * - * @param integer $offset Offset + * Sets dnsRecords * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object + * @param \Brevo\Client\Models\CreateDomainModelDnsRecords|null $dnsRecords dnsRecords * - * @return string + * @return $this */ - public function __toString() + public function setDnsRecords(?\Brevo\Client\Models\CreateDomainModelDnsRecords $dnsRecords): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($dnsRecords)) { + throw new InvalidArgumentException('non-nullable dnsRecords cannot be null'); } + $this->container['dnsRecords'] = $dnsRecords; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/CreateDomainModelDnsRecords.php b/lib/Models/CreateDomainModelDnsRecords.php index 247fef7..da8fed0 100644 --- a/lib/Models/CreateDomainModelDnsRecords.php +++ b/lib/Models/CreateDomainModelDnsRecords.php @@ -2,133 +2,138 @@ /** * CreateDomainModelDnsRecords * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateDomainModelDnsRecords Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateDomainModelDnsRecords implements ModelInterface, ArrayAccess +class CreateDomainModelDnsRecords extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createDomainModel_dns_records'; + protected static string $openAPIModelName = 'createDomainModel_dns_records'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'dkimRecord' => '\Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord', - 'brevoCode' => '\Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord' + 'brevoCode' => '\Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord', + 'dmarcRecord' => '\Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'dkimRecord' => null, - 'brevoCode' => null + 'brevoCode' => null, + 'dmarcRecord' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'dkimRecord' => false, + 'brevoCode' => false, + 'dmarcRecord' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'dkimRecord' => 'dkim_record', - 'brevoCode' => 'brevo_code' + 'brevoCode' => 'brevo_code', + 'dmarcRecord' => 'dmarc_record' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'dkimRecord' => 'setDkimRecord', - 'brevoCode' => 'setBrevoCode' + 'brevoCode' => 'setBrevoCode', + 'dmarcRecord' => 'setDmarcRecord' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'dkimRecord' => 'getDkimRecord', - 'brevoCode' => 'getBrevoCode' + 'brevoCode' => 'getBrevoCode', + 'dmarcRecord' => 'getDmarcRecord' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +141,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +151,51 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['dkimRecord'] = isset($data['dkimRecord']) ? $data['dkimRecord'] : null; - $this->container['brevoCode'] = isset($data['brevoCode']) ? $data['brevoCode'] : null; + $this->setIfExists('dkimRecord', $data ?? [], null); + $this->setIfExists('brevoCode', $data ?? [], null); + $this->setIfExists('dmarcRecord', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets dkimRecord * - * @return \Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord + * @return \Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord|null */ - public function getDkimRecord() + public function getDkimRecord(): ?\Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord { return $this->container['dkimRecord']; } @@ -223,12 +203,15 @@ public function getDkimRecord() /** * Sets dkimRecord * - * @param \Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord $dkimRecord dkimRecord + * @param \Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord|null $dkimRecord dkimRecord * * @return $this */ - public function setDkimRecord($dkimRecord) + public function setDkimRecord(?\Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord $dkimRecord): static { + if (is_null($dkimRecord)) { + throw new InvalidArgumentException('non-nullable dkimRecord cannot be null'); + } $this->container['dkimRecord'] = $dkimRecord; return $this; @@ -237,9 +220,9 @@ public function setDkimRecord($dkimRecord) /** * Gets brevoCode * - * @return \Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord + * @return \Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord|null */ - public function getBrevoCode() + public function getBrevoCode(): ?\Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord { return $this->container['brevoCode']; } @@ -247,88 +230,45 @@ public function getBrevoCode() /** * Sets brevoCode * - * @param \Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord $brevoCode brevoCode + * @param \Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord|null $brevoCode brevoCode * * @return $this */ - public function setBrevoCode($brevoCode) + public function setBrevoCode(?\Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord $brevoCode): static { + if (is_null($brevoCode)) { + throw new InvalidArgumentException('non-nullable brevoCode cannot be null'); + } $this->container['brevoCode'] = $brevoCode; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } /** - * Gets offset. - * - * @param integer $offset Offset + * Gets dmarcRecord * - * @return mixed + * @return \Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function getDmarcRecord(): ?\Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container['dmarcRecord']; } /** - * Sets value based on offset. + * Sets dmarcRecord * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param \Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord|null $dmarcRecord dmarcRecord * - * @return void - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string + * @return $this */ - public function __toString() + public function setDmarcRecord(?\Brevo\Client\Models\CreateDomainModelDnsRecordsDkimRecord $dmarcRecord): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($dmarcRecord)) { + throw new InvalidArgumentException('non-nullable dmarcRecord cannot be null'); } + $this->container['dmarcRecord'] = $dmarcRecord; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/CreateDomainModelDnsRecordsDkimRecord.php b/lib/Models/CreateDomainModelDnsRecordsDkimRecord.php index ebd55d2..0f887b3 100644 --- a/lib/Models/CreateDomainModelDnsRecordsDkimRecord.php +++ b/lib/Models/CreateDomainModelDnsRecordsDkimRecord.php @@ -2,61 +2,63 @@ /** * CreateDomainModelDnsRecordsDkimRecord * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateDomainModelDnsRecordsDkimRecord Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateDomainModelDnsRecordsDkimRecord implements ModelInterface, ArrayAccess +class CreateDomainModelDnsRecordsDkimRecord extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createDomainModel_dns_records_dkim_record'; + protected static string $openAPIModelName = 'createDomainModel_dns_records_dkim_record'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'type' => 'string', 'value' => 'string', 'hostName' => 'string', @@ -66,9 +68,9 @@ class CreateDomainModelDnsRecordsDkimRecord implements ModelInterface, ArrayAcce /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'type' => null, 'value' => null, 'hostName' => null, @@ -76,32 +78,31 @@ class CreateDomainModelDnsRecordsDkimRecord implements ModelInterface, ArrayAcce ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'value' => false, + 'hostName' => false, + 'status' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'type' => 'type', 'value' => 'value', 'hostName' => 'host_name', @@ -111,9 +112,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'type' => 'setType', 'value' => 'setValue', 'hostName' => 'setHostName', @@ -123,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'type' => 'getType', 'value' => 'getValue', 'hostName' => 'getHostName', @@ -136,9 +137,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +147,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,78 +157,52 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['value'] = isset($data['value']) ? $data['value'] : null; - $this->container['hostName'] = isset($data['hostName']) ? $data['hostName'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('hostName', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets type * - * @return string + * @return string|null */ - public function getType() + public function getType(): ?string { return $this->container['type']; } @@ -235,12 +210,15 @@ public function getType() /** * Sets type * - * @param string $type type + * @param string|null $type type * * @return $this */ - public function setType($type) + public function setType(?string $type): static { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -249,9 +227,9 @@ public function setType($type) /** * Gets value * - * @return string + * @return string|null */ - public function getValue() + public function getValue(): ?string { return $this->container['value']; } @@ -259,12 +237,15 @@ public function getValue() /** * Sets value * - * @param string $value value + * @param string|null $value value * * @return $this */ - public function setValue($value) + public function setValue(?string $value): static { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -273,9 +254,9 @@ public function setValue($value) /** * Gets hostName * - * @return string + * @return string|null */ - public function getHostName() + public function getHostName(): ?string { return $this->container['hostName']; } @@ -283,12 +264,15 @@ public function getHostName() /** * Sets hostName * - * @param string $hostName hostName + * @param string|null $hostName hostName * * @return $this */ - public function setHostName($hostName) + public function setHostName(?string $hostName): static { + if (is_null($hostName)) { + throw new InvalidArgumentException('non-nullable hostName cannot be null'); + } $this->container['hostName'] = $hostName; return $this; @@ -297,9 +281,9 @@ public function setHostName($hostName) /** * Gets status * - * @return bool + * @return bool|null */ - public function getStatus() + public function getStatus(): ?bool { return $this->container['status']; } @@ -307,89 +291,19 @@ public function getStatus() /** * Sets status * - * @param bool $status status + * @param bool|null $status status * * @return $this */ - public function setStatus($status) + public function setStatus(?bool $status): static { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateEmailCampaign.php b/lib/Models/CreateEmailCampaign.php index 7fc7d0f..4f787f7 100644 --- a/lib/Models/CreateEmailCampaign.php +++ b/lib/Models/CreateEmailCampaign.php @@ -2,64 +2,66 @@ /** * CreateEmailCampaign * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateEmailCampaign Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateEmailCampaign implements ModelInterface, ArrayAccess +class CreateEmailCampaign extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createEmailCampaign'; + protected static string $openAPIModelName = 'createEmailCampaign'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'tag' => 'string', + protected static array $openAPITypes = [ 'sender' => '\Brevo\Client\Models\CreateEmailCampaignSender', 'name' => 'string', + 'tag' => 'string', 'htmlContent' => 'string', 'htmlUrl' => 'string', 'templateId' => 'int', @@ -75,7 +77,7 @@ class CreateEmailCampaign implements ModelInterface, ArrayAccess 'footer' => 'string', 'header' => 'string', 'utmCampaign' => 'string', - 'params' => 'object', + 'params' => 'array', 'sendAtBestTime' => 'bool', 'abTesting' => 'bool', 'subjectA' => 'string', @@ -87,18 +89,19 @@ class CreateEmailCampaign implements ModelInterface, ArrayAccess 'initialQuota' => 'int', 'increaseRate' => 'int', 'unsubscriptionPageId' => 'string', - 'updateFormId' => 'string' + 'updateFormId' => 'string', + 'emailExpirationDate' => '\Brevo\Client\Models\CreateEmailCampaignEmailExpirationDate' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'tag' => null, + protected static array $openAPIFormats = [ 'sender' => null, 'name' => null, + 'tag' => null, 'htmlContent' => null, 'htmlUrl' => 'url', 'templateId' => 'int64', @@ -126,39 +129,67 @@ class CreateEmailCampaign implements ModelInterface, ArrayAccess 'initialQuota' => 'int64', 'increaseRate' => 'int64', 'unsubscriptionPageId' => null, - 'updateFormId' => null + 'updateFormId' => null, + 'emailExpirationDate' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'sender' => false, + 'name' => false, + 'tag' => false, + 'htmlContent' => false, + 'htmlUrl' => false, + 'templateId' => false, + 'scheduledAt' => false, + 'subject' => false, + 'previewText' => false, + 'replyTo' => false, + 'toField' => false, + 'recipients' => false, + 'attachmentUrl' => false, + 'inlineImageActivation' => false, + 'mirrorActive' => false, + 'footer' => false, + 'header' => false, + 'utmCampaign' => false, + 'params' => false, + 'sendAtBestTime' => false, + 'abTesting' => false, + 'subjectA' => false, + 'subjectB' => false, + 'splitRule' => false, + 'winnerCriteria' => false, + 'winnerDelay' => false, + 'ipWarmupEnable' => false, + 'initialQuota' => false, + 'increaseRate' => false, + 'unsubscriptionPageId' => false, + 'updateFormId' => false, + 'emailExpirationDate' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ - 'tag' => 'tag', + protected static array $attributeMap = [ 'sender' => 'sender', 'name' => 'name', + 'tag' => 'tag', 'htmlContent' => 'htmlContent', 'htmlUrl' => 'htmlUrl', 'templateId' => 'templateId', @@ -186,18 +217,19 @@ public static function swaggerFormats() 'initialQuota' => 'initialQuota', 'increaseRate' => 'increaseRate', 'unsubscriptionPageId' => 'unsubscriptionPageId', - 'updateFormId' => 'updateFormId' + 'updateFormId' => 'updateFormId', + 'emailExpirationDate' => 'emailExpirationDate' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ - 'tag' => 'setTag', + protected static array $setters = [ 'sender' => 'setSender', 'name' => 'setName', + 'tag' => 'setTag', 'htmlContent' => 'setHtmlContent', 'htmlUrl' => 'setHtmlUrl', 'templateId' => 'setTemplateId', @@ -225,18 +257,19 @@ public static function swaggerFormats() 'initialQuota' => 'setInitialQuota', 'increaseRate' => 'setIncreaseRate', 'unsubscriptionPageId' => 'setUnsubscriptionPageId', - 'updateFormId' => 'setUpdateFormId' + 'updateFormId' => 'setUpdateFormId', + 'emailExpirationDate' => 'setEmailExpirationDate' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ - 'tag' => 'getTag', + protected static array $getters = [ 'sender' => 'getSender', 'name' => 'getName', + 'tag' => 'getTag', 'htmlContent' => 'getHtmlContent', 'htmlUrl' => 'getHtmlUrl', 'templateId' => 'getTemplateId', @@ -264,16 +297,17 @@ public static function swaggerFormats() 'initialQuota' => 'getInitialQuota', 'increaseRate' => 'getIncreaseRate', 'unsubscriptionPageId' => 'getUnsubscriptionPageId', - 'updateFormId' => 'getUpdateFormId' + 'updateFormId' => 'getUpdateFormId', + 'emailExpirationDate' => 'getEmailExpirationDate' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -281,9 +315,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -291,28 +325,16 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const WINNER_CRITERIA_OPEN = 'open'; - const WINNER_CRITERIA_CLICK = 'click'; - + public const WINNER_CRITERIA_OPEN = 'open'; + public const WINNER_CRITERIA_CLICK = 'click'; - /** * Gets allowable values of the enum * @@ -325,62 +347,61 @@ public function getWinnerCriteriaAllowableValues() self::WINNER_CRITERIA_CLICK, ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['tag'] = isset($data['tag']) ? $data['tag'] : null; - $this->container['sender'] = isset($data['sender']) ? $data['sender'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['htmlContent'] = isset($data['htmlContent']) ? $data['htmlContent'] : null; - $this->container['htmlUrl'] = isset($data['htmlUrl']) ? $data['htmlUrl'] : null; - $this->container['templateId'] = isset($data['templateId']) ? $data['templateId'] : null; - $this->container['scheduledAt'] = isset($data['scheduledAt']) ? $data['scheduledAt'] : null; - $this->container['subject'] = isset($data['subject']) ? $data['subject'] : null; - $this->container['previewText'] = isset($data['previewText']) ? $data['previewText'] : null; - $this->container['replyTo'] = isset($data['replyTo']) ? $data['replyTo'] : null; - $this->container['toField'] = isset($data['toField']) ? $data['toField'] : null; - $this->container['recipients'] = isset($data['recipients']) ? $data['recipients'] : null; - $this->container['attachmentUrl'] = isset($data['attachmentUrl']) ? $data['attachmentUrl'] : null; - $this->container['inlineImageActivation'] = isset($data['inlineImageActivation']) ? $data['inlineImageActivation'] : false; - $this->container['mirrorActive'] = isset($data['mirrorActive']) ? $data['mirrorActive'] : null; - $this->container['footer'] = isset($data['footer']) ? $data['footer'] : null; - $this->container['header'] = isset($data['header']) ? $data['header'] : null; - $this->container['utmCampaign'] = isset($data['utmCampaign']) ? $data['utmCampaign'] : null; - $this->container['params'] = isset($data['params']) ? $data['params'] : null; - $this->container['sendAtBestTime'] = isset($data['sendAtBestTime']) ? $data['sendAtBestTime'] : false; - $this->container['abTesting'] = isset($data['abTesting']) ? $data['abTesting'] : false; - $this->container['subjectA'] = isset($data['subjectA']) ? $data['subjectA'] : null; - $this->container['subjectB'] = isset($data['subjectB']) ? $data['subjectB'] : null; - $this->container['splitRule'] = isset($data['splitRule']) ? $data['splitRule'] : null; - $this->container['winnerCriteria'] = isset($data['winnerCriteria']) ? $data['winnerCriteria'] : null; - $this->container['winnerDelay'] = isset($data['winnerDelay']) ? $data['winnerDelay'] : null; - $this->container['ipWarmupEnable'] = isset($data['ipWarmupEnable']) ? $data['ipWarmupEnable'] : false; - $this->container['initialQuota'] = isset($data['initialQuota']) ? $data['initialQuota'] : null; - $this->container['increaseRate'] = isset($data['increaseRate']) ? $data['increaseRate'] : null; - $this->container['unsubscriptionPageId'] = isset($data['unsubscriptionPageId']) ? $data['unsubscriptionPageId'] : null; - $this->container['updateFormId'] = isset($data['updateFormId']) ? $data['updateFormId'] : null; + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('htmlContent', $data ?? [], null); + $this->setIfExists('htmlUrl', $data ?? [], null); + $this->setIfExists('templateId', $data ?? [], null); + $this->setIfExists('scheduledAt', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('previewText', $data ?? [], null); + $this->setIfExists('replyTo', $data ?? [], null); + $this->setIfExists('toField', $data ?? [], null); + $this->setIfExists('recipients', $data ?? [], null); + $this->setIfExists('attachmentUrl', $data ?? [], null); + $this->setIfExists('inlineImageActivation', $data ?? [], false); + $this->setIfExists('mirrorActive', $data ?? [], null); + $this->setIfExists('footer', $data ?? [], null); + $this->setIfExists('header', $data ?? [], null); + $this->setIfExists('utmCampaign', $data ?? [], null); + $this->setIfExists('params', $data ?? [], null); + $this->setIfExists('sendAtBestTime', $data ?? [], false); + $this->setIfExists('abTesting', $data ?? [], false); + $this->setIfExists('subjectA', $data ?? [], null); + $this->setIfExists('subjectB', $data ?? [], null); + $this->setIfExists('splitRule', $data ?? [], null); + $this->setIfExists('winnerCriteria', $data ?? [], null); + $this->setIfExists('winnerDelay', $data ?? [], null); + $this->setIfExists('ipWarmupEnable', $data ?? [], false); + $this->setIfExists('initialQuota', $data ?? [], null); + $this->setIfExists('increaseRate', $data ?? [], null); + $this->setIfExists('unsubscriptionPageId', $data ?? [], null); + $this->setIfExists('updateFormId', $data ?? [], null); + $this->setIfExists('emailExpirationDate', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -401,7 +422,8 @@ public function listInvalidProperties() $allowedValues = $this->getWinnerCriteriaAllowableValues(); if (!is_null($this->container['winnerCriteria']) && !in_array($this->container['winnerCriteria'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'winnerCriteria', must be one of '%s'", + "invalid value '%s' for 'winnerCriteria', must be one of '%s'", + $this->container['winnerCriteria'], implode("', '", $allowedValues) ); } @@ -426,85 +448,82 @@ public function listInvalidProperties() } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets tag + * Gets sender * - * @return string + * @return \Brevo\Client\Models\CreateEmailCampaignSender */ - public function getTag() + public function getSender(): \Brevo\Client\Models\CreateEmailCampaignSender { - return $this->container['tag']; + return $this->container['sender']; } /** - * Sets tag + * Sets sender * - * @param string $tag Tag of the campaign + * @param \Brevo\Client\Models\CreateEmailCampaignSender $sender sender * * @return $this */ - public function setTag($tag) + public function setSender(\Brevo\Client\Models\CreateEmailCampaignSender $sender): static { - $this->container['tag'] = $tag; + if (is_null($sender)) { + throw new InvalidArgumentException('non-nullable sender cannot be null'); + } + $this->container['sender'] = $sender; return $this; } /** - * Gets sender + * Gets name * - * @return \Brevo\Client\Models\CreateEmailCampaignSender + * @return string */ - public function getSender() + public function getName(): string { - return $this->container['sender']; + return $this->container['name']; } /** - * Sets sender + * Sets name * - * @param \Brevo\Client\Models\CreateEmailCampaignSender $sender sender + * @param string $name Name of the campaign * * @return $this */ - public function setSender($sender) + public function setName(string $name): static { - $this->container['sender'] = $sender; + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; return $this; } /** - * Gets name + * Gets tag * - * @return string + * @return string|null */ - public function getName() + public function getTag(): ?string { - return $this->container['name']; + return $this->container['tag']; } /** - * Sets name + * Sets tag * - * @param string $name Name of the campaign + * @param string|null $tag Tag of the campaign * * @return $this */ - public function setName($name) + public function setTag(?string $tag): static { - $this->container['name'] = $name; + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } + $this->container['tag'] = $tag; return $this; } @@ -512,9 +531,9 @@ public function setName($name) /** * Gets htmlContent * - * @return string + * @return string|null */ - public function getHtmlContent() + public function getHtmlContent(): ?string { return $this->container['htmlContent']; } @@ -522,12 +541,15 @@ public function getHtmlContent() /** * Sets htmlContent * - * @param string $htmlContent Mandatory if htmlUrl and templateId are empty. Body of the message (HTML) + * @param string|null $htmlContent Mandatory if htmlUrl and templateId are empty. Body of the message (HTML). * * @return $this */ - public function setHtmlContent($htmlContent) + public function setHtmlContent(?string $htmlContent): static { + if (is_null($htmlContent)) { + throw new InvalidArgumentException('non-nullable htmlContent cannot be null'); + } $this->container['htmlContent'] = $htmlContent; return $this; @@ -536,9 +558,9 @@ public function setHtmlContent($htmlContent) /** * Gets htmlUrl * - * @return string + * @return string|null */ - public function getHtmlUrl() + public function getHtmlUrl(): ?string { return $this->container['htmlUrl']; } @@ -546,12 +568,15 @@ public function getHtmlUrl() /** * Sets htmlUrl * - * @param string $htmlUrl Mandatory if htmlContent and templateId are empty. Url to the message (HTML) + * @param string|null $htmlUrl **Mandatory if htmlContent and templateId are empty**. Url to the message (HTML). For example: **https://html.domain.com** * * @return $this */ - public function setHtmlUrl($htmlUrl) + public function setHtmlUrl(?string $htmlUrl): static { + if (is_null($htmlUrl)) { + throw new InvalidArgumentException('non-nullable htmlUrl cannot be null'); + } $this->container['htmlUrl'] = $htmlUrl; return $this; @@ -560,9 +585,9 @@ public function setHtmlUrl($htmlUrl) /** * Gets templateId * - * @return int + * @return int|null */ - public function getTemplateId() + public function getTemplateId(): ?int { return $this->container['templateId']; } @@ -570,12 +595,15 @@ public function getTemplateId() /** * Sets templateId * - * @param int $templateId Mandatory if htmlContent and htmlUrl are empty. Id of the transactional email template with status 'active'. Used to copy only its content fetched from htmlContent/htmlUrl to an email campaign for RSS feature. + * @param int|null $templateId **Mandatory if htmlContent and htmlUrl are empty**. Id of the transactional email template with status _active_. Used to copy only its content fetched from htmlContent/htmlUrl to an email campaign for RSS feature. * * @return $this */ - public function setTemplateId($templateId) + public function setTemplateId(?int $templateId): static { + if (is_null($templateId)) { + throw new InvalidArgumentException('non-nullable templateId cannot be null'); + } $this->container['templateId'] = $templateId; return $this; @@ -584,9 +612,9 @@ public function setTemplateId($templateId) /** * Gets scheduledAt * - * @return string + * @return string|null */ - public function getScheduledAt() + public function getScheduledAt(): ?string { return $this->container['scheduledAt']; } @@ -594,12 +622,15 @@ public function getScheduledAt() /** * Sets scheduledAt * - * @param string $scheduledAt Sending UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. If sendAtBestTime is set to true, your campaign will be sent according to the date passed (ignoring the time part). + * @param string|null $scheduledAt Sending UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result**. If sendAtBestTime is set to true, your campaign will be sent according to the date passed (ignoring the time part). For example: **2017-06-01T12:30:00+02:00** * * @return $this */ - public function setScheduledAt($scheduledAt) + public function setScheduledAt(?string $scheduledAt): static { + if (is_null($scheduledAt)) { + throw new InvalidArgumentException('non-nullable scheduledAt cannot be null'); + } $this->container['scheduledAt'] = $scheduledAt; return $this; @@ -608,9 +639,9 @@ public function setScheduledAt($scheduledAt) /** * Gets subject * - * @return string + * @return string|null */ - public function getSubject() + public function getSubject(): ?string { return $this->container['subject']; } @@ -618,12 +649,15 @@ public function getSubject() /** * Sets subject * - * @param string $subject Subject of the campaign. Mandatory if abTesting is false. Ignored if abTesting is true. + * @param string|null $subject Subject of the campaign. **Mandatory if abTesting is false**. Ignored if abTesting is true. * * @return $this */ - public function setSubject($subject) + public function setSubject(?string $subject): static { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } $this->container['subject'] = $subject; return $this; @@ -632,9 +666,9 @@ public function setSubject($subject) /** * Gets previewText * - * @return string + * @return string|null */ - public function getPreviewText() + public function getPreviewText(): ?string { return $this->container['previewText']; } @@ -642,12 +676,15 @@ public function getPreviewText() /** * Sets previewText * - * @param string $previewText Preview text or preheader of the email campaign + * @param string|null $previewText Preview text or preheader of the email campaign * * @return $this */ - public function setPreviewText($previewText) + public function setPreviewText(?string $previewText): static { + if (is_null($previewText)) { + throw new InvalidArgumentException('non-nullable previewText cannot be null'); + } $this->container['previewText'] = $previewText; return $this; @@ -656,9 +693,9 @@ public function setPreviewText($previewText) /** * Gets replyTo * - * @return string + * @return string|null */ - public function getReplyTo() + public function getReplyTo(): ?string { return $this->container['replyTo']; } @@ -666,12 +703,15 @@ public function getReplyTo() /** * Sets replyTo * - * @param string $replyTo Email on which the campaign recipients will be able to reply to + * @param string|null $replyTo Email on which the campaign recipients will be able to reply to * * @return $this */ - public function setReplyTo($replyTo) + public function setReplyTo(?string $replyTo): static { + if (is_null($replyTo)) { + throw new InvalidArgumentException('non-nullable replyTo cannot be null'); + } $this->container['replyTo'] = $replyTo; return $this; @@ -680,9 +720,9 @@ public function setReplyTo($replyTo) /** * Gets toField * - * @return string + * @return string|null */ - public function getToField() + public function getToField(): ?string { return $this->container['toField']; } @@ -690,12 +730,15 @@ public function getToField() /** * Sets toField * - * @param string $toField To personalize the «To» Field. If you want to include the first name and last name of your recipient, add {FNAME} {LNAME}. These contact attributes must already exist in your Brevo account. If input parameter 'params' used please use {{contact.FNAME}} {{contact.LNAME}} for personalization + * @param string|null $toField To personalize the **To** Field. If you want to include the first name and last name of your recipient, add **{FNAME} {LNAME}**. These contact attributes must already exist in your Brevo account. If input parameter **params** used please use **{{contact.FNAME}} {{contact.LNAME}}** for personalization * * @return $this */ - public function setToField($toField) + public function setToField(?string $toField): static { + if (is_null($toField)) { + throw new InvalidArgumentException('non-nullable toField cannot be null'); + } $this->container['toField'] = $toField; return $this; @@ -704,9 +747,9 @@ public function setToField($toField) /** * Gets recipients * - * @return \Brevo\Client\Models\CreateEmailCampaignRecipients + * @return \Brevo\Client\Models\CreateEmailCampaignRecipients|null */ - public function getRecipients() + public function getRecipients(): ?\Brevo\Client\Models\CreateEmailCampaignRecipients { return $this->container['recipients']; } @@ -714,12 +757,15 @@ public function getRecipients() /** * Sets recipients * - * @param \Brevo\Client\Models\CreateEmailCampaignRecipients $recipients recipients + * @param \Brevo\Client\Models\CreateEmailCampaignRecipients|null $recipients recipients * * @return $this */ - public function setRecipients($recipients) + public function setRecipients(?\Brevo\Client\Models\CreateEmailCampaignRecipients $recipients): static { + if (is_null($recipients)) { + throw new InvalidArgumentException('non-nullable recipients cannot be null'); + } $this->container['recipients'] = $recipients; return $this; @@ -728,9 +774,9 @@ public function setRecipients($recipients) /** * Gets attachmentUrl * - * @return string + * @return string|null */ - public function getAttachmentUrl() + public function getAttachmentUrl(): ?string { return $this->container['attachmentUrl']; } @@ -738,12 +784,15 @@ 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 + * @param string|null $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) + public function setAttachmentUrl(?string $attachmentUrl): static { + if (is_null($attachmentUrl)) { + throw new InvalidArgumentException('non-nullable attachmentUrl cannot be null'); + } $this->container['attachmentUrl'] = $attachmentUrl; return $this; @@ -752,9 +801,9 @@ public function setAttachmentUrl($attachmentUrl) /** * Gets inlineImageActivation * - * @return bool + * @return bool|null */ - public function getInlineImageActivation() + public function getInlineImageActivation(): ?bool { return $this->container['inlineImageActivation']; } @@ -762,12 +811,15 @@ 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 + * @param bool|null $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) + public function setInlineImageActivation(?bool $inlineImageActivation): static { + if (is_null($inlineImageActivation)) { + throw new InvalidArgumentException('non-nullable inlineImageActivation cannot be null'); + } $this->container['inlineImageActivation'] = $inlineImageActivation; return $this; @@ -776,9 +828,9 @@ public function setInlineImageActivation($inlineImageActivation) /** * Gets mirrorActive * - * @return bool + * @return bool|null */ - public function getMirrorActive() + public function getMirrorActive(): ?bool { return $this->container['mirrorActive']; } @@ -786,12 +838,15 @@ public function getMirrorActive() /** * Sets mirrorActive * - * @param bool $mirrorActive Use true to enable the mirror link + * @param bool|null $mirrorActive Use true to enable the mirror link * * @return $this */ - public function setMirrorActive($mirrorActive) + public function setMirrorActive(?bool $mirrorActive): static { + if (is_null($mirrorActive)) { + throw new InvalidArgumentException('non-nullable mirrorActive cannot be null'); + } $this->container['mirrorActive'] = $mirrorActive; return $this; @@ -800,9 +855,9 @@ public function setMirrorActive($mirrorActive) /** * Gets footer * - * @return string + * @return string|null */ - public function getFooter() + public function getFooter(): ?string { return $this->container['footer']; } @@ -810,12 +865,15 @@ public function getFooter() /** * Sets footer * - * @param string $footer Footer of the email campaign + * @param string|null $footer Footer of the email campaign * * @return $this */ - public function setFooter($footer) + public function setFooter(?string $footer): static { + if (is_null($footer)) { + throw new InvalidArgumentException('non-nullable footer cannot be null'); + } $this->container['footer'] = $footer; return $this; @@ -824,9 +882,9 @@ public function setFooter($footer) /** * Gets header * - * @return string + * @return string|null */ - public function getHeader() + public function getHeader(): ?string { return $this->container['header']; } @@ -834,12 +892,15 @@ public function getHeader() /** * Sets header * - * @param string $header Header of the email campaign + * @param string|null $header Header of the email campaign * * @return $this */ - public function setHeader($header) + public function setHeader(?string $header): static { + if (is_null($header)) { + throw new InvalidArgumentException('non-nullable header cannot be null'); + } $this->container['header'] = $header; return $this; @@ -848,9 +909,9 @@ public function setHeader($header) /** * Gets utmCampaign * - * @return string + * @return string|null */ - public function getUtmCampaign() + public function getUtmCampaign(): ?string { return $this->container['utmCampaign']; } @@ -858,12 +919,15 @@ 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 + * @param string|null $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) + public function setUtmCampaign(?string $utmCampaign): static { + if (is_null($utmCampaign)) { + throw new InvalidArgumentException('non-nullable utmCampaign cannot be null'); + } $this->container['utmCampaign'] = $utmCampaign; return $this; @@ -872,9 +936,9 @@ public function setUtmCampaign($utmCampaign) /** * Gets params * - * @return object + * @return array|null */ - public function getParams() + public function getParams(): ?array { return $this->container['params']; } @@ -882,12 +946,15 @@ public function getParams() /** * Sets params * - * @param object $params Pass the set of attributes to customize the type classic campaign. For example, {\"FNAME\":\"Joe\", \"LNAME\":\"Doe\"}. Only available if 'type' is 'classic'. It's considered only if campaign is in New Template Language format. The New Template Language is dependent on the values of 'subject', 'htmlContent/htmlUrl', 'sender.name' & 'toField' + * @param array|null $params Pass the set of attributes to customize the type classic campaign. For example: **{\"FNAME\":\"Joe\", \"LNAME\":\"Doe\"}**. Only available if **type** is **classic**. It's considered only if campaign is in _New Template Language format_. The New Template Language is dependent on the values of **subject, htmlContent/htmlUrl, sender.name & toField** * * @return $this */ - public function setParams($params) + public function setParams(?array $params): static { + if (is_null($params)) { + throw new InvalidArgumentException('non-nullable params cannot be null'); + } $this->container['params'] = $params; return $this; @@ -896,9 +963,9 @@ public function setParams($params) /** * Gets sendAtBestTime * - * @return bool + * @return bool|null */ - public function getSendAtBestTime() + public function getSendAtBestTime(): ?bool { return $this->container['sendAtBestTime']; } @@ -906,12 +973,15 @@ public function getSendAtBestTime() /** * Sets sendAtBestTime * - * @param bool $sendAtBestTime Set this to true if you want to send your campaign at best time. + * @param bool|null $sendAtBestTime Set this to true if you want to send your campaign at best time. * * @return $this */ - public function setSendAtBestTime($sendAtBestTime) + public function setSendAtBestTime(?bool $sendAtBestTime): static { + if (is_null($sendAtBestTime)) { + throw new InvalidArgumentException('non-nullable sendAtBestTime cannot be null'); + } $this->container['sendAtBestTime'] = $sendAtBestTime; return $this; @@ -920,9 +990,9 @@ public function setSendAtBestTime($sendAtBestTime) /** * Gets abTesting * - * @return bool + * @return bool|null */ - public function getAbTesting() + public function getAbTesting(): ?bool { return $this->container['abTesting']; } @@ -930,12 +1000,15 @@ public function getAbTesting() /** * Sets abTesting * - * @param bool $abTesting Status of A/B Test. abTesting = false means it is disabled, & abTesting = true means it is enabled. 'subjectA', 'subjectB', 'splitRule', 'winnerCriteria' & 'winnerDelay' will be considered when abTesting is set to true. 'subjectA' & 'subjectB' are mandatory together & 'subject' if passed is ignored. Can be set to true only if 'sendAtBestTime' is 'false'. You will be able to set up two subject lines for your campaign and send them to a random sample of your total recipients. Half of the test group will receive version A, and the other half will receive version B + * @param bool|null $abTesting Status of A/B Test. abTesting = false means it is disabled & abTesting = true means it is enabled. **subjectA, subjectB, splitRule, winnerCriteria & winnerDelay** will be considered when abTesting is set to true. subjectA & subjectB are mandatory together & subject if passed is ignored. **Can be set to true only if sendAtBestTime is false**. You will be able to set up two subject lines for your campaign and send them to a random sample of your total recipients. Half of the test group will receive version A, and the other half will receive version B * * @return $this */ - public function setAbTesting($abTesting) + public function setAbTesting(?bool $abTesting): static { + if (is_null($abTesting)) { + throw new InvalidArgumentException('non-nullable abTesting cannot be null'); + } $this->container['abTesting'] = $abTesting; return $this; @@ -944,9 +1017,9 @@ public function setAbTesting($abTesting) /** * Gets subjectA * - * @return string + * @return string|null */ - public function getSubjectA() + public function getSubjectA(): ?string { return $this->container['subjectA']; } @@ -954,12 +1027,15 @@ public function getSubjectA() /** * Sets subjectA * - * @param string $subjectA Subject A of the campaign. Mandatory if abTesting = true. subjectA & subjectB should have unique value + * @param string|null $subjectA Subject A of the campaign. **Mandatory if abTesting = true**. subjectA & subjectB should have unique value * * @return $this */ - public function setSubjectA($subjectA) + public function setSubjectA(?string $subjectA): static { + if (is_null($subjectA)) { + throw new InvalidArgumentException('non-nullable subjectA cannot be null'); + } $this->container['subjectA'] = $subjectA; return $this; @@ -968,9 +1044,9 @@ public function setSubjectA($subjectA) /** * Gets subjectB * - * @return string + * @return string|null */ - public function getSubjectB() + public function getSubjectB(): ?string { return $this->container['subjectB']; } @@ -978,12 +1054,15 @@ public function getSubjectB() /** * Sets subjectB * - * @param string $subjectB Subject B of the campaign. Mandatory if abTesting = true. subjectA & subjectB should have unique value + * @param string|null $subjectB Subject B of the campaign. **Mandatory if abTesting = true**. subjectA & subjectB should have unique value * * @return $this */ - public function setSubjectB($subjectB) + public function setSubjectB(?string $subjectB): static { + if (is_null($subjectB)) { + throw new InvalidArgumentException('non-nullable subjectB cannot be null'); + } $this->container['subjectB'] = $subjectB; return $this; @@ -992,9 +1071,9 @@ public function setSubjectB($subjectB) /** * Gets splitRule * - * @return int + * @return int|null */ - public function getSplitRule() + public function getSplitRule(): ?int { return $this->container['splitRule']; } @@ -1002,18 +1081,21 @@ public function getSplitRule() /** * Sets splitRule * - * @param int $splitRule Add the size of your test groups. Mandatory if abTesting = true & 'recipients' is passed. We'll send version A and B to a random sample of recipients, and then the winning version to everyone else + * @param int|null $splitRule Add the size of your test groups. **Mandatory if abTesting = true & 'recipients' is passed**. We'll send version A and B to a random sample of recipients, and then the winning version to everyone else * * @return $this */ - public function setSplitRule($splitRule) + public function setSplitRule(?int $splitRule): static { + if (is_null($splitRule)) { + throw new InvalidArgumentException('non-nullable splitRule cannot be null'); + } - if (!is_null($splitRule) && ($splitRule > 50)) { - throw new \InvalidArgumentException('invalid value for $splitRule when calling CreateEmailCampaign., must be smaller than or equal to 50.'); + if (($splitRule > 50)) { + throw new InvalidArgumentException('invalid value for $splitRule when calling CreateEmailCampaign., must be smaller than or equal to 50.'); } - if (!is_null($splitRule) && ($splitRule < 1)) { - throw new \InvalidArgumentException('invalid value for $splitRule when calling CreateEmailCampaign., must be bigger than or equal to 1.'); + if (($splitRule < 1)) { + throw new InvalidArgumentException('invalid value for $splitRule when calling CreateEmailCampaign., must be bigger than or equal to 1.'); } $this->container['splitRule'] = $splitRule; @@ -1024,9 +1106,9 @@ public function setSplitRule($splitRule) /** * Gets winnerCriteria * - * @return string + * @return string|null */ - public function getWinnerCriteria() + public function getWinnerCriteria(): ?string { return $this->container['winnerCriteria']; } @@ -1034,17 +1116,21 @@ public function getWinnerCriteria() /** * Sets winnerCriteria * - * @param string $winnerCriteria Choose the metrics that will determinate the winning version. Mandatory if 'splitRule' >= 1 and < 50. If splitRule = 50, 'winnerCriteria' is ignored if passed + * @param string|null $winnerCriteria Choose the metrics that will determinate the winning version. **Mandatory if _splitRule_ >= 1 and < 50**. If splitRule = 50, `winnerCriteria` is ignored if passed * * @return $this */ - public function setWinnerCriteria($winnerCriteria) + public function setWinnerCriteria(?string $winnerCriteria): static { + if (is_null($winnerCriteria)) { + throw new InvalidArgumentException('non-nullable winnerCriteria cannot be null'); + } $allowedValues = $this->getWinnerCriteriaAllowableValues(); - if (!is_null($winnerCriteria) && !in_array($winnerCriteria, $allowedValues, true)) { - throw new \InvalidArgumentException( + if (!in_array($winnerCriteria, $allowedValues, true)) { + throw new InvalidArgumentException( sprintf( - "Invalid value for 'winnerCriteria', must be one of '%s'", + "Invalid value '%s' for 'winnerCriteria', must be one of '%s'", + $winnerCriteria, implode("', '", $allowedValues) ) ); @@ -1057,9 +1143,9 @@ public function setWinnerCriteria($winnerCriteria) /** * Gets winnerDelay * - * @return int + * @return int|null */ - public function getWinnerDelay() + public function getWinnerDelay(): ?int { return $this->container['winnerDelay']; } @@ -1067,18 +1153,21 @@ public function getWinnerDelay() /** * Sets winnerDelay * - * @param int $winnerDelay Choose the duration of the test in hours. Maximum is 7 days, pass 24*7 = 168 hours. The winning version will be sent at the end of the test. Mandatory if 'splitRule' >= 1 and < 50. If splitRule = 50, 'winnerDelay' is ignored if passed + * @param int|null $winnerDelay Choose the duration of the test in hours. Maximum is 7 days, pass 24*7 = 168 hours. The winning version will be sent at the end of the test. **Mandatory if _splitRule_ >= 1 and < 50**. If splitRule = 50, `winnerDelay` is ignored if passed * * @return $this */ - public function setWinnerDelay($winnerDelay) + public function setWinnerDelay(?int $winnerDelay): static { + if (is_null($winnerDelay)) { + throw new InvalidArgumentException('non-nullable winnerDelay cannot be null'); + } - if (!is_null($winnerDelay) && ($winnerDelay > 168)) { - throw new \InvalidArgumentException('invalid value for $winnerDelay when calling CreateEmailCampaign., must be smaller than or equal to 168.'); + if (($winnerDelay > 168)) { + throw new InvalidArgumentException('invalid value for $winnerDelay when calling CreateEmailCampaign., must be smaller than or equal to 168.'); } - if (!is_null($winnerDelay) && ($winnerDelay < 1)) { - throw new \InvalidArgumentException('invalid value for $winnerDelay when calling CreateEmailCampaign., must be bigger than or equal to 1.'); + if (($winnerDelay < 1)) { + throw new InvalidArgumentException('invalid value for $winnerDelay when calling CreateEmailCampaign., must be bigger than or equal to 1.'); } $this->container['winnerDelay'] = $winnerDelay; @@ -1089,9 +1178,9 @@ public function setWinnerDelay($winnerDelay) /** * Gets ipWarmupEnable * - * @return bool + * @return bool|null */ - public function getIpWarmupEnable() + public function getIpWarmupEnable(): ?bool { return $this->container['ipWarmupEnable']; } @@ -1099,12 +1188,15 @@ public function getIpWarmupEnable() /** * Sets ipWarmupEnable * - * @param bool $ipWarmupEnable Available for dedicated ip clients. Set this to true if you wish to warm up your ip. + * @param bool|null $ipWarmupEnable **Available for dedicated ip clients**. Set this to true if you wish to warm up your ip. * * @return $this */ - public function setIpWarmupEnable($ipWarmupEnable) + public function setIpWarmupEnable(?bool $ipWarmupEnable): static { + if (is_null($ipWarmupEnable)) { + throw new InvalidArgumentException('non-nullable ipWarmupEnable cannot be null'); + } $this->container['ipWarmupEnable'] = $ipWarmupEnable; return $this; @@ -1113,9 +1205,9 @@ public function setIpWarmupEnable($ipWarmupEnable) /** * Gets initialQuota * - * @return int + * @return int|null */ - public function getInitialQuota() + public function getInitialQuota(): ?int { return $this->container['initialQuota']; } @@ -1123,12 +1215,15 @@ public function getInitialQuota() /** * Sets initialQuota * - * @param int $initialQuota Mandatory if ipWarmupEnable is set to true. Set an initial quota greater than 1 for warming up your ip. We recommend you set a value of 3000. + * @param int|null $initialQuota **Mandatory if ipWarmupEnable is set to true**. Set an initial quota greater than 1 for warming up your ip. We recommend you set a value of 3000. * * @return $this */ - public function setInitialQuota($initialQuota) + public function setInitialQuota(?int $initialQuota): static { + if (is_null($initialQuota)) { + throw new InvalidArgumentException('non-nullable initialQuota cannot be null'); + } $this->container['initialQuota'] = $initialQuota; return $this; @@ -1137,9 +1232,9 @@ public function setInitialQuota($initialQuota) /** * Gets increaseRate * - * @return int + * @return int|null */ - public function getIncreaseRate() + public function getIncreaseRate(): ?int { return $this->container['increaseRate']; } @@ -1147,18 +1242,21 @@ public function getIncreaseRate() /** * Sets increaseRate * - * @param int $increaseRate Mandatory if ipWarmupEnable is set to true. Set a percentage increase rate for warming up your ip. We recommend you set the increase rate to 30% per day. If you want to send the same number of emails every day, set the daily increase value to 0%. + * @param int|null $increaseRate **Mandatory if ipWarmupEnable is set to true**. Set a percentage increase rate for warming up your ip. We recommend you set the increase rate to 30% per day. If you want to send the same number of emails every day, set the daily increase value to 0%. * * @return $this */ - public function setIncreaseRate($increaseRate) + public function setIncreaseRate(?int $increaseRate): static { + if (is_null($increaseRate)) { + throw new InvalidArgumentException('non-nullable increaseRate cannot be null'); + } - if (!is_null($increaseRate) && ($increaseRate > 100)) { - throw new \InvalidArgumentException('invalid value for $increaseRate when calling CreateEmailCampaign., must be smaller than or equal to 100.'); + if (($increaseRate > 100)) { + throw new InvalidArgumentException('invalid value for $increaseRate when calling CreateEmailCampaign., must be smaller than or equal to 100.'); } - if (!is_null($increaseRate) && ($increaseRate < 0)) { - throw new \InvalidArgumentException('invalid value for $increaseRate when calling CreateEmailCampaign., must be bigger than or equal to 0.'); + if (($increaseRate < 0)) { + throw new InvalidArgumentException('invalid value for $increaseRate when calling CreateEmailCampaign., must be bigger than or equal to 0.'); } $this->container['increaseRate'] = $increaseRate; @@ -1169,9 +1267,9 @@ public function setIncreaseRate($increaseRate) /** * Gets unsubscriptionPageId * - * @return string + * @return string|null */ - public function getUnsubscriptionPageId() + public function getUnsubscriptionPageId(): ?string { return $this->container['unsubscriptionPageId']; } @@ -1179,12 +1277,15 @@ public function getUnsubscriptionPageId() /** * Sets unsubscriptionPageId * - * @param string $unsubscriptionPageId Enter an unsubscription page id. The page id is a 24 digit alphanumeric id that can be found in the URL when editing the page. If not entered, then the default unsubscription page will be used. + * @param string|null $unsubscriptionPageId Enter an unsubscription page id. The page id is a 24 digit alphanumeric id that can be found in the URL when editing the page. If not entered, then the default unsubscription page will be used. * * @return $this */ - public function setUnsubscriptionPageId($unsubscriptionPageId) + public function setUnsubscriptionPageId(?string $unsubscriptionPageId): static { + if (is_null($unsubscriptionPageId)) { + throw new InvalidArgumentException('non-nullable unsubscriptionPageId cannot be null'); + } $this->container['unsubscriptionPageId'] = $unsubscriptionPageId; return $this; @@ -1193,9 +1294,9 @@ public function setUnsubscriptionPageId($unsubscriptionPageId) /** * Gets updateFormId * - * @return string + * @return string|null */ - public function getUpdateFormId() + public function getUpdateFormId(): ?string { return $this->container['updateFormId']; } @@ -1203,88 +1304,45 @@ public function getUpdateFormId() /** * Sets updateFormId * - * @param string $updateFormId Mandatory if templateId is used containing the {{ update_profile }} tag. Enter an update profile form id. The form id is a 24 digit alphanumeric id that can be found in the URL when editing the form. If not entered, then the default update profile form will be used. + * @param string|null $updateFormId **Mandatory if templateId is used containing the {{ update_profile }} tag**. Enter an update profile form id. The form id is a 24 digit alphanumeric id that can be found in the URL when editing the form. If not entered, then the default update profile form will be used. * * @return $this */ - public function setUpdateFormId($updateFormId) + public function setUpdateFormId(?string $updateFormId): static { + if (is_null($updateFormId)) { + throw new InvalidArgumentException('non-nullable updateFormId cannot be null'); + } $this->container['updateFormId'] = $updateFormId; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } /** - * Gets offset. + * Gets emailExpirationDate * - * @param integer $offset Offset - * - * @return mixed + * @return \Brevo\Client\Models\CreateEmailCampaignEmailExpirationDate|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function getEmailExpirationDate(): ?\Brevo\Client\Models\CreateEmailCampaignEmailExpirationDate { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container['emailExpirationDate']; } /** - * Sets value based on offset. + * Sets emailExpirationDate * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param \Brevo\Client\Models\CreateEmailCampaignEmailExpirationDate|null $emailExpirationDate emailExpirationDate * - * @return void - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string + * @return $this */ - public function __toString() + public function setEmailExpirationDate(?\Brevo\Client\Models\CreateEmailCampaignEmailExpirationDate $emailExpirationDate): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($emailExpirationDate)) { + throw new InvalidArgumentException('non-nullable emailExpirationDate cannot be null'); } + $this->container['emailExpirationDate'] = $emailExpirationDate; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/CreateEmailCampaignEmailExpirationDate.php b/lib/Models/CreateEmailCampaignEmailExpirationDate.php new file mode 100644 index 0000000..719241c --- /dev/null +++ b/lib/Models/CreateEmailCampaignEmailExpirationDate.php @@ -0,0 +1,294 @@ + + */ +class CreateEmailCampaignEmailExpirationDate extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createEmailCampaign_emailExpirationDate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'duration' => 'int', + 'unit' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'duration' => 'int64', + 'unit' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'duration' => false, + 'unit' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'duration' => 'duration', + 'unit' => 'unit' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'duration' => 'setDuration', + 'unit' => 'setUnit' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'duration' => 'getDuration', + 'unit' => 'getUnit' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const UNIT_DAYS = 'days'; + public const UNIT_WEEKS = 'weeks'; + public const UNIT_MONTHS = 'months'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getUnitAllowableValues() + { + return [ + self::UNIT_DAYS, + self::UNIT_WEEKS, + self::UNIT_MONTHS, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('duration', $data ?? [], null); + $this->setIfExists('unit', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['duration']) && ($this->container['duration'] > 3600)) { + $invalidProperties[] = "invalid value for 'duration', must be smaller than or equal to 3600."; + } + + if (!is_null($this->container['duration']) && ($this->container['duration'] < 1)) { + $invalidProperties[] = "invalid value for 'duration', must be bigger than or equal to 1."; + } + + $allowedValues = $this->getUnitAllowableValues(); + if (!is_null($this->container['unit']) && !in_array($this->container['unit'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'unit', must be one of '%s'", + $this->container['unit'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets duration + * + * @return int|null + */ + public function getDuration(): ?int + { + return $this->container['duration']; + } + + /** + * Sets duration + * + * @param int|null $duration Duration of the email expiry. maximum duration can be 3600 days or 480 weeks or 120 months. + * + * @return $this + */ + public function setDuration(?int $duration): static + { + if (is_null($duration)) { + throw new InvalidArgumentException('non-nullable duration cannot be null'); + } + + if (($duration > 3600)) { + throw new InvalidArgumentException('invalid value for $duration when calling CreateEmailCampaignEmailExpirationDate., must be smaller than or equal to 3600.'); + } + if (($duration < 1)) { + throw new InvalidArgumentException('invalid value for $duration when calling CreateEmailCampaignEmailExpirationDate., must be bigger than or equal to 1.'); + } + + $this->container['duration'] = $duration; + + return $this; + } + + /** + * Gets unit + * + * @return string|null + */ + public function getUnit(): ?string + { + return $this->container['unit']; + } + + /** + * Sets unit + * + * @param string|null $unit unit of the duration + * + * @return $this + */ + public function setUnit(?string $unit): static + { + if (is_null($unit)) { + throw new InvalidArgumentException('non-nullable unit cannot be null'); + } + $allowedValues = $this->getUnitAllowableValues(); + if (!in_array($unit, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'unit', must be one of '%s'", + $unit, + implode("', '", $allowedValues) + ) + ); + } + $this->container['unit'] = $unit; + + return $this; + } +} + + diff --git a/lib/Models/CreateEmailCampaignRecipients.php b/lib/Models/CreateEmailCampaignRecipients.php index 3a6cf87..1eb3761 100644 --- a/lib/Models/CreateEmailCampaignRecipients.php +++ b/lib/Models/CreateEmailCampaignRecipients.php @@ -2,62 +2,64 @@ /** * CreateEmailCampaignRecipients * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateEmailCampaignRecipients Class Doc Comment * - * @category Class * @description Segment ids and List ids to include/exclude from campaign * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateEmailCampaignRecipients implements ModelInterface, ArrayAccess +class CreateEmailCampaignRecipients extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createEmailCampaign_recipients'; + protected static string $openAPIModelName = 'createEmailCampaign_recipients'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'exclusionListIds' => 'int[]', 'listIds' => 'int[]', 'segmentIds' => 'int[]' @@ -66,41 +68,39 @@ class CreateEmailCampaignRecipients implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'exclusionListIds' => 'int64', 'listIds' => 'int64', 'segmentIds' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'exclusionListIds' => false, + 'listIds' => false, + 'segmentIds' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'exclusionListIds' => 'exclusionListIds', 'listIds' => 'listIds', 'segmentIds' => 'segmentIds' @@ -109,9 +109,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'exclusionListIds' => 'setExclusionListIds', 'listIds' => 'setListIds', 'segmentIds' => 'setSegmentIds' @@ -120,9 +120,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'exclusionListIds' => 'getExclusionListIds', 'listIds' => 'getListIds', 'segmentIds' => 'getSegmentIds' @@ -132,9 +132,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -142,9 +142,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -152,77 +152,51 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['exclusionListIds'] = isset($data['exclusionListIds']) ? $data['exclusionListIds'] : null; - $this->container['listIds'] = isset($data['listIds']) ? $data['listIds'] : null; - $this->container['segmentIds'] = isset($data['segmentIds']) ? $data['segmentIds'] : null; + $this->setIfExists('exclusionListIds', $data ?? [], null); + $this->setIfExists('listIds', $data ?? [], null); + $this->setIfExists('segmentIds', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets exclusionListIds * - * @return int[] + * @return int[]|null */ - public function getExclusionListIds() + public function getExclusionListIds(): ?array { return $this->container['exclusionListIds']; } @@ -230,12 +204,15 @@ public function getExclusionListIds() /** * Sets exclusionListIds * - * @param int[] $exclusionListIds List ids to exclude from the campaign + * @param int[]|null $exclusionListIds List ids to exclude from the campaign * * @return $this */ - public function setExclusionListIds($exclusionListIds) + public function setExclusionListIds(?array $exclusionListIds): static { + if (is_null($exclusionListIds)) { + throw new InvalidArgumentException('non-nullable exclusionListIds cannot be null'); + } $this->container['exclusionListIds'] = $exclusionListIds; return $this; @@ -244,9 +221,9 @@ public function setExclusionListIds($exclusionListIds) /** * Gets listIds * - * @return int[] + * @return int[]|null */ - public function getListIds() + public function getListIds(): ?array { return $this->container['listIds']; } @@ -254,12 +231,15 @@ public function getListIds() /** * Sets listIds * - * @param int[] $listIds Mandatory if scheduledAt is not empty. List Ids to send the campaign to + * @param int[]|null $listIds **Mandatory if scheduledAt is not empty**. List Ids to send the campaign to * * @return $this */ - public function setListIds($listIds) + public function setListIds(?array $listIds): static { + if (is_null($listIds)) { + throw new InvalidArgumentException('non-nullable listIds cannot be null'); + } $this->container['listIds'] = $listIds; return $this; @@ -268,9 +248,9 @@ public function setListIds($listIds) /** * Gets segmentIds * - * @return int[] + * @return int[]|null */ - public function getSegmentIds() + public function getSegmentIds(): ?array { return $this->container['segmentIds']; } @@ -278,89 +258,19 @@ public function getSegmentIds() /** * Sets segmentIds * - * @param int[] $segmentIds Mandatory if listIds are not used. Segment ids to send the campaign to. + * @param int[]|null $segmentIds **Mandatory if listIds are not used**. Segment ids to send the campaign to. * * @return $this */ - public function setSegmentIds($segmentIds) + public function setSegmentIds(?array $segmentIds): static { + if (is_null($segmentIds)) { + throw new InvalidArgumentException('non-nullable segmentIds cannot be null'); + } $this->container['segmentIds'] = $segmentIds; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateEmailCampaignSender.php b/lib/Models/CreateEmailCampaignSender.php index 21e679d..c252b66 100644 --- a/lib/Models/CreateEmailCampaignSender.php +++ b/lib/Models/CreateEmailCampaignSender.php @@ -2,62 +2,64 @@ /** * CreateEmailCampaignSender * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateEmailCampaignSender Class Doc Comment * - * @category Class - * @description Sender details including id or email and name (optional). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example `{\"name\":\"xyz\", \"email\":\"example@abc.com\"}` , `{\"name\":\"xyz\", \"id\":123}` + * @description Sender details including id or email and name (_optional_). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example: **{\"name\":\"xyz\", \"email\":\"example@abc.com\"}** **{\"name\":\"xyz\", \"id\":123}** * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateEmailCampaignSender implements ModelInterface, ArrayAccess +class CreateEmailCampaignSender extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createEmailCampaign_sender'; + protected static string $openAPIModelName = 'createEmailCampaign_sender'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string', 'email' => 'string', 'id' => 'int' @@ -66,41 +68,39 @@ class CreateEmailCampaignSender implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null, 'email' => 'email', 'id' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'email' => false, + 'id' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name', 'email' => 'email', 'id' => 'id' @@ -109,9 +109,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName', 'email' => 'setEmail', 'id' => 'setId' @@ -120,9 +120,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName', 'email' => 'getEmail', 'id' => 'getId' @@ -132,9 +132,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -142,9 +142,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -152,80 +152,51 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; - if ($this->container['email'] === null) { - $invalidProperties[] = "'email' can't be null"; - } return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * - * @return string + * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -233,12 +204,15 @@ public function getName() /** * Sets name * - * @param string $name Sender Name + * @param string|null $name Sender Name * * @return $this */ - public function setName($name) + public function setName(?string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -247,9 +221,9 @@ public function setName($name) /** * Gets email * - * @return string + * @return string|null */ - public function getEmail() + public function getEmail(): ?string { return $this->container['email']; } @@ -257,12 +231,15 @@ public function getEmail() /** * Sets email * - * @param string $email Sender email + * @param string|null $email Sender email * * @return $this */ - public function setEmail($email) + public function setEmail(?string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -271,9 +248,9 @@ public function setEmail($email) /** * Gets id * - * @return int + * @return int|null */ - public function getId() + public function getId(): ?int { return $this->container['id']; } @@ -281,89 +258,19 @@ public function getId() /** * Sets id * - * @param int $id Select the sender for the campaign on the basis of sender id. In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email). + * @param int|null $id Select the sender for the campaign on the basis of sender id. _In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email)_. * * @return $this */ - public function setId($id) + public function setId(?int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateExternalFeed.php b/lib/Models/CreateExternalFeed.php index b53bf89..4240bb2 100644 --- a/lib/Models/CreateExternalFeed.php +++ b/lib/Models/CreateExternalFeed.php @@ -2,68 +2,70 @@ /** * CreateExternalFeed * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateExternalFeed Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateExternalFeed implements ModelInterface, ArrayAccess +class CreateExternalFeed extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createExternalFeed'; + protected static string $openAPIModelName = 'createExternalFeed'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string', 'url' => 'string', 'authType' => 'string', 'username' => 'string', 'password' => 'string', 'token' => 'string', - 'headers' => '\Brevo\Client\Models\GetExternalFeedByUUIDHeaders[]', + 'headers' => '\Brevo\Client\Models\GetExternalFeedByUUIDHeadersInner[]', 'maxRetries' => 'int', 'cache' => 'bool' ]; @@ -71,9 +73,9 @@ class CreateExternalFeed implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null, 'url' => 'url', 'authType' => null, @@ -86,32 +88,36 @@ class CreateExternalFeed implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'url' => false, + 'authType' => false, + 'username' => false, + 'password' => false, + 'token' => false, + 'headers' => false, + 'maxRetries' => false, + 'cache' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name', 'url' => 'url', 'authType' => 'authType', @@ -126,9 +132,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName', 'url' => 'setUrl', 'authType' => 'setAuthType', @@ -143,9 +149,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName', 'url' => 'getUrl', 'authType' => 'getAuthType', @@ -161,9 +167,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -171,9 +177,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -181,28 +187,16 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const AUTH_TYPE_BASIC = 'basic'; - const AUTH_TYPE_TOKEN = 'token'; - const AUTH_TYPE_NO_AUTH = 'noAuth'; - - + public const AUTH_TYPE_BASIC = 'basic'; + public const AUTH_TYPE_TOKEN = 'token'; + public const AUTH_TYPE_NO_AUTH = 'noAuth'; /** * Gets allowable values of the enum @@ -218,39 +212,37 @@ public function getAuthTypeAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['authType'] = isset($data['authType']) ? $data['authType'] : 'noAuth'; - $this->container['username'] = isset($data['username']) ? $data['username'] : null; - $this->container['password'] = isset($data['password']) ? $data['password'] : null; - $this->container['token'] = isset($data['token']) ? $data['token'] : null; - $this->container['headers'] = isset($data['headers']) ? $data['headers'] : null; - $this->container['maxRetries'] = isset($data['maxRetries']) ? $data['maxRetries'] : null; - $this->container['cache'] = isset($data['cache']) ? $data['cache'] : false; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('authType', $data ?? [], 'noAuth'); + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('password', $data ?? [], null); + $this->setIfExists('token', $data ?? [], null); + $this->setIfExists('headers', $data ?? [], null); + $this->setIfExists('maxRetries', $data ?? [], 5); + $this->setIfExists('cache', $data ?? [], false); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -263,7 +255,8 @@ public function listInvalidProperties() $allowedValues = $this->getAuthTypeAllowableValues(); if (!is_null($this->container['authType']) && !in_array($this->container['authType'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'authType', must be one of '%s'", + "invalid value '%s' for 'authType', must be one of '%s'", + $this->container['authType'], implode("', '", $allowedValues) ); } @@ -279,24 +272,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -308,8 +289,11 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -320,7 +304,7 @@ public function setName($name) * * @return string */ - public function getUrl() + public function getUrl(): string { return $this->container['url']; } @@ -332,8 +316,11 @@ public function getUrl() * * @return $this */ - public function setUrl($url) + public function setUrl(string $url): static { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } $this->container['url'] = $url; return $this; @@ -342,9 +329,9 @@ public function setUrl($url) /** * Gets authType * - * @return string + * @return string|null */ - public function getAuthType() + public function getAuthType(): ?string { return $this->container['authType']; } @@ -352,17 +339,21 @@ public function getAuthType() /** * Sets authType * - * @param string $authType Auth type of the feed: * `basic` * `token` * `noAuth` + * @param string|null $authType Auth type of the feed: * `basic` * `token` * `noAuth` * * @return $this */ - public function setAuthType($authType) + public function setAuthType(?string $authType): static { + if (is_null($authType)) { + throw new InvalidArgumentException('non-nullable authType cannot be null'); + } $allowedValues = $this->getAuthTypeAllowableValues(); - if (!is_null($authType) && !in_array($authType, $allowedValues, true)) { - throw new \InvalidArgumentException( + if (!in_array($authType, $allowedValues, true)) { + throw new InvalidArgumentException( sprintf( - "Invalid value for 'authType', must be one of '%s'", + "Invalid value '%s' for 'authType', must be one of '%s'", + $authType, implode("', '", $allowedValues) ) ); @@ -375,9 +366,9 @@ public function setAuthType($authType) /** * Gets username * - * @return string + * @return string|null */ - public function getUsername() + public function getUsername(): ?string { return $this->container['username']; } @@ -385,12 +376,15 @@ public function getUsername() /** * Sets username * - * @param string $username Username for authType `basic` + * @param string|null $username Username for authType `basic` * * @return $this */ - public function setUsername($username) + public function setUsername(?string $username): static { + if (is_null($username)) { + throw new InvalidArgumentException('non-nullable username cannot be null'); + } $this->container['username'] = $username; return $this; @@ -399,9 +393,9 @@ public function setUsername($username) /** * Gets password * - * @return string + * @return string|null */ - public function getPassword() + public function getPassword(): ?string { return $this->container['password']; } @@ -409,12 +403,15 @@ public function getPassword() /** * Sets password * - * @param string $password Password for authType `basic` + * @param string|null $password Password for authType `basic` * * @return $this */ - public function setPassword($password) + public function setPassword(?string $password): static { + if (is_null($password)) { + throw new InvalidArgumentException('non-nullable password cannot be null'); + } $this->container['password'] = $password; return $this; @@ -423,9 +420,9 @@ public function setPassword($password) /** * Gets token * - * @return string + * @return string|null */ - public function getToken() + public function getToken(): ?string { return $this->container['token']; } @@ -433,12 +430,15 @@ public function getToken() /** * Sets token * - * @param string $token Token for authType `token` + * @param string|null $token Token for authType `token` * * @return $this */ - public function setToken($token) + public function setToken(?string $token): static { + if (is_null($token)) { + throw new InvalidArgumentException('non-nullable token cannot be null'); + } $this->container['token'] = $token; return $this; @@ -447,9 +447,9 @@ public function setToken($token) /** * Gets headers * - * @return \Brevo\Client\Models\GetExternalFeedByUUIDHeaders[] + * @return \Brevo\Client\Models\GetExternalFeedByUUIDHeadersInner[]|null */ - public function getHeaders() + public function getHeaders(): ?array { return $this->container['headers']; } @@ -457,12 +457,15 @@ public function getHeaders() /** * Sets headers * - * @param \Brevo\Client\Models\GetExternalFeedByUUIDHeaders[] $headers Custom headers for the feed + * @param \Brevo\Client\Models\GetExternalFeedByUUIDHeadersInner[]|null $headers Custom headers for the feed * * @return $this */ - public function setHeaders($headers) + public function setHeaders(?array $headers): static { + if (is_null($headers)) { + throw new InvalidArgumentException('non-nullable headers cannot be null'); + } $this->container['headers'] = $headers; return $this; @@ -471,9 +474,9 @@ public function setHeaders($headers) /** * Gets maxRetries * - * @return int + * @return int|null */ - public function getMaxRetries() + public function getMaxRetries(): ?int { return $this->container['maxRetries']; } @@ -481,18 +484,21 @@ public function getMaxRetries() /** * Sets maxRetries * - * @param int $maxRetries Maximum number of retries on the feed url + * @param int|null $maxRetries Maximum number of retries on the feed url * * @return $this */ - public function setMaxRetries($maxRetries) + public function setMaxRetries(?int $maxRetries): static { + if (is_null($maxRetries)) { + throw new InvalidArgumentException('non-nullable maxRetries cannot be null'); + } - if (!is_null($maxRetries) && ($maxRetries > 5)) { - throw new \InvalidArgumentException('invalid value for $maxRetries when calling CreateExternalFeed., must be smaller than or equal to 5.'); + if (($maxRetries > 5)) { + throw new InvalidArgumentException('invalid value for $maxRetries when calling CreateExternalFeed., must be smaller than or equal to 5.'); } - if (!is_null($maxRetries) && ($maxRetries < 0)) { - throw new \InvalidArgumentException('invalid value for $maxRetries when calling CreateExternalFeed., must be bigger than or equal to 0.'); + if (($maxRetries < 0)) { + throw new InvalidArgumentException('invalid value for $maxRetries when calling CreateExternalFeed., must be bigger than or equal to 0.'); } $this->container['maxRetries'] = $maxRetries; @@ -503,9 +509,9 @@ public function setMaxRetries($maxRetries) /** * Gets cache * - * @return bool + * @return bool|null */ - public function getCache() + public function getCache(): ?bool { return $this->container['cache']; } @@ -513,89 +519,19 @@ public function getCache() /** * Sets cache * - * @param bool $cache Toggle caching of feed url response + * @param bool|null $cache Toggle caching of feed url response * * @return $this */ - public function setCache($cache) + public function setCache(?bool $cache): static { + if (is_null($cache)) { + throw new InvalidArgumentException('non-nullable cache cannot be null'); + } $this->container['cache'] = $cache; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateExternalFeed201Response.php b/lib/Models/CreateExternalFeed201Response.php new file mode 100644 index 0000000..8345ebb --- /dev/null +++ b/lib/Models/CreateExternalFeed201Response.php @@ -0,0 +1,210 @@ + + */ +class CreateExternalFeed201Response extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createExternalFeed_201_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'uuidv4' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id ID of the object created + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } +} + + diff --git a/lib/Models/CreateList.php b/lib/Models/CreateList.php index dde4281..bbc5058 100644 --- a/lib/Models/CreateList.php +++ b/lib/Models/CreateList.php @@ -2,61 +2,63 @@ /** * CreateList * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateList Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateList implements ModelInterface, ArrayAccess +class CreateList extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createList'; + protected static string $openAPIModelName = 'createList'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string', 'folderId' => 'int' ]; @@ -64,40 +66,37 @@ class CreateList implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null, 'folderId' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'folderId' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name', 'folderId' => 'folderId' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName', 'folderId' => 'setFolderId' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName', 'folderId' => 'getFolderId' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,52 +145,38 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['folderId'] = isset($data['folderId']) ? $data['folderId'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('folderId', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -204,24 +189,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -233,8 +206,11 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -245,7 +221,7 @@ public function setName($name) * * @return int */ - public function getFolderId() + public function getFolderId(): int { return $this->container['folderId']; } @@ -257,85 +233,15 @@ public function getFolderId() * * @return $this */ - public function setFolderId($folderId) + public function setFolderId(int $folderId): static { + if (is_null($folderId)) { + throw new InvalidArgumentException('non-nullable folderId cannot be null'); + } $this->container['folderId'] = $folderId; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateLoyaltyProgramPayload.php b/lib/Models/CreateLoyaltyProgramPayload.php new file mode 100644 index 0000000..0bdedb4 --- /dev/null +++ b/lib/Models/CreateLoyaltyProgramPayload.php @@ -0,0 +1,278 @@ + + */ +class CreateLoyaltyProgramPayload extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createLoyaltyProgramPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'description' => 'string', + 'meta' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'description' => null, + 'meta' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'description' => false, + 'meta' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'description' => 'description', + 'meta' => 'meta' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'description' => 'setDescription', + 'meta' => 'setMeta' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'description' => 'getDescription', + 'meta' => 'getMeta' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('meta', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Loyalty Program name + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Loyalty Program description + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets meta + * + * @return object|null + */ + public function getMeta(): ?object + { + return $this->container['meta']; + } + + /** + * Sets meta + * + * @param object|null $meta Loyalty Program meta data + * + * @return $this + */ + public function setMeta(?object $meta): static + { + if (is_null($meta)) { + throw new InvalidArgumentException('non-nullable meta cannot be null'); + } + $this->container['meta'] = $meta; + + return $this; + } +} + + diff --git a/lib/Models/CreateModel.php b/lib/Models/CreateModel.php index f95314c..bf02d9e 100644 --- a/lib/Models/CreateModel.php +++ b/lib/Models/CreateModel.php @@ -2,118 +2,116 @@ /** * CreateModel * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateModel Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateModel implements ModelInterface, ArrayAccess +class CreateModel extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createModel'; + protected static string $openAPIModelName = 'createModel'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,51 +139,37 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->setIfExists('id', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -195,24 +179,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -224,85 +196,15 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateOrderPayload.php b/lib/Models/CreateOrderPayload.php new file mode 100644 index 0000000..4d4595e --- /dev/null +++ b/lib/Models/CreateOrderPayload.php @@ -0,0 +1,389 @@ + + */ +class CreateOrderPayload extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createOrderPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'amount' => 'float', + 'dueAt' => 'string', + 'contactId' => 'float', + 'balanceDefinitionId' => 'string', + 'expiresAt' => 'string', + 'meta' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'amount' => null, + 'dueAt' => null, + 'contactId' => null, + 'balanceDefinitionId' => 'uuid', + 'expiresAt' => null, + 'meta' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'amount' => false, + 'dueAt' => false, + 'contactId' => false, + 'balanceDefinitionId' => false, + 'expiresAt' => false, + 'meta' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'amount' => 'amount', + 'dueAt' => 'dueAt', + 'contactId' => 'contactId', + 'balanceDefinitionId' => 'balanceDefinitionId', + 'expiresAt' => 'expiresAt', + 'meta' => 'meta' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'amount' => 'setAmount', + 'dueAt' => 'setDueAt', + 'contactId' => 'setContactId', + 'balanceDefinitionId' => 'setBalanceDefinitionId', + 'expiresAt' => 'setExpiresAt', + 'meta' => 'setMeta' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'amount' => 'getAmount', + 'dueAt' => 'getDueAt', + 'contactId' => 'getContactId', + 'balanceDefinitionId' => 'getBalanceDefinitionId', + 'expiresAt' => 'getExpiresAt', + 'meta' => 'getMeta' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('dueAt', $data ?? [], null); + $this->setIfExists('contactId', $data ?? [], null); + $this->setIfExists('balanceDefinitionId', $data ?? [], null); + $this->setIfExists('expiresAt', $data ?? [], null); + $this->setIfExists('meta', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['amount'] === null) { + $invalidProperties[] = "'amount' can't be null"; + } + if ($this->container['dueAt'] === null) { + $invalidProperties[] = "'dueAt' can't be null"; + } + if ($this->container['contactId'] === null) { + $invalidProperties[] = "'contactId' can't be null"; + } + if ($this->container['balanceDefinitionId'] === null) { + $invalidProperties[] = "'balanceDefinitionId' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets amount + * + * @return float + */ + public function getAmount(): float + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float $amount Amount of the order + * + * @return $this + */ + public function setAmount(float $amount): static + { + if (is_null($amount)) { + throw new InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets dueAt + * + * @return string + */ + public function getDueAt(): string + { + return $this->container['dueAt']; + } + + /** + * Sets dueAt + * + * @param string $dueAt Date and time at which the order needs to be processed + * + * @return $this + */ + public function setDueAt(string $dueAt): static + { + if (is_null($dueAt)) { + throw new InvalidArgumentException('non-nullable dueAt cannot be null'); + } + $this->container['dueAt'] = $dueAt; + + return $this; + } + + /** + * Gets contactId + * + * @return float + */ + public function getContactId(): float + { + return $this->container['contactId']; + } + + /** + * Sets contactId + * + * @param float $contactId Contact id + * + * @return $this + */ + public function setContactId(float $contactId): static + { + if (is_null($contactId)) { + throw new InvalidArgumentException('non-nullable contactId cannot be null'); + } + $this->container['contactId'] = $contactId; + + return $this; + } + + /** + * Gets balanceDefinitionId + * + * @return string + */ + public function getBalanceDefinitionId(): string + { + return $this->container['balanceDefinitionId']; + } + + /** + * Sets balanceDefinitionId + * + * @param string $balanceDefinitionId Balance definition id + * + * @return $this + */ + public function setBalanceDefinitionId(string $balanceDefinitionId): static + { + if (is_null($balanceDefinitionId)) { + throw new InvalidArgumentException('non-nullable balanceDefinitionId cannot be null'); + } + $this->container['balanceDefinitionId'] = $balanceDefinitionId; + + return $this; + } + + /** + * Gets expiresAt + * + * @return string|null + */ + public function getExpiresAt(): ?string + { + return $this->container['expiresAt']; + } + + /** + * Sets expiresAt + * + * @param string|null $expiresAt Add expiration to the balance credited by the order + * + * @return $this + */ + public function setExpiresAt(?string $expiresAt): static + { + if (is_null($expiresAt)) { + throw new InvalidArgumentException('non-nullable expiresAt cannot be null'); + } + $this->container['expiresAt'] = $expiresAt; + + return $this; + } + + /** + * Gets meta + * + * @return object|null + */ + public function getMeta(): ?object + { + return $this->container['meta']; + } + + /** + * Sets meta + * + * @param object|null $meta Additional metadata related to the order. + * + * @return $this + */ + public function setMeta(?object $meta): static + { + if (is_null($meta)) { + throw new InvalidArgumentException('non-nullable meta cannot be null'); + } + $this->container['meta'] = $meta; + + return $this; + } +} + + diff --git a/lib/Models/CreatePaymentRequest.php b/lib/Models/CreatePaymentRequest.php new file mode 100644 index 0000000..146a862 --- /dev/null +++ b/lib/Models/CreatePaymentRequest.php @@ -0,0 +1,386 @@ + + */ +class CreatePaymentRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createPaymentRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'reference' => 'string', + 'cart' => '\Brevo\Client\Models\Cart', + 'contactId' => 'int', + 'description' => 'string', + 'notification' => '\Brevo\Client\Models\Notification', + 'configuration' => '\Brevo\Client\Models\Configuration' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'reference' => null, + 'cart' => null, + 'contactId' => 'int64', + 'description' => null, + 'notification' => null, + 'configuration' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'reference' => false, + 'cart' => false, + 'contactId' => false, + 'description' => false, + 'notification' => false, + 'configuration' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'reference' => 'reference', + 'cart' => 'cart', + 'contactId' => 'contactId', + 'description' => 'description', + 'notification' => 'notification', + 'configuration' => 'configuration' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'reference' => 'setReference', + 'cart' => 'setCart', + 'contactId' => 'setContactId', + 'description' => 'setDescription', + 'notification' => 'setNotification', + 'configuration' => 'setConfiguration' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'reference' => 'getReference', + 'cart' => 'getCart', + 'contactId' => 'getContactId', + 'description' => 'getDescription', + 'notification' => 'getNotification', + 'configuration' => 'getConfiguration' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('reference', $data ?? [], null); + $this->setIfExists('cart', $data ?? [], null); + $this->setIfExists('contactId', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('notification', $data ?? [], null); + $this->setIfExists('configuration', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['reference'] === null) { + $invalidProperties[] = "'reference' can't be null"; + } + if ($this->container['cart'] === null) { + $invalidProperties[] = "'cart' can't be null"; + } + if ($this->container['contactId'] === null) { + $invalidProperties[] = "'contactId' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets reference + * + * @return string + */ + public function getReference(): string + { + return $this->container['reference']; + } + + /** + * Sets reference + * + * @param string $reference Reference of the payment request, it will appear on the payment page. + * + * @return $this + */ + public function setReference(string $reference): static + { + if (is_null($reference)) { + throw new InvalidArgumentException('non-nullable reference cannot be null'); + } + $this->container['reference'] = $reference; + + return $this; + } + + /** + * Gets cart + * + * @return \Brevo\Client\Models\Cart + */ + public function getCart(): \Brevo\Client\Models\Cart + { + return $this->container['cart']; + } + + /** + * Sets cart + * + * @param \Brevo\Client\Models\Cart $cart cart + * + * @return $this + */ + public function setCart(\Brevo\Client\Models\Cart $cart): static + { + if (is_null($cart)) { + throw new InvalidArgumentException('non-nullable cart cannot be null'); + } + $this->container['cart'] = $cart; + + return $this; + } + + /** + * Gets contactId + * + * @return int + */ + public function getContactId(): int + { + return $this->container['contactId']; + } + + /** + * Sets contactId + * + * @param int $contactId Brevo ID of the contact requested to pay. + * + * @return $this + */ + public function setContactId(int $contactId): static + { + if (is_null($contactId)) { + throw new InvalidArgumentException('non-nullable contactId cannot be null'); + } + $this->container['contactId'] = $contactId; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description of payment request + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets notification + * + * @return \Brevo\Client\Models\Notification|null + */ + public function getNotification(): ?\Brevo\Client\Models\Notification + { + return $this->container['notification']; + } + + /** + * Sets notification + * + * @param \Brevo\Client\Models\Notification|null $notification notification + * + * @return $this + */ + public function setNotification(?\Brevo\Client\Models\Notification $notification): static + { + if (is_null($notification)) { + throw new InvalidArgumentException('non-nullable notification cannot be null'); + } + $this->container['notification'] = $notification; + + return $this; + } + + /** + * Gets configuration + * + * @return \Brevo\Client\Models\Configuration|null + */ + public function getConfiguration(): ?\Brevo\Client\Models\Configuration + { + return $this->container['configuration']; + } + + /** + * Sets configuration + * + * @param \Brevo\Client\Models\Configuration|null $configuration configuration + * + * @return $this + */ + public function setConfiguration(?\Brevo\Client\Models\Configuration $configuration): static + { + if (is_null($configuration)) { + throw new InvalidArgumentException('non-nullable configuration cannot be null'); + } + $this->container['configuration'] = $configuration; + + return $this; + } +} + + diff --git a/lib/Models/CreatePaymentResponse.php b/lib/Models/CreatePaymentResponse.php new file mode 100644 index 0000000..beb3239 --- /dev/null +++ b/lib/Models/CreatePaymentResponse.php @@ -0,0 +1,244 @@ + + */ +class CreatePaymentResponse extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createPaymentResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'int64', + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets id + * + * @return int + */ + public function getId(): int + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id ID of the object created + * + * @return $this + */ + public function setId(int $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl(): ?string + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url URL of the payment request created + * + * @return $this + */ + public function setUrl(?string $url): static + { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } +} + + diff --git a/lib/Models/CreateProductModel.php b/lib/Models/CreateProductModel.php index 6ecf601..b9a688e 100644 --- a/lib/Models/CreateProductModel.php +++ b/lib/Models/CreateProductModel.php @@ -2,118 +2,116 @@ /** * CreateProductModel * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateProductModel Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateProductModel implements ModelInterface, ArrayAccess +class CreateProductModel extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createProductModel'; + protected static string $openAPIModelName = 'createProductModel'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,75 +139,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->setIfExists('id', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * - * @return int + * @return int|null */ - public function getId() + public function getId(): ?int { return $this->container['id']; } @@ -217,89 +189,19 @@ public function getId() /** * Sets id * - * @param int $id ID of the Product when a new product is created + * @param int|null $id ID of the Product when a new product is created * * @return $this */ - public function setId($id) + public function setId(?int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateReseller.php b/lib/Models/CreateReseller.php deleted file mode 100644 index 1549e17..0000000 --- a/lib/Models/CreateReseller.php +++ /dev/null @@ -1,338 +0,0 @@ - 'string', - 'id' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'authKey' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'authKey' => 'authKey', - 'id' => 'id' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'authKey' => 'setAuthKey', - 'id' => 'setId' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'authKey' => 'getAuthKey', - '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 - */ - public function __construct(array $data = null) - { - $this->container['authKey'] = isset($data['authKey']) ? $data['authKey'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['authKey'] === null) { - $invalidProperties[] = "'authKey' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets authKey - * - * @return string - */ - public function getAuthKey() - { - return $this->container['authKey']; - } - - /** - * Sets authKey - * - * @param string $authKey AuthKey of Reseller child created - * - * @return $this - */ - public function setAuthKey($authKey) - { - $this->container['authKey'] = $authKey; - - return $this; - } - - /** - * Gets id - * - * @return int - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param int $id Id of Reseller child created - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/CreateSender.php b/lib/Models/CreateSender.php index 39b3684..3a20adf 100644 --- a/lib/Models/CreateSender.php +++ b/lib/Models/CreateSender.php @@ -2,104 +2,104 @@ /** * CreateSender * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateSender Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateSender implements ModelInterface, ArrayAccess +class CreateSender extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createSender'; + protected static string $openAPIModelName = 'createSender'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string', 'email' => 'string', - 'ips' => '\Brevo\Client\Models\CreateSenderIps[]' + 'ips' => '\Brevo\Client\Models\CreateSenderIpsInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null, 'email' => 'email', 'ips' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'email' => false, + 'ips' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name', 'email' => 'email', 'ips' => 'ips' @@ -108,9 +108,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName', 'email' => 'setEmail', 'ips' => 'setIps' @@ -119,9 +119,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName', 'email' => 'getEmail', 'ips' => 'getIps' @@ -131,9 +131,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -141,9 +141,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -151,53 +151,39 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['ips'] = isset($data['ips']) ? $data['ips'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('ips', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -210,24 +196,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -239,8 +213,11 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -251,7 +228,7 @@ public function setName($name) * * @return string */ - public function getEmail() + public function getEmail(): string { return $this->container['email']; } @@ -263,8 +240,11 @@ public function getEmail() * * @return $this */ - public function setEmail($email) + public function setEmail(string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -273,9 +253,9 @@ public function setEmail($email) /** * Gets ips * - * @return \Brevo\Client\Models\CreateSenderIps[] + * @return \Brevo\Client\Models\CreateSenderIpsInner[]|null */ - public function getIps() + public function getIps(): ?array { return $this->container['ips']; } @@ -283,89 +263,19 @@ public function getIps() /** * Sets ips * - * @param \Brevo\Client\Models\CreateSenderIps[] $ips Mandatory in case of dedicated IP, IPs to associate to the sender + * @param \Brevo\Client\Models\CreateSenderIpsInner[]|null $ips **Mandatory in case of dedicated IP**. IPs to associate to the sender * * @return $this */ - public function setIps($ips) + public function setIps(?array $ips): static { + if (is_null($ips)) { + throw new InvalidArgumentException('non-nullable ips cannot be null'); + } $this->container['ips'] = $ips; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateSenderIps.php b/lib/Models/CreateSenderIps.php deleted file mode 100644 index 78257c5..0000000 --- a/lib/Models/CreateSenderIps.php +++ /dev/null @@ -1,387 +0,0 @@ - 'string', - 'domain' => 'string', - 'weight' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'ip' => null, - 'domain' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'ip' => 'ip', - 'domain' => 'domain', - 'weight' => 'weight' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'ip' => 'setIp', - 'domain' => 'setDomain', - 'weight' => 'setWeight' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'ip' => 'getIp', - 'domain' => 'getDomain', - '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 - */ - public function __construct(array $data = null) - { - $this->container['ip'] = isset($data['ip']) ? $data['ip'] : null; - $this->container['domain'] = isset($data['domain']) ? $data['domain'] : null; - $this->container['weight'] = isset($data['weight']) ? $data['weight'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['ip'] === null) { - $invalidProperties[] = "'ip' can't be null"; - } - if ($this->container['domain'] === null) { - $invalidProperties[] = "'domain' can't be null"; - } - if (!is_null($this->container['weight']) && ($this->container['weight'] > 100)) { - $invalidProperties[] = "invalid value for 'weight', must be smaller than or equal to 100."; - } - - if (!is_null($this->container['weight']) && ($this->container['weight'] < 1)) { - $invalidProperties[] = "invalid value for 'weight', must be bigger than or equal to 1."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets ip - * - * @return string - */ - public function getIp() - { - return $this->container['ip']; - } - - /** - * Sets ip - * - * @param string $ip Dedicated IP available in your account - * - * @return $this - */ - public function setIp($ip) - { - $this->container['ip'] = $ip; - - return $this; - } - - /** - * Gets domain - * - * @return string - */ - public function getDomain() - { - return $this->container['domain']; - } - - /** - * Sets domain - * - * @param string $domain Domain of the IP - * - * @return $this - */ - public function setDomain($domain) - { - $this->container['domain'] = $domain; - - return $this; - } - - /** - * Gets weight - * - * @return int - */ - public function getWeight() - { - return $this->container['weight']; - } - - /** - * 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) - { - - if (!is_null($weight) && ($weight > 100)) { - throw new \InvalidArgumentException('invalid value for $weight when calling CreateSenderIps., must be smaller than or equal to 100.'); - } - if (!is_null($weight) && ($weight < 1)) { - throw new \InvalidArgumentException('invalid value for $weight when calling CreateSenderIps., must be bigger than or equal to 1.'); - } - - $this->container['weight'] = $weight; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/CreateSenderIpsInner.php b/lib/Models/CreateSenderIpsInner.php new file mode 100644 index 0000000..adde08b --- /dev/null +++ b/lib/Models/CreateSenderIpsInner.php @@ -0,0 +1,297 @@ + + */ +class CreateSenderIpsInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createSender_ips_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'ip' => 'string', + 'domain' => 'string', + 'weight' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'ip' => null, + 'domain' => null, + 'weight' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'ip' => false, + 'domain' => false, + 'weight' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'ip' => 'ip', + 'domain' => 'domain', + 'weight' => 'weight' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'ip' => 'setIp', + 'domain' => 'setDomain', + 'weight' => 'setWeight' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'ip' => 'getIp', + 'domain' => 'getDomain', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('ip', $data ?? [], null); + $this->setIfExists('domain', $data ?? [], null); + $this->setIfExists('weight', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['ip'] === null) { + $invalidProperties[] = "'ip' can't be null"; + } + if ($this->container['domain'] === null) { + $invalidProperties[] = "'domain' can't be null"; + } + if (!is_null($this->container['weight']) && ($this->container['weight'] > 100)) { + $invalidProperties[] = "invalid value for 'weight', must be smaller than or equal to 100."; + } + + if (!is_null($this->container['weight']) && ($this->container['weight'] < 1)) { + $invalidProperties[] = "invalid value for 'weight', must be bigger than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Gets ip + * + * @return string + */ + public function getIp(): string + { + return $this->container['ip']; + } + + /** + * Sets ip + * + * @param string $ip Dedicated IP available in your account + * + * @return $this + */ + public function setIp(string $ip): static + { + if (is_null($ip)) { + throw new InvalidArgumentException('non-nullable ip cannot be null'); + } + $this->container['ip'] = $ip; + + return $this; + } + + /** + * Gets domain + * + * @return string + */ + public function getDomain(): string + { + return $this->container['domain']; + } + + /** + * Sets domain + * + * @param string $domain Domain of the IP + * + * @return $this + */ + public function setDomain(string $domain): static + { + if (is_null($domain)) { + throw new InvalidArgumentException('non-nullable domain cannot be null'); + } + $this->container['domain'] = $domain; + + return $this; + } + + /** + * Gets weight + * + * @return int|null + */ + public function getWeight(): ?int + { + return $this->container['weight']; + } + + /** + * Sets weight + * + * @param int|null $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(?int $weight): static + { + if (is_null($weight)) { + throw new InvalidArgumentException('non-nullable weight cannot be null'); + } + + if (($weight > 100)) { + throw new InvalidArgumentException('invalid value for $weight when calling CreateSenderIpsInner., must be smaller than or equal to 100.'); + } + if (($weight < 1)) { + throw new InvalidArgumentException('invalid value for $weight when calling CreateSenderIpsInner., must be bigger than or equal to 1.'); + } + + $this->container['weight'] = $weight; + + return $this; + } +} + + diff --git a/lib/Models/CreateSenderModel.php b/lib/Models/CreateSenderModel.php index 7b51328..f6db791 100644 --- a/lib/Models/CreateSenderModel.php +++ b/lib/Models/CreateSenderModel.php @@ -2,61 +2,63 @@ /** * CreateSenderModel * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateSenderModel Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateSenderModel implements ModelInterface, ArrayAccess +class CreateSenderModel extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createSenderModel'; + protected static string $openAPIModelName = 'createSenderModel'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'spfError' => 'bool', 'dkimError' => 'bool' @@ -65,41 +67,39 @@ class CreateSenderModel implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'spfError' => null, 'dkimError' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'spfError' => false, + 'dkimError' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'spfError' => 'spfError', 'dkimError' => 'dkimError' @@ -108,9 +108,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'spfError' => 'setSpfError', 'dkimError' => 'setDkimError' @@ -119,9 +119,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'spfError' => 'getSpfError', 'dkimError' => 'getDkimError' @@ -131,9 +131,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -141,9 +141,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -151,53 +151,39 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['spfError'] = isset($data['spfError']) ? $data['spfError'] : null; - $this->container['dkimError'] = isset($data['dkimError']) ? $data['dkimError'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('spfError', $data ?? [], null); + $this->setIfExists('dkimError', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -207,24 +193,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -236,8 +210,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -246,9 +223,9 @@ public function setId($id) /** * Gets spfError * - * @return bool + * @return bool|null */ - public function getSpfError() + public function getSpfError(): ?bool { return $this->container['spfError']; } @@ -256,12 +233,15 @@ public function getSpfError() /** * Sets spfError * - * @param bool $spfError Status of SPF configuration for the sender (true = SPF not well configured, false = SPF well configured) + * @param bool|null $spfError Status of SPF configuration for the sender (true = SPF not well configured, false = SPF well configured) * * @return $this */ - public function setSpfError($spfError) + public function setSpfError(?bool $spfError): static { + if (is_null($spfError)) { + throw new InvalidArgumentException('non-nullable spfError cannot be null'); + } $this->container['spfError'] = $spfError; return $this; @@ -270,9 +250,9 @@ public function setSpfError($spfError) /** * Gets dkimError * - * @return bool + * @return bool|null */ - public function getDkimError() + public function getDkimError(): ?bool { return $this->container['dkimError']; } @@ -280,89 +260,19 @@ public function getDkimError() /** * Sets dkimError * - * @param bool $dkimError Status of DKIM configuration for the sender (true = DKIM not well configured, false = DKIM well configured) + * @param bool|null $dkimError Status of DKIM configuration for the sender (true = DKIM not well configured, false = DKIM well configured) * * @return $this */ - public function setDkimError($dkimError) + public function setDkimError(?bool $dkimError): static { + if (is_null($dkimError)) { + throw new InvalidArgumentException('non-nullable dkimError cannot be null'); + } $this->container['dkimError'] = $dkimError; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateSmsCampaign.php b/lib/Models/CreateSmsCampaign.php index e17a890..2a6c1cd 100644 --- a/lib/Models/CreateSmsCampaign.php +++ b/lib/Models/CreateSmsCampaign.php @@ -2,61 +2,63 @@ /** * CreateSmsCampaign * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateSmsCampaign Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateSmsCampaign implements ModelInterface, ArrayAccess +class CreateSmsCampaign extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createSmsCampaign'; + protected static string $openAPIModelName = 'createSmsCampaign'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string', 'sender' => 'string', 'content' => 'string', @@ -70,9 +72,9 @@ class CreateSmsCampaign implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null, 'sender' => null, 'content' => null, @@ -84,32 +86,35 @@ class CreateSmsCampaign implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'sender' => false, + 'content' => false, + 'recipients' => false, + 'scheduledAt' => false, + 'unicodeEnabled' => false, + 'organisationPrefix' => false, + 'unsubscribeInstruction' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name', 'sender' => 'sender', 'content' => 'content', @@ -123,9 +128,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName', 'sender' => 'setSender', 'content' => 'setContent', @@ -139,9 +144,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName', 'sender' => 'getSender', 'content' => 'getContent', @@ -156,9 +161,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -166,9 +171,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -176,58 +181,44 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['sender'] = isset($data['sender']) ? $data['sender'] : null; - $this->container['content'] = isset($data['content']) ? $data['content'] : null; - $this->container['recipients'] = isset($data['recipients']) ? $data['recipients'] : null; - $this->container['scheduledAt'] = isset($data['scheduledAt']) ? $data['scheduledAt'] : null; - $this->container['unicodeEnabled'] = isset($data['unicodeEnabled']) ? $data['unicodeEnabled'] : false; - $this->container['organisationPrefix'] = isset($data['organisationPrefix']) ? $data['organisationPrefix'] : null; - $this->container['unsubscribeInstruction'] = isset($data['unsubscribeInstruction']) ? $data['unsubscribeInstruction'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('recipients', $data ?? [], null); + $this->setIfExists('scheduledAt', $data ?? [], null); + $this->setIfExists('unicodeEnabled', $data ?? [], false); + $this->setIfExists('organisationPrefix', $data ?? [], null); + $this->setIfExists('unsubscribeInstruction', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -247,24 +238,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -276,8 +255,11 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -288,7 +270,7 @@ public function setName($name) * * @return string */ - public function getSender() + public function getSender(): string { return $this->container['sender']; } @@ -300,10 +282,13 @@ public function getSender() * * @return $this */ - public function setSender($sender) + public function setSender(string $sender): static { + if (is_null($sender)) { + throw new InvalidArgumentException('non-nullable sender cannot be null'); + } if ((mb_strlen($sender) > 15)) { - throw new \InvalidArgumentException('invalid length for $sender when calling CreateSmsCampaign., must be smaller than or equal to 15.'); + throw new InvalidArgumentException('invalid length for $sender when calling CreateSmsCampaign., must be smaller than or equal to 15.'); } $this->container['sender'] = $sender; @@ -316,7 +301,7 @@ public function setSender($sender) * * @return string */ - public function getContent() + public function getContent(): string { return $this->container['content']; } @@ -324,12 +309,15 @@ 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 + * @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) + public function setContent(string $content): static { + if (is_null($content)) { + throw new InvalidArgumentException('non-nullable content cannot be null'); + } $this->container['content'] = $content; return $this; @@ -338,9 +326,9 @@ public function setContent($content) /** * Gets recipients * - * @return \Brevo\Client\Models\CreateSmsCampaignRecipients + * @return \Brevo\Client\Models\CreateSmsCampaignRecipients|null */ - public function getRecipients() + public function getRecipients(): ?\Brevo\Client\Models\CreateSmsCampaignRecipients { return $this->container['recipients']; } @@ -348,12 +336,15 @@ public function getRecipients() /** * Sets recipients * - * @param \Brevo\Client\Models\CreateSmsCampaignRecipients $recipients recipients + * @param \Brevo\Client\Models\CreateSmsCampaignRecipients|null $recipients recipients * * @return $this */ - public function setRecipients($recipients) + public function setRecipients(?\Brevo\Client\Models\CreateSmsCampaignRecipients $recipients): static { + if (is_null($recipients)) { + throw new InvalidArgumentException('non-nullable recipients cannot be null'); + } $this->container['recipients'] = $recipients; return $this; @@ -362,9 +353,9 @@ public function setRecipients($recipients) /** * Gets scheduledAt * - * @return string + * @return string|null */ - public function getScheduledAt() + public function getScheduledAt(): ?string { return $this->container['scheduledAt']; } @@ -372,12 +363,15 @@ public function getScheduledAt() /** * Sets scheduledAt * - * @param string $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. + * @param string|null $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) + public function setScheduledAt(?string $scheduledAt): static { + if (is_null($scheduledAt)) { + throw new InvalidArgumentException('non-nullable scheduledAt cannot be null'); + } $this->container['scheduledAt'] = $scheduledAt; return $this; @@ -386,9 +380,9 @@ public function setScheduledAt($scheduledAt) /** * Gets unicodeEnabled * - * @return bool + * @return bool|null */ - public function getUnicodeEnabled() + public function getUnicodeEnabled(): ?bool { return $this->container['unicodeEnabled']; } @@ -396,12 +390,15 @@ public function getUnicodeEnabled() /** * Sets unicodeEnabled * - * @param bool $unicodeEnabled Format of the message. It indicates whether the content should be treated as unicode or not. + * @param bool|null $unicodeEnabled Format of the message. It indicates whether the content should be treated as unicode or not. * * @return $this */ - public function setUnicodeEnabled($unicodeEnabled) + public function setUnicodeEnabled(?bool $unicodeEnabled): static { + if (is_null($unicodeEnabled)) { + throw new InvalidArgumentException('non-nullable unicodeEnabled cannot be null'); + } $this->container['unicodeEnabled'] = $unicodeEnabled; return $this; @@ -410,9 +407,9 @@ public function setUnicodeEnabled($unicodeEnabled) /** * Gets organisationPrefix * - * @return string + * @return string|null */ - public function getOrganisationPrefix() + public function getOrganisationPrefix(): ?string { return $this->container['organisationPrefix']; } @@ -420,12 +417,15 @@ public function getOrganisationPrefix() /** * Sets organisationPrefix * - * @param string $organisationPrefix A recognizable prefix will ensure your audience knows who you are. Recommended by U.S. carriers. This will be added as your Brand Name before the message content. **Prefer verifying maximum length of 160 characters including this prefix in message content to avoid multiple sending of same sms.** + * @param string|null $organisationPrefix A recognizable prefix will ensure your audience knows who you are. Recommended by U.S. carriers. This will be added as your Brand Name before the message content. **Prefer verifying maximum length of 160 characters including this prefix in message content to avoid multiple sending of same sms.** * * @return $this */ - public function setOrganisationPrefix($organisationPrefix) + public function setOrganisationPrefix(?string $organisationPrefix): static { + if (is_null($organisationPrefix)) { + throw new InvalidArgumentException('non-nullable organisationPrefix cannot be null'); + } $this->container['organisationPrefix'] = $organisationPrefix; return $this; @@ -434,9 +434,9 @@ public function setOrganisationPrefix($organisationPrefix) /** * Gets unsubscribeInstruction * - * @return string + * @return string|null */ - public function getUnsubscribeInstruction() + public function getUnsubscribeInstruction(): ?string { return $this->container['unsubscribeInstruction']; } @@ -444,89 +444,19 @@ public function getUnsubscribeInstruction() /** * Sets unsubscribeInstruction * - * @param string $unsubscribeInstruction Instructions to unsubscribe from future communications. Recommended by U.S. carriers. Must include **STOP** keyword. This will be added as instructions after the end of message content. **Prefer verifying maximum length of 160 characters including this instructions in message content to avoid multiple sending of same sms.** + * @param string|null $unsubscribeInstruction Instructions to unsubscribe from future communications. Recommended by U.S. carriers. Must include **STOP** keyword. This will be added as instructions after the end of message content. **Prefer verifying maximum length of 160 characters including this instructions in message content to avoid multiple sending of same sms.** * * @return $this */ - public function setUnsubscribeInstruction($unsubscribeInstruction) + public function setUnsubscribeInstruction(?string $unsubscribeInstruction): static { + if (is_null($unsubscribeInstruction)) { + throw new InvalidArgumentException('non-nullable unsubscribeInstruction cannot be null'); + } $this->container['unsubscribeInstruction'] = $unsubscribeInstruction; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateSmsCampaignRecipients.php b/lib/Models/CreateSmsCampaignRecipients.php index f4a8cd3..8fb926a 100644 --- a/lib/Models/CreateSmsCampaignRecipients.php +++ b/lib/Models/CreateSmsCampaignRecipients.php @@ -2,61 +2,63 @@ /** * CreateSmsCampaignRecipients * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateSmsCampaignRecipients Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateSmsCampaignRecipients implements ModelInterface, ArrayAccess +class CreateSmsCampaignRecipients extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createSmsCampaign_recipients'; + protected static string $openAPIModelName = 'createSmsCampaign_recipients'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'listIds' => 'int[]', 'exclusionListIds' => 'int[]' ]; @@ -64,40 +66,37 @@ class CreateSmsCampaignRecipients implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'listIds' => 'int64', 'exclusionListIds' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'listIds' => false, + 'exclusionListIds' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'listIds' => 'listIds', 'exclusionListIds' => 'exclusionListIds' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'listIds' => 'setListIds', 'exclusionListIds' => 'setExclusionListIds' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'listIds' => 'getListIds', 'exclusionListIds' => 'getExclusionListIds' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,52 +145,38 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['listIds'] = isset($data['listIds']) ? $data['listIds'] : null; - $this->container['exclusionListIds'] = isset($data['exclusionListIds']) ? $data['exclusionListIds'] : null; + $this->setIfExists('listIds', $data ?? [], null); + $this->setIfExists('exclusionListIds', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -201,24 +186,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets listIds * * @return int[] */ - public function getListIds() + public function getListIds(): array { return $this->container['listIds']; } @@ -226,12 +199,15 @@ public function getListIds() /** * Sets listIds * - * @param int[] $listIds Lists Ids to send the campaign to. REQUIRED if scheduledAt is not empty + * @param int[] $listIds Lists Ids to send the campaign to. **REQUIRED if scheduledAt is not empty** * * @return $this */ - public function setListIds($listIds) + public function setListIds(array $listIds): static { + if (is_null($listIds)) { + throw new InvalidArgumentException('non-nullable listIds cannot be null'); + } $this->container['listIds'] = $listIds; return $this; @@ -240,9 +216,9 @@ public function setListIds($listIds) /** * Gets exclusionListIds * - * @return int[] + * @return int[]|null */ - public function getExclusionListIds() + public function getExclusionListIds(): ?array { return $this->container['exclusionListIds']; } @@ -250,89 +226,19 @@ public function getExclusionListIds() /** * Sets exclusionListIds * - * @param int[] $exclusionListIds List ids which have to be excluded from a campaign + * @param int[]|null $exclusionListIds List ids which have to be excluded from a campaign * * @return $this */ - public function setExclusionListIds($exclusionListIds) + public function setExclusionListIds(?array $exclusionListIds): static { + if (is_null($exclusionListIds)) { + throw new InvalidArgumentException('non-nullable exclusionListIds cannot be null'); + } $this->container['exclusionListIds'] = $exclusionListIds; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateSmtpEmail.php b/lib/Models/CreateSmtpEmail.php index 0e8b522..3f4e543 100644 --- a/lib/Models/CreateSmtpEmail.php +++ b/lib/Models/CreateSmtpEmail.php @@ -2,61 +2,63 @@ /** * CreateSmtpEmail * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateSmtpEmail Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateSmtpEmail implements ModelInterface, ArrayAccess +class CreateSmtpEmail extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createSmtpEmail'; + protected static string $openAPIModelName = 'createSmtpEmail'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'messageId' => 'string', 'messageIds' => 'string[]' ]; @@ -64,40 +66,37 @@ class CreateSmtpEmail implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'messageId' => null, 'messageIds' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'messageId' => false, + 'messageIds' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'messageId' => 'messageId', 'messageIds' => 'messageIds' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'messageId' => 'setMessageId', 'messageIds' => 'setMessageIds' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'messageId' => 'getMessageId', 'messageIds' => 'getMessageIds' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +145,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['messageId'] = isset($data['messageId']) ? $data['messageId'] : null; - $this->container['messageIds'] = isset($data['messageIds']) ? $data['messageIds'] : null; + $this->setIfExists('messageId', $data ?? [], null); + $this->setIfExists('messageIds', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets messageId * - * @return string + * @return string|null */ - public function getMessageId() + public function getMessageId(): ?string { return $this->container['messageId']; } @@ -223,12 +196,15 @@ public function getMessageId() /** * Sets messageId * - * @param string $messageId Message ID of the transactional email sent + * @param string|null $messageId Message ID of the transactional email sent * * @return $this */ - public function setMessageId($messageId) + public function setMessageId(?string $messageId): static { + if (is_null($messageId)) { + throw new InvalidArgumentException('non-nullable messageId cannot be null'); + } $this->container['messageId'] = $messageId; return $this; @@ -237,9 +213,9 @@ public function setMessageId($messageId) /** * Gets messageIds * - * @return string[] + * @return string[]|null */ - public function getMessageIds() + public function getMessageIds(): ?array { return $this->container['messageIds']; } @@ -247,89 +223,19 @@ public function getMessageIds() /** * Sets messageIds * - * @param string[] $messageIds messageIds + * @param string[]|null $messageIds messageIds * * @return $this */ - public function setMessageIds($messageIds) + public function setMessageIds(?array $messageIds): static { + if (is_null($messageIds)) { + throw new InvalidArgumentException('non-nullable messageIds cannot be null'); + } $this->container['messageIds'] = $messageIds; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateSmtpTemplate.php b/lib/Models/CreateSmtpTemplate.php index 0b4a736..9bf733b 100644 --- a/lib/Models/CreateSmtpTemplate.php +++ b/lib/Models/CreateSmtpTemplate.php @@ -2,67 +2,69 @@ /** * CreateSmtpTemplate * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateSmtpTemplate Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateSmtpTemplate implements ModelInterface, ArrayAccess +class CreateSmtpTemplate extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createSmtpTemplate'; + protected static string $openAPIModelName = 'createSmtpTemplate'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'tag' => 'string', + protected static array $openAPITypes = [ 'sender' => '\Brevo\Client\Models\CreateSmtpTemplateSender', 'templateName' => 'string', + 'subject' => 'string', + 'tag' => 'string', 'htmlContent' => 'string', 'htmlUrl' => 'string', - 'subject' => 'string', 'replyTo' => 'string', 'toField' => 'string', 'attachmentUrl' => 'string', @@ -72,15 +74,15 @@ class CreateSmtpTemplate implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'tag' => null, + protected static array $openAPIFormats = [ 'sender' => null, 'templateName' => null, + 'subject' => null, + 'tag' => null, 'htmlContent' => null, 'htmlUrl' => 'url', - 'subject' => null, 'replyTo' => 'email', 'toField' => null, 'attachmentUrl' => 'url', @@ -88,38 +90,43 @@ class CreateSmtpTemplate implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'sender' => false, + 'templateName' => false, + 'subject' => false, + 'tag' => false, + 'htmlContent' => false, + 'htmlUrl' => false, + 'replyTo' => false, + 'toField' => false, + 'attachmentUrl' => false, + 'isActive' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ - 'tag' => 'tag', + protected static array $attributeMap = [ 'sender' => 'sender', 'templateName' => 'templateName', + 'subject' => 'subject', + 'tag' => 'tag', 'htmlContent' => 'htmlContent', 'htmlUrl' => 'htmlUrl', - 'subject' => 'subject', 'replyTo' => 'replyTo', 'toField' => 'toField', 'attachmentUrl' => 'attachmentUrl', @@ -129,15 +136,15 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ - 'tag' => 'setTag', + protected static array $setters = [ 'sender' => 'setSender', 'templateName' => 'setTemplateName', + 'subject' => 'setSubject', + 'tag' => 'setTag', 'htmlContent' => 'setHtmlContent', 'htmlUrl' => 'setHtmlUrl', - 'subject' => 'setSubject', 'replyTo' => 'setReplyTo', 'toField' => 'setToField', 'attachmentUrl' => 'setAttachmentUrl', @@ -147,15 +154,15 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ - 'tag' => 'getTag', + protected static array $getters = [ 'sender' => 'getSender', 'templateName' => 'getTemplateName', + 'subject' => 'getSubject', + 'tag' => 'getTag', 'htmlContent' => 'getHtmlContent', 'htmlUrl' => 'getHtmlUrl', - 'subject' => 'getSubject', 'replyTo' => 'getReplyTo', 'toField' => 'getToField', 'attachmentUrl' => 'getAttachmentUrl', @@ -166,9 +173,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -176,9 +183,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -186,60 +193,46 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['tag'] = isset($data['tag']) ? $data['tag'] : null; - $this->container['sender'] = isset($data['sender']) ? $data['sender'] : null; - $this->container['templateName'] = isset($data['templateName']) ? $data['templateName'] : null; - $this->container['htmlContent'] = isset($data['htmlContent']) ? $data['htmlContent'] : null; - $this->container['htmlUrl'] = isset($data['htmlUrl']) ? $data['htmlUrl'] : null; - $this->container['subject'] = isset($data['subject']) ? $data['subject'] : null; - $this->container['replyTo'] = isset($data['replyTo']) ? $data['replyTo'] : null; - $this->container['toField'] = isset($data['toField']) ? $data['toField'] : null; - $this->container['attachmentUrl'] = isset($data['attachmentUrl']) ? $data['attachmentUrl'] : null; - $this->container['isActive'] = isset($data['isActive']) ? $data['isActive'] : null; + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('templateName', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('htmlContent', $data ?? [], null); + $this->setIfExists('htmlUrl', $data ?? [], null); + $this->setIfExists('replyTo', $data ?? [], null); + $this->setIfExists('toField', $data ?? [], null); + $this->setIfExists('attachmentUrl', $data ?? [], null); + $this->setIfExists('isActive', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -256,157 +249,163 @@ public function listInvalidProperties() } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets tag + * Gets sender * - * @return string + * @return \Brevo\Client\Models\CreateSmtpTemplateSender */ - public function getTag() + public function getSender(): \Brevo\Client\Models\CreateSmtpTemplateSender { - return $this->container['tag']; + return $this->container['sender']; } /** - * Sets tag + * Sets sender * - * @param string $tag Tag of the template + * @param \Brevo\Client\Models\CreateSmtpTemplateSender $sender sender * * @return $this */ - public function setTag($tag) + public function setSender(\Brevo\Client\Models\CreateSmtpTemplateSender $sender): static { - $this->container['tag'] = $tag; + if (is_null($sender)) { + throw new InvalidArgumentException('non-nullable sender cannot be null'); + } + $this->container['sender'] = $sender; return $this; } /** - * Gets sender + * Gets templateName * - * @return \Brevo\Client\Models\CreateSmtpTemplateSender + * @return string */ - public function getSender() + public function getTemplateName(): string { - return $this->container['sender']; + return $this->container['templateName']; } /** - * Sets sender + * Sets templateName * - * @param \Brevo\Client\Models\CreateSmtpTemplateSender $sender sender + * @param string $templateName Name of the template * * @return $this */ - public function setSender($sender) + public function setTemplateName(string $templateName): static { - $this->container['sender'] = $sender; + if (is_null($templateName)) { + throw new InvalidArgumentException('non-nullable templateName cannot be null'); + } + $this->container['templateName'] = $templateName; return $this; } /** - * Gets templateName + * Gets subject * * @return string */ - public function getTemplateName() + public function getSubject(): string { - return $this->container['templateName']; + return $this->container['subject']; } /** - * Sets templateName + * Sets subject * - * @param string $templateName Name of the template + * @param string $subject Subject of the template * * @return $this */ - public function setTemplateName($templateName) + public function setSubject(string $subject): static { - $this->container['templateName'] = $templateName; + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } + $this->container['subject'] = $subject; return $this; } /** - * Gets htmlContent + * Gets tag * - * @return string + * @return string|null */ - public function getHtmlContent() + public function getTag(): ?string { - return $this->container['htmlContent']; + return $this->container['tag']; } /** - * Sets htmlContent + * Sets tag * - * @param string $htmlContent Body of the message (HTML version). The field must have more than 10 characters. REQUIRED if htmlUrl is empty + * @param string|null $tag Tag of the template * * @return $this */ - public function setHtmlContent($htmlContent) + public function setTag(?string $tag): static { - $this->container['htmlContent'] = $htmlContent; + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } + $this->container['tag'] = $tag; return $this; } /** - * Gets htmlUrl + * Gets htmlContent * - * @return string + * @return string|null */ - public function getHtmlUrl() + public function getHtmlContent(): ?string { - return $this->container['htmlUrl']; + return $this->container['htmlContent']; } /** - * Sets htmlUrl + * Sets htmlContent * - * @param string $htmlUrl Url which contents the body of the email message. REQUIRED if htmlContent is empty + * @param string|null $htmlContent Body of the message (HTML version). The field must have more than 10 characters. **REQUIRED if htmlUrl is empty** * * @return $this */ - public function setHtmlUrl($htmlUrl) + public function setHtmlContent(?string $htmlContent): static { - $this->container['htmlUrl'] = $htmlUrl; + if (is_null($htmlContent)) { + throw new InvalidArgumentException('non-nullable htmlContent cannot be null'); + } + $this->container['htmlContent'] = $htmlContent; return $this; } /** - * Gets subject + * Gets htmlUrl * - * @return string + * @return string|null */ - public function getSubject() + public function getHtmlUrl(): ?string { - return $this->container['subject']; + return $this->container['htmlUrl']; } /** - * Sets subject + * Sets htmlUrl * - * @param string $subject Subject of the template + * @param string|null $htmlUrl Url which contents the body of the email message. REQUIRED if htmlContent is empty * * @return $this */ - public function setSubject($subject) + public function setHtmlUrl(?string $htmlUrl): static { - $this->container['subject'] = $subject; + if (is_null($htmlUrl)) { + throw new InvalidArgumentException('non-nullable htmlUrl cannot be null'); + } + $this->container['htmlUrl'] = $htmlUrl; return $this; } @@ -414,9 +413,9 @@ public function setSubject($subject) /** * Gets replyTo * - * @return string + * @return string|null */ - public function getReplyTo() + public function getReplyTo(): ?string { return $this->container['replyTo']; } @@ -424,12 +423,15 @@ public function getReplyTo() /** * Sets replyTo * - * @param string $replyTo Email on which campaign recipients will be able to reply to + * @param string|null $replyTo Email on which campaign recipients will be able to reply to * * @return $this */ - public function setReplyTo($replyTo) + public function setReplyTo(?string $replyTo): static { + if (is_null($replyTo)) { + throw new InvalidArgumentException('non-nullable replyTo cannot be null'); + } $this->container['replyTo'] = $replyTo; return $this; @@ -438,9 +440,9 @@ public function setReplyTo($replyTo) /** * Gets toField * - * @return string + * @return string|null */ - public function getToField() + public function getToField(): ?string { return $this->container['toField']; } @@ -448,12 +450,15 @@ public function getToField() /** * Sets toField * - * @param string $toField To personalize the «To» Field. If you want to include the first name and last name of your recipient, add {FNAME} {LNAME}. These contact attributes must already exist in your Brevo account. If input parameter 'params' used please use {{contact.FNAME}} {{contact.LNAME}} for personalization + * @param string|null $toField To personalize the **To** Field. If you want to include the first name and last name of your recipient, add **{FNAME} {LNAME}**. These contact attributes must already exist in your Brevo account. If input parameter **params** used please use **{{contact.FNAME}} {{contact.LNAME}}** for personalization * * @return $this */ - public function setToField($toField) + public function setToField(?string $toField): static { + if (is_null($toField)) { + throw new InvalidArgumentException('non-nullable toField cannot be null'); + } $this->container['toField'] = $toField; return $this; @@ -462,9 +467,9 @@ public function setToField($toField) /** * Gets attachmentUrl * - * @return string + * @return string|null */ - public function getAttachmentUrl() + public function getAttachmentUrl(): ?string { return $this->container['attachmentUrl']; } @@ -472,12 +477,15 @@ 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 + * @param string|null $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) + public function setAttachmentUrl(?string $attachmentUrl): static { + if (is_null($attachmentUrl)) { + throw new InvalidArgumentException('non-nullable attachmentUrl cannot be null'); + } $this->container['attachmentUrl'] = $attachmentUrl; return $this; @@ -486,9 +494,9 @@ public function setAttachmentUrl($attachmentUrl) /** * Gets isActive * - * @return bool + * @return bool|null */ - public function getIsActive() + public function getIsActive(): ?bool { return $this->container['isActive']; } @@ -496,89 +504,19 @@ public function getIsActive() /** * Sets isActive * - * @param bool $isActive Status of template. isActive = true means template is active and isActive = false means template is inactive + * @param bool|null $isActive Status of template. isActive = true means template is active and isActive = false means template is inactive * * @return $this */ - public function setIsActive($isActive) + public function setIsActive(?bool $isActive): static { + if (is_null($isActive)) { + throw new InvalidArgumentException('non-nullable isActive cannot be null'); + } $this->container['isActive'] = $isActive; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateSmtpTemplateSender.php b/lib/Models/CreateSmtpTemplateSender.php index cf66365..58e7438 100644 --- a/lib/Models/CreateSmtpTemplateSender.php +++ b/lib/Models/CreateSmtpTemplateSender.php @@ -2,62 +2,64 @@ /** * CreateSmtpTemplateSender * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateSmtpTemplateSender Class Doc Comment * - * @category Class - * @description Sender details including id or email and name (optional). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example `{\"name\":\"xyz\", \"email\":\"example@abc.com\"}` , `{\"name\":\"xyz\", \"id\":123}` + * @description Sender details including id or email and name (_optional_). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example: **{\"name\":\"xyz\", \"email\":\"example@abc.com\"}** **{\"name\":\"xyz\", \"id\":123}** * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateSmtpTemplateSender implements ModelInterface, ArrayAccess +class CreateSmtpTemplateSender extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createSmtpTemplate_sender'; + protected static string $openAPIModelName = 'createSmtpTemplate_sender'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string', 'email' => 'string', 'id' => 'int' @@ -66,41 +68,39 @@ class CreateSmtpTemplateSender implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null, 'email' => 'email', 'id' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'email' => false, + 'id' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name', 'email' => 'email', 'id' => 'id' @@ -109,9 +109,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName', 'email' => 'setEmail', 'id' => 'setId' @@ -120,9 +120,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName', 'email' => 'getEmail', 'id' => 'getId' @@ -132,9 +132,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -142,9 +142,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -152,77 +152,51 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * - * @return string + * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -230,12 +204,15 @@ public function getName() /** * Sets name * - * @param string $name Name of the sender. If not passed, will be set to default + * @param string|null $name Name of the sender. **If not passed, will be set to default** * * @return $this */ - public function setName($name) + public function setName(?string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -244,9 +221,9 @@ public function setName($name) /** * Gets email * - * @return string + * @return string|null */ - public function getEmail() + public function getEmail(): ?string { return $this->container['email']; } @@ -254,12 +231,15 @@ public function getEmail() /** * Sets email * - * @param string $email Email of the sender + * @param string|null $email Email of the sender * * @return $this */ - public function setEmail($email) + public function setEmail(?string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -268,9 +248,9 @@ public function setEmail($email) /** * Gets id * - * @return int + * @return int|null */ - public function getId() + public function getId(): ?int { return $this->container['id']; } @@ -278,89 +258,19 @@ public function getId() /** * Sets id * - * @param int $id Select the sender for the template on the basis of sender id. In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email). + * @param int|null $id Select the sender for the template on the basis of sender id. _In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email)_. * * @return $this */ - public function setId($id) + public function setId(?int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateSubAccount.php b/lib/Models/CreateSubAccount.php index 9cf79e4..39e41e1 100644 --- a/lib/Models/CreateSubAccount.php +++ b/lib/Models/CreateSubAccount.php @@ -2,143 +2,150 @@ /** * CreateSubAccount * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateSubAccount Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateSubAccount implements ModelInterface, ArrayAccess +class CreateSubAccount extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createSubAccount'; + protected static string $openAPIModelName = 'createSubAccount'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'companyName' => 'string', 'email' => 'string', 'language' => 'string', - 'timezone' => 'string' + 'timezone' => 'string', + 'groupIds' => 'string[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'companyName' => null, 'email' => null, 'language' => null, - 'timezone' => null + 'timezone' => null, + 'groupIds' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'companyName' => false, + 'email' => false, + 'language' => false, + 'timezone' => false, + 'groupIds' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'companyName' => 'companyName', 'email' => 'email', 'language' => 'language', - 'timezone' => 'timezone' + 'timezone' => 'timezone', + 'groupIds' => 'groupIds' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'companyName' => 'setCompanyName', 'email' => 'setEmail', 'language' => 'setLanguage', - 'timezone' => 'setTimezone' + 'timezone' => 'setTimezone', + 'groupIds' => 'setGroupIds' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'companyName' => 'getCompanyName', 'email' => 'getEmail', 'language' => 'getLanguage', - 'timezone' => 'getTimezone' + 'timezone' => 'getTimezone', + 'groupIds' => 'getGroupIds' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +153,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,31 +163,19 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const LANGUAGE_EN = 'en'; - const LANGUAGE_FR = 'fr'; - const LANGUAGE_IT = 'it'; - const LANGUAGE_ES = 'es'; - const LANGUAGE_PT = 'pt'; - const LANGUAGE_DE = 'de'; - - + public const LANGUAGE_EN = 'en'; + public const LANGUAGE_FR = 'fr'; + public const LANGUAGE_IT = 'it'; + public const LANGUAGE_ES = 'es'; + public const LANGUAGE_PT = 'pt'; + public const LANGUAGE_DE = 'de'; /** * Gets allowable values of the enum @@ -199,34 +194,33 @@ public function getLanguageAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['companyName'] = isset($data['companyName']) ? $data['companyName'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['language'] = isset($data['language']) ? $data['language'] : null; - $this->container['timezone'] = isset($data['timezone']) ? $data['timezone'] : null; + $this->setIfExists('companyName', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('language', $data ?? [], null); + $this->setIfExists('timezone', $data ?? [], null); + $this->setIfExists('groupIds', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -239,7 +233,8 @@ public function listInvalidProperties() $allowedValues = $this->getLanguageAllowableValues(); if (!is_null($this->container['language']) && !in_array($this->container['language'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'language', must be one of '%s'", + "invalid value '%s' for 'language', must be one of '%s'", + $this->container['language'], implode("', '", $allowedValues) ); } @@ -247,24 +242,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets companyName * * @return string */ - public function getCompanyName() + public function getCompanyName(): string { return $this->container['companyName']; } @@ -276,8 +259,11 @@ public function getCompanyName() * * @return $this */ - public function setCompanyName($companyName) + public function setCompanyName(string $companyName): static { + if (is_null($companyName)) { + throw new InvalidArgumentException('non-nullable companyName cannot be null'); + } $this->container['companyName'] = $companyName; return $this; @@ -288,7 +274,7 @@ public function setCompanyName($companyName) * * @return string */ - public function getEmail() + public function getEmail(): string { return $this->container['email']; } @@ -300,8 +286,11 @@ public function getEmail() * * @return $this */ - public function setEmail($email) + public function setEmail(string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -310,9 +299,9 @@ public function setEmail($email) /** * Gets language * - * @return string + * @return string|null */ - public function getLanguage() + public function getLanguage(): ?string { return $this->container['language']; } @@ -320,17 +309,21 @@ public function getLanguage() /** * Sets language * - * @param string $language Set the language of the sub-account + * @param string|null $language Set the language of the sub-account * * @return $this */ - public function setLanguage($language) + public function setLanguage(?string $language): static { + if (is_null($language)) { + throw new InvalidArgumentException('non-nullable language cannot be null'); + } $allowedValues = $this->getLanguageAllowableValues(); - if (!is_null($language) && !in_array($language, $allowedValues, true)) { - throw new \InvalidArgumentException( + if (!in_array($language, $allowedValues, true)) { + throw new InvalidArgumentException( sprintf( - "Invalid value for 'language', must be one of '%s'", + "Invalid value '%s' for 'language', must be one of '%s'", + $language, implode("', '", $allowedValues) ) ); @@ -343,9 +336,9 @@ public function setLanguage($language) /** * Gets timezone * - * @return string + * @return string|null */ - public function getTimezone() + public function getTimezone(): ?string { return $this->container['timezone']; } @@ -353,88 +346,45 @@ public function getTimezone() /** * Sets timezone * - * @param string $timezone Set the timezone of the sub-account + * @param string|null $timezone Set the timezone of the sub-account * * @return $this */ - public function setTimezone($timezone) + public function setTimezone(?string $timezone): static { + if (is_null($timezone)) { + throw new InvalidArgumentException('non-nullable timezone cannot be null'); + } $this->container['timezone'] = $timezone; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 + * Gets groupIds * - * @return void + * @return string[]|null */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function getGroupIds(): ?array { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } + return $this->container['groupIds']; } /** - * Unsets offset. + * Sets groupIds * - * @param integer $offset Offset + * @param string[]|null $groupIds Set the group(s) for the sub-account * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string + * @return $this */ - public function __toString() + public function setGroupIds(?array $groupIds): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($groupIds)) { + throw new InvalidArgumentException('non-nullable groupIds cannot be null'); } + $this->container['groupIds'] = $groupIds; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/CreateSubAccountResponse.php b/lib/Models/CreateSubAccountResponse.php index 00e1b43..69e2827 100644 --- a/lib/Models/CreateSubAccountResponse.php +++ b/lib/Models/CreateSubAccountResponse.php @@ -2,118 +2,116 @@ /** * CreateSubAccountResponse * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateSubAccountResponse Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateSubAccountResponse implements ModelInterface, ArrayAccess +class CreateSubAccountResponse extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createSubAccountResponse'; + protected static string $openAPIModelName = 'createSubAccountResponse'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,51 +139,37 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->setIfExists('id', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -195,24 +179,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -224,85 +196,15 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateSubscriptionMemberPayload.php b/lib/Models/CreateSubscriptionMemberPayload.php new file mode 100644 index 0000000..cd0ad26 --- /dev/null +++ b/lib/Models/CreateSubscriptionMemberPayload.php @@ -0,0 +1,278 @@ + + */ +class CreateSubscriptionMemberPayload extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createSubscriptionMemberPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'memberContactIds' => 'int[]', + 'contactId' => 'int', + 'loyaltySubscriptionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'memberContactIds' => null, + 'contactId' => null, + 'loyaltySubscriptionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'memberContactIds' => false, + 'contactId' => false, + 'loyaltySubscriptionId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'memberContactIds' => 'memberContactIds', + 'contactId' => 'contactId', + 'loyaltySubscriptionId' => 'loyaltySubscriptionId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'memberContactIds' => 'setMemberContactIds', + 'contactId' => 'setContactId', + 'loyaltySubscriptionId' => 'setLoyaltySubscriptionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'memberContactIds' => 'getMemberContactIds', + 'contactId' => 'getContactId', + 'loyaltySubscriptionId' => 'getLoyaltySubscriptionId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('memberContactIds', $data ?? [], null); + $this->setIfExists('contactId', $data ?? [], null); + $this->setIfExists('loyaltySubscriptionId', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['memberContactIds'] === null) { + $invalidProperties[] = "'memberContactIds' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets memberContactIds + * + * @return int[] + */ + public function getMemberContactIds(): array + { + return $this->container['memberContactIds']; + } + + /** + * Sets memberContactIds + * + * @param int[] $memberContactIds Member Contact Ids + * + * @return $this + */ + public function setMemberContactIds(array $memberContactIds): static + { + if (is_null($memberContactIds)) { + throw new InvalidArgumentException('non-nullable memberContactIds cannot be null'); + } + $this->container['memberContactIds'] = $memberContactIds; + + return $this; + } + + /** + * Gets contactId + * + * @return int|null + */ + public function getContactId(): ?int + { + return $this->container['contactId']; + } + + /** + * Sets contactId + * + * @param int|null $contactId One of contact id or loyalty subscription id is required + * + * @return $this + */ + public function setContactId(?int $contactId): static + { + if (is_null($contactId)) { + throw new InvalidArgumentException('non-nullable contactId cannot be null'); + } + $this->container['contactId'] = $contactId; + + return $this; + } + + /** + * Gets loyaltySubscriptionId + * + * @return string|null + */ + public function getLoyaltySubscriptionId(): ?string + { + return $this->container['loyaltySubscriptionId']; + } + + /** + * Sets loyaltySubscriptionId + * + * @param string|null $loyaltySubscriptionId Client Reference + * + * @return $this + */ + public function setLoyaltySubscriptionId(?string $loyaltySubscriptionId): static + { + if (is_null($loyaltySubscriptionId)) { + throw new InvalidArgumentException('non-nullable loyaltySubscriptionId cannot be null'); + } + $this->container['loyaltySubscriptionId'] = $loyaltySubscriptionId; + + return $this; + } +} + + diff --git a/lib/Models/CreateSubscriptionMemberResponse.php b/lib/Models/CreateSubscriptionMemberResponse.php new file mode 100644 index 0000000..0d65a06 --- /dev/null +++ b/lib/Models/CreateSubscriptionMemberResponse.php @@ -0,0 +1,343 @@ + + */ +class CreateSubscriptionMemberResponse extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createSubscriptionMemberResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'organizationId' => 'int', + 'ownerContactId' => 'int', + 'memberContactIds' => 'int[]', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'organizationId' => null, + 'ownerContactId' => null, + 'memberContactIds' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'organizationId' => false, + 'ownerContactId' => false, + 'memberContactIds' => false, + 'createdAt' => false, + 'updatedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'organizationId' => 'organizationId', + 'ownerContactId' => 'ownerContactId', + 'memberContactIds' => 'memberContactIds', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'organizationId' => 'setOrganizationId', + 'ownerContactId' => 'setOwnerContactId', + 'memberContactIds' => 'setMemberContactIds', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'organizationId' => 'getOrganizationId', + 'ownerContactId' => 'getOwnerContactId', + 'memberContactIds' => 'getMemberContactIds', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('organizationId', $data ?? [], null); + $this->setIfExists('ownerContactId', $data ?? [], null); + $this->setIfExists('memberContactIds', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets organizationId + * + * @return int|null + */ + public function getOrganizationId(): ?int + { + return $this->container['organizationId']; + } + + /** + * Sets organizationId + * + * @param int|null $organizationId Organization Id + * + * @return $this + */ + public function setOrganizationId(?int $organizationId): static + { + if (is_null($organizationId)) { + throw new InvalidArgumentException('non-nullable organizationId cannot be null'); + } + $this->container['organizationId'] = $organizationId; + + return $this; + } + + /** + * Gets ownerContactId + * + * @return int|null + */ + public function getOwnerContactId(): ?int + { + return $this->container['ownerContactId']; + } + + /** + * Sets ownerContactId + * + * @param int|null $ownerContactId Owner Contact Id + * + * @return $this + */ + public function setOwnerContactId(?int $ownerContactId): static + { + if (is_null($ownerContactId)) { + throw new InvalidArgumentException('non-nullable ownerContactId cannot be null'); + } + $this->container['ownerContactId'] = $ownerContactId; + + return $this; + } + + /** + * Gets memberContactIds + * + * @return int[]|null + */ + public function getMemberContactIds(): ?array + { + return $this->container['memberContactIds']; + } + + /** + * Sets memberContactIds + * + * @param int[]|null $memberContactIds Member Contact Ids + * + * @return $this + */ + public function setMemberContactIds(?array $memberContactIds): static + { + if (is_null($memberContactIds)) { + throw new InvalidArgumentException('non-nullable memberContactIds cannot be null'); + } + $this->container['memberContactIds'] = $memberContactIds; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Subscription creation date + * + * @return $this + */ + public function setCreatedAt(?\DateTime $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt(): ?\DateTime + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Subscription last modification date + * + * @return $this + */ + public function setUpdatedAt(?\DateTime $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } +} + + diff --git a/lib/Models/CreateSubscriptionPayload.php b/lib/Models/CreateSubscriptionPayload.php new file mode 100644 index 0000000..e5d758a --- /dev/null +++ b/lib/Models/CreateSubscriptionPayload.php @@ -0,0 +1,244 @@ + + */ +class CreateSubscriptionPayload extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createSubscriptionPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'contactId' => 'int', + 'loyaltySubscriptionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'contactId' => null, + 'loyaltySubscriptionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'contactId' => false, + 'loyaltySubscriptionId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'contactId' => 'contactId', + 'loyaltySubscriptionId' => 'loyaltySubscriptionId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'contactId' => 'setContactId', + 'loyaltySubscriptionId' => 'setLoyaltySubscriptionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'contactId' => 'getContactId', + 'loyaltySubscriptionId' => 'getLoyaltySubscriptionId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('contactId', $data ?? [], null); + $this->setIfExists('loyaltySubscriptionId', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['contactId'] === null) { + $invalidProperties[] = "'contactId' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets contactId + * + * @return int + */ + public function getContactId(): int + { + return $this->container['contactId']; + } + + /** + * Sets contactId + * + * @param int $contactId Contact ID + * + * @return $this + */ + public function setContactId(int $contactId): static + { + if (is_null($contactId)) { + throw new InvalidArgumentException('non-nullable contactId cannot be null'); + } + $this->container['contactId'] = $contactId; + + return $this; + } + + /** + * Gets loyaltySubscriptionId + * + * @return string|null + */ + public function getLoyaltySubscriptionId(): ?string + { + return $this->container['loyaltySubscriptionId']; + } + + /** + * Sets loyaltySubscriptionId + * + * @param string|null $loyaltySubscriptionId Loyalty Subscription ID + * + * @return $this + */ + public function setLoyaltySubscriptionId(?string $loyaltySubscriptionId): static + { + if (is_null($loyaltySubscriptionId)) { + throw new InvalidArgumentException('non-nullable loyaltySubscriptionId cannot be null'); + } + $this->container['loyaltySubscriptionId'] = $loyaltySubscriptionId; + + return $this; + } +} + + diff --git a/lib/Models/CreateSubscriptionResponse.php b/lib/Models/CreateSubscriptionResponse.php new file mode 100644 index 0000000..87092fe --- /dev/null +++ b/lib/Models/CreateSubscriptionResponse.php @@ -0,0 +1,411 @@ + + */ +class CreateSubscriptionResponse extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createSubscriptionResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'organizationId' => 'int', + 'loyaltyProgramId' => 'string', + 'versionId' => 'int', + 'contactId' => 'int', + 'loyaltySubscriptionId' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'organizationId' => null, + 'loyaltyProgramId' => 'uuid', + 'versionId' => null, + 'contactId' => null, + 'loyaltySubscriptionId' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'organizationId' => false, + 'loyaltyProgramId' => false, + 'versionId' => false, + 'contactId' => false, + 'loyaltySubscriptionId' => false, + 'createdAt' => false, + 'updatedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'organizationId' => 'organizationId', + 'loyaltyProgramId' => 'loyaltyProgramId', + 'versionId' => 'versionId', + 'contactId' => 'contactId', + 'loyaltySubscriptionId' => 'loyaltySubscriptionId', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'organizationId' => 'setOrganizationId', + 'loyaltyProgramId' => 'setLoyaltyProgramId', + 'versionId' => 'setVersionId', + 'contactId' => 'setContactId', + 'loyaltySubscriptionId' => 'setLoyaltySubscriptionId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'organizationId' => 'getOrganizationId', + 'loyaltyProgramId' => 'getLoyaltyProgramId', + 'versionId' => 'getVersionId', + 'contactId' => 'getContactId', + 'loyaltySubscriptionId' => 'getLoyaltySubscriptionId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('organizationId', $data ?? [], null); + $this->setIfExists('loyaltyProgramId', $data ?? [], null); + $this->setIfExists('versionId', $data ?? [], null); + $this->setIfExists('contactId', $data ?? [], null); + $this->setIfExists('loyaltySubscriptionId', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets organizationId + * + * @return int|null + */ + public function getOrganizationId(): ?int + { + return $this->container['organizationId']; + } + + /** + * Sets organizationId + * + * @param int|null $organizationId Organization ID + * + * @return $this + */ + public function setOrganizationId(?int $organizationId): static + { + if (is_null($organizationId)) { + throw new InvalidArgumentException('non-nullable organizationId cannot be null'); + } + $this->container['organizationId'] = $organizationId; + + return $this; + } + + /** + * Gets loyaltyProgramId + * + * @return string|null + */ + public function getLoyaltyProgramId(): ?string + { + return $this->container['loyaltyProgramId']; + } + + /** + * Sets loyaltyProgramId + * + * @param string|null $loyaltyProgramId Loyalty Program ID + * + * @return $this + */ + public function setLoyaltyProgramId(?string $loyaltyProgramId): static + { + if (is_null($loyaltyProgramId)) { + throw new InvalidArgumentException('non-nullable loyaltyProgramId cannot be null'); + } + $this->container['loyaltyProgramId'] = $loyaltyProgramId; + + return $this; + } + + /** + * Gets versionId + * + * @return int|null + */ + public function getVersionId(): ?int + { + return $this->container['versionId']; + } + + /** + * Sets versionId + * + * @param int|null $versionId Version ID + * + * @return $this + */ + public function setVersionId(?int $versionId): static + { + if (is_null($versionId)) { + throw new InvalidArgumentException('non-nullable versionId cannot be null'); + } + $this->container['versionId'] = $versionId; + + return $this; + } + + /** + * Gets contactId + * + * @return int|null + */ + public function getContactId(): ?int + { + return $this->container['contactId']; + } + + /** + * Sets contactId + * + * @param int|null $contactId Contact ID + * + * @return $this + */ + public function setContactId(?int $contactId): static + { + if (is_null($contactId)) { + throw new InvalidArgumentException('non-nullable contactId cannot be null'); + } + $this->container['contactId'] = $contactId; + + return $this; + } + + /** + * Gets loyaltySubscriptionId + * + * @return string|null + */ + public function getLoyaltySubscriptionId(): ?string + { + return $this->container['loyaltySubscriptionId']; + } + + /** + * Sets loyaltySubscriptionId + * + * @param string|null $loyaltySubscriptionId Loyalty Subscription ID + * + * @return $this + */ + public function setLoyaltySubscriptionId(?string $loyaltySubscriptionId): static + { + if (is_null($loyaltySubscriptionId)) { + throw new InvalidArgumentException('non-nullable loyaltySubscriptionId cannot be null'); + } + $this->container['loyaltySubscriptionId'] = $loyaltySubscriptionId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Subscription creation date + * + * @return $this + */ + public function setCreatedAt(?\DateTime $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt(): ?\DateTime + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Subscription last modification date + * + * @return $this + */ + public function setUpdatedAt(?\DateTime $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } +} + + diff --git a/lib/Models/CreateTierGroupRequest.php b/lib/Models/CreateTierGroupRequest.php new file mode 100644 index 0000000..e4383c3 --- /dev/null +++ b/lib/Models/CreateTierGroupRequest.php @@ -0,0 +1,343 @@ + + */ +class CreateTierGroupRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createTierGroupRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'upgradeStrategy' => 'string', + 'downgradeStrategy' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'upgradeStrategy' => null, + 'downgradeStrategy' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'upgradeStrategy' => false, + 'downgradeStrategy' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'upgradeStrategy' => 'upgradeStrategy', + 'downgradeStrategy' => 'downgradeStrategy' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'upgradeStrategy' => 'setUpgradeStrategy', + 'downgradeStrategy' => 'setDowngradeStrategy' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'upgradeStrategy' => 'getUpgradeStrategy', + 'downgradeStrategy' => 'getDowngradeStrategy' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const UPGRADE_STRATEGY_REAL_TIME = 'real_time'; + public const UPGRADE_STRATEGY_ANNIVERSARY = 'anniversary'; + public const DOWNGRADE_STRATEGY_REAL_TIME = 'real_time'; + public const DOWNGRADE_STRATEGY_ANNIVERSARY = 'anniversary'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getUpgradeStrategyAllowableValues() + { + return [ + self::UPGRADE_STRATEGY_REAL_TIME, + self::UPGRADE_STRATEGY_ANNIVERSARY, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDowngradeStrategyAllowableValues() + { + return [ + self::DOWNGRADE_STRATEGY_REAL_TIME, + self::DOWNGRADE_STRATEGY_ANNIVERSARY, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('upgradeStrategy', $data ?? [], 'real_time'); + $this->setIfExists('downgradeStrategy', $data ?? [], 'real_time'); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = $this->getUpgradeStrategyAllowableValues(); + if (!is_null($this->container['upgradeStrategy']) && !in_array($this->container['upgradeStrategy'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'upgradeStrategy', must be one of '%s'", + $this->container['upgradeStrategy'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDowngradeStrategyAllowableValues(); + if (!is_null($this->container['downgradeStrategy']) && !in_array($this->container['downgradeStrategy'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'downgradeStrategy', must be one of '%s'", + $this->container['downgradeStrategy'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the tier group + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets upgradeStrategy + * + * @return string|null + */ + public function getUpgradeStrategy(): ?string + { + return $this->container['upgradeStrategy']; + } + + /** + * Sets upgradeStrategy + * + * @param string|null $upgradeStrategy Select real_time to upgrade tier on real time balance updates. Select anniversary to upgrade tier on subscription anniversary. + * + * @return $this + */ + public function setUpgradeStrategy(?string $upgradeStrategy): static + { + if (is_null($upgradeStrategy)) { + throw new InvalidArgumentException('non-nullable upgradeStrategy cannot be null'); + } + $allowedValues = $this->getUpgradeStrategyAllowableValues(); + if (!in_array($upgradeStrategy, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'upgradeStrategy', must be one of '%s'", + $upgradeStrategy, + implode("', '", $allowedValues) + ) + ); + } + $this->container['upgradeStrategy'] = $upgradeStrategy; + + return $this; + } + + /** + * Gets downgradeStrategy + * + * @return string|null + */ + public function getDowngradeStrategy(): ?string + { + return $this->container['downgradeStrategy']; + } + + /** + * Sets downgradeStrategy + * + * @param string|null $downgradeStrategy Select real_time to downgrade tier on real time balance updates. Select anniversary to downgrade tier on subscription anniversary. + * + * @return $this + */ + public function setDowngradeStrategy(?string $downgradeStrategy): static + { + if (is_null($downgradeStrategy)) { + throw new InvalidArgumentException('non-nullable downgradeStrategy cannot be null'); + } + $allowedValues = $this->getDowngradeStrategyAllowableValues(); + if (!in_array($downgradeStrategy, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'downgradeStrategy', must be one of '%s'", + $downgradeStrategy, + implode("', '", $allowedValues) + ) + ); + } + $this->container['downgradeStrategy'] = $downgradeStrategy; + + return $this; + } +} + + diff --git a/lib/Models/CreateTransactionPayload.php b/lib/Models/CreateTransactionPayload.php new file mode 100644 index 0000000..5d4d640 --- /dev/null +++ b/lib/Models/CreateTransactionPayload.php @@ -0,0 +1,352 @@ + + */ +class CreateTransactionPayload extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createTransactionPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'amount' => 'float', + 'balanceDefinitionId' => 'string', + 'contactId' => 'float', + 'meta' => 'object', + 'ttl' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'amount' => null, + 'balanceDefinitionId' => 'uuid', + 'contactId' => null, + 'meta' => null, + 'ttl' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'amount' => false, + 'balanceDefinitionId' => false, + 'contactId' => false, + 'meta' => false, + 'ttl' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'amount' => 'amount', + 'balanceDefinitionId' => 'balanceDefinitionId', + 'contactId' => 'contactId', + 'meta' => 'meta', + 'ttl' => 'ttl' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'amount' => 'setAmount', + 'balanceDefinitionId' => 'setBalanceDefinitionId', + 'contactId' => 'setContactId', + 'meta' => 'setMeta', + 'ttl' => 'setTtl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'amount' => 'getAmount', + 'balanceDefinitionId' => 'getBalanceDefinitionId', + 'contactId' => 'getContactId', + 'meta' => 'getMeta', + 'ttl' => 'getTtl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('balanceDefinitionId', $data ?? [], null); + $this->setIfExists('contactId', $data ?? [], null); + $this->setIfExists('meta', $data ?? [], null); + $this->setIfExists('ttl', $data ?? [], 300); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['amount'] === null) { + $invalidProperties[] = "'amount' can't be null"; + } + if ($this->container['balanceDefinitionId'] === null) { + $invalidProperties[] = "'balanceDefinitionId' can't be null"; + } + if ($this->container['contactId'] === null) { + $invalidProperties[] = "'contactId' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets amount + * + * @return float + */ + public function getAmount(): float + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float $amount Enter positive value for credit transaction and negative value for debit transaction + * + * @return $this + */ + public function setAmount(float $amount): static + { + if (is_null($amount)) { + throw new InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets balanceDefinitionId + * + * @return string + */ + public function getBalanceDefinitionId(): string + { + return $this->container['balanceDefinitionId']; + } + + /** + * Sets balanceDefinitionId + * + * @param string $balanceDefinitionId Balance definition id for which the transaction is made + * + * @return $this + */ + public function setBalanceDefinitionId(string $balanceDefinitionId): static + { + if (is_null($balanceDefinitionId)) { + throw new InvalidArgumentException('non-nullable balanceDefinitionId cannot be null'); + } + $this->container['balanceDefinitionId'] = $balanceDefinitionId; + + return $this; + } + + /** + * Gets contactId + * + * @return float + */ + public function getContactId(): float + { + return $this->container['contactId']; + } + + /** + * Sets contactId + * + * @param float $contactId Contact id + * + * @return $this + */ + public function setContactId(float $contactId): static + { + if (is_null($contactId)) { + throw new InvalidArgumentException('non-nullable contactId cannot be null'); + } + $this->container['contactId'] = $contactId; + + return $this; + } + + /** + * Gets meta + * + * @return object|null + */ + public function getMeta(): ?object + { + return $this->container['meta']; + } + + /** + * Sets meta + * + * @param object|null $meta Additional metadata related to the transaction. + * + * @return $this + */ + public function setMeta(?object $meta): static + { + if (is_null($meta)) { + throw new InvalidArgumentException('non-nullable meta cannot be null'); + } + $this->container['meta'] = $meta; + + return $this; + } + + /** + * Gets ttl + * + * @return int|null + */ + public function getTtl(): ?int + { + return $this->container['ttl']; + } + + /** + * Sets ttl + * + * @param int|null $ttl Time to live for the transaction in seconds. This defines how long the transaction remains valid before it expires. + * + * @return $this + */ + public function setTtl(?int $ttl): static + { + if (is_null($ttl)) { + throw new InvalidArgumentException('non-nullable ttl cannot be null'); + } + $this->container['ttl'] = $ttl; + + return $this; + } +} + + diff --git a/lib/Models/CreateUpdateBatchCategory.php b/lib/Models/CreateUpdateBatchCategory.php index 0ba45b5..202f9ad 100644 --- a/lib/Models/CreateUpdateBatchCategory.php +++ b/lib/Models/CreateUpdateBatchCategory.php @@ -2,61 +2,63 @@ /** * CreateUpdateBatchCategory * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateUpdateBatchCategory Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateUpdateBatchCategory implements ModelInterface, ArrayAccess +class CreateUpdateBatchCategory extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createUpdateBatchCategory'; + protected static string $openAPIModelName = 'createUpdateBatchCategory'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'categories' => '\Brevo\Client\Models\CreateUpdateCategories[]', 'updateEnabled' => 'bool' ]; @@ -64,40 +66,37 @@ class CreateUpdateBatchCategory implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'categories' => null, 'updateEnabled' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'categories' => false, + 'updateEnabled' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'categories' => 'categories', 'updateEnabled' => 'updateEnabled' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'categories' => 'setCategories', 'updateEnabled' => 'setUpdateEnabled' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'categories' => 'getCategories', 'updateEnabled' => 'getUpdateEnabled' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,52 +145,38 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['categories'] = isset($data['categories']) ? $data['categories'] : null; - $this->container['updateEnabled'] = isset($data['updateEnabled']) ? $data['updateEnabled'] : null; + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('updateEnabled', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -201,24 +186,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets categories * * @return \Brevo\Client\Models\CreateUpdateCategories[] */ - public function getCategories() + public function getCategories(): array { return $this->container['categories']; } @@ -230,8 +203,11 @@ public function getCategories() * * @return $this */ - public function setCategories($categories) + public function setCategories(array $categories): static { + if (is_null($categories)) { + throw new InvalidArgumentException('non-nullable categories cannot be null'); + } $this->container['categories'] = $categories; return $this; @@ -240,9 +216,9 @@ public function setCategories($categories) /** * Gets updateEnabled * - * @return bool + * @return bool|null */ - public function getUpdateEnabled() + public function getUpdateEnabled(): ?bool { return $this->container['updateEnabled']; } @@ -250,89 +226,19 @@ public function getUpdateEnabled() /** * Sets updateEnabled * - * @param bool $updateEnabled Facilitate to update the existing categories in the same request (updateEnabled = true) + * @param bool|null $updateEnabled Facilitate to update the existing categories in the same request (updateEnabled = true) * * @return $this */ - public function setUpdateEnabled($updateEnabled) + public function setUpdateEnabled(?bool $updateEnabled): static { + if (is_null($updateEnabled)) { + throw new InvalidArgumentException('non-nullable updateEnabled cannot be null'); + } $this->container['updateEnabled'] = $updateEnabled; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateUpdateBatchCategoryModel.php b/lib/Models/CreateUpdateBatchCategoryModel.php index 6beaff7..fc091e7 100644 --- a/lib/Models/CreateUpdateBatchCategoryModel.php +++ b/lib/Models/CreateUpdateBatchCategoryModel.php @@ -2,61 +2,63 @@ /** * CreateUpdateBatchCategoryModel * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateUpdateBatchCategoryModel Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateUpdateBatchCategoryModel implements ModelInterface, ArrayAccess +class CreateUpdateBatchCategoryModel extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createUpdateBatchCategoryModel'; + protected static string $openAPIModelName = 'createUpdateBatchCategoryModel'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'createdCount' => 'int', 'updatedCount' => 'int' ]; @@ -64,40 +66,37 @@ class CreateUpdateBatchCategoryModel implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'createdCount' => 'int64', 'updatedCount' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'createdCount' => false, + 'updatedCount' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'createdCount' => 'createdCount', 'updatedCount' => 'updatedCount' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'createdCount' => 'setCreatedCount', 'updatedCount' => 'setUpdatedCount' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'createdCount' => 'getCreatedCount', 'updatedCount' => 'getUpdatedCount' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +145,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['createdCount'] = isset($data['createdCount']) ? $data['createdCount'] : null; - $this->container['updatedCount'] = isset($data['updatedCount']) ? $data['updatedCount'] : null; + $this->setIfExists('createdCount', $data ?? [], null); + $this->setIfExists('updatedCount', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets createdCount * - * @return int + * @return int|null */ - public function getCreatedCount() + public function getCreatedCount(): ?int { return $this->container['createdCount']; } @@ -223,12 +196,15 @@ public function getCreatedCount() /** * Sets createdCount * - * @param int $createdCount Number of the new created categories + * @param int|null $createdCount Number of the new created categories * * @return $this */ - public function setCreatedCount($createdCount) + public function setCreatedCount(?int $createdCount): static { + if (is_null($createdCount)) { + throw new InvalidArgumentException('non-nullable createdCount cannot be null'); + } $this->container['createdCount'] = $createdCount; return $this; @@ -237,9 +213,9 @@ public function setCreatedCount($createdCount) /** * Gets updatedCount * - * @return int + * @return int|null */ - public function getUpdatedCount() + public function getUpdatedCount(): ?int { return $this->container['updatedCount']; } @@ -247,89 +223,19 @@ public function getUpdatedCount() /** * Sets updatedCount * - * @param int $updatedCount Number of the existing categories updated + * @param int|null $updatedCount Number of the existing categories updated * * @return $this */ - public function setUpdatedCount($updatedCount) + public function setUpdatedCount(?int $updatedCount): static { + if (is_null($updatedCount)) { + throw new InvalidArgumentException('non-nullable updatedCount cannot be null'); + } $this->container['updatedCount'] = $updatedCount; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateUpdateBatchProducts.php b/lib/Models/CreateUpdateBatchProducts.php index 620dd9b..d3830e6 100644 --- a/lib/Models/CreateUpdateBatchProducts.php +++ b/lib/Models/CreateUpdateBatchProducts.php @@ -2,61 +2,63 @@ /** * CreateUpdateBatchProducts * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateUpdateBatchProducts Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateUpdateBatchProducts implements ModelInterface, ArrayAccess +class CreateUpdateBatchProducts extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createUpdateBatchProducts'; + protected static string $openAPIModelName = 'createUpdateBatchProducts'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'products' => '\Brevo\Client\Models\CreateUpdateProducts[]', 'updateEnabled' => 'bool' ]; @@ -64,40 +66,37 @@ class CreateUpdateBatchProducts implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'products' => null, 'updateEnabled' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'products' => false, + 'updateEnabled' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'products' => 'products', 'updateEnabled' => 'updateEnabled' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'products' => 'setProducts', 'updateEnabled' => 'setUpdateEnabled' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'products' => 'getProducts', 'updateEnabled' => 'getUpdateEnabled' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,52 +145,38 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['products'] = isset($data['products']) ? $data['products'] : null; - $this->container['updateEnabled'] = isset($data['updateEnabled']) ? $data['updateEnabled'] : null; + $this->setIfExists('products', $data ?? [], null); + $this->setIfExists('updateEnabled', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -201,24 +186,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets products * * @return \Brevo\Client\Models\CreateUpdateProducts[] */ - public function getProducts() + public function getProducts(): array { return $this->container['products']; } @@ -230,8 +203,11 @@ public function getProducts() * * @return $this */ - public function setProducts($products) + public function setProducts(array $products): static { + if (is_null($products)) { + throw new InvalidArgumentException('non-nullable products cannot be null'); + } $this->container['products'] = $products; return $this; @@ -240,9 +216,9 @@ public function setProducts($products) /** * Gets updateEnabled * - * @return bool + * @return bool|null */ - public function getUpdateEnabled() + public function getUpdateEnabled(): ?bool { return $this->container['updateEnabled']; } @@ -250,89 +226,19 @@ public function getUpdateEnabled() /** * Sets updateEnabled * - * @param bool $updateEnabled Facilitate to update the existing categories in the same request (updateEnabled = true) + * @param bool|null $updateEnabled Facilitate to update the existing categories in the same request (updateEnabled = true) * * @return $this */ - public function setUpdateEnabled($updateEnabled) + public function setUpdateEnabled(?bool $updateEnabled): static { + if (is_null($updateEnabled)) { + throw new InvalidArgumentException('non-nullable updateEnabled cannot be null'); + } $this->container['updateEnabled'] = $updateEnabled; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateUpdateBatchProductsModel.php b/lib/Models/CreateUpdateBatchProductsModel.php index 529df3e..e1aa2eb 100644 --- a/lib/Models/CreateUpdateBatchProductsModel.php +++ b/lib/Models/CreateUpdateBatchProductsModel.php @@ -2,61 +2,63 @@ /** * CreateUpdateBatchProductsModel * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateUpdateBatchProductsModel Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateUpdateBatchProductsModel implements ModelInterface, ArrayAccess +class CreateUpdateBatchProductsModel extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createUpdateBatchProductsModel'; + protected static string $openAPIModelName = 'createUpdateBatchProductsModel'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'createdCount' => 'int', 'updatedCount' => 'int' ]; @@ -64,40 +66,37 @@ class CreateUpdateBatchProductsModel implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'createdCount' => 'int64', 'updatedCount' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'createdCount' => false, + 'updatedCount' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'createdCount' => 'createdCount', 'updatedCount' => 'updatedCount' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'createdCount' => 'setCreatedCount', 'updatedCount' => 'setUpdatedCount' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'createdCount' => 'getCreatedCount', 'updatedCount' => 'getUpdatedCount' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +145,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['createdCount'] = isset($data['createdCount']) ? $data['createdCount'] : null; - $this->container['updatedCount'] = isset($data['updatedCount']) ? $data['updatedCount'] : null; + $this->setIfExists('createdCount', $data ?? [], null); + $this->setIfExists('updatedCount', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets createdCount * - * @return int + * @return int|null */ - public function getCreatedCount() + public function getCreatedCount(): ?int { return $this->container['createdCount']; } @@ -223,12 +196,15 @@ public function getCreatedCount() /** * Sets createdCount * - * @param int $createdCount Number of the new created products + * @param int|null $createdCount Number of the new created products * * @return $this */ - public function setCreatedCount($createdCount) + public function setCreatedCount(?int $createdCount): static { + if (is_null($createdCount)) { + throw new InvalidArgumentException('non-nullable createdCount cannot be null'); + } $this->container['createdCount'] = $createdCount; return $this; @@ -237,9 +213,9 @@ public function setCreatedCount($createdCount) /** * Gets updatedCount * - * @return int + * @return int|null */ - public function getUpdatedCount() + public function getUpdatedCount(): ?int { return $this->container['updatedCount']; } @@ -247,89 +223,19 @@ public function getUpdatedCount() /** * Sets updatedCount * - * @param int $updatedCount Number of the existing products updated + * @param int|null $updatedCount Number of the existing products updated * * @return $this */ - public function setUpdatedCount($updatedCount) + public function setUpdatedCount(?int $updatedCount): static { + if (is_null($updatedCount)) { + throw new InvalidArgumentException('non-nullable updatedCount cannot be null'); + } $this->container['updatedCount'] = $updatedCount; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateUpdateCategories.php b/lib/Models/CreateUpdateCategories.php index 9e989d4..f637ae8 100644 --- a/lib/Models/CreateUpdateCategories.php +++ b/lib/Models/CreateUpdateCategories.php @@ -2,143 +2,150 @@ /** * CreateUpdateCategories * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateUpdateCategories Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateUpdateCategories implements ModelInterface, ArrayAccess +class CreateUpdateCategories extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createUpdateCategories'; + protected static string $openAPIModelName = 'createUpdateCategories'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'string', 'name' => 'string', 'url' => 'string', - 'deletedAt' => 'string' + 'deletedAt' => 'string', + 'isDeleted' => 'bool' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'email', 'name' => null, 'url' => null, - 'deletedAt' => null + 'deletedAt' => null, + 'isDeleted' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'url' => false, + 'deletedAt' => false, + 'isDeleted' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name', 'url' => 'url', - 'deletedAt' => 'deletedAt' + 'deletedAt' => 'deletedAt', + 'isDeleted' => 'isDeleted' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName', 'url' => 'setUrl', - 'deletedAt' => 'setDeletedAt' + 'deletedAt' => 'setDeletedAt', + 'isDeleted' => 'setIsDeleted' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName', 'url' => 'getUrl', - 'deletedAt' => 'getDeletedAt' + 'deletedAt' => 'getDeletedAt', + 'isDeleted' => 'getIsDeleted' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +153,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,54 +163,41 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['deletedAt'] = isset($data['deletedAt']) ? $data['deletedAt'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('deletedAt', $data ?? [], null); + $this->setIfExists('isDeleted', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -213,24 +207,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return string */ - public function getId() + public function getId(): string { return $this->container['id']; } @@ -242,8 +224,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(string $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -252,9 +237,9 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -262,12 +247,15 @@ public function getName() /** * Sets name * - * @param string $name **Mandatory in case of creation**. Name of the Category, as displayed in the shop + * @param string|null $name **Mandatory in case of creation**. Name of the Category, as displayed in the shop * * @return $this */ - public function setName($name) + public function setName(?string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -276,9 +264,9 @@ public function setName($name) /** * Gets url * - * @return string + * @return string|null */ - public function getUrl() + public function getUrl(): ?string { return $this->container['url']; } @@ -286,12 +274,15 @@ public function getUrl() /** * Sets url * - * @param string $url URL to the category + * @param string|null $url URL to the category * * @return $this */ - public function setUrl($url) + public function setUrl(?string $url): static { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } $this->container['url'] = $url; return $this; @@ -300,9 +291,9 @@ public function setUrl($url) /** * Gets deletedAt * - * @return string + * @return string|null */ - public function getDeletedAt() + public function getDeletedAt(): ?string { return $this->container['deletedAt']; } @@ -310,88 +301,45 @@ public function getDeletedAt() /** * Sets deletedAt * - * @param string $deletedAt UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the category deleted from the shop's database + * @param string|null $deletedAt UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the category deleted from the shop's database * * @return $this */ - public function setDeletedAt($deletedAt) + public function setDeletedAt(?string $deletedAt): static { + if (is_null($deletedAt)) { + throw new InvalidArgumentException('non-nullable deletedAt cannot be null'); + } $this->container['deletedAt'] = $deletedAt; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } /** - * Sets value based on offset. + * Gets isDeleted * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @return bool|null */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function getIsDeleted(): ?bool { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } + return $this->container['isDeleted']; } /** - * Unsets offset. + * Sets isDeleted * - * @param integer $offset Offset + * @param bool|null $isDeleted category deleted from the shop's database * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string + * @return $this */ - public function __toString() + public function setIsDeleted(?bool $isDeleted): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($isDeleted)) { + throw new InvalidArgumentException('non-nullable isDeleted cannot be null'); } + $this->container['isDeleted'] = $isDeleted; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/CreateUpdateCategory.php b/lib/Models/CreateUpdateCategory.php index 83a0a48..ca50e6c 100644 --- a/lib/Models/CreateUpdateCategory.php +++ b/lib/Models/CreateUpdateCategory.php @@ -2,148 +2,156 @@ /** * CreateUpdateCategory * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateUpdateCategory Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateUpdateCategory implements ModelInterface, ArrayAccess +class CreateUpdateCategory extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createUpdateCategory'; + protected static string $openAPIModelName = 'createUpdateCategory'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'string', 'name' => 'string', 'url' => 'string', 'updateEnabled' => 'bool', - 'deletedAt' => 'string' + 'deletedAt' => 'string', + 'isDeleted' => 'bool' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'email', 'name' => null, 'url' => null, 'updateEnabled' => null, - 'deletedAt' => null + 'deletedAt' => null, + 'isDeleted' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'url' => false, + 'updateEnabled' => false, + 'deletedAt' => false, + 'isDeleted' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name', 'url' => 'url', 'updateEnabled' => 'updateEnabled', - 'deletedAt' => 'deletedAt' + 'deletedAt' => 'deletedAt', + 'isDeleted' => 'isDeleted' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName', 'url' => 'setUrl', 'updateEnabled' => 'setUpdateEnabled', - 'deletedAt' => 'setDeletedAt' + 'deletedAt' => 'setDeletedAt', + 'isDeleted' => 'setIsDeleted' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName', 'url' => 'getUrl', 'updateEnabled' => 'getUpdateEnabled', - 'deletedAt' => 'getDeletedAt' + 'deletedAt' => 'getDeletedAt', + 'isDeleted' => 'getIsDeleted' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -151,9 +159,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -161,55 +169,42 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['updateEnabled'] = isset($data['updateEnabled']) ? $data['updateEnabled'] : false; - $this->container['deletedAt'] = isset($data['deletedAt']) ? $data['deletedAt'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('updateEnabled', $data ?? [], false); + $this->setIfExists('deletedAt', $data ?? [], null); + $this->setIfExists('isDeleted', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -219,24 +214,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return string */ - public function getId() + public function getId(): string { return $this->container['id']; } @@ -248,8 +231,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(string $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -258,9 +244,9 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -268,12 +254,15 @@ public function getName() /** * Sets name * - * @param string $name **Mandatory in case of creation**. Name of the Category, as displayed in the shop + * @param string|null $name **Mandatory in case of creation**. Name of the Category, as displayed in the shop * * @return $this */ - public function setName($name) + public function setName(?string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -282,9 +271,9 @@ public function setName($name) /** * Gets url * - * @return string + * @return string|null */ - public function getUrl() + public function getUrl(): ?string { return $this->container['url']; } @@ -292,12 +281,15 @@ public function getUrl() /** * Sets url * - * @param string $url URL to the category + * @param string|null $url URL to the category * * @return $this */ - public function setUrl($url) + public function setUrl(?string $url): static { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } $this->container['url'] = $url; return $this; @@ -306,9 +298,9 @@ public function setUrl($url) /** * Gets updateEnabled * - * @return bool + * @return bool|null */ - public function getUpdateEnabled() + public function getUpdateEnabled(): ?bool { return $this->container['updateEnabled']; } @@ -316,12 +308,15 @@ public function getUpdateEnabled() /** * Sets updateEnabled * - * @param bool $updateEnabled Facilitate to update the existing category in the same request (updateEnabled = true) + * @param bool|null $updateEnabled Facilitate to update the existing category in the same request (updateEnabled = true) * * @return $this */ - public function setUpdateEnabled($updateEnabled) + public function setUpdateEnabled(?bool $updateEnabled): static { + if (is_null($updateEnabled)) { + throw new InvalidArgumentException('non-nullable updateEnabled cannot be null'); + } $this->container['updateEnabled'] = $updateEnabled; return $this; @@ -330,9 +325,9 @@ public function setUpdateEnabled($updateEnabled) /** * Gets deletedAt * - * @return string + * @return string|null */ - public function getDeletedAt() + public function getDeletedAt(): ?string { return $this->container['deletedAt']; } @@ -340,88 +335,45 @@ public function getDeletedAt() /** * Sets deletedAt * - * @param string $deletedAt UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the category deleted from the shop's database + * @param string|null $deletedAt UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the category deleted from the shop's database * * @return $this */ - public function setDeletedAt($deletedAt) + public function setDeletedAt(?string $deletedAt): static { + if (is_null($deletedAt)) { + throw new InvalidArgumentException('non-nullable deletedAt cannot be null'); + } $this->container['deletedAt'] = $deletedAt; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } /** - * Sets value based on offset. + * Gets isDeleted * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @return bool|null */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function getIsDeleted(): ?bool { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } + return $this->container['isDeleted']; } /** - * Unsets offset. + * Sets isDeleted * - * @param integer $offset Offset + * @param bool|null $isDeleted category deleted from the shop's database * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string + * @return $this */ - public function __toString() + public function setIsDeleted(?bool $isDeleted): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($isDeleted)) { + throw new InvalidArgumentException('non-nullable isDeleted cannot be null'); } + $this->container['isDeleted'] = $isDeleted; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/CreateUpdateContactModel.php b/lib/Models/CreateUpdateContactModel.php index 152e764..65a1cb2 100644 --- a/lib/Models/CreateUpdateContactModel.php +++ b/lib/Models/CreateUpdateContactModel.php @@ -2,118 +2,116 @@ /** * CreateUpdateContactModel * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateUpdateContactModel Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateUpdateContactModel implements ModelInterface, ArrayAccess +class CreateUpdateContactModel extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createUpdateContactModel'; + protected static string $openAPIModelName = 'createUpdateContactModel'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,75 +139,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->setIfExists('id', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * - * @return int + * @return int|null */ - public function getId() + public function getId(): ?int { return $this->container['id']; } @@ -217,89 +189,19 @@ public function getId() /** * Sets id * - * @param int $id ID of the contact when a new contact is created + * @param int|null $id ID of the contact when a new contact is created * * @return $this */ - public function setId($id) + public function setId(?int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateUpdateFolder.php b/lib/Models/CreateUpdateFolder.php index f43f852..c57c99b 100644 --- a/lib/Models/CreateUpdateFolder.php +++ b/lib/Models/CreateUpdateFolder.php @@ -2,118 +2,116 @@ /** * CreateUpdateFolder * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateUpdateFolder Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateUpdateFolder implements ModelInterface, ArrayAccess +class CreateUpdateFolder extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createUpdateFolder'; + protected static string $openAPIModelName = 'createUpdateFolder'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,75 +139,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('name', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * - * @return string + * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -217,89 +189,19 @@ public function getName() /** * Sets name * - * @param string $name Name of the folder + * @param string|null $name Name of the folder * * @return $this */ - public function setName($name) + public function setName(?string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateUpdateProduct.php b/lib/Models/CreateUpdateProduct.php index 69df187..ec8e1be 100644 --- a/lib/Models/CreateUpdateProduct.php +++ b/lib/Models/CreateUpdateProduct.php @@ -2,61 +2,63 @@ /** * CreateUpdateProduct * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateUpdateProduct Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateUpdateProduct implements ModelInterface, ArrayAccess +class CreateUpdateProduct extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createUpdateProduct'; + protected static string $openAPIModelName = 'createUpdateProduct'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'string', 'name' => 'string', 'url' => 'string', @@ -65,17 +67,18 @@ class CreateUpdateProduct implements ModelInterface, ArrayAccess 'price' => 'float', 'categories' => 'string[]', 'parentId' => 'string', - 'metaInfo' => 'map[string,string]', + 'metaInfo' => 'array', 'updateEnabled' => 'bool', - 'deletedAt' => 'string' + 'deletedAt' => 'string', + 'isDeleted' => 'bool' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'string', 'name' => 'string', 'url' => 'string', @@ -86,36 +89,44 @@ class CreateUpdateProduct implements ModelInterface, ArrayAccess 'parentId' => 'string', 'metaInfo' => null, 'updateEnabled' => null, - 'deletedAt' => null + 'deletedAt' => null, + 'isDeleted' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'url' => false, + 'imageUrl' => false, + 'sku' => false, + 'price' => false, + 'categories' => false, + 'parentId' => false, + 'metaInfo' => false, + 'updateEnabled' => false, + 'deletedAt' => false, + 'isDeleted' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name', 'url' => 'url', @@ -126,15 +137,16 @@ public static function swaggerFormats() 'parentId' => 'parentId', 'metaInfo' => 'metaInfo', 'updateEnabled' => 'updateEnabled', - 'deletedAt' => 'deletedAt' + 'deletedAt' => 'deletedAt', + 'isDeleted' => 'isDeleted' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName', 'url' => 'setUrl', @@ -145,15 +157,16 @@ public static function swaggerFormats() 'parentId' => 'setParentId', 'metaInfo' => 'setMetaInfo', 'updateEnabled' => 'setUpdateEnabled', - 'deletedAt' => 'setDeletedAt' + 'deletedAt' => 'setDeletedAt', + 'isDeleted' => 'setIsDeleted' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName', 'url' => 'getUrl', @@ -164,16 +177,17 @@ public static function swaggerFormats() 'parentId' => 'getParentId', 'metaInfo' => 'getMetaInfo', 'updateEnabled' => 'getUpdateEnabled', - 'deletedAt' => 'getDeletedAt' + 'deletedAt' => 'getDeletedAt', + 'isDeleted' => 'getIsDeleted' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -181,9 +195,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -191,61 +205,48 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['imageUrl'] = isset($data['imageUrl']) ? $data['imageUrl'] : null; - $this->container['sku'] = isset($data['sku']) ? $data['sku'] : null; - $this->container['price'] = isset($data['price']) ? $data['price'] : null; - $this->container['categories'] = isset($data['categories']) ? $data['categories'] : null; - $this->container['parentId'] = isset($data['parentId']) ? $data['parentId'] : null; - $this->container['metaInfo'] = isset($data['metaInfo']) ? $data['metaInfo'] : null; - $this->container['updateEnabled'] = isset($data['updateEnabled']) ? $data['updateEnabled'] : false; - $this->container['deletedAt'] = isset($data['deletedAt']) ? $data['deletedAt'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('sku', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('parentId', $data ?? [], null); + $this->setIfExists('metaInfo', $data ?? [], null); + $this->setIfExists('updateEnabled', $data ?? [], false); + $this->setIfExists('deletedAt', $data ?? [], null); + $this->setIfExists('isDeleted', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -258,24 +259,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return string */ - public function getId() + public function getId(): string { return $this->container['id']; } @@ -287,8 +276,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(string $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -299,7 +291,7 @@ public function setId($id) * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -311,8 +303,11 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -321,9 +316,9 @@ public function setName($name) /** * Gets url * - * @return string + * @return string|null */ - public function getUrl() + public function getUrl(): ?string { return $this->container['url']; } @@ -331,12 +326,15 @@ public function getUrl() /** * Sets url * - * @param string $url URL to the product + * @param string|null $url URL to the product * * @return $this */ - public function setUrl($url) + public function setUrl(?string $url): static { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } $this->container['url'] = $url; return $this; @@ -345,9 +343,9 @@ public function setUrl($url) /** * Gets imageUrl * - * @return string + * @return string|null */ - public function getImageUrl() + public function getImageUrl(): ?string { return $this->container['imageUrl']; } @@ -355,12 +353,15 @@ public function getImageUrl() /** * Sets imageUrl * - * @param string $imageUrl Absolute URL to the cover image of the product + * @param string|null $imageUrl Absolute URL to the cover image of the product * * @return $this */ - public function setImageUrl($imageUrl) + public function setImageUrl(?string $imageUrl): static { + if (is_null($imageUrl)) { + throw new InvalidArgumentException('non-nullable imageUrl cannot be null'); + } $this->container['imageUrl'] = $imageUrl; return $this; @@ -369,9 +370,9 @@ public function setImageUrl($imageUrl) /** * Gets sku * - * @return string + * @return string|null */ - public function getSku() + public function getSku(): ?string { return $this->container['sku']; } @@ -379,12 +380,15 @@ public function getSku() /** * Sets sku * - * @param string $sku Product identifier from the shop + * @param string|null $sku Product identifier from the shop * * @return $this */ - public function setSku($sku) + public function setSku(?string $sku): static { + if (is_null($sku)) { + throw new InvalidArgumentException('non-nullable sku cannot be null'); + } $this->container['sku'] = $sku; return $this; @@ -393,9 +397,9 @@ public function setSku($sku) /** * Gets price * - * @return float + * @return float|null */ - public function getPrice() + public function getPrice(): ?float { return $this->container['price']; } @@ -403,12 +407,15 @@ public function getPrice() /** * Sets price * - * @param float $price Price of the product + * @param float|null $price Price of the product * * @return $this */ - public function setPrice($price) + public function setPrice(?float $price): static { + if (is_null($price)) { + throw new InvalidArgumentException('non-nullable price cannot be null'); + } $this->container['price'] = $price; return $this; @@ -417,9 +424,9 @@ public function setPrice($price) /** * Gets categories * - * @return string[] + * @return string[]|null */ - public function getCategories() + public function getCategories(): ?array { return $this->container['categories']; } @@ -427,12 +434,15 @@ public function getCategories() /** * Sets categories * - * @param string[] $categories Category ID-s of the product + * @param string[]|null $categories Category ID-s of the product * * @return $this */ - public function setCategories($categories) + public function setCategories(?array $categories): static { + if (is_null($categories)) { + throw new InvalidArgumentException('non-nullable categories cannot be null'); + } $this->container['categories'] = $categories; return $this; @@ -441,9 +451,9 @@ public function setCategories($categories) /** * Gets parentId * - * @return string + * @return string|null */ - public function getParentId() + public function getParentId(): ?string { return $this->container['parentId']; } @@ -451,12 +461,15 @@ public function getParentId() /** * Sets parentId * - * @param string $parentId Parent product id of the product + * @param string|null $parentId Parent product id of the product * * @return $this */ - public function setParentId($parentId) + public function setParentId(?string $parentId): static { + if (is_null($parentId)) { + throw new InvalidArgumentException('non-nullable parentId cannot be null'); + } $this->container['parentId'] = $parentId; return $this; @@ -465,9 +478,9 @@ public function setParentId($parentId) /** * Gets metaInfo * - * @return map[string,string] + * @return array|null */ - public function getMetaInfo() + public function getMetaInfo(): ?array { return $this->container['metaInfo']; } @@ -475,12 +488,15 @@ public function getMetaInfo() /** * Sets metaInfo * - * @param map[string,string] $metaInfo Meta data of product such as description, vendor, producer, stock level. The size of cumulative metaInfo shall not exceed **1000 KB**. Maximum length of metaInfo object can be 10. + * @param array|null $metaInfo Meta data of product such as description, vendor, producer, stock level. The size of cumulative metaInfo shall not exceed **1000 KB**. Maximum length of metaInfo object can be 10. * * @return $this */ - public function setMetaInfo($metaInfo) + public function setMetaInfo(?array $metaInfo): static { + if (is_null($metaInfo)) { + throw new InvalidArgumentException('non-nullable metaInfo cannot be null'); + } $this->container['metaInfo'] = $metaInfo; return $this; @@ -489,9 +505,9 @@ public function setMetaInfo($metaInfo) /** * Gets updateEnabled * - * @return bool + * @return bool|null */ - public function getUpdateEnabled() + public function getUpdateEnabled(): ?bool { return $this->container['updateEnabled']; } @@ -499,12 +515,15 @@ public function getUpdateEnabled() /** * Sets updateEnabled * - * @param bool $updateEnabled Facilitate to update the existing category in the same request (updateEnabled = true) + * @param bool|null $updateEnabled Facilitate to update the existing category in the same request (updateEnabled = true) * * @return $this */ - public function setUpdateEnabled($updateEnabled) + public function setUpdateEnabled(?bool $updateEnabled): static { + if (is_null($updateEnabled)) { + throw new InvalidArgumentException('non-nullable updateEnabled cannot be null'); + } $this->container['updateEnabled'] = $updateEnabled; return $this; @@ -513,9 +532,9 @@ public function setUpdateEnabled($updateEnabled) /** * Gets deletedAt * - * @return string + * @return string|null */ - public function getDeletedAt() + public function getDeletedAt(): ?string { return $this->container['deletedAt']; } @@ -523,88 +542,45 @@ public function getDeletedAt() /** * Sets deletedAt * - * @param string $deletedAt UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the product deleted from the shop's database + * @param string|null $deletedAt UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the product deleted from the shop's database * * @return $this */ - public function setDeletedAt($deletedAt) + public function setDeletedAt(?string $deletedAt): static { + if (is_null($deletedAt)) { + throw new InvalidArgumentException('non-nullable deletedAt cannot be null'); + } $this->container['deletedAt'] = $deletedAt; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 + * Gets isDeleted * - * @return void + * @return bool|null */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function getIsDeleted(): ?bool { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } + return $this->container['isDeleted']; } /** - * Unsets offset. + * Sets isDeleted * - * @param integer $offset Offset + * @param bool|null $isDeleted product deleted from the shop's database * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string + * @return $this */ - public function __toString() + public function setIsDeleted(?bool $isDeleted): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($isDeleted)) { + throw new InvalidArgumentException('non-nullable isDeleted cannot be null'); } + $this->container['isDeleted'] = $isDeleted; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/CreateUpdateProducts.php b/lib/Models/CreateUpdateProducts.php index 4198bf7..b69076d 100644 --- a/lib/Models/CreateUpdateProducts.php +++ b/lib/Models/CreateUpdateProducts.php @@ -2,61 +2,63 @@ /** * CreateUpdateProducts * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateUpdateProducts Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateUpdateProducts implements ModelInterface, ArrayAccess +class CreateUpdateProducts extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createUpdateProducts'; + protected static string $openAPIModelName = 'createUpdateProducts'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'string', 'name' => 'string', 'url' => 'string', @@ -65,16 +67,17 @@ class CreateUpdateProducts implements ModelInterface, ArrayAccess 'price' => 'float', 'categories' => 'string[]', 'parentId' => 'string', - 'metaInfo' => 'map[string,string]', - 'deletedAt' => 'string' + 'metaInfo' => 'array', + 'deletedAt' => 'string', + 'isDeleted' => 'bool' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'string', 'name' => 'string', 'url' => 'string', @@ -84,36 +87,43 @@ class CreateUpdateProducts implements ModelInterface, ArrayAccess 'categories' => null, 'parentId' => 'string', 'metaInfo' => null, - 'deletedAt' => null + 'deletedAt' => null, + 'isDeleted' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'url' => false, + 'imageUrl' => false, + 'sku' => false, + 'price' => false, + 'categories' => false, + 'parentId' => false, + 'metaInfo' => false, + 'deletedAt' => false, + 'isDeleted' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name', 'url' => 'url', @@ -123,15 +133,16 @@ public static function swaggerFormats() 'categories' => 'categories', 'parentId' => 'parentId', 'metaInfo' => 'metaInfo', - 'deletedAt' => 'deletedAt' + 'deletedAt' => 'deletedAt', + 'isDeleted' => 'isDeleted' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName', 'url' => 'setUrl', @@ -141,15 +152,16 @@ public static function swaggerFormats() 'categories' => 'setCategories', 'parentId' => 'setParentId', 'metaInfo' => 'setMetaInfo', - 'deletedAt' => 'setDeletedAt' + 'deletedAt' => 'setDeletedAt', + 'isDeleted' => 'setIsDeleted' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName', 'url' => 'getUrl', @@ -159,16 +171,17 @@ public static function swaggerFormats() 'categories' => 'getCategories', 'parentId' => 'getParentId', 'metaInfo' => 'getMetaInfo', - 'deletedAt' => 'getDeletedAt' + 'deletedAt' => 'getDeletedAt', + 'isDeleted' => 'getIsDeleted' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -176,9 +189,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -186,60 +199,47 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['imageUrl'] = isset($data['imageUrl']) ? $data['imageUrl'] : null; - $this->container['sku'] = isset($data['sku']) ? $data['sku'] : null; - $this->container['price'] = isset($data['price']) ? $data['price'] : null; - $this->container['categories'] = isset($data['categories']) ? $data['categories'] : null; - $this->container['parentId'] = isset($data['parentId']) ? $data['parentId'] : null; - $this->container['metaInfo'] = isset($data['metaInfo']) ? $data['metaInfo'] : null; - $this->container['deletedAt'] = isset($data['deletedAt']) ? $data['deletedAt'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('sku', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('parentId', $data ?? [], null); + $this->setIfExists('metaInfo', $data ?? [], null); + $this->setIfExists('deletedAt', $data ?? [], null); + $this->setIfExists('isDeleted', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -252,24 +252,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return string */ - public function getId() + public function getId(): string { return $this->container['id']; } @@ -281,8 +269,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(string $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -293,7 +284,7 @@ public function setId($id) * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -305,8 +296,11 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -315,9 +309,9 @@ public function setName($name) /** * Gets url * - * @return string + * @return string|null */ - public function getUrl() + public function getUrl(): ?string { return $this->container['url']; } @@ -325,12 +319,15 @@ public function getUrl() /** * Sets url * - * @param string $url URL to the product + * @param string|null $url URL to the product * * @return $this */ - public function setUrl($url) + public function setUrl(?string $url): static { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } $this->container['url'] = $url; return $this; @@ -339,9 +336,9 @@ public function setUrl($url) /** * Gets imageUrl * - * @return string + * @return string|null */ - public function getImageUrl() + public function getImageUrl(): ?string { return $this->container['imageUrl']; } @@ -349,12 +346,15 @@ public function getImageUrl() /** * Sets imageUrl * - * @param string $imageUrl Absolute URL to the cover image of the product + * @param string|null $imageUrl Absolute URL to the cover image of the product * * @return $this */ - public function setImageUrl($imageUrl) + public function setImageUrl(?string $imageUrl): static { + if (is_null($imageUrl)) { + throw new InvalidArgumentException('non-nullable imageUrl cannot be null'); + } $this->container['imageUrl'] = $imageUrl; return $this; @@ -363,9 +363,9 @@ public function setImageUrl($imageUrl) /** * Gets sku * - * @return string + * @return string|null */ - public function getSku() + public function getSku(): ?string { return $this->container['sku']; } @@ -373,12 +373,15 @@ public function getSku() /** * Sets sku * - * @param string $sku Product identifier from the shop + * @param string|null $sku Product identifier from the shop * * @return $this */ - public function setSku($sku) + public function setSku(?string $sku): static { + if (is_null($sku)) { + throw new InvalidArgumentException('non-nullable sku cannot be null'); + } $this->container['sku'] = $sku; return $this; @@ -387,9 +390,9 @@ public function setSku($sku) /** * Gets price * - * @return float + * @return float|null */ - public function getPrice() + public function getPrice(): ?float { return $this->container['price']; } @@ -397,12 +400,15 @@ public function getPrice() /** * Sets price * - * @param float $price Price of the product + * @param float|null $price Price of the product * * @return $this */ - public function setPrice($price) + public function setPrice(?float $price): static { + if (is_null($price)) { + throw new InvalidArgumentException('non-nullable price cannot be null'); + } $this->container['price'] = $price; return $this; @@ -411,9 +417,9 @@ public function setPrice($price) /** * Gets categories * - * @return string[] + * @return string[]|null */ - public function getCategories() + public function getCategories(): ?array { return $this->container['categories']; } @@ -421,12 +427,15 @@ public function getCategories() /** * Sets categories * - * @param string[] $categories Category ID-s of the product + * @param string[]|null $categories Category ID-s of the product * * @return $this */ - public function setCategories($categories) + public function setCategories(?array $categories): static { + if (is_null($categories)) { + throw new InvalidArgumentException('non-nullable categories cannot be null'); + } $this->container['categories'] = $categories; return $this; @@ -435,9 +444,9 @@ public function setCategories($categories) /** * Gets parentId * - * @return string + * @return string|null */ - public function getParentId() + public function getParentId(): ?string { return $this->container['parentId']; } @@ -445,12 +454,15 @@ public function getParentId() /** * Sets parentId * - * @param string $parentId Parent product id of the product + * @param string|null $parentId Parent product id of the product * * @return $this */ - public function setParentId($parentId) + public function setParentId(?string $parentId): static { + if (is_null($parentId)) { + throw new InvalidArgumentException('non-nullable parentId cannot be null'); + } $this->container['parentId'] = $parentId; return $this; @@ -459,9 +471,9 @@ public function setParentId($parentId) /** * Gets metaInfo * - * @return map[string,string] + * @return array|null */ - public function getMetaInfo() + public function getMetaInfo(): ?array { return $this->container['metaInfo']; } @@ -469,12 +481,15 @@ public function getMetaInfo() /** * Sets metaInfo * - * @param map[string,string] $metaInfo Meta data of product such as description, vendor, producer, stock level. The size of cumulative metaInfo shall not exceed **1000 KB**. Maximum length of metaInfo object can be 10. + * @param array|null $metaInfo Meta data of product such as description, vendor, producer, stock level. The size of cumulative metaInfo shall not exceed **1000 KB**. Maximum length of metaInfo object can be 10. * * @return $this */ - public function setMetaInfo($metaInfo) + public function setMetaInfo(?array $metaInfo): static { + if (is_null($metaInfo)) { + throw new InvalidArgumentException('non-nullable metaInfo cannot be null'); + } $this->container['metaInfo'] = $metaInfo; return $this; @@ -483,9 +498,9 @@ public function setMetaInfo($metaInfo) /** * Gets deletedAt * - * @return string + * @return string|null */ - public function getDeletedAt() + public function getDeletedAt(): ?string { return $this->container['deletedAt']; } @@ -493,88 +508,45 @@ public function getDeletedAt() /** * Sets deletedAt * - * @param string $deletedAt UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the product deleted from the shop's database + * @param string|null $deletedAt UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the product deleted from the shop's database * * @return $this */ - public function setDeletedAt($deletedAt) + public function setDeletedAt(?string $deletedAt): static { + if (is_null($deletedAt)) { + throw new InvalidArgumentException('non-nullable deletedAt cannot be null'); + } $this->container['deletedAt'] = $deletedAt; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 + * Gets isDeleted * - * @return void + * @return bool|null */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function getIsDeleted(): ?bool { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } + return $this->container['isDeleted']; } /** - * Unsets offset. + * Sets isDeleted * - * @param integer $offset Offset + * @param bool|null $isDeleted product deleted from the shop's database * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string + * @return $this */ - public function __toString() + public function setIsDeleted(?bool $isDeleted): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($isDeleted)) { + throw new InvalidArgumentException('non-nullable isDeleted cannot be null'); } + $this->container['isDeleted'] = $isDeleted; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/CreateWebhook.php b/lib/Models/CreateWebhook.php index d9c637b..93f2deb 100644 --- a/lib/Models/CreateWebhook.php +++ b/lib/Models/CreateWebhook.php @@ -2,80 +2,82 @@ /** * CreateWebhook * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateWebhook Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateWebhook implements ModelInterface, ArrayAccess +class CreateWebhook extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createWebhook'; + protected static string $openAPIModelName = 'createWebhook'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'url' => 'string', - 'description' => 'string', 'events' => 'string[]', + 'description' => 'string', 'type' => 'string', 'domain' => 'string', 'batched' => 'bool', - 'auth' => '\Brevo\Client\Models\GetWebhookAuth', - 'headers' => '\Brevo\Client\Models\GetWebhookHeaders[]' + 'auth' => 'object', + 'headers' => 'object[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'url' => 'url', - 'description' => null, 'events' => null, + 'description' => null, 'type' => null, 'domain' => null, 'batched' => null, @@ -84,35 +86,38 @@ class CreateWebhook implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'url' => false, + 'events' => false, + 'description' => false, + 'type' => false, + 'domain' => false, + 'batched' => false, + 'auth' => false, + 'headers' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'url' => 'url', - 'description' => 'description', 'events' => 'events', + 'description' => 'description', 'type' => 'type', 'domain' => 'domain', 'batched' => 'batched', @@ -123,12 +128,12 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'url' => 'setUrl', - 'description' => 'setDescription', 'events' => 'setEvents', + 'description' => 'setDescription', 'type' => 'setType', 'domain' => 'setDomain', 'batched' => 'setBatched', @@ -139,12 +144,12 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'url' => 'getUrl', - 'description' => 'getDescription', 'events' => 'getEvents', + 'description' => 'getDescription', 'type' => 'getType', 'domain' => 'getDomain', 'batched' => 'getBatched', @@ -156,9 +161,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -166,9 +171,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -176,45 +181,33 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const EVENTS_SENT = 'sent'; - const EVENTS_HARD_BOUNCE = 'hardBounce'; - const EVENTS_SOFT_BOUNCE = 'softBounce'; - const EVENTS_BLOCKED = 'blocked'; - const EVENTS_SPAM = 'spam'; - const EVENTS_DELIVERED = 'delivered'; - const EVENTS_REQUEST = 'request'; - const EVENTS_CLICK = 'click'; - const EVENTS_INVALID = 'invalid'; - const EVENTS_DEFERRED = 'deferred'; - const EVENTS_OPENED = 'opened'; - const EVENTS_UNIQUE_OPENED = 'uniqueOpened'; - const EVENTS_UNSUBSCRIBED = 'unsubscribed'; - const EVENTS_LIST_ADDITION = 'listAddition'; - const EVENTS_CONTACT_UPDATED = 'contactUpdated'; - const EVENTS_CONTACT_DELETED = 'contactDeleted'; - const EVENTS_INBOUND_EMAIL_PROCESSED = 'inboundEmailProcessed'; - const TYPE_TRANSACTIONAL = 'transactional'; - const TYPE_MARKETING = 'marketing'; - const TYPE_INBOUND = 'inbound'; - - + public const EVENTS_SENT = 'sent'; + public const EVENTS_HARD_BOUNCE = 'hardBounce'; + public const EVENTS_SOFT_BOUNCE = 'softBounce'; + public const EVENTS_BLOCKED = 'blocked'; + public const EVENTS_SPAM = 'spam'; + public const EVENTS_DELIVERED = 'delivered'; + public const EVENTS_REQUEST = 'request'; + public const EVENTS_CLICK = 'click'; + public const EVENTS_INVALID = 'invalid'; + public const EVENTS_DEFERRED = 'deferred'; + public const EVENTS_OPENED = 'opened'; + public const EVENTS_UNIQUE_OPENED = 'uniqueOpened'; + public const EVENTS_UNSUBSCRIBED = 'unsubscribed'; + public const EVENTS_LIST_ADDITION = 'listAddition'; + public const EVENTS_CONTACT_UPDATED = 'contactUpdated'; + public const EVENTS_CONTACT_DELETED = 'contactDeleted'; + public const EVENTS_INBOUND_EMAIL_PROCESSED = 'inboundEmailProcessed'; + public const TYPE_TRANSACTIONAL = 'transactional'; + public const TYPE_MARKETING = 'marketing'; + public const TYPE_INBOUND = 'inbound'; /** * Gets allowable values of the enum @@ -258,38 +251,36 @@ public function getTypeAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - $this->container['events'] = isset($data['events']) ? $data['events'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : 'transactional'; - $this->container['domain'] = isset($data['domain']) ? $data['domain'] : null; - $this->container['batched'] = isset($data['batched']) ? $data['batched'] : null; - $this->container['auth'] = isset($data['auth']) ? $data['auth'] : null; - $this->container['headers'] = isset($data['headers']) ? $data['headers'] : null; + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('events', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('type', $data ?? [], 'transactional'); + $this->setIfExists('domain', $data ?? [], null); + $this->setIfExists('batched', $data ?? [], null); + $this->setIfExists('auth', $data ?? [], null); + $this->setIfExists('headers', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -302,7 +293,8 @@ public function listInvalidProperties() $allowedValues = $this->getTypeAllowableValues(); if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], implode("', '", $allowedValues) ); } @@ -310,24 +302,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets url * * @return string */ - public function getUrl() + public function getUrl(): string { return $this->container['url']; } @@ -339,66 +319,75 @@ public function getUrl() * * @return $this */ - public function setUrl($url) + public function setUrl(string $url): static { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } $this->container['url'] = $url; return $this; } /** - * Gets description + * Gets events * - * @return string + * @return string[] */ - public function getDescription() + public function getEvents(): array { - return $this->container['description']; + return $this->container['events']; } /** - * Sets description + * Sets events * - * @param string $description Description of the webhook + * @param string[] $events - Events triggering the webhook. Possible values for **Transactional** type webhook: #### `sent` OR `request`, `delivered`, `hardBounce`, `softBounce`, `blocked`, `spam`, `invalid`, `deferred`, `click`, `opened`, `uniqueOpened` and `unsubscribed` - Possible values for **Marketing** type webhook: #### `spam`, `opened`, `click`, `hardBounce`, `softBounce`, `unsubscribed`, `listAddition` & `delivered` - Possible values for **Inbound** type webhook: #### `inboundEmailProcessed` * * @return $this */ - public function setDescription($description) + public function setEvents(array $events): static { - $this->container['description'] = $description; + if (is_null($events)) { + throw new InvalidArgumentException('non-nullable events cannot be null'); + } + $allowedValues = $this->getEventsAllowableValues(); + if (array_diff($events, $allowedValues)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value for 'events', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['events'] = $events; return $this; } /** - * Gets events + * Gets description * - * @return string[] + * @return string|null */ - public function getEvents() + public function getDescription(): ?string { - return $this->container['events']; + return $this->container['description']; } /** - * Sets events + * Sets description * - * @param string[] $events - Events triggering the webhook. Possible values for **Transactional** type webhook: #### `sent` OR `request`, `delivered`, `hardBounce`, `softBounce`, `blocked`, `spam`, `invalid`, `deferred`, `click`, `opened`, `uniqueOpened` and `unsubscribed` - Possible values for **Marketing** type webhook: #### `spam`, `opened`, `click`, `hardBounce`, `softBounce`, `unsubscribed`, `listAddition` & `delivered` - Possible values for **Inbound** type webhook: #### `inboundEmailProcessed` + * @param string|null $description Description of the webhook * * @return $this */ - public function setEvents($events) + public function setDescription(?string $description): static { - $allowedValues = $this->getEventsAllowableValues(); - if (array_diff($events, $allowedValues)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'events', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); } - $this->container['events'] = $events; + $this->container['description'] = $description; return $this; } @@ -406,9 +395,9 @@ public function setEvents($events) /** * Gets type * - * @return string + * @return string|null */ - public function getType() + public function getType(): ?string { return $this->container['type']; } @@ -416,17 +405,21 @@ public function getType() /** * Sets type * - * @param string $type Type of the webhook + * @param string|null $type Type of the webhook * * @return $this */ - public function setType($type) + public function setType(?string $type): static { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($type) && !in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( sprintf( - "Invalid value for 'type', must be one of '%s'", + "Invalid value '%s' for 'type', must be one of '%s'", + $type, implode("', '", $allowedValues) ) ); @@ -439,9 +432,9 @@ public function setType($type) /** * Gets domain * - * @return string + * @return string|null */ - public function getDomain() + public function getDomain(): ?string { return $this->container['domain']; } @@ -449,12 +442,15 @@ public function getDomain() /** * Sets domain * - * @param string $domain Inbound domain of webhook, required in case of event type `inbound` + * @param string|null $domain Inbound domain of webhook, required in case of event type `inbound` * * @return $this */ - public function setDomain($domain) + public function setDomain(?string $domain): static { + if (is_null($domain)) { + throw new InvalidArgumentException('non-nullable domain cannot be null'); + } $this->container['domain'] = $domain; return $this; @@ -463,9 +459,9 @@ public function setDomain($domain) /** * Gets batched * - * @return bool + * @return bool|null */ - public function getBatched() + public function getBatched(): ?bool { return $this->container['batched']; } @@ -473,12 +469,15 @@ public function getBatched() /** * Sets batched * - * @param bool $batched To send batched webhooks + * @param bool|null $batched Batching configuration of the webhook, we send batched webhooks if its true * * @return $this */ - public function setBatched($batched) + public function setBatched(?bool $batched): static { + if (is_null($batched)) { + throw new InvalidArgumentException('non-nullable batched cannot be null'); + } $this->container['batched'] = $batched; return $this; @@ -487,9 +486,9 @@ public function setBatched($batched) /** * Gets auth * - * @return \Brevo\Client\Models\GetWebhookAuth + * @return object|null */ - public function getAuth() + public function getAuth(): ?object { return $this->container['auth']; } @@ -497,12 +496,15 @@ public function getAuth() /** * Sets auth * - * @param \Brevo\Client\Models\GetWebhookAuth $auth auth + * @param object|null $auth Authentication header to be send with the webhook requests * * @return $this */ - public function setAuth($auth) + public function setAuth(?object $auth): static { + if (is_null($auth)) { + throw new InvalidArgumentException('non-nullable auth cannot be null'); + } $this->container['auth'] = $auth; return $this; @@ -511,9 +513,9 @@ public function setAuth($auth) /** * Gets headers * - * @return \Brevo\Client\Models\GetWebhookHeaders[] + * @return object[]|null */ - public function getHeaders() + public function getHeaders(): ?array { return $this->container['headers']; } @@ -521,89 +523,19 @@ public function getHeaders() /** * Sets headers * - * @param \Brevo\Client\Models\GetWebhookHeaders[] $headers Custom headers to be send with webhooks + * @param object[]|null $headers headers * * @return $this */ - public function setHeaders($headers) + public function setHeaders(?array $headers): static { + if (is_null($headers)) { + throw new InvalidArgumentException('non-nullable headers cannot be null'); + } $this->container['headers'] = $headers; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateWhatsAppCampaign.php b/lib/Models/CreateWhatsAppCampaign.php index 73ce9a9..49c8353 100644 --- a/lib/Models/CreateWhatsAppCampaign.php +++ b/lib/Models/CreateWhatsAppCampaign.php @@ -2,61 +2,63 @@ /** * CreateWhatsAppCampaign * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateWhatsAppCampaign Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateWhatsAppCampaign implements ModelInterface, ArrayAccess +class CreateWhatsAppCampaign extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createWhatsAppCampaign'; + protected static string $openAPIModelName = 'createWhatsAppCampaign'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string', 'templateId' => 'int', 'scheduledAt' => 'string', @@ -66,9 +68,9 @@ class CreateWhatsAppCampaign implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null, 'templateId' => null, 'scheduledAt' => null, @@ -76,32 +78,31 @@ class CreateWhatsAppCampaign implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'templateId' => false, + 'scheduledAt' => false, + 'recipients' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name', 'templateId' => 'templateId', 'scheduledAt' => 'scheduledAt', @@ -111,9 +112,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName', 'templateId' => 'setTemplateId', 'scheduledAt' => 'setScheduledAt', @@ -123,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName', 'templateId' => 'getTemplateId', 'scheduledAt' => 'getScheduledAt', @@ -136,9 +137,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +147,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,54 +157,40 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['templateId'] = isset($data['templateId']) ? $data['templateId'] : null; - $this->container['scheduledAt'] = isset($data['scheduledAt']) ? $data['scheduledAt'] : null; - $this->container['recipients'] = isset($data['recipients']) ? $data['recipients'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('templateId', $data ?? [], null); + $this->setIfExists('scheduledAt', $data ?? [], null); + $this->setIfExists('recipients', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -222,24 +209,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -251,8 +226,11 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -263,7 +241,7 @@ public function setName($name) * * @return int */ - public function getTemplateId() + public function getTemplateId(): int { return $this->container['templateId']; } @@ -275,8 +253,11 @@ public function getTemplateId() * * @return $this */ - public function setTemplateId($templateId) + public function setTemplateId(int $templateId): static { + if (is_null($templateId)) { + throw new InvalidArgumentException('non-nullable templateId cannot be null'); + } $this->container['templateId'] = $templateId; return $this; @@ -287,7 +268,7 @@ public function setTemplateId($templateId) * * @return string */ - public function getScheduledAt() + public function getScheduledAt(): string { return $this->container['scheduledAt']; } @@ -299,8 +280,11 @@ public function getScheduledAt() * * @return $this */ - public function setScheduledAt($scheduledAt) + public function setScheduledAt(string $scheduledAt): static { + if (is_null($scheduledAt)) { + throw new InvalidArgumentException('non-nullable scheduledAt cannot be null'); + } $this->container['scheduledAt'] = $scheduledAt; return $this; @@ -311,7 +295,7 @@ public function setScheduledAt($scheduledAt) * * @return \Brevo\Client\Models\CreateWhatsAppCampaignRecipients */ - public function getRecipients() + public function getRecipients(): \Brevo\Client\Models\CreateWhatsAppCampaignRecipients { return $this->container['recipients']; } @@ -323,85 +307,15 @@ public function getRecipients() * * @return $this */ - public function setRecipients($recipients) + public function setRecipients(\Brevo\Client\Models\CreateWhatsAppCampaignRecipients $recipients): static { + if (is_null($recipients)) { + throw new InvalidArgumentException('non-nullable recipients cannot be null'); + } $this->container['recipients'] = $recipients; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateWhatsAppCampaignRecipients.php b/lib/Models/CreateWhatsAppCampaignRecipients.php index ef52e07..97efb58 100644 --- a/lib/Models/CreateWhatsAppCampaignRecipients.php +++ b/lib/Models/CreateWhatsAppCampaignRecipients.php @@ -2,62 +2,64 @@ /** * CreateWhatsAppCampaignRecipients * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateWhatsAppCampaignRecipients Class Doc Comment * - * @category Class * @description Segment ids and List ids to include/exclude from campaign * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateWhatsAppCampaignRecipients implements ModelInterface, ArrayAccess +class CreateWhatsAppCampaignRecipients extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createWhatsAppCampaign_recipients'; + protected static string $openAPIModelName = 'createWhatsAppCampaign_recipients'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'excludedListIds' => 'int[]', 'listIds' => 'int[]', 'segments' => 'int[]' @@ -66,41 +68,39 @@ class CreateWhatsAppCampaignRecipients implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'excludedListIds' => 'int64', 'listIds' => 'int64', 'segments' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'excludedListIds' => false, + 'listIds' => false, + 'segments' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'excludedListIds' => 'excludedListIds', 'listIds' => 'listIds', 'segments' => 'segments' @@ -109,9 +109,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'excludedListIds' => 'setExcludedListIds', 'listIds' => 'setListIds', 'segments' => 'setSegments' @@ -120,9 +120,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'excludedListIds' => 'getExcludedListIds', 'listIds' => 'getListIds', 'segments' => 'getSegments' @@ -132,9 +132,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -142,9 +142,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -152,77 +152,51 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['excludedListIds'] = isset($data['excludedListIds']) ? $data['excludedListIds'] : null; - $this->container['listIds'] = isset($data['listIds']) ? $data['listIds'] : null; - $this->container['segments'] = isset($data['segments']) ? $data['segments'] : null; + $this->setIfExists('excludedListIds', $data ?? [], null); + $this->setIfExists('listIds', $data ?? [], null); + $this->setIfExists('segments', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets excludedListIds * - * @return int[] + * @return int[]|null */ - public function getExcludedListIds() + public function getExcludedListIds(): ?array { return $this->container['excludedListIds']; } @@ -230,12 +204,15 @@ public function getExcludedListIds() /** * Sets excludedListIds * - * @param int[] $excludedListIds List ids to exclude from the campaign + * @param int[]|null $excludedListIds List ids to exclude from the campaign * * @return $this */ - public function setExcludedListIds($excludedListIds) + public function setExcludedListIds(?array $excludedListIds): static { + if (is_null($excludedListIds)) { + throw new InvalidArgumentException('non-nullable excludedListIds cannot be null'); + } $this->container['excludedListIds'] = $excludedListIds; return $this; @@ -244,9 +221,9 @@ public function setExcludedListIds($excludedListIds) /** * Gets listIds * - * @return int[] + * @return int[]|null */ - public function getListIds() + public function getListIds(): ?array { return $this->container['listIds']; } @@ -254,12 +231,15 @@ public function getListIds() /** * Sets listIds * - * @param int[] $listIds **Mandatory if scheduledAt is not empty**. List Ids to send the campaign to + * @param int[]|null $listIds **Mandatory if scheduledAt is not empty**. List Ids to send the campaign to * * @return $this */ - public function setListIds($listIds) + public function setListIds(?array $listIds): static { + if (is_null($listIds)) { + throw new InvalidArgumentException('non-nullable listIds cannot be null'); + } $this->container['listIds'] = $listIds; return $this; @@ -268,9 +248,9 @@ public function setListIds($listIds) /** * Gets segments * - * @return int[] + * @return int[]|null */ - public function getSegments() + public function getSegments(): ?array { return $this->container['segments']; } @@ -278,89 +258,19 @@ public function getSegments() /** * Sets segments * - * @param int[] $segments **Mandatory if listIds are not used**. Segment ids to send the campaign to. + * @param int[]|null $segments **Mandatory if listIds are not used**. Segment ids to send the campaign to. * * @return $this */ - public function setSegments($segments) + public function setSegments(?array $segments): static { + if (is_null($segments)) { + throw new InvalidArgumentException('non-nullable segments cannot be null'); + } $this->container['segments'] = $segments; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreateWhatsAppTemplate.php b/lib/Models/CreateWhatsAppTemplate.php index 9a1f4da..8557f6e 100644 --- a/lib/Models/CreateWhatsAppTemplate.php +++ b/lib/Models/CreateWhatsAppTemplate.php @@ -2,66 +2,68 @@ /** * CreateWhatsAppTemplate * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreateWhatsAppTemplate Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreateWhatsAppTemplate implements ModelInterface, ArrayAccess +class CreateWhatsAppTemplate extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createWhatsAppTemplate'; + protected static string $openAPIModelName = 'createWhatsAppTemplate'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string', 'language' => 'string', 'category' => 'string', - 'mediaUrl' => 'string', 'bodyText' => 'string', + 'mediaUrl' => 'string', 'headerText' => 'string', 'source' => 'string' ]; @@ -69,50 +71,52 @@ class CreateWhatsAppTemplate implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null, 'language' => null, 'category' => null, - 'mediaUrl' => null, 'bodyText' => null, + 'mediaUrl' => null, 'headerText' => null, 'source' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'language' => false, + 'category' => false, + 'bodyText' => false, + 'mediaUrl' => false, + 'headerText' => false, + 'source' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name', 'language' => 'language', 'category' => 'category', - 'mediaUrl' => 'mediaUrl', 'bodyText' => 'bodyText', + 'mediaUrl' => 'mediaUrl', 'headerText' => 'headerText', 'source' => 'source' ]; @@ -120,14 +124,14 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName', 'language' => 'setLanguage', 'category' => 'setCategory', - 'mediaUrl' => 'setMediaUrl', 'bodyText' => 'setBodyText', + 'mediaUrl' => 'setMediaUrl', 'headerText' => 'setHeaderText', 'source' => 'setSource' ]; @@ -135,14 +139,14 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName', 'language' => 'getLanguage', 'category' => 'getCategory', - 'mediaUrl' => 'getMediaUrl', 'bodyText' => 'getBodyText', + 'mediaUrl' => 'getMediaUrl', 'headerText' => 'getHeaderText', 'source' => 'getSource' ]; @@ -151,9 +155,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -161,9 +165,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -171,29 +175,17 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const CATEGORY_MARKETING = 'MARKETING'; - const CATEGORY_UTILITY = 'UTILITY'; - const SOURCE_AUTOMATION = 'Automation'; - const SOURCE_CONVERSATIONS = 'Conversations'; - - + public const CATEGORY_MARKETING = 'MARKETING'; + public const CATEGORY_UTILITY = 'UTILITY'; + public const SOURCE_AUTOMATION = 'Automation'; + public const SOURCE_CONVERSATIONS = 'Conversations'; /** * Gets allowable values of the enum @@ -221,37 +213,35 @@ public function getSourceAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['language'] = isset($data['language']) ? $data['language'] : null; - $this->container['category'] = isset($data['category']) ? $data['category'] : null; - $this->container['mediaUrl'] = isset($data['mediaUrl']) ? $data['mediaUrl'] : null; - $this->container['bodyText'] = isset($data['bodyText']) ? $data['bodyText'] : null; - $this->container['headerText'] = isset($data['headerText']) ? $data['headerText'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('language', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('bodyText', $data ?? [], null); + $this->setIfExists('mediaUrl', $data ?? [], null); + $this->setIfExists('headerText', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -267,7 +257,8 @@ public function listInvalidProperties() $allowedValues = $this->getCategoryAllowableValues(); if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'category', must be one of '%s'", + "invalid value '%s' for 'category', must be one of '%s'", + $this->container['category'], implode("', '", $allowedValues) ); } @@ -278,7 +269,8 @@ public function listInvalidProperties() $allowedValues = $this->getSourceAllowableValues(); if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'source', must be one of '%s'", + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], implode("', '", $allowedValues) ); } @@ -286,24 +278,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -315,8 +295,11 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -327,7 +310,7 @@ public function setName($name) * * @return string */ - public function getLanguage() + public function getLanguage(): string { return $this->container['language']; } @@ -339,8 +322,11 @@ public function getLanguage() * * @return $this */ - public function setLanguage($language) + public function setLanguage(string $language): static { + if (is_null($language)) { + throw new InvalidArgumentException('non-nullable language cannot be null'); + } $this->container['language'] = $language; return $this; @@ -351,7 +337,7 @@ public function setLanguage($language) * * @return string */ - public function getCategory() + public function getCategory(): string { return $this->container['category']; } @@ -363,13 +349,17 @@ public function getCategory() * * @return $this */ - public function setCategory($category) + public function setCategory(string $category): static { + if (is_null($category)) { + throw new InvalidArgumentException('non-nullable category cannot be null'); + } $allowedValues = $this->getCategoryAllowableValues(); if (!in_array($category, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'category', must be one of '%s'", + "Invalid value '%s' for 'category', must be one of '%s'", + $category, implode("', '", $allowedValues) ) ); @@ -380,49 +370,55 @@ public function setCategory($category) } /** - * Gets mediaUrl + * Gets bodyText * * @return string */ - public function getMediaUrl() + public function getBodyText(): string { - return $this->container['mediaUrl']; + return $this->container['bodyText']; } /** - * Sets mediaUrl + * Sets bodyText * - * @param string $mediaUrl Absolute url of the media file **(no local file)** for the header. **Use this field in you want to add media in Template header and headerText is empty.** Allowed extensions for media files are: #### jpeg | png | mp4 | pdf + * @param string $bodyText Body of the template. **Maximum allowed characters are 1024** * * @return $this */ - public function setMediaUrl($mediaUrl) + public function setBodyText(string $bodyText): static { - $this->container['mediaUrl'] = $mediaUrl; + if (is_null($bodyText)) { + throw new InvalidArgumentException('non-nullable bodyText cannot be null'); + } + $this->container['bodyText'] = $bodyText; return $this; } /** - * Gets bodyText + * Gets mediaUrl * - * @return string + * @return string|null */ - public function getBodyText() + public function getMediaUrl(): ?string { - return $this->container['bodyText']; + return $this->container['mediaUrl']; } /** - * Sets bodyText + * Sets mediaUrl * - * @param string $bodyText Body of the template. **Maximum allowed characters are 1024** + * @param string|null $mediaUrl Absolute url of the media file **(no local file)** for the header. **Use this field in you want to add media in Template header and headerText is empty**. Allowed extensions for media files are: #### jpeg | png | mp4 | pdf * * @return $this */ - public function setBodyText($bodyText) + public function setMediaUrl(?string $mediaUrl): static { - $this->container['bodyText'] = $bodyText; + if (is_null($mediaUrl)) { + throw new InvalidArgumentException('non-nullable mediaUrl cannot be null'); + } + $this->container['mediaUrl'] = $mediaUrl; return $this; } @@ -430,9 +426,9 @@ public function setBodyText($bodyText) /** * Gets headerText * - * @return string + * @return string|null */ - public function getHeaderText() + public function getHeaderText(): ?string { return $this->container['headerText']; } @@ -440,12 +436,15 @@ public function getHeaderText() /** * Sets headerText * - * @param string $headerText Text content of the header in the template. **Maximum allowed characters are 45** **Use this field to add text content in template header and if mediaUrl is empty** + * @param string|null $headerText Text content of the header in the template. **Maximum allowed characters are 45** **Use this field to add text content in template header and if mediaUrl is empty** * * @return $this */ - public function setHeaderText($headerText) + public function setHeaderText(?string $headerText): static { + if (is_null($headerText)) { + throw new InvalidArgumentException('non-nullable headerText cannot be null'); + } $this->container['headerText'] = $headerText; return $this; @@ -454,9 +453,9 @@ public function setHeaderText($headerText) /** * Gets source * - * @return string + * @return string|null */ - public function getSource() + public function getSource(): ?string { return $this->container['source']; } @@ -464,17 +463,21 @@ public function getSource() /** * Sets source * - * @param string $source source of the template + * @param string|null $source source of the template * * @return $this */ - public function setSource($source) + public function setSource(?string $source): static { + if (is_null($source)) { + throw new InvalidArgumentException('non-nullable source cannot be null'); + } $allowedValues = $this->getSourceAllowableValues(); - if (!is_null($source) && !in_array($source, $allowedValues, true)) { - throw new \InvalidArgumentException( + if (!in_array($source, $allowedValues, true)) { + throw new InvalidArgumentException( sprintf( - "Invalid value for 'source', must be one of '%s'", + "Invalid value '%s' for 'source', must be one of '%s'", + $source, implode("', '", $allowedValues) ) ); @@ -483,79 +486,6 @@ public function setSource($source) return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CreatedBatchId.php b/lib/Models/CreatedBatchId.php index 344235f..7f8ebbe 100644 --- a/lib/Models/CreatedBatchId.php +++ b/lib/Models/CreatedBatchId.php @@ -2,128 +2,132 @@ /** * CreatedBatchId * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreatedBatchId Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreatedBatchId implements ModelInterface, ArrayAccess +class CreatedBatchId extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createdBatchId'; + protected static string $openAPIModelName = 'createdBatchId'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'batchId' => 'float' + protected static array $openAPITypes = [ + 'batchId' => 'float', + 'count' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'batchId' => null + protected static array $openAPIFormats = [ + 'batchId' => null, + 'count' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'batchId' => false, + 'count' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ - 'batchId' => 'batchId' + protected static array $attributeMap = [ + 'batchId' => 'batchId', + 'count' => 'count' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ - 'batchId' => 'setBatchId' + protected static array $setters = [ + 'batchId' => 'setBatchId', + 'count' => 'setCount' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ - 'batchId' => 'getBatchId' + protected static array $getters = [ + 'batchId' => 'getBatchId', + 'count' => 'getCount' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,51 +145,38 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['batchId'] = isset($data['batchId']) ? $data['batchId'] : null; + $this->setIfExists('batchId', $data ?? [], null); + $this->setIfExists('count', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -195,24 +186,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets batchId * * @return float */ - public function getBatchId() + public function getBatchId(): float { return $this->container['batchId']; } @@ -224,84 +203,41 @@ public function getBatchId() * * @return $this */ - public function setBatchId($batchId) + public function setBatchId(float $batchId): static { + if (is_null($batchId)) { + throw new InvalidArgumentException('non-nullable batchId cannot be null'); + } $this->container['batchId'] = $batchId; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 + * Gets count * - * @return void + * @return int|null */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function getCount(): ?int { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } + return $this->container['count']; } /** - * Unsets offset. + * Sets count * - * @param integer $offset Offset + * @param int|null $count Number of orders * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string + * @return $this */ - public function __toString() + public function setCount(?int $count): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); } + $this->container['count'] = $count; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/CreatedProcessId.php b/lib/Models/CreatedProcessId.php index 9096412..7bcefb9 100644 --- a/lib/Models/CreatedProcessId.php +++ b/lib/Models/CreatedProcessId.php @@ -2,118 +2,116 @@ /** * CreatedProcessId * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * CreatedProcessId Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class CreatedProcessId implements ModelInterface, ArrayAccess +class CreatedProcessId extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'createdProcessId'; + protected static string $openAPIModelName = 'createdProcessId'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'processId' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'processId' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'processId' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'processId' => 'processId' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'processId' => 'setProcessId' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'processId' => 'getProcessId' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,51 +139,37 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['processId'] = isset($data['processId']) ? $data['processId'] : null; + $this->setIfExists('processId', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -195,24 +179,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets processId * * @return int */ - public function getProcessId() + public function getProcessId(): int { return $this->container['processId']; } @@ -224,85 +196,15 @@ public function getProcessId() * * @return $this */ - public function setProcessId($processId) + public function setProcessId(int $processId): static { + if (is_null($processId)) { + throw new InvalidArgumentException('non-nullable processId cannot be null'); + } $this->container['processId'] = $processId; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/CrmDealsIdPatchRequest.php b/lib/Models/CrmDealsIdPatchRequest.php new file mode 100644 index 0000000..df0b7ad --- /dev/null +++ b/lib/Models/CrmDealsIdPatchRequest.php @@ -0,0 +1,241 @@ + + */ +class CrmDealsIdPatchRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_crm_deals__id__patch_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'attributes' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'attributes' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'attributes' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'attributes' => 'attributes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'attributes' => 'setAttributes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of deal + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets attributes + * + * @return object|null + */ + public function getAttributes(): ?object + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param object|null $attributes Attributes for deal update To assign owner of a Deal you can send attributes.deal_owner and utilize the account email or ID. If you wish to update the pipeline of a deal you need to provide the `pipeline` and the `deal_stage` Pipeline and deal_stage are ids you can fetch using this endpoint `/crm/pipeline/details/{pipelineID}` + * + * @return $this + */ + public function setAttributes(?object $attributes): static + { + if (is_null($attributes)) { + throw new InvalidArgumentException('non-nullable attributes cannot be null'); + } + $this->container['attributes'] = $attributes; + + return $this; + } +} + + diff --git a/lib/Models/CrmDealsLinkUnlinkIdPatchRequest.php b/lib/Models/CrmDealsLinkUnlinkIdPatchRequest.php new file mode 100644 index 0000000..2395fbe --- /dev/null +++ b/lib/Models/CrmDealsLinkUnlinkIdPatchRequest.php @@ -0,0 +1,309 @@ + + */ +class CrmDealsLinkUnlinkIdPatchRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_crm_deals_link_unlink__id__patch_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'linkContactIds' => 'int[]', + 'unlinkContactIds' => 'int[]', + 'linkCompanyIds' => 'string[]', + 'unlinkCompanyIds' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'linkContactIds' => 'int64', + 'unlinkContactIds' => 'int64', + 'linkCompanyIds' => null, + 'unlinkCompanyIds' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'linkContactIds' => false, + 'unlinkContactIds' => false, + 'linkCompanyIds' => false, + 'unlinkCompanyIds' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'linkContactIds' => 'linkContactIds', + 'unlinkContactIds' => 'unlinkContactIds', + 'linkCompanyIds' => 'linkCompanyIds', + 'unlinkCompanyIds' => 'unlinkCompanyIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'linkContactIds' => 'setLinkContactIds', + 'unlinkContactIds' => 'setUnlinkContactIds', + 'linkCompanyIds' => 'setLinkCompanyIds', + 'unlinkCompanyIds' => 'setUnlinkCompanyIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'linkContactIds' => 'getLinkContactIds', + 'unlinkContactIds' => 'getUnlinkContactIds', + 'linkCompanyIds' => 'getLinkCompanyIds', + 'unlinkCompanyIds' => 'getUnlinkCompanyIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('linkContactIds', $data ?? [], null); + $this->setIfExists('unlinkContactIds', $data ?? [], null); + $this->setIfExists('linkCompanyIds', $data ?? [], null); + $this->setIfExists('unlinkCompanyIds', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets linkContactIds + * + * @return int[]|null + */ + public function getLinkContactIds(): ?array + { + return $this->container['linkContactIds']; + } + + /** + * Sets linkContactIds + * + * @param int[]|null $linkContactIds Contact ids for contacts to be linked with deal + * + * @return $this + */ + public function setLinkContactIds(?array $linkContactIds): static + { + if (is_null($linkContactIds)) { + throw new InvalidArgumentException('non-nullable linkContactIds cannot be null'); + } + $this->container['linkContactIds'] = $linkContactIds; + + return $this; + } + + /** + * Gets unlinkContactIds + * + * @return int[]|null + */ + public function getUnlinkContactIds(): ?array + { + return $this->container['unlinkContactIds']; + } + + /** + * Sets unlinkContactIds + * + * @param int[]|null $unlinkContactIds Contact ids for contacts to be unlinked from deal + * + * @return $this + */ + public function setUnlinkContactIds(?array $unlinkContactIds): static + { + if (is_null($unlinkContactIds)) { + throw new InvalidArgumentException('non-nullable unlinkContactIds cannot be null'); + } + $this->container['unlinkContactIds'] = $unlinkContactIds; + + return $this; + } + + /** + * Gets linkCompanyIds + * + * @return string[]|null + */ + public function getLinkCompanyIds(): ?array + { + return $this->container['linkCompanyIds']; + } + + /** + * Sets linkCompanyIds + * + * @param string[]|null $linkCompanyIds Company ids to be linked with deal + * + * @return $this + */ + public function setLinkCompanyIds(?array $linkCompanyIds): static + { + if (is_null($linkCompanyIds)) { + throw new InvalidArgumentException('non-nullable linkCompanyIds cannot be null'); + } + $this->container['linkCompanyIds'] = $linkCompanyIds; + + return $this; + } + + /** + * Gets unlinkCompanyIds + * + * @return string[]|null + */ + public function getUnlinkCompanyIds(): ?array + { + return $this->container['unlinkCompanyIds']; + } + + /** + * Sets unlinkCompanyIds + * + * @param string[]|null $unlinkCompanyIds Company ids to be unlinked from deal + * + * @return $this + */ + public function setUnlinkCompanyIds(?array $unlinkCompanyIds): static + { + if (is_null($unlinkCompanyIds)) { + throw new InvalidArgumentException('non-nullable unlinkCompanyIds cannot be null'); + } + $this->container['unlinkCompanyIds'] = $unlinkCompanyIds; + + return $this; + } +} + + diff --git a/lib/Models/CrmDealsPost201Response.php b/lib/Models/CrmDealsPost201Response.php new file mode 100644 index 0000000..838bd38 --- /dev/null +++ b/lib/Models/CrmDealsPost201Response.php @@ -0,0 +1,211 @@ + + */ +class CrmDealsPost201Response extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_crm_deals_post_201_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Unique deal id + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } +} + + diff --git a/lib/Models/CrmDealsPostRequest.php b/lib/Models/CrmDealsPostRequest.php new file mode 100644 index 0000000..7d58d73 --- /dev/null +++ b/lib/Models/CrmDealsPostRequest.php @@ -0,0 +1,312 @@ + + */ +class CrmDealsPostRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_crm_deals_post_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'attributes' => 'object', + 'linkedContactsIds' => 'int[]', + 'linkedCompaniesIds' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'attributes' => null, + 'linkedContactsIds' => 'int64', + 'linkedCompaniesIds' => 'objectID' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'attributes' => false, + 'linkedContactsIds' => false, + 'linkedCompaniesIds' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'attributes' => 'attributes', + 'linkedContactsIds' => 'linkedContactsIds', + 'linkedCompaniesIds' => 'linkedCompaniesIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'attributes' => 'setAttributes', + 'linkedContactsIds' => 'setLinkedContactsIds', + 'linkedCompaniesIds' => 'setLinkedCompaniesIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'attributes' => 'getAttributes', + 'linkedContactsIds' => 'getLinkedContactsIds', + 'linkedCompaniesIds' => 'getLinkedCompaniesIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('linkedContactsIds', $data ?? [], null); + $this->setIfExists('linkedCompaniesIds', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Name of deal + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets attributes + * + * @return object|null + */ + public function getAttributes(): ?object + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param object|null $attributes Attributes for deal creation To assign owner of a Deal you can send attributes.deal_owner and utilize the account email or ID. If you want to create a deal on a specific pipeline and stage you can use the following attributes `pipeline` and `deal_stage`. Pipeline and deal_stage are ids you can fetch using this endpoint `/crm/pipeline/details/{pipelineID}` + * + * @return $this + */ + public function setAttributes(?object $attributes): static + { + if (is_null($attributes)) { + throw new InvalidArgumentException('non-nullable attributes cannot be null'); + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets linkedContactsIds + * + * @return int[]|null + */ + public function getLinkedContactsIds(): ?array + { + return $this->container['linkedContactsIds']; + } + + /** + * Sets linkedContactsIds + * + * @param int[]|null $linkedContactsIds Contact ids to be linked with deal + * + * @return $this + */ + public function setLinkedContactsIds(?array $linkedContactsIds): static + { + if (is_null($linkedContactsIds)) { + throw new InvalidArgumentException('non-nullable linkedContactsIds cannot be null'); + } + $this->container['linkedContactsIds'] = $linkedContactsIds; + + return $this; + } + + /** + * Gets linkedCompaniesIds + * + * @return string[]|null + */ + public function getLinkedCompaniesIds(): ?array + { + return $this->container['linkedCompaniesIds']; + } + + /** + * Sets linkedCompaniesIds + * + * @param string[]|null $linkedCompaniesIds Company ids to be linked with deal + * + * @return $this + */ + public function setLinkedCompaniesIds(?array $linkedCompaniesIds): static + { + if (is_null($linkedCompaniesIds)) { + throw new InvalidArgumentException('non-nullable linkedCompaniesIds cannot be null'); + } + $this->container['linkedCompaniesIds'] = $linkedCompaniesIds; + + return $this; + } +} + + diff --git a/lib/Models/CrmTasksIdPatchRequest.php b/lib/Models/CrmTasksIdPatchRequest.php new file mode 100644 index 0000000..24b5021 --- /dev/null +++ b/lib/Models/CrmTasksIdPatchRequest.php @@ -0,0 +1,547 @@ + + */ +class CrmTasksIdPatchRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_crm_tasks__id__patch_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'duration' => 'int', + 'taskTypeId' => 'string', + 'date' => '\DateTime', + 'notes' => 'string', + 'done' => 'bool', + 'assignToId' => 'string', + 'contactsIds' => 'int[]', + 'dealsIds' => 'string[]', + 'companiesIds' => 'string[]', + 'reminder' => '\Brevo\Client\Models\TaskReminder' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'duration' => 'int64', + 'taskTypeId' => null, + 'date' => 'date-time', + 'notes' => null, + 'done' => null, + 'assignToId' => null, + 'contactsIds' => null, + 'dealsIds' => null, + 'companiesIds' => null, + 'reminder' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'duration' => false, + 'taskTypeId' => false, + 'date' => false, + 'notes' => false, + 'done' => false, + 'assignToId' => false, + 'contactsIds' => false, + 'dealsIds' => false, + 'companiesIds' => false, + 'reminder' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'duration' => 'duration', + 'taskTypeId' => 'taskTypeId', + 'date' => 'date', + 'notes' => 'notes', + 'done' => 'done', + 'assignToId' => 'assignToId', + 'contactsIds' => 'contactsIds', + 'dealsIds' => 'dealsIds', + 'companiesIds' => 'companiesIds', + 'reminder' => 'reminder' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'duration' => 'setDuration', + 'taskTypeId' => 'setTaskTypeId', + 'date' => 'setDate', + 'notes' => 'setNotes', + 'done' => 'setDone', + 'assignToId' => 'setAssignToId', + 'contactsIds' => 'setContactsIds', + 'dealsIds' => 'setDealsIds', + 'companiesIds' => 'setCompaniesIds', + 'reminder' => 'setReminder' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'duration' => 'getDuration', + 'taskTypeId' => 'getTaskTypeId', + 'date' => 'getDate', + 'notes' => 'getNotes', + 'done' => 'getDone', + 'assignToId' => 'getAssignToId', + 'contactsIds' => 'getContactsIds', + 'dealsIds' => 'getDealsIds', + 'companiesIds' => 'getCompaniesIds', + 'reminder' => 'getReminder' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('duration', $data ?? [], null); + $this->setIfExists('taskTypeId', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('done', $data ?? [], null); + $this->setIfExists('assignToId', $data ?? [], null); + $this->setIfExists('contactsIds', $data ?? [], null); + $this->setIfExists('dealsIds', $data ?? [], null); + $this->setIfExists('companiesIds', $data ?? [], null); + $this->setIfExists('reminder', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of task + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets duration + * + * @return int|null + */ + public function getDuration(): ?int + { + return $this->container['duration']; + } + + /** + * Sets duration + * + * @param int|null $duration Duration of task in milliseconds [1 minute = 60000 ms] + * + * @return $this + */ + public function setDuration(?int $duration): static + { + if (is_null($duration)) { + throw new InvalidArgumentException('non-nullable duration cannot be null'); + } + $this->container['duration'] = $duration; + + return $this; + } + + /** + * Gets taskTypeId + * + * @return string|null + */ + public function getTaskTypeId(): ?string + { + return $this->container['taskTypeId']; + } + + /** + * Sets taskTypeId + * + * @param string|null $taskTypeId Id for type of task e.g Call / Email / Meeting etc. + * + * @return $this + */ + public function setTaskTypeId(?string $taskTypeId): static + { + if (is_null($taskTypeId)) { + throw new InvalidArgumentException('non-nullable taskTypeId cannot be null'); + } + $this->container['taskTypeId'] = $taskTypeId; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate(): ?\DateTime + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Task date/time + * + * @return $this + */ + public function setDate(?\DateTime $date): static + { + if (is_null($date)) { + throw new InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets notes + * + * @return string|null + */ + public function getNotes(): ?string + { + return $this->container['notes']; + } + + /** + * Sets notes + * + * @param string|null $notes Notes added to a task + * + * @return $this + */ + public function setNotes(?string $notes): static + { + if (is_null($notes)) { + throw new InvalidArgumentException('non-nullable notes cannot be null'); + } + $this->container['notes'] = $notes; + + return $this; + } + + /** + * Gets done + * + * @return bool|null + */ + public function getDone(): ?bool + { + return $this->container['done']; + } + + /** + * Sets done + * + * @param bool|null $done Task marked as done + * + * @return $this + */ + public function setDone(?bool $done): static + { + if (is_null($done)) { + throw new InvalidArgumentException('non-nullable done cannot be null'); + } + $this->container['done'] = $done; + + return $this; + } + + /** + * Gets assignToId + * + * @return string|null + */ + public function getAssignToId(): ?string + { + return $this->container['assignToId']; + } + + /** + * Sets assignToId + * + * @param string|null $assignToId To assign a task to a user you can use either the account email or ID. + * + * @return $this + */ + public function setAssignToId(?string $assignToId): static + { + if (is_null($assignToId)) { + throw new InvalidArgumentException('non-nullable assignToId cannot be null'); + } + $this->container['assignToId'] = $assignToId; + + return $this; + } + + /** + * Gets contactsIds + * + * @return int[]|null + */ + public function getContactsIds(): ?array + { + return $this->container['contactsIds']; + } + + /** + * Sets contactsIds + * + * @param int[]|null $contactsIds Contact ids for contacts linked to this task + * + * @return $this + */ + public function setContactsIds(?array $contactsIds): static + { + if (is_null($contactsIds)) { + throw new InvalidArgumentException('non-nullable contactsIds cannot be null'); + } + $this->container['contactsIds'] = $contactsIds; + + return $this; + } + + /** + * Gets dealsIds + * + * @return string[]|null + */ + public function getDealsIds(): ?array + { + return $this->container['dealsIds']; + } + + /** + * Sets dealsIds + * + * @param string[]|null $dealsIds Deal ids for deals a task is linked to + * + * @return $this + */ + public function setDealsIds(?array $dealsIds): static + { + if (is_null($dealsIds)) { + throw new InvalidArgumentException('non-nullable dealsIds cannot be null'); + } + $this->container['dealsIds'] = $dealsIds; + + return $this; + } + + /** + * Gets companiesIds + * + * @return string[]|null + */ + public function getCompaniesIds(): ?array + { + return $this->container['companiesIds']; + } + + /** + * Sets companiesIds + * + * @param string[]|null $companiesIds Companies ids for companies a task is linked to + * + * @return $this + */ + public function setCompaniesIds(?array $companiesIds): static + { + if (is_null($companiesIds)) { + throw new InvalidArgumentException('non-nullable companiesIds cannot be null'); + } + $this->container['companiesIds'] = $companiesIds; + + return $this; + } + + /** + * Gets reminder + * + * @return \Brevo\Client\Models\TaskReminder|null + */ + public function getReminder(): ?\Brevo\Client\Models\TaskReminder + { + return $this->container['reminder']; + } + + /** + * Sets reminder + * + * @param \Brevo\Client\Models\TaskReminder|null $reminder reminder + * + * @return $this + */ + public function setReminder(?\Brevo\Client\Models\TaskReminder $reminder): static + { + if (is_null($reminder)) { + throw new InvalidArgumentException('non-nullable reminder cannot be null'); + } + $this->container['reminder'] = $reminder; + + return $this; + } +} + + diff --git a/lib/Models/CrmTasksPost201Response.php b/lib/Models/CrmTasksPost201Response.php new file mode 100644 index 0000000..f267b97 --- /dev/null +++ b/lib/Models/CrmTasksPost201Response.php @@ -0,0 +1,211 @@ + + */ +class CrmTasksPost201Response extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_crm_tasks_post_201_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Unique task id + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } +} + + diff --git a/lib/Models/Body8.php b/lib/Models/CrmTasksPostRequest.php similarity index 54% rename from lib/Models/Body8.php rename to lib/Models/CrmTasksPostRequest.php index c07cc1f..c2f9dc0 100644 --- a/lib/Models/Body8.php +++ b/lib/Models/CrmTasksPostRequest.php @@ -1,66 +1,68 @@ */ -class Body8 implements ModelInterface, ArrayAccess +class CrmTasksPostRequest extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'body_8'; + protected static string $openAPIModelName = '_crm_tasks_post_request'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string', - 'duration' => 'int', 'taskTypeId' => 'string', 'date' => '\DateTime', + 'duration' => 'int', 'notes' => 'string', 'done' => 'bool', 'assignToId' => 'string', @@ -73,13 +75,13 @@ class Body8 implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null, - 'duration' => 'int64', 'taskTypeId' => null, 'date' => 'date-time', + 'duration' => 'int64', 'notes' => null, 'done' => null, 'assignToId' => null, @@ -90,36 +92,42 @@ class Body8 implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'taskTypeId' => false, + 'date' => false, + 'duration' => false, + 'notes' => false, + 'done' => false, + 'assignToId' => false, + 'contactsIds' => false, + 'dealsIds' => false, + 'companiesIds' => false, + 'reminder' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name', - 'duration' => 'duration', 'taskTypeId' => 'taskTypeId', 'date' => 'date', + 'duration' => 'duration', 'notes' => 'notes', 'done' => 'done', 'assignToId' => 'assignToId', @@ -132,13 +140,13 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName', - 'duration' => 'setDuration', 'taskTypeId' => 'setTaskTypeId', 'date' => 'setDate', + 'duration' => 'setDuration', 'notes' => 'setNotes', 'done' => 'setDone', 'assignToId' => 'setAssignToId', @@ -151,13 +159,13 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName', - 'duration' => 'getDuration', 'taskTypeId' => 'getTaskTypeId', 'date' => 'getDate', + 'duration' => 'getDuration', 'notes' => 'getNotes', 'done' => 'getDone', 'assignToId' => 'getAssignToId', @@ -171,9 +179,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -181,9 +189,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -191,98 +199,72 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['duration'] = isset($data['duration']) ? $data['duration'] : null; - $this->container['taskTypeId'] = isset($data['taskTypeId']) ? $data['taskTypeId'] : null; - $this->container['date'] = isset($data['date']) ? $data['date'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['done'] = isset($data['done']) ? $data['done'] : null; - $this->container['assignToId'] = isset($data['assignToId']) ? $data['assignToId'] : null; - $this->container['contactsIds'] = isset($data['contactsIds']) ? $data['contactsIds'] : null; - $this->container['dealsIds'] = isset($data['dealsIds']) ? $data['dealsIds'] : null; - $this->container['companiesIds'] = isset($data['companiesIds']) ? $data['companiesIds'] : null; - $this->container['reminder'] = isset($data['reminder']) ? $data['reminder'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('taskTypeId', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('duration', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('done', $data ?? [], null); + $this->setIfExists('assignToId', $data ?? [], null); + $this->setIfExists('contactsIds', $data ?? [], null); + $this->setIfExists('dealsIds', $data ?? [], null); + $this->setIfExists('companiesIds', $data ?? [], null); + $this->setIfExists('reminder', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; if ($this->container['name'] === null) { $invalidProperties[] = "'name' can't be null"; } - if (!is_null($this->container['duration']) && ($this->container['duration'] < 0)) { - $invalidProperties[] = "invalid value for 'duration', must be bigger than or equal to 0."; - } - if ($this->container['taskTypeId'] === null) { $invalidProperties[] = "'taskTypeId' can't be null"; } if ($this->container['date'] === null) { $invalidProperties[] = "'date' can't be null"; } - return $invalidProperties; - } + if (!is_null($this->container['duration']) && ($this->container['duration'] < 0)) { + $invalidProperties[] = "invalid value for 'duration', must be bigger than or equal to 0."; + } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; + return $invalidProperties; } - /** * Gets name * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -294,86 +276,98 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; } /** - * Gets duration + * Gets taskTypeId * - * @return int + * @return string */ - public function getDuration() + public function getTaskTypeId(): string { - return $this->container['duration']; + return $this->container['taskTypeId']; } /** - * Sets duration + * Sets taskTypeId * - * @param int $duration Duration of task in milliseconds [1 minute = 60000 ms] + * @param string $taskTypeId Id for type of task e.g Call / Email / Meeting etc. * * @return $this */ - public function setDuration($duration) + public function setTaskTypeId(string $taskTypeId): static { - - if (!is_null($duration) && ($duration < 0)) { - throw new \InvalidArgumentException('invalid value for $duration when calling Body8., must be bigger than or equal to 0.'); + if (is_null($taskTypeId)) { + throw new InvalidArgumentException('non-nullable taskTypeId cannot be null'); } - - $this->container['duration'] = $duration; + $this->container['taskTypeId'] = $taskTypeId; return $this; } /** - * Gets taskTypeId + * Gets date * - * @return string + * @return \DateTime */ - public function getTaskTypeId() + public function getDate(): \DateTime { - return $this->container['taskTypeId']; + return $this->container['date']; } /** - * Sets taskTypeId + * Sets date * - * @param string $taskTypeId Id for type of task e.g Call / Email / Meeting etc. + * @param \DateTime $date Task due date and time * * @return $this */ - public function setTaskTypeId($taskTypeId) + public function setDate(\DateTime $date): static { - $this->container['taskTypeId'] = $taskTypeId; + if (is_null($date)) { + throw new InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; return $this; } /** - * Gets date + * Gets duration * - * @return \DateTime + * @return int|null */ - public function getDate() + public function getDuration(): ?int { - return $this->container['date']; + return $this->container['duration']; } /** - * Sets date + * Sets duration * - * @param \DateTime $date Task due date and time + * @param int|null $duration Duration of task in milliseconds [1 minute = 60000 ms] * * @return $this */ - public function setDate($date) + public function setDuration(?int $duration): static { - $this->container['date'] = $date; + if (is_null($duration)) { + throw new InvalidArgumentException('non-nullable duration cannot be null'); + } + + if (($duration < 0)) { + throw new InvalidArgumentException('invalid value for $duration when calling CrmTasksPostRequest., must be bigger than or equal to 0.'); + } + + $this->container['duration'] = $duration; return $this; } @@ -381,9 +375,9 @@ public function setDate($date) /** * Gets notes * - * @return string + * @return string|null */ - public function getNotes() + public function getNotes(): ?string { return $this->container['notes']; } @@ -391,12 +385,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes Notes added to a task + * @param string|null $notes Notes added to a task * * @return $this */ - public function setNotes($notes) + public function setNotes(?string $notes): static { + if (is_null($notes)) { + throw new InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -405,9 +402,9 @@ public function setNotes($notes) /** * Gets done * - * @return bool + * @return bool|null */ - public function getDone() + public function getDone(): ?bool { return $this->container['done']; } @@ -415,12 +412,15 @@ public function getDone() /** * Sets done * - * @param bool $done Task marked as done + * @param bool|null $done Task marked as done * * @return $this */ - public function setDone($done) + public function setDone(?bool $done): static { + if (is_null($done)) { + throw new InvalidArgumentException('non-nullable done cannot be null'); + } $this->container['done'] = $done; return $this; @@ -429,9 +429,9 @@ public function setDone($done) /** * Gets assignToId * - * @return string + * @return string|null */ - public function getAssignToId() + public function getAssignToId(): ?string { return $this->container['assignToId']; } @@ -439,12 +439,15 @@ public function getAssignToId() /** * Sets assignToId * - * @param string $assignToId User id to whom task is assigned + * @param string|null $assignToId To assign a task to a user you can use either the account email or ID. * * @return $this */ - public function setAssignToId($assignToId) + public function setAssignToId(?string $assignToId): static { + if (is_null($assignToId)) { + throw new InvalidArgumentException('non-nullable assignToId cannot be null'); + } $this->container['assignToId'] = $assignToId; return $this; @@ -453,9 +456,9 @@ public function setAssignToId($assignToId) /** * Gets contactsIds * - * @return int[] + * @return int[]|null */ - public function getContactsIds() + public function getContactsIds(): ?array { return $this->container['contactsIds']; } @@ -463,12 +466,15 @@ public function getContactsIds() /** * Sets contactsIds * - * @param int[] $contactsIds Contact ids for contacts linked to this task + * @param int[]|null $contactsIds Contact ids for contacts linked to this task * * @return $this */ - public function setContactsIds($contactsIds) + public function setContactsIds(?array $contactsIds): static { + if (is_null($contactsIds)) { + throw new InvalidArgumentException('non-nullable contactsIds cannot be null'); + } $this->container['contactsIds'] = $contactsIds; return $this; @@ -477,9 +483,9 @@ public function setContactsIds($contactsIds) /** * Gets dealsIds * - * @return string[] + * @return string[]|null */ - public function getDealsIds() + public function getDealsIds(): ?array { return $this->container['dealsIds']; } @@ -487,12 +493,15 @@ public function getDealsIds() /** * Sets dealsIds * - * @param string[] $dealsIds Deal ids for deals a task is linked to + * @param string[]|null $dealsIds Deal ids for deals a task is linked to * * @return $this */ - public function setDealsIds($dealsIds) + public function setDealsIds(?array $dealsIds): static { + if (is_null($dealsIds)) { + throw new InvalidArgumentException('non-nullable dealsIds cannot be null'); + } $this->container['dealsIds'] = $dealsIds; return $this; @@ -501,9 +510,9 @@ public function setDealsIds($dealsIds) /** * Gets companiesIds * - * @return string[] + * @return string[]|null */ - public function getCompaniesIds() + public function getCompaniesIds(): ?array { return $this->container['companiesIds']; } @@ -511,12 +520,15 @@ public function getCompaniesIds() /** * Sets companiesIds * - * @param string[] $companiesIds Companies ids for companies a task is linked to + * @param string[]|null $companiesIds Companies ids for companies a task is linked to * * @return $this */ - public function setCompaniesIds($companiesIds) + public function setCompaniesIds(?array $companiesIds): static { + if (is_null($companiesIds)) { + throw new InvalidArgumentException('non-nullable companiesIds cannot be null'); + } $this->container['companiesIds'] = $companiesIds; return $this; @@ -525,9 +537,9 @@ public function setCompaniesIds($companiesIds) /** * Gets reminder * - * @return \Brevo\Client\Models\TaskReminder + * @return \Brevo\Client\Models\TaskReminder|null */ - public function getReminder() + public function getReminder(): ?\Brevo\Client\Models\TaskReminder { return $this->container['reminder']; } @@ -535,89 +547,19 @@ public function getReminder() /** * Sets reminder * - * @param \Brevo\Client\Models\TaskReminder $reminder reminder + * @param \Brevo\Client\Models\TaskReminder|null $reminder reminder * * @return $this */ - public function setReminder($reminder) + public function setReminder(?\Brevo\Client\Models\TaskReminder $reminder): static { + if (is_null($reminder)) { + throw new InvalidArgumentException('non-nullable reminder cannot be null'); + } $this->container['reminder'] = $reminder; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/Deal.php b/lib/Models/Deal.php index 98f05b3..4688b3b 100644 --- a/lib/Models/Deal.php +++ b/lib/Models/Deal.php @@ -2,62 +2,64 @@ /** * Deal * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * Deal Class Doc Comment * - * @category Class * @description Deal Details * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class Deal implements ModelInterface, ArrayAccess +class Deal extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'Deal'; + protected static string $openAPIModelName = 'Deal'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'string', 'attributes' => 'object', 'linkedContactsIds' => 'int[]', @@ -67,9 +69,9 @@ class Deal implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => null, 'attributes' => null, 'linkedContactsIds' => null, @@ -77,32 +79,31 @@ class Deal implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'attributes' => false, + 'linkedContactsIds' => false, + 'linkedCompaniesIds' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'attributes' => 'attributes', 'linkedContactsIds' => 'linkedContactsIds', @@ -112,9 +113,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'attributes' => 'setAttributes', 'linkedContactsIds' => 'setLinkedContactsIds', @@ -124,9 +125,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'attributes' => 'getAttributes', 'linkedContactsIds' => 'getLinkedContactsIds', @@ -137,9 +138,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -147,9 +148,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -157,78 +158,52 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['attributes'] = isset($data['attributes']) ? $data['attributes'] : null; - $this->container['linkedContactsIds'] = isset($data['linkedContactsIds']) ? $data['linkedContactsIds'] : null; - $this->container['linkedCompaniesIds'] = isset($data['linkedCompaniesIds']) ? $data['linkedCompaniesIds'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('linkedContactsIds', $data ?? [], null); + $this->setIfExists('linkedCompaniesIds', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * - * @return string + * @return string|null */ - public function getId() + public function getId(): ?string { return $this->container['id']; } @@ -236,12 +211,15 @@ public function getId() /** * Sets id * - * @param string $id Unique deal id + * @param string|null $id Unique deal id * * @return $this */ - public function setId($id) + public function setId(?string $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -250,9 +228,9 @@ public function setId($id) /** * Gets attributes * - * @return object + * @return object|null */ - public function getAttributes() + public function getAttributes(): ?object { return $this->container['attributes']; } @@ -260,12 +238,15 @@ public function getAttributes() /** * Sets attributes * - * @param object $attributes Deal attributes with values + * @param object|null $attributes Deal attributes with values * * @return $this */ - public function setAttributes($attributes) + public function setAttributes(?object $attributes): static { + if (is_null($attributes)) { + throw new InvalidArgumentException('non-nullable attributes cannot be null'); + } $this->container['attributes'] = $attributes; return $this; @@ -274,9 +255,9 @@ public function setAttributes($attributes) /** * Gets linkedContactsIds * - * @return int[] + * @return int[]|null */ - public function getLinkedContactsIds() + public function getLinkedContactsIds(): ?array { return $this->container['linkedContactsIds']; } @@ -284,12 +265,15 @@ public function getLinkedContactsIds() /** * Sets linkedContactsIds * - * @param int[] $linkedContactsIds Contact ids for contacts linked to this deal + * @param int[]|null $linkedContactsIds Contact ids for contacts linked to this deal * * @return $this */ - public function setLinkedContactsIds($linkedContactsIds) + public function setLinkedContactsIds(?array $linkedContactsIds): static { + if (is_null($linkedContactsIds)) { + throw new InvalidArgumentException('non-nullable linkedContactsIds cannot be null'); + } $this->container['linkedContactsIds'] = $linkedContactsIds; return $this; @@ -298,9 +282,9 @@ public function setLinkedContactsIds($linkedContactsIds) /** * Gets linkedCompaniesIds * - * @return string[] + * @return string[]|null */ - public function getLinkedCompaniesIds() + public function getLinkedCompaniesIds(): ?array { return $this->container['linkedCompaniesIds']; } @@ -308,89 +292,19 @@ public function getLinkedCompaniesIds() /** * Sets linkedCompaniesIds * - * @param string[] $linkedCompaniesIds Companies ids for companies linked to this deal + * @param string[]|null $linkedCompaniesIds Companies ids for companies linked to this deal * * @return $this */ - public function setLinkedCompaniesIds($linkedCompaniesIds) + public function setLinkedCompaniesIds(?array $linkedCompaniesIds): static { + if (is_null($linkedCompaniesIds)) { + throw new InvalidArgumentException('non-nullable linkedCompaniesIds cannot be null'); + } $this->container['linkedCompaniesIds'] = $linkedCompaniesIds; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/DealAttributes.php b/lib/Models/DealAttributes.php deleted file mode 100644 index caec1c0..0000000 --- a/lib/Models/DealAttributes.php +++ /dev/null @@ -1,281 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/DealAttributesInner.php b/lib/Models/DealAttributesInner.php index 50bf339..93660db 100644 --- a/lib/Models/DealAttributesInner.php +++ b/lib/Models/DealAttributesInner.php @@ -2,62 +2,64 @@ /** * DealAttributesInner * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * DealAttributesInner Class Doc Comment * - * @category Class * @description List of attributes * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class DealAttributesInner implements ModelInterface, ArrayAccess +class DealAttributesInner extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'DealAttributes_inner'; + protected static string $openAPIModelName = 'DealAttributes_inner'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'internalName' => 'string', 'label' => 'string', 'attributeTypeName' => 'string', @@ -68,9 +70,9 @@ class DealAttributesInner implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'internalName' => null, 'label' => null, 'attributeTypeName' => null, @@ -79,32 +81,32 @@ class DealAttributesInner implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'internalName' => false, + 'label' => false, + 'attributeTypeName' => false, + 'attributeOptions' => false, + 'isRequired' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'internalName' => 'internalName', 'label' => 'label', 'attributeTypeName' => 'attributeTypeName', @@ -115,9 +117,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'internalName' => 'setInternalName', 'label' => 'setLabel', 'attributeTypeName' => 'setAttributeTypeName', @@ -128,9 +130,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'internalName' => 'getInternalName', 'label' => 'getLabel', 'attributeTypeName' => 'getAttributeTypeName', @@ -142,9 +144,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -152,9 +154,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -162,79 +164,53 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['internalName'] = isset($data['internalName']) ? $data['internalName'] : null; - $this->container['label'] = isset($data['label']) ? $data['label'] : null; - $this->container['attributeTypeName'] = isset($data['attributeTypeName']) ? $data['attributeTypeName'] : null; - $this->container['attributeOptions'] = isset($data['attributeOptions']) ? $data['attributeOptions'] : null; - $this->container['isRequired'] = isset($data['isRequired']) ? $data['isRequired'] : null; + $this->setIfExists('internalName', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); + $this->setIfExists('attributeTypeName', $data ?? [], null); + $this->setIfExists('attributeOptions', $data ?? [], null); + $this->setIfExists('isRequired', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets internalName * - * @return string + * @return string|null */ - public function getInternalName() + public function getInternalName(): ?string { return $this->container['internalName']; } @@ -242,12 +218,15 @@ public function getInternalName() /** * Sets internalName * - * @param string $internalName internalName + * @param string|null $internalName internalName * * @return $this */ - public function setInternalName($internalName) + public function setInternalName(?string $internalName): static { + if (is_null($internalName)) { + throw new InvalidArgumentException('non-nullable internalName cannot be null'); + } $this->container['internalName'] = $internalName; return $this; @@ -256,9 +235,9 @@ public function setInternalName($internalName) /** * Gets label * - * @return string + * @return string|null */ - public function getLabel() + public function getLabel(): ?string { return $this->container['label']; } @@ -266,12 +245,15 @@ public function getLabel() /** * Sets label * - * @param string $label label + * @param string|null $label label * * @return $this */ - public function setLabel($label) + public function setLabel(?string $label): static { + if (is_null($label)) { + throw new InvalidArgumentException('non-nullable label cannot be null'); + } $this->container['label'] = $label; return $this; @@ -280,9 +262,9 @@ public function setLabel($label) /** * Gets attributeTypeName * - * @return string + * @return string|null */ - public function getAttributeTypeName() + public function getAttributeTypeName(): ?string { return $this->container['attributeTypeName']; } @@ -290,12 +272,15 @@ public function getAttributeTypeName() /** * Sets attributeTypeName * - * @param string $attributeTypeName attributeTypeName + * @param string|null $attributeTypeName attributeTypeName * * @return $this */ - public function setAttributeTypeName($attributeTypeName) + public function setAttributeTypeName(?string $attributeTypeName): static { + if (is_null($attributeTypeName)) { + throw new InvalidArgumentException('non-nullable attributeTypeName cannot be null'); + } $this->container['attributeTypeName'] = $attributeTypeName; return $this; @@ -304,9 +289,9 @@ public function setAttributeTypeName($attributeTypeName) /** * Gets attributeOptions * - * @return object[] + * @return object[]|null */ - public function getAttributeOptions() + public function getAttributeOptions(): ?array { return $this->container['attributeOptions']; } @@ -314,12 +299,15 @@ public function getAttributeOptions() /** * Sets attributeOptions * - * @param object[] $attributeOptions attributeOptions + * @param object[]|null $attributeOptions attributeOptions * * @return $this */ - public function setAttributeOptions($attributeOptions) + public function setAttributeOptions(?array $attributeOptions): static { + if (is_null($attributeOptions)) { + throw new InvalidArgumentException('non-nullable attributeOptions cannot be null'); + } $this->container['attributeOptions'] = $attributeOptions; return $this; @@ -328,9 +316,9 @@ public function setAttributeOptions($attributeOptions) /** * Gets isRequired * - * @return bool + * @return bool|null */ - public function getIsRequired() + public function getIsRequired(): ?bool { return $this->container['isRequired']; } @@ -338,89 +326,19 @@ public function getIsRequired() /** * Sets isRequired * - * @param bool $isRequired isRequired + * @param bool|null $isRequired isRequired * * @return $this */ - public function setIsRequired($isRequired) + public function setIsRequired(?bool $isRequired): static { + if (is_null($isRequired)) { + throw new InvalidArgumentException('non-nullable isRequired cannot be null'); + } $this->container['isRequired'] = $isRequired; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/DealsList.php b/lib/Models/DealsList.php index ac398b5..cf7c278 100644 --- a/lib/Models/DealsList.php +++ b/lib/Models/DealsList.php @@ -2,119 +2,117 @@ /** * DealsList * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * DealsList Class Doc Comment * - * @category Class * @description List of Deals * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class DealsList implements ModelInterface, ArrayAccess +class DealsList extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'DealsList'; + protected static string $openAPIModelName = 'DealsList'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'items' => '\Brevo\Client\Models\Deal[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'items' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'items' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'items' => 'items' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'items' => 'setItems' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'items' => 'getItems' ]; @@ -122,9 +120,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -132,9 +130,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -142,75 +140,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['items'] = isset($data['items']) ? $data['items'] : null; + $this->setIfExists('items', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets items * - * @return \Brevo\Client\Models\Deal[] + * @return \Brevo\Client\Models\Deal[]|null */ - public function getItems() + public function getItems(): ?array { return $this->container['items']; } @@ -218,89 +190,19 @@ public function getItems() /** * Sets items * - * @param \Brevo\Client\Models\Deal[] $items List of deals + * @param \Brevo\Client\Models\Deal[]|null $items List of deals * * @return $this */ - public function setItems($items) + public function setItems(?array $items): static { + if (is_null($items)) { + throw new InvalidArgumentException('non-nullable items cannot be null'); + } $this->container['items'] = $items; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/DeleteHardbounces.php b/lib/Models/DeleteHardbounces.php index faf9356..5644f30 100644 --- a/lib/Models/DeleteHardbounces.php +++ b/lib/Models/DeleteHardbounces.php @@ -2,61 +2,63 @@ /** * DeleteHardbounces * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * DeleteHardbounces Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class DeleteHardbounces implements ModelInterface, ArrayAccess +class DeleteHardbounces extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'deleteHardbounces'; + protected static string $openAPIModelName = 'deleteHardbounces'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'startDate' => 'string', 'endDate' => 'string', 'contactEmail' => 'string' @@ -65,41 +67,39 @@ class DeleteHardbounces implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'startDate' => null, 'endDate' => null, 'contactEmail' => 'email' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'startDate' => false, + 'endDate' => false, + 'contactEmail' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'startDate' => 'startDate', 'endDate' => 'endDate', 'contactEmail' => 'contactEmail' @@ -108,9 +108,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'startDate' => 'setStartDate', 'endDate' => 'setEndDate', 'contactEmail' => 'setContactEmail' @@ -119,9 +119,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'startDate' => 'getStartDate', 'endDate' => 'getEndDate', 'contactEmail' => 'getContactEmail' @@ -131,9 +131,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -141,9 +141,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -151,77 +151,51 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['startDate'] = isset($data['startDate']) ? $data['startDate'] : null; - $this->container['endDate'] = isset($data['endDate']) ? $data['endDate'] : null; - $this->container['contactEmail'] = isset($data['contactEmail']) ? $data['contactEmail'] : null; + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('endDate', $data ?? [], null); + $this->setIfExists('contactEmail', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets startDate * - * @return string + * @return string|null */ - public function getStartDate() + public function getStartDate(): ?string { return $this->container['startDate']; } @@ -229,12 +203,15 @@ public function getStartDate() /** * Sets startDate * - * @param string $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 + * @param string|null $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) + public function setStartDate(?string $startDate): static { + if (is_null($startDate)) { + throw new InvalidArgumentException('non-nullable startDate cannot be null'); + } $this->container['startDate'] = $startDate; return $this; @@ -243,9 +220,9 @@ public function setStartDate($startDate) /** * Gets endDate * - * @return string + * @return string|null */ - public function getEndDate() + public function getEndDate(): ?string { return $this->container['endDate']; } @@ -253,12 +230,15 @@ public function getEndDate() /** * Sets endDate * - * @param string $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 + * @param string|null $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) + public function setEndDate(?string $endDate): static { + if (is_null($endDate)) { + throw new InvalidArgumentException('non-nullable endDate cannot be null'); + } $this->container['endDate'] = $endDate; return $this; @@ -267,9 +247,9 @@ public function setEndDate($endDate) /** * Gets contactEmail * - * @return string + * @return string|null */ - public function getContactEmail() + public function getContactEmail(): ?string { return $this->container['contactEmail']; } @@ -277,89 +257,19 @@ public function getContactEmail() /** * Sets contactEmail * - * @param string $contactEmail Target a specific email address + * @param string|null $contactEmail Target a specific email address * * @return $this */ - public function setContactEmail($contactEmail) + public function setContactEmail(?string $contactEmail): static { + if (is_null($contactEmail)) { + throw new InvalidArgumentException('non-nullable contactEmail cannot be null'); + } $this->container['contactEmail'] = $contactEmail; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/DeleteSubscriptionMemberPayload.php b/lib/Models/DeleteSubscriptionMemberPayload.php new file mode 100644 index 0000000..b52751c --- /dev/null +++ b/lib/Models/DeleteSubscriptionMemberPayload.php @@ -0,0 +1,247 @@ + + */ +class DeleteSubscriptionMemberPayload extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'deleteSubscriptionMemberPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'contactId' => 'int', + 'memberContactIds' => 'int[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'contactId' => null, + 'memberContactIds' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'contactId' => false, + 'memberContactIds' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'contactId' => 'contactId', + 'memberContactIds' => 'memberContactIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'contactId' => 'setContactId', + 'memberContactIds' => 'setMemberContactIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'contactId' => 'getContactId', + 'memberContactIds' => 'getMemberContactIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('contactId', $data ?? [], 1); + $this->setIfExists('memberContactIds', $data ?? [], [2]); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['contactId'] === null) { + $invalidProperties[] = "'contactId' can't be null"; + } + if ($this->container['memberContactIds'] === null) { + $invalidProperties[] = "'memberContactIds' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets contactId + * + * @return int + */ + public function getContactId(): int + { + return $this->container['contactId']; + } + + /** + * Sets contactId + * + * @param int $contactId Contact Id + * + * @return $this + */ + public function setContactId(int $contactId): static + { + if (is_null($contactId)) { + throw new InvalidArgumentException('non-nullable contactId cannot be null'); + } + $this->container['contactId'] = $contactId; + + return $this; + } + + /** + * Gets memberContactIds + * + * @return int[] + */ + public function getMemberContactIds(): array + { + return $this->container['memberContactIds']; + } + + /** + * Sets memberContactIds + * + * @param int[] $memberContactIds Member Contact Ids + * + * @return $this + */ + public function setMemberContactIds(array $memberContactIds): static + { + if (is_null($memberContactIds)) { + throw new InvalidArgumentException('non-nullable memberContactIds cannot be null'); + } + $this->container['memberContactIds'] = $memberContactIds; + + return $this; + } +} + + diff --git a/lib/Models/EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response.php b/lib/Models/EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response.php new file mode 100644 index 0000000..20a5657 --- /dev/null +++ b/lib/Models/EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response.php @@ -0,0 +1,427 @@ + + */ +class EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_ecommerce_attribution_metrics__conversionSource___conversionSourceId__get_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'float', + 'conversionSource' => 'string', + 'ordersCount' => 'float', + 'revenue' => 'float', + 'averageBasket' => 'float', + 'newCustomersCount' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'integer', + 'conversionSource' => null, + 'ordersCount' => 'integer', + 'revenue' => 'float', + 'averageBasket' => 'float', + 'newCustomersCount' => 'integer' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'conversionSource' => false, + 'ordersCount' => false, + 'revenue' => false, + 'averageBasket' => false, + 'newCustomersCount' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'conversionSource' => 'conversionSource', + 'ordersCount' => 'ordersCount', + 'revenue' => 'revenue', + 'averageBasket' => 'averageBasket', + 'newCustomersCount' => 'newCustomersCount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'conversionSource' => 'setConversionSource', + 'ordersCount' => 'setOrdersCount', + 'revenue' => 'setRevenue', + 'averageBasket' => 'setAverageBasket', + 'newCustomersCount' => 'setNewCustomersCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'conversionSource' => 'getConversionSource', + 'ordersCount' => 'getOrdersCount', + 'revenue' => 'getRevenue', + 'averageBasket' => 'getAverageBasket', + 'newCustomersCount' => 'getNewCustomersCount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const CONVERSION_SOURCE_EMAIL_CAMPAIGN = 'email_campaign'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getConversionSourceAllowableValues() + { + return [ + self::CONVERSION_SOURCE_EMAIL_CAMPAIGN, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('conversionSource', $data ?? [], null); + $this->setIfExists('ordersCount', $data ?? [], null); + $this->setIfExists('revenue', $data ?? [], null); + $this->setIfExists('averageBasket', $data ?? [], null); + $this->setIfExists('newCustomersCount', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['conversionSource'] === null) { + $invalidProperties[] = "'conversionSource' can't be null"; + } + $allowedValues = $this->getConversionSourceAllowableValues(); + if (!is_null($this->container['conversionSource']) && !in_array($this->container['conversionSource'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'conversionSource', must be one of '%s'", + $this->container['conversionSource'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['ordersCount'] === null) { + $invalidProperties[] = "'ordersCount' can't be null"; + } + if ($this->container['revenue'] === null) { + $invalidProperties[] = "'revenue' can't be null"; + } + if ($this->container['averageBasket'] === null) { + $invalidProperties[] = "'averageBasket' can't be null"; + } + if ($this->container['newCustomersCount'] === null) { + $invalidProperties[] = "'newCustomersCount' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets id + * + * @return float + */ + public function getId(): float + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param float $id id + * + * @return $this + */ + public function setId(float $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets conversionSource + * + * @return string + */ + public function getConversionSource(): string + { + return $this->container['conversionSource']; + } + + /** + * Sets conversionSource + * + * @param string $conversionSource conversionSource + * + * @return $this + */ + public function setConversionSource(string $conversionSource): static + { + if (is_null($conversionSource)) { + throw new InvalidArgumentException('non-nullable conversionSource cannot be null'); + } + $allowedValues = $this->getConversionSourceAllowableValues(); + if (!in_array($conversionSource, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'conversionSource', must be one of '%s'", + $conversionSource, + implode("', '", $allowedValues) + ) + ); + } + $this->container['conversionSource'] = $conversionSource; + + return $this; + } + + /** + * Gets ordersCount + * + * @return float + */ + public function getOrdersCount(): float + { + return $this->container['ordersCount']; + } + + /** + * Sets ordersCount + * + * @param float $ordersCount ordersCount + * + * @return $this + */ + public function setOrdersCount(float $ordersCount): static + { + if (is_null($ordersCount)) { + throw new InvalidArgumentException('non-nullable ordersCount cannot be null'); + } + $this->container['ordersCount'] = $ordersCount; + + return $this; + } + + /** + * Gets revenue + * + * @return float + */ + public function getRevenue(): float + { + return $this->container['revenue']; + } + + /** + * Sets revenue + * + * @param float $revenue revenue + * + * @return $this + */ + public function setRevenue(float $revenue): static + { + if (is_null($revenue)) { + throw new InvalidArgumentException('non-nullable revenue cannot be null'); + } + $this->container['revenue'] = $revenue; + + return $this; + } + + /** + * Gets averageBasket + * + * @return float + */ + public function getAverageBasket(): float + { + return $this->container['averageBasket']; + } + + /** + * Sets averageBasket + * + * @param float $averageBasket averageBasket + * + * @return $this + */ + public function setAverageBasket(float $averageBasket): static + { + if (is_null($averageBasket)) { + throw new InvalidArgumentException('non-nullable averageBasket cannot be null'); + } + $this->container['averageBasket'] = $averageBasket; + + return $this; + } + + /** + * Gets newCustomersCount + * + * @return float + */ + public function getNewCustomersCount(): float + { + return $this->container['newCustomersCount']; + } + + /** + * Sets newCustomersCount + * + * @param float $newCustomersCount newCustomersCount + * + * @return $this + */ + public function setNewCustomersCount(float $newCustomersCount): static + { + if (is_null($newCustomersCount)) { + throw new InvalidArgumentException('non-nullable newCustomersCount cannot be null'); + } + $this->container['newCustomersCount'] = $newCustomersCount; + + return $this; + } +} + + diff --git a/lib/Models/EcommerceAttributionMetricsGet200Response.php b/lib/Models/EcommerceAttributionMetricsGet200Response.php new file mode 100644 index 0000000..5998066 --- /dev/null +++ b/lib/Models/EcommerceAttributionMetricsGet200Response.php @@ -0,0 +1,247 @@ + + */ +class EcommerceAttributionMetricsGet200Response extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_ecommerce_attribution_metrics_get_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'results' => '\Brevo\Client\Models\ConversionSourceMetrics[]', + 'totals' => '\Brevo\Client\Models\EcommerceAttributionMetricsGet200ResponseTotals' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'results' => null, + 'totals' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'results' => false, + 'totals' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'results' => 'results', + 'totals' => 'totals' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'results' => 'setResults', + 'totals' => 'setTotals' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'results' => 'getResults', + 'totals' => 'getTotals' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('totals', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['totals'] === null) { + $invalidProperties[] = "'totals' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets results + * + * @return \Brevo\Client\Models\ConversionSourceMetrics[] + */ + public function getResults(): array + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \Brevo\Client\Models\ConversionSourceMetrics[] $results List of conversion attribution metrics + * + * @return $this + */ + public function setResults(array $results): static + { + if (is_null($results)) { + throw new InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets totals + * + * @return \Brevo\Client\Models\EcommerceAttributionMetricsGet200ResponseTotals + */ + public function getTotals(): \Brevo\Client\Models\EcommerceAttributionMetricsGet200ResponseTotals + { + return $this->container['totals']; + } + + /** + * Sets totals + * + * @param \Brevo\Client\Models\EcommerceAttributionMetricsGet200ResponseTotals $totals totals + * + * @return $this + */ + public function setTotals(\Brevo\Client\Models\EcommerceAttributionMetricsGet200ResponseTotals $totals): static + { + if (is_null($totals)) { + throw new InvalidArgumentException('non-nullable totals cannot be null'); + } + $this->container['totals'] = $totals; + + return $this; + } +} + + diff --git a/lib/Models/EcommerceAttributionMetricsGet200ResponseTotals.php b/lib/Models/EcommerceAttributionMetricsGet200ResponseTotals.php new file mode 100644 index 0000000..45b49bb --- /dev/null +++ b/lib/Models/EcommerceAttributionMetricsGet200ResponseTotals.php @@ -0,0 +1,285 @@ + + */ +class EcommerceAttributionMetricsGet200ResponseTotals extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_ecommerce_attribution_metrics_get_200_response_totals'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'ordersCount' => 'float', + 'revenue' => 'float', + 'averageBasket' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'ordersCount' => 'integer', + 'revenue' => 'float', + 'averageBasket' => 'float' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'ordersCount' => false, + 'revenue' => false, + 'averageBasket' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'ordersCount' => 'ordersCount', + 'revenue' => 'revenue', + 'averageBasket' => 'averageBasket' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'ordersCount' => 'setOrdersCount', + 'revenue' => 'setRevenue', + 'averageBasket' => 'setAverageBasket' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'ordersCount' => 'getOrdersCount', + 'revenue' => 'getRevenue', + 'averageBasket' => 'getAverageBasket' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('ordersCount', $data ?? [], null); + $this->setIfExists('revenue', $data ?? [], null); + $this->setIfExists('averageBasket', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['ordersCount'] === null) { + $invalidProperties[] = "'ordersCount' can't be null"; + } + if ($this->container['revenue'] === null) { + $invalidProperties[] = "'revenue' can't be null"; + } + if ($this->container['averageBasket'] === null) { + $invalidProperties[] = "'averageBasket' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets ordersCount + * + * @return float + */ + public function getOrdersCount(): float + { + return $this->container['ordersCount']; + } + + /** + * Sets ordersCount + * + * @param float $ordersCount ordersCount + * + * @return $this + */ + public function setOrdersCount(float $ordersCount): static + { + if (is_null($ordersCount)) { + throw new InvalidArgumentException('non-nullable ordersCount cannot be null'); + } + $this->container['ordersCount'] = $ordersCount; + + return $this; + } + + /** + * Gets revenue + * + * @return float + */ + public function getRevenue(): float + { + return $this->container['revenue']; + } + + /** + * Sets revenue + * + * @param float $revenue revenue + * + * @return $this + */ + public function setRevenue(float $revenue): static + { + if (is_null($revenue)) { + throw new InvalidArgumentException('non-nullable revenue cannot be null'); + } + $this->container['revenue'] = $revenue; + + return $this; + } + + /** + * Gets averageBasket + * + * @return float + */ + public function getAverageBasket(): float + { + return $this->container['averageBasket']; + } + + /** + * Sets averageBasket + * + * @param float $averageBasket averageBasket + * + * @return $this + */ + public function setAverageBasket(float $averageBasket): static + { + if (is_null($averageBasket)) { + throw new InvalidArgumentException('non-nullable averageBasket cannot be null'); + } + $this->container['averageBasket'] = $averageBasket; + + return $this; + } +} + + diff --git a/lib/Models/EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response.php b/lib/Models/EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response.php new file mode 100644 index 0000000..73c5fb1 --- /dev/null +++ b/lib/Models/EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response.php @@ -0,0 +1,210 @@ + + */ +class EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_ecommerce_attribution_products__conversionSource___conversionSourceId__get_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'products' => '\Brevo\Client\Models\ConversionSourceProduct[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'products' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'products' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'products' => 'products' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'products' => 'setProducts' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'products' => 'getProducts' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('products', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['products'] === null) { + $invalidProperties[] = "'products' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets products + * + * @return \Brevo\Client\Models\ConversionSourceProduct[] + */ + public function getProducts(): array + { + return $this->container['products']; + } + + /** + * Sets products + * + * @param \Brevo\Client\Models\ConversionSourceProduct[] $products List of attributed products + * + * @return $this + */ + public function setProducts(array $products): static + { + if (is_null($products)) { + throw new InvalidArgumentException('non-nullable products cannot be null'); + } + $this->container['products'] = $products; + + return $this; + } +} + + diff --git a/lib/Models/EcommerceConfigDisplayCurrencyGet200Response.php b/lib/Models/EcommerceConfigDisplayCurrencyGet200Response.php new file mode 100644 index 0000000..7612b33 --- /dev/null +++ b/lib/Models/EcommerceConfigDisplayCurrencyGet200Response.php @@ -0,0 +1,210 @@ + + */ +class EcommerceConfigDisplayCurrencyGet200Response extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = '_ecommerce_config_displayCurrency_get_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'code' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'code' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'code' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'code' => 'code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'code' => 'setCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'code' => 'getCode' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('code', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['code'] === null) { + $invalidProperties[] = "'code' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets code + * + * @return string + */ + public function getCode(): string + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string $code ISO 4217 compliant display currency code + * + * @return $this + */ + public function setCode(string $code): static + { + if (is_null($code)) { + throw new InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } +} + + diff --git a/lib/Models/EmailExportRecipients.php b/lib/Models/EmailExportRecipients.php index 522d962..2f3bd6d 100644 --- a/lib/Models/EmailExportRecipients.php +++ b/lib/Models/EmailExportRecipients.php @@ -2,133 +2,132 @@ /** * EmailExportRecipients * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * EmailExportRecipients Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class EmailExportRecipients implements ModelInterface, ArrayAccess +class EmailExportRecipients extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'emailExportRecipients'; + protected static string $openAPIModelName = 'emailExportRecipients'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'notifyURL' => 'string', - 'recipientsType' => 'string' + protected static array $openAPITypes = [ + 'recipientsType' => 'string', + 'notifyURL' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'notifyURL' => 'url', - 'recipientsType' => null + protected static array $openAPIFormats = [ + 'recipientsType' => null, + 'notifyURL' => 'url' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'recipientsType' => false, + 'notifyURL' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ - 'notifyURL' => 'notifyURL', - 'recipientsType' => 'recipientsType' + protected static array $attributeMap = [ + 'recipientsType' => 'recipientsType', + 'notifyURL' => 'notifyURL' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ - 'notifyURL' => 'setNotifyURL', - 'recipientsType' => 'setRecipientsType' + protected static array $setters = [ + 'recipientsType' => 'setRecipientsType', + 'notifyURL' => 'setNotifyURL' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ - 'notifyURL' => 'getNotifyURL', - 'recipientsType' => 'getRecipientsType' + protected static array $getters = [ + 'recipientsType' => 'getRecipientsType', + 'notifyURL' => 'getNotifyURL' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,33 +145,21 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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'; - const RECIPIENTS_TYPE_CLICKERS = 'clickers'; - const RECIPIENTS_TYPE_OPENERS = 'openers'; - const RECIPIENTS_TYPE_SOFT_BOUNCES = 'softBounces'; - const RECIPIENTS_TYPE_HARD_BOUNCES = 'hardBounces'; - const RECIPIENTS_TYPE_UNSUBSCRIBED = 'unsubscribed'; - - + public const RECIPIENTS_TYPE_ALL = 'all'; + public const RECIPIENTS_TYPE_NON_CLICKERS = 'nonClickers'; + public const RECIPIENTS_TYPE_NON_OPENERS = 'nonOpeners'; + public const RECIPIENTS_TYPE_CLICKERS = 'clickers'; + public const RECIPIENTS_TYPE_OPENERS = 'openers'; + public const RECIPIENTS_TYPE_SOFT_BOUNCES = 'softBounces'; + public const RECIPIENTS_TYPE_HARD_BOUNCES = 'hardBounces'; + public const RECIPIENTS_TYPE_UNSUBSCRIBED = 'unsubscribed'; /** * Gets allowable values of the enum @@ -193,32 +180,30 @@ public function getRecipientsTypeAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['notifyURL'] = isset($data['notifyURL']) ? $data['notifyURL'] : null; - $this->container['recipientsType'] = isset($data['recipientsType']) ? $data['recipientsType'] : null; + $this->setIfExists('recipientsType', $data ?? [], null); + $this->setIfExists('notifyURL', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -228,7 +213,8 @@ public function listInvalidProperties() $allowedValues = $this->getRecipientsTypeAllowableValues(); if (!is_null($this->container['recipientsType']) && !in_array($this->container['recipientsType'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'recipientsType', must be one of '%s'", + "invalid value '%s' for 'recipientsType', must be one of '%s'", + $this->container['recipientsType'], implode("', '", $allowedValues) ); } @@ -236,48 +222,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets notifyURL - * - * @return string - */ - public function getNotifyURL() - { - return $this->container['notifyURL']; - } - - /** - * Sets notifyURL - * - * @param string $notifyURL Webhook called once the export process is finished. For reference, https://help.brevo.com/hc/en-us/articles/360007666479 - * - * @return $this - */ - public function setNotifyURL($notifyURL) - { - $this->container['notifyURL'] = $notifyURL; - - return $this; - } - /** * Gets recipientsType * * @return string */ - public function getRecipientsType() + public function getRecipientsType(): string { return $this->container['recipientsType']; } @@ -289,13 +239,17 @@ public function getRecipientsType() * * @return $this */ - public function setRecipientsType($recipientsType) + public function setRecipientsType(string $recipientsType): static { + if (is_null($recipientsType)) { + throw new InvalidArgumentException('non-nullable recipientsType cannot be null'); + } $allowedValues = $this->getRecipientsTypeAllowableValues(); if (!in_array($recipientsType, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'recipientsType', must be one of '%s'", + "Invalid value '%s' for 'recipientsType', must be one of '%s'", + $recipientsType, implode("', '", $allowedValues) ) ); @@ -304,78 +258,32 @@ public function setRecipientsType($recipientsType) return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 + * Gets notifyURL * - * @return void + * @return string|null */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function getNotifyURL(): ?string { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } + return $this->container['notifyURL']; } /** - * Unsets offset. - * - * @param integer $offset Offset + * Sets notifyURL * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object + * @param string|null $notifyURL Webhook called once the export process is finished. For reference, https://help.brevo.com/hc/en-us/articles/360007666479 * - * @return string + * @return $this */ - public function __toString() + public function setNotifyURL(?string $notifyURL): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($notifyURL)) { + throw new InvalidArgumentException('non-nullable notifyURL cannot be null'); } + $this->container['notifyURL'] = $notifyURL; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/ErrorModel.php b/lib/Models/ErrorModel.php index 04797b4..750b68f 100644 --- a/lib/Models/ErrorModel.php +++ b/lib/Models/ErrorModel.php @@ -2,61 +2,63 @@ /** * ErrorModel * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * ErrorModel Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class ErrorModel implements ModelInterface, ArrayAccess +class ErrorModel extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'errorModel'; + protected static string $openAPIModelName = 'errorModel'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'code' => 'string', 'message' => 'string' ]; @@ -64,40 +66,37 @@ class ErrorModel implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'code' => null, 'message' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'code' => false, + 'message' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'code' => 'code', 'message' => 'message' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'code' => 'setCode', 'message' => 'setMessage' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'code' => 'getCode', 'message' => 'getMessage' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,41 +145,29 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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'; - const CODE_CAMPAIGN_PROCESSING = 'campaign_processing'; - const CODE_CAMPAIGN_SENT = 'campaign_sent'; - const CODE_DOCUMENT_NOT_FOUND = 'document_not_found'; - const CODE_RESELLER_PERMISSION_DENIED = 'reseller_permission_denied'; - const CODE_NOT_ENOUGH_CREDITS = 'not_enough_credits'; - const CODE_PERMISSION_DENIED = 'permission_denied'; - const CODE_DUPLICATE_PARAMETER = 'duplicate_parameter'; - const CODE_DUPLICATE_REQUEST = 'duplicate_request'; - const CODE_METHOD_NOT_ALLOWED = 'method_not_allowed'; - const CODE_UNAUTHORIZED = 'unauthorized'; - const CODE_ACCOUNT_UNDER_VALIDATION = 'account_under_validation'; - const CODE_NOT_ACCEPTABLE = 'not_acceptable'; - const CODE_BAD_REQUEST = 'bad_request'; - - + public const CODE_INVALID_PARAMETER = 'invalid_parameter'; + public const CODE_MISSING_PARAMETER = 'missing_parameter'; + public const CODE_OUT_OF_RANGE = 'out_of_range'; + public const CODE_CAMPAIGN_PROCESSING = 'campaign_processing'; + public const CODE_CAMPAIGN_SENT = 'campaign_sent'; + public const CODE_DOCUMENT_NOT_FOUND = 'document_not_found'; + public const CODE_NOT_ENOUGH_CREDITS = 'not_enough_credits'; + public const CODE_PERMISSION_DENIED = 'permission_denied'; + public const CODE_DUPLICATE_PARAMETER = 'duplicate_parameter'; + public const CODE_DUPLICATE_REQUEST = 'duplicate_request'; + public const CODE_METHOD_NOT_ALLOWED = 'method_not_allowed'; + public const CODE_UNAUTHORIZED = 'unauthorized'; + public const CODE_ACCOUNT_UNDER_VALIDATION = 'account_under_validation'; + public const CODE_NOT_ACCEPTABLE = 'not_acceptable'; + public const CODE_BAD_REQUEST = 'bad_request'; + public const CODE_UNPROCESSABLE_ENTITY = 'unprocessable_entity'; /** * Gets allowable values of the enum @@ -196,7 +183,6 @@ public function getCodeAllowableValues() self::CODE_CAMPAIGN_PROCESSING, self::CODE_CAMPAIGN_SENT, self::CODE_DOCUMENT_NOT_FOUND, - self::CODE_RESELLER_PERMISSION_DENIED, self::CODE_NOT_ENOUGH_CREDITS, self::CODE_PERMISSION_DENIED, self::CODE_DUPLICATE_PARAMETER, @@ -206,35 +192,34 @@ public function getCodeAllowableValues() self::CODE_ACCOUNT_UNDER_VALIDATION, self::CODE_NOT_ACCEPTABLE, self::CODE_BAD_REQUEST, + self::CODE_UNPROCESSABLE_ENTITY, ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['code'] = isset($data['code']) ? $data['code'] : null; - $this->container['message'] = isset($data['message']) ? $data['message'] : null; + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -244,7 +229,8 @@ public function listInvalidProperties() $allowedValues = $this->getCodeAllowableValues(); if (!is_null($this->container['code']) && !in_array($this->container['code'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'code', must be one of '%s'", + "invalid value '%s' for 'code', must be one of '%s'", + $this->container['code'], implode("', '", $allowedValues) ); } @@ -255,24 +241,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets code * * @return string */ - public function getCode() + public function getCode(): string { return $this->container['code']; } @@ -284,13 +258,17 @@ public function getCode() * * @return $this */ - public function setCode($code) + public function setCode(string $code): static { + if (is_null($code)) { + throw new InvalidArgumentException('non-nullable code cannot be null'); + } $allowedValues = $this->getCodeAllowableValues(); if (!in_array($code, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'code', must be one of '%s'", + "Invalid value '%s' for 'code', must be one of '%s'", + $code, implode("', '", $allowedValues) ) ); @@ -305,7 +283,7 @@ public function setCode($code) * * @return string */ - public function getMessage() + public function getMessage(): string { return $this->container['message']; } @@ -317,85 +295,15 @@ public function getMessage() * * @return $this */ - public function setMessage($message) + public function setMessage(string $message): static { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/ErrorResponse.php b/lib/Models/ErrorResponse.php new file mode 100644 index 0000000..e86f93c --- /dev/null +++ b/lib/Models/ErrorResponse.php @@ -0,0 +1,207 @@ + + */ +class ErrorResponse extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'errorResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'error' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'error' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'error' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'error' => 'getError' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets error + * + * @return string|null + */ + public function getError(): ?string + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string|null $error Error message indicating what went wrong + * + * @return $this + */ + public function setError(?string $error): static + { + if (is_null($error)) { + throw new InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } +} + + diff --git a/lib/Models/Event.php b/lib/Models/Event.php index e1eaf44..29b0717 100644 --- a/lib/Models/Event.php +++ b/lib/Models/Event.php @@ -2,12 +2,11 @@ /** * Event * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** @@ -15,98 +14,101 @@ * * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * Event Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class Event implements ModelInterface, ArrayAccess +class Event extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'event'; + protected static string $openAPIModelName = 'event'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'eventName' => 'string', - 'eventDate' => 'string', 'identifiers' => '\Brevo\Client\Models\EventIdentifiers', - 'contactProperties' => 'object', - 'eventProperties' => 'object' + 'eventDate' => 'string', + 'contactProperties' => 'array', + 'eventProperties' => 'array' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'eventName' => null, - 'eventDate' => null, 'identifiers' => null, + 'eventDate' => null, 'contactProperties' => null, 'eventProperties' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'eventName' => false, + 'identifiers' => false, + 'eventDate' => false, + 'contactProperties' => false, + 'eventProperties' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'eventName' => 'event_name', - 'eventDate' => 'event_date', 'identifiers' => 'identifiers', + 'eventDate' => 'event_date', 'contactProperties' => 'contact_properties', 'eventProperties' => 'event_properties' ]; @@ -114,12 +116,12 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'eventName' => 'setEventName', - 'eventDate' => 'setEventDate', 'identifiers' => 'setIdentifiers', + 'eventDate' => 'setEventDate', 'contactProperties' => 'setContactProperties', 'eventProperties' => 'setEventProperties' ]; @@ -127,12 +129,12 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'eventName' => 'getEventName', - 'eventDate' => 'getEventDate', 'identifiers' => 'getIdentifiers', + 'eventDate' => 'getEventDate', 'contactProperties' => 'getContactProperties', 'eventProperties' => 'getEventProperties' ]; @@ -141,9 +143,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -151,9 +153,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -161,55 +163,41 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['eventName'] = isset($data['eventName']) ? $data['eventName'] : null; - $this->container['eventDate'] = isset($data['eventDate']) ? $data['eventDate'] : null; - $this->container['identifiers'] = isset($data['identifiers']) ? $data['identifiers'] : null; - $this->container['contactProperties'] = isset($data['contactProperties']) ? $data['contactProperties'] : null; - $this->container['eventProperties'] = isset($data['eventProperties']) ? $data['eventProperties'] : null; + $this->setIfExists('eventName', $data ?? [], null); + $this->setIfExists('identifiers', $data ?? [], null); + $this->setIfExists('eventDate', $data ?? [], null); + $this->setIfExists('contactProperties', $data ?? [], null); + $this->setIfExists('eventProperties', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -222,24 +210,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets eventName * * @return string */ - public function getEventName() + public function getEventName(): string { return $this->container['eventName']; } @@ -251,57 +227,66 @@ public function getEventName() * * @return $this */ - public function setEventName($eventName) + public function setEventName(string $eventName): static { + if (is_null($eventName)) { + throw new InvalidArgumentException('non-nullable eventName cannot be null'); + } $this->container['eventName'] = $eventName; return $this; } /** - * Gets eventDate + * Gets identifiers * - * @return string + * @return \Brevo\Client\Models\EventIdentifiers */ - public function getEventDate() + public function getIdentifiers(): \Brevo\Client\Models\EventIdentifiers { - return $this->container['eventDate']; + return $this->container['identifiers']; } /** - * Sets eventDate + * Sets identifiers * - * @param string $eventDate Timestamp of when the event occurred (e.g. \"2024-01-24T17:39:57+01:00\"). If no value is passed, the timestamp of the event creation is used. + * @param \Brevo\Client\Models\EventIdentifiers $identifiers identifiers * * @return $this */ - public function setEventDate($eventDate) + public function setIdentifiers(\Brevo\Client\Models\EventIdentifiers $identifiers): static { - $this->container['eventDate'] = $eventDate; + if (is_null($identifiers)) { + throw new InvalidArgumentException('non-nullable identifiers cannot be null'); + } + $this->container['identifiers'] = $identifiers; return $this; } /** - * Gets identifiers + * Gets eventDate * - * @return \Brevo\Client\Models\EventIdentifiers + * @return string|null */ - public function getIdentifiers() + public function getEventDate(): ?string { - return $this->container['identifiers']; + return $this->container['eventDate']; } /** - * Sets identifiers + * Sets eventDate * - * @param \Brevo\Client\Models\EventIdentifiers $identifiers identifiers + * @param string|null $eventDate Timestamp of when the event occurred (e.g. \"2024-01-24T17:39:57+01:00\"). If no value is passed, the timestamp of the event creation is used. * * @return $this */ - public function setIdentifiers($identifiers) + public function setEventDate(?string $eventDate): static { - $this->container['identifiers'] = $identifiers; + if (is_null($eventDate)) { + throw new InvalidArgumentException('non-nullable eventDate cannot be null'); + } + $this->container['eventDate'] = $eventDate; return $this; } @@ -309,9 +294,9 @@ public function setIdentifiers($identifiers) /** * Gets contactProperties * - * @return object + * @return array|null */ - public function getContactProperties() + public function getContactProperties(): ?array { return $this->container['contactProperties']; } @@ -319,12 +304,15 @@ public function getContactProperties() /** * Sets contactProperties * - * @param object $contactProperties Properties defining the state of the contact associated to this event. Useful to update contact attributes defined in your contacts database while passing the event. For example: **\"FIRSTNAME\": \"Jane\" , \"AGE\": 37** + * @param array|null $contactProperties Properties defining the state of the contact associated to this event. Useful to update contact attributes defined in your contacts database while passing the event. For example: **\"FIRSTNAME\": \"Jane\" , \"AGE\": 37** * * @return $this */ - public function setContactProperties($contactProperties) + public function setContactProperties(?array $contactProperties): static { + if (is_null($contactProperties)) { + throw new InvalidArgumentException('non-nullable contactProperties cannot be null'); + } $this->container['contactProperties'] = $contactProperties; return $this; @@ -333,9 +321,9 @@ public function setContactProperties($contactProperties) /** * Gets eventProperties * - * @return object + * @return array|null */ - public function getEventProperties() + public function getEventProperties(): ?array { return $this->container['eventProperties']; } @@ -343,89 +331,19 @@ public function getEventProperties() /** * Sets eventProperties * - * @param object $eventProperties Properties of the event. Top level properties and nested properties can be used to better segment contacts and personalise workflow conditions. The following field type are supported: string, number, boolean (true/false), date (Timestamp e.g. \"2024-01-24T17:39:57+01:00\"). Keys are limited to 255 characters, alphanumerical characters and - _ only. Size is limited to 50Kb. + * @param array|null $eventProperties Properties of the event. Top level properties and nested properties can be used to better segment contacts and personalise workflow conditions. The following field type are supported: string, number, boolean (true/false), date (Timestamp e.g. \"2024-01-24T17:39:57+01:00\"). Keys are limited to 255 characters, alphanumerical characters and - _ only. Size is limited to 50Kb. * * @return $this */ - public function setEventProperties($eventProperties) + public function setEventProperties(?array $eventProperties): static { + if (is_null($eventProperties)) { + throw new InvalidArgumentException('non-nullable eventProperties cannot be null'); + } $this->container['eventProperties'] = $eventProperties; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/EventContactPropertiesValue.php b/lib/Models/EventContactPropertiesValue.php new file mode 100644 index 0000000..024ee47 --- /dev/null +++ b/lib/Models/EventContactPropertiesValue.php @@ -0,0 +1,179 @@ + + */ +class EventContactPropertiesValue extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'event_contact_properties_value'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } +} + + diff --git a/lib/Models/EventEventPropertiesValue.php b/lib/Models/EventEventPropertiesValue.php new file mode 100644 index 0000000..3df3721 --- /dev/null +++ b/lib/Models/EventEventPropertiesValue.php @@ -0,0 +1,179 @@ + + */ +class EventEventPropertiesValue extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'event_event_properties_value'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } +} + + diff --git a/lib/Models/EventIdentifiers.php b/lib/Models/EventIdentifiers.php index 0d1d0c6..43aa4d5 100644 --- a/lib/Models/EventIdentifiers.php +++ b/lib/Models/EventIdentifiers.php @@ -2,12 +2,11 @@ /** * EventIdentifiers * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** @@ -15,49 +14,52 @@ * * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * EventIdentifiers Class Doc Comment * - * @category Class * @description Identifies the contact associated with the event. At least one identifier is required. * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class EventIdentifiers implements ModelInterface, ArrayAccess +class EventIdentifiers extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'event_identifiers'; + protected static string $openAPIModelName = 'event_identifiers'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'emailId' => 'string', 'phoneId' => 'string', 'whatsappId' => 'string', @@ -68,9 +70,9 @@ class EventIdentifiers implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'emailId' => null, 'phoneId' => null, 'whatsappId' => null, @@ -79,32 +81,32 @@ class EventIdentifiers implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'emailId' => false, + 'phoneId' => false, + 'whatsappId' => false, + 'landlineNumberId' => false, + 'extId' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'emailId' => 'email_id', 'phoneId' => 'phone_id', 'whatsappId' => 'whatsapp_id', @@ -115,9 +117,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'emailId' => 'setEmailId', 'phoneId' => 'setPhoneId', 'whatsappId' => 'setWhatsappId', @@ -128,9 +130,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'emailId' => 'getEmailId', 'phoneId' => 'getPhoneId', 'whatsappId' => 'getWhatsappId', @@ -142,9 +144,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -152,9 +154,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -162,79 +164,53 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['emailId'] = isset($data['emailId']) ? $data['emailId'] : null; - $this->container['phoneId'] = isset($data['phoneId']) ? $data['phoneId'] : null; - $this->container['whatsappId'] = isset($data['whatsappId']) ? $data['whatsappId'] : null; - $this->container['landlineNumberId'] = isset($data['landlineNumberId']) ? $data['landlineNumberId'] : null; - $this->container['extId'] = isset($data['extId']) ? $data['extId'] : null; + $this->setIfExists('emailId', $data ?? [], null); + $this->setIfExists('phoneId', $data ?? [], null); + $this->setIfExists('whatsappId', $data ?? [], null); + $this->setIfExists('landlineNumberId', $data ?? [], null); + $this->setIfExists('extId', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets emailId * - * @return string + * @return string|null */ - public function getEmailId() + public function getEmailId(): ?string { return $this->container['emailId']; } @@ -242,12 +218,15 @@ public function getEmailId() /** * Sets emailId * - * @param string $emailId Email Id associated with the event + * @param string|null $emailId Email Id associated with the event * * @return $this */ - public function setEmailId($emailId) + public function setEmailId(?string $emailId): static { + if (is_null($emailId)) { + throw new InvalidArgumentException('non-nullable emailId cannot be null'); + } $this->container['emailId'] = $emailId; return $this; @@ -256,9 +235,9 @@ public function setEmailId($emailId) /** * Gets phoneId * - * @return string + * @return string|null */ - public function getPhoneId() + public function getPhoneId(): ?string { return $this->container['phoneId']; } @@ -266,12 +245,15 @@ public function getPhoneId() /** * Sets phoneId * - * @param string $phoneId SMS associated with the event + * @param string|null $phoneId SMS associated with the event * * @return $this */ - public function setPhoneId($phoneId) + public function setPhoneId(?string $phoneId): static { + if (is_null($phoneId)) { + throw new InvalidArgumentException('non-nullable phoneId cannot be null'); + } $this->container['phoneId'] = $phoneId; return $this; @@ -280,9 +262,9 @@ public function setPhoneId($phoneId) /** * Gets whatsappId * - * @return string + * @return string|null */ - public function getWhatsappId() + public function getWhatsappId(): ?string { return $this->container['whatsappId']; } @@ -290,12 +272,15 @@ public function getWhatsappId() /** * Sets whatsappId * - * @param string $whatsappId whatsapp associated with the event + * @param string|null $whatsappId whatsapp associated with the event * * @return $this */ - public function setWhatsappId($whatsappId) + public function setWhatsappId(?string $whatsappId): static { + if (is_null($whatsappId)) { + throw new InvalidArgumentException('non-nullable whatsappId cannot be null'); + } $this->container['whatsappId'] = $whatsappId; return $this; @@ -304,9 +289,9 @@ public function setWhatsappId($whatsappId) /** * Gets landlineNumberId * - * @return string + * @return string|null */ - public function getLandlineNumberId() + public function getLandlineNumberId(): ?string { return $this->container['landlineNumberId']; } @@ -314,12 +299,15 @@ public function getLandlineNumberId() /** * Sets landlineNumberId * - * @param string $landlineNumberId landline_number associated with the event + * @param string|null $landlineNumberId landline_number associated with the event * * @return $this */ - public function setLandlineNumberId($landlineNumberId) + public function setLandlineNumberId(?string $landlineNumberId): static { + if (is_null($landlineNumberId)) { + throw new InvalidArgumentException('non-nullable landlineNumberId cannot be null'); + } $this->container['landlineNumberId'] = $landlineNumberId; return $this; @@ -328,9 +316,9 @@ public function setLandlineNumberId($landlineNumberId) /** * Gets extId * - * @return string + * @return string|null */ - public function getExtId() + public function getExtId(): ?string { return $this->container['extId']; } @@ -338,89 +326,19 @@ public function getExtId() /** * Sets extId * - * @param string $extId ext_id associated with the event + * @param string|null $extId ext_id associated with the event * * @return $this */ - public function setExtId($extId) + public function setExtId(?string $extId): static { + if (is_null($extId)) { + throw new InvalidArgumentException('non-nullable extId cannot be null'); + } $this->container['extId'] = $extId; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/ExportWebhooksHistory.php b/lib/Models/ExportWebhooksHistory.php index 5f8a096..9d0a9f8 100644 --- a/lib/Models/ExportWebhooksHistory.php +++ b/lib/Models/ExportWebhooksHistory.php @@ -2,68 +2,70 @@ /** * ExportWebhooksHistory * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * ExportWebhooksHistory Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class ExportWebhooksHistory implements ModelInterface, ArrayAccess +class ExportWebhooksHistory extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'exportWebhooksHistory'; + protected static string $openAPIModelName = 'exportWebhooksHistory'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ + 'type' => 'string', + 'event' => 'string', + 'notifyURL' => 'string', 'days' => 'int', 'startDate' => 'string', 'endDate' => 'string', 'sort' => 'string', - 'type' => 'string', - 'event' => 'string', - 'notifyURL' => 'string', 'webhookId' => 'int', 'email' => 'string', 'messageId' => 'int' @@ -72,55 +74,60 @@ class ExportWebhooksHistory implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ + 'type' => null, + 'event' => null, + 'notifyURL' => null, 'days' => null, 'startDate' => null, 'endDate' => null, 'sort' => null, - 'type' => null, - 'event' => null, - 'notifyURL' => null, 'webhookId' => null, 'email' => null, 'messageId' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'event' => false, + 'notifyURL' => false, + 'days' => false, + 'startDate' => false, + 'endDate' => false, + 'sort' => false, + 'webhookId' => false, + 'email' => false, + 'messageId' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ + 'type' => 'type', + 'event' => 'event', + 'notifyURL' => 'notifyURL', 'days' => 'days', 'startDate' => 'startDate', 'endDate' => 'endDate', 'sort' => 'sort', - 'type' => 'type', - 'event' => 'event', - 'notifyURL' => 'notifyURL', 'webhookId' => 'webhookId', 'email' => 'email', 'messageId' => 'messageId' @@ -129,16 +136,16 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ + 'type' => 'setType', + 'event' => 'setEvent', + 'notifyURL' => 'setNotifyURL', 'days' => 'setDays', 'startDate' => 'setStartDate', 'endDate' => 'setEndDate', 'sort' => 'setSort', - 'type' => 'setType', - 'event' => 'setEvent', - 'notifyURL' => 'setNotifyURL', 'webhookId' => 'setWebhookId', 'email' => 'setEmail', 'messageId' => 'setMessageId' @@ -147,16 +154,16 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ + 'type' => 'getType', + 'event' => 'getEvent', + 'notifyURL' => 'getNotifyURL', 'days' => 'getDays', 'startDate' => 'getStartDate', 'endDate' => 'getEndDate', 'sort' => 'getSort', - 'type' => 'getType', - 'event' => 'getEvent', - 'notifyURL' => 'getNotifyURL', 'webhookId' => 'getWebhookId', 'email' => 'getEmail', 'messageId' => 'getMessageId' @@ -166,9 +173,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -176,9 +183,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -186,44 +193,32 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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'; - const EVENT_INVALID_PARAMETER = 'invalid_parameter'; - const EVENT_MISSING_PARAMETER = 'missing_parameter'; - const EVENT_HARD_BOUNCE = 'hardBounce'; - const EVENT_SOFT_BOUNCE = 'softBounce'; - const EVENT_DELIVERED = 'delivered\"'; - const EVENT_SPAM = 'spam'; - const EVENT_REQUEST = 'request'; - const EVENT_OPENED = 'opened'; - const EVENT_CLICK = 'click'; - const EVENT_INVALID = 'invalid'; - const EVENT_DEFERRED = 'deferred'; - const EVENT_BLOCKED = 'blocked'; - const EVENT_UNSUBSCRIBED = 'unsubscribed'; - const EVENT_ERROR = 'error'; - const EVENT_UNIQUE_OPENED = 'uniqueOpened'; - const EVENT_LOADED_BY_PROXY = 'loadedByProxy'; - const EVENT_ALL_EVENTS = 'allEvents'; - - + public const TYPE_TRANSACTIONAL = 'transactional'; + public const TYPE_MARKETING = 'marketing'; + public const EVENT_INVALID_PARAMETER = 'invalid_parameter'; + public const EVENT_MISSING_PARAMETER = 'missing_parameter'; + public const EVENT_HARD_BOUNCE = 'hardBounce'; + public const EVENT_SOFT_BOUNCE = 'softBounce'; + public const EVENT_DELIVERED = 'delivered'; + public const EVENT_SPAM = 'spam'; + public const EVENT_REQUEST = 'request'; + public const EVENT_OPENED = 'opened'; + public const EVENT_CLICK = 'click'; + public const EVENT_INVALID = 'invalid'; + public const EVENT_DEFERRED = 'deferred'; + public const EVENT_BLOCKED = 'blocked'; + public const EVENT_UNSUBSCRIBED = 'unsubscribed'; + public const EVENT_ERROR = 'error'; + public const EVENT_UNIQUE_OPENED = 'uniqueOpened'; + public const EVENT_LOADED_BY_PROXY = 'loadedByProxy'; + public const EVENT_ALL_EVENTS = 'allEvents'; /** * Gets allowable values of the enum @@ -266,40 +261,38 @@ public function getEventAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['days'] = isset($data['days']) ? $data['days'] : null; - $this->container['startDate'] = isset($data['startDate']) ? $data['startDate'] : null; - $this->container['endDate'] = isset($data['endDate']) ? $data['endDate'] : null; - $this->container['sort'] = isset($data['sort']) ? $data['sort'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['event'] = isset($data['event']) ? $data['event'] : null; - $this->container['notifyURL'] = isset($data['notifyURL']) ? $data['notifyURL'] : null; - $this->container['webhookId'] = isset($data['webhookId']) ? $data['webhookId'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['messageId'] = isset($data['messageId']) ? $data['messageId'] : null; + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('event', $data ?? [], null); + $this->setIfExists('notifyURL', $data ?? [], null); + $this->setIfExists('days', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('endDate', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('webhookId', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('messageId', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -309,7 +302,8 @@ public function listInvalidProperties() $allowedValues = $this->getTypeAllowableValues(); if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], implode("', '", $allowedValues) ); } @@ -320,7 +314,8 @@ public function listInvalidProperties() $allowedValues = $this->getEventAllowableValues(); if (!is_null($this->container['event']) && !in_array($this->container['event'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'event', must be one of '%s'", + "invalid value '%s' for 'event', must be one of '%s'", + $this->container['event'], implode("', '", $allowedValues) ); } @@ -332,199 +327,210 @@ public function listInvalidProperties() } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets days + * Gets type * - * @return int + * @return string */ - public function getDays() + public function getType(): string { - return $this->container['days']; + return $this->container['type']; } /** - * Sets days + * Sets type * - * @param int $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ + * @param string $type Filter the history based on webhook type * * @return $this */ - public function setDays($days) + public function setType(string $type): static { - $this->container['days'] = $days; + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; return $this; } /** - * Gets startDate + * Gets event * * @return string */ - public function getStartDate() + public function getEvent(): string { - return $this->container['startDate']; + return $this->container['event']; } /** - * Sets startDate + * Sets event * - * @param string $startDate Mandatory if endDate is used. Starting date of the history (YYYY-MM-DD). Must be lower than equal to endDate + * @param string $event Filter the history for a specific event type * * @return $this */ - public function setStartDate($startDate) + public function setEvent(string $event): static { - $this->container['startDate'] = $startDate; + if (is_null($event)) { + throw new InvalidArgumentException('non-nullable event cannot be null'); + } + $allowedValues = $this->getEventAllowableValues(); + if (!in_array($event, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'event', must be one of '%s'", + $event, + implode("', '", $allowedValues) + ) + ); + } + $this->container['event'] = $event; return $this; } /** - * Gets endDate + * Gets notifyURL * * @return string */ - public function getEndDate() + public function getNotifyURL(): string { - return $this->container['endDate']; + return $this->container['notifyURL']; } /** - * Sets endDate + * Sets notifyURL * - * @param string $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate + * @param string $notifyURL Webhook URL to receive CSV file link * * @return $this */ - public function setEndDate($endDate) + public function setNotifyURL(string $notifyURL): static { - $this->container['endDate'] = $endDate; + if (is_null($notifyURL)) { + throw new InvalidArgumentException('non-nullable notifyURL cannot be null'); + } + $this->container['notifyURL'] = $notifyURL; return $this; } /** - * Gets sort + * Gets days * - * @return string + * @return int|null */ - public function getSort() + public function getDays(): ?int { - return $this->container['sort']; + return $this->container['days']; } /** - * Sets sort + * Sets days * - * @param string $sort Sorting order of records (asc or desc) + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ * * @return $this */ - public function setSort($sort) + public function setDays(?int $days): static { - $this->container['sort'] = $sort; + if (is_null($days)) { + throw new InvalidArgumentException('non-nullable days cannot be null'); + } + $this->container['days'] = $days; return $this; } /** - * Gets type + * Gets startDate * - * @return string + * @return string|null */ - public function getType() + public function getStartDate(): ?string { - return $this->container['type']; + return $this->container['startDate']; } /** - * Sets type + * Sets startDate * - * @param string $type Filter the history based on webhook type + * @param string|null $startDate Mandatory if endDate is used. Starting date of the history (YYYY-MM-DD). Must be lower than equal to endDate * * @return $this */ - public function setType($type) + public function setStartDate(?string $startDate): static { - $allowedValues = $this->getTypeAllowableValues(); - if (!in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'type', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); + if (is_null($startDate)) { + throw new InvalidArgumentException('non-nullable startDate cannot be null'); } - $this->container['type'] = $type; + $this->container['startDate'] = $startDate; return $this; } /** - * Gets event + * Gets endDate * - * @return string + * @return string|null */ - public function getEvent() + public function getEndDate(): ?string { - return $this->container['event']; + return $this->container['endDate']; } /** - * Sets event + * Sets endDate * - * @param string $event Filter the history for a specific event type + * @param string|null $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate * * @return $this */ - public function setEvent($event) + public function setEndDate(?string $endDate): static { - $allowedValues = $this->getEventAllowableValues(); - if (!in_array($event, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'event', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); + if (is_null($endDate)) { + throw new InvalidArgumentException('non-nullable endDate cannot be null'); } - $this->container['event'] = $event; + $this->container['endDate'] = $endDate; return $this; } /** - * Gets notifyURL + * Gets sort * - * @return string + * @return string|null */ - public function getNotifyURL() + public function getSort(): ?string { - return $this->container['notifyURL']; + return $this->container['sort']; } /** - * Sets notifyURL + * Sets sort * - * @param string $notifyURL Webhook URL to receive CSV file link + * @param string|null $sort Sorting order of records (asc or desc) * * @return $this */ - public function setNotifyURL($notifyURL) + public function setSort(?string $sort): static { - $this->container['notifyURL'] = $notifyURL; + if (is_null($sort)) { + throw new InvalidArgumentException('non-nullable sort cannot be null'); + } + $this->container['sort'] = $sort; return $this; } @@ -532,9 +538,9 @@ public function setNotifyURL($notifyURL) /** * Gets webhookId * - * @return int + * @return int|null */ - public function getWebhookId() + public function getWebhookId(): ?int { return $this->container['webhookId']; } @@ -542,12 +548,15 @@ public function getWebhookId() /** * Sets webhookId * - * @param int $webhookId Filter the history for a specific webhook id + * @param int|null $webhookId Filter the history for a specific webhook id * * @return $this */ - public function setWebhookId($webhookId) + public function setWebhookId(?int $webhookId): static { + if (is_null($webhookId)) { + throw new InvalidArgumentException('non-nullable webhookId cannot be null'); + } $this->container['webhookId'] = $webhookId; return $this; @@ -556,9 +565,9 @@ public function setWebhookId($webhookId) /** * Gets email * - * @return string + * @return string|null */ - public function getEmail() + public function getEmail(): ?string { return $this->container['email']; } @@ -566,12 +575,15 @@ public function getEmail() /** * Sets email * - * @param string $email Filter the history for a specific email + * @param string|null $email Filter the history for a specific email * * @return $this */ - public function setEmail($email) + public function setEmail(?string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -580,9 +592,9 @@ public function setEmail($email) /** * Gets messageId * - * @return int + * @return int|null */ - public function getMessageId() + public function getMessageId(): ?int { return $this->container['messageId']; } @@ -590,89 +602,19 @@ public function getMessageId() /** * Sets messageId * - * @param int $messageId Filter the history for a specific message id. Applicable only for transactional webhooks. + * @param int|null $messageId Filter the history for a specific message id. Applicable only for transactional webhooks. * * @return $this */ - public function setMessageId($messageId) + public function setMessageId(?int $messageId): static { + if (is_null($messageId)) { + throw new InvalidArgumentException('non-nullable messageId cannot be null'); + } $this->container['messageId'] = $messageId; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/ExportWebhooksHistoryRequest.php b/lib/Models/ExportWebhooksHistoryRequest.php new file mode 100644 index 0000000..faa850e --- /dev/null +++ b/lib/Models/ExportWebhooksHistoryRequest.php @@ -0,0 +1,620 @@ + + */ +class ExportWebhooksHistoryRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'exportWebhooksHistory_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => 'string', + 'event' => 'string', + 'notifyURL' => 'string', + 'days' => 'int', + 'startDate' => 'string', + 'endDate' => 'string', + 'sort' => 'string', + 'webhookId' => 'int', + 'email' => 'string', + 'messageId' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'event' => null, + 'notifyURL' => null, + 'days' => null, + 'startDate' => null, + 'endDate' => null, + 'sort' => null, + 'webhookId' => null, + 'email' => null, + 'messageId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'event' => false, + 'notifyURL' => false, + 'days' => false, + 'startDate' => false, + 'endDate' => false, + 'sort' => false, + 'webhookId' => false, + 'email' => false, + 'messageId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'event' => 'event', + 'notifyURL' => 'notifyURL', + 'days' => 'days', + 'startDate' => 'startDate', + 'endDate' => 'endDate', + 'sort' => 'sort', + 'webhookId' => 'webhookId', + 'email' => 'email', + 'messageId' => 'messageId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'event' => 'setEvent', + 'notifyURL' => 'setNotifyURL', + 'days' => 'setDays', + 'startDate' => 'setStartDate', + 'endDate' => 'setEndDate', + 'sort' => 'setSort', + 'webhookId' => 'setWebhookId', + 'email' => 'setEmail', + 'messageId' => 'setMessageId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'event' => 'getEvent', + 'notifyURL' => 'getNotifyURL', + 'days' => 'getDays', + 'startDate' => 'getStartDate', + 'endDate' => 'getEndDate', + 'sort' => 'getSort', + 'webhookId' => 'getWebhookId', + 'email' => 'getEmail', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const TYPE_TRANSACTIONAL = 'transactional'; + public const TYPE_MARKETING = 'marketing'; + public const EVENT_INVALID_PARAMETER = 'invalid_parameter'; + public const EVENT_MISSING_PARAMETER = 'missing_parameter'; + public const EVENT_HARD_BOUNCE = 'hardBounce'; + public const EVENT_SOFT_BOUNCE = 'softBounce'; + public const EVENT_DELIVERED = 'delivered'; + public const EVENT_SPAM = 'spam'; + public const EVENT_REQUEST = 'request'; + public const EVENT_OPENED = 'opened'; + public const EVENT_CLICK = 'click'; + public const EVENT_INVALID = 'invalid'; + public const EVENT_DEFERRED = 'deferred'; + public const EVENT_BLOCKED = 'blocked'; + public const EVENT_UNSUBSCRIBED = 'unsubscribed'; + public const EVENT_ERROR = 'error'; + public const EVENT_UNIQUE_OPENED = 'uniqueOpened'; + public const EVENT_LOADED_BY_PROXY = 'loadedByProxy'; + public const EVENT_ALL_EVENTS = 'allEvents'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_TRANSACTIONAL, + self::TYPE_MARKETING, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEventAllowableValues() + { + return [ + self::EVENT_INVALID_PARAMETER, + self::EVENT_MISSING_PARAMETER, + self::EVENT_HARD_BOUNCE, + self::EVENT_SOFT_BOUNCE, + self::EVENT_DELIVERED, + self::EVENT_SPAM, + self::EVENT_REQUEST, + self::EVENT_OPENED, + self::EVENT_CLICK, + self::EVENT_INVALID, + self::EVENT_DEFERRED, + self::EVENT_BLOCKED, + self::EVENT_UNSUBSCRIBED, + self::EVENT_ERROR, + self::EVENT_UNIQUE_OPENED, + self::EVENT_LOADED_BY_PROXY, + self::EVENT_ALL_EVENTS, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('event', $data ?? [], null); + $this->setIfExists('notifyURL', $data ?? [], null); + $this->setIfExists('days', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('endDate', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('webhookId', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('messageId', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['event'] === null) { + $invalidProperties[] = "'event' can't be null"; + } + $allowedValues = $this->getEventAllowableValues(); + if (!is_null($this->container['event']) && !in_array($this->container['event'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'event', must be one of '%s'", + $this->container['event'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['notifyURL'] === null) { + $invalidProperties[] = "'notifyURL' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets type + * + * @return string + */ + public function getType(): string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type Filter the history based on webhook type + * + * @return $this + */ + public function setType(string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets event + * + * @return string + */ + public function getEvent(): string + { + return $this->container['event']; + } + + /** + * Sets event + * + * @param string $event Filter the history for a specific event type + * + * @return $this + */ + public function setEvent(string $event): static + { + if (is_null($event)) { + throw new InvalidArgumentException('non-nullable event cannot be null'); + } + $allowedValues = $this->getEventAllowableValues(); + if (!in_array($event, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'event', must be one of '%s'", + $event, + implode("', '", $allowedValues) + ) + ); + } + $this->container['event'] = $event; + + return $this; + } + + /** + * Gets notifyURL + * + * @return string + */ + public function getNotifyURL(): string + { + return $this->container['notifyURL']; + } + + /** + * Sets notifyURL + * + * @param string $notifyURL Webhook URL to receive CSV file link + * + * @return $this + */ + public function setNotifyURL(string $notifyURL): static + { + if (is_null($notifyURL)) { + throw new InvalidArgumentException('non-nullable notifyURL cannot be null'); + } + $this->container['notifyURL'] = $notifyURL; + + return $this; + } + + /** + * Gets days + * + * @return int|null + */ + public function getDays(): ?int + { + return $this->container['days']; + } + + /** + * Sets days + * + * @param int|null $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ + * + * @return $this + */ + public function setDays(?int $days): static + { + if (is_null($days)) { + throw new InvalidArgumentException('non-nullable days cannot be null'); + } + $this->container['days'] = $days; + + return $this; + } + + /** + * Gets startDate + * + * @return string|null + */ + public function getStartDate(): ?string + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param string|null $startDate Mandatory if endDate is used. Starting date of the history (YYYY-MM-DD). Must be lower than equal to endDate + * + * @return $this + */ + public function setStartDate(?string $startDate): static + { + if (is_null($startDate)) { + throw new InvalidArgumentException('non-nullable startDate cannot be null'); + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets endDate + * + * @return string|null + */ + public function getEndDate(): ?string + { + return $this->container['endDate']; + } + + /** + * Sets endDate + * + * @param string|null $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate + * + * @return $this + */ + public function setEndDate(?string $endDate): static + { + if (is_null($endDate)) { + throw new InvalidArgumentException('non-nullable endDate cannot be null'); + } + $this->container['endDate'] = $endDate; + + return $this; + } + + /** + * Gets sort + * + * @return string|null + */ + public function getSort(): ?string + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param string|null $sort Sorting order of records (asc or desc) + * + * @return $this + */ + public function setSort(?string $sort): static + { + if (is_null($sort)) { + throw new InvalidArgumentException('non-nullable sort cannot be null'); + } + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets webhookId + * + * @return int|null + */ + public function getWebhookId(): ?int + { + return $this->container['webhookId']; + } + + /** + * Sets webhookId + * + * @param int|null $webhookId Filter the history for a specific webhook id + * + * @return $this + */ + public function setWebhookId(?int $webhookId): static + { + if (is_null($webhookId)) { + throw new InvalidArgumentException('non-nullable webhookId cannot be null'); + } + $this->container['webhookId'] = $webhookId; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail(): ?string + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Filter the history for a specific email + * + * @return $this + */ + public function setEmail(?string $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets messageId + * + * @return int|null + */ + public function getMessageId(): ?int + { + return $this->container['messageId']; + } + + /** + * Sets messageId + * + * @param int|null $messageId Filter the history for a specific message id. Applicable only for transactional webhooks. + * + * @return $this + */ + public function setMessageId(?int $messageId): static + { + if (is_null($messageId)) { + throw new InvalidArgumentException('non-nullable messageId cannot be null'); + } + $this->container['messageId'] = $messageId; + + return $this; + } +} + + diff --git a/lib/Models/FileData.php b/lib/Models/FileData.php index 215c76b..0aa9dcf 100644 --- a/lib/Models/FileData.php +++ b/lib/Models/FileData.php @@ -2,179 +2,163 @@ /** * FileData * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * FileData Class Doc Comment * - * @category Class * @description File data that is uploaded * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class FileData implements ModelInterface, ArrayAccess +class FileData extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'FileData'; + protected static string $openAPIModelName = 'FileData'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'url' => 'string', - 'id' => 'string', + protected static array $openAPITypes = [ 'name' => 'string', 'authorId' => 'string', - 'author' => 'object', 'contactId' => 'int', 'dealId' => 'string', 'companyId' => 'string', 'size' => 'int', - 'createdAt' => '\DateTime', - 'updatedAt' => '\DateTime' + 'createdAt' => '\DateTime' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'url' => null, - 'id' => null, + protected static array $openAPIFormats = [ 'name' => null, 'authorId' => null, - 'author' => null, 'contactId' => 'int64', 'dealId' => null, 'companyId' => null, 'size' => 'int64', - 'createdAt' => 'date-time', - 'updatedAt' => 'date-time' + 'createdAt' => 'date-time' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'authorId' => false, + 'contactId' => false, + 'dealId' => false, + 'companyId' => false, + 'size' => false, + 'createdAt' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ - 'url' => 'url', - 'id' => 'id', + protected static array $attributeMap = [ 'name' => 'name', 'authorId' => 'authorId', - 'author' => 'author', 'contactId' => 'contactId', 'dealId' => 'dealId', 'companyId' => 'companyId', 'size' => 'size', - 'createdAt' => 'createdAt', - 'updatedAt' => 'updatedAt' + 'createdAt' => 'createdAt' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ - 'url' => 'setUrl', - 'id' => 'setId', + protected static array $setters = [ 'name' => 'setName', 'authorId' => 'setAuthorId', - 'author' => 'setAuthor', 'contactId' => 'setContactId', 'dealId' => 'setDealId', 'companyId' => 'setCompanyId', 'size' => 'setSize', - 'createdAt' => 'setCreatedAt', - 'updatedAt' => 'setUpdatedAt' + 'createdAt' => 'setCreatedAt' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ - 'url' => 'getUrl', - 'id' => 'getId', + protected static array $getters = [ 'name' => 'getName', 'authorId' => 'getAuthorId', - 'author' => 'getAuthor', 'contactId' => 'getContactId', 'dealId' => 'getDealId', 'companyId' => 'getCompanyId', 'size' => 'getSize', - 'createdAt' => 'getCreatedAt', - 'updatedAt' => 'getUpdatedAt' + 'createdAt' => 'getCreatedAt' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -182,9 +166,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -192,133 +176,55 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['authorId'] = isset($data['authorId']) ? $data['authorId'] : null; - $this->container['author'] = isset($data['author']) ? $data['author'] : null; - $this->container['contactId'] = isset($data['contactId']) ? $data['contactId'] : null; - $this->container['dealId'] = isset($data['dealId']) ? $data['dealId'] : null; - $this->container['companyId'] = isset($data['companyId']) ? $data['companyId'] : null; - $this->container['size'] = isset($data['size']) ? $data['size'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['updatedAt'] = isset($data['updatedAt']) ? $data['updatedAt'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('authorId', $data ?? [], null); + $this->setIfExists('contactId', $data ?? [], null); + $this->setIfExists('dealId', $data ?? [], null); + $this->setIfExists('companyId', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets url - * - * @return string - */ - public function getUrl() - { - return $this->container['url']; - } - - /** - * Sets url - * - * @param string $url Url of uploaded file - * - * @return $this - */ - public function setUrl($url) - { - $this->container['url'] = $url; - - return $this; - } - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id Id of uploaded file - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - /** * Gets name * - * @return string + * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -326,12 +232,15 @@ public function getName() /** * Sets name * - * @param string $name Name of uploaded file + * @param string|null $name Name of uploaded file * * @return $this */ - public function setName($name) + public function setName(?string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -340,9 +249,9 @@ public function setName($name) /** * Gets authorId * - * @return string + * @return string|null */ - public function getAuthorId() + public function getAuthorId(): ?string { return $this->container['authorId']; } @@ -350,12 +259,15 @@ public function getAuthorId() /** * Sets authorId * - * @param string $authorId Account id of user which created the file + * @param string|null $authorId Account id of user which created the file * * @return $this */ - public function setAuthorId($authorId) + public function setAuthorId(?string $authorId): static { + if (is_null($authorId)) { + throw new InvalidArgumentException('non-nullable authorId cannot be null'); + } $this->container['authorId'] = $authorId; return $this; @@ -364,9 +276,9 @@ public function setAuthorId($authorId) /** * Gets contactId * - * @return int + * @return int|null */ - public function getContactId() + public function getContactId(): ?int { return $this->container['contactId']; } @@ -374,12 +286,15 @@ public function getContactId() /** * Sets contactId * - * @param int $contactId Contact id of contact on which file is uploaded + * @param int|null $contactId Contact id of contact on which file is uploaded * * @return $this */ - public function setContactId($contactId) + public function setContactId(?int $contactId): static { + if (is_null($contactId)) { + throw new InvalidArgumentException('non-nullable contactId cannot be null'); + } $this->container['contactId'] = $contactId; return $this; @@ -388,9 +303,9 @@ public function setContactId($contactId) /** * Gets dealId * - * @return string + * @return string|null */ - public function getDealId() + public function getDealId(): ?string { return $this->container['dealId']; } @@ -398,12 +313,15 @@ public function getDealId() /** * Sets dealId * - * @param string $dealId Deal id linked to a file + * @param string|null $dealId Deal id linked to a file * * @return $this */ - public function setDealId($dealId) + public function setDealId(?string $dealId): static { + if (is_null($dealId)) { + throw new InvalidArgumentException('non-nullable dealId cannot be null'); + } $this->container['dealId'] = $dealId; return $this; @@ -412,9 +330,9 @@ public function setDealId($dealId) /** * Gets companyId * - * @return string + * @return string|null */ - public function getCompanyId() + public function getCompanyId(): ?string { return $this->container['companyId']; } @@ -422,12 +340,15 @@ public function getCompanyId() /** * Sets companyId * - * @param string $companyId Company id linked to a file + * @param string|null $companyId Company id linked to a file * * @return $this */ - public function setCompanyId($companyId) + public function setCompanyId(?string $companyId): static { + if (is_null($companyId)) { + throw new InvalidArgumentException('non-nullable companyId cannot be null'); + } $this->container['companyId'] = $companyId; return $this; @@ -436,9 +357,9 @@ public function setCompanyId($companyId) /** * Gets size * - * @return int + * @return int|null */ - public function getSize() + public function getSize(): ?int { return $this->container['size']; } @@ -446,12 +367,15 @@ public function getSize() /** * Sets size * - * @param int $size Size of file in bytes + * @param int|null $size Size of file in bytes * * @return $this */ - public function setSize($size) + public function setSize(?int $size): static { + if (is_null($size)) { + throw new InvalidArgumentException('non-nullable size cannot be null'); + } $this->container['size'] = $size; return $this; @@ -460,9 +384,9 @@ public function setSize($size) /** * Gets createdAt * - * @return \DateTime + * @return \DateTime|null */ - public function getCreatedAt() + public function getCreatedAt(): ?\DateTime { return $this->container['createdAt']; } @@ -470,113 +394,19 @@ public function getCreatedAt() /** * Sets createdAt * - * @param \DateTime $createdAt File created date/time + * @param \DateTime|null $createdAt File created date/time * * @return $this */ - public function setCreatedAt($createdAt) + public function setCreatedAt(?\DateTime $createdAt): static { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } $this->container['createdAt'] = $createdAt; return $this; } - - /** - * Gets updatedAt - * - * @return \DateTime - */ - public function getUpdatedAt() - { - return $this->container['updatedAt']; - } - - /** - * Sets updatedAt - * - * @param \DateTime $updatedAt File updated date/time - * - * @return $this - */ - public function setUpdatedAt($updatedAt) - { - $this->container['updatedAt'] = $updatedAt; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/FileDownloadableLink.php b/lib/Models/FileDownloadableLink.php index 1a9cdf3..300dd16 100644 --- a/lib/Models/FileDownloadableLink.php +++ b/lib/Models/FileDownloadableLink.php @@ -2,118 +2,117 @@ /** * FileDownloadableLink * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * FileDownloadableLink Class Doc Comment * - * @category Class + * @description Downloadable file link * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class FileDownloadableLink implements ModelInterface, ArrayAccess +class FileDownloadableLink extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'FileDownloadableLink'; + protected static string $openAPIModelName = 'FileDownloadableLink'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'fileUrl' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'fileUrl' => 'url' + protected static array $openAPIFormats = [ + 'fileUrl' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'fileUrl' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'fileUrl' => 'fileUrl' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'fileUrl' => 'setFileUrl' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'fileUrl' => 'getFileUrl' ]; @@ -121,9 +120,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +130,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,78 +140,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['fileUrl'] = isset($data['fileUrl']) ? $data['fileUrl'] : null; + $this->setIfExists('fileUrl', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; - if ($this->container['fileUrl'] === null) { - $invalidProperties[] = "'fileUrl' can't be null"; - } return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets fileUrl * - * @return string + * @return string|null */ - public function getFileUrl() + public function getFileUrl(): ?string { return $this->container['fileUrl']; } @@ -220,89 +190,19 @@ public function getFileUrl() /** * Sets fileUrl * - * @param string $fileUrl A unique link to download the requested file. + * @param string|null $fileUrl A unique link to download the requested file. * * @return $this */ - public function setFileUrl($fileUrl) + public function setFileUrl(?string $fileUrl): static { + if (is_null($fileUrl)) { + throw new InvalidArgumentException('non-nullable fileUrl cannot be null'); + } $this->container['fileUrl'] = $fileUrl; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/FileList.php b/lib/Models/FileList.php deleted file mode 100644 index 7a817a3..0000000 --- a/lib/Models/FileList.php +++ /dev/null @@ -1,281 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetAccount.php b/lib/Models/GetAccount.php index 7d55464..1b17820 100644 --- a/lib/Models/GetAccount.php +++ b/lib/Models/GetAccount.php @@ -2,102 +2,124 @@ /** * GetAccount * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \Brevo\Client\ObjectSerializer; + +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetAccount Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetAccount extends GetExtendedClient +class GetAccount extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getAccount'; + protected static string $openAPIModelName = 'getAccount'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'plan' => '\Brevo\Client\Models\GetAccountPlan[]', - 'relay' => '\Brevo\Client\Models\GetAccountRelay', - 'marketingAutomation' => '\Brevo\Client\Models\GetAccountMarketingAutomation' + protected static array $openAPITypes = [ + 'email' => 'string', + 'firstName' => 'string', + 'lastName' => 'string', + 'companyName' => 'string', + 'address' => '\Brevo\Client\Models\GetExtendedClientAllOfAddress', + 'plan' => '\Brevo\Client\Models\GetAccountAllOfPlan[]', + 'relay' => '\Brevo\Client\Models\GetAccountAllOfRelay', + 'marketingAutomation' => '\Brevo\Client\Models\GetAccountAllOfMarketingAutomation' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ + 'email' => 'email', + 'firstName' => null, + 'lastName' => null, + 'companyName' => null, + 'address' => null, 'plan' => null, 'relay' => null, 'marketingAutomation' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes + parent::swaggerTypes(); - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'firstName' => false, + 'lastName' => false, + 'companyName' => false, + 'address' => false, + 'plan' => false, + 'relay' => false, + 'marketingAutomation' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats + parent::swaggerFormats(); - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ + 'email' => 'email', + 'firstName' => 'firstName', + 'lastName' => 'lastName', + 'companyName' => 'companyName', + 'address' => 'address', 'plan' => 'plan', 'relay' => 'relay', 'marketingAutomation' => 'marketingAutomation' @@ -106,9 +128,14 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ + 'email' => 'setEmail', + 'firstName' => 'setFirstName', + 'lastName' => 'setLastName', + 'companyName' => 'setCompanyName', + 'address' => 'setAddress', 'plan' => 'setPlan', 'relay' => 'setRelay', 'marketingAutomation' => 'setMarketingAutomation' @@ -117,9 +144,14 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ + 'email' => 'getEmail', + 'firstName' => 'getFirstName', + 'lastName' => 'getLastName', + 'companyName' => 'getCompanyName', + 'address' => 'getAddress', 'plan' => 'getPlan', 'relay' => 'getRelay', 'marketingAutomation' => 'getMarketingAutomation' @@ -129,72 +161,82 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { - return parent::attributeMap() + self::$attributeMap; + return self::$attributeMap; } /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { - return parent::setters() + self::$setters; + return self::$setters; } /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { - return parent::getters() + self::$getters; + return self::$getters; } + /** - * The original name of the model. + * Associative array for storing property values * - * @return string + * @var array */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - parent::__construct($data); - - $this->container['plan'] = isset($data['plan']) ? $data['plan'] : null; - $this->container['relay'] = isset($data['relay']) ? $data['relay'] : null; - $this->container['marketingAutomation'] = isset($data['marketingAutomation']) ? $data['marketingAutomation'] : null; + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('firstName', $data ?? [], null); + $this->setIfExists('lastName', $data ?? [], null); + $this->setIfExists('companyName', $data ?? [], null); + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('plan', $data ?? [], null); + $this->setIfExists('relay', $data ?? [], null); + $this->setIfExists('marketingAutomation', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { - $invalidProperties = parent::listInvalidProperties(); + $invalidProperties = []; + if ($this->container['email'] === null) { + $invalidProperties[] = "'email' can't be null"; + } + if ($this->container['firstName'] === null) { + $invalidProperties[] = "'firstName' can't be null"; + } + if ($this->container['lastName'] === null) { + $invalidProperties[] = "'lastName' can't be null"; + } + if ($this->container['companyName'] === null) { + $invalidProperties[] = "'companyName' can't be null"; + } + if ($this->container['address'] === null) { + $invalidProperties[] = "'address' can't be null"; + } if ($this->container['plan'] === null) { $invalidProperties[] = "'plan' can't be null"; } @@ -205,160 +247,219 @@ public function listInvalidProperties() } /** - * Validate all the properties in the model - * return true if all passed + * Gets email * - * @return bool True if all properties are valid + * @return string */ - public function valid() + public function getEmail(): string { - return count($this->listInvalidProperties()) === 0; + return $this->container['email']; } + /** + * Sets email + * + * @param string $email Login Email + * + * @return $this + */ + public function setEmail(string $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } /** - * Gets plan + * Gets firstName * - * @return \Brevo\Client\Models\GetAccountPlan[] + * @return string */ - public function getPlan() + public function getFirstName(): string { - return $this->container['plan']; + return $this->container['firstName']; } /** - * Sets plan + * Sets firstName * - * @param \Brevo\Client\Models\GetAccountPlan[] $plan Information about your plans and credits + * @param string $firstName First Name * * @return $this */ - public function setPlan($plan) + public function setFirstName(string $firstName): static { - $this->container['plan'] = $plan; + if (is_null($firstName)) { + throw new InvalidArgumentException('non-nullable firstName cannot be null'); + } + $this->container['firstName'] = $firstName; return $this; } /** - * Gets relay + * Gets lastName * - * @return \Brevo\Client\Models\GetAccountRelay + * @return string */ - public function getRelay() + public function getLastName(): string { - return $this->container['relay']; + return $this->container['lastName']; } /** - * Sets relay + * Sets lastName * - * @param \Brevo\Client\Models\GetAccountRelay $relay relay + * @param string $lastName Last Name * * @return $this */ - public function setRelay($relay) + public function setLastName(string $lastName): static { - $this->container['relay'] = $relay; + if (is_null($lastName)) { + throw new InvalidArgumentException('non-nullable lastName cannot be null'); + } + $this->container['lastName'] = $lastName; return $this; } /** - * Gets marketingAutomation + * Gets companyName * - * @return \Brevo\Client\Models\GetAccountMarketingAutomation + * @return string */ - public function getMarketingAutomation() + public function getCompanyName(): string { - return $this->container['marketingAutomation']; + return $this->container['companyName']; } /** - * Sets marketingAutomation + * Sets companyName * - * @param \Brevo\Client\Models\GetAccountMarketingAutomation $marketingAutomation marketingAutomation + * @param string $companyName Name of the company * * @return $this */ - public function setMarketingAutomation($marketingAutomation) + public function setCompanyName(string $companyName): static { - $this->container['marketingAutomation'] = $marketingAutomation; + if (is_null($companyName)) { + throw new InvalidArgumentException('non-nullable companyName cannot be null'); + } + $this->container['companyName'] = $companyName; return $this; } + /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset + * Gets address * - * @return boolean + * @return \Brevo\Client\Models\GetExtendedClientAllOfAddress */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) + public function getAddress(): \Brevo\Client\Models\GetExtendedClientAllOfAddress { - return isset($this->container[$offset]); + return $this->container['address']; } /** - * Gets offset. + * Sets address * - * @param integer $offset Offset + * @param \Brevo\Client\Models\GetExtendedClientAllOfAddress $address address + * + * @return $this + */ + public function setAddress(\Brevo\Client\Models\GetExtendedClientAllOfAddress $address): static + { + if (is_null($address)) { + throw new InvalidArgumentException('non-nullable address cannot be null'); + } + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets plan * - * @return mixed + * @return \Brevo\Client\Models\GetAccountAllOfPlan[] */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function getPlan(): array { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container['plan']; } /** - * Sets value based on offset. + * Sets plan * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param \Brevo\Client\Models\GetAccountAllOfPlan[] $plan Information about your plans and credits * - * @return void + * @return $this */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function setPlan(array $plan): static { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; + if (is_null($plan)) { + throw new InvalidArgumentException('non-nullable plan cannot be null'); } + $this->container['plan'] = $plan; + + return $this; + } + + /** + * Gets relay + * + * @return \Brevo\Client\Models\GetAccountAllOfRelay + */ + public function getRelay(): \Brevo\Client\Models\GetAccountAllOfRelay + { + return $this->container['relay']; } /** - * Unsets offset. + * Sets relay * - * @param integer $offset Offset + * @param \Brevo\Client\Models\GetAccountAllOfRelay $relay relay + * + * @return $this + */ + public function setRelay(\Brevo\Client\Models\GetAccountAllOfRelay $relay): static + { + if (is_null($relay)) { + throw new InvalidArgumentException('non-nullable relay cannot be null'); + } + $this->container['relay'] = $relay; + + return $this; + } + + /** + * Gets marketingAutomation * - * @return void + * @return \Brevo\Client\Models\GetAccountAllOfMarketingAutomation|null */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) + public function getMarketingAutomation(): ?\Brevo\Client\Models\GetAccountAllOfMarketingAutomation { - unset($this->container[$offset]); + return $this->container['marketingAutomation']; } /** - * Gets the string presentation of the object + * Sets marketingAutomation * - * @return string + * @param \Brevo\Client\Models\GetAccountAllOfMarketingAutomation|null $marketingAutomation marketingAutomation + * + * @return $this */ - public function __toString() + public function setMarketingAutomation(?\Brevo\Client\Models\GetAccountAllOfMarketingAutomation $marketingAutomation): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($marketingAutomation)) { + throw new InvalidArgumentException('non-nullable marketingAutomation cannot be null'); } + $this->container['marketingAutomation'] = $marketingAutomation; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/GetAccountActivity.php b/lib/Models/GetAccountActivity.php index 108ba48..52c2151 100644 --- a/lib/Models/GetAccountActivity.php +++ b/lib/Models/GetAccountActivity.php @@ -2,118 +2,116 @@ /** * GetAccountActivity * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetAccountActivity Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetAccountActivity implements ModelInterface, ArrayAccess +class GetAccountActivity extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getAccountActivity'; + protected static string $openAPIModelName = 'getAccountActivity'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'logs' => '\Brevo\Client\Models\GetAccountActivityLogs[]' + protected static array $openAPITypes = [ + 'logs' => '\Brevo\Client\Models\GetAccountActivityLogsInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'logs' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'logs' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'logs' => 'logs' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'logs' => 'setLogs' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'logs' => 'getLogs' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,75 +139,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['logs'] = isset($data['logs']) ? $data['logs'] : null; + $this->setIfExists('logs', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets logs * - * @return \Brevo\Client\Models\GetAccountActivityLogs[] + * @return \Brevo\Client\Models\GetAccountActivityLogsInner[]|null */ - public function getLogs() + public function getLogs(): ?array { return $this->container['logs']; } @@ -217,89 +189,19 @@ public function getLogs() /** * Sets logs * - * @param \Brevo\Client\Models\GetAccountActivityLogs[] $logs Get user activity logs + * @param \Brevo\Client\Models\GetAccountActivityLogsInner[]|null $logs Get user activity logs * * @return $this */ - public function setLogs($logs) + public function setLogs(?array $logs): static { + if (is_null($logs)) { + throw new InvalidArgumentException('non-nullable logs cannot be null'); + } $this->container['logs'] = $logs; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetAccountActivityLogs.php b/lib/Models/GetAccountActivityLogsInner.php similarity index 53% rename from lib/Models/GetAccountActivityLogs.php rename to lib/Models/GetAccountActivityLogsInner.php index c45fb2d..5cc995c 100644 --- a/lib/Models/GetAccountActivityLogs.php +++ b/lib/Models/GetAccountActivityLogsInner.php @@ -1,62 +1,64 @@ */ -class GetAccountActivityLogs implements ModelInterface, ArrayAccess +class GetAccountActivityLogsInner extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getAccountActivity_logs'; + protected static string $openAPIModelName = 'getAccountActivity_logs_inner'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'action' => 'string', 'date' => 'string', 'userEmail' => 'string', @@ -67,9 +69,9 @@ class GetAccountActivityLogs implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'action' => null, 'date' => null, 'userEmail' => null, @@ -78,32 +80,32 @@ class GetAccountActivityLogs implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'action' => false, + 'date' => false, + 'userEmail' => false, + 'userIp' => false, + 'userAgent' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'action' => 'action', 'date' => 'date', 'userEmail' => 'user_email', @@ -114,9 +116,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'action' => 'setAction', 'date' => 'setDate', 'userEmail' => 'setUserEmail', @@ -127,9 +129,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'action' => 'getAction', 'date' => 'getDate', 'userEmail' => 'getUserEmail', @@ -141,9 +143,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -151,9 +153,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -161,55 +163,41 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['action'] = isset($data['action']) ? $data['action'] : null; - $this->container['date'] = isset($data['date']) ? $data['date'] : null; - $this->container['userEmail'] = isset($data['userEmail']) ? $data['userEmail'] : null; - $this->container['userIp'] = isset($data['userIp']) ? $data['userIp'] : null; - $this->container['userAgent'] = isset($data['userAgent']) ? $data['userAgent'] : null; + $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('userEmail', $data ?? [], null); + $this->setIfExists('userIp', $data ?? [], null); + $this->setIfExists('userAgent', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -231,24 +219,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets action * * @return string */ - public function getAction() + public function getAction(): string { return $this->container['action']; } @@ -260,8 +236,11 @@ public function getAction() * * @return $this */ - public function setAction($action) + public function setAction(string $action): static { + if (is_null($action)) { + throw new InvalidArgumentException('non-nullable action cannot be null'); + } $this->container['action'] = $action; return $this; @@ -272,7 +251,7 @@ public function setAction($action) * * @return string */ - public function getDate() + public function getDate(): string { return $this->container['date']; } @@ -284,8 +263,11 @@ public function getDate() * * @return $this */ - public function setDate($date) + public function setDate(string $date): static { + if (is_null($date)) { + throw new InvalidArgumentException('non-nullable date cannot be null'); + } $this->container['date'] = $date; return $this; @@ -296,7 +278,7 @@ public function setDate($date) * * @return string */ - public function getUserEmail() + public function getUserEmail(): string { return $this->container['userEmail']; } @@ -308,8 +290,11 @@ public function getUserEmail() * * @return $this */ - public function setUserEmail($userEmail) + public function setUserEmail(string $userEmail): static { + if (is_null($userEmail)) { + throw new InvalidArgumentException('non-nullable userEmail cannot be null'); + } $this->container['userEmail'] = $userEmail; return $this; @@ -320,7 +305,7 @@ public function setUserEmail($userEmail) * * @return string */ - public function getUserIp() + public function getUserIp(): string { return $this->container['userIp']; } @@ -332,8 +317,11 @@ public function getUserIp() * * @return $this */ - public function setUserIp($userIp) + public function setUserIp(string $userIp): static { + if (is_null($userIp)) { + throw new InvalidArgumentException('non-nullable userIp cannot be null'); + } $this->container['userIp'] = $userIp; return $this; @@ -344,7 +332,7 @@ public function setUserIp($userIp) * * @return string */ - public function getUserAgent() + public function getUserAgent(): string { return $this->container['userAgent']; } @@ -356,85 +344,15 @@ public function getUserAgent() * * @return $this */ - public function setUserAgent($userAgent) + public function setUserAgent(string $userAgent): static { + if (is_null($userAgent)) { + throw new InvalidArgumentException('non-nullable userAgent cannot be null'); + } $this->container['userAgent'] = $userAgent; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetAccountAllOfMarketingAutomation.php b/lib/Models/GetAccountAllOfMarketingAutomation.php new file mode 100644 index 0000000..45aae13 --- /dev/null +++ b/lib/Models/GetAccountAllOfMarketingAutomation.php @@ -0,0 +1,244 @@ + + */ +class GetAccountAllOfMarketingAutomation extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getAccount_allOf_marketingAutomation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'enabled' => 'bool', + 'key' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'enabled' => null, + 'key' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'enabled' => false, + 'key' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'enabled' => 'enabled', + 'key' => 'key' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'enabled' => 'setEnabled', + 'key' => 'setKey' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'enabled' => 'getEnabled', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('enabled', $data ?? [], null); + $this->setIfExists('key', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['enabled'] === null) { + $invalidProperties[] = "'enabled' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets enabled + * + * @return bool + */ + public function getEnabled(): bool + { + return $this->container['enabled']; + } + + /** + * Sets enabled + * + * @param bool $enabled Status of Marketing Automation Plateform activation for your account (true=enabled, false=disabled) + * + * @return $this + */ + public function setEnabled(bool $enabled): static + { + if (is_null($enabled)) { + throw new InvalidArgumentException('non-nullable enabled cannot be null'); + } + $this->container['enabled'] = $enabled; + + return $this; + } + + /** + * Gets key + * + * @return string|null + */ + public function getKey(): ?string + { + return $this->container['key']; + } + + /** + * Sets key + * + * @param string|null $key Marketing Automation Tracker ID + * + * @return $this + */ + public function setKey(?string $key): static + { + if (is_null($key)) { + throw new InvalidArgumentException('non-nullable key cannot be null'); + } + $this->container['key'] = $key; + + return $this; + } +} + + diff --git a/lib/Models/GetAccountPlan.php b/lib/Models/GetAccountAllOfPlan.php similarity index 50% rename from lib/Models/GetAccountPlan.php rename to lib/Models/GetAccountAllOfPlan.php index eeffdb0..9c49c37 100644 --- a/lib/Models/GetAccountPlan.php +++ b/lib/Models/GetAccountAllOfPlan.php @@ -1,154 +1,151 @@ */ -class GetAccountPlan implements ModelInterface, ArrayAccess +class GetAccountAllOfPlan extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getAccount_plan'; + protected static string $openAPIModelName = 'getAccount_allOf_plan'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'type' => 'string', 'creditsType' => 'string', 'credits' => 'float', 'startDate' => '\DateTime', - 'endDate' => '\DateTime', - 'userLimit' => 'int' + 'endDate' => '\DateTime' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'type' => null, 'creditsType' => null, 'credits' => 'float', 'startDate' => 'date', - 'endDate' => 'date', - 'userLimit' => null + 'endDate' => 'date' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'creditsType' => false, + 'credits' => false, + 'startDate' => false, + 'endDate' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'type' => 'type', 'creditsType' => 'creditsType', 'credits' => 'credits', 'startDate' => 'startDate', - 'endDate' => 'endDate', - 'userLimit' => 'userLimit' + 'endDate' => 'endDate' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'type' => 'setType', 'creditsType' => 'setCreditsType', 'credits' => 'setCredits', 'startDate' => 'setStartDate', - 'endDate' => 'setEndDate', - 'userLimit' => 'setUserLimit' + 'endDate' => 'setEndDate' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'type' => 'getType', 'creditsType' => 'getCreditsType', 'credits' => 'getCredits', 'startDate' => 'getStartDate', - 'endDate' => 'getEndDate', - 'userLimit' => 'getUserLimit' + 'endDate' => 'getEndDate' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -156,9 +153,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -166,32 +163,19 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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_FREE = 'free'; - const TYPE_SUBSCRIPTION = 'subscription'; - const TYPE_SMS = 'sms'; - const TYPE_RESELLER = 'reseller'; - const CREDITS_TYPE_SEND_LIMIT = 'sendLimit'; - + public const TYPE_PAY_AS_YOU_GO = 'payAsYouGo'; + public const TYPE_FREE = 'free'; + public const TYPE_SUBSCRIPTION = 'subscription'; + public const TYPE_SMS = 'sms'; + public const CREDITS_TYPE_SEND_LIMIT = 'sendLimit'; - /** * Gets allowable values of the enum * @@ -204,10 +188,9 @@ public function getTypeAllowableValues() self::TYPE_FREE, self::TYPE_SUBSCRIPTION, self::TYPE_SMS, - self::TYPE_RESELLER, ]; } - + /** * Gets allowable values of the enum * @@ -219,37 +202,34 @@ public function getCreditsTypeAllowableValues() self::CREDITS_TYPE_SEND_LIMIT, ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['creditsType'] = isset($data['creditsType']) ? $data['creditsType'] : null; - $this->container['credits'] = isset($data['credits']) ? $data['credits'] : null; - $this->container['startDate'] = isset($data['startDate']) ? $data['startDate'] : null; - $this->container['endDate'] = isset($data['endDate']) ? $data['endDate'] : null; - $this->container['userLimit'] = isset($data['userLimit']) ? $data['userLimit'] : null; + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('creditsType', $data ?? [], null); + $this->setIfExists('credits', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('endDate', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -259,7 +239,8 @@ public function listInvalidProperties() $allowedValues = $this->getTypeAllowableValues(); if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], implode("', '", $allowedValues) ); } @@ -270,7 +251,8 @@ public function listInvalidProperties() $allowedValues = $this->getCreditsTypeAllowableValues(); if (!is_null($this->container['creditsType']) && !in_array($this->container['creditsType'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'creditsType', must be one of '%s'", + "invalid value '%s' for 'creditsType', must be one of '%s'", + $this->container['creditsType'], implode("', '", $allowedValues) ); } @@ -281,24 +263,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets type * * @return string */ - public function getType() + public function getType(): string { return $this->container['type']; } @@ -310,13 +280,17 @@ public function getType() * * @return $this */ - public function setType($type) + public function setType(string $type): static { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $allowedValues = $this->getTypeAllowableValues(); if (!in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'type', must be one of '%s'", + "Invalid value '%s' for 'type', must be one of '%s'", + $type, implode("', '", $allowedValues) ) ); @@ -331,7 +305,7 @@ public function setType($type) * * @return string */ - public function getCreditsType() + public function getCreditsType(): string { return $this->container['creditsType']; } @@ -343,13 +317,17 @@ public function getCreditsType() * * @return $this */ - public function setCreditsType($creditsType) + public function setCreditsType(string $creditsType): static { + if (is_null($creditsType)) { + throw new InvalidArgumentException('non-nullable creditsType cannot be null'); + } $allowedValues = $this->getCreditsTypeAllowableValues(); if (!in_array($creditsType, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'creditsType', must be one of '%s'", + "Invalid value '%s' for 'creditsType', must be one of '%s'", + $creditsType, implode("', '", $allowedValues) ) ); @@ -364,7 +342,7 @@ public function setCreditsType($creditsType) * * @return float */ - public function getCredits() + public function getCredits(): float { return $this->container['credits']; } @@ -376,8 +354,11 @@ public function getCredits() * * @return $this */ - public function setCredits($credits) + public function setCredits(float $credits): static { + if (is_null($credits)) { + throw new InvalidArgumentException('non-nullable credits cannot be null'); + } $this->container['credits'] = $credits; return $this; @@ -386,9 +367,9 @@ public function setCredits($credits) /** * Gets startDate * - * @return \DateTime + * @return \DateTime|null */ - public function getStartDate() + public function getStartDate(): ?\DateTime { return $this->container['startDate']; } @@ -396,12 +377,15 @@ public function getStartDate() /** * Sets startDate * - * @param \DateTime $startDate Date of the period from which the plan will start (only available for \"subscription\" and \"reseller\" plan type) + * @param \DateTime|null $startDate Date of the period from which the plan will start (only available for \"subscription\" plan type) * * @return $this */ - public function setStartDate($startDate) + public function setStartDate(?\DateTime $startDate): static { + if (is_null($startDate)) { + throw new InvalidArgumentException('non-nullable startDate cannot be null'); + } $this->container['startDate'] = $startDate; return $this; @@ -410,9 +394,9 @@ public function setStartDate($startDate) /** * Gets endDate * - * @return \DateTime + * @return \DateTime|null */ - public function getEndDate() + public function getEndDate(): ?\DateTime { return $this->container['endDate']; } @@ -420,113 +404,19 @@ public function getEndDate() /** * Sets endDate * - * @param \DateTime $endDate Date of the period from which the plan will end (only available for \"subscription\" and \"reseller\" plan type) + * @param \DateTime|null $endDate Date of the period from which the plan will end (only available for \"subscription\" plan type) * * @return $this */ - public function setEndDate($endDate) + public function setEndDate(?\DateTime $endDate): static { + if (is_null($endDate)) { + throw new InvalidArgumentException('non-nullable endDate cannot be null'); + } $this->container['endDate'] = $endDate; return $this; } - - /** - * Gets userLimit - * - * @return int - */ - public function getUserLimit() - { - return $this->container['userLimit']; - } - - /** - * 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) - { - $this->container['userLimit'] = $userLimit; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetAccountAllOfRelay.php b/lib/Models/GetAccountAllOfRelay.php new file mode 100644 index 0000000..464c4f8 --- /dev/null +++ b/lib/Models/GetAccountAllOfRelay.php @@ -0,0 +1,248 @@ + + */ +class GetAccountAllOfRelay extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getAccount_allOf_relay'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'enabled' => 'bool', + 'data' => '\Brevo\Client\Models\GetAccountAllOfRelayData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'enabled' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'enabled' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'enabled' => 'enabled', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'enabled' => 'setEnabled', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'enabled' => 'getEnabled', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('enabled', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['enabled'] === null) { + $invalidProperties[] = "'enabled' can't be null"; + } + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets enabled + * + * @return bool + */ + public function getEnabled(): bool + { + return $this->container['enabled']; + } + + /** + * Sets enabled + * + * @param bool $enabled Status of your transactional email Account (true=Enabled, false=Disabled) + * + * @return $this + */ + public function setEnabled(bool $enabled): static + { + if (is_null($enabled)) { + throw new InvalidArgumentException('non-nullable enabled cannot be null'); + } + $this->container['enabled'] = $enabled; + + return $this; + } + + /** + * Gets data + * + * @return \Brevo\Client\Models\GetAccountAllOfRelayData + */ + public function getData(): \Brevo\Client\Models\GetAccountAllOfRelayData + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Brevo\Client\Models\GetAccountAllOfRelayData $data data + * + * @return $this + */ + public function setData(\Brevo\Client\Models\GetAccountAllOfRelayData $data): static + { + if (is_null($data)) { + throw new InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } +} + + diff --git a/lib/Models/GetAccountAllOfRelayData.php b/lib/Models/GetAccountAllOfRelayData.php new file mode 100644 index 0000000..fb66523 --- /dev/null +++ b/lib/Models/GetAccountAllOfRelayData.php @@ -0,0 +1,285 @@ + + */ +class GetAccountAllOfRelayData extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getAccount_allOf_relay_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'userName' => 'string', + 'relay' => 'string', + 'port' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'userName' => 'email', + 'relay' => null, + 'port' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'userName' => false, + 'relay' => false, + 'port' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'userName' => 'userName', + 'relay' => 'relay', + 'port' => 'port' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'userName' => 'setUserName', + 'relay' => 'setRelay', + 'port' => 'setPort' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'userName' => 'getUserName', + 'relay' => 'getRelay', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('userName', $data ?? [], null); + $this->setIfExists('relay', $data ?? [], null); + $this->setIfExists('port', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['userName'] === null) { + $invalidProperties[] = "'userName' can't be null"; + } + if ($this->container['relay'] === null) { + $invalidProperties[] = "'relay' can't be null"; + } + if ($this->container['port'] === null) { + $invalidProperties[] = "'port' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets userName + * + * @return string + */ + public function getUserName(): string + { + return $this->container['userName']; + } + + /** + * Sets userName + * + * @param string $userName Email to use as login on transactional platform + * + * @return $this + */ + public function setUserName(string $userName): static + { + if (is_null($userName)) { + throw new InvalidArgumentException('non-nullable userName cannot be null'); + } + $this->container['userName'] = $userName; + + return $this; + } + + /** + * Gets relay + * + * @return string + */ + public function getRelay(): string + { + return $this->container['relay']; + } + + /** + * Sets relay + * + * @param string $relay URL of the SMTP Relay + * + * @return $this + */ + public function setRelay(string $relay): static + { + if (is_null($relay)) { + throw new InvalidArgumentException('non-nullable relay cannot be null'); + } + $this->container['relay'] = $relay; + + return $this; + } + + /** + * Gets port + * + * @return int + */ + public function getPort(): int + { + return $this->container['port']; + } + + /** + * Sets port + * + * @param int $port Port used for SMTP Relay + * + * @return $this + */ + public function setPort(int $port): static + { + if (is_null($port)) { + throw new InvalidArgumentException('non-nullable port cannot be null'); + } + $this->container['port'] = $port; + + return $this; + } +} + + diff --git a/lib/Models/GetAccountMarketingAutomation.php b/lib/Models/GetAccountMarketingAutomation.php deleted file mode 100644 index dfc1a53..0000000 --- a/lib/Models/GetAccountMarketingAutomation.php +++ /dev/null @@ -1,338 +0,0 @@ - 'string', - 'enabled' => 'bool' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'key' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'key' => 'key', - 'enabled' => 'enabled' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'key' => 'setKey', - 'enabled' => 'setEnabled' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'key' => 'getKey', - '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 - */ - public function __construct(array $data = null) - { - $this->container['key'] = isset($data['key']) ? $data['key'] : null; - $this->container['enabled'] = isset($data['enabled']) ? $data['enabled'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['enabled'] === null) { - $invalidProperties[] = "'enabled' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets key - * - * @return string - */ - public function getKey() - { - return $this->container['key']; - } - - /** - * Sets key - * - * @param string $key Marketing Automation Tracker ID - * - * @return $this - */ - public function setKey($key) - { - $this->container['key'] = $key; - - return $this; - } - - /** - * Gets enabled - * - * @return bool - */ - public function getEnabled() - { - return $this->container['enabled']; - } - - /** - * Sets enabled - * - * @param bool $enabled Status of Marketing Automation Plateform activation for your account (true=enabled, false=disabled) - * - * @return $this - */ - public function setEnabled($enabled) - { - $this->container['enabled'] = $enabled; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetAccountRelay.php b/lib/Models/GetAccountRelay.php deleted file mode 100644 index 20abb76..0000000 --- a/lib/Models/GetAccountRelay.php +++ /dev/null @@ -1,342 +0,0 @@ - 'bool', - 'data' => '\Brevo\Client\Models\GetAccountRelayData' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'enabled' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'enabled' => 'enabled', - 'data' => 'data' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'enabled' => 'setEnabled', - 'data' => 'setData' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'enabled' => 'getEnabled', - '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 - */ - public function __construct(array $data = null) - { - $this->container['enabled'] = isset($data['enabled']) ? $data['enabled'] : null; - $this->container['data'] = isset($data['data']) ? $data['data'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['enabled'] === null) { - $invalidProperties[] = "'enabled' can't be null"; - } - if ($this->container['data'] === null) { - $invalidProperties[] = "'data' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets enabled - * - * @return bool - */ - public function getEnabled() - { - return $this->container['enabled']; - } - - /** - * Sets enabled - * - * @param bool $enabled Status of your transactional email Account (true=Enabled, false=Disabled) - * - * @return $this - */ - public function setEnabled($enabled) - { - $this->container['enabled'] = $enabled; - - return $this; - } - - /** - * Gets data - * - * @return \Brevo\Client\Models\GetAccountRelayData - */ - public function getData() - { - return $this->container['data']; - } - - /** - * Sets data - * - * @param \Brevo\Client\Models\GetAccountRelayData $data data - * - * @return $this - */ - public function setData($data) - { - $this->container['data'] = $data; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetAccountRelayData.php b/lib/Models/GetAccountRelayData.php deleted file mode 100644 index 00cf4c4..0000000 --- a/lib/Models/GetAccountRelayData.php +++ /dev/null @@ -1,375 +0,0 @@ - 'string', - 'relay' => 'string', - 'port' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'userName' => 'email', - 'relay' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'userName' => 'userName', - 'relay' => 'relay', - 'port' => 'port' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'userName' => 'setUserName', - 'relay' => 'setRelay', - 'port' => 'setPort' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'userName' => 'getUserName', - 'relay' => 'getRelay', - '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 - */ - public function __construct(array $data = null) - { - $this->container['userName'] = isset($data['userName']) ? $data['userName'] : null; - $this->container['relay'] = isset($data['relay']) ? $data['relay'] : null; - $this->container['port'] = isset($data['port']) ? $data['port'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['userName'] === null) { - $invalidProperties[] = "'userName' can't be null"; - } - if ($this->container['relay'] === null) { - $invalidProperties[] = "'relay' can't be null"; - } - if ($this->container['port'] === null) { - $invalidProperties[] = "'port' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets userName - * - * @return string - */ - public function getUserName() - { - return $this->container['userName']; - } - - /** - * Sets userName - * - * @param string $userName Email to use as login on transactional platform - * - * @return $this - */ - public function setUserName($userName) - { - $this->container['userName'] = $userName; - - return $this; - } - - /** - * Gets relay - * - * @return string - */ - public function getRelay() - { - return $this->container['relay']; - } - - /** - * Sets relay - * - * @param string $relay URL of the SMTP Relay - * - * @return $this - */ - public function setRelay($relay) - { - $this->container['relay'] = $relay; - - return $this; - } - - /** - * Gets port - * - * @return int - */ - public function getPort() - { - return $this->container['port']; - } - - /** - * Sets port - * - * @param int $port Port used for SMTP Relay - * - * @return $this - */ - public function setPort($port) - { - $this->container['port'] = $port; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetAggregatedReport.php b/lib/Models/GetAggregatedReport.php index 570c7ff..97fa4db 100644 --- a/lib/Models/GetAggregatedReport.php +++ b/lib/Models/GetAggregatedReport.php @@ -2,61 +2,63 @@ /** * GetAggregatedReport * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetAggregatedReport Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetAggregatedReport implements ModelInterface, ArrayAccess +class GetAggregatedReport extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getAggregatedReport'; + protected static string $openAPIModelName = 'getAggregatedReport'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'range' => 'string', 'requests' => 'int', 'delivered' => 'int', @@ -75,9 +77,9 @@ class GetAggregatedReport implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'range' => null, 'requests' => 'int64', 'delivered' => 'int64', @@ -94,32 +96,40 @@ class GetAggregatedReport implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'range' => false, + 'requests' => false, + 'delivered' => false, + 'hardBounces' => false, + 'softBounces' => false, + 'clicks' => false, + 'uniqueClicks' => false, + 'opens' => false, + 'uniqueOpens' => false, + 'spamReports' => false, + 'blocked' => false, + 'invalid' => false, + 'unsubscribed' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'range' => 'range', 'requests' => 'requests', 'delivered' => 'delivered', @@ -138,9 +148,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'range' => 'setRange', 'requests' => 'setRequests', 'delivered' => 'setDelivered', @@ -159,9 +169,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'range' => 'getRange', 'requests' => 'getRequests', 'delivered' => 'getDelivered', @@ -181,9 +191,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -191,9 +201,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -201,87 +211,61 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['range'] = isset($data['range']) ? $data['range'] : null; - $this->container['requests'] = isset($data['requests']) ? $data['requests'] : null; - $this->container['delivered'] = isset($data['delivered']) ? $data['delivered'] : null; - $this->container['hardBounces'] = isset($data['hardBounces']) ? $data['hardBounces'] : null; - $this->container['softBounces'] = isset($data['softBounces']) ? $data['softBounces'] : null; - $this->container['clicks'] = isset($data['clicks']) ? $data['clicks'] : null; - $this->container['uniqueClicks'] = isset($data['uniqueClicks']) ? $data['uniqueClicks'] : null; - $this->container['opens'] = isset($data['opens']) ? $data['opens'] : null; - $this->container['uniqueOpens'] = isset($data['uniqueOpens']) ? $data['uniqueOpens'] : null; - $this->container['spamReports'] = isset($data['spamReports']) ? $data['spamReports'] : null; - $this->container['blocked'] = isset($data['blocked']) ? $data['blocked'] : null; - $this->container['invalid'] = isset($data['invalid']) ? $data['invalid'] : null; - $this->container['unsubscribed'] = isset($data['unsubscribed']) ? $data['unsubscribed'] : null; + $this->setIfExists('range', $data ?? [], null); + $this->setIfExists('requests', $data ?? [], null); + $this->setIfExists('delivered', $data ?? [], null); + $this->setIfExists('hardBounces', $data ?? [], null); + $this->setIfExists('softBounces', $data ?? [], null); + $this->setIfExists('clicks', $data ?? [], null); + $this->setIfExists('uniqueClicks', $data ?? [], null); + $this->setIfExists('opens', $data ?? [], null); + $this->setIfExists('uniqueOpens', $data ?? [], null); + $this->setIfExists('spamReports', $data ?? [], null); + $this->setIfExists('blocked', $data ?? [], null); + $this->setIfExists('invalid', $data ?? [], null); + $this->setIfExists('unsubscribed', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets range * - * @return string + * @return string|null */ - public function getRange() + public function getRange(): ?string { return $this->container['range']; } @@ -289,12 +273,15 @@ public function getRange() /** * Sets range * - * @param string $range Time frame of the report + * @param string|null $range Time frame of the report * * @return $this */ - public function setRange($range) + public function setRange(?string $range): static { + if (is_null($range)) { + throw new InvalidArgumentException('non-nullable range cannot be null'); + } $this->container['range'] = $range; return $this; @@ -303,9 +290,9 @@ public function setRange($range) /** * Gets requests * - * @return int + * @return int|null */ - public function getRequests() + public function getRequests(): ?int { return $this->container['requests']; } @@ -313,12 +300,15 @@ public function getRequests() /** * Sets requests * - * @param int $requests Number of requests for the timeframe + * @param int|null $requests Number of requests for the timeframe * * @return $this */ - public function setRequests($requests) + public function setRequests(?int $requests): static { + if (is_null($requests)) { + throw new InvalidArgumentException('non-nullable requests cannot be null'); + } $this->container['requests'] = $requests; return $this; @@ -327,9 +317,9 @@ public function setRequests($requests) /** * Gets delivered * - * @return int + * @return int|null */ - public function getDelivered() + public function getDelivered(): ?int { return $this->container['delivered']; } @@ -337,12 +327,15 @@ public function getDelivered() /** * Sets delivered * - * @param int $delivered Number of delivered emails for the timeframe + * @param int|null $delivered Number of delivered emails for the timeframe * * @return $this */ - public function setDelivered($delivered) + public function setDelivered(?int $delivered): static { + if (is_null($delivered)) { + throw new InvalidArgumentException('non-nullable delivered cannot be null'); + } $this->container['delivered'] = $delivered; return $this; @@ -351,9 +344,9 @@ public function setDelivered($delivered) /** * Gets hardBounces * - * @return int + * @return int|null */ - public function getHardBounces() + public function getHardBounces(): ?int { return $this->container['hardBounces']; } @@ -361,12 +354,15 @@ public function getHardBounces() /** * Sets hardBounces * - * @param int $hardBounces Number of hardbounces for the timeframe + * @param int|null $hardBounces Number of hardbounces for the timeframe * * @return $this */ - public function setHardBounces($hardBounces) + public function setHardBounces(?int $hardBounces): static { + if (is_null($hardBounces)) { + throw new InvalidArgumentException('non-nullable hardBounces cannot be null'); + } $this->container['hardBounces'] = $hardBounces; return $this; @@ -375,9 +371,9 @@ public function setHardBounces($hardBounces) /** * Gets softBounces * - * @return int + * @return int|null */ - public function getSoftBounces() + public function getSoftBounces(): ?int { return $this->container['softBounces']; } @@ -385,12 +381,15 @@ public function getSoftBounces() /** * Sets softBounces * - * @param int $softBounces Number of softbounces for the timeframe + * @param int|null $softBounces Number of softbounces for the timeframe * * @return $this */ - public function setSoftBounces($softBounces) + public function setSoftBounces(?int $softBounces): static { + if (is_null($softBounces)) { + throw new InvalidArgumentException('non-nullable softBounces cannot be null'); + } $this->container['softBounces'] = $softBounces; return $this; @@ -399,9 +398,9 @@ public function setSoftBounces($softBounces) /** * Gets clicks * - * @return int + * @return int|null */ - public function getClicks() + public function getClicks(): ?int { return $this->container['clicks']; } @@ -409,12 +408,15 @@ public function getClicks() /** * Sets clicks * - * @param int $clicks Number of clicks for the timeframe + * @param int|null $clicks Number of clicks for the timeframe * * @return $this */ - public function setClicks($clicks) + public function setClicks(?int $clicks): static { + if (is_null($clicks)) { + throw new InvalidArgumentException('non-nullable clicks cannot be null'); + } $this->container['clicks'] = $clicks; return $this; @@ -423,9 +425,9 @@ public function setClicks($clicks) /** * Gets uniqueClicks * - * @return int + * @return int|null */ - public function getUniqueClicks() + public function getUniqueClicks(): ?int { return $this->container['uniqueClicks']; } @@ -433,12 +435,15 @@ public function getUniqueClicks() /** * Sets uniqueClicks * - * @param int $uniqueClicks Number of unique clicks for the timeframe + * @param int|null $uniqueClicks Number of unique clicks for the timeframe * * @return $this */ - public function setUniqueClicks($uniqueClicks) + public function setUniqueClicks(?int $uniqueClicks): static { + if (is_null($uniqueClicks)) { + throw new InvalidArgumentException('non-nullable uniqueClicks cannot be null'); + } $this->container['uniqueClicks'] = $uniqueClicks; return $this; @@ -447,9 +452,9 @@ public function setUniqueClicks($uniqueClicks) /** * Gets opens * - * @return int + * @return int|null */ - public function getOpens() + public function getOpens(): ?int { return $this->container['opens']; } @@ -457,12 +462,15 @@ public function getOpens() /** * Sets opens * - * @param int $opens Number of openings for the timeframe + * @param int|null $opens Number of openings for the timeframe * * @return $this */ - public function setOpens($opens) + public function setOpens(?int $opens): static { + if (is_null($opens)) { + throw new InvalidArgumentException('non-nullable opens cannot be null'); + } $this->container['opens'] = $opens; return $this; @@ -471,9 +479,9 @@ public function setOpens($opens) /** * Gets uniqueOpens * - * @return int + * @return int|null */ - public function getUniqueOpens() + public function getUniqueOpens(): ?int { return $this->container['uniqueOpens']; } @@ -481,12 +489,15 @@ public function getUniqueOpens() /** * Sets uniqueOpens * - * @param int $uniqueOpens Number of unique openings for the timeframe + * @param int|null $uniqueOpens Number of unique openings for the timeframe * * @return $this */ - public function setUniqueOpens($uniqueOpens) + public function setUniqueOpens(?int $uniqueOpens): static { + if (is_null($uniqueOpens)) { + throw new InvalidArgumentException('non-nullable uniqueOpens cannot be null'); + } $this->container['uniqueOpens'] = $uniqueOpens; return $this; @@ -495,9 +506,9 @@ public function setUniqueOpens($uniqueOpens) /** * Gets spamReports * - * @return int + * @return int|null */ - public function getSpamReports() + public function getSpamReports(): ?int { return $this->container['spamReports']; } @@ -505,12 +516,15 @@ public function getSpamReports() /** * Sets spamReports * - * @param int $spamReports Number of complaint (spam report) for the timeframe + * @param int|null $spamReports Number of complaint (spam report) for the timeframe * * @return $this */ - public function setSpamReports($spamReports) + public function setSpamReports(?int $spamReports): static { + if (is_null($spamReports)) { + throw new InvalidArgumentException('non-nullable spamReports cannot be null'); + } $this->container['spamReports'] = $spamReports; return $this; @@ -519,9 +533,9 @@ public function setSpamReports($spamReports) /** * Gets blocked * - * @return int + * @return int|null */ - public function getBlocked() + public function getBlocked(): ?int { return $this->container['blocked']; } @@ -529,12 +543,15 @@ public function getBlocked() /** * Sets blocked * - * @param int $blocked Number of blocked contact emails for the timeframe + * @param int|null $blocked Number of blocked contact emails for the timeframe * * @return $this */ - public function setBlocked($blocked) + public function setBlocked(?int $blocked): static { + if (is_null($blocked)) { + throw new InvalidArgumentException('non-nullable blocked cannot be null'); + } $this->container['blocked'] = $blocked; return $this; @@ -543,9 +560,9 @@ public function setBlocked($blocked) /** * Gets invalid * - * @return int + * @return int|null */ - public function getInvalid() + public function getInvalid(): ?int { return $this->container['invalid']; } @@ -553,12 +570,15 @@ public function getInvalid() /** * Sets invalid * - * @param int $invalid Number of invalid emails for the timeframe + * @param int|null $invalid Number of invalid emails for the timeframe * * @return $this */ - public function setInvalid($invalid) + public function setInvalid(?int $invalid): static { + if (is_null($invalid)) { + throw new InvalidArgumentException('non-nullable invalid cannot be null'); + } $this->container['invalid'] = $invalid; return $this; @@ -567,9 +587,9 @@ public function setInvalid($invalid) /** * Gets unsubscribed * - * @return int + * @return int|null */ - public function getUnsubscribed() + public function getUnsubscribed(): ?int { return $this->container['unsubscribed']; } @@ -577,89 +597,19 @@ public function getUnsubscribed() /** * Sets unsubscribed * - * @param int $unsubscribed Number of unsubscribed emails for the timeframe + * @param int|null $unsubscribed Number of unsubscribed emails for the timeframe * * @return $this */ - public function setUnsubscribed($unsubscribed) + public function setUnsubscribed(?int $unsubscribed): static { + if (is_null($unsubscribed)) { + throw new InvalidArgumentException('non-nullable unsubscribed cannot be null'); + } $this->container['unsubscribed'] = $unsubscribed; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetAllExternalFeeds.php b/lib/Models/GetAllExternalFeeds.php index b060e3f..3f504ec 100644 --- a/lib/Models/GetAllExternalFeeds.php +++ b/lib/Models/GetAllExternalFeeds.php @@ -2,102 +2,101 @@ /** * GetAllExternalFeeds * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetAllExternalFeeds Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetAllExternalFeeds implements ModelInterface, ArrayAccess +class GetAllExternalFeeds extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getAllExternalFeeds'; + protected static string $openAPIModelName = 'getAllExternalFeeds'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'count' => 'int', - 'feeds' => '\Brevo\Client\Models\GetAllExternalFeedsFeeds[]' + 'feeds' => '\Brevo\Client\Models\GetAllExternalFeedsFeedsInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'count' => null, 'feeds' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'count' => false, + 'feeds' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'count' => 'count', 'feeds' => 'feeds' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'count' => 'setCount', 'feeds' => 'setFeeds' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'count' => 'getCount', 'feeds' => 'getFeeds' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +145,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['count'] = isset($data['count']) ? $data['count'] : null; - $this->container['feeds'] = isset($data['feeds']) ? $data['feeds'] : null; + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('feeds', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets count * - * @return int + * @return int|null */ - public function getCount() + public function getCount(): ?int { return $this->container['count']; } @@ -223,12 +196,15 @@ public function getCount() /** * Sets count * - * @param int $count Total number of batches + * @param int|null $count Total number of batches * * @return $this */ - public function setCount($count) + public function setCount(?int $count): static { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } $this->container['count'] = $count; return $this; @@ -237,9 +213,9 @@ public function setCount($count) /** * Gets feeds * - * @return \Brevo\Client\Models\GetAllExternalFeedsFeeds[] + * @return \Brevo\Client\Models\GetAllExternalFeedsFeedsInner[]|null */ - public function getFeeds() + public function getFeeds(): ?array { return $this->container['feeds']; } @@ -247,89 +223,19 @@ public function getFeeds() /** * Sets feeds * - * @param \Brevo\Client\Models\GetAllExternalFeedsFeeds[] $feeds feeds + * @param \Brevo\Client\Models\GetAllExternalFeedsFeedsInner[]|null $feeds feeds * * @return $this */ - public function setFeeds($feeds) + public function setFeeds(?array $feeds): static { + if (is_null($feeds)) { + throw new InvalidArgumentException('non-nullable feeds cannot be null'); + } $this->container['feeds'] = $feeds; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetAllExternalFeedsFeeds.php b/lib/Models/GetAllExternalFeedsFeedsInner.php similarity index 58% rename from lib/Models/GetAllExternalFeedsFeeds.php rename to lib/Models/GetAllExternalFeedsFeedsInner.php index 5ebdbf4..cf980a1 100644 --- a/lib/Models/GetAllExternalFeedsFeeds.php +++ b/lib/Models/GetAllExternalFeedsFeedsInner.php @@ -1,184 +1,193 @@ */ -class GetAllExternalFeedsFeeds implements ModelInterface, ArrayAccess +class GetAllExternalFeedsFeedsInner extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getAllExternalFeeds_feeds'; + protected static string $openAPIModelName = 'getAllExternalFeeds_feeds_inner'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'string', 'name' => 'string', 'url' => 'string', 'authType' => 'string', - 'username' => 'string', - 'password' => 'string', - 'token' => 'string', - 'headers' => '\Brevo\Client\Models\GetExternalFeedByUUIDHeaders[]', + 'headers' => '\Brevo\Client\Models\GetExternalFeedByUUIDHeadersInner[]', 'maxRetries' => 'int', 'cache' => 'bool', 'createdAt' => '\DateTime', - 'modifiedAt' => '\DateTime' + 'modifiedAt' => '\DateTime', + 'username' => 'string', + 'password' => 'string', + 'token' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'uuidv4', 'name' => null, 'url' => 'url', 'authType' => null, - 'username' => null, - 'password' => null, - 'token' => null, 'headers' => null, 'maxRetries' => null, 'cache' => null, 'createdAt' => 'date-time', - 'modifiedAt' => 'date-time' + 'modifiedAt' => 'date-time', + 'username' => null, + 'password' => null, + 'token' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'url' => false, + 'authType' => false, + 'headers' => false, + 'maxRetries' => false, + 'cache' => false, + 'createdAt' => false, + 'modifiedAt' => false, + 'username' => false, + 'password' => false, + 'token' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name', 'url' => 'url', 'authType' => 'authType', - 'username' => 'username', - 'password' => 'password', - 'token' => 'token', 'headers' => 'headers', 'maxRetries' => 'maxRetries', 'cache' => 'cache', 'createdAt' => 'createdAt', - 'modifiedAt' => 'modifiedAt' + 'modifiedAt' => 'modifiedAt', + 'username' => 'username', + 'password' => 'password', + 'token' => 'token' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName', 'url' => 'setUrl', 'authType' => 'setAuthType', - 'username' => 'setUsername', - 'password' => 'setPassword', - 'token' => 'setToken', 'headers' => 'setHeaders', 'maxRetries' => 'setMaxRetries', 'cache' => 'setCache', 'createdAt' => 'setCreatedAt', - 'modifiedAt' => 'setModifiedAt' + 'modifiedAt' => 'setModifiedAt', + 'username' => 'setUsername', + 'password' => 'setPassword', + 'token' => 'setToken' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName', 'url' => 'getUrl', 'authType' => 'getAuthType', - 'username' => 'getUsername', - 'password' => 'getPassword', - 'token' => 'getToken', 'headers' => 'getHeaders', 'maxRetries' => 'getMaxRetries', 'cache' => 'getCache', 'createdAt' => 'getCreatedAt', - 'modifiedAt' => 'getModifiedAt' + 'modifiedAt' => 'getModifiedAt', + 'username' => 'getUsername', + 'password' => 'getPassword', + 'token' => 'getToken' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -186,9 +195,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -196,28 +205,16 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const AUTH_TYPE_BASIC = 'basic'; - const AUTH_TYPE_TOKEN = 'token'; - const AUTH_TYPE_NO_AUTH = 'noAuth'; - - + public const AUTH_TYPE_BASIC = 'basic'; + public const AUTH_TYPE_TOKEN = 'token'; + public const AUTH_TYPE_NO_AUTH = 'noAuth'; /** * Gets allowable values of the enum @@ -233,42 +230,40 @@ public function getAuthTypeAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['authType'] = isset($data['authType']) ? $data['authType'] : null; - $this->container['username'] = isset($data['username']) ? $data['username'] : null; - $this->container['password'] = isset($data['password']) ? $data['password'] : null; - $this->container['token'] = isset($data['token']) ? $data['token'] : null; - $this->container['headers'] = isset($data['headers']) ? $data['headers'] : null; - $this->container['maxRetries'] = isset($data['maxRetries']) ? $data['maxRetries'] : null; - $this->container['cache'] = isset($data['cache']) ? $data['cache'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['modifiedAt'] = isset($data['modifiedAt']) ? $data['modifiedAt'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('authType', $data ?? [], null); + $this->setIfExists('headers', $data ?? [], null); + $this->setIfExists('maxRetries', $data ?? [], 5); + $this->setIfExists('cache', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('modifiedAt', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('password', $data ?? [], null); + $this->setIfExists('token', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -287,7 +282,8 @@ public function listInvalidProperties() $allowedValues = $this->getAuthTypeAllowableValues(); if (!is_null($this->container['authType']) && !in_array($this->container['authType'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'authType', must be one of '%s'", + "invalid value '%s' for 'authType', must be one of '%s'", + $this->container['authType'], implode("', '", $allowedValues) ); } @@ -318,24 +314,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return string */ - public function getId() + public function getId(): string { return $this->container['id']; } @@ -347,8 +331,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(string $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -359,7 +346,7 @@ public function setId($id) * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -371,8 +358,11 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -383,7 +373,7 @@ public function setName($name) * * @return string */ - public function getUrl() + public function getUrl(): string { return $this->container['url']; } @@ -395,8 +385,11 @@ public function getUrl() * * @return $this */ - public function setUrl($url) + public function setUrl(string $url): static { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } $this->container['url'] = $url; return $this; @@ -407,7 +400,7 @@ public function setUrl($url) * * @return string */ - public function getAuthType() + public function getAuthType(): string { return $this->container['authType']; } @@ -419,13 +412,17 @@ public function getAuthType() * * @return $this */ - public function setAuthType($authType) + public function setAuthType(string $authType): static { + if (is_null($authType)) { + throw new InvalidArgumentException('non-nullable authType cannot be null'); + } $allowedValues = $this->getAuthTypeAllowableValues(); if (!in_array($authType, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'authType', must be one of '%s'", + "Invalid value '%s' for 'authType', must be one of '%s'", + $authType, implode("', '", $allowedValues) ) ); @@ -435,84 +432,12 @@ public function setAuthType($authType) return $this; } - /** - * Gets username - * - * @return string - */ - public function getUsername() - { - return $this->container['username']; - } - - /** - * Sets username - * - * @param string $username Username for authType `basic` - * - * @return $this - */ - public function setUsername($username) - { - $this->container['username'] = $username; - - return $this; - } - - /** - * Gets password - * - * @return string - */ - public function getPassword() - { - return $this->container['password']; - } - - /** - * Sets password - * - * @param string $password Password for authType `basic` - * - * @return $this - */ - public function setPassword($password) - { - $this->container['password'] = $password; - - return $this; - } - - /** - * Gets token - * - * @return string - */ - public function getToken() - { - return $this->container['token']; - } - - /** - * Sets token - * - * @param string $token Token for authType `token` - * - * @return $this - */ - public function setToken($token) - { - $this->container['token'] = $token; - - return $this; - } - /** * Gets headers * - * @return \Brevo\Client\Models\GetExternalFeedByUUIDHeaders[] + * @return \Brevo\Client\Models\GetExternalFeedByUUIDHeadersInner[] */ - public function getHeaders() + public function getHeaders(): array { return $this->container['headers']; } @@ -520,12 +445,15 @@ public function getHeaders() /** * Sets headers * - * @param \Brevo\Client\Models\GetExternalFeedByUUIDHeaders[] $headers Custom headers for the feed + * @param \Brevo\Client\Models\GetExternalFeedByUUIDHeadersInner[] $headers Custom headers for the feed * * @return $this */ - public function setHeaders($headers) + public function setHeaders(array $headers): static { + if (is_null($headers)) { + throw new InvalidArgumentException('non-nullable headers cannot be null'); + } $this->container['headers'] = $headers; return $this; @@ -536,7 +464,7 @@ public function setHeaders($headers) * * @return int */ - public function getMaxRetries() + public function getMaxRetries(): int { return $this->container['maxRetries']; } @@ -548,14 +476,17 @@ public function getMaxRetries() * * @return $this */ - public function setMaxRetries($maxRetries) + public function setMaxRetries(int $maxRetries): static { + if (is_null($maxRetries)) { + throw new InvalidArgumentException('non-nullable maxRetries cannot be null'); + } if (($maxRetries > 5)) { - throw new \InvalidArgumentException('invalid value for $maxRetries when calling GetAllExternalFeedsFeeds., must be smaller than or equal to 5.'); + throw new InvalidArgumentException('invalid value for $maxRetries when calling GetAllExternalFeedsFeedsInner., must be smaller than or equal to 5.'); } if (($maxRetries < 0)) { - throw new \InvalidArgumentException('invalid value for $maxRetries when calling GetAllExternalFeedsFeeds., must be bigger than or equal to 0.'); + throw new InvalidArgumentException('invalid value for $maxRetries when calling GetAllExternalFeedsFeedsInner., must be bigger than or equal to 0.'); } $this->container['maxRetries'] = $maxRetries; @@ -568,7 +499,7 @@ public function setMaxRetries($maxRetries) * * @return bool */ - public function getCache() + public function getCache(): bool { return $this->container['cache']; } @@ -580,8 +511,11 @@ public function getCache() * * @return $this */ - public function setCache($cache) + public function setCache(bool $cache): static { + if (is_null($cache)) { + throw new InvalidArgumentException('non-nullable cache cannot be null'); + } $this->container['cache'] = $cache; return $this; @@ -592,7 +526,7 @@ public function setCache($cache) * * @return \DateTime */ - public function getCreatedAt() + public function getCreatedAt(): \DateTime { return $this->container['createdAt']; } @@ -604,8 +538,11 @@ public function getCreatedAt() * * @return $this */ - public function setCreatedAt($createdAt) + public function setCreatedAt(\DateTime $createdAt): static { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } $this->container['createdAt'] = $createdAt; return $this; @@ -616,7 +553,7 @@ public function setCreatedAt($createdAt) * * @return \DateTime */ - public function getModifiedAt() + public function getModifiedAt(): \DateTime { return $this->container['modifiedAt']; } @@ -628,84 +565,95 @@ public function getModifiedAt() * * @return $this */ - public function setModifiedAt($modifiedAt) + public function setModifiedAt(\DateTime $modifiedAt): static { + if (is_null($modifiedAt)) { + throw new InvalidArgumentException('non-nullable modifiedAt cannot be null'); + } $this->container['modifiedAt'] = $modifiedAt; return $this; } + /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset + * Gets username * - * @return boolean + * @return string|null */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) + public function getUsername(): ?string { - return isset($this->container[$offset]); + return $this->container['username']; } /** - * Gets offset. + * Sets username * - * @param integer $offset Offset + * @param string|null $username Username for authType `basic` + * + * @return $this + */ + public function setUsername(?string $username): static + { + if (is_null($username)) { + throw new InvalidArgumentException('non-nullable username cannot be null'); + } + $this->container['username'] = $username; + + return $this; + } + + /** + * Gets password * - * @return mixed + * @return string|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function getPassword(): ?string { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container['password']; } /** - * Sets value based on offset. + * Sets password * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param string|null $password Password for authType `basic` * - * @return void + * @return $this */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function setPassword(?string $password): static { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; + if (is_null($password)) { + throw new InvalidArgumentException('non-nullable password cannot be null'); } + $this->container['password'] = $password; + + return $this; } /** - * Unsets offset. - * - * @param integer $offset Offset + * Gets token * - * @return void + * @return string|null */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) + public function getToken(): ?string { - unset($this->container[$offset]); + return $this->container['token']; } /** - * Gets the string presentation of the object + * Sets token * - * @return string + * @param string|null $token Token for authType `token` + * + * @return $this */ - public function __toString() + public function setToken(?string $token): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($token)) { + throw new InvalidArgumentException('non-nullable token cannot be null'); } + $this->container['token'] = $token; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/GetAttributes.php b/lib/Models/GetAttributes.php index d24d86f..7201789 100644 --- a/lib/Models/GetAttributes.php +++ b/lib/Models/GetAttributes.php @@ -2,118 +2,116 @@ /** * GetAttributes * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetAttributes Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetAttributes implements ModelInterface, ArrayAccess +class GetAttributes extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getAttributes'; + protected static string $openAPIModelName = 'getAttributes'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'attributes' => '\Brevo\Client\Models\GetAttributesAttributes[]' + protected static array $openAPITypes = [ + 'attributes' => '\Brevo\Client\Models\GetAttributesAttributesInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'attributes' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'attributes' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'attributes' => 'attributes' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'attributes' => 'setAttributes' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'attributes' => 'getAttributes' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,51 +139,37 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['attributes'] = isset($data['attributes']) ? $data['attributes'] : null; + $this->setIfExists('attributes', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -195,24 +179,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets attributes * - * @return \Brevo\Client\Models\GetAttributesAttributes[] + * @return \Brevo\Client\Models\GetAttributesAttributesInner[] */ - public function getAttributes() + public function getAttributes(): array { return $this->container['attributes']; } @@ -220,89 +192,19 @@ public function getAttributes() /** * Sets attributes * - * @param \Brevo\Client\Models\GetAttributesAttributes[] $attributes Listing of available contact attributes in your account + * @param \Brevo\Client\Models\GetAttributesAttributesInner[] $attributes Listing of available contact attributes in your account * * @return $this */ - public function setAttributes($attributes) + public function setAttributes(array $attributes): static { + if (is_null($attributes)) { + throw new InvalidArgumentException('non-nullable attributes cannot be null'); + } $this->container['attributes'] = $attributes; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetAttributesAttributes.php b/lib/Models/GetAttributesAttributesInner.php similarity index 52% rename from lib/Models/GetAttributesAttributes.php rename to lib/Models/GetAttributesAttributesInner.php index a9290ba..4786483 100644 --- a/lib/Models/GetAttributesAttributes.php +++ b/lib/Models/GetAttributesAttributesInner.php @@ -1,75 +1,77 @@ */ -class GetAttributesAttributes implements ModelInterface, ArrayAccess +class GetAttributesAttributesInner extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getAttributes_attributes'; + protected static string $openAPIModelName = 'getAttributes_attributes_inner'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string', 'category' => 'string', 'type' => 'string', - 'enumeration' => '\Brevo\Client\Models\GetAttributesEnumeration[]', + 'enumeration' => '\Brevo\Client\Models\GetAttributesAttributesInnerEnumerationInner[]', 'calculatedValue' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null, 'category' => null, 'type' => null, @@ -78,32 +80,32 @@ class GetAttributesAttributes implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'category' => false, + 'type' => false, + 'enumeration' => false, + 'calculatedValue' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name', 'category' => 'category', 'type' => 'type', @@ -114,9 +116,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName', 'category' => 'setCategory', 'type' => 'setType', @@ -127,9 +129,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName', 'category' => 'getCategory', 'type' => 'getType', @@ -141,9 +143,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -151,9 +153,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -161,36 +163,24 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } + public const CATEGORY_NORMAL = 'normal'; + public const CATEGORY_TRANSACTIONAL = 'transactional'; + public const CATEGORY_CATEGORY = 'category'; + public const CATEGORY_CALCULATED = 'calculated'; + public const CATEGORY__GLOBAL = 'global'; + public const TYPE_TEXT = 'text'; + public const TYPE_DATE = 'date'; + public const TYPE_FLOAT = 'float'; + public const TYPE_ID = 'id'; + public const TYPE_BOOLEAN = 'boolean'; - const CATEGORY_NORMAL = 'normal'; - const CATEGORY_TRANSACTIONAL = 'transactional'; - const CATEGORY_CATEGORY = 'category'; - const CATEGORY_CALCULATED = 'calculated'; - const CATEGORY__GLOBAL = 'global'; - const TYPE_TEXT = 'text'; - const TYPE_DATE = 'date'; - const TYPE_FLOAT = 'float'; - const TYPE_ID = 'id'; - const TYPE_BOOLEAN = 'boolean'; - - - /** * Gets allowable values of the enum * @@ -206,7 +196,7 @@ public function getCategoryAllowableValues() self::CATEGORY__GLOBAL, ]; } - + /** * Gets allowable values of the enum * @@ -222,36 +212,34 @@ public function getTypeAllowableValues() self::TYPE_BOOLEAN, ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['category'] = isset($data['category']) ? $data['category'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['enumeration'] = isset($data['enumeration']) ? $data['enumeration'] : null; - $this->container['calculatedValue'] = isset($data['calculatedValue']) ? $data['calculatedValue'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('enumeration', $data ?? [], null); + $this->setIfExists('calculatedValue', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -264,7 +252,8 @@ public function listInvalidProperties() $allowedValues = $this->getCategoryAllowableValues(); if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'category', must be one of '%s'", + "invalid value '%s' for 'category', must be one of '%s'", + $this->container['category'], implode("', '", $allowedValues) ); } @@ -272,7 +261,8 @@ public function listInvalidProperties() $allowedValues = $this->getTypeAllowableValues(); if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], implode("', '", $allowedValues) ); } @@ -280,24 +270,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -309,8 +287,11 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -321,7 +302,7 @@ public function setName($name) * * @return string */ - public function getCategory() + public function getCategory(): string { return $this->container['category']; } @@ -333,13 +314,17 @@ public function getCategory() * * @return $this */ - public function setCategory($category) + public function setCategory(string $category): static { + if (is_null($category)) { + throw new InvalidArgumentException('non-nullable category cannot be null'); + } $allowedValues = $this->getCategoryAllowableValues(); if (!in_array($category, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'category', must be one of '%s'", + "Invalid value '%s' for 'category', must be one of '%s'", + $category, implode("', '", $allowedValues) ) ); @@ -352,9 +337,9 @@ public function setCategory($category) /** * Gets type * - * @return string + * @return string|null */ - public function getType() + public function getType(): ?string { return $this->container['type']; } @@ -362,17 +347,21 @@ public function getType() /** * Sets type * - * @param string $type Type of the attribute + * @param string|null $type Type of the attribute * * @return $this */ - public function setType($type) + public function setType(?string $type): static { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($type) && !in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( sprintf( - "Invalid value for 'type', must be one of '%s'", + "Invalid value '%s' for 'type', must be one of '%s'", + $type, implode("', '", $allowedValues) ) ); @@ -385,9 +374,9 @@ public function setType($type) /** * Gets enumeration * - * @return \Brevo\Client\Models\GetAttributesEnumeration[] + * @return \Brevo\Client\Models\GetAttributesAttributesInnerEnumerationInner[]|null */ - public function getEnumeration() + public function getEnumeration(): ?array { return $this->container['enumeration']; } @@ -395,12 +384,15 @@ public function getEnumeration() /** * Sets enumeration * - * @param \Brevo\Client\Models\GetAttributesEnumeration[] $enumeration Parameter only available for \"category\" type attributes. + * @param \Brevo\Client\Models\GetAttributesAttributesInnerEnumerationInner[]|null $enumeration Parameter only available for \"category\" type attributes. * * @return $this */ - public function setEnumeration($enumeration) + public function setEnumeration(?array $enumeration): static { + if (is_null($enumeration)) { + throw new InvalidArgumentException('non-nullable enumeration cannot be null'); + } $this->container['enumeration'] = $enumeration; return $this; @@ -409,9 +401,9 @@ public function setEnumeration($enumeration) /** * Gets calculatedValue * - * @return string + * @return string|null */ - public function getCalculatedValue() + public function getCalculatedValue(): ?string { return $this->container['calculatedValue']; } @@ -419,89 +411,19 @@ public function getCalculatedValue() /** * Sets calculatedValue * - * @param string $calculatedValue Calculated value formula + * @param string|null $calculatedValue Calculated value formula * * @return $this */ - public function setCalculatedValue($calculatedValue) + public function setCalculatedValue(?string $calculatedValue): static { + if (is_null($calculatedValue)) { + throw new InvalidArgumentException('non-nullable calculatedValue cannot be null'); + } $this->container['calculatedValue'] = $calculatedValue; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetAttributesAttributesInnerEnumerationInner.php b/lib/Models/GetAttributesAttributesInnerEnumerationInner.php new file mode 100644 index 0000000..74a0db3 --- /dev/null +++ b/lib/Models/GetAttributesAttributesInnerEnumerationInner.php @@ -0,0 +1,247 @@ + + */ +class GetAttributesAttributesInnerEnumerationInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getAttributes_attributes_inner_enumeration_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'value' => 'int', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'value' => 'int64', + 'label' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'value' => false, + 'label' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'value' => 'value', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'value' => 'setValue', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'value' => 'getValue', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets value + * + * @return int + */ + public function getValue(): int + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param int $value ID of Value of the \"category\" type attribute + * + * @return $this + */ + public function setValue(int $value): static + { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets label + * + * @return string + */ + public function getLabel(): string + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string $label Label of the \"category\" type attribute + * + * @return $this + */ + public function setLabel(string $label): static + { + if (is_null($label)) { + throw new InvalidArgumentException('non-nullable label cannot be null'); + } + $this->container['label'] = $label; + + return $this; + } +} + + diff --git a/lib/Models/GetAttributesEnumeration.php b/lib/Models/GetAttributesEnumeration.php deleted file mode 100644 index 8b726cc..0000000 --- a/lib/Models/GetAttributesEnumeration.php +++ /dev/null @@ -1,341 +0,0 @@ - 'int', - 'label' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'value' => 'int64', - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'value' => 'value', - 'label' => 'label' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'value' => 'setValue', - 'label' => 'setLabel' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'value' => 'getValue', - '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 - */ - public function __construct(array $data = null) - { - $this->container['value'] = isset($data['value']) ? $data['value'] : null; - $this->container['label'] = isset($data['label']) ? $data['label'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['value'] === null) { - $invalidProperties[] = "'value' can't be null"; - } - if ($this->container['label'] === null) { - $invalidProperties[] = "'label' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets value - * - * @return int - */ - public function getValue() - { - return $this->container['value']; - } - - /** - * Sets value - * - * @param int $value ID of Value of the \"category\" type attribute - * - * @return $this - */ - public function setValue($value) - { - $this->container['value'] = $value; - - return $this; - } - - /** - * Gets label - * - * @return string - */ - public function getLabel() - { - return $this->container['label']; - } - - /** - * Sets label - * - * @param string $label Label of the \"category\" type attribute - * - * @return $this - */ - public function setLabel($label) - { - $this->container['label'] = $label; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetBlockedDomains.php b/lib/Models/GetBlockedDomains.php index d4bb11e..f6a3c9a 100644 --- a/lib/Models/GetBlockedDomains.php +++ b/lib/Models/GetBlockedDomains.php @@ -2,119 +2,116 @@ /** * GetBlockedDomains * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetBlockedDomains Class Doc Comment * - * @category Class - * @description list of blocked domains * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetBlockedDomains implements ModelInterface, ArrayAccess +class GetBlockedDomains extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getBlockedDomains'; + protected static string $openAPIModelName = 'getBlockedDomains'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'domains' => 'string[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'domains' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'domains' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'domains' => 'domains' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'domains' => 'setDomains' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'domains' => 'getDomains' ]; @@ -122,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -132,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -142,51 +139,37 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['domains'] = isset($data['domains']) ? $data['domains'] : null; + $this->setIfExists('domains', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -196,24 +179,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets domains * * @return string[] */ - public function getDomains() + public function getDomains(): array { return $this->container['domains']; } @@ -225,85 +196,15 @@ public function getDomains() * * @return $this */ - public function setDomains($domains) + public function setDomains(array $domains): static { + if (is_null($domains)) { + throw new InvalidArgumentException('non-nullable domains cannot be null'); + } $this->container['domains'] = $domains; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetCampaignOverview.php b/lib/Models/GetCampaignOverview.php index 23d6a5c..3dcd127 100644 --- a/lib/Models/GetCampaignOverview.php +++ b/lib/Models/GetCampaignOverview.php @@ -2,67 +2,69 @@ /** * GetCampaignOverview * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetCampaignOverview Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetCampaignOverview implements ModelInterface, ArrayAccess +class GetCampaignOverview extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getCampaignOverview'; + protected static string $openAPIModelName = 'getCampaignOverview'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'name' => 'string', - 'subject' => 'string', - 'previewText' => 'string', 'type' => 'string', 'status' => 'string', + 'subject' => 'string', + 'previewText' => 'string', 'scheduledAt' => 'string', 'abTesting' => 'bool', 'subjectA' => 'string', @@ -76,15 +78,15 @@ class GetCampaignOverview implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'name' => null, - 'subject' => null, - 'previewText' => null, 'type' => null, 'status' => null, + 'subject' => null, + 'previewText' => null, 'scheduledAt' => null, 'abTesting' => null, 'subjectA' => null, @@ -96,38 +98,47 @@ class GetCampaignOverview implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'type' => false, + 'status' => false, + 'subject' => false, + 'previewText' => false, + 'scheduledAt' => false, + 'abTesting' => false, + 'subjectA' => false, + 'subjectB' => false, + 'splitRule' => false, + 'winnerCriteria' => false, + 'winnerDelay' => false, + 'sendAtBestTime' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name', - 'subject' => 'subject', - 'previewText' => 'previewText', 'type' => 'type', 'status' => 'status', + 'subject' => 'subject', + 'previewText' => 'previewText', 'scheduledAt' => 'scheduledAt', 'abTesting' => 'abTesting', 'subjectA' => 'subjectA', @@ -141,15 +152,15 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName', - 'subject' => 'setSubject', - 'previewText' => 'setPreviewText', 'type' => 'setType', 'status' => 'setStatus', + 'subject' => 'setSubject', + 'previewText' => 'setPreviewText', 'scheduledAt' => 'setScheduledAt', 'abTesting' => 'setAbTesting', 'subjectA' => 'setSubjectA', @@ -163,15 +174,15 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName', - 'subject' => 'getSubject', - 'previewText' => 'getPreviewText', 'type' => 'getType', 'status' => 'getStatus', + 'subject' => 'getSubject', + 'previewText' => 'getPreviewText', 'scheduledAt' => 'getScheduledAt', 'abTesting' => 'getAbTesting', 'subjectA' => 'getSubjectA', @@ -186,9 +197,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -196,9 +207,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -206,33 +217,21 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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'; - const STATUS_SENT = 'sent'; - const STATUS_ARCHIVE = 'archive'; - const STATUS_QUEUED = 'queued'; - const STATUS_SUSPENDED = 'suspended'; - const STATUS_IN_PROCESS = 'in_process'; - - + public const TYPE_CLASSIC = 'classic'; + public const TYPE_TRIGGER = 'trigger'; + public const STATUS_DRAFT = 'draft'; + public const STATUS_SENT = 'sent'; + public const STATUS_ARCHIVE = 'archive'; + public const STATUS_QUEUED = 'queued'; + public const STATUS_SUSPENDED = 'suspended'; + public const STATUS_IN_PROCESS = 'in_process'; /** * Gets allowable values of the enum @@ -264,44 +263,42 @@ public function getStatusAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['subject'] = isset($data['subject']) ? $data['subject'] : null; - $this->container['previewText'] = isset($data['previewText']) ? $data['previewText'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['scheduledAt'] = isset($data['scheduledAt']) ? $data['scheduledAt'] : null; - $this->container['abTesting'] = isset($data['abTesting']) ? $data['abTesting'] : null; - $this->container['subjectA'] = isset($data['subjectA']) ? $data['subjectA'] : null; - $this->container['subjectB'] = isset($data['subjectB']) ? $data['subjectB'] : null; - $this->container['splitRule'] = isset($data['splitRule']) ? $data['splitRule'] : null; - $this->container['winnerCriteria'] = isset($data['winnerCriteria']) ? $data['winnerCriteria'] : null; - $this->container['winnerDelay'] = isset($data['winnerDelay']) ? $data['winnerDelay'] : null; - $this->container['sendAtBestTime'] = isset($data['sendAtBestTime']) ? $data['sendAtBestTime'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('previewText', $data ?? [], null); + $this->setIfExists('scheduledAt', $data ?? [], null); + $this->setIfExists('abTesting', $data ?? [], null); + $this->setIfExists('subjectA', $data ?? [], null); + $this->setIfExists('subjectB', $data ?? [], null); + $this->setIfExists('splitRule', $data ?? [], null); + $this->setIfExists('winnerCriteria', $data ?? [], null); + $this->setIfExists('winnerDelay', $data ?? [], null); + $this->setIfExists('sendAtBestTime', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -317,7 +314,8 @@ public function listInvalidProperties() $allowedValues = $this->getTypeAllowableValues(); if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], implode("', '", $allowedValues) ); } @@ -328,7 +326,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -336,24 +335,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -365,8 +352,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -377,7 +367,7 @@ public function setId($id) * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -389,123 +379,140 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; } /** - * Gets subject + * Gets type * * @return string */ - public function getSubject() + public function getType(): string { - return $this->container['subject']; + return $this->container['type']; } /** - * Sets subject + * Sets type * - * @param string $subject Subject of the campaign. Only available if `abTesting` flag of the campaign is `false` + * @param string $type Type of campaign * * @return $this */ - public function setSubject($subject) + public function setType(string $type): static { - $this->container['subject'] = $subject; + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; return $this; } /** - * Gets previewText + * Gets status * * @return string */ - public function getPreviewText() + public function getStatus(): string { - return $this->container['previewText']; + return $this->container['status']; } /** - * Sets previewText + * Sets status * - * @param string $previewText Preview text or preheader of the email campaign + * @param string $status Status of the campaign * * @return $this */ - public function setPreviewText($previewText) + public function setStatus(string $status): static { - $this->container['previewText'] = $previewText; + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; return $this; } /** - * Gets type + * Gets subject * - * @return string + * @return string|null */ - public function getType() + public function getSubject(): ?string { - return $this->container['type']; + return $this->container['subject']; } /** - * Sets type + * Sets subject * - * @param string $type Type of campaign + * @param string|null $subject Subject of the campaign. Only available if `abTesting` flag of the campaign is `false` * * @return $this */ - public function setType($type) + public function setSubject(?string $subject): static { - $allowedValues = $this->getTypeAllowableValues(); - if (!in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'type', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); } - $this->container['type'] = $type; + $this->container['subject'] = $subject; return $this; } /** - * Gets status + * Gets previewText * - * @return string + * @return string|null */ - public function getStatus() + public function getPreviewText(): ?string { - return $this->container['status']; + return $this->container['previewText']; } /** - * Sets status + * Sets previewText * - * @param string $status Status of the campaign + * @param string|null $previewText Preview text or preheader of the email campaign * * @return $this */ - public function setStatus($status) + public function setPreviewText(?string $previewText): static { - $allowedValues = $this->getStatusAllowableValues(); - if (!in_array($status, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'status', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); + if (is_null($previewText)) { + throw new InvalidArgumentException('non-nullable previewText cannot be null'); } - $this->container['status'] = $status; + $this->container['previewText'] = $previewText; return $this; } @@ -513,9 +520,9 @@ public function setStatus($status) /** * Gets scheduledAt * - * @return string + * @return string|null */ - public function getScheduledAt() + public function getScheduledAt(): ?string { return $this->container['scheduledAt']; } @@ -523,12 +530,15 @@ public function getScheduledAt() /** * Sets scheduledAt * - * @param string $scheduledAt UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) + * @param string|null $scheduledAt UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) * * @return $this */ - public function setScheduledAt($scheduledAt) + public function setScheduledAt(?string $scheduledAt): static { + if (is_null($scheduledAt)) { + throw new InvalidArgumentException('non-nullable scheduledAt cannot be null'); + } $this->container['scheduledAt'] = $scheduledAt; return $this; @@ -537,9 +547,9 @@ public function setScheduledAt($scheduledAt) /** * Gets abTesting * - * @return bool + * @return bool|null */ - public function getAbTesting() + public function getAbTesting(): ?bool { return $this->container['abTesting']; } @@ -547,12 +557,15 @@ public function getAbTesting() /** * Sets abTesting * - * @param bool $abTesting Status of A/B Test for the campaign. abTesting = false means it is disabled, & abTesting = true means it is enabled. + * @param bool|null $abTesting Status of A/B Test for the campaign. abTesting = false means it is disabled, & abTesting = true means it is enabled. * * @return $this */ - public function setAbTesting($abTesting) + public function setAbTesting(?bool $abTesting): static { + if (is_null($abTesting)) { + throw new InvalidArgumentException('non-nullable abTesting cannot be null'); + } $this->container['abTesting'] = $abTesting; return $this; @@ -561,9 +574,9 @@ public function setAbTesting($abTesting) /** * Gets subjectA * - * @return string + * @return string|null */ - public function getSubjectA() + public function getSubjectA(): ?string { return $this->container['subjectA']; } @@ -571,12 +584,15 @@ public function getSubjectA() /** * Sets subjectA * - * @param string $subjectA Subject A of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` + * @param string|null $subjectA Subject A of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` * * @return $this */ - public function setSubjectA($subjectA) + public function setSubjectA(?string $subjectA): static { + if (is_null($subjectA)) { + throw new InvalidArgumentException('non-nullable subjectA cannot be null'); + } $this->container['subjectA'] = $subjectA; return $this; @@ -585,9 +601,9 @@ public function setSubjectA($subjectA) /** * Gets subjectB * - * @return string + * @return string|null */ - public function getSubjectB() + public function getSubjectB(): ?string { return $this->container['subjectB']; } @@ -595,12 +611,15 @@ public function getSubjectB() /** * Sets subjectB * - * @param string $subjectB Subject B of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` + * @param string|null $subjectB Subject B of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` * * @return $this */ - public function setSubjectB($subjectB) + public function setSubjectB(?string $subjectB): static { + if (is_null($subjectB)) { + throw new InvalidArgumentException('non-nullable subjectB cannot be null'); + } $this->container['subjectB'] = $subjectB; return $this; @@ -609,9 +628,9 @@ public function setSubjectB($subjectB) /** * Gets splitRule * - * @return int + * @return int|null */ - public function getSplitRule() + public function getSplitRule(): ?int { return $this->container['splitRule']; } @@ -619,12 +638,15 @@ public function getSplitRule() /** * Sets splitRule * - * @param int $splitRule The size of your ab-test groups. Only available if `abTesting` flag of the campaign is `true` + * @param int|null $splitRule The size of your ab-test groups. Only available if `abTesting` flag of the campaign is `true` * * @return $this */ - public function setSplitRule($splitRule) + public function setSplitRule(?int $splitRule): static { + if (is_null($splitRule)) { + throw new InvalidArgumentException('non-nullable splitRule cannot be null'); + } $this->container['splitRule'] = $splitRule; return $this; @@ -633,9 +655,9 @@ public function setSplitRule($splitRule) /** * Gets winnerCriteria * - * @return string + * @return string|null */ - public function getWinnerCriteria() + public function getWinnerCriteria(): ?string { return $this->container['winnerCriteria']; } @@ -643,12 +665,15 @@ public function getWinnerCriteria() /** * Sets winnerCriteria * - * @param string $winnerCriteria Criteria for the winning version. Only available if `abTesting` flag of the campaign is `true` + * @param string|null $winnerCriteria Criteria for the winning version. Only available if `abTesting` flag of the campaign is `true` * * @return $this */ - public function setWinnerCriteria($winnerCriteria) + public function setWinnerCriteria(?string $winnerCriteria): static { + if (is_null($winnerCriteria)) { + throw new InvalidArgumentException('non-nullable winnerCriteria cannot be null'); + } $this->container['winnerCriteria'] = $winnerCriteria; return $this; @@ -657,9 +682,9 @@ public function setWinnerCriteria($winnerCriteria) /** * Gets winnerDelay * - * @return int + * @return int|null */ - public function getWinnerDelay() + public function getWinnerDelay(): ?int { return $this->container['winnerDelay']; } @@ -667,12 +692,15 @@ public function getWinnerDelay() /** * Sets winnerDelay * - * @param int $winnerDelay The duration of the test in hours at the end of which the winning version will be sent. Only available if `abTesting` flag of the campaign is `true` + * @param int|null $winnerDelay The duration of the test in hours at the end of which the winning version will be sent. Only available if `abTesting` flag of the campaign is `true` * * @return $this */ - public function setWinnerDelay($winnerDelay) + public function setWinnerDelay(?int $winnerDelay): static { + if (is_null($winnerDelay)) { + throw new InvalidArgumentException('non-nullable winnerDelay cannot be null'); + } $this->container['winnerDelay'] = $winnerDelay; return $this; @@ -681,9 +709,9 @@ public function setWinnerDelay($winnerDelay) /** * Gets sendAtBestTime * - * @return bool + * @return bool|null */ - public function getSendAtBestTime() + public function getSendAtBestTime(): ?bool { return $this->container['sendAtBestTime']; } @@ -691,89 +719,19 @@ public function getSendAtBestTime() /** * Sets sendAtBestTime * - * @param bool $sendAtBestTime It is true if you have chosen to send your campaign at best time, otherwise it is false + * @param bool|null $sendAtBestTime It is true if you have chosen to send your campaign at best time, otherwise it is false * * @return $this */ - public function setSendAtBestTime($sendAtBestTime) + public function setSendAtBestTime(?bool $sendAtBestTime): static { + if (is_null($sendAtBestTime)) { + throw new InvalidArgumentException('non-nullable sendAtBestTime cannot be null'); + } $this->container['sendAtBestTime'] = $sendAtBestTime; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetCampaignRecipients.php b/lib/Models/GetCampaignRecipients.php index 1d14587..4229d97 100644 --- a/lib/Models/GetCampaignRecipients.php +++ b/lib/Models/GetCampaignRecipients.php @@ -2,61 +2,63 @@ /** * GetCampaignRecipients * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetCampaignRecipients Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetCampaignRecipients implements ModelInterface, ArrayAccess +class GetCampaignRecipients extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getCampaignRecipients'; + protected static string $openAPIModelName = 'getCampaignRecipients'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'lists' => 'int[]', 'exclusionLists' => 'int[]' ]; @@ -64,40 +66,37 @@ class GetCampaignRecipients implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'lists' => 'int64', 'exclusionLists' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'lists' => false, + 'exclusionLists' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'lists' => 'lists', 'exclusionLists' => 'exclusionLists' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'lists' => 'setLists', 'exclusionLists' => 'setExclusionLists' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'lists' => 'getLists', 'exclusionLists' => 'getExclusionLists' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,52 +145,38 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['lists'] = isset($data['lists']) ? $data['lists'] : null; - $this->container['exclusionLists'] = isset($data['exclusionLists']) ? $data['exclusionLists'] : null; + $this->setIfExists('lists', $data ?? [], null); + $this->setIfExists('exclusionLists', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -204,24 +189,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets lists * * @return int[] */ - public function getLists() + public function getLists(): array { return $this->container['lists']; } @@ -233,8 +206,11 @@ public function getLists() * * @return $this */ - public function setLists($lists) + public function setLists(array $lists): static { + if (is_null($lists)) { + throw new InvalidArgumentException('non-nullable lists cannot be null'); + } $this->container['lists'] = $lists; return $this; @@ -245,7 +221,7 @@ public function setLists($lists) * * @return int[] */ - public function getExclusionLists() + public function getExclusionLists(): array { return $this->container['exclusionLists']; } @@ -257,85 +233,15 @@ public function getExclusionLists() * * @return $this */ - public function setExclusionLists($exclusionLists) + public function setExclusionLists(array $exclusionLists): static { + if (is_null($exclusionLists)) { + throw new InvalidArgumentException('non-nullable exclusionLists cannot be null'); + } $this->container['exclusionLists'] = $exclusionLists; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetCampaignStats.php b/lib/Models/GetCampaignStats.php index 03c5f2e..6a5452d 100644 --- a/lib/Models/GetCampaignStats.php +++ b/lib/Models/GetCampaignStats.php @@ -2,62 +2,63 @@ /** * GetCampaignStats * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetCampaignStats Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetCampaignStats implements ModelInterface, ArrayAccess +class GetCampaignStats extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getCampaignStats'; + protected static string $openAPIModelName = 'getCampaignStats'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'listId' => 'int', + protected static array $openAPITypes = [ 'uniqueClicks' => 'int', 'clickers' => 'int', 'complaints' => 'int', @@ -67,10 +68,11 @@ class GetCampaignStats implements ModelInterface, ArrayAccess 'hardBounces' => 'int', 'uniqueViews' => 'int', 'trackableViews' => 'int', - 'trackableViewsRate' => 'float', - 'estimatedViews' => 'int', 'unsubscriptions' => 'int', 'viewed' => 'int', + 'listId' => 'int', + 'trackableViewsRate' => 'float', + 'estimatedViews' => 'int', 'deferred' => 'int', 'returnBounce' => 'int' ]; @@ -78,10 +80,9 @@ class GetCampaignStats implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'listId' => 'int64', + protected static array $openAPIFormats = [ 'uniqueClicks' => 'int64', 'clickers' => 'int64', 'complaints' => 'int64', @@ -91,42 +92,53 @@ class GetCampaignStats implements ModelInterface, ArrayAccess 'hardBounces' => 'int64', 'uniqueViews' => 'int64', 'trackableViews' => 'int64', - 'trackableViewsRate' => 'float', - 'estimatedViews' => 'int64', 'unsubscriptions' => 'int64', 'viewed' => 'int64', + 'listId' => 'int64', + 'trackableViewsRate' => 'float', + 'estimatedViews' => 'int64', 'deferred' => 'int64', 'returnBounce' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'uniqueClicks' => false, + 'clickers' => false, + 'complaints' => false, + 'delivered' => false, + 'sent' => false, + 'softBounces' => false, + 'hardBounces' => false, + 'uniqueViews' => false, + 'trackableViews' => false, + 'unsubscriptions' => false, + 'viewed' => false, + 'listId' => false, + 'trackableViewsRate' => false, + 'estimatedViews' => false, + 'deferred' => false, + 'returnBounce' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ - 'listId' => 'listId', + protected static array $attributeMap = [ 'uniqueClicks' => 'uniqueClicks', 'clickers' => 'clickers', 'complaints' => 'complaints', @@ -136,10 +148,11 @@ public static function swaggerFormats() 'hardBounces' => 'hardBounces', 'uniqueViews' => 'uniqueViews', 'trackableViews' => 'trackableViews', - 'trackableViewsRate' => 'trackableViewsRate', - 'estimatedViews' => 'estimatedViews', 'unsubscriptions' => 'unsubscriptions', 'viewed' => 'viewed', + 'listId' => 'listId', + 'trackableViewsRate' => 'trackableViewsRate', + 'estimatedViews' => 'estimatedViews', 'deferred' => 'deferred', 'returnBounce' => 'returnBounce' ]; @@ -147,10 +160,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ - 'listId' => 'setListId', + protected static array $setters = [ 'uniqueClicks' => 'setUniqueClicks', 'clickers' => 'setClickers', 'complaints' => 'setComplaints', @@ -160,10 +172,11 @@ public static function swaggerFormats() 'hardBounces' => 'setHardBounces', 'uniqueViews' => 'setUniqueViews', 'trackableViews' => 'setTrackableViews', - 'trackableViewsRate' => 'setTrackableViewsRate', - 'estimatedViews' => 'setEstimatedViews', 'unsubscriptions' => 'setUnsubscriptions', 'viewed' => 'setViewed', + 'listId' => 'setListId', + 'trackableViewsRate' => 'setTrackableViewsRate', + 'estimatedViews' => 'setEstimatedViews', 'deferred' => 'setDeferred', 'returnBounce' => 'setReturnBounce' ]; @@ -171,10 +184,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ - 'listId' => 'getListId', + protected static array $getters = [ 'uniqueClicks' => 'getUniqueClicks', 'clickers' => 'getClickers', 'complaints' => 'getComplaints', @@ -184,10 +196,11 @@ public static function swaggerFormats() 'hardBounces' => 'getHardBounces', 'uniqueViews' => 'getUniqueViews', 'trackableViews' => 'getTrackableViews', - 'trackableViewsRate' => 'getTrackableViewsRate', - 'estimatedViews' => 'getEstimatedViews', 'unsubscriptions' => 'getUnsubscriptions', 'viewed' => 'getViewed', + 'listId' => 'getListId', + 'trackableViewsRate' => 'getTrackableViewsRate', + 'estimatedViews' => 'getEstimatedViews', 'deferred' => 'getDeferred', 'returnBounce' => 'getReturnBounce' ]; @@ -196,9 +209,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -206,9 +219,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -216,66 +229,52 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['listId'] = isset($data['listId']) ? $data['listId'] : null; - $this->container['uniqueClicks'] = isset($data['uniqueClicks']) ? $data['uniqueClicks'] : null; - $this->container['clickers'] = isset($data['clickers']) ? $data['clickers'] : null; - $this->container['complaints'] = isset($data['complaints']) ? $data['complaints'] : null; - $this->container['delivered'] = isset($data['delivered']) ? $data['delivered'] : null; - $this->container['sent'] = isset($data['sent']) ? $data['sent'] : null; - $this->container['softBounces'] = isset($data['softBounces']) ? $data['softBounces'] : null; - $this->container['hardBounces'] = isset($data['hardBounces']) ? $data['hardBounces'] : null; - $this->container['uniqueViews'] = isset($data['uniqueViews']) ? $data['uniqueViews'] : null; - $this->container['trackableViews'] = isset($data['trackableViews']) ? $data['trackableViews'] : null; - $this->container['trackableViewsRate'] = isset($data['trackableViewsRate']) ? $data['trackableViewsRate'] : null; - $this->container['estimatedViews'] = isset($data['estimatedViews']) ? $data['estimatedViews'] : null; - $this->container['unsubscriptions'] = isset($data['unsubscriptions']) ? $data['unsubscriptions'] : null; - $this->container['viewed'] = isset($data['viewed']) ? $data['viewed'] : null; - $this->container['deferred'] = isset($data['deferred']) ? $data['deferred'] : null; - $this->container['returnBounce'] = isset($data['returnBounce']) ? $data['returnBounce'] : null; + $this->setIfExists('uniqueClicks', $data ?? [], null); + $this->setIfExists('clickers', $data ?? [], null); + $this->setIfExists('complaints', $data ?? [], null); + $this->setIfExists('delivered', $data ?? [], null); + $this->setIfExists('sent', $data ?? [], null); + $this->setIfExists('softBounces', $data ?? [], null); + $this->setIfExists('hardBounces', $data ?? [], null); + $this->setIfExists('uniqueViews', $data ?? [], null); + $this->setIfExists('trackableViews', $data ?? [], null); + $this->setIfExists('unsubscriptions', $data ?? [], null); + $this->setIfExists('viewed', $data ?? [], null); + $this->setIfExists('listId', $data ?? [], null); + $this->setIfExists('trackableViewsRate', $data ?? [], null); + $this->setIfExists('estimatedViews', $data ?? [], null); + $this->setIfExists('deferred', $data ?? [], null); + $this->setIfExists('returnBounce', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -315,48 +314,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets listId - * - * @return int - */ - public function getListId() - { - return $this->container['listId']; - } - - /** - * Sets listId - * - * @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) - { - $this->container['listId'] = $listId; - - return $this; - } - /** * Gets uniqueClicks * * @return int */ - public function getUniqueClicks() + public function getUniqueClicks(): int { return $this->container['uniqueClicks']; } @@ -368,8 +331,11 @@ public function getUniqueClicks() * * @return $this */ - public function setUniqueClicks($uniqueClicks) + public function setUniqueClicks(int $uniqueClicks): static { + if (is_null($uniqueClicks)) { + throw new InvalidArgumentException('non-nullable uniqueClicks cannot be null'); + } $this->container['uniqueClicks'] = $uniqueClicks; return $this; @@ -380,7 +346,7 @@ public function setUniqueClicks($uniqueClicks) * * @return int */ - public function getClickers() + public function getClickers(): int { return $this->container['clickers']; } @@ -392,8 +358,11 @@ public function getClickers() * * @return $this */ - public function setClickers($clickers) + public function setClickers(int $clickers): static { + if (is_null($clickers)) { + throw new InvalidArgumentException('non-nullable clickers cannot be null'); + } $this->container['clickers'] = $clickers; return $this; @@ -404,7 +373,7 @@ public function setClickers($clickers) * * @return int */ - public function getComplaints() + public function getComplaints(): int { return $this->container['complaints']; } @@ -416,8 +385,11 @@ public function getComplaints() * * @return $this */ - public function setComplaints($complaints) + public function setComplaints(int $complaints): static { + if (is_null($complaints)) { + throw new InvalidArgumentException('non-nullable complaints cannot be null'); + } $this->container['complaints'] = $complaints; return $this; @@ -428,7 +400,7 @@ public function setComplaints($complaints) * * @return int */ - public function getDelivered() + public function getDelivered(): int { return $this->container['delivered']; } @@ -440,8 +412,11 @@ public function getDelivered() * * @return $this */ - public function setDelivered($delivered) + public function setDelivered(int $delivered): static { + if (is_null($delivered)) { + throw new InvalidArgumentException('non-nullable delivered cannot be null'); + } $this->container['delivered'] = $delivered; return $this; @@ -452,7 +427,7 @@ public function setDelivered($delivered) * * @return int */ - public function getSent() + public function getSent(): int { return $this->container['sent']; } @@ -464,8 +439,11 @@ public function getSent() * * @return $this */ - public function setSent($sent) + public function setSent(int $sent): static { + if (is_null($sent)) { + throw new InvalidArgumentException('non-nullable sent cannot be null'); + } $this->container['sent'] = $sent; return $this; @@ -476,7 +454,7 @@ public function setSent($sent) * * @return int */ - public function getSoftBounces() + public function getSoftBounces(): int { return $this->container['softBounces']; } @@ -488,8 +466,11 @@ public function getSoftBounces() * * @return $this */ - public function setSoftBounces($softBounces) + public function setSoftBounces(int $softBounces): static { + if (is_null($softBounces)) { + throw new InvalidArgumentException('non-nullable softBounces cannot be null'); + } $this->container['softBounces'] = $softBounces; return $this; @@ -500,7 +481,7 @@ public function setSoftBounces($softBounces) * * @return int */ - public function getHardBounces() + public function getHardBounces(): int { return $this->container['hardBounces']; } @@ -512,8 +493,11 @@ public function getHardBounces() * * @return $this */ - public function setHardBounces($hardBounces) + public function setHardBounces(int $hardBounces): static { + if (is_null($hardBounces)) { + throw new InvalidArgumentException('non-nullable hardBounces cannot be null'); + } $this->container['hardBounces'] = $hardBounces; return $this; @@ -524,7 +508,7 @@ public function setHardBounces($hardBounces) * * @return int */ - public function getUniqueViews() + public function getUniqueViews(): int { return $this->container['uniqueViews']; } @@ -536,8 +520,11 @@ public function getUniqueViews() * * @return $this */ - public function setUniqueViews($uniqueViews) + public function setUniqueViews(int $uniqueViews): static { + if (is_null($uniqueViews)) { + throw new InvalidArgumentException('non-nullable uniqueViews cannot be null'); + } $this->container['uniqueViews'] = $uniqueViews; return $this; @@ -548,7 +535,7 @@ public function setUniqueViews($uniqueViews) * * @return int */ - public function getTrackableViews() + public function getTrackableViews(): int { return $this->container['trackableViews']; } @@ -560,228 +547,203 @@ public function getTrackableViews() * * @return $this */ - public function setTrackableViews($trackableViews) + public function setTrackableViews(int $trackableViews): static { + if (is_null($trackableViews)) { + throw new InvalidArgumentException('non-nullable trackableViews cannot be null'); + } $this->container['trackableViews'] = $trackableViews; return $this; } /** - * Gets trackableViewsRate + * Gets unsubscriptions * - * @return float + * @return int */ - public function getTrackableViewsRate() + public function getUnsubscriptions(): int { - return $this->container['trackableViewsRate']; + return $this->container['unsubscriptions']; } /** - * Sets trackableViewsRate + * Sets unsubscriptions * - * @param float $trackableViewsRate Rate of recipients without any privacy protection option enabled in their email client + * @param int $unsubscriptions Number of unsubscription for the campaign * * @return $this */ - public function setTrackableViewsRate($trackableViewsRate) + public function setUnsubscriptions(int $unsubscriptions): static { - $this->container['trackableViewsRate'] = $trackableViewsRate; + if (is_null($unsubscriptions)) { + throw new InvalidArgumentException('non-nullable unsubscriptions cannot be null'); + } + $this->container['unsubscriptions'] = $unsubscriptions; return $this; } /** - * Gets estimatedViews + * Gets viewed * * @return int */ - public function getEstimatedViews() + public function getViewed(): int { - return $this->container['estimatedViews']; + return $this->container['viewed']; } /** - * Sets estimatedViews + * Sets viewed * - * @param int $estimatedViews Rate of recipients without any privacy protection option enabled in their email client, applied to all delivered emails + * @param int $viewed Number of openings for the campaign * * @return $this */ - public function setEstimatedViews($estimatedViews) + public function setViewed(int $viewed): static { - $this->container['estimatedViews'] = $estimatedViews; + if (is_null($viewed)) { + throw new InvalidArgumentException('non-nullable viewed cannot be null'); + } + $this->container['viewed'] = $viewed; return $this; } /** - * Gets unsubscriptions + * Gets listId * - * @return int + * @return int|null */ - public function getUnsubscriptions() + public function getListId(): ?int { - return $this->container['unsubscriptions']; + return $this->container['listId']; } /** - * Sets unsubscriptions + * Sets listId * - * @param int $unsubscriptions Number of unsubscription for the campaign + * @param int|null $listId List Id of email campaign (only in case of get email campaign(s)(not for global stats)) * * @return $this */ - public function setUnsubscriptions($unsubscriptions) + public function setListId(?int $listId): static { - $this->container['unsubscriptions'] = $unsubscriptions; + if (is_null($listId)) { + throw new InvalidArgumentException('non-nullable listId cannot be null'); + } + $this->container['listId'] = $listId; return $this; } /** - * Gets viewed + * Gets trackableViewsRate * - * @return int + * @return float|null */ - public function getViewed() + public function getTrackableViewsRate(): ?float { - return $this->container['viewed']; + return $this->container['trackableViewsRate']; } /** - * Sets viewed + * Sets trackableViewsRate * - * @param int $viewed Number of openings for the campaign + * @param float|null $trackableViewsRate Rate of recipients without any privacy protection option enabled in their email client * * @return $this */ - public function setViewed($viewed) + public function setTrackableViewsRate(?float $trackableViewsRate): static { - $this->container['viewed'] = $viewed; + if (is_null($trackableViewsRate)) { + throw new InvalidArgumentException('non-nullable trackableViewsRate cannot be null'); + } + $this->container['trackableViewsRate'] = $trackableViewsRate; return $this; } /** - * Gets deferred + * Gets estimatedViews * - * @return int + * @return int|null */ - public function getDeferred() + public function getEstimatedViews(): ?int { - return $this->container['deferred']; + return $this->container['estimatedViews']; } /** - * Sets deferred + * Sets estimatedViews * - * @param int $deferred Number of deferred emails for the campaign + * @param int|null $estimatedViews Rate of recipients without any privacy protection option enabled in their email client, applied to all delivered emails * * @return $this */ - public function setDeferred($deferred) + public function setEstimatedViews(?int $estimatedViews): static { - $this->container['deferred'] = $deferred; + if (is_null($estimatedViews)) { + throw new InvalidArgumentException('non-nullable estimatedViews cannot be null'); + } + $this->container['estimatedViews'] = $estimatedViews; return $this; } /** - * Gets returnBounce + * Gets deferred * - * @return int + * @return int|null */ - public function getReturnBounce() + public function getDeferred(): ?int { - return $this->container['returnBounce']; + return $this->container['deferred']; } /** - * Sets returnBounce + * Sets deferred * - * @param int $returnBounce Total number of non-delivered campaigns for a particular campaign id. + * @param int|null $deferred Number of deferred emails for the campaign * * @return $this */ - public function setReturnBounce($returnBounce) + public function setDeferred(?int $deferred): static { - $this->container['returnBounce'] = $returnBounce; + if (is_null($deferred)) { + throw new InvalidArgumentException('non-nullable deferred cannot be null'); + } + $this->container['deferred'] = $deferred; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 + * Gets returnBounce * - * @return void + * @return int|null */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function getReturnBounce(): ?int { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } + return $this->container['returnBounce']; } /** - * Unsets offset. + * Sets returnBounce * - * @param integer $offset Offset + * @param int|null $returnBounce Total number of non-delivered campaigns for a particular campaign id. * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string + * @return $this */ - public function __toString() + public function setReturnBounce(?int $returnBounce): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($returnBounce)) { + throw new InvalidArgumentException('non-nullable returnBounce cannot be null'); } + $this->container['returnBounce'] = $returnBounce; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/GetCategories.php b/lib/Models/GetCategories.php index e893017..cfec7e3 100644 --- a/lib/Models/GetCategories.php +++ b/lib/Models/GetCategories.php @@ -2,102 +2,101 @@ /** * GetCategories * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetCategories Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetCategories implements ModelInterface, ArrayAccess +class GetCategories extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getCategories'; + protected static string $openAPIModelName = 'getCategories'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'categories' => 'object[]', + protected static array $openAPITypes = [ + 'categories' => 'GetCategoryDetails[]', 'count' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'categories' => null, 'count' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'categories' => false, + 'count' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'categories' => 'categories', 'count' => 'count' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'categories' => 'setCategories', 'count' => 'setCount' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'categories' => 'getCategories', 'count' => 'getCount' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,52 +145,38 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['categories'] = isset($data['categories']) ? $data['categories'] : null; - $this->container['count'] = isset($data['count']) ? $data['count'] : null; + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('count', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -204,24 +189,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets categories * - * @return object[] + * @return GetCategoryDetails[] */ - public function getCategories() + public function getCategories(): array { return $this->container['categories']; } @@ -229,12 +202,15 @@ public function getCategories() /** * Sets categories * - * @param object[] $categories categories + * @param GetCategoryDetails[] $categories categories * * @return $this */ - public function setCategories($categories) + public function setCategories(array $categories): static { + if (is_null($categories)) { + throw new InvalidArgumentException('non-nullable categories cannot be null'); + } $this->container['categories'] = $categories; return $this; @@ -245,7 +221,7 @@ public function setCategories($categories) * * @return int */ - public function getCount() + public function getCount(): int { return $this->container['count']; } @@ -257,85 +233,15 @@ public function getCount() * * @return $this */ - public function setCount($count) + public function setCount(int $count): static { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } $this->container['count'] = $count; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetCategoryDetails.php b/lib/Models/GetCategoryDetails.php index 866c4a4..e1ede0b 100644 --- a/lib/Models/GetCategoryDetails.php +++ b/lib/Models/GetCategoryDetails.php @@ -2,61 +2,63 @@ /** * GetCategoryDetails * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetCategoryDetails Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetCategoryDetails implements ModelInterface, ArrayAccess +class GetCategoryDetails extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getCategoryDetails'; + protected static string $openAPIModelName = 'getCategoryDetails'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'string', 'name' => 'string', 'createdAt' => 'string', @@ -68,9 +70,9 @@ class GetCategoryDetails implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'string', 'name' => 'string', 'createdAt' => null, @@ -80,32 +82,33 @@ class GetCategoryDetails implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'createdAt' => false, + 'modifiedAt' => false, + 'url' => false, + 'isDeleted' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name', 'createdAt' => 'createdAt', @@ -117,9 +120,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName', 'createdAt' => 'setCreatedAt', @@ -131,9 +134,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName', 'createdAt' => 'getCreatedAt', @@ -146,9 +149,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -156,9 +159,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -166,56 +169,42 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['modifiedAt'] = isset($data['modifiedAt']) ? $data['modifiedAt'] : null; - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['isDeleted'] = isset($data['isDeleted']) ? $data['isDeleted'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('modifiedAt', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('isDeleted', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -234,24 +223,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return string */ - public function getId() + public function getId(): string { return $this->container['id']; } @@ -263,8 +240,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(string $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -275,7 +255,7 @@ public function setId($id) * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -287,8 +267,11 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -299,7 +282,7 @@ public function setName($name) * * @return string */ - public function getCreatedAt() + public function getCreatedAt(): string { return $this->container['createdAt']; } @@ -311,8 +294,11 @@ public function getCreatedAt() * * @return $this */ - public function setCreatedAt($createdAt) + public function setCreatedAt(string $createdAt): static { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } $this->container['createdAt'] = $createdAt; return $this; @@ -323,7 +309,7 @@ public function setCreatedAt($createdAt) * * @return string */ - public function getModifiedAt() + public function getModifiedAt(): string { return $this->container['modifiedAt']; } @@ -335,8 +321,11 @@ public function getModifiedAt() * * @return $this */ - public function setModifiedAt($modifiedAt) + public function setModifiedAt(string $modifiedAt): static { + if (is_null($modifiedAt)) { + throw new InvalidArgumentException('non-nullable modifiedAt cannot be null'); + } $this->container['modifiedAt'] = $modifiedAt; return $this; @@ -345,9 +334,9 @@ public function setModifiedAt($modifiedAt) /** * Gets url * - * @return string + * @return string|null */ - public function getUrl() + public function getUrl(): ?string { return $this->container['url']; } @@ -355,12 +344,15 @@ public function getUrl() /** * Sets url * - * @param string $url URL to the category + * @param string|null $url URL to the category * * @return $this */ - public function setUrl($url) + public function setUrl(?string $url): static { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } $this->container['url'] = $url; return $this; @@ -369,9 +361,9 @@ public function setUrl($url) /** * Gets isDeleted * - * @return bool + * @return bool|null */ - public function getIsDeleted() + public function getIsDeleted(): ?bool { return $this->container['isDeleted']; } @@ -379,89 +371,19 @@ public function getIsDeleted() /** * Sets isDeleted * - * @param bool $isDeleted category deleted from the shop's database + * @param bool|null $isDeleted category deleted from the shop's database * * @return $this */ - public function setIsDeleted($isDeleted) + public function setIsDeleted(?bool $isDeleted): static { + if (is_null($isDeleted)) { + throw new InvalidArgumentException('non-nullable isDeleted cannot be null'); + } $this->container['isDeleted'] = $isDeleted; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetChildAccountCreationStatus.php b/lib/Models/GetChildAccountCreationStatus.php deleted file mode 100644 index e7fe87d..0000000 --- a/lib/Models/GetChildAccountCreationStatus.php +++ /dev/null @@ -1,308 +0,0 @@ - 'bool' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'childAccountCreated' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'childAccountCreated' => 'childAccountCreated' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'childAccountCreated' => 'setChildAccountCreated' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'childAccountCreated' => 'getChildAccountCreated' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['childAccountCreated'] = isset($data['childAccountCreated']) ? $data['childAccountCreated'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['childAccountCreated'] === null) { - $invalidProperties[] = "'childAccountCreated' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets childAccountCreated - * - * @return bool - */ - public function getChildAccountCreated() - { - return $this->container['childAccountCreated']; - } - - /** - * Sets childAccountCreated - * - * @param bool $childAccountCreated Status of child account creation whether it is successfully created (exists) or not. - * - * @return $this - */ - public function setChildAccountCreated($childAccountCreated) - { - $this->container['childAccountCreated'] = $childAccountCreated; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetChildDomain.php b/lib/Models/GetChildDomain.php deleted file mode 100644 index 47c6a3b..0000000 --- a/lib/Models/GetChildDomain.php +++ /dev/null @@ -1,335 +0,0 @@ - 'string', - 'active' => 'bool' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'domain' => null, - 'active' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'domain' => 'domain', - 'active' => 'active' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'domain' => 'setDomain', - 'active' => 'setActive' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'domain' => 'getDomain', - 'active' => 'getActive' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['domain'] = isset($data['domain']) ? $data['domain'] : null; - $this->container['active'] = isset($data['active']) ? $data['active'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets domain - * - * @return string - */ - public function getDomain() - { - return $this->container['domain']; - } - - /** - * Sets domain - * - * @param string $domain Sender domain - * - * @return $this - */ - public function setDomain($domain) - { - $this->container['domain'] = $domain; - - return $this; - } - - /** - * Gets active - * - * @return bool - */ - public function getActive() - { - return $this->container['active']; - } - - /** - * Sets active - * - * @param bool $active indicates whether a domain is verified or not - * - * @return $this - */ - public function setActive($active) - { - $this->container['active'] = $active; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetChildDomains.php b/lib/Models/GetChildDomains.php deleted file mode 100644 index 2ad8a64..0000000 --- a/lib/Models/GetChildDomains.php +++ /dev/null @@ -1,280 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetChildInfo.php b/lib/Models/GetChildInfo.php deleted file mode 100644 index 9eb352b..0000000 --- a/lib/Models/GetChildInfo.php +++ /dev/null @@ -1,422 +0,0 @@ - '\Brevo\Client\Models\GetChildInfoCredits', - 'statistics' => '\Brevo\Client\Models\GetChildInfoStatistics', - 'password' => 'string', - 'ips' => 'string[]', - 'apiKeys' => '\Brevo\Client\Models\GetChildInfoApiKeys' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'credits' => null, - 'statistics' => null, - 'password' => 'password', - 'ips' => null, - 'apiKeys' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes + parent::swaggerTypes(); - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats + parent::swaggerFormats(); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'credits' => 'credits', - 'statistics' => 'statistics', - 'password' => 'password', - 'ips' => 'ips', - 'apiKeys' => 'apiKeys' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'credits' => 'setCredits', - 'statistics' => 'setStatistics', - 'password' => 'setPassword', - 'ips' => 'setIps', - 'apiKeys' => 'setApiKeys' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'credits' => 'getCredits', - 'statistics' => 'getStatistics', - 'password' => 'getPassword', - 'ips' => 'getIps', - '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 parent::attributeMap() + self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return parent::setters() + self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return parent::getters() + self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - parent::__construct($data); - - $this->container['credits'] = isset($data['credits']) ? $data['credits'] : null; - $this->container['statistics'] = isset($data['statistics']) ? $data['statistics'] : null; - $this->container['password'] = isset($data['password']) ? $data['password'] : null; - $this->container['ips'] = isset($data['ips']) ? $data['ips'] : null; - $this->container['apiKeys'] = isset($data['apiKeys']) ? $data['apiKeys'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = parent::listInvalidProperties(); - - if ($this->container['password'] === null) { - $invalidProperties[] = "'password' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets credits - * - * @return \Brevo\Client\Models\GetChildInfoCredits - */ - public function getCredits() - { - return $this->container['credits']; - } - - /** - * Sets credits - * - * @param \Brevo\Client\Models\GetChildInfoCredits $credits credits - * - * @return $this - */ - public function setCredits($credits) - { - $this->container['credits'] = $credits; - - return $this; - } - - /** - * Gets statistics - * - * @return \Brevo\Client\Models\GetChildInfoStatistics - */ - public function getStatistics() - { - return $this->container['statistics']; - } - - /** - * Sets statistics - * - * @param \Brevo\Client\Models\GetChildInfoStatistics $statistics statistics - * - * @return $this - */ - public function setStatistics($statistics) - { - $this->container['statistics'] = $statistics; - - return $this; - } - - /** - * Gets password - * - * @return string - */ - public function getPassword() - { - return $this->container['password']; - } - - /** - * Sets password - * - * @param string $password The encrypted password of child account - * - * @return $this - */ - public function setPassword($password) - { - $this->container['password'] = $password; - - return $this; - } - - /** - * Gets ips - * - * @return string[] - */ - public function getIps() - { - return $this->container['ips']; - } - - /** - * Sets ips - * - * @param string[] $ips IP(s) associated to a child account user - * - * @return $this - */ - public function setIps($ips) - { - $this->container['ips'] = $ips; - - return $this; - } - - /** - * Gets apiKeys - * - * @return \Brevo\Client\Models\GetChildInfoApiKeys - */ - public function getApiKeys() - { - return $this->container['apiKeys']; - } - - /** - * Sets apiKeys - * - * @param \Brevo\Client\Models\GetChildInfoApiKeys $apiKeys apiKeys - * - * @return $this - */ - public function setApiKeys($apiKeys) - { - $this->container['apiKeys'] = $apiKeys; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetChildInfoApiKeys.php b/lib/Models/GetChildInfoApiKeys.php deleted file mode 100644 index 4ae18d1..0000000 --- a/lib/Models/GetChildInfoApiKeys.php +++ /dev/null @@ -1,339 +0,0 @@ - '\Brevo\Client\Models\GetChildInfoApiKeysV2[]', - 'v3' => '\Brevo\Client\Models\GetChildInfoApiKeysV3[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'v2' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'v2' => 'v2', - 'v3' => 'v3' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'v2' => 'setV2', - 'v3' => 'setV3' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'v2' => 'getV2', - '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 - */ - public function __construct(array $data = null) - { - $this->container['v2'] = isset($data['v2']) ? $data['v2'] : null; - $this->container['v3'] = isset($data['v3']) ? $data['v3'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['v2'] === null) { - $invalidProperties[] = "'v2' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets v2 - * - * @return \Brevo\Client\Models\GetChildInfoApiKeysV2[] - */ - public function getV2() - { - return $this->container['v2']; - } - - /** - * Sets v2 - * - * @param \Brevo\Client\Models\GetChildInfoApiKeysV2[] $v2 v2 - * - * @return $this - */ - public function setV2($v2) - { - $this->container['v2'] = $v2; - - return $this; - } - - /** - * Gets v3 - * - * @return \Brevo\Client\Models\GetChildInfoApiKeysV3[] - */ - public function getV3() - { - return $this->container['v3']; - } - - /** - * Sets v3 - * - * @param \Brevo\Client\Models\GetChildInfoApiKeysV3[] $v3 v3 - * - * @return $this - */ - public function setV3($v3) - { - $this->container['v3'] = $v3; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetChildInfoApiKeysV2.php b/lib/Models/GetChildInfoApiKeysV2.php deleted file mode 100644 index e57a51b..0000000 --- a/lib/Models/GetChildInfoApiKeysV2.php +++ /dev/null @@ -1,341 +0,0 @@ - 'string', - 'key' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'name' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'name' => 'name', - 'key' => 'key' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'name' => 'setName', - 'key' => 'setKey' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'name' => 'getName', - '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 - */ - public function __construct(array $data = null) - { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['key'] = isset($data['key']) ? $data['key'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['key'] === null) { - $invalidProperties[] = "'key' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Name of the key for version 2 - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets key - * - * @return string - */ - public function getKey() - { - return $this->container['key']; - } - - /** - * Sets key - * - * @param string $key API Key for version 2 - * - * @return $this - */ - public function setKey($key) - { - $this->container['key'] = $key; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetChildInfoApiKeysV3.php b/lib/Models/GetChildInfoApiKeysV3.php deleted file mode 100644 index be8a8dd..0000000 --- a/lib/Models/GetChildInfoApiKeysV3.php +++ /dev/null @@ -1,341 +0,0 @@ - 'string', - 'key' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'name' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'name' => 'name', - 'key' => 'key' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'name' => 'setName', - 'key' => 'setKey' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'name' => 'getName', - '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 - */ - public function __construct(array $data = null) - { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['key'] = isset($data['key']) ? $data['key'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['key'] === null) { - $invalidProperties[] = "'key' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Name of the key for version 3 - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets key - * - * @return string - */ - public function getKey() - { - return $this->container['key']; - } - - /** - * Sets key - * - * @param string $key API Key for version 3 - * - * @return $this - */ - public function setKey($key) - { - $this->container['key'] = $key; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetChildInfoCredits.php b/lib/Models/GetChildInfoCredits.php deleted file mode 100644 index 81f2c01..0000000 --- a/lib/Models/GetChildInfoCredits.php +++ /dev/null @@ -1,336 +0,0 @@ - 'int', - 'smsCredits' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'emailCredits' => 'int64', - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'emailCredits' => 'emailCredits', - 'smsCredits' => 'smsCredits' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'emailCredits' => 'setEmailCredits', - 'smsCredits' => 'setSmsCredits' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'emailCredits' => 'getEmailCredits', - '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 - */ - public function __construct(array $data = null) - { - $this->container['emailCredits'] = isset($data['emailCredits']) ? $data['emailCredits'] : null; - $this->container['smsCredits'] = isset($data['smsCredits']) ? $data['smsCredits'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets emailCredits - * - * @return int - */ - public function getEmailCredits() - { - return $this->container['emailCredits']; - } - - /** - * Sets emailCredits - * - * @param int $emailCredits Email credits available for your child - * - * @return $this - */ - public function setEmailCredits($emailCredits) - { - $this->container['emailCredits'] = $emailCredits; - - return $this; - } - - /** - * Gets smsCredits - * - * @return int - */ - public function getSmsCredits() - { - return $this->container['smsCredits']; - } - - /** - * Sets smsCredits - * - * @param int $smsCredits SMS credits available for your child - * - * @return $this - */ - public function setSmsCredits($smsCredits) - { - $this->container['smsCredits'] = $smsCredits; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetChildInfoStatistics.php b/lib/Models/GetChildInfoStatistics.php deleted file mode 100644 index 7da5fae..0000000 --- a/lib/Models/GetChildInfoStatistics.php +++ /dev/null @@ -1,366 +0,0 @@ - 'int', - 'currentMonthTotalSent' => 'int', - 'totalSent' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'previousMonthTotalSent' => 'int64', - 'currentMonthTotalSent' => 'int64', - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'previousMonthTotalSent' => 'previousMonthTotalSent', - 'currentMonthTotalSent' => 'currentMonthTotalSent', - 'totalSent' => 'totalSent' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'previousMonthTotalSent' => 'setPreviousMonthTotalSent', - 'currentMonthTotalSent' => 'setCurrentMonthTotalSent', - 'totalSent' => 'setTotalSent' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'previousMonthTotalSent' => 'getPreviousMonthTotalSent', - 'currentMonthTotalSent' => 'getCurrentMonthTotalSent', - '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 - */ - public function __construct(array $data = null) - { - $this->container['previousMonthTotalSent'] = isset($data['previousMonthTotalSent']) ? $data['previousMonthTotalSent'] : null; - $this->container['currentMonthTotalSent'] = isset($data['currentMonthTotalSent']) ? $data['currentMonthTotalSent'] : null; - $this->container['totalSent'] = isset($data['totalSent']) ? $data['totalSent'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets previousMonthTotalSent - * - * @return int - */ - public function getPreviousMonthTotalSent() - { - return $this->container['previousMonthTotalSent']; - } - - /** - * Sets previousMonthTotalSent - * - * @param int $previousMonthTotalSent Overall emails sent for the previous month - * - * @return $this - */ - public function setPreviousMonthTotalSent($previousMonthTotalSent) - { - $this->container['previousMonthTotalSent'] = $previousMonthTotalSent; - - return $this; - } - - /** - * Gets currentMonthTotalSent - * - * @return int - */ - public function getCurrentMonthTotalSent() - { - return $this->container['currentMonthTotalSent']; - } - - /** - * Sets currentMonthTotalSent - * - * @param int $currentMonthTotalSent Overall emails sent for current month - * - * @return $this - */ - public function setCurrentMonthTotalSent($currentMonthTotalSent) - { - $this->container['currentMonthTotalSent'] = $currentMonthTotalSent; - - return $this; - } - - /** - * Gets totalSent - * - * @return int - */ - public function getTotalSent() - { - return $this->container['totalSent']; - } - - /** - * Sets totalSent - * - * @param int $totalSent Overall emails sent for since the account exists - * - * @return $this - */ - public function setTotalSent($totalSent) - { - $this->container['totalSent'] = $totalSent; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetChildrenList.php b/lib/Models/GetChildrenList.php deleted file mode 100644 index 704d5ca..0000000 --- a/lib/Models/GetChildrenList.php +++ /dev/null @@ -1,335 +0,0 @@ - 'object[]', - 'count' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'children' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'children' => 'children', - 'count' => 'count' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'children' => 'setChildren', - 'count' => 'setCount' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'children' => 'getChildren', - '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 - */ - public function __construct(array $data = null) - { - $this->container['children'] = isset($data['children']) ? $data['children'] : null; - $this->container['count'] = isset($data['count']) ? $data['count'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets children - * - * @return object[] - */ - public function getChildren() - { - return $this->container['children']; - } - - /** - * Sets children - * - * @param object[] $children Your children's account information - * - * @return $this - */ - public function setChildren($children) - { - $this->container['children'] = $children; - - return $this; - } - - /** - * Gets count - * - * @return int - */ - public function getCount() - { - return $this->container['count']; - } - - /** - * Sets count - * - * @param int $count Number of child accounts - * - * @return $this - */ - public function setCount($count) - { - $this->container['count'] = $count; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetClient.php b/lib/Models/GetClient.php index 06fb685..b0a33ec 100644 --- a/lib/Models/GetClient.php +++ b/lib/Models/GetClient.php @@ -2,61 +2,63 @@ /** * GetClient * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetClient Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetClient implements ModelInterface, ArrayAccess +class GetClient extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getClient'; + protected static string $openAPIModelName = 'getClient'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'email' => 'string', 'firstName' => 'string', 'lastName' => 'string', @@ -66,9 +68,9 @@ class GetClient implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'email' => 'email', 'firstName' => null, 'lastName' => null, @@ -76,32 +78,31 @@ class GetClient implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'firstName' => false, + 'lastName' => false, + 'companyName' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'email' => 'email', 'firstName' => 'firstName', 'lastName' => 'lastName', @@ -111,9 +112,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'email' => 'setEmail', 'firstName' => 'setFirstName', 'lastName' => 'setLastName', @@ -123,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'email' => 'getEmail', 'firstName' => 'getFirstName', 'lastName' => 'getLastName', @@ -136,9 +137,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +147,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,54 +157,40 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['firstName'] = isset($data['firstName']) ? $data['firstName'] : null; - $this->container['lastName'] = isset($data['lastName']) ? $data['lastName'] : null; - $this->container['companyName'] = isset($data['companyName']) ? $data['companyName'] : null; + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('firstName', $data ?? [], null); + $this->setIfExists('lastName', $data ?? [], null); + $this->setIfExists('companyName', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -222,24 +209,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets email * * @return string */ - public function getEmail() + public function getEmail(): string { return $this->container['email']; } @@ -251,8 +226,11 @@ public function getEmail() * * @return $this */ - public function setEmail($email) + public function setEmail(string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -263,7 +241,7 @@ public function setEmail($email) * * @return string */ - public function getFirstName() + public function getFirstName(): string { return $this->container['firstName']; } @@ -275,8 +253,11 @@ public function getFirstName() * * @return $this */ - public function setFirstName($firstName) + public function setFirstName(string $firstName): static { + if (is_null($firstName)) { + throw new InvalidArgumentException('non-nullable firstName cannot be null'); + } $this->container['firstName'] = $firstName; return $this; @@ -287,7 +268,7 @@ public function setFirstName($firstName) * * @return string */ - public function getLastName() + public function getLastName(): string { return $this->container['lastName']; } @@ -299,8 +280,11 @@ public function getLastName() * * @return $this */ - public function setLastName($lastName) + public function setLastName(string $lastName): static { + if (is_null($lastName)) { + throw new InvalidArgumentException('non-nullable lastName cannot be null'); + } $this->container['lastName'] = $lastName; return $this; @@ -311,7 +295,7 @@ public function setLastName($lastName) * * @return string */ - public function getCompanyName() + public function getCompanyName(): string { return $this->container['companyName']; } @@ -323,85 +307,15 @@ public function getCompanyName() * * @return $this */ - public function setCompanyName($companyName) + public function setCompanyName(string $companyName): static { + if (is_null($companyName)) { + throw new InvalidArgumentException('non-nullable companyName cannot be null'); + } $this->container['companyName'] = $companyName; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetContactCampaignStats.php b/lib/Models/GetContactCampaignStats.php index 7579be3..80e233d 100644 --- a/lib/Models/GetContactCampaignStats.php +++ b/lib/Models/GetContactCampaignStats.php @@ -2,79 +2,81 @@ /** * GetContactCampaignStats * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetContactCampaignStats Class Doc Comment * - * @category Class * @description Campaign Statistics for the contact * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetContactCampaignStats implements ModelInterface, ArrayAccess +class GetContactCampaignStats extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getContactCampaignStats'; + protected static string $openAPIModelName = 'getContactCampaignStats'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'messagesSent' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[]', - 'hardBounces' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[]', - 'softBounces' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[]', - 'complaints' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[]', + protected static array $openAPITypes = [ + 'messagesSent' => '\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]', + 'hardBounces' => '\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]', + 'softBounces' => '\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]', + 'complaints' => '\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]', 'unsubscriptions' => '\Brevo\Client\Models\GetContactCampaignStatsUnsubscriptions', - 'opened' => '\Brevo\Client\Models\GetContactCampaignStatsOpened[]', - 'clicked' => '\Brevo\Client\Models\GetContactCampaignStatsClicked[]', - 'transacAttributes' => '\Brevo\Client\Models\GetContactCampaignStatsTransacAttributes[]', - 'delivered' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[]' + 'opened' => '\Brevo\Client\Models\GetContactCampaignStatsOpenedInner[]', + 'clicked' => '\Brevo\Client\Models\GetContactCampaignStatsClickedInner[]', + 'transacAttributes' => '\Brevo\Client\Models\GetContactCampaignStatsTransacAttributesInner[]', + 'delivered' => '\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'messagesSent' => null, 'hardBounces' => null, 'softBounces' => null, @@ -87,32 +89,36 @@ class GetContactCampaignStats implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'messagesSent' => false, + 'hardBounces' => false, + 'softBounces' => false, + 'complaints' => false, + 'unsubscriptions' => false, + 'opened' => false, + 'clicked' => false, + 'transacAttributes' => false, + 'delivered' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'messagesSent' => 'messagesSent', 'hardBounces' => 'hardBounces', 'softBounces' => 'softBounces', @@ -127,9 +133,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'messagesSent' => 'setMessagesSent', 'hardBounces' => 'setHardBounces', 'softBounces' => 'setSoftBounces', @@ -144,9 +150,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'messagesSent' => 'getMessagesSent', 'hardBounces' => 'getHardBounces', 'softBounces' => 'getSoftBounces', @@ -162,9 +168,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -172,9 +178,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -182,83 +188,57 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['messagesSent'] = isset($data['messagesSent']) ? $data['messagesSent'] : null; - $this->container['hardBounces'] = isset($data['hardBounces']) ? $data['hardBounces'] : null; - $this->container['softBounces'] = isset($data['softBounces']) ? $data['softBounces'] : null; - $this->container['complaints'] = isset($data['complaints']) ? $data['complaints'] : null; - $this->container['unsubscriptions'] = isset($data['unsubscriptions']) ? $data['unsubscriptions'] : null; - $this->container['opened'] = isset($data['opened']) ? $data['opened'] : null; - $this->container['clicked'] = isset($data['clicked']) ? $data['clicked'] : null; - $this->container['transacAttributes'] = isset($data['transacAttributes']) ? $data['transacAttributes'] : null; - $this->container['delivered'] = isset($data['delivered']) ? $data['delivered'] : null; + $this->setIfExists('messagesSent', $data ?? [], null); + $this->setIfExists('hardBounces', $data ?? [], null); + $this->setIfExists('softBounces', $data ?? [], null); + $this->setIfExists('complaints', $data ?? [], null); + $this->setIfExists('unsubscriptions', $data ?? [], null); + $this->setIfExists('opened', $data ?? [], null); + $this->setIfExists('clicked', $data ?? [], null); + $this->setIfExists('transacAttributes', $data ?? [], null); + $this->setIfExists('delivered', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets messagesSent * - * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]|null */ - public function getMessagesSent() + public function getMessagesSent(): ?array { return $this->container['messagesSent']; } @@ -266,12 +246,15 @@ public function getMessagesSent() /** * Sets messagesSent * - * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] $messagesSent messagesSent + * @param \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]|null $messagesSent messagesSent * * @return $this */ - public function setMessagesSent($messagesSent) + public function setMessagesSent(?array $messagesSent): static { + if (is_null($messagesSent)) { + throw new InvalidArgumentException('non-nullable messagesSent cannot be null'); + } $this->container['messagesSent'] = $messagesSent; return $this; @@ -280,9 +263,9 @@ public function setMessagesSent($messagesSent) /** * Gets hardBounces * - * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]|null */ - public function getHardBounces() + public function getHardBounces(): ?array { return $this->container['hardBounces']; } @@ -290,12 +273,15 @@ public function getHardBounces() /** * Sets hardBounces * - * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] $hardBounces hardBounces + * @param \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]|null $hardBounces hardBounces * * @return $this */ - public function setHardBounces($hardBounces) + public function setHardBounces(?array $hardBounces): static { + if (is_null($hardBounces)) { + throw new InvalidArgumentException('non-nullable hardBounces cannot be null'); + } $this->container['hardBounces'] = $hardBounces; return $this; @@ -304,9 +290,9 @@ public function setHardBounces($hardBounces) /** * Gets softBounces * - * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]|null */ - public function getSoftBounces() + public function getSoftBounces(): ?array { return $this->container['softBounces']; } @@ -314,12 +300,15 @@ public function getSoftBounces() /** * Sets softBounces * - * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] $softBounces softBounces + * @param \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]|null $softBounces softBounces * * @return $this */ - public function setSoftBounces($softBounces) + public function setSoftBounces(?array $softBounces): static { + if (is_null($softBounces)) { + throw new InvalidArgumentException('non-nullable softBounces cannot be null'); + } $this->container['softBounces'] = $softBounces; return $this; @@ -328,9 +317,9 @@ public function setSoftBounces($softBounces) /** * Gets complaints * - * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]|null */ - public function getComplaints() + public function getComplaints(): ?array { return $this->container['complaints']; } @@ -338,12 +327,15 @@ public function getComplaints() /** * Sets complaints * - * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] $complaints complaints + * @param \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]|null $complaints complaints * * @return $this */ - public function setComplaints($complaints) + public function setComplaints(?array $complaints): static { + if (is_null($complaints)) { + throw new InvalidArgumentException('non-nullable complaints cannot be null'); + } $this->container['complaints'] = $complaints; return $this; @@ -352,9 +344,9 @@ public function setComplaints($complaints) /** * Gets unsubscriptions * - * @return \Brevo\Client\Models\GetContactCampaignStatsUnsubscriptions + * @return \Brevo\Client\Models\GetContactCampaignStatsUnsubscriptions|null */ - public function getUnsubscriptions() + public function getUnsubscriptions(): ?\Brevo\Client\Models\GetContactCampaignStatsUnsubscriptions { return $this->container['unsubscriptions']; } @@ -362,12 +354,15 @@ public function getUnsubscriptions() /** * Sets unsubscriptions * - * @param \Brevo\Client\Models\GetContactCampaignStatsUnsubscriptions $unsubscriptions unsubscriptions + * @param \Brevo\Client\Models\GetContactCampaignStatsUnsubscriptions|null $unsubscriptions unsubscriptions * * @return $this */ - public function setUnsubscriptions($unsubscriptions) + public function setUnsubscriptions(?\Brevo\Client\Models\GetContactCampaignStatsUnsubscriptions $unsubscriptions): static { + if (is_null($unsubscriptions)) { + throw new InvalidArgumentException('non-nullable unsubscriptions cannot be null'); + } $this->container['unsubscriptions'] = $unsubscriptions; return $this; @@ -376,9 +371,9 @@ public function setUnsubscriptions($unsubscriptions) /** * Gets opened * - * @return \Brevo\Client\Models\GetContactCampaignStatsOpened[] + * @return \Brevo\Client\Models\GetContactCampaignStatsOpenedInner[]|null */ - public function getOpened() + public function getOpened(): ?array { return $this->container['opened']; } @@ -386,12 +381,15 @@ public function getOpened() /** * Sets opened * - * @param \Brevo\Client\Models\GetContactCampaignStatsOpened[] $opened opened + * @param \Brevo\Client\Models\GetContactCampaignStatsOpenedInner[]|null $opened opened * * @return $this */ - public function setOpened($opened) + public function setOpened(?array $opened): static { + if (is_null($opened)) { + throw new InvalidArgumentException('non-nullable opened cannot be null'); + } $this->container['opened'] = $opened; return $this; @@ -400,9 +398,9 @@ public function setOpened($opened) /** * Gets clicked * - * @return \Brevo\Client\Models\GetContactCampaignStatsClicked[] + * @return \Brevo\Client\Models\GetContactCampaignStatsClickedInner[]|null */ - public function getClicked() + public function getClicked(): ?array { return $this->container['clicked']; } @@ -410,12 +408,15 @@ public function getClicked() /** * Sets clicked * - * @param \Brevo\Client\Models\GetContactCampaignStatsClicked[] $clicked clicked + * @param \Brevo\Client\Models\GetContactCampaignStatsClickedInner[]|null $clicked clicked * * @return $this */ - public function setClicked($clicked) + public function setClicked(?array $clicked): static { + if (is_null($clicked)) { + throw new InvalidArgumentException('non-nullable clicked cannot be null'); + } $this->container['clicked'] = $clicked; return $this; @@ -424,9 +425,9 @@ public function setClicked($clicked) /** * Gets transacAttributes * - * @return \Brevo\Client\Models\GetContactCampaignStatsTransacAttributes[] + * @return \Brevo\Client\Models\GetContactCampaignStatsTransacAttributesInner[]|null */ - public function getTransacAttributes() + public function getTransacAttributes(): ?array { return $this->container['transacAttributes']; } @@ -434,12 +435,15 @@ public function getTransacAttributes() /** * Sets transacAttributes * - * @param \Brevo\Client\Models\GetContactCampaignStatsTransacAttributes[] $transacAttributes transacAttributes + * @param \Brevo\Client\Models\GetContactCampaignStatsTransacAttributesInner[]|null $transacAttributes transacAttributes * * @return $this */ - public function setTransacAttributes($transacAttributes) + public function setTransacAttributes(?array $transacAttributes): static { + if (is_null($transacAttributes)) { + throw new InvalidArgumentException('non-nullable transacAttributes cannot be null'); + } $this->container['transacAttributes'] = $transacAttributes; return $this; @@ -448,9 +452,9 @@ public function setTransacAttributes($transacAttributes) /** * Gets delivered * - * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]|null */ - public function getDelivered() + public function getDelivered(): ?array { return $this->container['delivered']; } @@ -458,89 +462,19 @@ public function getDelivered() /** * Sets delivered * - * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] $delivered delivered + * @param \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]|null $delivered delivered * * @return $this */ - public function setDelivered($delivered) + public function setDelivered(?array $delivered): static { + if (is_null($delivered)) { + throw new InvalidArgumentException('non-nullable delivered cannot be null'); + } $this->container['delivered'] = $delivered; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetContactCampaignStatsClicked.php b/lib/Models/GetContactCampaignStatsClicked.php deleted file mode 100644 index 65078f9..0000000 --- a/lib/Models/GetContactCampaignStatsClicked.php +++ /dev/null @@ -1,341 +0,0 @@ - 'int', - 'links' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsLinks[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'campaignId' => 'int64', - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'campaignId' => 'campaignId', - 'links' => 'links' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'campaignId' => 'setCampaignId', - 'links' => 'setLinks' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'campaignId' => 'getCampaignId', - '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 - */ - public function __construct(array $data = null) - { - $this->container['campaignId'] = isset($data['campaignId']) ? $data['campaignId'] : null; - $this->container['links'] = isset($data['links']) ? $data['links'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['campaignId'] === null) { - $invalidProperties[] = "'campaignId' can't be null"; - } - if ($this->container['links'] === null) { - $invalidProperties[] = "'links' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets campaignId - * - * @return int - */ - public function getCampaignId() - { - return $this->container['campaignId']; - } - - /** - * Sets campaignId - * - * @param int $campaignId ID of the campaign which generated the event - * - * @return $this - */ - public function setCampaignId($campaignId) - { - $this->container['campaignId'] = $campaignId; - - return $this; - } - - /** - * Gets links - * - * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsLinks[] - */ - public function getLinks() - { - return $this->container['links']; - } - - /** - * Sets links - * - * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsLinks[] $links links - * - * @return $this - */ - public function setLinks($links) - { - $this->container['links'] = $links; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetContactCampaignStatsClickedInner.php b/lib/Models/GetContactCampaignStatsClickedInner.php new file mode 100644 index 0000000..9af1007 --- /dev/null +++ b/lib/Models/GetContactCampaignStatsClickedInner.php @@ -0,0 +1,247 @@ + + */ +class GetContactCampaignStatsClickedInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getContactCampaignStats_clicked_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'campaignId' => 'int', + 'links' => '\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsLinks[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'campaignId' => 'int64', + 'links' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'campaignId' => false, + 'links' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'campaignId' => 'campaignId', + 'links' => 'links' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'campaignId' => 'setCampaignId', + 'links' => 'setLinks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'campaignId' => 'getCampaignId', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['campaignId'] === null) { + $invalidProperties[] = "'campaignId' can't be null"; + } + if ($this->container['links'] === null) { + $invalidProperties[] = "'links' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets campaignId + * + * @return int + */ + public function getCampaignId(): int + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param int $campaignId ID of the campaign which generated the event + * + * @return $this + */ + public function setCampaignId(int $campaignId): static + { + if (is_null($campaignId)) { + throw new InvalidArgumentException('non-nullable campaignId cannot be null'); + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets links + * + * @return \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsLinks[] + */ + public function getLinks(): array + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsLinks[] $links links + * + * @return $this + */ + public function setLinks(array $links): static + { + if (is_null($links)) { + throw new InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } +} + + diff --git a/lib/Models/GetContactCampaignStatsOpened.php b/lib/Models/GetContactCampaignStatsOpenedInner.php similarity index 51% rename from lib/Models/GetContactCampaignStatsOpened.php rename to lib/Models/GetContactCampaignStatsOpenedInner.php index 5ce69b8..9127c73 100644 --- a/lib/Models/GetContactCampaignStatsOpened.php +++ b/lib/Models/GetContactCampaignStatsOpenedInner.php @@ -1,62 +1,64 @@ */ -class GetContactCampaignStatsOpened implements ModelInterface, ArrayAccess +class GetContactCampaignStatsOpenedInner extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getContactCampaignStats_opened'; + protected static string $openAPIModelName = 'getContactCampaignStats_opened_inner'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'campaignId' => 'int', 'count' => 'int', 'eventTime' => 'string', @@ -66,9 +68,9 @@ class GetContactCampaignStatsOpened implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'campaignId' => 'int64', 'count' => 'int64', 'eventTime' => null, @@ -76,32 +78,31 @@ class GetContactCampaignStatsOpened implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'campaignId' => false, + 'count' => false, + 'eventTime' => false, + 'ip' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'campaignId' => 'campaignId', 'count' => 'count', 'eventTime' => 'eventTime', @@ -111,9 +112,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'campaignId' => 'setCampaignId', 'count' => 'setCount', 'eventTime' => 'setEventTime', @@ -123,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'campaignId' => 'getCampaignId', 'count' => 'getCount', 'eventTime' => 'getEventTime', @@ -136,9 +137,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +147,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,54 +157,40 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['campaignId'] = isset($data['campaignId']) ? $data['campaignId'] : null; - $this->container['count'] = isset($data['count']) ? $data['count'] : null; - $this->container['eventTime'] = isset($data['eventTime']) ? $data['eventTime'] : null; - $this->container['ip'] = isset($data['ip']) ? $data['ip'] : null; + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('eventTime', $data ?? [], null); + $this->setIfExists('ip', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -222,24 +209,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets campaignId * * @return int */ - public function getCampaignId() + public function getCampaignId(): int { return $this->container['campaignId']; } @@ -251,8 +226,11 @@ public function getCampaignId() * * @return $this */ - public function setCampaignId($campaignId) + public function setCampaignId(int $campaignId): static { + if (is_null($campaignId)) { + throw new InvalidArgumentException('non-nullable campaignId cannot be null'); + } $this->container['campaignId'] = $campaignId; return $this; @@ -263,7 +241,7 @@ public function setCampaignId($campaignId) * * @return int */ - public function getCount() + public function getCount(): int { return $this->container['count']; } @@ -275,8 +253,11 @@ public function getCount() * * @return $this */ - public function setCount($count) + public function setCount(int $count): static { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } $this->container['count'] = $count; return $this; @@ -287,7 +268,7 @@ public function setCount($count) * * @return string */ - public function getEventTime() + public function getEventTime(): string { return $this->container['eventTime']; } @@ -299,8 +280,11 @@ public function getEventTime() * * @return $this */ - public function setEventTime($eventTime) + public function setEventTime(string $eventTime): static { + if (is_null($eventTime)) { + throw new InvalidArgumentException('non-nullable eventTime cannot be null'); + } $this->container['eventTime'] = $eventTime; return $this; @@ -311,7 +295,7 @@ public function setEventTime($eventTime) * * @return string */ - public function getIp() + public function getIp(): string { return $this->container['ip']; } @@ -323,85 +307,15 @@ public function getIp() * * @return $this */ - public function setIp($ip) + public function setIp(string $ip): static { + if (is_null($ip)) { + throw new InvalidArgumentException('non-nullable ip cannot be null'); + } $this->container['ip'] = $ip; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetContactCampaignStatsTransacAttributes.php b/lib/Models/GetContactCampaignStatsTransacAttributes.php deleted file mode 100644 index 1caa691..0000000 --- a/lib/Models/GetContactCampaignStatsTransacAttributes.php +++ /dev/null @@ -1,374 +0,0 @@ - '\DateTime', - 'orderPrice' => 'float', - 'orderId' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'orderDate' => 'date', - 'orderPrice' => 'float', - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'orderDate' => 'orderDate', - 'orderPrice' => 'orderPrice', - 'orderId' => 'orderId' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'orderDate' => 'setOrderDate', - 'orderPrice' => 'setOrderPrice', - 'orderId' => 'setOrderId' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'orderDate' => 'getOrderDate', - 'orderPrice' => 'getOrderPrice', - '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 - */ - public function __construct(array $data = null) - { - $this->container['orderDate'] = isset($data['orderDate']) ? $data['orderDate'] : null; - $this->container['orderPrice'] = isset($data['orderPrice']) ? $data['orderPrice'] : null; - $this->container['orderId'] = isset($data['orderId']) ? $data['orderId'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['orderDate'] === null) { - $invalidProperties[] = "'orderDate' can't be null"; - } - if ($this->container['orderPrice'] === null) { - $invalidProperties[] = "'orderPrice' can't be null"; - } - if ($this->container['orderId'] === null) { - $invalidProperties[] = "'orderId' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets orderDate - * - * @return \DateTime - */ - public function getOrderDate() - { - return $this->container['orderDate']; - } - - /** - * Sets orderDate - * - * @param \DateTime $orderDate Date of the order - * - * @return $this - */ - public function setOrderDate($orderDate) - { - $this->container['orderDate'] = $orderDate; - - return $this; - } - - /** - * Gets orderPrice - * - * @return float - */ - public function getOrderPrice() - { - return $this->container['orderPrice']; - } - - /** - * Sets orderPrice - * - * @param float $orderPrice Price of the order - * - * @return $this - */ - public function setOrderPrice($orderPrice) - { - $this->container['orderPrice'] = $orderPrice; - - return $this; - } - - /** - * Gets orderId - * - * @return int - */ - public function getOrderId() - { - return $this->container['orderId']; - } - - /** - * Sets orderId - * - * @param int $orderId ID of the order - * - * @return $this - */ - public function setOrderId($orderId) - { - $this->container['orderId'] = $orderId; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetContactCampaignStatsTransacAttributesInner.php b/lib/Models/GetContactCampaignStatsTransacAttributesInner.php new file mode 100644 index 0000000..c89054d --- /dev/null +++ b/lib/Models/GetContactCampaignStatsTransacAttributesInner.php @@ -0,0 +1,284 @@ + + */ +class GetContactCampaignStatsTransacAttributesInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getContactCampaignStats_transacAttributes_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'orderDate' => '\DateTime', + 'orderPrice' => 'float', + 'orderId' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'orderDate' => 'date', + 'orderPrice' => 'float', + 'orderId' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'orderDate' => false, + 'orderPrice' => false, + 'orderId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'orderDate' => 'orderDate', + 'orderPrice' => 'orderPrice', + 'orderId' => 'orderId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'orderDate' => 'setOrderDate', + 'orderPrice' => 'setOrderPrice', + 'orderId' => 'setOrderId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'orderDate' => 'getOrderDate', + 'orderPrice' => 'getOrderPrice', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('orderDate', $data ?? [], null); + $this->setIfExists('orderPrice', $data ?? [], null); + $this->setIfExists('orderId', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['orderDate'] === null) { + $invalidProperties[] = "'orderDate' can't be null"; + } + if ($this->container['orderPrice'] === null) { + $invalidProperties[] = "'orderPrice' can't be null"; + } + if ($this->container['orderId'] === null) { + $invalidProperties[] = "'orderId' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets orderDate + * + * @return \DateTime + */ + public function getOrderDate(): \DateTime + { + return $this->container['orderDate']; + } + + /** + * Sets orderDate + * + * @param \DateTime $orderDate Date of the order + * + * @return $this + */ + public function setOrderDate(\DateTime $orderDate): static + { + if (is_null($orderDate)) { + throw new InvalidArgumentException('non-nullable orderDate cannot be null'); + } + $this->container['orderDate'] = $orderDate; + + return $this; + } + + /** + * Gets orderPrice + * + * @return float + */ + public function getOrderPrice(): float + { + return $this->container['orderPrice']; + } + + /** + * Sets orderPrice + * + * @param float $orderPrice Price of the order + * + * @return $this + */ + public function setOrderPrice(float $orderPrice): static + { + if (is_null($orderPrice)) { + throw new InvalidArgumentException('non-nullable orderPrice cannot be null'); + } + $this->container['orderPrice'] = $orderPrice; + + return $this; + } + + /** + * Gets orderId + * + * @return int + */ + public function getOrderId(): int + { + return $this->container['orderId']; + } + + /** + * Sets orderId + * + * @param int $orderId ID of the order + * + * @return $this + */ + public function setOrderId(int $orderId): static + { + if (is_null($orderId)) { + throw new InvalidArgumentException('non-nullable orderId cannot be null'); + } + $this->container['orderId'] = $orderId; + + return $this; + } +} + + diff --git a/lib/Models/GetContactCampaignStatsUnsubscriptions.php b/lib/Models/GetContactCampaignStatsUnsubscriptions.php index e989bf9..e25ea82 100644 --- a/lib/Models/GetContactCampaignStatsUnsubscriptions.php +++ b/lib/Models/GetContactCampaignStatsUnsubscriptions.php @@ -2,102 +2,101 @@ /** * GetContactCampaignStatsUnsubscriptions * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetContactCampaignStatsUnsubscriptions Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetContactCampaignStatsUnsubscriptions implements ModelInterface, ArrayAccess +class GetContactCampaignStatsUnsubscriptions extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getContactCampaignStats_unsubscriptions'; + protected static string $openAPIModelName = 'getContactCampaignStats_unsubscriptions'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'userUnsubscription' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[]', - 'adminUnsubscription' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[]' + protected static array $openAPITypes = [ + 'userUnsubscription' => '\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription[]', + 'adminUnsubscription' => '\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'userUnsubscription' => null, 'adminUnsubscription' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'userUnsubscription' => false, + 'adminUnsubscription' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'userUnsubscription' => 'userUnsubscription', 'adminUnsubscription' => 'adminUnsubscription' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'userUnsubscription' => 'setUserUnsubscription', 'adminUnsubscription' => 'setAdminUnsubscription' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'userUnsubscription' => 'getUserUnsubscription', 'adminUnsubscription' => 'getAdminUnsubscription' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,52 +145,38 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['userUnsubscription'] = isset($data['userUnsubscription']) ? $data['userUnsubscription'] : null; - $this->container['adminUnsubscription'] = isset($data['adminUnsubscription']) ? $data['adminUnsubscription'] : null; + $this->setIfExists('userUnsubscription', $data ?? [], null); + $this->setIfExists('adminUnsubscription', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -204,24 +189,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets userUnsubscription * - * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription[] */ - public function getUserUnsubscription() + public function getUserUnsubscription(): array { return $this->container['userUnsubscription']; } @@ -229,12 +202,15 @@ public function getUserUnsubscription() /** * Sets userUnsubscription * - * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[] $userUnsubscription Contact has unsubscribed via the unsubscription link in the email + * @param \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription[] $userUnsubscription Contact has unsubscribed via the unsubscription link in the email * * @return $this */ - public function setUserUnsubscription($userUnsubscription) + public function setUserUnsubscription(array $userUnsubscription): static { + if (is_null($userUnsubscription)) { + throw new InvalidArgumentException('non-nullable userUnsubscription cannot be null'); + } $this->container['userUnsubscription'] = $userUnsubscription; return $this; @@ -243,9 +219,9 @@ public function setUserUnsubscription($userUnsubscription) /** * Gets adminUnsubscription * - * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[] + * @return \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription[] */ - public function getAdminUnsubscription() + public function getAdminUnsubscription(): array { return $this->container['adminUnsubscription']; } @@ -253,89 +229,19 @@ public function getAdminUnsubscription() /** * Sets adminUnsubscription * - * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[] $adminUnsubscription Contact has been unsubscribed from the administrator + * @param \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription[] $adminUnsubscription Contact has been unsubscribed from the administrator * * @return $this */ - public function setAdminUnsubscription($adminUnsubscription) + public function setAdminUnsubscription(array $adminUnsubscription): static { + if (is_null($adminUnsubscription)) { + throw new InvalidArgumentException('non-nullable adminUnsubscription cannot be null'); + } $this->container['adminUnsubscription'] = $adminUnsubscription; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetContactDetails.php b/lib/Models/GetContactDetails.php index 8a572a3..8597cbe 100644 --- a/lib/Models/GetContactDetails.php +++ b/lib/Models/GetContactDetails.php @@ -2,168 +2,174 @@ /** * GetContactDetails * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetContactDetails Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetContactDetails implements ModelInterface, ArrayAccess +class GetContactDetails extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getContactDetails'; + protected static string $openAPIModelName = 'getContactDetails'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'email' => 'string', + protected static array $openAPITypes = [ 'id' => 'int', 'emailBlacklisted' => 'bool', 'smsBlacklisted' => 'bool', 'createdAt' => 'string', 'modifiedAt' => 'string', 'listIds' => 'int[]', - 'listUnsubscribed' => 'int[]', - 'attributes' => 'object' + 'attributes' => 'object', + 'email' => 'string', + 'listUnsubscribed' => 'int[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'email' => 'email', + protected static array $openAPIFormats = [ 'id' => 'int64', 'emailBlacklisted' => null, 'smsBlacklisted' => null, 'createdAt' => null, 'modifiedAt' => null, 'listIds' => 'int64', - 'listUnsubscribed' => 'int64', - 'attributes' => null + 'attributes' => null, + 'email' => 'email', + 'listUnsubscribed' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'emailBlacklisted' => false, + 'smsBlacklisted' => false, + 'createdAt' => false, + 'modifiedAt' => false, + 'listIds' => false, + 'attributes' => false, + 'email' => false, + 'listUnsubscribed' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ - 'email' => 'email', + protected static array $attributeMap = [ 'id' => 'id', 'emailBlacklisted' => 'emailBlacklisted', 'smsBlacklisted' => 'smsBlacklisted', 'createdAt' => 'createdAt', 'modifiedAt' => 'modifiedAt', 'listIds' => 'listIds', - 'listUnsubscribed' => 'listUnsubscribed', - 'attributes' => 'attributes' + 'attributes' => 'attributes', + 'email' => 'email', + 'listUnsubscribed' => 'listUnsubscribed' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ - 'email' => 'setEmail', + protected static array $setters = [ 'id' => 'setId', 'emailBlacklisted' => 'setEmailBlacklisted', 'smsBlacklisted' => 'setSmsBlacklisted', 'createdAt' => 'setCreatedAt', 'modifiedAt' => 'setModifiedAt', 'listIds' => 'setListIds', - 'listUnsubscribed' => 'setListUnsubscribed', - 'attributes' => 'setAttributes' + 'attributes' => 'setAttributes', + 'email' => 'setEmail', + 'listUnsubscribed' => 'setListUnsubscribed' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ - 'email' => 'getEmail', + protected static array $getters = [ 'id' => 'getId', 'emailBlacklisted' => 'getEmailBlacklisted', 'smsBlacklisted' => 'getSmsBlacklisted', 'createdAt' => 'getCreatedAt', 'modifiedAt' => 'getModifiedAt', 'listIds' => 'getListIds', - 'listUnsubscribed' => 'getListUnsubscribed', - 'attributes' => 'getAttributes' + 'attributes' => 'getAttributes', + 'email' => 'getEmail', + 'listUnsubscribed' => 'getListUnsubscribed' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -171,9 +177,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -181,65 +187,48 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['emailBlacklisted'] = isset($data['emailBlacklisted']) ? $data['emailBlacklisted'] : null; - $this->container['smsBlacklisted'] = isset($data['smsBlacklisted']) ? $data['smsBlacklisted'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['modifiedAt'] = isset($data['modifiedAt']) ? $data['modifiedAt'] : null; - $this->container['listIds'] = isset($data['listIds']) ? $data['listIds'] : null; - $this->container['listUnsubscribed'] = isset($data['listUnsubscribed']) ? $data['listUnsubscribed'] : null; - $this->container['attributes'] = isset($data['attributes']) ? $data['attributes'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('emailBlacklisted', $data ?? [], null); + $this->setIfExists('smsBlacklisted', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('modifiedAt', $data ?? [], null); + $this->setIfExists('listIds', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('listUnsubscribed', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; - if ($this->container['email'] === null) { - $invalidProperties[] = "'email' can't be null"; - } if ($this->container['id'] === null) { $invalidProperties[] = "'id' can't be null"; } @@ -264,48 +253,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets email - * - * @return string - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string $email Email address of the contact for which you requested the details - * - * @return $this - */ - public function setEmail($email) - { - $this->container['email'] = $email; - - return $this; - } - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -317,8 +270,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -329,7 +285,7 @@ public function setId($id) * * @return bool */ - public function getEmailBlacklisted() + public function getEmailBlacklisted(): bool { return $this->container['emailBlacklisted']; } @@ -341,8 +297,11 @@ public function getEmailBlacklisted() * * @return $this */ - public function setEmailBlacklisted($emailBlacklisted) + public function setEmailBlacklisted(bool $emailBlacklisted): static { + if (is_null($emailBlacklisted)) { + throw new InvalidArgumentException('non-nullable emailBlacklisted cannot be null'); + } $this->container['emailBlacklisted'] = $emailBlacklisted; return $this; @@ -353,7 +312,7 @@ public function setEmailBlacklisted($emailBlacklisted) * * @return bool */ - public function getSmsBlacklisted() + public function getSmsBlacklisted(): bool { return $this->container['smsBlacklisted']; } @@ -365,8 +324,11 @@ public function getSmsBlacklisted() * * @return $this */ - public function setSmsBlacklisted($smsBlacklisted) + public function setSmsBlacklisted(bool $smsBlacklisted): static { + if (is_null($smsBlacklisted)) { + throw new InvalidArgumentException('non-nullable smsBlacklisted cannot be null'); + } $this->container['smsBlacklisted'] = $smsBlacklisted; return $this; @@ -377,7 +339,7 @@ public function setSmsBlacklisted($smsBlacklisted) * * @return string */ - public function getCreatedAt() + public function getCreatedAt(): string { return $this->container['createdAt']; } @@ -389,8 +351,11 @@ public function getCreatedAt() * * @return $this */ - public function setCreatedAt($createdAt) + public function setCreatedAt(string $createdAt): static { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } $this->container['createdAt'] = $createdAt; return $this; @@ -401,7 +366,7 @@ public function setCreatedAt($createdAt) * * @return string */ - public function getModifiedAt() + public function getModifiedAt(): string { return $this->container['modifiedAt']; } @@ -413,8 +378,11 @@ public function getModifiedAt() * * @return $this */ - public function setModifiedAt($modifiedAt) + public function setModifiedAt(string $modifiedAt): static { + if (is_null($modifiedAt)) { + throw new InvalidArgumentException('non-nullable modifiedAt cannot be null'); + } $this->container['modifiedAt'] = $modifiedAt; return $this; @@ -425,7 +393,7 @@ public function setModifiedAt($modifiedAt) * * @return int[] */ - public function getListIds() + public function getListIds(): array { return $this->container['listIds']; } @@ -437,43 +405,22 @@ public function getListIds() * * @return $this */ - public function setListIds($listIds) + public function setListIds(array $listIds): static { + if (is_null($listIds)) { + throw new InvalidArgumentException('non-nullable listIds cannot be null'); + } $this->container['listIds'] = $listIds; return $this; } - /** - * Gets listUnsubscribed - * - * @return int[] - */ - public function getListUnsubscribed() - { - return $this->container['listUnsubscribed']; - } - - /** - * Sets listUnsubscribed - * - * @param int[] $listUnsubscribed listUnsubscribed - * - * @return $this - */ - public function setListUnsubscribed($listUnsubscribed) - { - $this->container['listUnsubscribed'] = $listUnsubscribed; - - return $this; - } - /** * Gets attributes * * @return object */ - public function getAttributes() + public function getAttributes(): object { return $this->container['attributes']; } @@ -485,84 +432,68 @@ public function getAttributes() * * @return $this */ - public function setAttributes($attributes) + public function setAttributes(object $attributes): static { + if (is_null($attributes)) { + throw new InvalidArgumentException('non-nullable attributes cannot be null'); + } $this->container['attributes'] = $attributes; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } /** - * Gets offset. - * - * @param integer $offset Offset + * Gets email * - * @return mixed + * @return string|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function getEmail(): ?string { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container['email']; } /** - * Sets value based on offset. + * Sets email * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param string|null $email Email address of the contact for which you requested the details * - * @return void + * @return $this */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function setEmail(?string $email): static { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); } + $this->container['email'] = $email; + + return $this; } /** - * Unsets offset. - * - * @param integer $offset Offset + * Gets listUnsubscribed * - * @return void + * @return int[]|null */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) + public function getListUnsubscribed(): ?array { - unset($this->container[$offset]); + return $this->container['listUnsubscribed']; } /** - * Gets the string presentation of the object + * Sets listUnsubscribed * - * @return string + * @param int[]|null $listUnsubscribed listUnsubscribed + * + * @return $this */ - public function __toString() + public function setListUnsubscribed(?array $listUnsubscribed): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($listUnsubscribed)) { + throw new InvalidArgumentException('non-nullable listUnsubscribed cannot be null'); } + $this->container['listUnsubscribed'] = $listUnsubscribed; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/GetContactInfoIdentifierParameter.php b/lib/Models/GetContactInfoIdentifierParameter.php new file mode 100644 index 0000000..a03416b --- /dev/null +++ b/lib/Models/GetContactInfoIdentifierParameter.php @@ -0,0 +1,179 @@ + + */ +class GetContactInfoIdentifierParameter extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getContactInfo_identifier_parameter'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } +} + + diff --git a/lib/Models/GetContacts.php b/lib/Models/GetContacts.php index af655cd..26bf286 100644 --- a/lib/Models/GetContacts.php +++ b/lib/Models/GetContacts.php @@ -2,102 +2,101 @@ /** * GetContacts * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetContacts Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetContacts implements ModelInterface, ArrayAccess +class GetContacts extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getContacts'; + protected static string $openAPIModelName = 'getContacts'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'contacts' => 'object[]', + protected static array $openAPITypes = [ + 'contacts' => 'GetContactDetails[]', 'count' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'contacts' => null, 'count' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'contacts' => false, + 'count' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'contacts' => 'contacts', 'count' => 'count' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'contacts' => 'setContacts', 'count' => 'setCount' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'contacts' => 'getContacts', 'count' => 'getCount' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,52 +145,38 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['contacts'] = isset($data['contacts']) ? $data['contacts'] : null; - $this->container['count'] = isset($data['count']) ? $data['count'] : null; + $this->setIfExists('contacts', $data ?? [], null); + $this->setIfExists('count', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -204,24 +189,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets contacts * - * @return object[] + * @return GetContactDetails[] */ - public function getContacts() + public function getContacts(): array { return $this->container['contacts']; } @@ -229,12 +202,15 @@ public function getContacts() /** * Sets contacts * - * @param object[] $contacts contacts + * @param GetContactDetails[] $contacts contacts * * @return $this */ - public function setContacts($contacts) + public function setContacts(array $contacts): static { + if (is_null($contacts)) { + throw new InvalidArgumentException('non-nullable contacts cannot be null'); + } $this->container['contacts'] = $contacts; return $this; @@ -245,7 +221,7 @@ public function setContacts($contacts) * * @return int */ - public function getCount() + public function getCount(): int { return $this->container['count']; } @@ -257,85 +233,15 @@ public function getCount() * * @return $this */ - public function setCount($count) + public function setCount(int $count): static { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } $this->container['count'] = $count; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetCorporateInvitedUsersList.php b/lib/Models/GetCorporateInvitedUsersList.php index bea7d3c..987ff94 100644 --- a/lib/Models/GetCorporateInvitedUsersList.php +++ b/lib/Models/GetCorporateInvitedUsersList.php @@ -2,118 +2,116 @@ /** * GetCorporateInvitedUsersList * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetCorporateInvitedUsersList Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetCorporateInvitedUsersList implements ModelInterface, ArrayAccess +class GetCorporateInvitedUsersList extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getCorporateInvitedUsersList'; + protected static string $openAPIModelName = 'getCorporateInvitedUsersList'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'users' => '\Brevo\Client\Models\GetCorporateInvitedUsersListUsers[]' + protected static array $openAPITypes = [ + 'users' => '\Brevo\Client\Models\GetCorporateInvitedUsersListUsersInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'users' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'users' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'users' => 'users' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'users' => 'setUsers' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'users' => 'getUsers' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,75 +139,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['users'] = isset($data['users']) ? $data['users'] : null; + $this->setIfExists('users', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets users * - * @return \Brevo\Client\Models\GetCorporateInvitedUsersListUsers[] + * @return \Brevo\Client\Models\GetCorporateInvitedUsersListUsersInner[]|null */ - public function getUsers() + public function getUsers(): ?array { return $this->container['users']; } @@ -217,89 +189,19 @@ public function getUsers() /** * Sets users * - * @param \Brevo\Client\Models\GetCorporateInvitedUsersListUsers[] $users Get invited users list + * @param \Brevo\Client\Models\GetCorporateInvitedUsersListUsersInner[]|null $users Get invited users list * * @return $this */ - public function setUsers($users) + public function setUsers(?array $users): static { + if (is_null($users)) { + throw new InvalidArgumentException('non-nullable users cannot be null'); + } $this->container['users'] = $users; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetCorporateInvitedUsersListFeatureAccess.php b/lib/Models/GetCorporateInvitedUsersListFeatureAccess.php deleted file mode 100644 index 3acfa2e..0000000 --- a/lib/Models/GetCorporateInvitedUsersListFeatureAccess.php +++ /dev/null @@ -1,396 +0,0 @@ - 'string[]', - 'apiKeys' => 'string[]', - 'myPlan' => 'string[]', - 'appsManagement' => 'string[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'userManagement' => null, - 'apiKeys' => null, - 'myPlan' => null, - 'appsManagement' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'userManagement' => 'user_management', - 'apiKeys' => 'api_keys', - 'myPlan' => 'my_plan', - 'appsManagement' => 'apps_management' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'userManagement' => 'setUserManagement', - 'apiKeys' => 'setApiKeys', - 'myPlan' => 'setMyPlan', - 'appsManagement' => 'setAppsManagement' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'userManagement' => 'getUserManagement', - 'apiKeys' => 'getApiKeys', - 'myPlan' => 'getMyPlan', - 'appsManagement' => 'getAppsManagement' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['userManagement'] = isset($data['userManagement']) ? $data['userManagement'] : null; - $this->container['apiKeys'] = isset($data['apiKeys']) ? $data['apiKeys'] : null; - $this->container['myPlan'] = isset($data['myPlan']) ? $data['myPlan'] : null; - $this->container['appsManagement'] = isset($data['appsManagement']) ? $data['appsManagement'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets userManagement - * - * @return string[] - */ - public function getUserManagement() - { - return $this->container['userManagement']; - } - - /** - * Sets userManagement - * - * @param string[] $userManagement User management accessiblity. - * - * @return $this - */ - public function setUserManagement($userManagement) - { - $this->container['userManagement'] = $userManagement; - - return $this; - } - - /** - * Gets apiKeys - * - * @return string[] - */ - public function getApiKeys() - { - return $this->container['apiKeys']; - } - - /** - * Sets apiKeys - * - * @param string[] $apiKeys Api keys accessiblity. - * - * @return $this - */ - public function setApiKeys($apiKeys) - { - $this->container['apiKeys'] = $apiKeys; - - return $this; - } - - /** - * Gets myPlan - * - * @return string[] - */ - public function getMyPlan() - { - return $this->container['myPlan']; - } - - /** - * Sets myPlan - * - * @param string[] $myPlan My plan accessiblity. - * - * @return $this - */ - public function setMyPlan($myPlan) - { - $this->container['myPlan'] = $myPlan; - - return $this; - } - - /** - * Gets appsManagement - * - * @return string[] - */ - public function getAppsManagement() - { - return $this->container['appsManagement']; - } - - /** - * Sets appsManagement - * - * @param string[] $appsManagement Apps management accessiblity | Not available in ENTv2 - * - * @return $this - */ - public function setAppsManagement($appsManagement) - { - $this->container['appsManagement'] = $appsManagement; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetCorporateInvitedUsersListGroups.php b/lib/Models/GetCorporateInvitedUsersListGroups.php deleted file mode 100644 index d059605..0000000 --- a/lib/Models/GetCorporateInvitedUsersListGroups.php +++ /dev/null @@ -1,336 +0,0 @@ - 'string', - 'name' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'name' => 'name' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'name' => 'setName' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - '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 - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id group id - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name group name - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetCorporateInvitedUsersListUsers.php b/lib/Models/GetCorporateInvitedUsersListUsers.php deleted file mode 100644 index 68b9478..0000000 --- a/lib/Models/GetCorporateInvitedUsersListUsers.php +++ /dev/null @@ -1,440 +0,0 @@ - '\Brevo\Client\Models\GetCorporateInvitedUsersListGroups', - 'email' => 'string', - 'isOwner' => 'string', - 'status' => 'string', - 'featureAccess' => '\Brevo\Client\Models\GetCorporateInvitedUsersListFeatureAccess' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'groups' => null, - 'email' => null, - 'isOwner' => null, - 'status' => null, - 'featureAccess' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'groups' => 'groups', - 'email' => 'email', - 'isOwner' => 'is_owner', - 'status' => 'status', - 'featureAccess' => 'feature_access' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'groups' => 'setGroups', - 'email' => 'setEmail', - 'isOwner' => 'setIsOwner', - 'status' => 'setStatus', - 'featureAccess' => 'setFeatureAccess' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'groups' => 'getGroups', - 'email' => 'getEmail', - 'isOwner' => 'getIsOwner', - 'status' => 'getStatus', - 'featureAccess' => 'getFeatureAccess' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['groups'] = isset($data['groups']) ? $data['groups'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['isOwner'] = isset($data['isOwner']) ? $data['isOwner'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['featureAccess'] = isset($data['featureAccess']) ? $data['featureAccess'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['groups'] === null) { - $invalidProperties[] = "'groups' can't be null"; - } - if ($this->container['email'] === null) { - $invalidProperties[] = "'email' can't be null"; - } - if ($this->container['isOwner'] === null) { - $invalidProperties[] = "'isOwner' can't be null"; - } - if ($this->container['status'] === null) { - $invalidProperties[] = "'status' can't be null"; - } - if ($this->container['featureAccess'] === null) { - $invalidProperties[] = "'featureAccess' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets groups - * - * @return \Brevo\Client\Models\GetCorporateInvitedUsersListGroups - */ - public function getGroups() - { - return $this->container['groups']; - } - - /** - * Sets groups - * - * @param \Brevo\Client\Models\GetCorporateInvitedUsersListGroups $groups groups - * - * @return $this - */ - public function setGroups($groups) - { - $this->container['groups'] = $groups; - - return $this; - } - - /** - * Gets email - * - * @return string - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string $email Email address of the user. - * - * @return $this - */ - public function setEmail($email) - { - $this->container['email'] = $email; - - return $this; - } - - /** - * Gets isOwner - * - * @return string - */ - public function getIsOwner() - { - return $this->container['isOwner']; - } - - /** - * Sets isOwner - * - * @param string $isOwner Flag for indicating is user owner of the organization. - * - * @return $this - */ - public function setIsOwner($isOwner) - { - $this->container['isOwner'] = $isOwner; - - return $this; - } - - /** - * Gets status - * - * @return string - */ - public function getStatus() - { - return $this->container['status']; - } - - /** - * Sets status - * - * @param string $status Status of the invited user. - * - * @return $this - */ - public function setStatus($status) - { - $this->container['status'] = $status; - - return $this; - } - - /** - * Gets featureAccess - * - * @return \Brevo\Client\Models\GetCorporateInvitedUsersListFeatureAccess - */ - public function getFeatureAccess() - { - return $this->container['featureAccess']; - } - - /** - * Sets featureAccess - * - * @param \Brevo\Client\Models\GetCorporateInvitedUsersListFeatureAccess $featureAccess featureAccess - * - * @return $this - */ - public function setFeatureAccess($featureAccess) - { - $this->container['featureAccess'] = $featureAccess; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetCorporateInvitedUsersListUsersInner.php b/lib/Models/GetCorporateInvitedUsersListUsersInner.php new file mode 100644 index 0000000..d0fa9b8 --- /dev/null +++ b/lib/Models/GetCorporateInvitedUsersListUsersInner.php @@ -0,0 +1,355 @@ + + */ +class GetCorporateInvitedUsersListUsersInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getCorporateInvitedUsersList_users_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'email' => 'string', + 'isOwner' => 'string', + 'status' => 'string', + 'featureAccess' => '\Brevo\Client\Models\GetCorporateInvitedUsersListUsersInnerFeatureAccess', + 'groups' => '\Brevo\Client\Models\GetCorporateInvitedUsersListUsersInnerGroups' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'email' => null, + 'isOwner' => null, + 'status' => null, + 'featureAccess' => null, + 'groups' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'isOwner' => false, + 'status' => false, + 'featureAccess' => false, + 'groups' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'email' => 'email', + 'isOwner' => 'is_owner', + 'status' => 'status', + 'featureAccess' => 'feature_access', + 'groups' => 'groups' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'email' => 'setEmail', + 'isOwner' => 'setIsOwner', + 'status' => 'setStatus', + 'featureAccess' => 'setFeatureAccess', + 'groups' => 'setGroups' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'email' => 'getEmail', + 'isOwner' => 'getIsOwner', + 'status' => 'getStatus', + 'featureAccess' => 'getFeatureAccess', + 'groups' => 'getGroups' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('isOwner', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('featureAccess', $data ?? [], null); + $this->setIfExists('groups', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['email'] === null) { + $invalidProperties[] = "'email' can't be null"; + } + if ($this->container['isOwner'] === null) { + $invalidProperties[] = "'isOwner' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + if ($this->container['featureAccess'] === null) { + $invalidProperties[] = "'featureAccess' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets email + * + * @return string + */ + public function getEmail(): string + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string $email Email address of the user. + * + * @return $this + */ + public function setEmail(string $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets isOwner + * + * @return string + */ + public function getIsOwner(): string + { + return $this->container['isOwner']; + } + + /** + * Sets isOwner + * + * @param string $isOwner Flag for indicating is user owner of the organization. + * + * @return $this + */ + public function setIsOwner(string $isOwner): static + { + if (is_null($isOwner)) { + throw new InvalidArgumentException('non-nullable isOwner cannot be null'); + } + $this->container['isOwner'] = $isOwner; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus(): string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status Status of the invited user. + * + * @return $this + */ + public function setStatus(string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets featureAccess + * + * @return \Brevo\Client\Models\GetCorporateInvitedUsersListUsersInnerFeatureAccess + */ + public function getFeatureAccess(): \Brevo\Client\Models\GetCorporateInvitedUsersListUsersInnerFeatureAccess + { + return $this->container['featureAccess']; + } + + /** + * Sets featureAccess + * + * @param \Brevo\Client\Models\GetCorporateInvitedUsersListUsersInnerFeatureAccess $featureAccess featureAccess + * + * @return $this + */ + public function setFeatureAccess(\Brevo\Client\Models\GetCorporateInvitedUsersListUsersInnerFeatureAccess $featureAccess): static + { + if (is_null($featureAccess)) { + throw new InvalidArgumentException('non-nullable featureAccess cannot be null'); + } + $this->container['featureAccess'] = $featureAccess; + + return $this; + } + + /** + * Gets groups + * + * @return \Brevo\Client\Models\GetCorporateInvitedUsersListUsersInnerGroups|null + */ + public function getGroups(): ?\Brevo\Client\Models\GetCorporateInvitedUsersListUsersInnerGroups + { + return $this->container['groups']; + } + + /** + * Sets groups + * + * @param \Brevo\Client\Models\GetCorporateInvitedUsersListUsersInnerGroups|null $groups groups + * + * @return $this + */ + public function setGroups(?\Brevo\Client\Models\GetCorporateInvitedUsersListUsersInnerGroups $groups): static + { + if (is_null($groups)) { + throw new InvalidArgumentException('non-nullable groups cannot be null'); + } + $this->container['groups'] = $groups; + + return $this; + } +} + + diff --git a/lib/Models/GetCorporateInvitedUsersListUsersInnerFeatureAccess.php b/lib/Models/GetCorporateInvitedUsersListUsersInnerFeatureAccess.php new file mode 100644 index 0000000..a15aff6 --- /dev/null +++ b/lib/Models/GetCorporateInvitedUsersListUsersInnerFeatureAccess.php @@ -0,0 +1,480 @@ + + */ +class GetCorporateInvitedUsersListUsersInnerFeatureAccess extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getCorporateInvitedUsersList_users_inner_feature_access'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'userManagement' => 'string[]', + 'apiKeys' => 'string[]', + 'myPlan' => 'string[]', + 'appsManagement' => 'string[]', + 'subOrganizationGroups' => 'string[]', + 'createSubOrganizations' => 'string[]', + 'manageSubOrganizations' => 'string[]', + 'analytics' => 'string[]', + 'security' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'userManagement' => null, + 'apiKeys' => null, + 'myPlan' => null, + 'appsManagement' => null, + 'subOrganizationGroups' => null, + 'createSubOrganizations' => null, + 'manageSubOrganizations' => null, + 'analytics' => null, + 'security' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'userManagement' => false, + 'apiKeys' => false, + 'myPlan' => false, + 'appsManagement' => false, + 'subOrganizationGroups' => false, + 'createSubOrganizations' => false, + 'manageSubOrganizations' => false, + 'analytics' => false, + 'security' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'userManagement' => 'user_management', + 'apiKeys' => 'api_keys', + 'myPlan' => 'my_plan', + 'appsManagement' => 'apps_management', + 'subOrganizationGroups' => 'sub_organization_groups', + 'createSubOrganizations' => 'create_sub_organizations', + 'manageSubOrganizations' => 'manage_sub_organizations', + 'analytics' => 'analytics', + 'security' => 'security' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'userManagement' => 'setUserManagement', + 'apiKeys' => 'setApiKeys', + 'myPlan' => 'setMyPlan', + 'appsManagement' => 'setAppsManagement', + 'subOrganizationGroups' => 'setSubOrganizationGroups', + 'createSubOrganizations' => 'setCreateSubOrganizations', + 'manageSubOrganizations' => 'setManageSubOrganizations', + 'analytics' => 'setAnalytics', + 'security' => 'setSecurity' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'userManagement' => 'getUserManagement', + 'apiKeys' => 'getApiKeys', + 'myPlan' => 'getMyPlan', + 'appsManagement' => 'getAppsManagement', + 'subOrganizationGroups' => 'getSubOrganizationGroups', + 'createSubOrganizations' => 'getCreateSubOrganizations', + 'manageSubOrganizations' => 'getManageSubOrganizations', + 'analytics' => 'getAnalytics', + 'security' => 'getSecurity' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('userManagement', $data ?? [], null); + $this->setIfExists('apiKeys', $data ?? [], null); + $this->setIfExists('myPlan', $data ?? [], null); + $this->setIfExists('appsManagement', $data ?? [], null); + $this->setIfExists('subOrganizationGroups', $data ?? [], null); + $this->setIfExists('createSubOrganizations', $data ?? [], null); + $this->setIfExists('manageSubOrganizations', $data ?? [], null); + $this->setIfExists('analytics', $data ?? [], null); + $this->setIfExists('security', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets userManagement + * + * @return string[]|null + */ + public function getUserManagement(): ?array + { + return $this->container['userManagement']; + } + + /** + * Sets userManagement + * + * @param string[]|null $userManagement User management accessiblity. + * + * @return $this + */ + public function setUserManagement(?array $userManagement): static + { + if (is_null($userManagement)) { + throw new InvalidArgumentException('non-nullable userManagement cannot be null'); + } + $this->container['userManagement'] = $userManagement; + + return $this; + } + + /** + * Gets apiKeys + * + * @return string[]|null + */ + public function getApiKeys(): ?array + { + return $this->container['apiKeys']; + } + + /** + * Sets apiKeys + * + * @param string[]|null $apiKeys Api keys accessiblity. + * + * @return $this + */ + public function setApiKeys(?array $apiKeys): static + { + if (is_null($apiKeys)) { + throw new InvalidArgumentException('non-nullable apiKeys cannot be null'); + } + $this->container['apiKeys'] = $apiKeys; + + return $this; + } + + /** + * Gets myPlan + * + * @return string[]|null + */ + public function getMyPlan(): ?array + { + return $this->container['myPlan']; + } + + /** + * Sets myPlan + * + * @param string[]|null $myPlan My plan accessiblity. + * + * @return $this + */ + public function setMyPlan(?array $myPlan): static + { + if (is_null($myPlan)) { + throw new InvalidArgumentException('non-nullable myPlan cannot be null'); + } + $this->container['myPlan'] = $myPlan; + + return $this; + } + + /** + * Gets appsManagement + * + * @return string[]|null + */ + public function getAppsManagement(): ?array + { + return $this->container['appsManagement']; + } + + /** + * Sets appsManagement + * + * @param string[]|null $appsManagement Apps management accessiblity | Not available in ENTv2 + * + * @return $this + */ + public function setAppsManagement(?array $appsManagement): static + { + if (is_null($appsManagement)) { + throw new InvalidArgumentException('non-nullable appsManagement cannot be null'); + } + $this->container['appsManagement'] = $appsManagement; + + return $this; + } + + /** + * Gets subOrganizationGroups + * + * @return string[]|null + */ + public function getSubOrganizationGroups(): ?array + { + return $this->container['subOrganizationGroups']; + } + + /** + * Sets subOrganizationGroups + * + * @param string[]|null $subOrganizationGroups Group creation, modification or deletion accessibility + * + * @return $this + */ + public function setSubOrganizationGroups(?array $subOrganizationGroups): static + { + if (is_null($subOrganizationGroups)) { + throw new InvalidArgumentException('non-nullable subOrganizationGroups cannot be null'); + } + $this->container['subOrganizationGroups'] = $subOrganizationGroups; + + return $this; + } + + /** + * Gets createSubOrganizations + * + * @return string[]|null + */ + public function getCreateSubOrganizations(): ?array + { + return $this->container['createSubOrganizations']; + } + + /** + * Sets createSubOrganizations + * + * @param string[]|null $createSubOrganizations Authorization to create sub-organization in the admin account. If the user creating the sub-organization, belongs to a group, the user must choose a group at the sub-organization creation. + * + * @return $this + */ + public function setCreateSubOrganizations(?array $createSubOrganizations): static + { + if (is_null($createSubOrganizations)) { + throw new InvalidArgumentException('non-nullable createSubOrganizations cannot be null'); + } + $this->container['createSubOrganizations'] = $createSubOrganizations; + + return $this; + } + + /** + * Gets manageSubOrganizations + * + * @return string[]|null + */ + public function getManageSubOrganizations(): ?array + { + return $this->container['manageSubOrganizations']; + } + + /** + * Sets manageSubOrganizations + * + * @param string[]|null $manageSubOrganizations Authorization to manage and access sub-organizations in the admin account. + * + * @return $this + */ + public function setManageSubOrganizations(?array $manageSubOrganizations): static + { + if (is_null($manageSubOrganizations)) { + throw new InvalidArgumentException('non-nullable manageSubOrganizations cannot be null'); + } + $this->container['manageSubOrganizations'] = $manageSubOrganizations; + + return $this; + } + + /** + * Gets analytics + * + * @return string[]|null + */ + public function getAnalytics(): ?array + { + return $this->container['analytics']; + } + + /** + * Sets analytics + * + * @param string[]|null $analytics Analytics dashboard accessibility + * + * @return $this + */ + public function setAnalytics(?array $analytics): static + { + if (is_null($analytics)) { + throw new InvalidArgumentException('non-nullable analytics cannot be null'); + } + $this->container['analytics'] = $analytics; + + return $this; + } + + /** + * Gets security + * + * @return string[]|null + */ + public function getSecurity(): ?array + { + return $this->container['security']; + } + + /** + * Sets security + * + * @param string[]|null $security Security page accessibility + * + * @return $this + */ + public function setSecurity(?array $security): static + { + if (is_null($security)) { + throw new InvalidArgumentException('non-nullable security cannot be null'); + } + $this->container['security'] = $security; + + return $this; + } +} + + diff --git a/lib/Models/GetCorporateInvitedUsersListUsersInnerGroups.php b/lib/Models/GetCorporateInvitedUsersListUsersInnerGroups.php new file mode 100644 index 0000000..c816994 --- /dev/null +++ b/lib/Models/GetCorporateInvitedUsersListUsersInnerGroups.php @@ -0,0 +1,242 @@ + + */ +class GetCorporateInvitedUsersListUsersInnerGroups extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getCorporateInvitedUsersList_users_inner_groups'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id group id + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name group name + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } +} + + diff --git a/lib/Models/GetCorporateUserPermission.php b/lib/Models/GetCorporateUserPermission.php new file mode 100644 index 0000000..8792018 --- /dev/null +++ b/lib/Models/GetCorporateUserPermission.php @@ -0,0 +1,322 @@ + + */ +class GetCorporateUserPermission extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getCorporateUserPermission'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'email' => 'string', + 'status' => 'string', + 'groups' => '\Brevo\Client\Models\GetCorporateUserPermissionGroupsInner[]', + 'featureAccess' => '\Brevo\Client\Models\GetCorporateUserPermissionFeatureAccess' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'email' => null, + 'status' => null, + 'groups' => null, + 'featureAccess' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'status' => false, + 'groups' => false, + 'featureAccess' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'email' => 'email', + 'status' => 'status', + 'groups' => 'groups', + 'featureAccess' => 'feature_access' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'email' => 'setEmail', + 'status' => 'setStatus', + 'groups' => 'setGroups', + 'featureAccess' => 'setFeatureAccess' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'email' => 'getEmail', + 'status' => 'getStatus', + 'groups' => 'getGroups', + 'featureAccess' => 'getFeatureAccess' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('groups', $data ?? [], null); + $this->setIfExists('featureAccess', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['email'] === null) { + $invalidProperties[] = "'email' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + if ($this->container['groups'] === null) { + $invalidProperties[] = "'groups' can't be null"; + } + if ($this->container['featureAccess'] === null) { + $invalidProperties[] = "'featureAccess' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets email + * + * @return string + */ + public function getEmail(): string + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string $email Email address of the user. + * + * @return $this + */ + public function setEmail(string $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus(): string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status Status of the invited user. + * + * @return $this + */ + public function setStatus(string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets groups + * + * @return \Brevo\Client\Models\GetCorporateUserPermissionGroupsInner[] + */ + public function getGroups(): array + { + return $this->container['groups']; + } + + /** + * Sets groups + * + * @param \Brevo\Client\Models\GetCorporateUserPermissionGroupsInner[] $groups groups + * + * @return $this + */ + public function setGroups(array $groups): static + { + if (is_null($groups)) { + throw new InvalidArgumentException('non-nullable groups cannot be null'); + } + $this->container['groups'] = $groups; + + return $this; + } + + /** + * Gets featureAccess + * + * @return \Brevo\Client\Models\GetCorporateUserPermissionFeatureAccess + */ + public function getFeatureAccess(): \Brevo\Client\Models\GetCorporateUserPermissionFeatureAccess + { + return $this->container['featureAccess']; + } + + /** + * Sets featureAccess + * + * @param \Brevo\Client\Models\GetCorporateUserPermissionFeatureAccess $featureAccess featureAccess + * + * @return $this + */ + public function setFeatureAccess(\Brevo\Client\Models\GetCorporateUserPermissionFeatureAccess $featureAccess): static + { + if (is_null($featureAccess)) { + throw new InvalidArgumentException('non-nullable featureAccess cannot be null'); + } + $this->container['featureAccess'] = $featureAccess; + + return $this; + } +} + + diff --git a/lib/Models/GetCorporateUserPermissionFeatureAccess.php b/lib/Models/GetCorporateUserPermissionFeatureAccess.php new file mode 100644 index 0000000..45d61ae --- /dev/null +++ b/lib/Models/GetCorporateUserPermissionFeatureAccess.php @@ -0,0 +1,480 @@ + + */ +class GetCorporateUserPermissionFeatureAccess extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getCorporateUserPermission_feature_access'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'apiKeys' => 'string[]', + 'myPlan' => 'string[]', + 'userManagement' => 'string[]', + 'appsManagement' => 'string[]', + 'subOrganizationGroups' => 'string[]', + 'createSubOrganizations' => 'string[]', + 'manageSubOrganizations' => 'string[]', + 'analytics' => 'string[]', + 'security' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'apiKeys' => null, + 'myPlan' => null, + 'userManagement' => null, + 'appsManagement' => null, + 'subOrganizationGroups' => null, + 'createSubOrganizations' => null, + 'manageSubOrganizations' => null, + 'analytics' => null, + 'security' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'apiKeys' => false, + 'myPlan' => false, + 'userManagement' => false, + 'appsManagement' => false, + 'subOrganizationGroups' => false, + 'createSubOrganizations' => false, + 'manageSubOrganizations' => false, + 'analytics' => false, + 'security' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'apiKeys' => 'api_keys', + 'myPlan' => 'my_plan', + 'userManagement' => 'user_management', + 'appsManagement' => 'apps_management', + 'subOrganizationGroups' => 'sub_organization_groups', + 'createSubOrganizations' => 'create_sub_organizations', + 'manageSubOrganizations' => 'manage_sub_organizations', + 'analytics' => 'analytics', + 'security' => 'security' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'apiKeys' => 'setApiKeys', + 'myPlan' => 'setMyPlan', + 'userManagement' => 'setUserManagement', + 'appsManagement' => 'setAppsManagement', + 'subOrganizationGroups' => 'setSubOrganizationGroups', + 'createSubOrganizations' => 'setCreateSubOrganizations', + 'manageSubOrganizations' => 'setManageSubOrganizations', + 'analytics' => 'setAnalytics', + 'security' => 'setSecurity' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'apiKeys' => 'getApiKeys', + 'myPlan' => 'getMyPlan', + 'userManagement' => 'getUserManagement', + 'appsManagement' => 'getAppsManagement', + 'subOrganizationGroups' => 'getSubOrganizationGroups', + 'createSubOrganizations' => 'getCreateSubOrganizations', + 'manageSubOrganizations' => 'getManageSubOrganizations', + 'analytics' => 'getAnalytics', + 'security' => 'getSecurity' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('apiKeys', $data ?? [], null); + $this->setIfExists('myPlan', $data ?? [], null); + $this->setIfExists('userManagement', $data ?? [], null); + $this->setIfExists('appsManagement', $data ?? [], null); + $this->setIfExists('subOrganizationGroups', $data ?? [], null); + $this->setIfExists('createSubOrganizations', $data ?? [], null); + $this->setIfExists('manageSubOrganizations', $data ?? [], null); + $this->setIfExists('analytics', $data ?? [], null); + $this->setIfExists('security', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets apiKeys + * + * @return string[]|null + */ + public function getApiKeys(): ?array + { + return $this->container['apiKeys']; + } + + /** + * Sets apiKeys + * + * @param string[]|null $apiKeys Permission on api keys + * + * @return $this + */ + public function setApiKeys(?array $apiKeys): static + { + if (is_null($apiKeys)) { + throw new InvalidArgumentException('non-nullable apiKeys cannot be null'); + } + $this->container['apiKeys'] = $apiKeys; + + return $this; + } + + /** + * Gets myPlan + * + * @return string[]|null + */ + public function getMyPlan(): ?array + { + return $this->container['myPlan']; + } + + /** + * Sets myPlan + * + * @param string[]|null $myPlan Permission on my plan + * + * @return $this + */ + public function setMyPlan(?array $myPlan): static + { + if (is_null($myPlan)) { + throw new InvalidArgumentException('non-nullable myPlan cannot be null'); + } + $this->container['myPlan'] = $myPlan; + + return $this; + } + + /** + * Gets userManagement + * + * @return string[]|null + */ + public function getUserManagement(): ?array + { + return $this->container['userManagement']; + } + + /** + * Sets userManagement + * + * @param string[]|null $userManagement Permission on user management + * + * @return $this + */ + public function setUserManagement(?array $userManagement): static + { + if (is_null($userManagement)) { + throw new InvalidArgumentException('non-nullable userManagement cannot be null'); + } + $this->container['userManagement'] = $userManagement; + + return $this; + } + + /** + * Gets appsManagement + * + * @return string[]|null + */ + public function getAppsManagement(): ?array + { + return $this->container['appsManagement']; + } + + /** + * Sets appsManagement + * + * @param string[]|null $appsManagement Permission on apps management + * + * @return $this + */ + public function setAppsManagement(?array $appsManagement): static + { + if (is_null($appsManagement)) { + throw new InvalidArgumentException('non-nullable appsManagement cannot be null'); + } + $this->container['appsManagement'] = $appsManagement; + + return $this; + } + + /** + * Gets subOrganizationGroups + * + * @return string[]|null + */ + public function getSubOrganizationGroups(): ?array + { + return $this->container['subOrganizationGroups']; + } + + /** + * Sets subOrganizationGroups + * + * @param string[]|null $subOrganizationGroups Permission on groups + * + * @return $this + */ + public function setSubOrganizationGroups(?array $subOrganizationGroups): static + { + if (is_null($subOrganizationGroups)) { + throw new InvalidArgumentException('non-nullable subOrganizationGroups cannot be null'); + } + $this->container['subOrganizationGroups'] = $subOrganizationGroups; + + return $this; + } + + /** + * Gets createSubOrganizations + * + * @return string[]|null + */ + public function getCreateSubOrganizations(): ?array + { + return $this->container['createSubOrganizations']; + } + + /** + * Sets createSubOrganizations + * + * @param string[]|null $createSubOrganizations Permission on create sub-accounts + * + * @return $this + */ + public function setCreateSubOrganizations(?array $createSubOrganizations): static + { + if (is_null($createSubOrganizations)) { + throw new InvalidArgumentException('non-nullable createSubOrganizations cannot be null'); + } + $this->container['createSubOrganizations'] = $createSubOrganizations; + + return $this; + } + + /** + * Gets manageSubOrganizations + * + * @return string[]|null + */ + public function getManageSubOrganizations(): ?array + { + return $this->container['manageSubOrganizations']; + } + + /** + * Sets manageSubOrganizations + * + * @param string[]|null $manageSubOrganizations Permission on manage sub-accounts + * + * @return $this + */ + public function setManageSubOrganizations(?array $manageSubOrganizations): static + { + if (is_null($manageSubOrganizations)) { + throw new InvalidArgumentException('non-nullable manageSubOrganizations cannot be null'); + } + $this->container['manageSubOrganizations'] = $manageSubOrganizations; + + return $this; + } + + /** + * Gets analytics + * + * @return string[]|null + */ + public function getAnalytics(): ?array + { + return $this->container['analytics']; + } + + /** + * Sets analytics + * + * @param string[]|null $analytics Permission on analytics + * + * @return $this + */ + public function setAnalytics(?array $analytics): static + { + if (is_null($analytics)) { + throw new InvalidArgumentException('non-nullable analytics cannot be null'); + } + $this->container['analytics'] = $analytics; + + return $this; + } + + /** + * Gets security + * + * @return string[]|null + */ + public function getSecurity(): ?array + { + return $this->container['security']; + } + + /** + * Sets security + * + * @param string[]|null $security Permission on security + * + * @return $this + */ + public function setSecurity(?array $security): static + { + if (is_null($security)) { + throw new InvalidArgumentException('non-nullable security cannot be null'); + } + $this->container['security'] = $security; + + return $this; + } +} + + diff --git a/lib/Models/GetCorporateUserPermissionGroupsInner.php b/lib/Models/GetCorporateUserPermissionGroupsInner.php new file mode 100644 index 0000000..61f010e --- /dev/null +++ b/lib/Models/GetCorporateUserPermissionGroupsInner.php @@ -0,0 +1,242 @@ + + */ +class GetCorporateUserPermissionGroupsInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getCorporateUserPermission_groups_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id group identifier + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Group name + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } +} + + diff --git a/lib/Models/GetCouponCollection.php b/lib/Models/GetCouponCollection.php index 17f4fe1..c6f96e5 100644 --- a/lib/Models/GetCouponCollection.php +++ b/lib/Models/GetCouponCollection.php @@ -2,153 +2,174 @@ /** * GetCouponCollection * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetCouponCollection Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetCouponCollection implements ModelInterface, ArrayAccess +class GetCouponCollection extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getCouponCollection'; + protected static string $openAPIModelName = 'getCouponCollection'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'string', 'name' => 'string', 'defaultCoupon' => 'string', 'createdAt' => '\DateTime', 'totalCoupons' => 'int', - 'remainingCoupons' => 'int' + 'remainingCoupons' => 'int', + 'expirationDate' => '\DateTime', + 'remainingDaysAlert' => 'int', + 'remainingCouponsAlert' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'uuidv4', 'name' => 'uuidv4', 'defaultCoupon' => null, 'createdAt' => 'date-time', 'totalCoupons' => 'int64', - 'remainingCoupons' => 'int64' + 'remainingCoupons' => 'int64', + 'expirationDate' => 'date-time', + 'remainingDaysAlert' => null, + 'remainingCouponsAlert' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'defaultCoupon' => false, + 'createdAt' => false, + 'totalCoupons' => false, + 'remainingCoupons' => false, + 'expirationDate' => false, + 'remainingDaysAlert' => false, + 'remainingCouponsAlert' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name', 'defaultCoupon' => 'defaultCoupon', 'createdAt' => 'createdAt', 'totalCoupons' => 'totalCoupons', - 'remainingCoupons' => 'remainingCoupons' + 'remainingCoupons' => 'remainingCoupons', + 'expirationDate' => 'expirationDate', + 'remainingDaysAlert' => 'remainingDaysAlert', + 'remainingCouponsAlert' => 'remainingCouponsAlert' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName', 'defaultCoupon' => 'setDefaultCoupon', 'createdAt' => 'setCreatedAt', 'totalCoupons' => 'setTotalCoupons', - 'remainingCoupons' => 'setRemainingCoupons' + 'remainingCoupons' => 'setRemainingCoupons', + 'expirationDate' => 'setExpirationDate', + 'remainingDaysAlert' => 'setRemainingDaysAlert', + 'remainingCouponsAlert' => 'setRemainingCouponsAlert' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName', 'defaultCoupon' => 'getDefaultCoupon', 'createdAt' => 'getCreatedAt', 'totalCoupons' => 'getTotalCoupons', - 'remainingCoupons' => 'getRemainingCoupons' + 'remainingCoupons' => 'getRemainingCoupons', + 'expirationDate' => 'getExpirationDate', + 'remainingDaysAlert' => 'getRemainingDaysAlert', + 'remainingCouponsAlert' => 'getRemainingCouponsAlert' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -156,9 +177,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -166,56 +187,45 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['defaultCoupon'] = isset($data['defaultCoupon']) ? $data['defaultCoupon'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['totalCoupons'] = isset($data['totalCoupons']) ? $data['totalCoupons'] : null; - $this->container['remainingCoupons'] = isset($data['remainingCoupons']) ? $data['remainingCoupons'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('defaultCoupon', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('totalCoupons', $data ?? [], null); + $this->setIfExists('remainingCoupons', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('remainingDaysAlert', $data ?? [], null); + $this->setIfExists('remainingCouponsAlert', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -240,24 +250,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return string */ - public function getId() + public function getId(): string { return $this->container['id']; } @@ -265,12 +263,15 @@ public function getId() /** * Sets id * - * @param string $id The id of the collection + * @param string $id The id of the collection. * * @return $this */ - public function setId($id) + public function setId(string $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -281,7 +282,7 @@ public function setId($id) * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -289,12 +290,15 @@ public function getName() /** * Sets name * - * @param string $name The name of the collection + * @param string $name The name of the collection. * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -305,7 +309,7 @@ public function setName($name) * * @return string */ - public function getDefaultCoupon() + public function getDefaultCoupon(): string { return $this->container['defaultCoupon']; } @@ -313,12 +317,15 @@ public function getDefaultCoupon() /** * Sets defaultCoupon * - * @param string $defaultCoupon The default coupon of the collection + * @param string $defaultCoupon The default coupon of the collection. * * @return $this */ - public function setDefaultCoupon($defaultCoupon) + public function setDefaultCoupon(string $defaultCoupon): static { + if (is_null($defaultCoupon)) { + throw new InvalidArgumentException('non-nullable defaultCoupon cannot be null'); + } $this->container['defaultCoupon'] = $defaultCoupon; return $this; @@ -329,7 +336,7 @@ public function setDefaultCoupon($defaultCoupon) * * @return \DateTime */ - public function getCreatedAt() + public function getCreatedAt(): \DateTime { return $this->container['createdAt']; } @@ -337,12 +344,15 @@ public function getCreatedAt() /** * Sets createdAt * - * @param \DateTime $createdAt Datetime on which the collection was created + * @param \DateTime $createdAt Datetime on which the collection was created. * * @return $this */ - public function setCreatedAt($createdAt) + public function setCreatedAt(\DateTime $createdAt): static { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } $this->container['createdAt'] = $createdAt; return $this; @@ -353,7 +363,7 @@ public function setCreatedAt($createdAt) * * @return int */ - public function getTotalCoupons() + public function getTotalCoupons(): int { return $this->container['totalCoupons']; } @@ -361,12 +371,15 @@ public function getTotalCoupons() /** * Sets totalCoupons * - * @param int $totalCoupons Total coupons in the collection + * @param int $totalCoupons Total number of coupons in the collection. * * @return $this */ - public function setTotalCoupons($totalCoupons) + public function setTotalCoupons(int $totalCoupons): static { + if (is_null($totalCoupons)) { + throw new InvalidArgumentException('non-nullable totalCoupons cannot be null'); + } $this->container['totalCoupons'] = $totalCoupons; return $this; @@ -377,7 +390,7 @@ public function setTotalCoupons($totalCoupons) * * @return int */ - public function getRemainingCoupons() + public function getRemainingCoupons(): int { return $this->container['remainingCoupons']; } @@ -385,88 +398,99 @@ public function getRemainingCoupons() /** * Sets remainingCoupons * - * @param int $remainingCoupons Not sent coupons in the collection + * @param int $remainingCoupons Number of coupons that have not been sent yet. * * @return $this */ - public function setRemainingCoupons($remainingCoupons) + public function setRemainingCoupons(int $remainingCoupons): static { + if (is_null($remainingCoupons)) { + throw new InvalidArgumentException('non-nullable remainingCoupons cannot be null'); + } $this->container['remainingCoupons'] = $remainingCoupons; return $this; } + /** - * Returns true if offset exists. False otherwise. + * Gets expirationDate * - * @param integer $offset Offset - * - * @return boolean + * @return \DateTime|null */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) + public function getExpirationDate(): ?\DateTime { - return isset($this->container[$offset]); + return $this->container['expirationDate']; } /** - * Gets offset. + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration date for the coupon collection in RFC3339 format. * - * @param integer $offset Offset + * @return $this + */ + public function setExpirationDate(?\DateTime $expirationDate): static + { + if (is_null($expirationDate)) { + throw new InvalidArgumentException('non-nullable expirationDate cannot be null'); + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets remainingDaysAlert * - * @return mixed + * @return int|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function getRemainingDaysAlert(): ?int { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container['remainingDaysAlert']; } /** - * Sets value based on offset. + * Sets remainingDaysAlert * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $remainingDaysAlert If present, an email notification is going to be sent the defined amount of days before to the expiration date. * - * @return void + * @return $this */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function setRemainingDaysAlert(?int $remainingDaysAlert): static { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; + if (is_null($remainingDaysAlert)) { + throw new InvalidArgumentException('non-nullable remainingDaysAlert cannot be null'); } + $this->container['remainingDaysAlert'] = $remainingDaysAlert; + + return $this; } /** - * Unsets offset. + * Gets remainingCouponsAlert * - * @param integer $offset Offset - * - * @return void + * @return int|null */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) + public function getRemainingCouponsAlert(): ?int { - unset($this->container[$offset]); + return $this->container['remainingCouponsAlert']; } /** - * Gets the string presentation of the object + * Sets remainingCouponsAlert * - * @return string + * @param int|null $remainingCouponsAlert If present, an email notification is going to be sent when the total number of available coupons falls below the defined threshold. + * + * @return $this */ - public function __toString() + public function setRemainingCouponsAlert(?int $remainingCouponsAlert): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($remainingCouponsAlert)) { + throw new InvalidArgumentException('non-nullable remainingCouponsAlert cannot be null'); } + $this->container['remainingCouponsAlert'] = $remainingCouponsAlert; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/GetDeviceBrowserStats.php b/lib/Models/GetDeviceBrowserStats.php index 90f7e77..731c443 100644 --- a/lib/Models/GetDeviceBrowserStats.php +++ b/lib/Models/GetDeviceBrowserStats.php @@ -2,61 +2,63 @@ /** * GetDeviceBrowserStats * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetDeviceBrowserStats Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetDeviceBrowserStats implements ModelInterface, ArrayAccess +class GetDeviceBrowserStats extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getDeviceBrowserStats'; + protected static string $openAPIModelName = 'getDeviceBrowserStats'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'clickers' => 'int', 'uniqueClicks' => 'int', 'viewed' => 'int', @@ -66,9 +68,9 @@ class GetDeviceBrowserStats implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'clickers' => 'int64', 'uniqueClicks' => 'int64', 'viewed' => 'int64', @@ -76,32 +78,31 @@ class GetDeviceBrowserStats implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'clickers' => false, + 'uniqueClicks' => false, + 'viewed' => false, + 'uniqueViews' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'clickers' => 'clickers', 'uniqueClicks' => 'uniqueClicks', 'viewed' => 'viewed', @@ -111,9 +112,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'clickers' => 'setClickers', 'uniqueClicks' => 'setUniqueClicks', 'viewed' => 'setViewed', @@ -123,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'clickers' => 'getClickers', 'uniqueClicks' => 'getUniqueClicks', 'viewed' => 'getViewed', @@ -136,9 +137,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +147,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,54 +157,40 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['clickers'] = isset($data['clickers']) ? $data['clickers'] : null; - $this->container['uniqueClicks'] = isset($data['uniqueClicks']) ? $data['uniqueClicks'] : null; - $this->container['viewed'] = isset($data['viewed']) ? $data['viewed'] : null; - $this->container['uniqueViews'] = isset($data['uniqueViews']) ? $data['uniqueViews'] : null; + $this->setIfExists('clickers', $data ?? [], null); + $this->setIfExists('uniqueClicks', $data ?? [], null); + $this->setIfExists('viewed', $data ?? [], null); + $this->setIfExists('uniqueViews', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -222,24 +209,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets clickers * * @return int */ - public function getClickers() + public function getClickers(): int { return $this->container['clickers']; } @@ -251,8 +226,11 @@ public function getClickers() * * @return $this */ - public function setClickers($clickers) + public function setClickers(int $clickers): static { + if (is_null($clickers)) { + throw new InvalidArgumentException('non-nullable clickers cannot be null'); + } $this->container['clickers'] = $clickers; return $this; @@ -263,7 +241,7 @@ public function setClickers($clickers) * * @return int */ - public function getUniqueClicks() + public function getUniqueClicks(): int { return $this->container['uniqueClicks']; } @@ -275,8 +253,11 @@ public function getUniqueClicks() * * @return $this */ - public function setUniqueClicks($uniqueClicks) + public function setUniqueClicks(int $uniqueClicks): static { + if (is_null($uniqueClicks)) { + throw new InvalidArgumentException('non-nullable uniqueClicks cannot be null'); + } $this->container['uniqueClicks'] = $uniqueClicks; return $this; @@ -287,7 +268,7 @@ public function setUniqueClicks($uniqueClicks) * * @return int */ - public function getViewed() + public function getViewed(): int { return $this->container['viewed']; } @@ -299,8 +280,11 @@ public function getViewed() * * @return $this */ - public function setViewed($viewed) + public function setViewed(int $viewed): static { + if (is_null($viewed)) { + throw new InvalidArgumentException('non-nullable viewed cannot be null'); + } $this->container['viewed'] = $viewed; return $this; @@ -311,7 +295,7 @@ public function setViewed($viewed) * * @return int */ - public function getUniqueViews() + public function getUniqueViews(): int { return $this->container['uniqueViews']; } @@ -323,85 +307,15 @@ public function getUniqueViews() * * @return $this */ - public function setUniqueViews($uniqueViews) + public function setUniqueViews(int $uniqueViews): static { + if (is_null($uniqueViews)) { + throw new InvalidArgumentException('non-nullable uniqueViews cannot be null'); + } $this->container['uniqueViews'] = $uniqueViews; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetDomainConfigurationModel.php b/lib/Models/GetDomainConfigurationModel.php index 898d3fa..3eba1f9 100644 --- a/lib/Models/GetDomainConfigurationModel.php +++ b/lib/Models/GetDomainConfigurationModel.php @@ -2,61 +2,63 @@ /** * GetDomainConfigurationModel * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetDomainConfigurationModel Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetDomainConfigurationModel implements ModelInterface, ArrayAccess +class GetDomainConfigurationModel extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getDomainConfigurationModel'; + protected static string $openAPIModelName = 'getDomainConfigurationModel'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'domain' => 'string', 'verified' => 'bool', 'authenticated' => 'bool', @@ -66,9 +68,9 @@ class GetDomainConfigurationModel implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'domain' => null, 'verified' => null, 'authenticated' => null, @@ -76,32 +78,31 @@ class GetDomainConfigurationModel implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'domain' => false, + 'verified' => false, + 'authenticated' => false, + 'dnsRecords' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'domain' => 'domain', 'verified' => 'verified', 'authenticated' => 'authenticated', @@ -111,9 +112,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'domain' => 'setDomain', 'verified' => 'setVerified', 'authenticated' => 'setAuthenticated', @@ -123,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'domain' => 'getDomain', 'verified' => 'getVerified', 'authenticated' => 'getAuthenticated', @@ -136,9 +137,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +147,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,54 +157,40 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['domain'] = isset($data['domain']) ? $data['domain'] : null; - $this->container['verified'] = isset($data['verified']) ? $data['verified'] : null; - $this->container['authenticated'] = isset($data['authenticated']) ? $data['authenticated'] : null; - $this->container['dnsRecords'] = isset($data['dnsRecords']) ? $data['dnsRecords'] : null; + $this->setIfExists('domain', $data ?? [], null); + $this->setIfExists('verified', $data ?? [], null); + $this->setIfExists('authenticated', $data ?? [], null); + $this->setIfExists('dnsRecords', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -222,24 +209,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets domain * * @return string */ - public function getDomain() + public function getDomain(): string { return $this->container['domain']; } @@ -251,8 +226,11 @@ public function getDomain() * * @return $this */ - public function setDomain($domain) + public function setDomain(string $domain): static { + if (is_null($domain)) { + throw new InvalidArgumentException('non-nullable domain cannot be null'); + } $this->container['domain'] = $domain; return $this; @@ -263,7 +241,7 @@ public function setDomain($domain) * * @return bool */ - public function getVerified() + public function getVerified(): bool { return $this->container['verified']; } @@ -275,8 +253,11 @@ public function getVerified() * * @return $this */ - public function setVerified($verified) + public function setVerified(bool $verified): static { + if (is_null($verified)) { + throw new InvalidArgumentException('non-nullable verified cannot be null'); + } $this->container['verified'] = $verified; return $this; @@ -287,7 +268,7 @@ public function setVerified($verified) * * @return bool */ - public function getAuthenticated() + public function getAuthenticated(): bool { return $this->container['authenticated']; } @@ -299,8 +280,11 @@ public function getAuthenticated() * * @return $this */ - public function setAuthenticated($authenticated) + public function setAuthenticated(bool $authenticated): static { + if (is_null($authenticated)) { + throw new InvalidArgumentException('non-nullable authenticated cannot be null'); + } $this->container['authenticated'] = $authenticated; return $this; @@ -311,7 +295,7 @@ public function setAuthenticated($authenticated) * * @return \Brevo\Client\Models\CreateDomainModelDnsRecords */ - public function getDnsRecords() + public function getDnsRecords(): \Brevo\Client\Models\CreateDomainModelDnsRecords { return $this->container['dnsRecords']; } @@ -323,85 +307,15 @@ public function getDnsRecords() * * @return $this */ - public function setDnsRecords($dnsRecords) + public function setDnsRecords(\Brevo\Client\Models\CreateDomainModelDnsRecords $dnsRecords): static { + if (is_null($dnsRecords)) { + throw new InvalidArgumentException('non-nullable dnsRecords cannot be null'); + } $this->container['dnsRecords'] = $dnsRecords; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetDomainsList.php b/lib/Models/GetDomainsList.php index 3e50427..add0fc7 100644 --- a/lib/Models/GetDomainsList.php +++ b/lib/Models/GetDomainsList.php @@ -2,118 +2,116 @@ /** * GetDomainsList * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetDomainsList Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetDomainsList implements ModelInterface, ArrayAccess +class GetDomainsList extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getDomainsList'; + protected static string $openAPIModelName = 'getDomainsList'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'domains' => '\Brevo\Client\Models\GetDomainsListDomains[]' + protected static array $openAPITypes = [ + 'domains' => '\Brevo\Client\Models\GetDomainsListDomainsInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'domains' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'domains' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'domains' => 'domains' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'domains' => 'setDomains' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'domains' => 'getDomains' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,75 +139,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['domains'] = isset($data['domains']) ? $data['domains'] : null; + $this->setIfExists('domains', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets domains * - * @return \Brevo\Client\Models\GetDomainsListDomains[] + * @return \Brevo\Client\Models\GetDomainsListDomainsInner[]|null */ - public function getDomains() + public function getDomains(): ?array { return $this->container['domains']; } @@ -217,89 +189,19 @@ public function getDomains() /** * Sets domains * - * @param \Brevo\Client\Models\GetDomainsListDomains[] $domains List of the domains available in your account + * @param \Brevo\Client\Models\GetDomainsListDomainsInner[]|null $domains List of the domains available in your account * * @return $this */ - public function setDomains($domains) + public function setDomains(?array $domains): static { + if (is_null($domains)) { + throw new InvalidArgumentException('non-nullable domains cannot be null'); + } $this->container['domains'] = $domains; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetDomainsListDomains.php b/lib/Models/GetDomainsListDomainsInner.php similarity index 52% rename from lib/Models/GetDomainsListDomains.php rename to lib/Models/GetDomainsListDomainsInner.php index e145cbd..863489d 100644 --- a/lib/Models/GetDomainsListDomains.php +++ b/lib/Models/GetDomainsListDomainsInner.php @@ -1,62 +1,64 @@ */ -class GetDomainsListDomains implements ModelInterface, ArrayAccess +class GetDomainsListDomainsInner extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getDomainsList_domains'; + protected static string $openAPIModelName = 'getDomainsList_domains_inner'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'domainName' => 'string', 'authenticated' => 'bool', @@ -67,9 +69,9 @@ class GetDomainsListDomains implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'domainName' => null, 'authenticated' => null, @@ -78,32 +80,32 @@ class GetDomainsListDomains implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'domainName' => false, + 'authenticated' => false, + 'verified' => false, + 'ip' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'domainName' => 'domain_name', 'authenticated' => 'authenticated', @@ -114,9 +116,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'domainName' => 'setDomainName', 'authenticated' => 'setAuthenticated', @@ -127,9 +129,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'domainName' => 'getDomainName', 'authenticated' => 'getAuthenticated', @@ -141,9 +143,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -151,9 +153,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -161,55 +163,41 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['domainName'] = isset($data['domainName']) ? $data['domainName'] : null; - $this->container['authenticated'] = isset($data['authenticated']) ? $data['authenticated'] : null; - $this->container['verified'] = isset($data['verified']) ? $data['verified'] : null; - $this->container['ip'] = isset($data['ip']) ? $data['ip'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('domainName', $data ?? [], null); + $this->setIfExists('authenticated', $data ?? [], null); + $this->setIfExists('verified', $data ?? [], null); + $this->setIfExists('ip', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -228,24 +216,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -257,8 +233,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -269,7 +248,7 @@ public function setId($id) * * @return string */ - public function getDomainName() + public function getDomainName(): string { return $this->container['domainName']; } @@ -281,8 +260,11 @@ public function getDomainName() * * @return $this */ - public function setDomainName($domainName) + public function setDomainName(string $domainName): static { + if (is_null($domainName)) { + throw new InvalidArgumentException('non-nullable domainName cannot be null'); + } $this->container['domainName'] = $domainName; return $this; @@ -293,7 +275,7 @@ public function setDomainName($domainName) * * @return bool */ - public function getAuthenticated() + public function getAuthenticated(): bool { return $this->container['authenticated']; } @@ -305,8 +287,11 @@ public function getAuthenticated() * * @return $this */ - public function setAuthenticated($authenticated) + public function setAuthenticated(bool $authenticated): static { + if (is_null($authenticated)) { + throw new InvalidArgumentException('non-nullable authenticated cannot be null'); + } $this->container['authenticated'] = $authenticated; return $this; @@ -317,7 +302,7 @@ public function setAuthenticated($authenticated) * * @return bool */ - public function getVerified() + public function getVerified(): bool { return $this->container['verified']; } @@ -329,8 +314,11 @@ public function getVerified() * * @return $this */ - public function setVerified($verified) + public function setVerified(bool $verified): static { + if (is_null($verified)) { + throw new InvalidArgumentException('non-nullable verified cannot be null'); + } $this->container['verified'] = $verified; return $this; @@ -339,9 +327,9 @@ public function setVerified($verified) /** * Gets ip * - * @return string + * @return string|null */ - public function getIp() + public function getIp(): ?string { return $this->container['ip']; } @@ -349,89 +337,19 @@ public function getIp() /** * Sets ip * - * @param string $ip Dedicated IP associated with domain + * @param string|null $ip Dedicated IP associated with domain * * @return $this */ - public function setIp($ip) + public function setIp(?string $ip): static { + if (is_null($ip)) { + throw new InvalidArgumentException('non-nullable ip cannot be null'); + } $this->container['ip'] = $ip; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetEmailCampaign.php b/lib/Models/GetEmailCampaign.php index 177d888..073d1d0 100644 --- a/lib/Models/GetEmailCampaign.php +++ b/lib/Models/GetEmailCampaign.php @@ -2,66 +2,79 @@ /** * GetEmailCampaign * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetEmailCampaign Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetEmailCampaign implements ModelInterface, ArrayAccess +class GetEmailCampaign extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getEmailCampaign'; + protected static string $openAPIModelName = 'getEmailCampaign'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'name' => 'string', - 'subject' => 'string', 'type' => 'string', 'status' => 'string', + 'testSent' => 'bool', + 'header' => 'string', + 'footer' => 'string', + 'sender' => '\Brevo\Client\Models\GetExtendedCampaignOverviewAllOfSender', + 'replyTo' => 'string', + 'htmlContent' => 'string', + 'createdAt' => 'string', + 'modifiedAt' => 'string', + 'recipients' => 'object', + 'statistics' => 'object', + 'subject' => 'string', + 'previewText' => 'string', 'scheduledAt' => 'string', 'abTesting' => 'bool', 'subjectA' => 'string', @@ -70,37 +83,42 @@ class GetEmailCampaign implements ModelInterface, ArrayAccess 'winnerCriteria' => 'string', 'winnerDelay' => 'int', 'sendAtBestTime' => 'bool', - 'testSent' => 'bool', - 'header' => 'string', - 'footer' => 'string', - 'sender' => '\Brevo\Client\Models\GetExtendedCampaignOverviewSender', - 'replyTo' => 'string', + 'utmCampaignValue' => 'string', + 'utmSource' => 'string', + 'utmMedium' => 'string', + 'utmIDActive' => 'bool', 'toField' => 'string', - 'htmlContent' => 'string', 'shareLink' => 'string', 'tag' => 'string', - 'createdAt' => 'string', - 'modifiedAt' => 'string', 'inlineImageActivation' => 'bool', 'mirrorActive' => 'bool', 'recurring' => 'bool', 'sentDate' => 'string', - 'returnBounce' => 'int', - 'recipients' => 'object', - 'statistics' => 'object' + 'returnBounce' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'name' => null, - 'subject' => null, 'type' => null, 'status' => null, + 'testSent' => null, + 'header' => null, + 'footer' => null, + 'sender' => null, + 'replyTo' => 'email', + 'htmlContent' => null, + 'createdAt' => null, + 'modifiedAt' => null, + 'recipients' => null, + 'statistics' => null, + 'subject' => null, + 'previewText' => null, 'scheduledAt' => null, 'abTesting' => null, 'subjectA' => null, @@ -109,58 +127,94 @@ class GetEmailCampaign implements ModelInterface, ArrayAccess 'winnerCriteria' => null, 'winnerDelay' => null, 'sendAtBestTime' => null, - 'testSent' => null, - 'header' => null, - 'footer' => null, - 'sender' => null, - 'replyTo' => 'email', + 'utmCampaignValue' => null, + 'utmSource' => null, + 'utmMedium' => null, + 'utmIDActive' => null, 'toField' => null, - 'htmlContent' => null, 'shareLink' => 'url', 'tag' => null, - 'createdAt' => null, - 'modifiedAt' => null, 'inlineImageActivation' => null, 'mirrorActive' => null, 'recurring' => null, 'sentDate' => null, - 'returnBounce' => 'int64', - 'recipients' => null, - 'statistics' => null + 'returnBounce' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'type' => false, + 'status' => false, + 'testSent' => false, + 'header' => false, + 'footer' => false, + 'sender' => false, + 'replyTo' => false, + 'htmlContent' => false, + 'createdAt' => false, + 'modifiedAt' => false, + 'recipients' => false, + 'statistics' => false, + 'subject' => false, + 'previewText' => false, + 'scheduledAt' => false, + 'abTesting' => false, + 'subjectA' => false, + 'subjectB' => false, + 'splitRule' => false, + 'winnerCriteria' => false, + 'winnerDelay' => false, + 'sendAtBestTime' => false, + 'utmCampaignValue' => false, + 'utmSource' => false, + 'utmMedium' => false, + 'utmIDActive' => false, + 'toField' => false, + 'shareLink' => false, + 'tag' => false, + 'inlineImageActivation' => false, + 'mirrorActive' => false, + 'recurring' => false, + 'sentDate' => false, + 'returnBounce' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name', - 'subject' => 'subject', 'type' => 'type', 'status' => 'status', + 'testSent' => 'testSent', + 'header' => 'header', + 'footer' => 'footer', + 'sender' => 'sender', + 'replyTo' => 'replyTo', + 'htmlContent' => 'htmlContent', + 'createdAt' => 'createdAt', + 'modifiedAt' => 'modifiedAt', + 'recipients' => 'recipients', + 'statistics' => 'statistics', + 'subject' => 'subject', + 'previewText' => 'previewText', 'scheduledAt' => 'scheduledAt', 'abTesting' => 'abTesting', 'subjectA' => 'subjectA', @@ -169,37 +223,42 @@ public static function swaggerFormats() 'winnerCriteria' => 'winnerCriteria', 'winnerDelay' => 'winnerDelay', 'sendAtBestTime' => 'sendAtBestTime', - 'testSent' => 'testSent', - 'header' => 'header', - 'footer' => 'footer', - 'sender' => 'sender', - 'replyTo' => 'replyTo', + 'utmCampaignValue' => 'utmCampaignValue', + 'utmSource' => 'utmSource', + 'utmMedium' => 'utmMedium', + 'utmIDActive' => 'utmIDActive', 'toField' => 'toField', - 'htmlContent' => 'htmlContent', 'shareLink' => 'shareLink', 'tag' => 'tag', - 'createdAt' => 'createdAt', - 'modifiedAt' => 'modifiedAt', 'inlineImageActivation' => 'inlineImageActivation', 'mirrorActive' => 'mirrorActive', 'recurring' => 'recurring', 'sentDate' => 'sentDate', - 'returnBounce' => 'returnBounce', - 'recipients' => 'recipients', - 'statistics' => 'statistics' + 'returnBounce' => 'returnBounce' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName', - 'subject' => 'setSubject', 'type' => 'setType', 'status' => 'setStatus', + 'testSent' => 'setTestSent', + 'header' => 'setHeader', + 'footer' => 'setFooter', + 'sender' => 'setSender', + 'replyTo' => 'setReplyTo', + 'htmlContent' => 'setHtmlContent', + 'createdAt' => 'setCreatedAt', + 'modifiedAt' => 'setModifiedAt', + 'recipients' => 'setRecipients', + 'statistics' => 'setStatistics', + 'subject' => 'setSubject', + 'previewText' => 'setPreviewText', 'scheduledAt' => 'setScheduledAt', 'abTesting' => 'setAbTesting', 'subjectA' => 'setSubjectA', @@ -208,37 +267,42 @@ public static function swaggerFormats() 'winnerCriteria' => 'setWinnerCriteria', 'winnerDelay' => 'setWinnerDelay', 'sendAtBestTime' => 'setSendAtBestTime', - 'testSent' => 'setTestSent', - 'header' => 'setHeader', - 'footer' => 'setFooter', - 'sender' => 'setSender', - 'replyTo' => 'setReplyTo', + 'utmCampaignValue' => 'setUtmCampaignValue', + 'utmSource' => 'setUtmSource', + 'utmMedium' => 'setUtmMedium', + 'utmIDActive' => 'setUtmIDActive', 'toField' => 'setToField', - 'htmlContent' => 'setHtmlContent', 'shareLink' => 'setShareLink', 'tag' => 'setTag', - 'createdAt' => 'setCreatedAt', - 'modifiedAt' => 'setModifiedAt', 'inlineImageActivation' => 'setInlineImageActivation', 'mirrorActive' => 'setMirrorActive', 'recurring' => 'setRecurring', 'sentDate' => 'setSentDate', - 'returnBounce' => 'setReturnBounce', - 'recipients' => 'setRecipients', - 'statistics' => 'setStatistics' + 'returnBounce' => 'setReturnBounce' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName', - 'subject' => 'getSubject', 'type' => 'getType', 'status' => 'getStatus', + 'testSent' => 'getTestSent', + 'header' => 'getHeader', + 'footer' => 'getFooter', + 'sender' => 'getSender', + 'replyTo' => 'getReplyTo', + 'htmlContent' => 'getHtmlContent', + 'createdAt' => 'getCreatedAt', + 'modifiedAt' => 'getModifiedAt', + 'recipients' => 'getRecipients', + 'statistics' => 'getStatistics', + 'subject' => 'getSubject', + 'previewText' => 'getPreviewText', 'scheduledAt' => 'getScheduledAt', 'abTesting' => 'getAbTesting', 'subjectA' => 'getSubjectA', @@ -247,33 +311,27 @@ public static function swaggerFormats() 'winnerCriteria' => 'getWinnerCriteria', 'winnerDelay' => 'getWinnerDelay', 'sendAtBestTime' => 'getSendAtBestTime', - 'testSent' => 'getTestSent', - 'header' => 'getHeader', - 'footer' => 'getFooter', - 'sender' => 'getSender', - 'replyTo' => 'getReplyTo', + 'utmCampaignValue' => 'getUtmCampaignValue', + 'utmSource' => 'getUtmSource', + 'utmMedium' => 'getUtmMedium', + 'utmIDActive' => 'getUtmIDActive', 'toField' => 'getToField', - 'htmlContent' => 'getHtmlContent', 'shareLink' => 'getShareLink', 'tag' => 'getTag', - 'createdAt' => 'getCreatedAt', - 'modifiedAt' => 'getModifiedAt', 'inlineImageActivation' => 'getInlineImageActivation', 'mirrorActive' => 'getMirrorActive', 'recurring' => 'getRecurring', 'sentDate' => 'getSentDate', - 'returnBounce' => 'getReturnBounce', - 'recipients' => 'getRecipients', - 'statistics' => 'getStatistics' + 'returnBounce' => 'getReturnBounce' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -281,9 +339,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -291,34 +349,21 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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'; - const STATUS_SENT = 'sent'; - const STATUS_ARCHIVE = 'archive'; - const STATUS_QUEUED = 'queued'; - const STATUS_SUSPENDED = 'suspended'; - const STATUS_IN_PROCESS = 'in_process'; - - - + public const TYPE_CLASSIC = 'classic'; + public const TYPE_TRIGGER = 'trigger'; + public const STATUS_DRAFT = 'draft'; + public const STATUS_SENT = 'sent'; + public const STATUS_ARCHIVE = 'archive'; + public const STATUS_QUEUED = 'queued'; + public const STATUS_SUSPENDED = 'suspended'; + public const STATUS_IN_PROCESS = 'in_process'; /** * Gets allowable values of the enum @@ -350,61 +395,64 @@ public function getStatusAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['subject'] = isset($data['subject']) ? $data['subject'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['scheduledAt'] = isset($data['scheduledAt']) ? $data['scheduledAt'] : null; - $this->container['abTesting'] = isset($data['abTesting']) ? $data['abTesting'] : null; - $this->container['subjectA'] = isset($data['subjectA']) ? $data['subjectA'] : null; - $this->container['subjectB'] = isset($data['subjectB']) ? $data['subjectB'] : null; - $this->container['splitRule'] = isset($data['splitRule']) ? $data['splitRule'] : null; - $this->container['winnerCriteria'] = isset($data['winnerCriteria']) ? $data['winnerCriteria'] : null; - $this->container['winnerDelay'] = isset($data['winnerDelay']) ? $data['winnerDelay'] : null; - $this->container['sendAtBestTime'] = isset($data['sendAtBestTime']) ? $data['sendAtBestTime'] : null; - $this->container['testSent'] = isset($data['testSent']) ? $data['testSent'] : null; - $this->container['header'] = isset($data['header']) ? $data['header'] : null; - $this->container['footer'] = isset($data['footer']) ? $data['footer'] : null; - $this->container['sender'] = isset($data['sender']) ? $data['sender'] : null; - $this->container['replyTo'] = isset($data['replyTo']) ? $data['replyTo'] : null; - $this->container['toField'] = isset($data['toField']) ? $data['toField'] : null; - $this->container['htmlContent'] = isset($data['htmlContent']) ? $data['htmlContent'] : null; - $this->container['shareLink'] = isset($data['shareLink']) ? $data['shareLink'] : null; - $this->container['tag'] = isset($data['tag']) ? $data['tag'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['modifiedAt'] = isset($data['modifiedAt']) ? $data['modifiedAt'] : null; - $this->container['inlineImageActivation'] = isset($data['inlineImageActivation']) ? $data['inlineImageActivation'] : null; - $this->container['mirrorActive'] = isset($data['mirrorActive']) ? $data['mirrorActive'] : null; - $this->container['recurring'] = isset($data['recurring']) ? $data['recurring'] : null; - $this->container['sentDate'] = isset($data['sentDate']) ? $data['sentDate'] : null; - $this->container['returnBounce'] = isset($data['returnBounce']) ? $data['returnBounce'] : null; - $this->container['recipients'] = isset($data['recipients']) ? $data['recipients'] : null; - $this->container['statistics'] = isset($data['statistics']) ? $data['statistics'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('testSent', $data ?? [], null); + $this->setIfExists('header', $data ?? [], null); + $this->setIfExists('footer', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('replyTo', $data ?? [], null); + $this->setIfExists('htmlContent', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('modifiedAt', $data ?? [], null); + $this->setIfExists('recipients', $data ?? [], null); + $this->setIfExists('statistics', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('previewText', $data ?? [], null); + $this->setIfExists('scheduledAt', $data ?? [], null); + $this->setIfExists('abTesting', $data ?? [], null); + $this->setIfExists('subjectA', $data ?? [], null); + $this->setIfExists('subjectB', $data ?? [], null); + $this->setIfExists('splitRule', $data ?? [], null); + $this->setIfExists('winnerCriteria', $data ?? [], null); + $this->setIfExists('winnerDelay', $data ?? [], null); + $this->setIfExists('sendAtBestTime', $data ?? [], null); + $this->setIfExists('utmCampaignValue', $data ?? [], null); + $this->setIfExists('utmSource', $data ?? [], null); + $this->setIfExists('utmMedium', $data ?? [], null); + $this->setIfExists('utmIDActive', $data ?? [], null); + $this->setIfExists('toField', $data ?? [], null); + $this->setIfExists('shareLink', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('inlineImageActivation', $data ?? [], null); + $this->setIfExists('mirrorActive', $data ?? [], null); + $this->setIfExists('recurring', $data ?? [], null); + $this->setIfExists('sentDate', $data ?? [], null); + $this->setIfExists('returnBounce', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -420,7 +468,8 @@ public function listInvalidProperties() $allowedValues = $this->getTypeAllowableValues(); if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], implode("', '", $allowedValues) ); } @@ -431,7 +480,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -469,24 +519,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -498,8 +536,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -510,7 +551,7 @@ public function setId($id) * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -522,43 +563,22 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; } - /** - * Gets subject - * - * @return string - */ - public function getSubject() - { - return $this->container['subject']; - } - - /** - * Sets subject - * - * @param string $subject Subject of the campaign. Only available if `abTesting` flag of the campaign is `false` - * - * @return $this - */ - public function setSubject($subject) - { - $this->container['subject'] = $subject; - - return $this; - } - /** * Gets type * * @return string */ - public function getType() + public function getType(): string { return $this->container['type']; } @@ -570,13 +590,17 @@ public function getType() * * @return $this */ - public function setType($type) + public function setType(string $type): static { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $allowedValues = $this->getTypeAllowableValues(); if (!in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'type', must be one of '%s'", + "Invalid value '%s' for 'type', must be one of '%s'", + $type, implode("', '", $allowedValues) ) ); @@ -591,7 +615,7 @@ public function setType($type) * * @return string */ - public function getStatus() + public function getStatus(): string { return $this->container['status']; } @@ -603,13 +627,17 @@ public function getStatus() * * @return $this */ - public function setStatus($status) + public function setStatus(string $status): static { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); if (!in_array($status, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -620,700 +648,867 @@ public function setStatus($status) } /** - * Gets scheduledAt + * Gets testSent * - * @return string + * @return bool */ - public function getScheduledAt() + public function getTestSent(): bool { - return $this->container['scheduledAt']; + return $this->container['testSent']; } /** - * Sets scheduledAt + * Sets testSent * - * @param string $scheduledAt UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) + * @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 setScheduledAt($scheduledAt) + public function setTestSent(bool $testSent): static { - $this->container['scheduledAt'] = $scheduledAt; + if (is_null($testSent)) { + throw new InvalidArgumentException('non-nullable testSent cannot be null'); + } + $this->container['testSent'] = $testSent; return $this; } /** - * Gets abTesting + * Gets header * - * @return bool + * @return string */ - public function getAbTesting() + public function getHeader(): string { - return $this->container['abTesting']; + return $this->container['header']; } /** - * Sets abTesting + * Sets header * - * @param bool $abTesting Status of A/B Test for the campaign. abTesting = false means it is disabled, & abTesting = true means it is enabled. + * @param string $header Header of the campaign * * @return $this */ - public function setAbTesting($abTesting) + public function setHeader(string $header): static { - $this->container['abTesting'] = $abTesting; + if (is_null($header)) { + throw new InvalidArgumentException('non-nullable header cannot be null'); + } + $this->container['header'] = $header; return $this; } /** - * Gets subjectA + * Gets footer * * @return string */ - public function getSubjectA() + public function getFooter(): string { - return $this->container['subjectA']; + return $this->container['footer']; } /** - * Sets subjectA + * Sets footer * - * @param string $subjectA Subject A of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` + * @param string $footer Footer of the campaign * * @return $this */ - public function setSubjectA($subjectA) + public function setFooter(string $footer): static { - $this->container['subjectA'] = $subjectA; + if (is_null($footer)) { + throw new InvalidArgumentException('non-nullable footer cannot be null'); + } + $this->container['footer'] = $footer; return $this; } /** - * Gets subjectB + * Gets sender + * + * @return \Brevo\Client\Models\GetExtendedCampaignOverviewAllOfSender + */ + public function getSender(): \Brevo\Client\Models\GetExtendedCampaignOverviewAllOfSender + { + return $this->container['sender']; + } + + /** + * Sets sender + * + * @param \Brevo\Client\Models\GetExtendedCampaignOverviewAllOfSender $sender sender + * + * @return $this + */ + public function setSender(\Brevo\Client\Models\GetExtendedCampaignOverviewAllOfSender $sender): static + { + if (is_null($sender)) { + throw new InvalidArgumentException('non-nullable sender cannot be null'); + } + $this->container['sender'] = $sender; + + return $this; + } + + /** + * Gets replyTo * * @return string */ - public function getSubjectB() + public function getReplyTo(): string { - return $this->container['subjectB']; + return $this->container['replyTo']; } /** - * Sets subjectB + * Sets replyTo * - * @param string $subjectB Subject B of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` + * @param string $replyTo Email defined as the \"Reply to\" of the campaign * * @return $this */ - public function setSubjectB($subjectB) + public function setReplyTo(string $replyTo): static { - $this->container['subjectB'] = $subjectB; + if (is_null($replyTo)) { + throw new InvalidArgumentException('non-nullable replyTo cannot be null'); + } + $this->container['replyTo'] = $replyTo; return $this; } /** - * Gets splitRule + * Gets htmlContent * - * @return int + * @return string */ - public function getSplitRule() + public function getHtmlContent(): string { - return $this->container['splitRule']; + return $this->container['htmlContent']; } /** - * Sets splitRule + * Sets htmlContent * - * @param int $splitRule The size of your ab-test groups. Only available if `abTesting` flag of the campaign is `true` + * @param string $htmlContent HTML content of the campaign * * @return $this */ - public function setSplitRule($splitRule) + public function setHtmlContent(string $htmlContent): static { - $this->container['splitRule'] = $splitRule; + if (is_null($htmlContent)) { + throw new InvalidArgumentException('non-nullable htmlContent cannot be null'); + } + $this->container['htmlContent'] = $htmlContent; return $this; } /** - * Gets winnerCriteria + * Gets createdAt * * @return string */ - public function getWinnerCriteria() + public function getCreatedAt(): string { - return $this->container['winnerCriteria']; + return $this->container['createdAt']; } /** - * Sets winnerCriteria + * Sets createdAt * - * @param string $winnerCriteria Criteria for the winning version. Only available if `abTesting` flag of the campaign is `true` + * @param string $createdAt Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) * * @return $this */ - public function setWinnerCriteria($winnerCriteria) + public function setCreatedAt(string $createdAt): static { - $this->container['winnerCriteria'] = $winnerCriteria; + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; return $this; } /** - * Gets winnerDelay + * Gets modifiedAt * - * @return int + * @return string */ - public function getWinnerDelay() + public function getModifiedAt(): string { - return $this->container['winnerDelay']; + return $this->container['modifiedAt']; } /** - * Sets winnerDelay + * Sets modifiedAt * - * @param int $winnerDelay The duration of the test in hours at the end of which the winning version will be sent. Only available if `abTesting` flag of the campaign is `true` + * @param string $modifiedAt UTC date-time of last modification of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) * * @return $this */ - public function setWinnerDelay($winnerDelay) + public function setModifiedAt(string $modifiedAt): static { - $this->container['winnerDelay'] = $winnerDelay; + if (is_null($modifiedAt)) { + throw new InvalidArgumentException('non-nullable modifiedAt cannot be null'); + } + $this->container['modifiedAt'] = $modifiedAt; return $this; } /** - * Gets sendAtBestTime + * Gets recipients * - * @return bool + * @return object */ - public function getSendAtBestTime() + public function getRecipients(): object { - return $this->container['sendAtBestTime']; + return $this->container['recipients']; } /** - * Sets sendAtBestTime + * Sets recipients * - * @param bool $sendAtBestTime It is true if you have chosen to send your campaign at best time, otherwise it is false + * @param object $recipients recipients * * @return $this */ - public function setSendAtBestTime($sendAtBestTime) + public function setRecipients(object $recipients): static { - $this->container['sendAtBestTime'] = $sendAtBestTime; + if (is_null($recipients)) { + throw new InvalidArgumentException('non-nullable recipients cannot be null'); + } + $this->container['recipients'] = $recipients; return $this; } /** - * Gets testSent + * Gets statistics * - * @return bool + * @return object */ - public function getTestSent() + public function getStatistics(): object { - return $this->container['testSent']; + return $this->container['statistics']; } /** - * Sets testSent + * Sets statistics * - * @param bool $testSent Retrieved the status of test email sending. (true=Test email has been sent false=Test email has not been sent) + * @param object $statistics statistics * * @return $this */ - public function setTestSent($testSent) + public function setStatistics(object $statistics): static { - $this->container['testSent'] = $testSent; + if (is_null($statistics)) { + throw new InvalidArgumentException('non-nullable statistics cannot be null'); + } + $this->container['statistics'] = $statistics; return $this; } /** - * Gets header + * Gets subject * - * @return string + * @return string|null */ - public function getHeader() + public function getSubject(): ?string { - return $this->container['header']; + return $this->container['subject']; } /** - * Sets header + * Sets subject * - * @param string $header Header of the campaign + * @param string|null $subject Subject of the campaign. Only available if `abTesting` flag of the campaign is `false` * * @return $this */ - public function setHeader($header) + public function setSubject(?string $subject): static { - $this->container['header'] = $header; + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } + $this->container['subject'] = $subject; return $this; } /** - * Gets footer + * Gets previewText * - * @return string + * @return string|null */ - public function getFooter() + public function getPreviewText(): ?string { - return $this->container['footer']; + return $this->container['previewText']; } /** - * Sets footer + * Sets previewText * - * @param string $footer Footer of the campaign + * @param string|null $previewText Preview text or preheader of the email campaign * * @return $this */ - public function setFooter($footer) + public function setPreviewText(?string $previewText): static { - $this->container['footer'] = $footer; + if (is_null($previewText)) { + throw new InvalidArgumentException('non-nullable previewText cannot be null'); + } + $this->container['previewText'] = $previewText; return $this; } /** - * Gets sender + * Gets scheduledAt * - * @return \Brevo\Client\Models\GetExtendedCampaignOverviewSender + * @return string|null */ - public function getSender() + public function getScheduledAt(): ?string { - return $this->container['sender']; + return $this->container['scheduledAt']; } /** - * Sets sender + * Sets scheduledAt * - * @param \Brevo\Client\Models\GetExtendedCampaignOverviewSender $sender sender + * @param string|null $scheduledAt UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) * * @return $this */ - public function setSender($sender) + public function setScheduledAt(?string $scheduledAt): static { - $this->container['sender'] = $sender; + if (is_null($scheduledAt)) { + throw new InvalidArgumentException('non-nullable scheduledAt cannot be null'); + } + $this->container['scheduledAt'] = $scheduledAt; return $this; } /** - * Gets replyTo + * Gets abTesting * - * @return string + * @return bool|null */ - public function getReplyTo() + public function getAbTesting(): ?bool { - return $this->container['replyTo']; + return $this->container['abTesting']; } /** - * Sets replyTo + * Sets abTesting * - * @param string $replyTo Email defined as the \"Reply to\" of the campaign + * @param bool|null $abTesting Status of A/B Test for the campaign. abTesting = false means it is disabled, & abTesting = true means it is enabled. * * @return $this */ - public function setReplyTo($replyTo) + public function setAbTesting(?bool $abTesting): static { - $this->container['replyTo'] = $replyTo; + if (is_null($abTesting)) { + throw new InvalidArgumentException('non-nullable abTesting cannot be null'); + } + $this->container['abTesting'] = $abTesting; return $this; } /** - * Gets toField + * Gets subjectA * - * @return string + * @return string|null */ - public function getToField() + public function getSubjectA(): ?string { - return $this->container['toField']; + return $this->container['subjectA']; } /** - * Sets toField + * Sets subjectA * - * @param string $toField Customisation of the \"to\" field of the campaign + * @param string|null $subjectA Subject A of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` * * @return $this */ - public function setToField($toField) + public function setSubjectA(?string $subjectA): static { - $this->container['toField'] = $toField; + if (is_null($subjectA)) { + throw new InvalidArgumentException('non-nullable subjectA cannot be null'); + } + $this->container['subjectA'] = $subjectA; return $this; } /** - * Gets htmlContent + * Gets subjectB * - * @return string + * @return string|null */ - public function getHtmlContent() + public function getSubjectB(): ?string { - return $this->container['htmlContent']; + return $this->container['subjectB']; } /** - * Sets htmlContent + * Sets subjectB * - * @param string $htmlContent HTML content of the campaign + * @param string|null $subjectB Subject B of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` * * @return $this */ - public function setHtmlContent($htmlContent) + public function setSubjectB(?string $subjectB): static { - $this->container['htmlContent'] = $htmlContent; + if (is_null($subjectB)) { + throw new InvalidArgumentException('non-nullable subjectB cannot be null'); + } + $this->container['subjectB'] = $subjectB; return $this; } /** - * Gets shareLink + * Gets splitRule * - * @return string + * @return int|null */ - public function getShareLink() + public function getSplitRule(): ?int { - return $this->container['shareLink']; + return $this->container['splitRule']; } /** - * Sets shareLink + * Sets splitRule * - * @param string $shareLink Link to share the campaign on social medias + * @param int|null $splitRule The size of your ab-test groups. Only available if `abTesting` flag of the campaign is `true` * * @return $this */ - public function setShareLink($shareLink) + public function setSplitRule(?int $splitRule): static { - $this->container['shareLink'] = $shareLink; + if (is_null($splitRule)) { + throw new InvalidArgumentException('non-nullable splitRule cannot be null'); + } + $this->container['splitRule'] = $splitRule; return $this; } /** - * Gets tag + * Gets winnerCriteria * - * @return string + * @return string|null */ - public function getTag() + public function getWinnerCriteria(): ?string { - return $this->container['tag']; + return $this->container['winnerCriteria']; } /** - * Sets tag + * Sets winnerCriteria * - * @param string $tag Tag of the campaign + * @param string|null $winnerCriteria Criteria for the winning version. Only available if `abTesting` flag of the campaign is `true` * * @return $this */ - public function setTag($tag) + public function setWinnerCriteria(?string $winnerCriteria): static { - $this->container['tag'] = $tag; + if (is_null($winnerCriteria)) { + throw new InvalidArgumentException('non-nullable winnerCriteria cannot be null'); + } + $this->container['winnerCriteria'] = $winnerCriteria; return $this; } /** - * Gets createdAt + * Gets winnerDelay * - * @return string + * @return int|null */ - public function getCreatedAt() + public function getWinnerDelay(): ?int { - return $this->container['createdAt']; + return $this->container['winnerDelay']; } /** - * Sets createdAt + * Sets winnerDelay * - * @param string $createdAt Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + * @param int|null $winnerDelay The duration of the test in hours at the end of which the winning version will be sent. Only available if `abTesting` flag of the campaign is `true` * * @return $this */ - public function setCreatedAt($createdAt) + public function setWinnerDelay(?int $winnerDelay): static { - $this->container['createdAt'] = $createdAt; + if (is_null($winnerDelay)) { + throw new InvalidArgumentException('non-nullable winnerDelay cannot be null'); + } + $this->container['winnerDelay'] = $winnerDelay; return $this; } /** - * Gets modifiedAt + * Gets sendAtBestTime * - * @return string + * @return bool|null */ - public function getModifiedAt() + public function getSendAtBestTime(): ?bool { - return $this->container['modifiedAt']; + return $this->container['sendAtBestTime']; } /** - * Sets modifiedAt + * Sets sendAtBestTime * - * @param string $modifiedAt UTC date-time of last modification of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + * @param bool|null $sendAtBestTime It is true if you have chosen to send your campaign at best time, otherwise it is false * * @return $this */ - public function setModifiedAt($modifiedAt) + public function setSendAtBestTime(?bool $sendAtBestTime): static { - $this->container['modifiedAt'] = $modifiedAt; + if (is_null($sendAtBestTime)) { + throw new InvalidArgumentException('non-nullable sendAtBestTime cannot be null'); + } + $this->container['sendAtBestTime'] = $sendAtBestTime; return $this; } /** - * Gets inlineImageActivation + * Gets utmCampaignValue * - * @return bool + * @return string|null */ - public function getInlineImageActivation() + public function getUtmCampaignValue(): ?string { - return $this->container['inlineImageActivation']; + return $this->container['utmCampaignValue']; } /** - * Sets inlineImageActivation + * Sets utmCampaignValue * - * @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. + * @param string|null $utmCampaignValue utm parameter associated with campaign * * @return $this */ - public function setInlineImageActivation($inlineImageActivation) + public function setUtmCampaignValue(?string $utmCampaignValue): static { - $this->container['inlineImageActivation'] = $inlineImageActivation; + if (is_null($utmCampaignValue)) { + throw new InvalidArgumentException('non-nullable utmCampaignValue cannot be null'); + } + $this->container['utmCampaignValue'] = $utmCampaignValue; return $this; } /** - * Gets mirrorActive + * Gets utmSource * - * @return bool + * @return string|null */ - public function getMirrorActive() + public function getUtmSource(): ?string { - return $this->container['mirrorActive']; + return $this->container['utmSource']; } /** - * Sets mirrorActive + * Sets utmSource * - * @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 + * @param string|null $utmSource utmSource * * @return $this */ - public function setMirrorActive($mirrorActive) + public function setUtmSource(?string $utmSource): static { - $this->container['mirrorActive'] = $mirrorActive; + if (is_null($utmSource)) { + throw new InvalidArgumentException('non-nullable utmSource cannot be null'); + } + $this->container['utmSource'] = $utmSource; return $this; } /** - * Gets recurring + * Gets utmMedium * - * @return bool + * @return string|null */ - public function getRecurring() + public function getUtmMedium(): ?string { - return $this->container['recurring']; + return $this->container['utmMedium']; } /** - * Sets recurring + * Sets utmMedium * - * @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 + * @param string|null $utmMedium utmMedium * * @return $this */ - public function setRecurring($recurring) + public function setUtmMedium(?string $utmMedium): static { - $this->container['recurring'] = $recurring; + if (is_null($utmMedium)) { + throw new InvalidArgumentException('non-nullable utmMedium cannot be null'); + } + $this->container['utmMedium'] = $utmMedium; return $this; } /** - * Gets sentDate + * Gets utmIDActive * - * @return string + * @return bool|null */ - public function getSentDate() + public function getUtmIDActive(): ?bool { - return $this->container['sentDate']; + return $this->container['utmIDActive']; } /** - * Sets sentDate + * Sets utmIDActive * - * @param string $sentDate Sent UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ). Only available if 'status' of the campaign is 'sent' + * @param bool|null $utmIDActive utm id activate * * @return $this */ - public function setSentDate($sentDate) + public function setUtmIDActive(?bool $utmIDActive): static { - $this->container['sentDate'] = $sentDate; + if (is_null($utmIDActive)) { + throw new InvalidArgumentException('non-nullable utmIDActive cannot be null'); + } + $this->container['utmIDActive'] = $utmIDActive; return $this; } /** - * Gets returnBounce + * Gets toField * - * @return int + * @return string|null */ - public function getReturnBounce() + public function getToField(): ?string { - return $this->container['returnBounce']; + return $this->container['toField']; } /** - * Sets returnBounce + * Sets toField * - * @param int $returnBounce Total number of non-delivered campaigns for a particular campaign id. + * @param string|null $toField Customisation of the \"to\" field of the campaign * * @return $this */ - public function setReturnBounce($returnBounce) + public function setToField(?string $toField): static { - $this->container['returnBounce'] = $returnBounce; + if (is_null($toField)) { + throw new InvalidArgumentException('non-nullable toField cannot be null'); + } + $this->container['toField'] = $toField; return $this; } /** - * Gets recipients + * Gets shareLink * - * @return object + * @return string|null */ - public function getRecipients() + public function getShareLink(): ?string { - return $this->container['recipients']; + return $this->container['shareLink']; } /** - * Sets recipients + * Sets shareLink * - * @param object $recipients recipients + * @param string|null $shareLink Link to share the campaign on social medias * * @return $this */ - public function setRecipients($recipients) + public function setShareLink(?string $shareLink): static { - $this->container['recipients'] = $recipients; + if (is_null($shareLink)) { + throw new InvalidArgumentException('non-nullable shareLink cannot be null'); + } + $this->container['shareLink'] = $shareLink; return $this; } /** - * Gets statistics + * Gets tag * - * @return object + * @return string|null */ - public function getStatistics() + public function getTag(): ?string { - return $this->container['statistics']; + return $this->container['tag']; } /** - * Sets statistics + * Sets tag * - * @param object $statistics statistics + * @param string|null $tag Tag of the campaign * * @return $this */ - public function setStatistics($statistics) + public function setTag(?string $tag): static { - $this->container['statistics'] = $statistics; + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } + $this->container['tag'] = $tag; return $this; } + + /** + * Gets inlineImageActivation + * + * @return bool|null + */ + public function getInlineImageActivation(): ?bool + { + return $this->container['inlineImageActivation']; + } + /** - * Returns true if offset exists. False otherwise. + * Sets inlineImageActivation * - * @param integer $offset Offset + * @param bool|null $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(?bool $inlineImageActivation): static + { + if (is_null($inlineImageActivation)) { + throw new InvalidArgumentException('non-nullable inlineImageActivation cannot be null'); + } + $this->container['inlineImageActivation'] = $inlineImageActivation; + + return $this; + } + + /** + * Gets mirrorActive * - * @return boolean + * @return bool|null */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) + public function getMirrorActive(): ?bool { - return isset($this->container[$offset]); + return $this->container['mirrorActive']; } /** - * Gets offset. + * Sets mirrorActive * - * @param integer $offset Offset + * @param bool|null $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 mixed + * @return $this + */ + public function setMirrorActive(?bool $mirrorActive): static + { + if (is_null($mirrorActive)) { + throw new InvalidArgumentException('non-nullable mirrorActive cannot be null'); + } + $this->container['mirrorActive'] = $mirrorActive; + + return $this; + } + + /** + * Gets recurring + * + * @return bool|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function getRecurring(): ?bool { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container['recurring']; } /** - * Sets value based on offset. + * Sets recurring * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param bool|null $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 void + * @return $this */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function setRecurring(?bool $recurring): static { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; + if (is_null($recurring)) { + throw new InvalidArgumentException('non-nullable recurring cannot be null'); } + $this->container['recurring'] = $recurring; + + return $this; + } + + /** + * Gets sentDate + * + * @return string|null + */ + public function getSentDate(): ?string + { + return $this->container['sentDate']; } /** - * Unsets offset. + * Sets sentDate * - * @param integer $offset Offset + * @param string|null $sentDate Sent UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ). Only available if 'status' of the campaign is 'sent' * - * @return void + * @return $this */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) + public function setSentDate(?string $sentDate): static { - unset($this->container[$offset]); + if (is_null($sentDate)) { + throw new InvalidArgumentException('non-nullable sentDate cannot be null'); + } + $this->container['sentDate'] = $sentDate; + + return $this; } /** - * Gets the string presentation of the object + * Gets returnBounce * - * @return string + * @return int|null */ - public function __toString() + public function getReturnBounce(): ?int { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + return $this->container['returnBounce']; + } + + /** + * Sets returnBounce + * + * @param int|null $returnBounce Total number of non-delivered campaigns for a particular campaign id. + * + * @return $this + */ + public function setReturnBounce(?int $returnBounce): static + { + if (is_null($returnBounce)) { + throw new InvalidArgumentException('non-nullable returnBounce cannot be null'); } + $this->container['returnBounce'] = $returnBounce; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/GetEmailCampaigns.php b/lib/Models/GetEmailCampaigns.php index 004c07a..25e49ff 100644 --- a/lib/Models/GetEmailCampaigns.php +++ b/lib/Models/GetEmailCampaigns.php @@ -2,102 +2,101 @@ /** * GetEmailCampaigns * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetEmailCampaigns Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetEmailCampaigns implements ModelInterface, ArrayAccess +class GetEmailCampaigns extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getEmailCampaigns'; + protected static string $openAPIModelName = 'getEmailCampaigns'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'campaigns' => 'object[]', + protected static array $openAPITypes = [ + 'campaigns' => '\Brevo\Client\Models\GetEmailCampaignsCampaignsInner[]', 'count' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'campaigns' => null, 'count' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'campaigns' => false, + 'count' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'campaigns' => 'campaigns', 'count' => 'count' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'campaigns' => 'setCampaigns', 'count' => 'setCount' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'campaigns' => 'getCampaigns', 'count' => 'getCount' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +145,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['campaigns'] = isset($data['campaigns']) ? $data['campaigns'] : null; - $this->container['count'] = isset($data['count']) ? $data['count'] : null; + $this->setIfExists('campaigns', $data ?? [], null); + $this->setIfExists('count', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets campaigns * - * @return object[] + * @return \Brevo\Client\Models\GetEmailCampaignsCampaignsInner[]|null */ - public function getCampaigns() + public function getCampaigns(): ?array { return $this->container['campaigns']; } @@ -223,12 +196,15 @@ public function getCampaigns() /** * Sets campaigns * - * @param object[] $campaigns campaigns + * @param \Brevo\Client\Models\GetEmailCampaignsCampaignsInner[]|null $campaigns campaigns * * @return $this */ - public function setCampaigns($campaigns) + public function setCampaigns(?array $campaigns): static { + if (is_null($campaigns)) { + throw new InvalidArgumentException('non-nullable campaigns cannot be null'); + } $this->container['campaigns'] = $campaigns; return $this; @@ -237,9 +213,9 @@ public function setCampaigns($campaigns) /** * Gets count * - * @return int + * @return int|null */ - public function getCount() + public function getCount(): ?int { return $this->container['count']; } @@ -247,89 +223,19 @@ public function getCount() /** * Sets count * - * @param int $count Number of Email campaigns retrieved + * @param int|null $count Number of Email campaigns retrieved * * @return $this */ - public function setCount($count) + public function setCount(?int $count): static { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } $this->container['count'] = $count; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetEmailCampaignsCampaignsInner.php b/lib/Models/GetEmailCampaignsCampaignsInner.php new file mode 100644 index 0000000..d8074db --- /dev/null +++ b/lib/Models/GetEmailCampaignsCampaignsInner.php @@ -0,0 +1,1515 @@ + + */ +class GetEmailCampaignsCampaignsInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getEmailCampaigns_campaigns_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'name' => 'string', + 'type' => 'string', + 'status' => 'string', + 'testSent' => 'bool', + 'header' => 'string', + 'footer' => 'string', + 'sender' => '\Brevo\Client\Models\GetExtendedCampaignOverviewAllOfSender', + 'replyTo' => 'string', + 'htmlContent' => 'string', + 'createdAt' => 'string', + 'modifiedAt' => 'string', + 'recipients' => '\Brevo\Client\Models\GetCampaignRecipients', + 'statistics' => '\Brevo\Client\Models\GetExtendedCampaignStats', + 'subject' => 'string', + 'previewText' => 'string', + 'scheduledAt' => 'string', + 'abTesting' => 'bool', + 'subjectA' => 'string', + 'subjectB' => 'string', + 'splitRule' => 'int', + 'winnerCriteria' => 'string', + 'winnerDelay' => 'int', + 'sendAtBestTime' => 'bool', + 'utmCampaignValue' => 'string', + 'utmSource' => 'string', + 'utmMedium' => 'string', + 'utmIDActive' => 'bool', + 'toField' => 'string', + 'shareLink' => 'string', + 'tag' => 'string', + 'inlineImageActivation' => 'bool', + 'mirrorActive' => 'bool', + 'recurring' => 'bool', + 'sentDate' => 'string', + 'returnBounce' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'int64', + 'name' => null, + 'type' => null, + 'status' => null, + 'testSent' => null, + 'header' => null, + 'footer' => null, + 'sender' => null, + 'replyTo' => 'email', + 'htmlContent' => null, + 'createdAt' => null, + 'modifiedAt' => null, + 'recipients' => null, + 'statistics' => null, + 'subject' => null, + 'previewText' => null, + 'scheduledAt' => null, + 'abTesting' => null, + 'subjectA' => null, + 'subjectB' => null, + 'splitRule' => null, + 'winnerCriteria' => null, + 'winnerDelay' => null, + 'sendAtBestTime' => null, + 'utmCampaignValue' => null, + 'utmSource' => null, + 'utmMedium' => null, + 'utmIDActive' => null, + 'toField' => null, + 'shareLink' => 'url', + 'tag' => null, + 'inlineImageActivation' => null, + 'mirrorActive' => null, + 'recurring' => null, + 'sentDate' => null, + 'returnBounce' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'type' => false, + 'status' => false, + 'testSent' => false, + 'header' => false, + 'footer' => false, + 'sender' => false, + 'replyTo' => false, + 'htmlContent' => false, + 'createdAt' => false, + 'modifiedAt' => false, + 'recipients' => false, + 'statistics' => false, + 'subject' => false, + 'previewText' => false, + 'scheduledAt' => false, + 'abTesting' => false, + 'subjectA' => false, + 'subjectB' => false, + 'splitRule' => false, + 'winnerCriteria' => false, + 'winnerDelay' => false, + 'sendAtBestTime' => false, + 'utmCampaignValue' => false, + 'utmSource' => false, + 'utmMedium' => false, + 'utmIDActive' => false, + 'toField' => false, + 'shareLink' => false, + 'tag' => false, + 'inlineImageActivation' => false, + 'mirrorActive' => false, + 'recurring' => false, + 'sentDate' => false, + 'returnBounce' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'type' => 'type', + 'status' => 'status', + 'testSent' => 'testSent', + 'header' => 'header', + 'footer' => 'footer', + 'sender' => 'sender', + 'replyTo' => 'replyTo', + 'htmlContent' => 'htmlContent', + 'createdAt' => 'createdAt', + 'modifiedAt' => 'modifiedAt', + 'recipients' => 'recipients', + 'statistics' => 'statistics', + 'subject' => 'subject', + 'previewText' => 'previewText', + 'scheduledAt' => 'scheduledAt', + 'abTesting' => 'abTesting', + 'subjectA' => 'subjectA', + 'subjectB' => 'subjectB', + 'splitRule' => 'splitRule', + 'winnerCriteria' => 'winnerCriteria', + 'winnerDelay' => 'winnerDelay', + 'sendAtBestTime' => 'sendAtBestTime', + 'utmCampaignValue' => 'utmCampaignValue', + 'utmSource' => 'utmSource', + 'utmMedium' => 'utmMedium', + 'utmIDActive' => 'utmIDActive', + 'toField' => 'toField', + 'shareLink' => 'shareLink', + 'tag' => 'tag', + 'inlineImageActivation' => 'inlineImageActivation', + 'mirrorActive' => 'mirrorActive', + 'recurring' => 'recurring', + 'sentDate' => 'sentDate', + 'returnBounce' => 'returnBounce' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'type' => 'setType', + 'status' => 'setStatus', + 'testSent' => 'setTestSent', + 'header' => 'setHeader', + 'footer' => 'setFooter', + 'sender' => 'setSender', + 'replyTo' => 'setReplyTo', + 'htmlContent' => 'setHtmlContent', + 'createdAt' => 'setCreatedAt', + 'modifiedAt' => 'setModifiedAt', + 'recipients' => 'setRecipients', + 'statistics' => 'setStatistics', + 'subject' => 'setSubject', + 'previewText' => 'setPreviewText', + 'scheduledAt' => 'setScheduledAt', + 'abTesting' => 'setAbTesting', + 'subjectA' => 'setSubjectA', + 'subjectB' => 'setSubjectB', + 'splitRule' => 'setSplitRule', + 'winnerCriteria' => 'setWinnerCriteria', + 'winnerDelay' => 'setWinnerDelay', + 'sendAtBestTime' => 'setSendAtBestTime', + 'utmCampaignValue' => 'setUtmCampaignValue', + 'utmSource' => 'setUtmSource', + 'utmMedium' => 'setUtmMedium', + 'utmIDActive' => 'setUtmIDActive', + 'toField' => 'setToField', + 'shareLink' => 'setShareLink', + 'tag' => 'setTag', + 'inlineImageActivation' => 'setInlineImageActivation', + 'mirrorActive' => 'setMirrorActive', + 'recurring' => 'setRecurring', + 'sentDate' => 'setSentDate', + 'returnBounce' => 'setReturnBounce' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'type' => 'getType', + 'status' => 'getStatus', + 'testSent' => 'getTestSent', + 'header' => 'getHeader', + 'footer' => 'getFooter', + 'sender' => 'getSender', + 'replyTo' => 'getReplyTo', + 'htmlContent' => 'getHtmlContent', + 'createdAt' => 'getCreatedAt', + 'modifiedAt' => 'getModifiedAt', + 'recipients' => 'getRecipients', + 'statistics' => 'getStatistics', + 'subject' => 'getSubject', + 'previewText' => 'getPreviewText', + 'scheduledAt' => 'getScheduledAt', + 'abTesting' => 'getAbTesting', + 'subjectA' => 'getSubjectA', + 'subjectB' => 'getSubjectB', + 'splitRule' => 'getSplitRule', + 'winnerCriteria' => 'getWinnerCriteria', + 'winnerDelay' => 'getWinnerDelay', + 'sendAtBestTime' => 'getSendAtBestTime', + 'utmCampaignValue' => 'getUtmCampaignValue', + 'utmSource' => 'getUtmSource', + 'utmMedium' => 'getUtmMedium', + 'utmIDActive' => 'getUtmIDActive', + 'toField' => 'getToField', + 'shareLink' => 'getShareLink', + 'tag' => 'getTag', + 'inlineImageActivation' => 'getInlineImageActivation', + 'mirrorActive' => 'getMirrorActive', + 'recurring' => 'getRecurring', + 'sentDate' => 'getSentDate', + 'returnBounce' => 'getReturnBounce' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const TYPE_CLASSIC = 'classic'; + public const TYPE_TRIGGER = 'trigger'; + public const STATUS_DRAFT = 'draft'; + public const STATUS_SENT = 'sent'; + public const STATUS_ARCHIVE = 'archive'; + public const STATUS_QUEUED = 'queued'; + public const STATUS_SUSPENDED = 'suspended'; + public const STATUS_IN_PROCESS = 'in_process'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_CLASSIC, + self::TYPE_TRIGGER, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_DRAFT, + self::STATUS_SENT, + self::STATUS_ARCHIVE, + self::STATUS_QUEUED, + self::STATUS_SUSPENDED, + self::STATUS_IN_PROCESS, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('testSent', $data ?? [], null); + $this->setIfExists('header', $data ?? [], null); + $this->setIfExists('footer', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('replyTo', $data ?? [], null); + $this->setIfExists('htmlContent', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('modifiedAt', $data ?? [], null); + $this->setIfExists('recipients', $data ?? [], null); + $this->setIfExists('statistics', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('previewText', $data ?? [], null); + $this->setIfExists('scheduledAt', $data ?? [], null); + $this->setIfExists('abTesting', $data ?? [], null); + $this->setIfExists('subjectA', $data ?? [], null); + $this->setIfExists('subjectB', $data ?? [], null); + $this->setIfExists('splitRule', $data ?? [], null); + $this->setIfExists('winnerCriteria', $data ?? [], null); + $this->setIfExists('winnerDelay', $data ?? [], null); + $this->setIfExists('sendAtBestTime', $data ?? [], null); + $this->setIfExists('utmCampaignValue', $data ?? [], null); + $this->setIfExists('utmSource', $data ?? [], null); + $this->setIfExists('utmMedium', $data ?? [], null); + $this->setIfExists('utmIDActive', $data ?? [], null); + $this->setIfExists('toField', $data ?? [], null); + $this->setIfExists('shareLink', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('inlineImageActivation', $data ?? [], null); + $this->setIfExists('mirrorActive', $data ?? [], null); + $this->setIfExists('recurring', $data ?? [], null); + $this->setIfExists('sentDate', $data ?? [], null); + $this->setIfExists('returnBounce', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['testSent'] === null) { + $invalidProperties[] = "'testSent' can't be null"; + } + if ($this->container['header'] === null) { + $invalidProperties[] = "'header' can't be null"; + } + if ($this->container['footer'] === null) { + $invalidProperties[] = "'footer' can't be null"; + } + if ($this->container['sender'] === null) { + $invalidProperties[] = "'sender' can't be null"; + } + if ($this->container['replyTo'] === null) { + $invalidProperties[] = "'replyTo' can't be null"; + } + if ($this->container['htmlContent'] === null) { + $invalidProperties[] = "'htmlContent' can't be null"; + } + if ($this->container['createdAt'] === null) { + $invalidProperties[] = "'createdAt' can't be null"; + } + if ($this->container['modifiedAt'] === null) { + $invalidProperties[] = "'modifiedAt' can't be null"; + } + if ($this->container['recipients'] === null) { + $invalidProperties[] = "'recipients' can't be null"; + } + if ($this->container['statistics'] === null) { + $invalidProperties[] = "'statistics' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets id + * + * @return int + */ + public function getId(): int + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id ID of the campaign + * + * @return $this + */ + public function setId(int $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Name of the campaign + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets type + * + * @return string + */ + public function getType(): string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type Type of campaign + * + * @return $this + */ + public function setType(string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus(): string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status Status of the campaign + * + * @return $this + */ + public function setStatus(string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets testSent + * + * @return bool + */ + public function getTestSent(): bool + { + return $this->container['testSent']; + } + + /** + * 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(bool $testSent): static + { + if (is_null($testSent)) { + throw new InvalidArgumentException('non-nullable testSent cannot be null'); + } + $this->container['testSent'] = $testSent; + + return $this; + } + + /** + * Gets header + * + * @return string + */ + public function getHeader(): string + { + return $this->container['header']; + } + + /** + * Sets header + * + * @param string $header Header of the campaign + * + * @return $this + */ + public function setHeader(string $header): static + { + if (is_null($header)) { + throw new InvalidArgumentException('non-nullable header cannot be null'); + } + $this->container['header'] = $header; + + return $this; + } + + /** + * Gets footer + * + * @return string + */ + public function getFooter(): string + { + return $this->container['footer']; + } + + /** + * Sets footer + * + * @param string $footer Footer of the campaign + * + * @return $this + */ + public function setFooter(string $footer): static + { + if (is_null($footer)) { + throw new InvalidArgumentException('non-nullable footer cannot be null'); + } + $this->container['footer'] = $footer; + + return $this; + } + + /** + * Gets sender + * + * @return \Brevo\Client\Models\GetExtendedCampaignOverviewAllOfSender + */ + public function getSender(): \Brevo\Client\Models\GetExtendedCampaignOverviewAllOfSender + { + return $this->container['sender']; + } + + /** + * Sets sender + * + * @param \Brevo\Client\Models\GetExtendedCampaignOverviewAllOfSender $sender sender + * + * @return $this + */ + public function setSender(\Brevo\Client\Models\GetExtendedCampaignOverviewAllOfSender $sender): static + { + if (is_null($sender)) { + throw new InvalidArgumentException('non-nullable sender cannot be null'); + } + $this->container['sender'] = $sender; + + return $this; + } + + /** + * Gets replyTo + * + * @return string + */ + public function getReplyTo(): string + { + return $this->container['replyTo']; + } + + /** + * Sets replyTo + * + * @param string $replyTo Email defined as the \"Reply to\" of the campaign + * + * @return $this + */ + public function setReplyTo(string $replyTo): static + { + if (is_null($replyTo)) { + throw new InvalidArgumentException('non-nullable replyTo cannot be null'); + } + $this->container['replyTo'] = $replyTo; + + return $this; + } + + /** + * Gets htmlContent + * + * @return string + */ + public function getHtmlContent(): string + { + return $this->container['htmlContent']; + } + + /** + * Sets htmlContent + * + * @param string $htmlContent HTML content of the campaign + * + * @return $this + */ + public function setHtmlContent(string $htmlContent): static + { + if (is_null($htmlContent)) { + throw new InvalidArgumentException('non-nullable htmlContent cannot be null'); + } + $this->container['htmlContent'] = $htmlContent; + + return $this; + } + + /** + * Gets createdAt + * + * @return string + */ + public function getCreatedAt(): string + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param string $createdAt Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + * + * @return $this + */ + public function setCreatedAt(string $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets modifiedAt + * + * @return string + */ + public function getModifiedAt(): string + { + return $this->container['modifiedAt']; + } + + /** + * Sets modifiedAt + * + * @param string $modifiedAt UTC date-time of last modification of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + * + * @return $this + */ + public function setModifiedAt(string $modifiedAt): static + { + if (is_null($modifiedAt)) { + throw new InvalidArgumentException('non-nullable modifiedAt cannot be null'); + } + $this->container['modifiedAt'] = $modifiedAt; + + return $this; + } + + /** + * Gets recipients + * + * @return \Brevo\Client\Models\GetCampaignRecipients + */ + public function getRecipients(): \Brevo\Client\Models\GetCampaignRecipients + { + return $this->container['recipients']; + } + + /** + * Sets recipients + * + * @param \Brevo\Client\Models\GetCampaignRecipients $recipients recipients + * + * @return $this + */ + public function setRecipients(\Brevo\Client\Models\GetCampaignRecipients $recipients): static + { + if (is_null($recipients)) { + throw new InvalidArgumentException('non-nullable recipients cannot be null'); + } + $this->container['recipients'] = $recipients; + + return $this; + } + + /** + * Gets statistics + * + * @return \Brevo\Client\Models\GetExtendedCampaignStats + */ + public function getStatistics(): \Brevo\Client\Models\GetExtendedCampaignStats + { + return $this->container['statistics']; + } + + /** + * Sets statistics + * + * @param \Brevo\Client\Models\GetExtendedCampaignStats $statistics statistics + * + * @return $this + */ + public function setStatistics(\Brevo\Client\Models\GetExtendedCampaignStats $statistics): static + { + if (is_null($statistics)) { + throw new InvalidArgumentException('non-nullable statistics cannot be null'); + } + $this->container['statistics'] = $statistics; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject(): ?string + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject Subject of the campaign. Only available if `abTesting` flag of the campaign is `false` + * + * @return $this + */ + public function setSubject(?string $subject): static + { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets previewText + * + * @return string|null + */ + public function getPreviewText(): ?string + { + return $this->container['previewText']; + } + + /** + * Sets previewText + * + * @param string|null $previewText Preview text or preheader of the email campaign + * + * @return $this + */ + public function setPreviewText(?string $previewText): static + { + if (is_null($previewText)) { + throw new InvalidArgumentException('non-nullable previewText cannot be null'); + } + $this->container['previewText'] = $previewText; + + return $this; + } + + /** + * Gets scheduledAt + * + * @return string|null + */ + public function getScheduledAt(): ?string + { + return $this->container['scheduledAt']; + } + + /** + * Sets scheduledAt + * + * @param string|null $scheduledAt UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) + * + * @return $this + */ + public function setScheduledAt(?string $scheduledAt): static + { + if (is_null($scheduledAt)) { + throw new InvalidArgumentException('non-nullable scheduledAt cannot be null'); + } + $this->container['scheduledAt'] = $scheduledAt; + + return $this; + } + + /** + * Gets abTesting + * + * @return bool|null + */ + public function getAbTesting(): ?bool + { + return $this->container['abTesting']; + } + + /** + * Sets abTesting + * + * @param bool|null $abTesting Status of A/B Test for the campaign. abTesting = false means it is disabled, & abTesting = true means it is enabled. + * + * @return $this + */ + public function setAbTesting(?bool $abTesting): static + { + if (is_null($abTesting)) { + throw new InvalidArgumentException('non-nullable abTesting cannot be null'); + } + $this->container['abTesting'] = $abTesting; + + return $this; + } + + /** + * Gets subjectA + * + * @return string|null + */ + public function getSubjectA(): ?string + { + return $this->container['subjectA']; + } + + /** + * Sets subjectA + * + * @param string|null $subjectA Subject A of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` + * + * @return $this + */ + public function setSubjectA(?string $subjectA): static + { + if (is_null($subjectA)) { + throw new InvalidArgumentException('non-nullable subjectA cannot be null'); + } + $this->container['subjectA'] = $subjectA; + + return $this; + } + + /** + * Gets subjectB + * + * @return string|null + */ + public function getSubjectB(): ?string + { + return $this->container['subjectB']; + } + + /** + * Sets subjectB + * + * @param string|null $subjectB Subject B of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` + * + * @return $this + */ + public function setSubjectB(?string $subjectB): static + { + if (is_null($subjectB)) { + throw new InvalidArgumentException('non-nullable subjectB cannot be null'); + } + $this->container['subjectB'] = $subjectB; + + return $this; + } + + /** + * Gets splitRule + * + * @return int|null + */ + public function getSplitRule(): ?int + { + return $this->container['splitRule']; + } + + /** + * Sets splitRule + * + * @param int|null $splitRule The size of your ab-test groups. Only available if `abTesting` flag of the campaign is `true` + * + * @return $this + */ + public function setSplitRule(?int $splitRule): static + { + if (is_null($splitRule)) { + throw new InvalidArgumentException('non-nullable splitRule cannot be null'); + } + $this->container['splitRule'] = $splitRule; + + return $this; + } + + /** + * Gets winnerCriteria + * + * @return string|null + */ + public function getWinnerCriteria(): ?string + { + return $this->container['winnerCriteria']; + } + + /** + * Sets winnerCriteria + * + * @param string|null $winnerCriteria Criteria for the winning version. Only available if `abTesting` flag of the campaign is `true` + * + * @return $this + */ + public function setWinnerCriteria(?string $winnerCriteria): static + { + if (is_null($winnerCriteria)) { + throw new InvalidArgumentException('non-nullable winnerCriteria cannot be null'); + } + $this->container['winnerCriteria'] = $winnerCriteria; + + return $this; + } + + /** + * Gets winnerDelay + * + * @return int|null + */ + public function getWinnerDelay(): ?int + { + return $this->container['winnerDelay']; + } + + /** + * Sets winnerDelay + * + * @param int|null $winnerDelay The duration of the test in hours at the end of which the winning version will be sent. Only available if `abTesting` flag of the campaign is `true` + * + * @return $this + */ + public function setWinnerDelay(?int $winnerDelay): static + { + if (is_null($winnerDelay)) { + throw new InvalidArgumentException('non-nullable winnerDelay cannot be null'); + } + $this->container['winnerDelay'] = $winnerDelay; + + return $this; + } + + /** + * Gets sendAtBestTime + * + * @return bool|null + */ + public function getSendAtBestTime(): ?bool + { + return $this->container['sendAtBestTime']; + } + + /** + * Sets sendAtBestTime + * + * @param bool|null $sendAtBestTime It is true if you have chosen to send your campaign at best time, otherwise it is false + * + * @return $this + */ + public function setSendAtBestTime(?bool $sendAtBestTime): static + { + if (is_null($sendAtBestTime)) { + throw new InvalidArgumentException('non-nullable sendAtBestTime cannot be null'); + } + $this->container['sendAtBestTime'] = $sendAtBestTime; + + return $this; + } + + /** + * Gets utmCampaignValue + * + * @return string|null + */ + public function getUtmCampaignValue(): ?string + { + return $this->container['utmCampaignValue']; + } + + /** + * Sets utmCampaignValue + * + * @param string|null $utmCampaignValue utm parameter associated with campaign + * + * @return $this + */ + public function setUtmCampaignValue(?string $utmCampaignValue): static + { + if (is_null($utmCampaignValue)) { + throw new InvalidArgumentException('non-nullable utmCampaignValue cannot be null'); + } + $this->container['utmCampaignValue'] = $utmCampaignValue; + + return $this; + } + + /** + * Gets utmSource + * + * @return string|null + */ + public function getUtmSource(): ?string + { + return $this->container['utmSource']; + } + + /** + * Sets utmSource + * + * @param string|null $utmSource utmSource + * + * @return $this + */ + public function setUtmSource(?string $utmSource): static + { + if (is_null($utmSource)) { + throw new InvalidArgumentException('non-nullable utmSource cannot be null'); + } + $this->container['utmSource'] = $utmSource; + + return $this; + } + + /** + * Gets utmMedium + * + * @return string|null + */ + public function getUtmMedium(): ?string + { + return $this->container['utmMedium']; + } + + /** + * Sets utmMedium + * + * @param string|null $utmMedium utmMedium + * + * @return $this + */ + public function setUtmMedium(?string $utmMedium): static + { + if (is_null($utmMedium)) { + throw new InvalidArgumentException('non-nullable utmMedium cannot be null'); + } + $this->container['utmMedium'] = $utmMedium; + + return $this; + } + + /** + * Gets utmIDActive + * + * @return bool|null + */ + public function getUtmIDActive(): ?bool + { + return $this->container['utmIDActive']; + } + + /** + * Sets utmIDActive + * + * @param bool|null $utmIDActive utm id activate + * + * @return $this + */ + public function setUtmIDActive(?bool $utmIDActive): static + { + if (is_null($utmIDActive)) { + throw new InvalidArgumentException('non-nullable utmIDActive cannot be null'); + } + $this->container['utmIDActive'] = $utmIDActive; + + return $this; + } + + /** + * Gets toField + * + * @return string|null + */ + public function getToField(): ?string + { + return $this->container['toField']; + } + + /** + * Sets toField + * + * @param string|null $toField Customisation of the \"to\" field of the campaign + * + * @return $this + */ + public function setToField(?string $toField): static + { + if (is_null($toField)) { + throw new InvalidArgumentException('non-nullable toField cannot be null'); + } + $this->container['toField'] = $toField; + + return $this; + } + + /** + * Gets shareLink + * + * @return string|null + */ + public function getShareLink(): ?string + { + return $this->container['shareLink']; + } + + /** + * Sets shareLink + * + * @param string|null $shareLink Link to share the campaign on social medias + * + * @return $this + */ + public function setShareLink(?string $shareLink): static + { + if (is_null($shareLink)) { + throw new InvalidArgumentException('non-nullable shareLink cannot be null'); + } + $this->container['shareLink'] = $shareLink; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag Tag of the campaign + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets inlineImageActivation + * + * @return bool|null + */ + public function getInlineImageActivation(): ?bool + { + return $this->container['inlineImageActivation']; + } + + /** + * Sets inlineImageActivation + * + * @param bool|null $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(?bool $inlineImageActivation): static + { + if (is_null($inlineImageActivation)) { + throw new InvalidArgumentException('non-nullable inlineImageActivation cannot be null'); + } + $this->container['inlineImageActivation'] = $inlineImageActivation; + + return $this; + } + + /** + * Gets mirrorActive + * + * @return bool|null + */ + public function getMirrorActive(): ?bool + { + return $this->container['mirrorActive']; + } + + /** + * Sets mirrorActive + * + * @param bool|null $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(?bool $mirrorActive): static + { + if (is_null($mirrorActive)) { + throw new InvalidArgumentException('non-nullable mirrorActive cannot be null'); + } + $this->container['mirrorActive'] = $mirrorActive; + + return $this; + } + + /** + * Gets recurring + * + * @return bool|null + */ + public function getRecurring(): ?bool + { + return $this->container['recurring']; + } + + /** + * Sets recurring + * + * @param bool|null $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(?bool $recurring): static + { + if (is_null($recurring)) { + throw new InvalidArgumentException('non-nullable recurring cannot be null'); + } + $this->container['recurring'] = $recurring; + + return $this; + } + + /** + * Gets sentDate + * + * @return string|null + */ + public function getSentDate(): ?string + { + return $this->container['sentDate']; + } + + /** + * Sets sentDate + * + * @param string|null $sentDate Sent UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ). Only available if 'status' of the campaign is 'sent' + * + * @return $this + */ + public function setSentDate(?string $sentDate): static + { + if (is_null($sentDate)) { + throw new InvalidArgumentException('non-nullable sentDate cannot be null'); + } + $this->container['sentDate'] = $sentDate; + + return $this; + } + + /** + * Gets returnBounce + * + * @return int|null + */ + public function getReturnBounce(): ?int + { + return $this->container['returnBounce']; + } + + /** + * Sets returnBounce + * + * @param int|null $returnBounce Total number of non-delivered campaigns for a particular campaign id. + * + * @return $this + */ + public function setReturnBounce(?int $returnBounce): static + { + if (is_null($returnBounce)) { + throw new InvalidArgumentException('non-nullable returnBounce cannot be null'); + } + $this->container['returnBounce'] = $returnBounce; + + return $this; + } +} + + diff --git a/lib/Models/GetEmailEventReport.php b/lib/Models/GetEmailEventReport.php index 6733cbc..6285412 100644 --- a/lib/Models/GetEmailEventReport.php +++ b/lib/Models/GetEmailEventReport.php @@ -2,118 +2,116 @@ /** * GetEmailEventReport * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetEmailEventReport Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetEmailEventReport implements ModelInterface, ArrayAccess +class GetEmailEventReport extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getEmailEventReport'; + protected static string $openAPIModelName = 'getEmailEventReport'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'events' => '\Brevo\Client\Models\GetEmailEventReportEvents[]' + protected static array $openAPITypes = [ + 'events' => '\Brevo\Client\Models\GetEmailEventReportEventsInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'events' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'events' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'events' => 'events' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'events' => 'setEvents' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'events' => 'getEvents' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,75 +139,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['events'] = isset($data['events']) ? $data['events'] : null; + $this->setIfExists('events', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets events * - * @return \Brevo\Client\Models\GetEmailEventReportEvents[] + * @return \Brevo\Client\Models\GetEmailEventReportEventsInner[]|null */ - public function getEvents() + public function getEvents(): ?array { return $this->container['events']; } @@ -217,89 +189,19 @@ public function getEvents() /** * Sets events * - * @param \Brevo\Client\Models\GetEmailEventReportEvents[] $events events + * @param \Brevo\Client\Models\GetEmailEventReportEventsInner[]|null $events events * * @return $this */ - public function setEvents($events) + public function setEvents(?array $events): static { + if (is_null($events)) { + throw new InvalidArgumentException('non-nullable events cannot be null'); + } $this->container['events'] = $events; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetEmailEventReportEvents.php b/lib/Models/GetEmailEventReportEventsInner.php similarity index 54% rename from lib/Models/GetEmailEventReportEvents.php rename to lib/Models/GetEmailEventReportEventsInner.php index ef11bab..a4a2941 100644 --- a/lib/Models/GetEmailEventReportEvents.php +++ b/lib/Models/GetEmailEventReportEventsInner.php @@ -1,67 +1,69 @@ */ -class GetEmailEventReportEvents implements ModelInterface, ArrayAccess +class GetEmailEventReportEventsInner extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getEmailEventReport_events'; + protected static string $openAPIModelName = 'getEmailEventReport_events_inner'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'email' => 'string', 'date' => 'string', - 'subject' => 'string', 'messageId' => 'string', 'event' => 'string', + 'subject' => 'string', 'reason' => 'string', 'tag' => 'string', 'ip' => 'string', @@ -73,14 +75,14 @@ class GetEmailEventReportEvents implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'email' => 'email', 'date' => null, - 'subject' => null, 'messageId' => null, 'event' => null, + 'subject' => null, 'reason' => null, 'tag' => null, 'ip' => null, @@ -90,37 +92,43 @@ class GetEmailEventReportEvents implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'date' => false, + 'messageId' => false, + 'event' => false, + 'subject' => false, + 'reason' => false, + 'tag' => false, + 'ip' => false, + 'link' => false, + 'from' => false, + 'templateId' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'email' => 'email', 'date' => 'date', - 'subject' => 'subject', 'messageId' => 'messageId', 'event' => 'event', + 'subject' => 'subject', 'reason' => 'reason', 'tag' => 'tag', 'ip' => 'ip', @@ -132,14 +140,14 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'email' => 'setEmail', 'date' => 'setDate', - 'subject' => 'setSubject', 'messageId' => 'setMessageId', 'event' => 'setEvent', + 'subject' => 'setSubject', 'reason' => 'setReason', 'tag' => 'setTag', 'ip' => 'setIp', @@ -151,14 +159,14 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'email' => 'getEmail', 'date' => 'getDate', - 'subject' => 'getSubject', 'messageId' => 'getMessageId', 'event' => 'getEvent', + 'subject' => 'getSubject', 'reason' => 'getReason', 'tag' => 'getTag', 'ip' => 'getIp', @@ -171,9 +179,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -181,9 +189,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -191,40 +199,28 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } + public const EVENT_BOUNCES = 'bounces'; + public const EVENT_HARD_BOUNCES = 'hardBounces'; + public const EVENT_SOFT_BOUNCES = 'softBounces'; + public const EVENT_DELIVERED = 'delivered'; + public const EVENT_SPAM = 'spam'; + public const EVENT_REQUESTS = 'requests'; + public const EVENT_OPENED = 'opened'; + public const EVENT_CLICKS = 'clicks'; + public const EVENT_INVALID = 'invalid'; + public const EVENT_DEFERRED = 'deferred'; + public const EVENT_BLOCKED = 'blocked'; + public const EVENT_UNSUBSCRIBED = 'unsubscribed'; + public const EVENT_ERROR = 'error'; + public const EVENT_LOADED_BY_PROXY = 'loadedByProxy'; - const EVENT_BOUNCES = 'bounces'; - const EVENT_HARD_BOUNCES = 'hardBounces'; - const EVENT_SOFT_BOUNCES = 'softBounces'; - const EVENT_DELIVERED = 'delivered'; - const EVENT_SPAM = 'spam'; - const EVENT_REQUESTS = 'requests'; - const EVENT_OPENED = 'opened'; - const EVENT_CLICKS = 'clicks'; - const EVENT_INVALID = 'invalid'; - const EVENT_DEFERRED = 'deferred'; - const EVENT_BLOCKED = 'blocked'; - const EVENT_UNSUBSCRIBED = 'unsubscribed'; - const EVENT_ERROR = 'error'; - const EVENT_LOADED_BY_PROXY = 'loadedByProxy'; - - - /** * Gets allowable values of the enum * @@ -249,42 +245,40 @@ public function getEventAllowableValues() self::EVENT_LOADED_BY_PROXY, ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['date'] = isset($data['date']) ? $data['date'] : null; - $this->container['subject'] = isset($data['subject']) ? $data['subject'] : null; - $this->container['messageId'] = isset($data['messageId']) ? $data['messageId'] : null; - $this->container['event'] = isset($data['event']) ? $data['event'] : null; - $this->container['reason'] = isset($data['reason']) ? $data['reason'] : null; - $this->container['tag'] = isset($data['tag']) ? $data['tag'] : null; - $this->container['ip'] = isset($data['ip']) ? $data['ip'] : null; - $this->container['link'] = isset($data['link']) ? $data['link'] : null; - $this->container['from'] = isset($data['from']) ? $data['from'] : null; - $this->container['templateId'] = isset($data['templateId']) ? $data['templateId'] : null; + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('messageId', $data ?? [], null); + $this->setIfExists('event', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('reason', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('ip', $data ?? [], null); + $this->setIfExists('link', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('templateId', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -303,7 +297,8 @@ public function listInvalidProperties() $allowedValues = $this->getEventAllowableValues(); if (!is_null($this->container['event']) && !in_array($this->container['event'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'event', must be one of '%s'", + "invalid value '%s' for 'event', must be one of '%s'", + $this->container['event'], implode("', '", $allowedValues) ); } @@ -311,24 +306,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets email * * @return string */ - public function getEmail() + public function getEmail(): string { return $this->container['email']; } @@ -340,8 +323,11 @@ public function getEmail() * * @return $this */ - public function setEmail($email) + public function setEmail(string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -352,7 +338,7 @@ public function setEmail($email) * * @return string */ - public function getDate() + public function getDate(): string { return $this->container['date']; } @@ -364,43 +350,22 @@ public function getDate() * * @return $this */ - public function setDate($date) + public function setDate(string $date): static { + if (is_null($date)) { + throw new InvalidArgumentException('non-nullable date cannot be null'); + } $this->container['date'] = $date; return $this; } - /** - * Gets subject - * - * @return string - */ - public function getSubject() - { - return $this->container['subject']; - } - - /** - * Sets subject - * - * @param string $subject Subject of the event - * - * @return $this - */ - public function setSubject($subject) - { - $this->container['subject'] = $subject; - - return $this; - } - /** * Gets messageId * * @return string */ - public function getMessageId() + public function getMessageId(): string { return $this->container['messageId']; } @@ -412,8 +377,11 @@ public function getMessageId() * * @return $this */ - public function setMessageId($messageId) + public function setMessageId(string $messageId): static { + if (is_null($messageId)) { + throw new InvalidArgumentException('non-nullable messageId cannot be null'); + } $this->container['messageId'] = $messageId; return $this; @@ -424,7 +392,7 @@ public function setMessageId($messageId) * * @return string */ - public function getEvent() + public function getEvent(): string { return $this->container['event']; } @@ -436,13 +404,17 @@ public function getEvent() * * @return $this */ - public function setEvent($event) + public function setEvent(string $event): static { + if (is_null($event)) { + throw new InvalidArgumentException('non-nullable event cannot be null'); + } $allowedValues = $this->getEventAllowableValues(); if (!in_array($event, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'event', must be one of '%s'", + "Invalid value '%s' for 'event', must be one of '%s'", + $event, implode("', '", $allowedValues) ) ); @@ -452,12 +424,39 @@ public function setEvent($event) return $this; } + /** + * Gets subject + * + * @return string|null + */ + public function getSubject(): ?string + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject Subject of the event + * + * @return $this + */ + public function setSubject(?string $subject): static + { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } + $this->container['subject'] = $subject; + + return $this; + } + /** * Gets reason * - * @return string + * @return string|null */ - public function getReason() + public function getReason(): ?string { return $this->container['reason']; } @@ -465,12 +464,15 @@ public function getReason() /** * Sets reason * - * @param string $reason Reason of bounce (only available if the event is hardbounce or softbounce) + * @param string|null $reason Reason of bounce (only available if the event is hardbounce or softbounce) * * @return $this */ - public function setReason($reason) + public function setReason(?string $reason): static { + if (is_null($reason)) { + throw new InvalidArgumentException('non-nullable reason cannot be null'); + } $this->container['reason'] = $reason; return $this; @@ -479,9 +481,9 @@ public function setReason($reason) /** * Gets tag * - * @return string + * @return string|null */ - public function getTag() + public function getTag(): ?string { return $this->container['tag']; } @@ -489,12 +491,15 @@ public function getTag() /** * Sets tag * - * @param string $tag Tag of the email which generated the event + * @param string|null $tag Tag of the email which generated the event * * @return $this */ - public function setTag($tag) + public function setTag(?string $tag): static { + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } $this->container['tag'] = $tag; return $this; @@ -503,9 +508,9 @@ public function setTag($tag) /** * Gets ip * - * @return string + * @return string|null */ - public function getIp() + public function getIp(): ?string { return $this->container['ip']; } @@ -513,12 +518,15 @@ 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) + * @param string|null $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) + public function setIp(?string $ip): static { + if (is_null($ip)) { + throw new InvalidArgumentException('non-nullable ip cannot be null'); + } $this->container['ip'] = $ip; return $this; @@ -527,9 +535,9 @@ public function setIp($ip) /** * Gets link * - * @return string + * @return string|null */ - public function getLink() + public function getLink(): ?string { return $this->container['link']; } @@ -537,12 +545,15 @@ 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) + * @param string|null $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) + public function setLink(?string $link): static { + if (is_null($link)) { + throw new InvalidArgumentException('non-nullable link cannot be null'); + } $this->container['link'] = $link; return $this; @@ -551,9 +562,9 @@ public function setLink($link) /** * Gets from * - * @return string + * @return string|null */ - public function getFrom() + public function getFrom(): ?string { return $this->container['from']; } @@ -561,12 +572,15 @@ public function getFrom() /** * Sets from * - * @param string $from Sender email from which the emails are sent + * @param string|null $from Sender email from which the emails are sent * * @return $this */ - public function setFrom($from) + public function setFrom(?string $from): static { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } $this->container['from'] = $from; return $this; @@ -575,9 +589,9 @@ public function setFrom($from) /** * Gets templateId * - * @return int + * @return int|null */ - public function getTemplateId() + public function getTemplateId(): ?int { return $this->container['templateId']; } @@ -585,89 +599,19 @@ public function getTemplateId() /** * Sets templateId * - * @param int $templateId ID of the template (only available if the email is template based) + * @param int|null $templateId ID of the template (only available if the email is template based) * * @return $this */ - public function setTemplateId($templateId) + public function setTemplateId(?int $templateId): static { + if (is_null($templateId)) { + throw new InvalidArgumentException('non-nullable templateId cannot be null'); + } $this->container['templateId'] = $templateId; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetExtendedCampaignOverview.php b/lib/Models/GetExtendedCampaignOverview.php index 211a3dc..2460398 100644 --- a/lib/Models/GetExtendedCampaignOverview.php +++ b/lib/Models/GetExtendedCampaignOverview.php @@ -2,66 +2,77 @@ /** * GetExtendedCampaignOverview * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetExtendedCampaignOverview Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetExtendedCampaignOverview implements ModelInterface, ArrayAccess +class GetExtendedCampaignOverview extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getExtendedCampaignOverview'; + protected static string $openAPIModelName = 'getExtendedCampaignOverview'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'name' => 'string', - 'subject' => 'string', 'type' => 'string', 'status' => 'string', + 'testSent' => 'bool', + 'header' => 'string', + 'footer' => 'string', + 'sender' => '\Brevo\Client\Models\GetExtendedCampaignOverviewAllOfSender', + 'replyTo' => 'string', + 'htmlContent' => 'string', + 'createdAt' => 'string', + 'modifiedAt' => 'string', + 'subject' => 'string', + 'previewText' => 'string', 'scheduledAt' => 'string', 'abTesting' => 'bool', 'subjectA' => 'string', @@ -70,17 +81,13 @@ class GetExtendedCampaignOverview implements ModelInterface, ArrayAccess 'winnerCriteria' => 'string', 'winnerDelay' => 'int', 'sendAtBestTime' => 'bool', - 'testSent' => 'bool', - 'header' => 'string', - 'footer' => 'string', - 'sender' => '\Brevo\Client\Models\GetExtendedCampaignOverviewSender', - 'replyTo' => 'string', + 'utmCampaignValue' => 'string', + 'utmSource' => 'string', + 'utmMedium' => 'string', + 'utmIDActive' => 'bool', 'toField' => 'string', - 'htmlContent' => 'string', 'shareLink' => 'string', 'tag' => 'string', - 'createdAt' => 'string', - 'modifiedAt' => 'string', 'inlineImageActivation' => 'bool', 'mirrorActive' => 'bool', 'recurring' => 'bool', @@ -91,14 +98,23 @@ class GetExtendedCampaignOverview implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'name' => null, - 'subject' => null, 'type' => null, 'status' => null, + 'testSent' => null, + 'header' => null, + 'footer' => null, + 'sender' => null, + 'replyTo' => 'email', + 'htmlContent' => null, + 'createdAt' => null, + 'modifiedAt' => null, + 'subject' => null, + 'previewText' => null, 'scheduledAt' => null, 'abTesting' => null, 'subjectA' => null, @@ -107,17 +123,13 @@ class GetExtendedCampaignOverview implements ModelInterface, ArrayAccess 'winnerCriteria' => null, 'winnerDelay' => null, 'sendAtBestTime' => null, - 'testSent' => null, - 'header' => null, - 'footer' => null, - 'sender' => null, - 'replyTo' => 'email', + 'utmCampaignValue' => null, + 'utmSource' => null, + 'utmMedium' => null, + 'utmIDActive' => null, 'toField' => null, - 'htmlContent' => null, 'shareLink' => 'url', 'tag' => null, - 'createdAt' => null, - 'modifiedAt' => null, 'inlineImageActivation' => null, 'mirrorActive' => null, 'recurring' => null, @@ -126,37 +138,75 @@ class GetExtendedCampaignOverview implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'type' => false, + 'status' => false, + 'testSent' => false, + 'header' => false, + 'footer' => false, + 'sender' => false, + 'replyTo' => false, + 'htmlContent' => false, + 'createdAt' => false, + 'modifiedAt' => false, + 'subject' => false, + 'previewText' => false, + 'scheduledAt' => false, + 'abTesting' => false, + 'subjectA' => false, + 'subjectB' => false, + 'splitRule' => false, + 'winnerCriteria' => false, + 'winnerDelay' => false, + 'sendAtBestTime' => false, + 'utmCampaignValue' => false, + 'utmSource' => false, + 'utmMedium' => false, + 'utmIDActive' => false, + 'toField' => false, + 'shareLink' => false, + 'tag' => false, + 'inlineImageActivation' => false, + 'mirrorActive' => false, + 'recurring' => false, + 'sentDate' => false, + 'returnBounce' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name', - 'subject' => 'subject', 'type' => 'type', 'status' => 'status', + 'testSent' => 'testSent', + 'header' => 'header', + 'footer' => 'footer', + 'sender' => 'sender', + 'replyTo' => 'replyTo', + 'htmlContent' => 'htmlContent', + 'createdAt' => 'createdAt', + 'modifiedAt' => 'modifiedAt', + 'subject' => 'subject', + 'previewText' => 'previewText', 'scheduledAt' => 'scheduledAt', 'abTesting' => 'abTesting', 'subjectA' => 'subjectA', @@ -165,17 +215,13 @@ public static function swaggerFormats() 'winnerCriteria' => 'winnerCriteria', 'winnerDelay' => 'winnerDelay', 'sendAtBestTime' => 'sendAtBestTime', - 'testSent' => 'testSent', - 'header' => 'header', - 'footer' => 'footer', - 'sender' => 'sender', - 'replyTo' => 'replyTo', + 'utmCampaignValue' => 'utmCampaignValue', + 'utmSource' => 'utmSource', + 'utmMedium' => 'utmMedium', + 'utmIDActive' => 'utmIDActive', 'toField' => 'toField', - 'htmlContent' => 'htmlContent', 'shareLink' => 'shareLink', 'tag' => 'tag', - 'createdAt' => 'createdAt', - 'modifiedAt' => 'modifiedAt', 'inlineImageActivation' => 'inlineImageActivation', 'mirrorActive' => 'mirrorActive', 'recurring' => 'recurring', @@ -186,14 +232,23 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName', - 'subject' => 'setSubject', 'type' => 'setType', 'status' => 'setStatus', + 'testSent' => 'setTestSent', + 'header' => 'setHeader', + 'footer' => 'setFooter', + 'sender' => 'setSender', + 'replyTo' => 'setReplyTo', + 'htmlContent' => 'setHtmlContent', + 'createdAt' => 'setCreatedAt', + 'modifiedAt' => 'setModifiedAt', + 'subject' => 'setSubject', + 'previewText' => 'setPreviewText', 'scheduledAt' => 'setScheduledAt', 'abTesting' => 'setAbTesting', 'subjectA' => 'setSubjectA', @@ -202,17 +257,13 @@ public static function swaggerFormats() 'winnerCriteria' => 'setWinnerCriteria', 'winnerDelay' => 'setWinnerDelay', 'sendAtBestTime' => 'setSendAtBestTime', - 'testSent' => 'setTestSent', - 'header' => 'setHeader', - 'footer' => 'setFooter', - 'sender' => 'setSender', - 'replyTo' => 'setReplyTo', + 'utmCampaignValue' => 'setUtmCampaignValue', + 'utmSource' => 'setUtmSource', + 'utmMedium' => 'setUtmMedium', + 'utmIDActive' => 'setUtmIDActive', 'toField' => 'setToField', - 'htmlContent' => 'setHtmlContent', 'shareLink' => 'setShareLink', 'tag' => 'setTag', - 'createdAt' => 'setCreatedAt', - 'modifiedAt' => 'setModifiedAt', 'inlineImageActivation' => 'setInlineImageActivation', 'mirrorActive' => 'setMirrorActive', 'recurring' => 'setRecurring', @@ -223,14 +274,23 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName', - 'subject' => 'getSubject', 'type' => 'getType', 'status' => 'getStatus', + 'testSent' => 'getTestSent', + 'header' => 'getHeader', + 'footer' => 'getFooter', + 'sender' => 'getSender', + 'replyTo' => 'getReplyTo', + 'htmlContent' => 'getHtmlContent', + 'createdAt' => 'getCreatedAt', + 'modifiedAt' => 'getModifiedAt', + 'subject' => 'getSubject', + 'previewText' => 'getPreviewText', 'scheduledAt' => 'getScheduledAt', 'abTesting' => 'getAbTesting', 'subjectA' => 'getSubjectA', @@ -239,17 +299,13 @@ public static function swaggerFormats() 'winnerCriteria' => 'getWinnerCriteria', 'winnerDelay' => 'getWinnerDelay', 'sendAtBestTime' => 'getSendAtBestTime', - 'testSent' => 'getTestSent', - 'header' => 'getHeader', - 'footer' => 'getFooter', - 'sender' => 'getSender', - 'replyTo' => 'getReplyTo', + 'utmCampaignValue' => 'getUtmCampaignValue', + 'utmSource' => 'getUtmSource', + 'utmMedium' => 'getUtmMedium', + 'utmIDActive' => 'getUtmIDActive', 'toField' => 'getToField', - 'htmlContent' => 'getHtmlContent', 'shareLink' => 'getShareLink', 'tag' => 'getTag', - 'createdAt' => 'getCreatedAt', - 'modifiedAt' => 'getModifiedAt', 'inlineImageActivation' => 'getInlineImageActivation', 'mirrorActive' => 'getMirrorActive', 'recurring' => 'getRecurring', @@ -261,9 +317,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -271,9 +327,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -281,34 +337,21 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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'; - const STATUS_SENT = 'sent'; - const STATUS_ARCHIVE = 'archive'; - const STATUS_QUEUED = 'queued'; - const STATUS_SUSPENDED = 'suspended'; - const STATUS_IN_PROCESS = 'in_process'; - - - + public const TYPE_CLASSIC = 'classic'; + public const TYPE_TRIGGER = 'trigger'; + public const STATUS_DRAFT = 'draft'; + public const STATUS_SENT = 'sent'; + public const STATUS_ARCHIVE = 'archive'; + public const STATUS_QUEUED = 'queued'; + public const STATUS_SUSPENDED = 'suspended'; + public const STATUS_IN_PROCESS = 'in_process'; /** * Gets allowable values of the enum @@ -340,59 +383,62 @@ public function getStatusAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['subject'] = isset($data['subject']) ? $data['subject'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['scheduledAt'] = isset($data['scheduledAt']) ? $data['scheduledAt'] : null; - $this->container['abTesting'] = isset($data['abTesting']) ? $data['abTesting'] : null; - $this->container['subjectA'] = isset($data['subjectA']) ? $data['subjectA'] : null; - $this->container['subjectB'] = isset($data['subjectB']) ? $data['subjectB'] : null; - $this->container['splitRule'] = isset($data['splitRule']) ? $data['splitRule'] : null; - $this->container['winnerCriteria'] = isset($data['winnerCriteria']) ? $data['winnerCriteria'] : null; - $this->container['winnerDelay'] = isset($data['winnerDelay']) ? $data['winnerDelay'] : null; - $this->container['sendAtBestTime'] = isset($data['sendAtBestTime']) ? $data['sendAtBestTime'] : null; - $this->container['testSent'] = isset($data['testSent']) ? $data['testSent'] : null; - $this->container['header'] = isset($data['header']) ? $data['header'] : null; - $this->container['footer'] = isset($data['footer']) ? $data['footer'] : null; - $this->container['sender'] = isset($data['sender']) ? $data['sender'] : null; - $this->container['replyTo'] = isset($data['replyTo']) ? $data['replyTo'] : null; - $this->container['toField'] = isset($data['toField']) ? $data['toField'] : null; - $this->container['htmlContent'] = isset($data['htmlContent']) ? $data['htmlContent'] : null; - $this->container['shareLink'] = isset($data['shareLink']) ? $data['shareLink'] : null; - $this->container['tag'] = isset($data['tag']) ? $data['tag'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['modifiedAt'] = isset($data['modifiedAt']) ? $data['modifiedAt'] : null; - $this->container['inlineImageActivation'] = isset($data['inlineImageActivation']) ? $data['inlineImageActivation'] : null; - $this->container['mirrorActive'] = isset($data['mirrorActive']) ? $data['mirrorActive'] : null; - $this->container['recurring'] = isset($data['recurring']) ? $data['recurring'] : null; - $this->container['sentDate'] = isset($data['sentDate']) ? $data['sentDate'] : null; - $this->container['returnBounce'] = isset($data['returnBounce']) ? $data['returnBounce'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('testSent', $data ?? [], null); + $this->setIfExists('header', $data ?? [], null); + $this->setIfExists('footer', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('replyTo', $data ?? [], null); + $this->setIfExists('htmlContent', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('modifiedAt', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('previewText', $data ?? [], null); + $this->setIfExists('scheduledAt', $data ?? [], null); + $this->setIfExists('abTesting', $data ?? [], null); + $this->setIfExists('subjectA', $data ?? [], null); + $this->setIfExists('subjectB', $data ?? [], null); + $this->setIfExists('splitRule', $data ?? [], null); + $this->setIfExists('winnerCriteria', $data ?? [], null); + $this->setIfExists('winnerDelay', $data ?? [], null); + $this->setIfExists('sendAtBestTime', $data ?? [], null); + $this->setIfExists('utmCampaignValue', $data ?? [], null); + $this->setIfExists('utmSource', $data ?? [], null); + $this->setIfExists('utmMedium', $data ?? [], null); + $this->setIfExists('utmIDActive', $data ?? [], null); + $this->setIfExists('toField', $data ?? [], null); + $this->setIfExists('shareLink', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('inlineImageActivation', $data ?? [], null); + $this->setIfExists('mirrorActive', $data ?? [], null); + $this->setIfExists('recurring', $data ?? [], null); + $this->setIfExists('sentDate', $data ?? [], null); + $this->setIfExists('returnBounce', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -408,7 +454,8 @@ public function listInvalidProperties() $allowedValues = $this->getTypeAllowableValues(); if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], implode("', '", $allowedValues) ); } @@ -419,7 +466,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -451,24 +499,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -480,8 +516,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -492,7 +531,7 @@ public function setId($id) * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -504,43 +543,22 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; } - /** - * Gets subject - * - * @return string - */ - public function getSubject() - { - return $this->container['subject']; - } - - /** - * Sets subject - * - * @param string $subject Subject of the campaign. Only available if `abTesting` flag of the campaign is `false` - * - * @return $this - */ - public function setSubject($subject) - { - $this->container['subject'] = $subject; - - return $this; - } - /** * Gets type * * @return string */ - public function getType() + public function getType(): string { return $this->container['type']; } @@ -552,13 +570,17 @@ public function getType() * * @return $this */ - public function setType($type) + public function setType(string $type): static { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $allowedValues = $this->getTypeAllowableValues(); if (!in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'type', must be one of '%s'", + "Invalid value '%s' for 'type', must be one of '%s'", + $type, implode("', '", $allowedValues) ) ); @@ -573,7 +595,7 @@ public function setType($type) * * @return string */ - public function getStatus() + public function getStatus(): string { return $this->container['status']; } @@ -585,13 +607,17 @@ public function getStatus() * * @return $this */ - public function setStatus($status) + public function setStatus(string $status): static { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); if (!in_array($status, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -602,652 +628,813 @@ public function setStatus($status) } /** - * Gets scheduledAt + * Gets testSent * - * @return string + * @return bool */ - public function getScheduledAt() + public function getTestSent(): bool { - return $this->container['scheduledAt']; + return $this->container['testSent']; } /** - * Sets scheduledAt + * Sets testSent * - * @param string $scheduledAt UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) + * @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 setScheduledAt($scheduledAt) + public function setTestSent(bool $testSent): static { - $this->container['scheduledAt'] = $scheduledAt; + if (is_null($testSent)) { + throw new InvalidArgumentException('non-nullable testSent cannot be null'); + } + $this->container['testSent'] = $testSent; return $this; } /** - * Gets abTesting + * Gets header * - * @return bool + * @return string */ - public function getAbTesting() + public function getHeader(): string { - return $this->container['abTesting']; + return $this->container['header']; } /** - * Sets abTesting + * Sets header * - * @param bool $abTesting Status of A/B Test for the campaign. abTesting = false means it is disabled, & abTesting = true means it is enabled. + * @param string $header Header of the campaign * * @return $this */ - public function setAbTesting($abTesting) + public function setHeader(string $header): static { - $this->container['abTesting'] = $abTesting; + if (is_null($header)) { + throw new InvalidArgumentException('non-nullable header cannot be null'); + } + $this->container['header'] = $header; return $this; } /** - * Gets subjectA + * Gets footer * * @return string */ - public function getSubjectA() + public function getFooter(): string { - return $this->container['subjectA']; + return $this->container['footer']; } /** - * Sets subjectA + * Sets footer * - * @param string $subjectA Subject A of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` + * @param string $footer Footer of the campaign * * @return $this */ - public function setSubjectA($subjectA) + public function setFooter(string $footer): static { - $this->container['subjectA'] = $subjectA; + if (is_null($footer)) { + throw new InvalidArgumentException('non-nullable footer cannot be null'); + } + $this->container['footer'] = $footer; return $this; } /** - * Gets subjectB + * Gets sender + * + * @return \Brevo\Client\Models\GetExtendedCampaignOverviewAllOfSender + */ + public function getSender(): \Brevo\Client\Models\GetExtendedCampaignOverviewAllOfSender + { + return $this->container['sender']; + } + + /** + * Sets sender + * + * @param \Brevo\Client\Models\GetExtendedCampaignOverviewAllOfSender $sender sender + * + * @return $this + */ + public function setSender(\Brevo\Client\Models\GetExtendedCampaignOverviewAllOfSender $sender): static + { + if (is_null($sender)) { + throw new InvalidArgumentException('non-nullable sender cannot be null'); + } + $this->container['sender'] = $sender; + + return $this; + } + + /** + * Gets replyTo * * @return string */ - public function getSubjectB() + public function getReplyTo(): string { - return $this->container['subjectB']; + return $this->container['replyTo']; } /** - * Sets subjectB + * Sets replyTo * - * @param string $subjectB Subject B of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` + * @param string $replyTo Email defined as the \"Reply to\" of the campaign * * @return $this */ - public function setSubjectB($subjectB) + public function setReplyTo(string $replyTo): static { - $this->container['subjectB'] = $subjectB; + if (is_null($replyTo)) { + throw new InvalidArgumentException('non-nullable replyTo cannot be null'); + } + $this->container['replyTo'] = $replyTo; return $this; } /** - * Gets splitRule + * Gets htmlContent * - * @return int + * @return string */ - public function getSplitRule() + public function getHtmlContent(): string { - return $this->container['splitRule']; + return $this->container['htmlContent']; } /** - * Sets splitRule + * Sets htmlContent * - * @param int $splitRule The size of your ab-test groups. Only available if `abTesting` flag of the campaign is `true` + * @param string $htmlContent HTML content of the campaign * * @return $this */ - public function setSplitRule($splitRule) + public function setHtmlContent(string $htmlContent): static { - $this->container['splitRule'] = $splitRule; + if (is_null($htmlContent)) { + throw new InvalidArgumentException('non-nullable htmlContent cannot be null'); + } + $this->container['htmlContent'] = $htmlContent; return $this; } /** - * Gets winnerCriteria + * Gets createdAt * * @return string */ - public function getWinnerCriteria() + public function getCreatedAt(): string { - return $this->container['winnerCriteria']; + return $this->container['createdAt']; } /** - * Sets winnerCriteria + * Sets createdAt * - * @param string $winnerCriteria Criteria for the winning version. Only available if `abTesting` flag of the campaign is `true` + * @param string $createdAt Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) * * @return $this */ - public function setWinnerCriteria($winnerCriteria) + public function setCreatedAt(string $createdAt): static { - $this->container['winnerCriteria'] = $winnerCriteria; + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; return $this; } /** - * Gets winnerDelay + * Gets modifiedAt * - * @return int + * @return string */ - public function getWinnerDelay() + public function getModifiedAt(): string { - return $this->container['winnerDelay']; + return $this->container['modifiedAt']; } /** - * Sets winnerDelay + * Sets modifiedAt * - * @param int $winnerDelay The duration of the test in hours at the end of which the winning version will be sent. Only available if `abTesting` flag of the campaign is `true` + * @param string $modifiedAt UTC date-time of last modification of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) * * @return $this */ - public function setWinnerDelay($winnerDelay) + public function setModifiedAt(string $modifiedAt): static { - $this->container['winnerDelay'] = $winnerDelay; + if (is_null($modifiedAt)) { + throw new InvalidArgumentException('non-nullable modifiedAt cannot be null'); + } + $this->container['modifiedAt'] = $modifiedAt; return $this; } /** - * Gets sendAtBestTime + * Gets subject * - * @return bool + * @return string|null */ - public function getSendAtBestTime() + public function getSubject(): ?string { - return $this->container['sendAtBestTime']; + return $this->container['subject']; } /** - * Sets sendAtBestTime + * Sets subject * - * @param bool $sendAtBestTime It is true if you have chosen to send your campaign at best time, otherwise it is false + * @param string|null $subject Subject of the campaign. Only available if `abTesting` flag of the campaign is `false` * * @return $this */ - public function setSendAtBestTime($sendAtBestTime) + public function setSubject(?string $subject): static { - $this->container['sendAtBestTime'] = $sendAtBestTime; + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } + $this->container['subject'] = $subject; return $this; } /** - * Gets testSent + * Gets previewText * - * @return bool + * @return string|null */ - public function getTestSent() + public function getPreviewText(): ?string { - return $this->container['testSent']; + return $this->container['previewText']; } /** - * Sets testSent + * Sets previewText * - * @param bool $testSent Retrieved the status of test email sending. (true=Test email has been sent false=Test email has not been sent) + * @param string|null $previewText Preview text or preheader of the email campaign * * @return $this */ - public function setTestSent($testSent) + public function setPreviewText(?string $previewText): static { - $this->container['testSent'] = $testSent; + if (is_null($previewText)) { + throw new InvalidArgumentException('non-nullable previewText cannot be null'); + } + $this->container['previewText'] = $previewText; return $this; } /** - * Gets header + * Gets scheduledAt * - * @return string + * @return string|null */ - public function getHeader() + public function getScheduledAt(): ?string { - return $this->container['header']; + return $this->container['scheduledAt']; } /** - * Sets header + * Sets scheduledAt * - * @param string $header Header of the campaign + * @param string|null $scheduledAt UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) * * @return $this */ - public function setHeader($header) + public function setScheduledAt(?string $scheduledAt): static { - $this->container['header'] = $header; + if (is_null($scheduledAt)) { + throw new InvalidArgumentException('non-nullable scheduledAt cannot be null'); + } + $this->container['scheduledAt'] = $scheduledAt; return $this; } /** - * Gets footer + * Gets abTesting * - * @return string + * @return bool|null */ - public function getFooter() + public function getAbTesting(): ?bool { - return $this->container['footer']; + return $this->container['abTesting']; } /** - * Sets footer + * Sets abTesting * - * @param string $footer Footer of the campaign + * @param bool|null $abTesting Status of A/B Test for the campaign. abTesting = false means it is disabled, & abTesting = true means it is enabled. * * @return $this */ - public function setFooter($footer) + public function setAbTesting(?bool $abTesting): static { - $this->container['footer'] = $footer; + if (is_null($abTesting)) { + throw new InvalidArgumentException('non-nullable abTesting cannot be null'); + } + $this->container['abTesting'] = $abTesting; return $this; } /** - * Gets sender + * Gets subjectA * - * @return \Brevo\Client\Models\GetExtendedCampaignOverviewSender + * @return string|null */ - public function getSender() + public function getSubjectA(): ?string { - return $this->container['sender']; + return $this->container['subjectA']; } /** - * Sets sender + * Sets subjectA * - * @param \Brevo\Client\Models\GetExtendedCampaignOverviewSender $sender sender + * @param string|null $subjectA Subject A of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` * * @return $this */ - public function setSender($sender) + public function setSubjectA(?string $subjectA): static { - $this->container['sender'] = $sender; + if (is_null($subjectA)) { + throw new InvalidArgumentException('non-nullable subjectA cannot be null'); + } + $this->container['subjectA'] = $subjectA; return $this; } /** - * Gets replyTo + * Gets subjectB * - * @return string + * @return string|null */ - public function getReplyTo() + public function getSubjectB(): ?string { - return $this->container['replyTo']; + return $this->container['subjectB']; } /** - * Sets replyTo + * Sets subjectB * - * @param string $replyTo Email defined as the \"Reply to\" of the campaign + * @param string|null $subjectB Subject B of the ab-test campaign. Only available if `abTesting` flag of the campaign is `true` * * @return $this */ - public function setReplyTo($replyTo) + public function setSubjectB(?string $subjectB): static { - $this->container['replyTo'] = $replyTo; + if (is_null($subjectB)) { + throw new InvalidArgumentException('non-nullable subjectB cannot be null'); + } + $this->container['subjectB'] = $subjectB; return $this; } /** - * Gets toField + * Gets splitRule * - * @return string + * @return int|null */ - public function getToField() + public function getSplitRule(): ?int { - return $this->container['toField']; + return $this->container['splitRule']; } /** - * Sets toField + * Sets splitRule * - * @param string $toField Customisation of the \"to\" field of the campaign + * @param int|null $splitRule The size of your ab-test groups. Only available if `abTesting` flag of the campaign is `true` * * @return $this */ - public function setToField($toField) + public function setSplitRule(?int $splitRule): static { - $this->container['toField'] = $toField; + if (is_null($splitRule)) { + throw new InvalidArgumentException('non-nullable splitRule cannot be null'); + } + $this->container['splitRule'] = $splitRule; return $this; } /** - * Gets htmlContent + * Gets winnerCriteria * - * @return string + * @return string|null */ - public function getHtmlContent() + public function getWinnerCriteria(): ?string { - return $this->container['htmlContent']; + return $this->container['winnerCriteria']; } /** - * Sets htmlContent + * Sets winnerCriteria * - * @param string $htmlContent HTML content of the campaign + * @param string|null $winnerCriteria Criteria for the winning version. Only available if `abTesting` flag of the campaign is `true` * * @return $this */ - public function setHtmlContent($htmlContent) + public function setWinnerCriteria(?string $winnerCriteria): static { - $this->container['htmlContent'] = $htmlContent; + if (is_null($winnerCriteria)) { + throw new InvalidArgumentException('non-nullable winnerCriteria cannot be null'); + } + $this->container['winnerCriteria'] = $winnerCriteria; return $this; } /** - * Gets shareLink + * Gets winnerDelay * - * @return string + * @return int|null */ - public function getShareLink() + public function getWinnerDelay(): ?int { - return $this->container['shareLink']; + return $this->container['winnerDelay']; } /** - * Sets shareLink + * Sets winnerDelay * - * @param string $shareLink Link to share the campaign on social medias + * @param int|null $winnerDelay The duration of the test in hours at the end of which the winning version will be sent. Only available if `abTesting` flag of the campaign is `true` * * @return $this */ - public function setShareLink($shareLink) + public function setWinnerDelay(?int $winnerDelay): static { - $this->container['shareLink'] = $shareLink; + if (is_null($winnerDelay)) { + throw new InvalidArgumentException('non-nullable winnerDelay cannot be null'); + } + $this->container['winnerDelay'] = $winnerDelay; return $this; } /** - * Gets tag + * Gets sendAtBestTime * - * @return string + * @return bool|null */ - public function getTag() + public function getSendAtBestTime(): ?bool { - return $this->container['tag']; + return $this->container['sendAtBestTime']; } /** - * Sets tag + * Sets sendAtBestTime * - * @param string $tag Tag of the campaign + * @param bool|null $sendAtBestTime It is true if you have chosen to send your campaign at best time, otherwise it is false * * @return $this */ - public function setTag($tag) + public function setSendAtBestTime(?bool $sendAtBestTime): static { - $this->container['tag'] = $tag; + if (is_null($sendAtBestTime)) { + throw new InvalidArgumentException('non-nullable sendAtBestTime cannot be null'); + } + $this->container['sendAtBestTime'] = $sendAtBestTime; return $this; } /** - * Gets createdAt + * Gets utmCampaignValue * - * @return string + * @return string|null */ - public function getCreatedAt() + public function getUtmCampaignValue(): ?string { - return $this->container['createdAt']; + return $this->container['utmCampaignValue']; } /** - * Sets createdAt + * Sets utmCampaignValue * - * @param string $createdAt Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + * @param string|null $utmCampaignValue utm parameter associated with campaign * * @return $this */ - public function setCreatedAt($createdAt) + public function setUtmCampaignValue(?string $utmCampaignValue): static { - $this->container['createdAt'] = $createdAt; + if (is_null($utmCampaignValue)) { + throw new InvalidArgumentException('non-nullable utmCampaignValue cannot be null'); + } + $this->container['utmCampaignValue'] = $utmCampaignValue; return $this; } /** - * Gets modifiedAt + * Gets utmSource * - * @return string + * @return string|null */ - public function getModifiedAt() + public function getUtmSource(): ?string { - return $this->container['modifiedAt']; + return $this->container['utmSource']; } /** - * Sets modifiedAt + * Sets utmSource * - * @param string $modifiedAt UTC date-time of last modification of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + * @param string|null $utmSource utmSource * * @return $this */ - public function setModifiedAt($modifiedAt) + public function setUtmSource(?string $utmSource): static { - $this->container['modifiedAt'] = $modifiedAt; + if (is_null($utmSource)) { + throw new InvalidArgumentException('non-nullable utmSource cannot be null'); + } + $this->container['utmSource'] = $utmSource; return $this; } /** - * Gets inlineImageActivation + * Gets utmMedium * - * @return bool + * @return string|null */ - public function getInlineImageActivation() + public function getUtmMedium(): ?string { - return $this->container['inlineImageActivation']; + return $this->container['utmMedium']; } /** - * Sets inlineImageActivation + * Sets utmMedium * - * @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. + * @param string|null $utmMedium utmMedium * * @return $this */ - public function setInlineImageActivation($inlineImageActivation) + public function setUtmMedium(?string $utmMedium): static { - $this->container['inlineImageActivation'] = $inlineImageActivation; + if (is_null($utmMedium)) { + throw new InvalidArgumentException('non-nullable utmMedium cannot be null'); + } + $this->container['utmMedium'] = $utmMedium; return $this; } /** - * Gets mirrorActive + * Gets utmIDActive * - * @return bool + * @return bool|null */ - public function getMirrorActive() + public function getUtmIDActive(): ?bool { - return $this->container['mirrorActive']; + return $this->container['utmIDActive']; } /** - * Sets mirrorActive + * Sets utmIDActive * - * @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 + * @param bool|null $utmIDActive utm id activate * * @return $this */ - public function setMirrorActive($mirrorActive) + public function setUtmIDActive(?bool $utmIDActive): static { - $this->container['mirrorActive'] = $mirrorActive; + if (is_null($utmIDActive)) { + throw new InvalidArgumentException('non-nullable utmIDActive cannot be null'); + } + $this->container['utmIDActive'] = $utmIDActive; return $this; } /** - * Gets recurring + * Gets toField * - * @return bool + * @return string|null */ - public function getRecurring() + public function getToField(): ?string { - return $this->container['recurring']; + return $this->container['toField']; } /** - * Sets recurring + * Sets toField * - * @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 + * @param string|null $toField Customisation of the \"to\" field of the campaign * * @return $this */ - public function setRecurring($recurring) + public function setToField(?string $toField): static { - $this->container['recurring'] = $recurring; + if (is_null($toField)) { + throw new InvalidArgumentException('non-nullable toField cannot be null'); + } + $this->container['toField'] = $toField; return $this; } /** - * Gets sentDate + * Gets shareLink * - * @return string + * @return string|null */ - public function getSentDate() + public function getShareLink(): ?string { - return $this->container['sentDate']; + return $this->container['shareLink']; } /** - * Sets sentDate + * Sets shareLink * - * @param string $sentDate Sent UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ). Only available if 'status' of the campaign is 'sent' + * @param string|null $shareLink Link to share the campaign on social medias * * @return $this */ - public function setSentDate($sentDate) + public function setShareLink(?string $shareLink): static { - $this->container['sentDate'] = $sentDate; + if (is_null($shareLink)) { + throw new InvalidArgumentException('non-nullable shareLink cannot be null'); + } + $this->container['shareLink'] = $shareLink; return $this; } /** - * Gets returnBounce + * Gets tag * - * @return int + * @return string|null */ - public function getReturnBounce() + public function getTag(): ?string { - return $this->container['returnBounce']; + return $this->container['tag']; } /** - * Sets returnBounce + * Sets tag * - * @param int $returnBounce Total number of non-delivered campaigns for a particular campaign id. + * @param string|null $tag Tag of the campaign * * @return $this */ - public function setReturnBounce($returnBounce) + public function setTag(?string $tag): static { - $this->container['returnBounce'] = $returnBounce; + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } + $this->container['tag'] = $tag; return $this; } + + /** + * Gets inlineImageActivation + * + * @return bool|null + */ + public function getInlineImageActivation(): ?bool + { + return $this->container['inlineImageActivation']; + } + /** - * Returns true if offset exists. False otherwise. + * Sets inlineImageActivation * - * @param integer $offset Offset + * @param bool|null $inlineImageActivation Status of inline image. inlineImageActivation = false means image can’t be embedded, & inlineImageActivation = true means image can be embedded, in the email. * - * @return boolean + * @return $this */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) + public function setInlineImageActivation(?bool $inlineImageActivation): static { - return isset($this->container[$offset]); + if (is_null($inlineImageActivation)) { + throw new InvalidArgumentException('non-nullable inlineImageActivation cannot be null'); + } + $this->container['inlineImageActivation'] = $inlineImageActivation; + + return $this; } /** - * Gets offset. + * Gets mirrorActive * - * @param integer $offset Offset + * @return bool|null + */ + public function getMirrorActive(): ?bool + { + return $this->container['mirrorActive']; + } + + /** + * Sets mirrorActive * - * @return mixed + * @param bool|null $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 */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function setMirrorActive(?bool $mirrorActive): static { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + if (is_null($mirrorActive)) { + throw new InvalidArgumentException('non-nullable mirrorActive cannot be null'); + } + $this->container['mirrorActive'] = $mirrorActive; + + return $this; + } + + /** + * Gets recurring + * + * @return bool|null + */ + public function getRecurring(): ?bool + { + return $this->container['recurring']; } /** - * Sets value based on offset. + * Sets recurring * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param bool|null $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 void + * @return $this */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function setRecurring(?bool $recurring): static { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; + if (is_null($recurring)) { + throw new InvalidArgumentException('non-nullable recurring cannot be null'); } + $this->container['recurring'] = $recurring; + + return $this; } /** - * Unsets offset. + * Gets sentDate * - * @param integer $offset Offset + * @return string|null + */ + public function getSentDate(): ?string + { + return $this->container['sentDate']; + } + + /** + * Sets sentDate * - * @return void + * @param string|null $sentDate Sent UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ). Only available if 'status' of the campaign is 'sent' + * + * @return $this */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) + public function setSentDate(?string $sentDate): static { - unset($this->container[$offset]); + if (is_null($sentDate)) { + throw new InvalidArgumentException('non-nullable sentDate cannot be null'); + } + $this->container['sentDate'] = $sentDate; + + return $this; } /** - * Gets the string presentation of the object + * Gets returnBounce * - * @return string + * @return int|null */ - public function __toString() + public function getReturnBounce(): ?int { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + return $this->container['returnBounce']; + } + + /** + * Sets returnBounce + * + * @param int|null $returnBounce Total number of non-delivered campaigns for a particular campaign id. + * + * @return $this + */ + public function setReturnBounce(?int $returnBounce): static + { + if (is_null($returnBounce)) { + throw new InvalidArgumentException('non-nullable returnBounce cannot be null'); } + $this->container['returnBounce'] = $returnBounce; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/GetExtendedCampaignOverviewAllOfSender.php b/lib/Models/GetExtendedCampaignOverviewAllOfSender.php new file mode 100644 index 0000000..6453c1f --- /dev/null +++ b/lib/Models/GetExtendedCampaignOverviewAllOfSender.php @@ -0,0 +1,275 @@ + + */ +class GetExtendedCampaignOverviewAllOfSender extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getExtendedCampaignOverview_allOf_sender'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'email' => 'string', + 'id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'email' => 'email', + 'id' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'email' => false, + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'email' => 'email', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'email' => 'setEmail', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'email' => 'getEmail', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Sender name of the campaign + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail(): ?string + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Sender email of the campaign + * + * @return $this + */ + public function setEmail(?string $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets id + * + * @return int|null + */ + public function getId(): ?int + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int|null $id Sender id of the campaign + * + * @return $this + */ + public function setId(?int $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } +} + + diff --git a/lib/Models/GetExtendedCampaignOverviewSender.php b/lib/Models/GetExtendedCampaignOverviewSender.php deleted file mode 100644 index 3e46c7c..0000000 --- a/lib/Models/GetExtendedCampaignOverviewSender.php +++ /dev/null @@ -1,365 +0,0 @@ - 'string', - 'email' => 'string', - 'id' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'name' => null, - 'email' => 'email', - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'name' => 'name', - 'email' => 'email', - 'id' => 'id' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'name' => 'setName', - 'email' => 'setEmail', - 'id' => 'setId' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'name' => 'getName', - 'email' => 'getEmail', - '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 - */ - public function __construct(array $data = null) - { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Sender name of the campaign - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets email - * - * @return string - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string $email Sender email of the campaign - * - * @return $this - */ - public function setEmail($email) - { - $this->container['email'] = $email; - - return $this; - } - - /** - * Gets id - * - * @return int - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param int $id Sender id of the campaign - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetExtendedCampaignStats.php b/lib/Models/GetExtendedCampaignStats.php index 922592b..0c296a8 100644 --- a/lib/Models/GetExtendedCampaignStats.php +++ b/lib/Models/GetExtendedCampaignStats.php @@ -2,77 +2,79 @@ /** * GetExtendedCampaignStats * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetExtendedCampaignStats Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetExtendedCampaignStats implements ModelInterface, ArrayAccess +class GetExtendedCampaignStats extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getExtendedCampaignStats'; + protected static string $openAPIModelName = 'getExtendedCampaignStats'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'globalStats' => '\Brevo\Client\Models\GetExtendedCampaignStatsGlobalStats', - 'campaignStats' => 'object[]', + protected static array $openAPITypes = [ + 'globalStats' => '\Brevo\Client\Models\GetCampaignStats', + 'campaignStats' => 'GetCampaignStats[]', 'mirrorClick' => 'int', 'remaining' => 'int', 'linksStats' => 'object', - 'statsByDomain' => '\Brevo\Client\Models\GetStatsByDomain', + 'statsByDomain' => 'array', 'statsByDevice' => '\Brevo\Client\Models\GetStatsByDevice', - 'statsByBrowser' => '\Brevo\Client\Models\GetStatsByBrowser' + 'statsByBrowser' => 'array' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'globalStats' => null, 'campaignStats' => null, 'mirrorClick' => 'int64', @@ -84,32 +86,35 @@ class GetExtendedCampaignStats implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'globalStats' => false, + 'campaignStats' => false, + 'mirrorClick' => false, + 'remaining' => false, + 'linksStats' => false, + 'statsByDomain' => false, + 'statsByDevice' => false, + 'statsByBrowser' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'globalStats' => 'globalStats', 'campaignStats' => 'campaignStats', 'mirrorClick' => 'mirrorClick', @@ -123,9 +128,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'globalStats' => 'setGlobalStats', 'campaignStats' => 'setCampaignStats', 'mirrorClick' => 'setMirrorClick', @@ -139,9 +144,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'globalStats' => 'getGlobalStats', 'campaignStats' => 'getCampaignStats', 'mirrorClick' => 'getMirrorClick', @@ -156,9 +161,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -166,9 +171,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -176,58 +181,44 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $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; - $this->container['linksStats'] = isset($data['linksStats']) ? $data['linksStats'] : null; - $this->container['statsByDomain'] = isset($data['statsByDomain']) ? $data['statsByDomain'] : null; - $this->container['statsByDevice'] = isset($data['statsByDevice']) ? $data['statsByDevice'] : null; - $this->container['statsByBrowser'] = isset($data['statsByBrowser']) ? $data['statsByBrowser'] : null; + $this->setIfExists('globalStats', $data ?? [], null); + $this->setIfExists('campaignStats', $data ?? [], null); + $this->setIfExists('mirrorClick', $data ?? [], null); + $this->setIfExists('remaining', $data ?? [], null); + $this->setIfExists('linksStats', $data ?? [], null); + $this->setIfExists('statsByDomain', $data ?? [], null); + $this->setIfExists('statsByDevice', $data ?? [], null); + $this->setIfExists('statsByBrowser', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -258,24 +249,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets globalStats * - * @return \Brevo\Client\Models\GetExtendedCampaignStatsGlobalStats + * @return \Brevo\Client\Models\GetCampaignStats */ - public function getGlobalStats() + public function getGlobalStats(): \Brevo\Client\Models\GetCampaignStats { return $this->container['globalStats']; } @@ -283,12 +262,15 @@ public function getGlobalStats() /** * Sets globalStats * - * @param \Brevo\Client\Models\GetExtendedCampaignStatsGlobalStats $globalStats globalStats + * @param \Brevo\Client\Models\GetCampaignStats $globalStats Overall statistics of the campaign * * @return $this */ - public function setGlobalStats($globalStats) + public function setGlobalStats(\Brevo\Client\Models\GetCampaignStats $globalStats): static { + if (is_null($globalStats)) { + throw new InvalidArgumentException('non-nullable globalStats cannot be null'); + } $this->container['globalStats'] = $globalStats; return $this; @@ -297,9 +279,9 @@ public function setGlobalStats($globalStats) /** * Gets campaignStats * - * @return object[] + * @return GetCampaignStats[] */ - public function getCampaignStats() + public function getCampaignStats(): array { return $this->container['campaignStats']; } @@ -307,12 +289,15 @@ public function getCampaignStats() /** * Sets campaignStats * - * @param object[] $campaignStats List-wise statistics of the campaign. + * @param GetCampaignStats[] $campaignStats List-wise statistics of the campaign. * * @return $this */ - public function setCampaignStats($campaignStats) + public function setCampaignStats(array $campaignStats): static { + if (is_null($campaignStats)) { + throw new InvalidArgumentException('non-nullable campaignStats cannot be null'); + } $this->container['campaignStats'] = $campaignStats; return $this; @@ -323,7 +308,7 @@ public function setCampaignStats($campaignStats) * * @return int */ - public function getMirrorClick() + public function getMirrorClick(): int { return $this->container['mirrorClick']; } @@ -335,8 +320,11 @@ public function getMirrorClick() * * @return $this */ - public function setMirrorClick($mirrorClick) + public function setMirrorClick(int $mirrorClick): static { + if (is_null($mirrorClick)) { + throw new InvalidArgumentException('non-nullable mirrorClick cannot be null'); + } $this->container['mirrorClick'] = $mirrorClick; return $this; @@ -347,7 +335,7 @@ public function setMirrorClick($mirrorClick) * * @return int */ - public function getRemaining() + public function getRemaining(): int { return $this->container['remaining']; } @@ -359,8 +347,11 @@ public function getRemaining() * * @return $this */ - public function setRemaining($remaining) + public function setRemaining(int $remaining): static { + if (is_null($remaining)) { + throw new InvalidArgumentException('non-nullable remaining cannot be null'); + } $this->container['remaining'] = $remaining; return $this; @@ -371,7 +362,7 @@ public function setRemaining($remaining) * * @return object */ - public function getLinksStats() + public function getLinksStats(): object { return $this->container['linksStats']; } @@ -383,8 +374,11 @@ public function getLinksStats() * * @return $this */ - public function setLinksStats($linksStats) + public function setLinksStats(object $linksStats): static { + if (is_null($linksStats)) { + throw new InvalidArgumentException('non-nullable linksStats cannot be null'); + } $this->container['linksStats'] = $linksStats; return $this; @@ -393,9 +387,9 @@ public function setLinksStats($linksStats) /** * Gets statsByDomain * - * @return \Brevo\Client\Models\GetStatsByDomain + * @return array */ - public function getStatsByDomain() + public function getStatsByDomain(): array { return $this->container['statsByDomain']; } @@ -403,12 +397,15 @@ public function getStatsByDomain() /** * Sets statsByDomain * - * @param \Brevo\Client\Models\GetStatsByDomain $statsByDomain statsByDomain + * @param array $statsByDomain statsByDomain * * @return $this */ - public function setStatsByDomain($statsByDomain) + public function setStatsByDomain(array $statsByDomain): static { + if (is_null($statsByDomain)) { + throw new InvalidArgumentException('non-nullable statsByDomain cannot be null'); + } $this->container['statsByDomain'] = $statsByDomain; return $this; @@ -419,7 +416,7 @@ public function setStatsByDomain($statsByDomain) * * @return \Brevo\Client\Models\GetStatsByDevice */ - public function getStatsByDevice() + public function getStatsByDevice(): \Brevo\Client\Models\GetStatsByDevice { return $this->container['statsByDevice']; } @@ -427,12 +424,15 @@ public function getStatsByDevice() /** * Sets statsByDevice * - * @param \Brevo\Client\Models\GetStatsByDevice $statsByDevice Statistics about the campaign on the basis of various devices + * @param \Brevo\Client\Models\GetStatsByDevice $statsByDevice statsByDevice * * @return $this */ - public function setStatsByDevice($statsByDevice) + public function setStatsByDevice(\Brevo\Client\Models\GetStatsByDevice $statsByDevice): static { + if (is_null($statsByDevice)) { + throw new InvalidArgumentException('non-nullable statsByDevice cannot be null'); + } $this->container['statsByDevice'] = $statsByDevice; return $this; @@ -441,9 +441,9 @@ public function setStatsByDevice($statsByDevice) /** * Gets statsByBrowser * - * @return \Brevo\Client\Models\GetStatsByBrowser + * @return array */ - public function getStatsByBrowser() + public function getStatsByBrowser(): array { return $this->container['statsByBrowser']; } @@ -451,89 +451,19 @@ public function getStatsByBrowser() /** * Sets statsByBrowser * - * @param \Brevo\Client\Models\GetStatsByBrowser $statsByBrowser Statistics about the campaign on the basis of various browsers + * @param array $statsByBrowser statsByBrowser * * @return $this */ - public function setStatsByBrowser($statsByBrowser) + public function setStatsByBrowser(array $statsByBrowser): static { + if (is_null($statsByBrowser)) { + throw new InvalidArgumentException('non-nullable statsByBrowser cannot be null'); + } $this->container['statsByBrowser'] = $statsByBrowser; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetExtendedCampaignStatsGlobalStats.php b/lib/Models/GetExtendedCampaignStatsGlobalStats.php deleted file mode 100644 index bdef9e5..0000000 --- a/lib/Models/GetExtendedCampaignStatsGlobalStats.php +++ /dev/null @@ -1,281 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetExtendedClient.php b/lib/Models/GetExtendedClient.php index d3f63ce..ac8971c 100644 --- a/lib/Models/GetExtendedClient.php +++ b/lib/Models/GetExtendedClient.php @@ -2,116 +2,140 @@ /** * GetExtendedClient * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \Brevo\Client\ObjectSerializer; + +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetExtendedClient Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetExtendedClient extends GetClient +class GetExtendedClient extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getExtendedClient'; + protected static string $openAPIModelName = 'getExtendedClient'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'address' => '\Brevo\Client\Models\GetExtendedClientAddress' + protected static array $openAPITypes = [ + 'email' => 'string', + 'firstName' => 'string', + 'lastName' => 'string', + 'companyName' => 'string', + 'address' => '\Brevo\Client\Models\GetExtendedClientAllOfAddress' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ + 'email' => 'email', + 'firstName' => null, + 'lastName' => null, + 'companyName' => null, 'address' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes + parent::swaggerTypes(); - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'firstName' => false, + 'lastName' => false, + 'companyName' => false, + 'address' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats + parent::swaggerFormats(); - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ + 'email' => 'email', + 'firstName' => 'firstName', + 'lastName' => 'lastName', + 'companyName' => 'companyName', 'address' => 'address' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ + 'email' => 'setEmail', + 'firstName' => 'setFirstName', + 'lastName' => 'setLastName', + 'companyName' => 'setCompanyName', 'address' => 'setAddress' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ + 'email' => 'getEmail', + 'firstName' => 'getFirstName', + 'lastName' => 'getLastName', + 'companyName' => 'getCompanyName', 'address' => 'getAddress' ]; @@ -119,70 +143,76 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { - return parent::attributeMap() + self::$attributeMap; + return self::$attributeMap; } /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { - return parent::setters() + self::$setters; + return self::$setters; } /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { - return parent::getters() + self::$getters; + return self::$getters; } + /** - * The original name of the model. + * Associative array for storing property values * - * @return string + * @var array */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - parent::__construct($data); - - $this->container['address'] = isset($data['address']) ? $data['address'] : null; + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('firstName', $data ?? [], null); + $this->setIfExists('lastName', $data ?? [], null); + $this->setIfExists('companyName', $data ?? [], null); + $this->setIfExists('address', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { - $invalidProperties = parent::listInvalidProperties(); + $invalidProperties = []; + if ($this->container['email'] === null) { + $invalidProperties[] = "'email' can't be null"; + } + if ($this->container['firstName'] === null) { + $invalidProperties[] = "'firstName' can't be null"; + } + if ($this->container['lastName'] === null) { + $invalidProperties[] = "'lastName' can't be null"; + } + if ($this->container['companyName'] === null) { + $invalidProperties[] = "'companyName' can't be null"; + } if ($this->container['address'] === null) { $invalidProperties[] = "'address' can't be null"; } @@ -190,112 +220,138 @@ public function listInvalidProperties() } /** - * Validate all the properties in the model - * return true if all passed + * Gets email * - * @return bool True if all properties are valid + * @return string */ - public function valid() + public function getEmail(): string { - return count($this->listInvalidProperties()) === 0; + return $this->container['email']; } + /** + * Sets email + * + * @param string $email Login Email + * + * @return $this + */ + public function setEmail(string $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } /** - * Gets address + * Gets firstName * - * @return \Brevo\Client\Models\GetExtendedClientAddress + * @return string */ - public function getAddress() + public function getFirstName(): string { - return $this->container['address']; + return $this->container['firstName']; } /** - * Sets address + * Sets firstName * - * @param \Brevo\Client\Models\GetExtendedClientAddress $address address + * @param string $firstName First Name * * @return $this */ - public function setAddress($address) + public function setFirstName(string $firstName): static { - $this->container['address'] = $address; + if (is_null($firstName)) { + throw new InvalidArgumentException('non-nullable firstName cannot be null'); + } + $this->container['firstName'] = $firstName; return $this; } + /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset + * Gets lastName * - * @return boolean + * @return string */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) + public function getLastName(): string { - return isset($this->container[$offset]); + return $this->container['lastName']; } /** - * Gets offset. + * Sets lastName * - * @param integer $offset Offset + * @param string $lastName Last Name * - * @return mixed + * @return $this */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function setLastName(string $lastName): static { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + if (is_null($lastName)) { + throw new InvalidArgumentException('non-nullable lastName cannot be null'); + } + $this->container['lastName'] = $lastName; + + return $this; } /** - * Sets value based on offset. + * Gets companyName * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @return string + */ + public function getCompanyName(): string + { + return $this->container['companyName']; + } + + /** + * Sets companyName + * + * @param string $companyName Name of the company * - * @return void + * @return $this */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function setCompanyName(string $companyName): static { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; + if (is_null($companyName)) { + throw new InvalidArgumentException('non-nullable companyName cannot be null'); } + $this->container['companyName'] = $companyName; + + return $this; } /** - * Unsets offset. - * - * @param integer $offset Offset + * Gets address * - * @return void + * @return \Brevo\Client\Models\GetExtendedClientAllOfAddress */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) + public function getAddress(): \Brevo\Client\Models\GetExtendedClientAllOfAddress { - unset($this->container[$offset]); + return $this->container['address']; } /** - * Gets the string presentation of the object + * Sets address * - * @return string + * @param \Brevo\Client\Models\GetExtendedClientAllOfAddress $address address + * + * @return $this */ - public function __toString() + public function setAddress(\Brevo\Client\Models\GetExtendedClientAllOfAddress $address): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($address)) { + throw new InvalidArgumentException('non-nullable address cannot be null'); } + $this->container['address'] = $address; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/GetExtendedClientAddress.php b/lib/Models/GetExtendedClientAllOfAddress.php similarity index 51% rename from lib/Models/GetExtendedClientAddress.php rename to lib/Models/GetExtendedClientAllOfAddress.php index d66f903..f68a607 100644 --- a/lib/Models/GetExtendedClientAddress.php +++ b/lib/Models/GetExtendedClientAllOfAddress.php @@ -1,63 +1,65 @@ */ -class GetExtendedClientAddress implements ModelInterface, ArrayAccess +class GetExtendedClientAllOfAddress extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getExtendedClient_address'; + protected static string $openAPIModelName = 'getExtendedClient_allOf_address'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'street' => 'string', 'city' => 'string', 'zipCode' => 'string', @@ -67,9 +69,9 @@ class GetExtendedClientAddress implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'street' => null, 'city' => null, 'zipCode' => null, @@ -77,32 +79,31 @@ class GetExtendedClientAddress implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'street' => false, + 'city' => false, + 'zipCode' => false, + 'country' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'street' => 'street', 'city' => 'city', 'zipCode' => 'zipCode', @@ -112,9 +113,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'street' => 'setStreet', 'city' => 'setCity', 'zipCode' => 'setZipCode', @@ -124,9 +125,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'street' => 'getStreet', 'city' => 'getCity', 'zipCode' => 'getZipCode', @@ -137,9 +138,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -147,9 +148,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -157,54 +158,40 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['street'] = isset($data['street']) ? $data['street'] : null; - $this->container['city'] = isset($data['city']) ? $data['city'] : null; - $this->container['zipCode'] = isset($data['zipCode']) ? $data['zipCode'] : null; - $this->container['country'] = isset($data['country']) ? $data['country'] : null; + $this->setIfExists('street', $data ?? [], null); + $this->setIfExists('city', $data ?? [], null); + $this->setIfExists('zipCode', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -223,24 +210,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets street * * @return string */ - public function getStreet() + public function getStreet(): string { return $this->container['street']; } @@ -252,8 +227,11 @@ public function getStreet() * * @return $this */ - public function setStreet($street) + public function setStreet(string $street): static { + if (is_null($street)) { + throw new InvalidArgumentException('non-nullable street cannot be null'); + } $this->container['street'] = $street; return $this; @@ -264,7 +242,7 @@ public function setStreet($street) * * @return string */ - public function getCity() + public function getCity(): string { return $this->container['city']; } @@ -276,8 +254,11 @@ public function getCity() * * @return $this */ - public function setCity($city) + public function setCity(string $city): static { + if (is_null($city)) { + throw new InvalidArgumentException('non-nullable city cannot be null'); + } $this->container['city'] = $city; return $this; @@ -288,7 +269,7 @@ public function setCity($city) * * @return string */ - public function getZipCode() + public function getZipCode(): string { return $this->container['zipCode']; } @@ -300,8 +281,11 @@ public function getZipCode() * * @return $this */ - public function setZipCode($zipCode) + public function setZipCode(string $zipCode): static { + if (is_null($zipCode)) { + throw new InvalidArgumentException('non-nullable zipCode cannot be null'); + } $this->container['zipCode'] = $zipCode; return $this; @@ -312,7 +296,7 @@ public function setZipCode($zipCode) * * @return string */ - public function getCountry() + public function getCountry(): string { return $this->container['country']; } @@ -324,85 +308,15 @@ public function getCountry() * * @return $this */ - public function setCountry($country) + public function setCountry(string $country): static { + if (is_null($country)) { + throw new InvalidArgumentException('non-nullable country cannot be null'); + } $this->container['country'] = $country; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetExtendedContactDetails.php b/lib/Models/GetExtendedContactDetails.php index fa15194..a3f6471 100644 --- a/lib/Models/GetExtendedContactDetails.php +++ b/lib/Models/GetExtendedContactDetails.php @@ -2,173 +2,180 @@ /** * GetExtendedContactDetails * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetExtendedContactDetails Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetExtendedContactDetails implements ModelInterface, ArrayAccess +class GetExtendedContactDetails extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getExtendedContactDetails'; + protected static string $openAPIModelName = 'getExtendedContactDetails'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'email' => 'string', + protected static array $openAPITypes = [ 'id' => 'int', 'emailBlacklisted' => 'bool', 'smsBlacklisted' => 'bool', 'createdAt' => 'string', 'modifiedAt' => 'string', 'listIds' => 'int[]', - 'listUnsubscribed' => 'int[]', 'attributes' => 'object', - 'statistics' => '\Brevo\Client\Models\GetExtendedContactDetailsStatistics' + 'statistics' => '\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatistics', + 'email' => 'string', + 'listUnsubscribed' => 'int[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'email' => 'email', + protected static array $openAPIFormats = [ 'id' => 'int64', 'emailBlacklisted' => null, 'smsBlacklisted' => null, 'createdAt' => null, 'modifiedAt' => null, 'listIds' => 'int64', - 'listUnsubscribed' => 'int64', 'attributes' => null, - 'statistics' => null + 'statistics' => null, + 'email' => 'email', + 'listUnsubscribed' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'emailBlacklisted' => false, + 'smsBlacklisted' => false, + 'createdAt' => false, + 'modifiedAt' => false, + 'listIds' => false, + 'attributes' => false, + 'statistics' => false, + 'email' => false, + 'listUnsubscribed' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ - 'email' => 'email', + protected static array $attributeMap = [ 'id' => 'id', 'emailBlacklisted' => 'emailBlacklisted', 'smsBlacklisted' => 'smsBlacklisted', 'createdAt' => 'createdAt', 'modifiedAt' => 'modifiedAt', 'listIds' => 'listIds', - 'listUnsubscribed' => 'listUnsubscribed', 'attributes' => 'attributes', - 'statistics' => 'statistics' + 'statistics' => 'statistics', + 'email' => 'email', + 'listUnsubscribed' => 'listUnsubscribed' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ - 'email' => 'setEmail', + protected static array $setters = [ 'id' => 'setId', 'emailBlacklisted' => 'setEmailBlacklisted', 'smsBlacklisted' => 'setSmsBlacklisted', 'createdAt' => 'setCreatedAt', 'modifiedAt' => 'setModifiedAt', 'listIds' => 'setListIds', - 'listUnsubscribed' => 'setListUnsubscribed', 'attributes' => 'setAttributes', - 'statistics' => 'setStatistics' + 'statistics' => 'setStatistics', + 'email' => 'setEmail', + 'listUnsubscribed' => 'setListUnsubscribed' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ - 'email' => 'getEmail', + protected static array $getters = [ 'id' => 'getId', 'emailBlacklisted' => 'getEmailBlacklisted', 'smsBlacklisted' => 'getSmsBlacklisted', 'createdAt' => 'getCreatedAt', 'modifiedAt' => 'getModifiedAt', 'listIds' => 'getListIds', - 'listUnsubscribed' => 'getListUnsubscribed', 'attributes' => 'getAttributes', - 'statistics' => 'getStatistics' + 'statistics' => 'getStatistics', + 'email' => 'getEmail', + 'listUnsubscribed' => 'getListUnsubscribed' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -176,9 +183,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -186,67 +193,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['emailBlacklisted'] = isset($data['emailBlacklisted']) ? $data['emailBlacklisted'] : null; - $this->container['smsBlacklisted'] = isset($data['smsBlacklisted']) ? $data['smsBlacklisted'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['modifiedAt'] = isset($data['modifiedAt']) ? $data['modifiedAt'] : null; - $this->container['listIds'] = isset($data['listIds']) ? $data['listIds'] : null; - $this->container['listUnsubscribed'] = isset($data['listUnsubscribed']) ? $data['listUnsubscribed'] : null; - $this->container['attributes'] = isset($data['attributes']) ? $data['attributes'] : null; - $this->container['statistics'] = isset($data['statistics']) ? $data['statistics'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('emailBlacklisted', $data ?? [], null); + $this->setIfExists('smsBlacklisted', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('modifiedAt', $data ?? [], null); + $this->setIfExists('listIds', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('statistics', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('listUnsubscribed', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; - if ($this->container['email'] === null) { - $invalidProperties[] = "'email' can't be null"; - } if ($this->container['id'] === null) { $invalidProperties[] = "'id' can't be null"; } @@ -274,48 +263,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets email - * - * @return string - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string $email Email address of the contact for which you requested the details - * - * @return $this - */ - public function setEmail($email) - { - $this->container['email'] = $email; - - return $this; - } - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -327,8 +280,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -339,7 +295,7 @@ public function setId($id) * * @return bool */ - public function getEmailBlacklisted() + public function getEmailBlacklisted(): bool { return $this->container['emailBlacklisted']; } @@ -351,8 +307,11 @@ public function getEmailBlacklisted() * * @return $this */ - public function setEmailBlacklisted($emailBlacklisted) + public function setEmailBlacklisted(bool $emailBlacklisted): static { + if (is_null($emailBlacklisted)) { + throw new InvalidArgumentException('non-nullable emailBlacklisted cannot be null'); + } $this->container['emailBlacklisted'] = $emailBlacklisted; return $this; @@ -363,7 +322,7 @@ public function setEmailBlacklisted($emailBlacklisted) * * @return bool */ - public function getSmsBlacklisted() + public function getSmsBlacklisted(): bool { return $this->container['smsBlacklisted']; } @@ -375,8 +334,11 @@ public function getSmsBlacklisted() * * @return $this */ - public function setSmsBlacklisted($smsBlacklisted) + public function setSmsBlacklisted(bool $smsBlacklisted): static { + if (is_null($smsBlacklisted)) { + throw new InvalidArgumentException('non-nullable smsBlacklisted cannot be null'); + } $this->container['smsBlacklisted'] = $smsBlacklisted; return $this; @@ -387,7 +349,7 @@ public function setSmsBlacklisted($smsBlacklisted) * * @return string */ - public function getCreatedAt() + public function getCreatedAt(): string { return $this->container['createdAt']; } @@ -399,8 +361,11 @@ public function getCreatedAt() * * @return $this */ - public function setCreatedAt($createdAt) + public function setCreatedAt(string $createdAt): static { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } $this->container['createdAt'] = $createdAt; return $this; @@ -411,7 +376,7 @@ public function setCreatedAt($createdAt) * * @return string */ - public function getModifiedAt() + public function getModifiedAt(): string { return $this->container['modifiedAt']; } @@ -423,8 +388,11 @@ public function getModifiedAt() * * @return $this */ - public function setModifiedAt($modifiedAt) + public function setModifiedAt(string $modifiedAt): static { + if (is_null($modifiedAt)) { + throw new InvalidArgumentException('non-nullable modifiedAt cannot be null'); + } $this->container['modifiedAt'] = $modifiedAt; return $this; @@ -435,7 +403,7 @@ public function setModifiedAt($modifiedAt) * * @return int[] */ - public function getListIds() + public function getListIds(): array { return $this->container['listIds']; } @@ -447,43 +415,22 @@ public function getListIds() * * @return $this */ - public function setListIds($listIds) + public function setListIds(array $listIds): static { + if (is_null($listIds)) { + throw new InvalidArgumentException('non-nullable listIds cannot be null'); + } $this->container['listIds'] = $listIds; return $this; } - /** - * Gets listUnsubscribed - * - * @return int[] - */ - public function getListUnsubscribed() - { - return $this->container['listUnsubscribed']; - } - - /** - * Sets listUnsubscribed - * - * @param int[] $listUnsubscribed listUnsubscribed - * - * @return $this - */ - public function setListUnsubscribed($listUnsubscribed) - { - $this->container['listUnsubscribed'] = $listUnsubscribed; - - return $this; - } - /** * Gets attributes * * @return object */ - public function getAttributes() + public function getAttributes(): object { return $this->container['attributes']; } @@ -495,8 +442,11 @@ public function getAttributes() * * @return $this */ - public function setAttributes($attributes) + public function setAttributes(object $attributes): static { + if (is_null($attributes)) { + throw new InvalidArgumentException('non-nullable attributes cannot be null'); + } $this->container['attributes'] = $attributes; return $this; @@ -505,9 +455,9 @@ public function setAttributes($attributes) /** * Gets statistics * - * @return \Brevo\Client\Models\GetExtendedContactDetailsStatistics + * @return \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatistics */ - public function getStatistics() + public function getStatistics(): \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatistics { return $this->container['statistics']; } @@ -515,88 +465,72 @@ public function getStatistics() /** * Sets statistics * - * @param \Brevo\Client\Models\GetExtendedContactDetailsStatistics $statistics statistics + * @param \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatistics $statistics statistics * * @return $this */ - public function setStatistics($statistics) + public function setStatistics(\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatistics $statistics): static { + if (is_null($statistics)) { + throw new InvalidArgumentException('non-nullable statistics cannot be null'); + } $this->container['statistics'] = $statistics; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } /** - * Gets offset. - * - * @param integer $offset Offset + * Gets email * - * @return mixed + * @return string|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function getEmail(): ?string { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container['email']; } /** - * Sets value based on offset. + * Sets email * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param string|null $email Email address of the contact for which you requested the details * - * @return void + * @return $this */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function setEmail(?string $email): static { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); } + $this->container['email'] = $email; + + return $this; } /** - * Unsets offset. - * - * @param integer $offset Offset + * Gets listUnsubscribed * - * @return void + * @return int[]|null */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) + public function getListUnsubscribed(): ?array { - unset($this->container[$offset]); + return $this->container['listUnsubscribed']; } /** - * Gets the string presentation of the object + * Sets listUnsubscribed * - * @return string + * @param int[]|null $listUnsubscribed listUnsubscribed + * + * @return $this */ - public function __toString() + public function setListUnsubscribed(?array $listUnsubscribed): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($listUnsubscribed)) { + throw new InvalidArgumentException('non-nullable listUnsubscribed cannot be null'); } + $this->container['listUnsubscribed'] = $listUnsubscribed; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/GetExtendedContactDetailsAllOfStatistics.php b/lib/Models/GetExtendedContactDetailsAllOfStatistics.php new file mode 100644 index 0000000..bd6373c --- /dev/null +++ b/lib/Models/GetExtendedContactDetailsAllOfStatistics.php @@ -0,0 +1,480 @@ + + */ +class GetExtendedContactDetailsAllOfStatistics extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getExtendedContactDetails_allOf_statistics'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'messagesSent' => '\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]', + 'hardBounces' => '\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]', + 'softBounces' => '\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]', + 'complaints' => '\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]', + 'unsubscriptions' => '\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptions', + 'opened' => '\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsOpened[]', + 'clicked' => '\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsClicked[]', + 'transacAttributes' => 'object[]', + 'delivered' => '\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'messagesSent' => null, + 'hardBounces' => null, + 'softBounces' => null, + 'complaints' => null, + 'unsubscriptions' => null, + 'opened' => null, + 'clicked' => null, + 'transacAttributes' => null, + 'delivered' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'messagesSent' => false, + 'hardBounces' => false, + 'softBounces' => false, + 'complaints' => false, + 'unsubscriptions' => false, + 'opened' => false, + 'clicked' => false, + 'transacAttributes' => false, + 'delivered' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'messagesSent' => 'messagesSent', + 'hardBounces' => 'hardBounces', + 'softBounces' => 'softBounces', + 'complaints' => 'complaints', + 'unsubscriptions' => 'unsubscriptions', + 'opened' => 'opened', + 'clicked' => 'clicked', + 'transacAttributes' => 'transacAttributes', + 'delivered' => 'delivered' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'messagesSent' => 'setMessagesSent', + 'hardBounces' => 'setHardBounces', + 'softBounces' => 'setSoftBounces', + 'complaints' => 'setComplaints', + 'unsubscriptions' => 'setUnsubscriptions', + 'opened' => 'setOpened', + 'clicked' => 'setClicked', + 'transacAttributes' => 'setTransacAttributes', + 'delivered' => 'setDelivered' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'messagesSent' => 'getMessagesSent', + 'hardBounces' => 'getHardBounces', + 'softBounces' => 'getSoftBounces', + 'complaints' => 'getComplaints', + 'unsubscriptions' => 'getUnsubscriptions', + 'opened' => 'getOpened', + 'clicked' => 'getClicked', + 'transacAttributes' => 'getTransacAttributes', + 'delivered' => 'getDelivered' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('messagesSent', $data ?? [], null); + $this->setIfExists('hardBounces', $data ?? [], null); + $this->setIfExists('softBounces', $data ?? [], null); + $this->setIfExists('complaints', $data ?? [], null); + $this->setIfExists('unsubscriptions', $data ?? [], null); + $this->setIfExists('opened', $data ?? [], null); + $this->setIfExists('clicked', $data ?? [], null); + $this->setIfExists('transacAttributes', $data ?? [], null); + $this->setIfExists('delivered', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets messagesSent + * + * @return \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]|null + */ + public function getMessagesSent(): ?array + { + return $this->container['messagesSent']; + } + + /** + * Sets messagesSent + * + * @param \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]|null $messagesSent Listing of the sent campaign for the contact + * + * @return $this + */ + public function setMessagesSent(?array $messagesSent): static + { + if (is_null($messagesSent)) { + throw new InvalidArgumentException('non-nullable messagesSent cannot be null'); + } + $this->container['messagesSent'] = $messagesSent; + + return $this; + } + + /** + * Gets hardBounces + * + * @return \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]|null + */ + public function getHardBounces(): ?array + { + return $this->container['hardBounces']; + } + + /** + * Sets hardBounces + * + * @param \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]|null $hardBounces Listing of the hardbounes generated by the contact + * + * @return $this + */ + public function setHardBounces(?array $hardBounces): static + { + if (is_null($hardBounces)) { + throw new InvalidArgumentException('non-nullable hardBounces cannot be null'); + } + $this->container['hardBounces'] = $hardBounces; + + return $this; + } + + /** + * Gets softBounces + * + * @return \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]|null + */ + public function getSoftBounces(): ?array + { + return $this->container['softBounces']; + } + + /** + * Sets softBounces + * + * @param \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]|null $softBounces Listing of the softbounes generated by the contact + * + * @return $this + */ + public function setSoftBounces(?array $softBounces): static + { + if (is_null($softBounces)) { + throw new InvalidArgumentException('non-nullable softBounces cannot be null'); + } + $this->container['softBounces'] = $softBounces; + + return $this; + } + + /** + * Gets complaints + * + * @return \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]|null + */ + public function getComplaints(): ?array + { + return $this->container['complaints']; + } + + /** + * Sets complaints + * + * @param \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]|null $complaints Listing of the complaints generated by the contact + * + * @return $this + */ + public function setComplaints(?array $complaints): static + { + if (is_null($complaints)) { + throw new InvalidArgumentException('non-nullable complaints cannot be null'); + } + $this->container['complaints'] = $complaints; + + return $this; + } + + /** + * Gets unsubscriptions + * + * @return \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptions|null + */ + public function getUnsubscriptions(): ?\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptions + { + return $this->container['unsubscriptions']; + } + + /** + * Sets unsubscriptions + * + * @param \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptions|null $unsubscriptions unsubscriptions + * + * @return $this + */ + public function setUnsubscriptions(?\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptions $unsubscriptions): static + { + if (is_null($unsubscriptions)) { + throw new InvalidArgumentException('non-nullable unsubscriptions cannot be null'); + } + $this->container['unsubscriptions'] = $unsubscriptions; + + return $this; + } + + /** + * Gets opened + * + * @return \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsOpened[]|null + */ + public function getOpened(): ?array + { + return $this->container['opened']; + } + + /** + * Sets opened + * + * @param \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsOpened[]|null $opened Listing of the openings generated by the contact + * + * @return $this + */ + public function setOpened(?array $opened): static + { + if (is_null($opened)) { + throw new InvalidArgumentException('non-nullable opened cannot be null'); + } + $this->container['opened'] = $opened; + + return $this; + } + + /** + * Gets clicked + * + * @return \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsClicked[]|null + */ + public function getClicked(): ?array + { + return $this->container['clicked']; + } + + /** + * Sets clicked + * + * @param \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsClicked[]|null $clicked Listing of the clicks generated by the contact + * + * @return $this + */ + public function setClicked(?array $clicked): static + { + if (is_null($clicked)) { + throw new InvalidArgumentException('non-nullable clicked cannot be null'); + } + $this->container['clicked'] = $clicked; + + return $this; + } + + /** + * Gets transacAttributes + * + * @return object[]|null + */ + public function getTransacAttributes(): ?array + { + return $this->container['transacAttributes']; + } + + /** + * Sets transacAttributes + * + * @param object[]|null $transacAttributes Listing of the transactional attributes for the contact + * + * @return $this + */ + public function setTransacAttributes(?array $transacAttributes): static + { + if (is_null($transacAttributes)) { + throw new InvalidArgumentException('non-nullable transacAttributes cannot be null'); + } + $this->container['transacAttributes'] = $transacAttributes; + + return $this; + } + + /** + * Gets delivered + * + * @return \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]|null + */ + public function getDelivered(): ?array + { + return $this->container['delivered']; + } + + /** + * Sets delivered + * + * @param \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsMessagesSent[]|null $delivered Listing of the delivered campaign for the contact + * + * @return $this + */ + public function setDelivered(?array $delivered): static + { + if (is_null($delivered)) { + throw new InvalidArgumentException('non-nullable delivered cannot be null'); + } + $this->container['delivered'] = $delivered; + + return $this; + } +} + + diff --git a/lib/Models/GetExtendedContactDetailsAllOfStatisticsClicked.php b/lib/Models/GetExtendedContactDetailsAllOfStatisticsClicked.php new file mode 100644 index 0000000..8fafe6f --- /dev/null +++ b/lib/Models/GetExtendedContactDetailsAllOfStatisticsClicked.php @@ -0,0 +1,247 @@ + + */ +class GetExtendedContactDetailsAllOfStatisticsClicked extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getExtendedContactDetails_allOf_statistics_clicked'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'campaignId' => 'int', + 'links' => '\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsLinks[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'campaignId' => 'int64', + 'links' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'campaignId' => false, + 'links' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'campaignId' => 'campaignId', + 'links' => 'links' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'campaignId' => 'setCampaignId', + 'links' => 'setLinks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'campaignId' => 'getCampaignId', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['campaignId'] === null) { + $invalidProperties[] = "'campaignId' can't be null"; + } + if ($this->container['links'] === null) { + $invalidProperties[] = "'links' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets campaignId + * + * @return int + */ + public function getCampaignId(): int + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param int $campaignId ID of the campaign which generated the event + * + * @return $this + */ + public function setCampaignId(int $campaignId): static + { + if (is_null($campaignId)) { + throw new InvalidArgumentException('non-nullable campaignId cannot be null'); + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets links + * + * @return \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsLinks[] + */ + public function getLinks(): array + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsLinks[] $links Listing of the clicked links for the campaign + * + * @return $this + */ + public function setLinks(array $links): static + { + if (is_null($links)) { + throw new InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } +} + + diff --git a/lib/Models/GetExtendedContactDetailsStatisticsLinks.php b/lib/Models/GetExtendedContactDetailsAllOfStatisticsLinks.php similarity index 50% rename from lib/Models/GetExtendedContactDetailsStatisticsLinks.php rename to lib/Models/GetExtendedContactDetailsAllOfStatisticsLinks.php index 7aa2a6b..0fadf51 100644 --- a/lib/Models/GetExtendedContactDetailsStatisticsLinks.php +++ b/lib/Models/GetExtendedContactDetailsAllOfStatisticsLinks.php @@ -1,62 +1,64 @@ */ -class GetExtendedContactDetailsStatisticsLinks implements ModelInterface, ArrayAccess +class GetExtendedContactDetailsAllOfStatisticsLinks extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getExtendedContactDetails_statistics_links'; + protected static string $openAPIModelName = 'getExtendedContactDetails_allOf_statistics_links'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'count' => 'int', 'eventTime' => 'string', 'ip' => 'string', @@ -66,9 +68,9 @@ class GetExtendedContactDetailsStatisticsLinks implements ModelInterface, ArrayA /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'count' => 'int64', 'eventTime' => null, 'ip' => null, @@ -76,32 +78,31 @@ class GetExtendedContactDetailsStatisticsLinks implements ModelInterface, ArrayA ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'count' => false, + 'eventTime' => false, + 'ip' => false, + 'url' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'count' => 'count', 'eventTime' => 'eventTime', 'ip' => 'ip', @@ -111,9 +112,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'count' => 'setCount', 'eventTime' => 'setEventTime', 'ip' => 'setIp', @@ -123,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'count' => 'getCount', 'eventTime' => 'getEventTime', 'ip' => 'getIp', @@ -136,9 +137,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +147,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,54 +157,40 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['count'] = isset($data['count']) ? $data['count'] : null; - $this->container['eventTime'] = isset($data['eventTime']) ? $data['eventTime'] : null; - $this->container['ip'] = isset($data['ip']) ? $data['ip'] : null; - $this->container['url'] = isset($data['url']) ? $data['url'] : null; + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('eventTime', $data ?? [], null); + $this->setIfExists('ip', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -222,24 +209,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets count * * @return int */ - public function getCount() + public function getCount(): int { return $this->container['count']; } @@ -251,8 +226,11 @@ public function getCount() * * @return $this */ - public function setCount($count) + public function setCount(int $count): static { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } $this->container['count'] = $count; return $this; @@ -263,7 +241,7 @@ public function setCount($count) * * @return string */ - public function getEventTime() + public function getEventTime(): string { return $this->container['eventTime']; } @@ -275,8 +253,11 @@ public function getEventTime() * * @return $this */ - public function setEventTime($eventTime) + public function setEventTime(string $eventTime): static { + if (is_null($eventTime)) { + throw new InvalidArgumentException('non-nullable eventTime cannot be null'); + } $this->container['eventTime'] = $eventTime; return $this; @@ -287,7 +268,7 @@ public function setEventTime($eventTime) * * @return string */ - public function getIp() + public function getIp(): string { return $this->container['ip']; } @@ -299,8 +280,11 @@ public function getIp() * * @return $this */ - public function setIp($ip) + public function setIp(string $ip): static { + if (is_null($ip)) { + throw new InvalidArgumentException('non-nullable ip cannot be null'); + } $this->container['ip'] = $ip; return $this; @@ -311,7 +295,7 @@ public function setIp($ip) * * @return string */ - public function getUrl() + public function getUrl(): string { return $this->container['url']; } @@ -323,85 +307,15 @@ public function getUrl() * * @return $this */ - public function setUrl($url) + public function setUrl(string $url): static { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } $this->container['url'] = $url; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetExtendedContactDetailsAllOfStatisticsMessagesSent.php b/lib/Models/GetExtendedContactDetailsAllOfStatisticsMessagesSent.php new file mode 100644 index 0000000..b605c05 --- /dev/null +++ b/lib/Models/GetExtendedContactDetailsAllOfStatisticsMessagesSent.php @@ -0,0 +1,247 @@ + + */ +class GetExtendedContactDetailsAllOfStatisticsMessagesSent extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getExtendedContactDetails_allOf_statistics_messagesSent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'campaignId' => 'int', + 'eventTime' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'campaignId' => 'int64', + 'eventTime' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'campaignId' => false, + 'eventTime' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'campaignId' => 'campaignId', + 'eventTime' => 'eventTime' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'campaignId' => 'setCampaignId', + 'eventTime' => 'setEventTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'campaignId' => 'getCampaignId', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('eventTime', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['campaignId'] === null) { + $invalidProperties[] = "'campaignId' can't be null"; + } + if ($this->container['eventTime'] === null) { + $invalidProperties[] = "'eventTime' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets campaignId + * + * @return int + */ + public function getCampaignId(): int + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param int $campaignId ID of the campaign which generated the event + * + * @return $this + */ + public function setCampaignId(int $campaignId): static + { + if (is_null($campaignId)) { + throw new InvalidArgumentException('non-nullable campaignId cannot be null'); + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets eventTime + * + * @return string + */ + public function getEventTime(): string + { + return $this->container['eventTime']; + } + + /** + * Sets eventTime + * + * @param string $eventTime UTC date-time of the event + * + * @return $this + */ + public function setEventTime(string $eventTime): static + { + if (is_null($eventTime)) { + throw new InvalidArgumentException('non-nullable eventTime cannot be null'); + } + $this->container['eventTime'] = $eventTime; + + return $this; + } +} + + diff --git a/lib/Models/GetExtendedContactDetailsStatisticsOpened.php b/lib/Models/GetExtendedContactDetailsAllOfStatisticsOpened.php similarity index 51% rename from lib/Models/GetExtendedContactDetailsStatisticsOpened.php rename to lib/Models/GetExtendedContactDetailsAllOfStatisticsOpened.php index f74fb92..f5fa62f 100644 --- a/lib/Models/GetExtendedContactDetailsStatisticsOpened.php +++ b/lib/Models/GetExtendedContactDetailsAllOfStatisticsOpened.php @@ -1,62 +1,64 @@ */ -class GetExtendedContactDetailsStatisticsOpened implements ModelInterface, ArrayAccess +class GetExtendedContactDetailsAllOfStatisticsOpened extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getExtendedContactDetails_statistics_opened'; + protected static string $openAPIModelName = 'getExtendedContactDetails_allOf_statistics_opened'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'campaignId' => 'int', 'count' => 'int', 'eventTime' => 'string', @@ -66,9 +68,9 @@ class GetExtendedContactDetailsStatisticsOpened implements ModelInterface, Array /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'campaignId' => 'int64', 'count' => 'int64', 'eventTime' => null, @@ -76,32 +78,31 @@ class GetExtendedContactDetailsStatisticsOpened implements ModelInterface, Array ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'campaignId' => false, + 'count' => false, + 'eventTime' => false, + 'ip' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'campaignId' => 'campaignId', 'count' => 'count', 'eventTime' => 'eventTime', @@ -111,9 +112,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'campaignId' => 'setCampaignId', 'count' => 'setCount', 'eventTime' => 'setEventTime', @@ -123,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'campaignId' => 'getCampaignId', 'count' => 'getCount', 'eventTime' => 'getEventTime', @@ -136,9 +137,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +147,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,54 +157,40 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['campaignId'] = isset($data['campaignId']) ? $data['campaignId'] : null; - $this->container['count'] = isset($data['count']) ? $data['count'] : null; - $this->container['eventTime'] = isset($data['eventTime']) ? $data['eventTime'] : null; - $this->container['ip'] = isset($data['ip']) ? $data['ip'] : null; + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('eventTime', $data ?? [], null); + $this->setIfExists('ip', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -222,24 +209,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets campaignId * * @return int */ - public function getCampaignId() + public function getCampaignId(): int { return $this->container['campaignId']; } @@ -251,8 +226,11 @@ public function getCampaignId() * * @return $this */ - public function setCampaignId($campaignId) + public function setCampaignId(int $campaignId): static { + if (is_null($campaignId)) { + throw new InvalidArgumentException('non-nullable campaignId cannot be null'); + } $this->container['campaignId'] = $campaignId; return $this; @@ -263,7 +241,7 @@ public function setCampaignId($campaignId) * * @return int */ - public function getCount() + public function getCount(): int { return $this->container['count']; } @@ -275,8 +253,11 @@ public function getCount() * * @return $this */ - public function setCount($count) + public function setCount(int $count): static { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } $this->container['count'] = $count; return $this; @@ -287,7 +268,7 @@ public function setCount($count) * * @return string */ - public function getEventTime() + public function getEventTime(): string { return $this->container['eventTime']; } @@ -299,8 +280,11 @@ public function getEventTime() * * @return $this */ - public function setEventTime($eventTime) + public function setEventTime(string $eventTime): static { + if (is_null($eventTime)) { + throw new InvalidArgumentException('non-nullable eventTime cannot be null'); + } $this->container['eventTime'] = $eventTime; return $this; @@ -311,7 +295,7 @@ public function setEventTime($eventTime) * * @return string */ - public function getIp() + public function getIp(): string { return $this->container['ip']; } @@ -323,85 +307,15 @@ public function getIp() * * @return $this */ - public function setIp($ip) + public function setIp(string $ip): static { + if (is_null($ip)) { + throw new InvalidArgumentException('non-nullable ip cannot be null'); + } $this->container['ip'] = $ip; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetExtendedContactDetailsAllOfStatisticsUnsubscriptions.php b/lib/Models/GetExtendedContactDetailsAllOfStatisticsUnsubscriptions.php new file mode 100644 index 0000000..991fe46 --- /dev/null +++ b/lib/Models/GetExtendedContactDetailsAllOfStatisticsUnsubscriptions.php @@ -0,0 +1,248 @@ + + */ +class GetExtendedContactDetailsAllOfStatisticsUnsubscriptions extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getExtendedContactDetails_allOf_statistics_unsubscriptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'userUnsubscription' => '\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription[]', + 'adminUnsubscription' => '\Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'userUnsubscription' => null, + 'adminUnsubscription' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'userUnsubscription' => false, + 'adminUnsubscription' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'userUnsubscription' => 'userUnsubscription', + 'adminUnsubscription' => 'adminUnsubscription' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'userUnsubscription' => 'setUserUnsubscription', + 'adminUnsubscription' => 'setAdminUnsubscription' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'userUnsubscription' => 'getUserUnsubscription', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('userUnsubscription', $data ?? [], null); + $this->setIfExists('adminUnsubscription', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['userUnsubscription'] === null) { + $invalidProperties[] = "'userUnsubscription' can't be null"; + } + if ($this->container['adminUnsubscription'] === null) { + $invalidProperties[] = "'adminUnsubscription' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets userUnsubscription + * + * @return \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription[] + */ + public function getUserUnsubscription(): array + { + return $this->container['userUnsubscription']; + } + + /** + * Sets userUnsubscription + * + * @param \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription[] $userUnsubscription Contact unsubscribe via unsubscription link in a campaign + * + * @return $this + */ + public function setUserUnsubscription(array $userUnsubscription): static + { + if (is_null($userUnsubscription)) { + throw new InvalidArgumentException('non-nullable userUnsubscription cannot be null'); + } + $this->container['userUnsubscription'] = $userUnsubscription; + + return $this; + } + + /** + * Gets adminUnsubscription + * + * @return \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription[] + */ + public function getAdminUnsubscription(): array + { + return $this->container['adminUnsubscription']; + } + + /** + * Sets adminUnsubscription + * + * @param \Brevo\Client\Models\GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription[] $adminUnsubscription Contact has been unsubscribed from the administrator + * + * @return $this + */ + public function setAdminUnsubscription(array $adminUnsubscription): static + { + if (is_null($adminUnsubscription)) { + throw new InvalidArgumentException('non-nullable adminUnsubscription cannot be null'); + } + $this->container['adminUnsubscription'] = $adminUnsubscription; + + return $this; + } +} + + diff --git a/lib/Models/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription.php b/lib/Models/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription.php new file mode 100644 index 0000000..9cc1ba3 --- /dev/null +++ b/lib/Models/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription.php @@ -0,0 +1,244 @@ + + */ +class GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getExtendedContactDetails_allOf_statistics_unsubscriptions_adminUnsubscription'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'eventTime' => 'string', + 'ip' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'eventTime' => null, + 'ip' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'eventTime' => false, + 'ip' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'eventTime' => 'eventTime', + 'ip' => 'ip' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'eventTime' => 'setEventTime', + 'ip' => 'setIp' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'eventTime' => 'getEventTime', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('eventTime', $data ?? [], null); + $this->setIfExists('ip', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['eventTime'] === null) { + $invalidProperties[] = "'eventTime' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets eventTime + * + * @return string + */ + public function getEventTime(): string + { + return $this->container['eventTime']; + } + + /** + * Sets eventTime + * + * @param string $eventTime UTC date-time of the event + * + * @return $this + */ + public function setEventTime(string $eventTime): static + { + if (is_null($eventTime)) { + throw new InvalidArgumentException('non-nullable eventTime cannot be null'); + } + $this->container['eventTime'] = $eventTime; + + return $this; + } + + /** + * Gets ip + * + * @return string|null + */ + public function getIp(): ?string + { + return $this->container['ip']; + } + + /** + * Sets ip + * + * @param string|null $ip IP from which the user has been unsubscribed + * + * @return $this + */ + public function setIp(?string $ip): static + { + if (is_null($ip)) { + throw new InvalidArgumentException('non-nullable ip cannot be null'); + } + $this->container['ip'] = $ip; + + return $this; + } +} + + diff --git a/lib/Models/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription.php b/lib/Models/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription.php new file mode 100644 index 0000000..5be4fce --- /dev/null +++ b/lib/Models/GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription.php @@ -0,0 +1,281 @@ + + */ +class GetExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getExtendedContactDetails_allOf_statistics_unsubscriptions_userUnsubscription'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'campaignId' => 'int', + 'eventTime' => 'string', + 'ip' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'campaignId' => 'int64', + 'eventTime' => null, + 'ip' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'campaignId' => false, + 'eventTime' => false, + 'ip' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'campaignId' => 'campaignId', + 'eventTime' => 'eventTime', + 'ip' => 'ip' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'campaignId' => 'setCampaignId', + 'eventTime' => 'setEventTime', + 'ip' => 'setIp' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'campaignId' => 'getCampaignId', + 'eventTime' => 'getEventTime', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('eventTime', $data ?? [], null); + $this->setIfExists('ip', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['campaignId'] === null) { + $invalidProperties[] = "'campaignId' can't be null"; + } + if ($this->container['eventTime'] === null) { + $invalidProperties[] = "'eventTime' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets campaignId + * + * @return int + */ + public function getCampaignId(): int + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param int $campaignId ID of the campaign which generated the event + * + * @return $this + */ + public function setCampaignId(int $campaignId): static + { + if (is_null($campaignId)) { + throw new InvalidArgumentException('non-nullable campaignId cannot be null'); + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets eventTime + * + * @return string + */ + public function getEventTime(): string + { + return $this->container['eventTime']; + } + + /** + * Sets eventTime + * + * @param string $eventTime UTC date-time of the event + * + * @return $this + */ + public function setEventTime(string $eventTime): static + { + if (is_null($eventTime)) { + throw new InvalidArgumentException('non-nullable eventTime cannot be null'); + } + $this->container['eventTime'] = $eventTime; + + return $this; + } + + /** + * Gets ip + * + * @return string|null + */ + public function getIp(): ?string + { + return $this->container['ip']; + } + + /** + * Sets ip + * + * @param string|null $ip IP from which the user has unsubscribed + * + * @return $this + */ + public function setIp(?string $ip): static + { + if (is_null($ip)) { + throw new InvalidArgumentException('non-nullable ip cannot be null'); + } + $this->container['ip'] = $ip; + + return $this; + } +} + + diff --git a/lib/Models/GetExtendedContactDetailsStatistics.php b/lib/Models/GetExtendedContactDetailsStatistics.php deleted file mode 100644 index 1a4cabb..0000000 --- a/lib/Models/GetExtendedContactDetailsStatistics.php +++ /dev/null @@ -1,546 +0,0 @@ - '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[]', - 'hardBounces' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[]', - 'softBounces' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[]', - 'complaints' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[]', - 'unsubscriptions' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptions', - 'opened' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsOpened[]', - 'clicked' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsClicked[]', - 'transacAttributes' => 'object[]', - 'delivered' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'messagesSent' => null, - 'hardBounces' => null, - 'softBounces' => null, - 'complaints' => null, - 'unsubscriptions' => null, - 'opened' => null, - 'clicked' => null, - 'transacAttributes' => null, - 'delivered' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'messagesSent' => 'messagesSent', - 'hardBounces' => 'hardBounces', - 'softBounces' => 'softBounces', - 'complaints' => 'complaints', - 'unsubscriptions' => 'unsubscriptions', - 'opened' => 'opened', - 'clicked' => 'clicked', - 'transacAttributes' => 'transacAttributes', - 'delivered' => 'delivered' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'messagesSent' => 'setMessagesSent', - 'hardBounces' => 'setHardBounces', - 'softBounces' => 'setSoftBounces', - 'complaints' => 'setComplaints', - 'unsubscriptions' => 'setUnsubscriptions', - 'opened' => 'setOpened', - 'clicked' => 'setClicked', - 'transacAttributes' => 'setTransacAttributes', - 'delivered' => 'setDelivered' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'messagesSent' => 'getMessagesSent', - 'hardBounces' => 'getHardBounces', - 'softBounces' => 'getSoftBounces', - 'complaints' => 'getComplaints', - 'unsubscriptions' => 'getUnsubscriptions', - 'opened' => 'getOpened', - 'clicked' => 'getClicked', - 'transacAttributes' => 'getTransacAttributes', - 'delivered' => 'getDelivered' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['messagesSent'] = isset($data['messagesSent']) ? $data['messagesSent'] : null; - $this->container['hardBounces'] = isset($data['hardBounces']) ? $data['hardBounces'] : null; - $this->container['softBounces'] = isset($data['softBounces']) ? $data['softBounces'] : null; - $this->container['complaints'] = isset($data['complaints']) ? $data['complaints'] : null; - $this->container['unsubscriptions'] = isset($data['unsubscriptions']) ? $data['unsubscriptions'] : null; - $this->container['opened'] = isset($data['opened']) ? $data['opened'] : null; - $this->container['clicked'] = isset($data['clicked']) ? $data['clicked'] : null; - $this->container['transacAttributes'] = isset($data['transacAttributes']) ? $data['transacAttributes'] : null; - $this->container['delivered'] = isset($data['delivered']) ? $data['delivered'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets messagesSent - * - * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] - */ - public function getMessagesSent() - { - return $this->container['messagesSent']; - } - - /** - * Sets messagesSent - * - * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] $messagesSent Listing of the sent campaign for the contact - * - * @return $this - */ - public function setMessagesSent($messagesSent) - { - $this->container['messagesSent'] = $messagesSent; - - return $this; - } - - /** - * Gets hardBounces - * - * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] - */ - public function getHardBounces() - { - return $this->container['hardBounces']; - } - - /** - * Sets hardBounces - * - * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] $hardBounces Listing of the hardbounes generated by the contact - * - * @return $this - */ - public function setHardBounces($hardBounces) - { - $this->container['hardBounces'] = $hardBounces; - - return $this; - } - - /** - * Gets softBounces - * - * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] - */ - public function getSoftBounces() - { - return $this->container['softBounces']; - } - - /** - * Sets softBounces - * - * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] $softBounces Listing of the softbounes generated by the contact - * - * @return $this - */ - public function setSoftBounces($softBounces) - { - $this->container['softBounces'] = $softBounces; - - return $this; - } - - /** - * Gets complaints - * - * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] - */ - public function getComplaints() - { - return $this->container['complaints']; - } - - /** - * Sets complaints - * - * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] $complaints Listing of the complaints generated by the contact - * - * @return $this - */ - public function setComplaints($complaints) - { - $this->container['complaints'] = $complaints; - - return $this; - } - - /** - * Gets unsubscriptions - * - * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptions - */ - public function getUnsubscriptions() - { - return $this->container['unsubscriptions']; - } - - /** - * Sets unsubscriptions - * - * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptions $unsubscriptions unsubscriptions - * - * @return $this - */ - public function setUnsubscriptions($unsubscriptions) - { - $this->container['unsubscriptions'] = $unsubscriptions; - - return $this; - } - - /** - * Gets opened - * - * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsOpened[] - */ - public function getOpened() - { - return $this->container['opened']; - } - - /** - * Sets opened - * - * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsOpened[] $opened Listing of the openings generated by the contact - * - * @return $this - */ - public function setOpened($opened) - { - $this->container['opened'] = $opened; - - return $this; - } - - /** - * Gets clicked - * - * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsClicked[] - */ - public function getClicked() - { - return $this->container['clicked']; - } - - /** - * Sets clicked - * - * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsClicked[] $clicked Listing of the clicks generated by the contact - * - * @return $this - */ - public function setClicked($clicked) - { - $this->container['clicked'] = $clicked; - - return $this; - } - - /** - * Gets transacAttributes - * - * @return object[] - */ - public function getTransacAttributes() - { - return $this->container['transacAttributes']; - } - - /** - * Sets transacAttributes - * - * @param object[] $transacAttributes Listing of the transactional attributes for the contact - * - * @return $this - */ - public function setTransacAttributes($transacAttributes) - { - $this->container['transacAttributes'] = $transacAttributes; - - return $this; - } - - /** - * Gets delivered - * - * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] - */ - public function getDelivered() - { - return $this->container['delivered']; - } - - /** - * Sets delivered - * - * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsMessagesSent[] $delivered Listing of the delivered campaign for the contact - * - * @return $this - */ - public function setDelivered($delivered) - { - $this->container['delivered'] = $delivered; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetExtendedContactDetailsStatisticsClicked.php b/lib/Models/GetExtendedContactDetailsStatisticsClicked.php deleted file mode 100644 index 5984d9a..0000000 --- a/lib/Models/GetExtendedContactDetailsStatisticsClicked.php +++ /dev/null @@ -1,341 +0,0 @@ - 'int', - 'links' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsLinks[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'campaignId' => 'int64', - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'campaignId' => 'campaignId', - 'links' => 'links' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'campaignId' => 'setCampaignId', - 'links' => 'setLinks' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'campaignId' => 'getCampaignId', - '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 - */ - public function __construct(array $data = null) - { - $this->container['campaignId'] = isset($data['campaignId']) ? $data['campaignId'] : null; - $this->container['links'] = isset($data['links']) ? $data['links'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['campaignId'] === null) { - $invalidProperties[] = "'campaignId' can't be null"; - } - if ($this->container['links'] === null) { - $invalidProperties[] = "'links' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets campaignId - * - * @return int - */ - public function getCampaignId() - { - return $this->container['campaignId']; - } - - /** - * Sets campaignId - * - * @param int $campaignId ID of the campaign which generated the event - * - * @return $this - */ - public function setCampaignId($campaignId) - { - $this->container['campaignId'] = $campaignId; - - return $this; - } - - /** - * Gets links - * - * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsLinks[] - */ - public function getLinks() - { - return $this->container['links']; - } - - /** - * Sets links - * - * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsLinks[] $links Listing of the clicked links for the campaign - * - * @return $this - */ - public function setLinks($links) - { - $this->container['links'] = $links; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetExtendedContactDetailsStatisticsDelivered.php b/lib/Models/GetExtendedContactDetailsStatisticsDelivered.php deleted file mode 100644 index 217aab4..0000000 --- a/lib/Models/GetExtendedContactDetailsStatisticsDelivered.php +++ /dev/null @@ -1,337 +0,0 @@ - 'int', - 'eventTime' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'campaignId' => 'int64', - 'eventTime' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'campaignId' => 'campaignId', - 'eventTime' => 'eventTime' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'campaignId' => 'setCampaignId', - 'eventTime' => 'setEventTime' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'campaignId' => 'getCampaignId', - '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 - */ - public function __construct(array $data = null) - { - $this->container['campaignId'] = isset($data['campaignId']) ? $data['campaignId'] : null; - $this->container['eventTime'] = isset($data['eventTime']) ? $data['eventTime'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['campaignId'] === null) { - $invalidProperties[] = "'campaignId' can't be null"; - } - if ($this->container['eventTime'] === null) { - $invalidProperties[] = "'eventTime' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets campaignId - * - * @return int - */ - public function getCampaignId() - { - return $this->container['campaignId']; - } - - /** - * Sets campaignId - * - * @param int $campaignId ID of the campaign which generated the event - * - * @return $this - */ - public function setCampaignId($campaignId) - { - $this->container['campaignId'] = $campaignId; - - return $this; - } - - /** - * Gets eventTime - * - * @return string - */ - public function getEventTime() - { - return $this->container['eventTime']; - } - - /** - * Sets eventTime - * - * @param string $eventTime UTC date-time of the event - * - * @return $this - */ - public function setEventTime($eventTime) - { - $this->container['eventTime'] = $eventTime; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetExtendedContactDetailsStatisticsMessagesSent.php b/lib/Models/GetExtendedContactDetailsStatisticsMessagesSent.php deleted file mode 100644 index 3ff5187..0000000 --- a/lib/Models/GetExtendedContactDetailsStatisticsMessagesSent.php +++ /dev/null @@ -1,341 +0,0 @@ - 'int', - 'eventTime' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'campaignId' => 'int64', - 'eventTime' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'campaignId' => 'campaignId', - 'eventTime' => 'eventTime' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'campaignId' => 'setCampaignId', - 'eventTime' => 'setEventTime' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'campaignId' => 'getCampaignId', - '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 - */ - public function __construct(array $data = null) - { - $this->container['campaignId'] = isset($data['campaignId']) ? $data['campaignId'] : null; - $this->container['eventTime'] = isset($data['eventTime']) ? $data['eventTime'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['campaignId'] === null) { - $invalidProperties[] = "'campaignId' can't be null"; - } - if ($this->container['eventTime'] === null) { - $invalidProperties[] = "'eventTime' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets campaignId - * - * @return int - */ - public function getCampaignId() - { - return $this->container['campaignId']; - } - - /** - * Sets campaignId - * - * @param int $campaignId ID of the campaign which generated the event - * - * @return $this - */ - public function setCampaignId($campaignId) - { - $this->container['campaignId'] = $campaignId; - - return $this; - } - - /** - * Gets eventTime - * - * @return string - */ - public function getEventTime() - { - return $this->container['eventTime']; - } - - /** - * Sets eventTime - * - * @param string $eventTime UTC date-time of the event - * - * @return $this - */ - public function setEventTime($eventTime) - { - $this->container['eventTime'] = $eventTime; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetExtendedContactDetailsStatisticsUnsubscriptions.php b/lib/Models/GetExtendedContactDetailsStatisticsUnsubscriptions.php deleted file mode 100644 index faa096e..0000000 --- a/lib/Models/GetExtendedContactDetailsStatisticsUnsubscriptions.php +++ /dev/null @@ -1,342 +0,0 @@ - '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[]', - 'adminUnsubscription' => '\Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'userUnsubscription' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'userUnsubscription' => 'userUnsubscription', - 'adminUnsubscription' => 'adminUnsubscription' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'userUnsubscription' => 'setUserUnsubscription', - 'adminUnsubscription' => 'setAdminUnsubscription' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'userUnsubscription' => 'getUserUnsubscription', - '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 - */ - public function __construct(array $data = null) - { - $this->container['userUnsubscription'] = isset($data['userUnsubscription']) ? $data['userUnsubscription'] : null; - $this->container['adminUnsubscription'] = isset($data['adminUnsubscription']) ? $data['adminUnsubscription'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['userUnsubscription'] === null) { - $invalidProperties[] = "'userUnsubscription' can't be null"; - } - if ($this->container['adminUnsubscription'] === null) { - $invalidProperties[] = "'adminUnsubscription' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets userUnsubscription - * - * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[] - */ - public function getUserUnsubscription() - { - return $this->container['userUnsubscription']; - } - - /** - * Sets userUnsubscription - * - * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[] $userUnsubscription Contact unsubscribe via unsubscription link in a campaign - * - * @return $this - */ - public function setUserUnsubscription($userUnsubscription) - { - $this->container['userUnsubscription'] = $userUnsubscription; - - return $this; - } - - /** - * Gets adminUnsubscription - * - * @return \Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[] - */ - public function getAdminUnsubscription() - { - return $this->container['adminUnsubscription']; - } - - /** - * Sets adminUnsubscription - * - * @param \Brevo\Client\Models\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[] $adminUnsubscription Contact has been unsubscribed from the administrator - * - * @return $this - */ - public function setAdminUnsubscription($adminUnsubscription) - { - $this->container['adminUnsubscription'] = $adminUnsubscription; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.php b/lib/Models/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.php deleted file mode 100644 index 32688a2..0000000 --- a/lib/Models/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.php +++ /dev/null @@ -1,338 +0,0 @@ - 'string', - 'ip' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'eventTime' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'eventTime' => 'eventTime', - 'ip' => 'ip' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'eventTime' => 'setEventTime', - 'ip' => 'setIp' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'eventTime' => 'getEventTime', - '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 - */ - public function __construct(array $data = null) - { - $this->container['eventTime'] = isset($data['eventTime']) ? $data['eventTime'] : null; - $this->container['ip'] = isset($data['ip']) ? $data['ip'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['eventTime'] === null) { - $invalidProperties[] = "'eventTime' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets eventTime - * - * @return string - */ - public function getEventTime() - { - return $this->container['eventTime']; - } - - /** - * Sets eventTime - * - * @param string $eventTime UTC date-time of the event - * - * @return $this - */ - public function setEventTime($eventTime) - { - $this->container['eventTime'] = $eventTime; - - return $this; - } - - /** - * Gets ip - * - * @return string - */ - public function getIp() - { - return $this->container['ip']; - } - - /** - * Sets ip - * - * @param string $ip IP from which the user has been unsubscribed - * - * @return $this - */ - public function setIp($ip) - { - $this->container['ip'] = $ip; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.php b/lib/Models/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.php deleted file mode 100644 index 16f28c2..0000000 --- a/lib/Models/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.php +++ /dev/null @@ -1,371 +0,0 @@ - 'int', - 'eventTime' => 'string', - 'ip' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'campaignId' => 'int64', - 'eventTime' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'campaignId' => 'campaignId', - 'eventTime' => 'eventTime', - 'ip' => 'ip' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'campaignId' => 'setCampaignId', - 'eventTime' => 'setEventTime', - 'ip' => 'setIp' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'campaignId' => 'getCampaignId', - 'eventTime' => 'getEventTime', - '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 - */ - public function __construct(array $data = null) - { - $this->container['campaignId'] = isset($data['campaignId']) ? $data['campaignId'] : null; - $this->container['eventTime'] = isset($data['eventTime']) ? $data['eventTime'] : null; - $this->container['ip'] = isset($data['ip']) ? $data['ip'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['campaignId'] === null) { - $invalidProperties[] = "'campaignId' can't be null"; - } - if ($this->container['eventTime'] === null) { - $invalidProperties[] = "'eventTime' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets campaignId - * - * @return int - */ - public function getCampaignId() - { - return $this->container['campaignId']; - } - - /** - * Sets campaignId - * - * @param int $campaignId ID of the campaign which generated the event - * - * @return $this - */ - public function setCampaignId($campaignId) - { - $this->container['campaignId'] = $campaignId; - - return $this; - } - - /** - * Gets eventTime - * - * @return string - */ - public function getEventTime() - { - return $this->container['eventTime']; - } - - /** - * Sets eventTime - * - * @param string $eventTime UTC date-time of the event - * - * @return $this - */ - public function setEventTime($eventTime) - { - $this->container['eventTime'] = $eventTime; - - return $this; - } - - /** - * Gets ip - * - * @return string - */ - public function getIp() - { - return $this->container['ip']; - } - - /** - * Sets ip - * - * @param string $ip IP from which the user has unsubscribed - * - * @return $this - */ - public function setIp($ip) - { - $this->container['ip'] = $ip; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetExtendedList.php b/lib/Models/GetExtendedList.php index 2f5c253..067124a 100644 --- a/lib/Models/GetExtendedList.php +++ b/lib/Models/GetExtendedList.php @@ -2,71 +2,85 @@ /** * GetExtendedList * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \Brevo\Client\ObjectSerializer; + +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetExtendedList Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetExtendedList extends GetList +class GetExtendedList extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getExtendedList'; + protected static string $openAPIModelName = 'getExtendedList'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ + 'id' => 'int', + 'name' => 'string', + 'totalBlacklisted' => 'int', + 'totalSubscribers' => 'int', + 'uniqueSubscribers' => 'int', 'folderId' => 'int', 'createdAt' => 'string', - 'campaignStats' => '\Brevo\Client\Models\GetExtendedListCampaignStats[]', + 'campaignStats' => '\Brevo\Client\Models\GetExtendedListAllOfCampaignStats[]', 'dynamicList' => 'bool' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ + 'id' => 'int64', + 'name' => null, + 'totalBlacklisted' => 'int64', + 'totalSubscribers' => 'int64', + 'uniqueSubscribers' => 'int64', 'folderId' => 'int64', 'createdAt' => null, 'campaignStats' => null, @@ -74,32 +88,41 @@ class GetExtendedList extends GetList ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes + parent::swaggerTypes(); - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'totalBlacklisted' => false, + 'totalSubscribers' => false, + 'uniqueSubscribers' => false, + 'folderId' => false, + 'createdAt' => false, + 'campaignStats' => false, + 'dynamicList' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats + parent::swaggerFormats(); - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'totalBlacklisted' => 'totalBlacklisted', + 'totalSubscribers' => 'totalSubscribers', + 'uniqueSubscribers' => 'uniqueSubscribers', 'folderId' => 'folderId', 'createdAt' => 'createdAt', 'campaignStats' => 'campaignStats', @@ -109,9 +132,14 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'totalBlacklisted' => 'setTotalBlacklisted', + 'totalSubscribers' => 'setTotalSubscribers', + 'uniqueSubscribers' => 'setUniqueSubscribers', 'folderId' => 'setFolderId', 'createdAt' => 'setCreatedAt', 'campaignStats' => 'setCampaignStats', @@ -121,9 +149,14 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'totalBlacklisted' => 'getTotalBlacklisted', + 'totalSubscribers' => 'getTotalSubscribers', + 'uniqueSubscribers' => 'getUniqueSubscribers', 'folderId' => 'getFolderId', 'createdAt' => 'getCreatedAt', 'campaignStats' => 'getCampaignStats', @@ -134,73 +167,83 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { - return parent::attributeMap() + self::$attributeMap; + return self::$attributeMap; } /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { - return parent::setters() + self::$setters; + return self::$setters; } /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { - return parent::getters() + self::$getters; + return self::$getters; } + /** - * The original name of the model. + * Associative array for storing property values * - * @return string + * @var array */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - parent::__construct($data); - - $this->container['folderId'] = isset($data['folderId']) ? $data['folderId'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['campaignStats'] = isset($data['campaignStats']) ? $data['campaignStats'] : null; - $this->container['dynamicList'] = isset($data['dynamicList']) ? $data['dynamicList'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('totalBlacklisted', $data ?? [], null); + $this->setIfExists('totalSubscribers', $data ?? [], null); + $this->setIfExists('uniqueSubscribers', $data ?? [], null); + $this->setIfExists('folderId', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('campaignStats', $data ?? [], null); + $this->setIfExists('dynamicList', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { - $invalidProperties = parent::listInvalidProperties(); + $invalidProperties = []; + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['totalBlacklisted'] === null) { + $invalidProperties[] = "'totalBlacklisted' can't be null"; + } + if ($this->container['totalSubscribers'] === null) { + $invalidProperties[] = "'totalSubscribers' can't be null"; + } + if ($this->container['uniqueSubscribers'] === null) { + $invalidProperties[] = "'uniqueSubscribers' can't be null"; + } if ($this->container['folderId'] === null) { $invalidProperties[] = "'folderId' can't be null"; } @@ -211,184 +254,246 @@ public function listInvalidProperties() } /** - * Validate all the properties in the model - * return true if all passed + * Gets id * - * @return bool True if all properties are valid + * @return int */ - public function valid() + public function getId(): int { - return count($this->listInvalidProperties()) === 0; + return $this->container['id']; } + /** + * Sets id + * + * @param int $id ID of the list + * + * @return $this + */ + public function setId(int $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } /** - * Gets folderId + * Gets name * - * @return int + * @return string */ - public function getFolderId() + public function getName(): string { - return $this->container['folderId']; + return $this->container['name']; } /** - * Sets folderId + * Sets name * - * @param int $folderId ID of the folder + * @param string $name Name of the list * * @return $this */ - public function setFolderId($folderId) + public function setName(string $name): static { - $this->container['folderId'] = $folderId; + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; return $this; } /** - * Gets createdAt + * Gets totalBlacklisted * - * @return string + * @return int */ - public function getCreatedAt() + public function getTotalBlacklisted(): int { - return $this->container['createdAt']; + return $this->container['totalBlacklisted']; } /** - * Sets createdAt + * Sets totalBlacklisted * - * @param string $createdAt Creation UTC date-time of the list (YYYY-MM-DDTHH:mm:ss.SSSZ) + * @param int $totalBlacklisted Number of blacklisted contacts in the list * * @return $this */ - public function setCreatedAt($createdAt) + public function setTotalBlacklisted(int $totalBlacklisted): static { - $this->container['createdAt'] = $createdAt; + if (is_null($totalBlacklisted)) { + throw new InvalidArgumentException('non-nullable totalBlacklisted cannot be null'); + } + $this->container['totalBlacklisted'] = $totalBlacklisted; return $this; } /** - * Gets campaignStats + * Gets totalSubscribers * - * @return \Brevo\Client\Models\GetExtendedListCampaignStats[] + * @return int */ - public function getCampaignStats() + public function getTotalSubscribers(): int { - return $this->container['campaignStats']; + return $this->container['totalSubscribers']; } /** - * Sets campaignStats + * Sets totalSubscribers * - * @param \Brevo\Client\Models\GetExtendedListCampaignStats[] $campaignStats campaignStats + * @param int $totalSubscribers Number of contacts in the list * * @return $this */ - public function setCampaignStats($campaignStats) + public function setTotalSubscribers(int $totalSubscribers): static { - $this->container['campaignStats'] = $campaignStats; + if (is_null($totalSubscribers)) { + throw new InvalidArgumentException('non-nullable totalSubscribers cannot be null'); + } + $this->container['totalSubscribers'] = $totalSubscribers; return $this; } /** - * Gets dynamicList + * Gets uniqueSubscribers * - * @return bool + * @return int */ - public function getDynamicList() + public function getUniqueSubscribers(): int { - return $this->container['dynamicList']; + return $this->container['uniqueSubscribers']; } /** - * Sets dynamicList + * Sets uniqueSubscribers * - * @param bool $dynamicList Status telling if the list is dynamic or not (true=dynamic, false=not dynamic) + * @param int $uniqueSubscribers Number of unique contacts in the list * * @return $this */ - public function setDynamicList($dynamicList) + public function setUniqueSubscribers(int $uniqueSubscribers): static { - $this->container['dynamicList'] = $dynamicList; + if (is_null($uniqueSubscribers)) { + throw new InvalidArgumentException('non-nullable uniqueSubscribers cannot be null'); + } + $this->container['uniqueSubscribers'] = $uniqueSubscribers; return $this; } + /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset + * Gets folderId * - * @return boolean + * @return int */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) + public function getFolderId(): int { - return isset($this->container[$offset]); + return $this->container['folderId']; } /** - * Gets offset. + * Sets folderId * - * @param integer $offset Offset + * @param int $folderId ID of the folder * - * @return mixed + * @return $this */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function setFolderId(int $folderId): static { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + if (is_null($folderId)) { + throw new InvalidArgumentException('non-nullable folderId cannot be null'); + } + $this->container['folderId'] = $folderId; + + return $this; } /** - * Sets value based on offset. + * Gets createdAt * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @return string + */ + public function getCreatedAt(): string + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt * - * @return void + * @param string $createdAt Creation UTC date-time of the list (YYYY-MM-DDTHH:mm:ss.SSSZ) + * + * @return $this */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function setCreatedAt(string $createdAt): static { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); } + $this->container['createdAt'] = $createdAt; + + return $this; } /** - * Unsets offset. + * Gets campaignStats * - * @param integer $offset Offset + * @return \Brevo\Client\Models\GetExtendedListAllOfCampaignStats[]|null + */ + public function getCampaignStats(): ?array + { + return $this->container['campaignStats']; + } + + /** + * Sets campaignStats + * + * @param \Brevo\Client\Models\GetExtendedListAllOfCampaignStats[]|null $campaignStats campaignStats + * + * @return $this + */ + public function setCampaignStats(?array $campaignStats): static + { + if (is_null($campaignStats)) { + throw new InvalidArgumentException('non-nullable campaignStats cannot be null'); + } + $this->container['campaignStats'] = $campaignStats; + + return $this; + } + + /** + * Gets dynamicList * - * @return void + * @return bool|null */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) + public function getDynamicList(): ?bool { - unset($this->container[$offset]); + return $this->container['dynamicList']; } /** - * Gets the string presentation of the object + * Sets dynamicList * - * @return string + * @param bool|null $dynamicList Status telling if the list is dynamic or not (true=dynamic, false=not dynamic) + * + * @return $this */ - public function __toString() + public function setDynamicList(?bool $dynamicList): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($dynamicList)) { + throw new InvalidArgumentException('non-nullable dynamicList cannot be null'); } + $this->container['dynamicList'] = $dynamicList; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/GetExtendedListAllOfCampaignStats.php b/lib/Models/GetExtendedListAllOfCampaignStats.php new file mode 100644 index 0000000..108aebb --- /dev/null +++ b/lib/Models/GetExtendedListAllOfCampaignStats.php @@ -0,0 +1,247 @@ + + */ +class GetExtendedListAllOfCampaignStats extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getExtendedList_allOf_campaignStats'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'campaignId' => 'int', + 'stats' => '\Brevo\Client\Models\GetCampaignStats' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'campaignId' => 'int64', + 'stats' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'campaignId' => false, + 'stats' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'campaignId' => 'campaignId', + 'stats' => 'stats' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'campaignId' => 'setCampaignId', + 'stats' => 'setStats' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'campaignId' => 'getCampaignId', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('stats', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['campaignId'] === null) { + $invalidProperties[] = "'campaignId' can't be null"; + } + if ($this->container['stats'] === null) { + $invalidProperties[] = "'stats' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets campaignId + * + * @return int + */ + public function getCampaignId(): int + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param int $campaignId ID of the campaign + * + * @return $this + */ + public function setCampaignId(int $campaignId): static + { + if (is_null($campaignId)) { + throw new InvalidArgumentException('non-nullable campaignId cannot be null'); + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets stats + * + * @return \Brevo\Client\Models\GetCampaignStats + */ + public function getStats(): \Brevo\Client\Models\GetCampaignStats + { + return $this->container['stats']; + } + + /** + * Sets stats + * + * @param \Brevo\Client\Models\GetCampaignStats $stats stats + * + * @return $this + */ + public function setStats(\Brevo\Client\Models\GetCampaignStats $stats): static + { + if (is_null($stats)) { + throw new InvalidArgumentException('non-nullable stats cannot be null'); + } + $this->container['stats'] = $stats; + + return $this; + } +} + + diff --git a/lib/Models/GetExtendedListCampaignStats.php b/lib/Models/GetExtendedListCampaignStats.php deleted file mode 100644 index 1e555f5..0000000 --- a/lib/Models/GetExtendedListCampaignStats.php +++ /dev/null @@ -1,341 +0,0 @@ - 'int', - 'stats' => '\Brevo\Client\Models\GetCampaignStats' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'campaignId' => 'int64', - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'campaignId' => 'campaignId', - 'stats' => 'stats' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'campaignId' => 'setCampaignId', - 'stats' => 'setStats' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'campaignId' => 'getCampaignId', - '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 - */ - public function __construct(array $data = null) - { - $this->container['campaignId'] = isset($data['campaignId']) ? $data['campaignId'] : null; - $this->container['stats'] = isset($data['stats']) ? $data['stats'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['campaignId'] === null) { - $invalidProperties[] = "'campaignId' can't be null"; - } - if ($this->container['stats'] === null) { - $invalidProperties[] = "'stats' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets campaignId - * - * @return int - */ - public function getCampaignId() - { - return $this->container['campaignId']; - } - - /** - * Sets campaignId - * - * @param int $campaignId ID of the campaign - * - * @return $this - */ - public function setCampaignId($campaignId) - { - $this->container['campaignId'] = $campaignId; - - return $this; - } - - /** - * Gets stats - * - * @return \Brevo\Client\Models\GetCampaignStats - */ - public function getStats() - { - return $this->container['stats']; - } - - /** - * Sets stats - * - * @param \Brevo\Client\Models\GetCampaignStats $stats stats - * - * @return $this - */ - public function setStats($stats) - { - $this->container['stats'] = $stats; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetExternalFeedByUUID.php b/lib/Models/GetExternalFeedByUUID.php index 02cd256..8992f36 100644 --- a/lib/Models/GetExternalFeedByUUID.php +++ b/lib/Models/GetExternalFeedByUUID.php @@ -2,183 +2,192 @@ /** * GetExternalFeedByUUID * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetExternalFeedByUUID Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetExternalFeedByUUID implements ModelInterface, ArrayAccess +class GetExternalFeedByUUID extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getExternalFeedByUUID'; + protected static string $openAPIModelName = 'getExternalFeedByUUID'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'string', 'name' => 'string', 'url' => 'string', 'authType' => 'string', - 'username' => 'string', - 'password' => 'string', - 'token' => 'string', - 'headers' => '\Brevo\Client\Models\GetExternalFeedByUUIDHeaders[]', + 'headers' => '\Brevo\Client\Models\GetExternalFeedByUUIDHeadersInner[]', 'maxRetries' => 'int', 'cache' => 'bool', 'createdAt' => '\DateTime', - 'modifiedAt' => '\DateTime' + 'modifiedAt' => '\DateTime', + 'username' => 'string', + 'password' => 'string', + 'token' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'uuidv4', 'name' => null, 'url' => 'url', 'authType' => null, - 'username' => null, - 'password' => null, - 'token' => null, 'headers' => null, 'maxRetries' => null, 'cache' => null, 'createdAt' => 'date-time', - 'modifiedAt' => 'date-time' + 'modifiedAt' => 'date-time', + 'username' => null, + 'password' => null, + 'token' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'url' => false, + 'authType' => false, + 'headers' => false, + 'maxRetries' => false, + 'cache' => false, + 'createdAt' => false, + 'modifiedAt' => false, + 'username' => false, + 'password' => false, + 'token' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name', 'url' => 'url', 'authType' => 'authType', - 'username' => 'username', - 'password' => 'password', - 'token' => 'token', 'headers' => 'headers', 'maxRetries' => 'maxRetries', 'cache' => 'cache', 'createdAt' => 'createdAt', - 'modifiedAt' => 'modifiedAt' + 'modifiedAt' => 'modifiedAt', + 'username' => 'username', + 'password' => 'password', + 'token' => 'token' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName', 'url' => 'setUrl', 'authType' => 'setAuthType', - 'username' => 'setUsername', - 'password' => 'setPassword', - 'token' => 'setToken', 'headers' => 'setHeaders', 'maxRetries' => 'setMaxRetries', 'cache' => 'setCache', 'createdAt' => 'setCreatedAt', - 'modifiedAt' => 'setModifiedAt' + 'modifiedAt' => 'setModifiedAt', + 'username' => 'setUsername', + 'password' => 'setPassword', + 'token' => 'setToken' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName', 'url' => 'getUrl', 'authType' => 'getAuthType', - 'username' => 'getUsername', - 'password' => 'getPassword', - 'token' => 'getToken', 'headers' => 'getHeaders', 'maxRetries' => 'getMaxRetries', 'cache' => 'getCache', 'createdAt' => 'getCreatedAt', - 'modifiedAt' => 'getModifiedAt' + 'modifiedAt' => 'getModifiedAt', + 'username' => 'getUsername', + 'password' => 'getPassword', + 'token' => 'getToken' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -186,9 +195,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -196,29 +205,17 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const AUTH_TYPE_BASIC = 'basic'; - const AUTH_TYPE_TOKEN = 'token'; - const AUTH_TYPE_NO_AUTH = 'noAuth'; - + public const AUTH_TYPE_BASIC = 'basic'; + public const AUTH_TYPE_TOKEN = 'token'; + public const AUTH_TYPE_NO_AUTH = 'noAuth'; - /** * Gets allowable values of the enum * @@ -232,43 +229,41 @@ public function getAuthTypeAllowableValues() self::AUTH_TYPE_NO_AUTH, ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['authType'] = isset($data['authType']) ? $data['authType'] : null; - $this->container['username'] = isset($data['username']) ? $data['username'] : null; - $this->container['password'] = isset($data['password']) ? $data['password'] : null; - $this->container['token'] = isset($data['token']) ? $data['token'] : null; - $this->container['headers'] = isset($data['headers']) ? $data['headers'] : null; - $this->container['maxRetries'] = isset($data['maxRetries']) ? $data['maxRetries'] : null; - $this->container['cache'] = isset($data['cache']) ? $data['cache'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['modifiedAt'] = isset($data['modifiedAt']) ? $data['modifiedAt'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('authType', $data ?? [], null); + $this->setIfExists('headers', $data ?? [], null); + $this->setIfExists('maxRetries', $data ?? [], 5); + $this->setIfExists('cache', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('modifiedAt', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('password', $data ?? [], null); + $this->setIfExists('token', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -287,7 +282,8 @@ public function listInvalidProperties() $allowedValues = $this->getAuthTypeAllowableValues(); if (!is_null($this->container['authType']) && !in_array($this->container['authType'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'authType', must be one of '%s'", + "invalid value '%s' for 'authType', must be one of '%s'", + $this->container['authType'], implode("', '", $allowedValues) ); } @@ -318,24 +314,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return string */ - public function getId() + public function getId(): string { return $this->container['id']; } @@ -347,8 +331,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(string $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -359,7 +346,7 @@ public function setId($id) * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -371,8 +358,11 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -383,7 +373,7 @@ public function setName($name) * * @return string */ - public function getUrl() + public function getUrl(): string { return $this->container['url']; } @@ -395,8 +385,11 @@ public function getUrl() * * @return $this */ - public function setUrl($url) + public function setUrl(string $url): static { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } $this->container['url'] = $url; return $this; @@ -407,7 +400,7 @@ public function setUrl($url) * * @return string */ - public function getAuthType() + public function getAuthType(): string { return $this->container['authType']; } @@ -419,13 +412,17 @@ public function getAuthType() * * @return $this */ - public function setAuthType($authType) + public function setAuthType(string $authType): static { + if (is_null($authType)) { + throw new InvalidArgumentException('non-nullable authType cannot be null'); + } $allowedValues = $this->getAuthTypeAllowableValues(); if (!in_array($authType, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'authType', must be one of '%s'", + "Invalid value '%s' for 'authType', must be one of '%s'", + $authType, implode("', '", $allowedValues) ) ); @@ -435,84 +432,12 @@ public function setAuthType($authType) return $this; } - /** - * Gets username - * - * @return string - */ - public function getUsername() - { - return $this->container['username']; - } - - /** - * Sets username - * - * @param string $username Username for authType `basic` - * - * @return $this - */ - public function setUsername($username) - { - $this->container['username'] = $username; - - return $this; - } - - /** - * Gets password - * - * @return string - */ - public function getPassword() - { - return $this->container['password']; - } - - /** - * Sets password - * - * @param string $password Password for authType `basic` - * - * @return $this - */ - public function setPassword($password) - { - $this->container['password'] = $password; - - return $this; - } - - /** - * Gets token - * - * @return string - */ - public function getToken() - { - return $this->container['token']; - } - - /** - * Sets token - * - * @param string $token Token for authType `token` - * - * @return $this - */ - public function setToken($token) - { - $this->container['token'] = $token; - - return $this; - } - /** * Gets headers * - * @return \Brevo\Client\Models\GetExternalFeedByUUIDHeaders[] + * @return \Brevo\Client\Models\GetExternalFeedByUUIDHeadersInner[] */ - public function getHeaders() + public function getHeaders(): array { return $this->container['headers']; } @@ -520,12 +445,15 @@ public function getHeaders() /** * Sets headers * - * @param \Brevo\Client\Models\GetExternalFeedByUUIDHeaders[] $headers Custom headers for the feed + * @param \Brevo\Client\Models\GetExternalFeedByUUIDHeadersInner[] $headers Custom headers for the feed * * @return $this */ - public function setHeaders($headers) + public function setHeaders(array $headers): static { + if (is_null($headers)) { + throw new InvalidArgumentException('non-nullable headers cannot be null'); + } $this->container['headers'] = $headers; return $this; @@ -536,7 +464,7 @@ public function setHeaders($headers) * * @return int */ - public function getMaxRetries() + public function getMaxRetries(): int { return $this->container['maxRetries']; } @@ -548,14 +476,17 @@ public function getMaxRetries() * * @return $this */ - public function setMaxRetries($maxRetries) + public function setMaxRetries(int $maxRetries): static { + if (is_null($maxRetries)) { + throw new InvalidArgumentException('non-nullable maxRetries cannot be null'); + } if (($maxRetries > 5)) { - throw new \InvalidArgumentException('invalid value for $maxRetries when calling GetExternalFeedByUUID., must be smaller than or equal to 5.'); + throw new InvalidArgumentException('invalid value for $maxRetries when calling GetExternalFeedByUUID., must be smaller than or equal to 5.'); } if (($maxRetries < 0)) { - throw new \InvalidArgumentException('invalid value for $maxRetries when calling GetExternalFeedByUUID., must be bigger than or equal to 0.'); + throw new InvalidArgumentException('invalid value for $maxRetries when calling GetExternalFeedByUUID., must be bigger than or equal to 0.'); } $this->container['maxRetries'] = $maxRetries; @@ -568,7 +499,7 @@ public function setMaxRetries($maxRetries) * * @return bool */ - public function getCache() + public function getCache(): bool { return $this->container['cache']; } @@ -580,8 +511,11 @@ public function getCache() * * @return $this */ - public function setCache($cache) + public function setCache(bool $cache): static { + if (is_null($cache)) { + throw new InvalidArgumentException('non-nullable cache cannot be null'); + } $this->container['cache'] = $cache; return $this; @@ -592,7 +526,7 @@ public function setCache($cache) * * @return \DateTime */ - public function getCreatedAt() + public function getCreatedAt(): \DateTime { return $this->container['createdAt']; } @@ -604,8 +538,11 @@ public function getCreatedAt() * * @return $this */ - public function setCreatedAt($createdAt) + public function setCreatedAt(\DateTime $createdAt): static { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } $this->container['createdAt'] = $createdAt; return $this; @@ -616,7 +553,7 @@ public function setCreatedAt($createdAt) * * @return \DateTime */ - public function getModifiedAt() + public function getModifiedAt(): \DateTime { return $this->container['modifiedAt']; } @@ -628,84 +565,95 @@ public function getModifiedAt() * * @return $this */ - public function setModifiedAt($modifiedAt) + public function setModifiedAt(\DateTime $modifiedAt): static { + if (is_null($modifiedAt)) { + throw new InvalidArgumentException('non-nullable modifiedAt cannot be null'); + } $this->container['modifiedAt'] = $modifiedAt; return $this; } + /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset + * Gets username * - * @return boolean + * @return string|null */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) + public function getUsername(): ?string { - return isset($this->container[$offset]); + return $this->container['username']; } /** - * Gets offset. + * Sets username * - * @param integer $offset Offset + * @param string|null $username Username for authType `basic` + * + * @return $this + */ + public function setUsername(?string $username): static + { + if (is_null($username)) { + throw new InvalidArgumentException('non-nullable username cannot be null'); + } + $this->container['username'] = $username; + + return $this; + } + + /** + * Gets password * - * @return mixed + * @return string|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function getPassword(): ?string { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container['password']; } /** - * Sets value based on offset. + * Sets password * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param string|null $password Password for authType `basic` * - * @return void + * @return $this */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function setPassword(?string $password): static { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; + if (is_null($password)) { + throw new InvalidArgumentException('non-nullable password cannot be null'); } + $this->container['password'] = $password; + + return $this; } /** - * Unsets offset. - * - * @param integer $offset Offset + * Gets token * - * @return void + * @return string|null */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) + public function getToken(): ?string { - unset($this->container[$offset]); + return $this->container['token']; } /** - * Gets the string presentation of the object + * Sets token * - * @return string + * @param string|null $token Token for authType `token` + * + * @return $this */ - public function __toString() + public function setToken(?string $token): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($token)) { + throw new InvalidArgumentException('non-nullable token cannot be null'); } + $this->container['token'] = $token; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/GetExternalFeedByUUIDHeaders.php b/lib/Models/GetExternalFeedByUUIDHeaders.php deleted file mode 100644 index afe7f62..0000000 --- a/lib/Models/GetExternalFeedByUUIDHeaders.php +++ /dev/null @@ -1,335 +0,0 @@ - 'string', - 'value' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'name' => null, - 'value' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'name' => 'name', - 'value' => 'value' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'name' => 'setName', - 'value' => 'setValue' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'name' => 'getName', - 'value' => 'getValue' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['value'] = isset($data['value']) ? $data['value'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Name of the header - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets value - * - * @return string - */ - public function getValue() - { - return $this->container['value']; - } - - /** - * Sets value - * - * @param string $value Value of the header - * - * @return $this - */ - public function setValue($value) - { - $this->container['value'] = $value; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetExternalFeedByUUIDHeadersInner.php b/lib/Models/GetExternalFeedByUUIDHeadersInner.php new file mode 100644 index 0000000..0c94a72 --- /dev/null +++ b/lib/Models/GetExternalFeedByUUIDHeadersInner.php @@ -0,0 +1,241 @@ + + */ +class GetExternalFeedByUUIDHeadersInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getExternalFeedByUUID_headers_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'value' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'value' => 'getValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the header + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets value + * + * @return string|null + */ + public function getValue(): ?string + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string|null $value Value of the header + * + * @return $this + */ + public function setValue(?string $value): static + { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } + $this->container['value'] = $value; + + return $this; + } +} + + diff --git a/lib/Models/GetFolder.php b/lib/Models/GetFolder.php index bfab91a..84490c4 100644 --- a/lib/Models/GetFolder.php +++ b/lib/Models/GetFolder.php @@ -2,61 +2,63 @@ /** * GetFolder * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetFolder Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetFolder implements ModelInterface, ArrayAccess +class GetFolder extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getFolder'; + protected static string $openAPIModelName = 'getFolder'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'totalBlacklisted' => 'int', @@ -67,9 +69,9 @@ class GetFolder implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'name' => null, 'totalBlacklisted' => 'int64', @@ -78,32 +80,32 @@ class GetFolder implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'totalBlacklisted' => false, + 'totalSubscribers' => false, + 'uniqueSubscribers' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name', 'totalBlacklisted' => 'totalBlacklisted', @@ -114,9 +116,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName', 'totalBlacklisted' => 'setTotalBlacklisted', @@ -127,9 +129,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName', 'totalBlacklisted' => 'getTotalBlacklisted', @@ -141,9 +143,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -151,9 +153,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -161,55 +163,41 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['totalBlacklisted'] = isset($data['totalBlacklisted']) ? $data['totalBlacklisted'] : null; - $this->container['totalSubscribers'] = isset($data['totalSubscribers']) ? $data['totalSubscribers'] : null; - $this->container['uniqueSubscribers'] = isset($data['uniqueSubscribers']) ? $data['uniqueSubscribers'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('totalBlacklisted', $data ?? [], null); + $this->setIfExists('totalSubscribers', $data ?? [], null); + $this->setIfExists('uniqueSubscribers', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -231,24 +219,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -260,8 +236,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -272,7 +251,7 @@ public function setId($id) * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -284,8 +263,11 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -296,7 +278,7 @@ public function setName($name) * * @return int */ - public function getTotalBlacklisted() + public function getTotalBlacklisted(): int { return $this->container['totalBlacklisted']; } @@ -308,8 +290,11 @@ public function getTotalBlacklisted() * * @return $this */ - public function setTotalBlacklisted($totalBlacklisted) + public function setTotalBlacklisted(int $totalBlacklisted): static { + if (is_null($totalBlacklisted)) { + throw new InvalidArgumentException('non-nullable totalBlacklisted cannot be null'); + } $this->container['totalBlacklisted'] = $totalBlacklisted; return $this; @@ -320,7 +305,7 @@ public function setTotalBlacklisted($totalBlacklisted) * * @return int */ - public function getTotalSubscribers() + public function getTotalSubscribers(): int { return $this->container['totalSubscribers']; } @@ -332,8 +317,11 @@ public function getTotalSubscribers() * * @return $this */ - public function setTotalSubscribers($totalSubscribers) + public function setTotalSubscribers(int $totalSubscribers): static { + if (is_null($totalSubscribers)) { + throw new InvalidArgumentException('non-nullable totalSubscribers cannot be null'); + } $this->container['totalSubscribers'] = $totalSubscribers; return $this; @@ -344,7 +332,7 @@ public function setTotalSubscribers($totalSubscribers) * * @return int */ - public function getUniqueSubscribers() + public function getUniqueSubscribers(): int { return $this->container['uniqueSubscribers']; } @@ -356,85 +344,15 @@ public function getUniqueSubscribers() * * @return $this */ - public function setUniqueSubscribers($uniqueSubscribers) + public function setUniqueSubscribers(int $uniqueSubscribers): static { + if (is_null($uniqueSubscribers)) { + throw new InvalidArgumentException('non-nullable uniqueSubscribers cannot be null'); + } $this->container['uniqueSubscribers'] = $uniqueSubscribers; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetFolderLists.php b/lib/Models/GetFolderLists.php index 01ad999..ebfeb4e 100644 --- a/lib/Models/GetFolderLists.php +++ b/lib/Models/GetFolderLists.php @@ -2,102 +2,101 @@ /** * GetFolderLists * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetFolderLists Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetFolderLists implements ModelInterface, ArrayAccess +class GetFolderLists extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getFolderLists'; + protected static string $openAPIModelName = 'getFolderLists'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'lists' => 'object[]', + protected static array $openAPITypes = [ + 'lists' => 'GetList[]', 'count' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'lists' => null, 'count' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'lists' => false, + 'count' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'lists' => 'lists', 'count' => 'count' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'lists' => 'setLists', 'count' => 'setCount' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'lists' => 'getLists', 'count' => 'getCount' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +145,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['lists'] = isset($data['lists']) ? $data['lists'] : null; - $this->container['count'] = isset($data['count']) ? $data['count'] : null; + $this->setIfExists('lists', $data ?? [], null); + $this->setIfExists('count', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets lists * - * @return object[] + * @return GetList[]|null */ - public function getLists() + public function getLists(): ?array { return $this->container['lists']; } @@ -223,12 +196,15 @@ public function getLists() /** * Sets lists * - * @param object[] $lists lists + * @param GetList[]|null $lists lists * * @return $this */ - public function setLists($lists) + public function setLists(?array $lists): static { + if (is_null($lists)) { + throw new InvalidArgumentException('non-nullable lists cannot be null'); + } $this->container['lists'] = $lists; return $this; @@ -237,9 +213,9 @@ public function setLists($lists) /** * Gets count * - * @return int + * @return int|null */ - public function getCount() + public function getCount(): ?int { return $this->container['count']; } @@ -247,89 +223,19 @@ public function getCount() /** * Sets count * - * @param int $count Number of lists in the folder + * @param int|null $count Number of lists in the folder * * @return $this */ - public function setCount($count) + public function setCount(?int $count): static { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } $this->container['count'] = $count; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetFolders.php b/lib/Models/GetFolders.php index d5eed21..3fb6774 100644 --- a/lib/Models/GetFolders.php +++ b/lib/Models/GetFolders.php @@ -2,102 +2,101 @@ /** * GetFolders * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetFolders Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetFolders implements ModelInterface, ArrayAccess +class GetFolders extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getFolders'; + protected static string $openAPIModelName = 'getFolders'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'folders' => 'object[]', + protected static array $openAPITypes = [ + 'folders' => 'GetFolder[]', 'count' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'folders' => null, 'count' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'folders' => false, + 'count' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'folders' => 'folders', 'count' => 'count' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'folders' => 'setFolders', 'count' => 'setCount' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'folders' => 'getFolders', 'count' => 'getCount' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +145,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['folders'] = isset($data['folders']) ? $data['folders'] : null; - $this->container['count'] = isset($data['count']) ? $data['count'] : null; + $this->setIfExists('folders', $data ?? [], null); + $this->setIfExists('count', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets folders * - * @return object[] + * @return GetFolder[]|null */ - public function getFolders() + public function getFolders(): ?array { return $this->container['folders']; } @@ -223,12 +196,15 @@ public function getFolders() /** * Sets folders * - * @param object[] $folders folders + * @param GetFolder[]|null $folders folders * * @return $this */ - public function setFolders($folders) + public function setFolders(?array $folders): static { + if (is_null($folders)) { + throw new InvalidArgumentException('non-nullable folders cannot be null'); + } $this->container['folders'] = $folders; return $this; @@ -237,9 +213,9 @@ public function setFolders($folders) /** * Gets count * - * @return int + * @return int|null */ - public function getCount() + public function getCount(): ?int { return $this->container['count']; } @@ -247,89 +223,19 @@ public function getCount() /** * Sets count * - * @param int $count Number of folders available in your account + * @param int|null $count Number of folders available in your account * * @return $this */ - public function setCount($count) + public function setCount(?int $count): static { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } $this->container['count'] = $count; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetInboundEmailEvents.php b/lib/Models/GetInboundEmailEvents.php index 14b7ce2..f960b53 100644 --- a/lib/Models/GetInboundEmailEvents.php +++ b/lib/Models/GetInboundEmailEvents.php @@ -2,118 +2,116 @@ /** * GetInboundEmailEvents * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetInboundEmailEvents Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetInboundEmailEvents implements ModelInterface, ArrayAccess +class GetInboundEmailEvents extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getInboundEmailEvents'; + protected static string $openAPIModelName = 'getInboundEmailEvents'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'events' => '\Brevo\Client\Models\GetInboundEmailEventsEvents[]' + protected static array $openAPITypes = [ + 'events' => '\Brevo\Client\Models\GetInboundEmailEventsEventsInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'events' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'events' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'events' => 'events' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'events' => 'setEvents' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'events' => 'getEvents' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,75 +139,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['events'] = isset($data['events']) ? $data['events'] : null; + $this->setIfExists('events', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets events * - * @return \Brevo\Client\Models\GetInboundEmailEventsEvents[] + * @return \Brevo\Client\Models\GetInboundEmailEventsEventsInner[]|null */ - public function getEvents() + public function getEvents(): ?array { return $this->container['events']; } @@ -217,89 +189,19 @@ public function getEvents() /** * Sets events * - * @param \Brevo\Client\Models\GetInboundEmailEventsEvents[] $events events + * @param \Brevo\Client\Models\GetInboundEmailEventsEventsInner[]|null $events events * * @return $this */ - public function setEvents($events) + public function setEvents(?array $events): static { + if (is_null($events)) { + throw new InvalidArgumentException('non-nullable events cannot be null'); + } $this->container['events'] = $events; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetInboundEmailEventsByUuid.php b/lib/Models/GetInboundEmailEventsByUuid.php index 6ba54ff..3e4eede 100644 --- a/lib/Models/GetInboundEmailEventsByUuid.php +++ b/lib/Models/GetInboundEmailEventsByUuid.php @@ -2,77 +2,79 @@ /** * GetInboundEmailEventsByUuid * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetInboundEmailEventsByUuid Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetInboundEmailEventsByUuid implements ModelInterface, ArrayAccess +class GetInboundEmailEventsByUuid extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getInboundEmailEventsByUuid'; + protected static string $openAPIModelName = 'getInboundEmailEventsByUuid'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'receivedAt' => '\DateTime', 'deliveredAt' => '\DateTime', 'recipient' => 'string', 'sender' => 'string', 'messageId' => 'string', 'subject' => 'string', - 'attachments' => '\Brevo\Client\Models\GetInboundEmailEventsByUuidAttachments[]', - 'logs' => '\Brevo\Client\Models\GetInboundEmailEventsByUuidLogs[]' + 'attachments' => '\Brevo\Client\Models\GetInboundEmailEventsByUuidAttachmentsInner[]', + 'logs' => '\Brevo\Client\Models\GetInboundEmailEventsByUuidLogsInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'receivedAt' => 'date-time', 'deliveredAt' => 'date-time', 'recipient' => 'email', @@ -84,32 +86,35 @@ class GetInboundEmailEventsByUuid implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'receivedAt' => false, + 'deliveredAt' => true, + 'recipient' => false, + 'sender' => false, + 'messageId' => false, + 'subject' => false, + 'attachments' => false, + 'logs' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'receivedAt' => 'receivedAt', 'deliveredAt' => 'deliveredAt', 'recipient' => 'recipient', @@ -123,9 +128,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'receivedAt' => 'setReceivedAt', 'deliveredAt' => 'setDeliveredAt', 'recipient' => 'setRecipient', @@ -139,9 +144,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'receivedAt' => 'getReceivedAt', 'deliveredAt' => 'getDeliveredAt', 'recipient' => 'getRecipient', @@ -156,9 +161,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -166,9 +171,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -176,82 +181,56 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['receivedAt'] = isset($data['receivedAt']) ? $data['receivedAt'] : null; - $this->container['deliveredAt'] = isset($data['deliveredAt']) ? $data['deliveredAt'] : null; - $this->container['recipient'] = isset($data['recipient']) ? $data['recipient'] : null; - $this->container['sender'] = isset($data['sender']) ? $data['sender'] : null; - $this->container['messageId'] = isset($data['messageId']) ? $data['messageId'] : null; - $this->container['subject'] = isset($data['subject']) ? $data['subject'] : null; - $this->container['attachments'] = isset($data['attachments']) ? $data['attachments'] : null; - $this->container['logs'] = isset($data['logs']) ? $data['logs'] : null; + $this->setIfExists('receivedAt', $data ?? [], null); + $this->setIfExists('deliveredAt', $data ?? [], null); + $this->setIfExists('recipient', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('messageId', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('logs', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets receivedAt * - * @return \DateTime + * @return \DateTime|null */ - public function getReceivedAt() + public function getReceivedAt(): ?\DateTime { return $this->container['receivedAt']; } @@ -259,12 +238,15 @@ public function getReceivedAt() /** * Sets receivedAt * - * @param \DateTime $receivedAt Date when email was received on SMTP relay + * @param \DateTime|null $receivedAt Date when email was received on SMTP relay * * @return $this */ - public function setReceivedAt($receivedAt) + public function setReceivedAt(?\DateTime $receivedAt): static { + if (is_null($receivedAt)) { + throw new InvalidArgumentException('non-nullable receivedAt cannot be null'); + } $this->container['receivedAt'] = $receivedAt; return $this; @@ -273,9 +255,9 @@ public function setReceivedAt($receivedAt) /** * Gets deliveredAt * - * @return \DateTime + * @return \DateTime|null */ - public function getDeliveredAt() + public function getDeliveredAt(): ?\DateTime { return $this->container['deliveredAt']; } @@ -283,12 +265,22 @@ public function getDeliveredAt() /** * Sets deliveredAt * - * @param \DateTime $deliveredAt Date when email was delivered successfully to client’s webhook + * @param \DateTime|null $deliveredAt Date when email was delivered successfully to client’s webhook * * @return $this */ - public function setDeliveredAt($deliveredAt) + public function setDeliveredAt(?\DateTime $deliveredAt): static { + if (is_null($deliveredAt)) { + array_push($this->openAPINullablesSetToNull, 'deliveredAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('deliveredAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['deliveredAt'] = $deliveredAt; return $this; @@ -297,9 +289,9 @@ public function setDeliveredAt($deliveredAt) /** * Gets recipient * - * @return string + * @return string|null */ - public function getRecipient() + public function getRecipient(): ?string { return $this->container['recipient']; } @@ -307,12 +299,15 @@ public function getRecipient() /** * Sets recipient * - * @param string $recipient Recipient’s email address + * @param string|null $recipient Recipient’s email address * * @return $this */ - public function setRecipient($recipient) + public function setRecipient(?string $recipient): static { + if (is_null($recipient)) { + throw new InvalidArgumentException('non-nullable recipient cannot be null'); + } $this->container['recipient'] = $recipient; return $this; @@ -321,9 +316,9 @@ public function setRecipient($recipient) /** * Gets sender * - * @return string + * @return string|null */ - public function getSender() + public function getSender(): ?string { return $this->container['sender']; } @@ -331,12 +326,15 @@ public function getSender() /** * Sets sender * - * @param string $sender Sender’s email address + * @param string|null $sender Sender’s email address * * @return $this */ - public function setSender($sender) + public function setSender(?string $sender): static { + if (is_null($sender)) { + throw new InvalidArgumentException('non-nullable sender cannot be null'); + } $this->container['sender'] = $sender; return $this; @@ -345,9 +343,9 @@ public function setSender($sender) /** * Gets messageId * - * @return string + * @return string|null */ - public function getMessageId() + public function getMessageId(): ?string { return $this->container['messageId']; } @@ -355,12 +353,15 @@ public function getMessageId() /** * Sets messageId * - * @param string $messageId Value of the Message-ID header. This will be present only after the processing is done. + * @param string|null $messageId Value of the Message-ID header. This will be present only after the processing is done. * * @return $this */ - public function setMessageId($messageId) + public function setMessageId(?string $messageId): static { + if (is_null($messageId)) { + throw new InvalidArgumentException('non-nullable messageId cannot be null'); + } $this->container['messageId'] = $messageId; return $this; @@ -369,9 +370,9 @@ public function setMessageId($messageId) /** * Gets subject * - * @return string + * @return string|null */ - public function getSubject() + public function getSubject(): ?string { return $this->container['subject']; } @@ -379,12 +380,15 @@ public function getSubject() /** * Sets subject * - * @param string $subject Value of the Subject header. This will be present only after the processing is done. + * @param string|null $subject Value of the Subject header. This will be present only after the processing is done. * * @return $this */ - public function setSubject($subject) + public function setSubject(?string $subject): static { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } $this->container['subject'] = $subject; return $this; @@ -393,9 +397,9 @@ public function setSubject($subject) /** * Gets attachments * - * @return \Brevo\Client\Models\GetInboundEmailEventsByUuidAttachments[] + * @return \Brevo\Client\Models\GetInboundEmailEventsByUuidAttachmentsInner[]|null */ - public function getAttachments() + public function getAttachments(): ?array { return $this->container['attachments']; } @@ -403,12 +407,15 @@ public function getAttachments() /** * Sets attachments * - * @param \Brevo\Client\Models\GetInboundEmailEventsByUuidAttachments[] $attachments List of attachments of the email. This will be present only after the processing is done. + * @param \Brevo\Client\Models\GetInboundEmailEventsByUuidAttachmentsInner[]|null $attachments List of attachments of the email. This will be present only after the processing is done. * * @return $this */ - public function setAttachments($attachments) + public function setAttachments(?array $attachments): static { + if (is_null($attachments)) { + throw new InvalidArgumentException('non-nullable attachments cannot be null'); + } $this->container['attachments'] = $attachments; return $this; @@ -417,9 +424,9 @@ public function setAttachments($attachments) /** * Gets logs * - * @return \Brevo\Client\Models\GetInboundEmailEventsByUuidLogs[] + * @return \Brevo\Client\Models\GetInboundEmailEventsByUuidLogsInner[]|null */ - public function getLogs() + public function getLogs(): ?array { return $this->container['logs']; } @@ -427,89 +434,19 @@ public function getLogs() /** * Sets logs * - * @param \Brevo\Client\Models\GetInboundEmailEventsByUuidLogs[] $logs List of events/logs that describe the lifecycle of the email on SIB platform + * @param \Brevo\Client\Models\GetInboundEmailEventsByUuidLogsInner[]|null $logs List of events/logs that describe the lifecycle of the email on SIB platform * * @return $this */ - public function setLogs($logs) + public function setLogs(?array $logs): static { + if (is_null($logs)) { + throw new InvalidArgumentException('non-nullable logs cannot be null'); + } $this->container['logs'] = $logs; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetInboundEmailEventsByUuidAttachments.php b/lib/Models/GetInboundEmailEventsByUuidAttachments.php deleted file mode 100644 index 17e9fc8..0000000 --- a/lib/Models/GetInboundEmailEventsByUuidAttachments.php +++ /dev/null @@ -1,395 +0,0 @@ - 'string', - 'contentType' => 'string', - 'contentId' => 'string', - 'contentLength' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'name' => null, - 'contentType' => null, - 'contentId' => null, - 'contentLength' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'name' => 'name', - 'contentType' => 'contentType', - 'contentId' => 'contentId', - 'contentLength' => 'contentLength' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'name' => 'setName', - 'contentType' => 'setContentType', - 'contentId' => 'setContentId', - 'contentLength' => 'setContentLength' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'name' => 'getName', - 'contentType' => 'getContentType', - 'contentId' => 'getContentId', - 'contentLength' => 'getContentLength' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['contentType'] = isset($data['contentType']) ? $data['contentType'] : null; - $this->container['contentId'] = isset($data['contentId']) ? $data['contentId'] : null; - $this->container['contentLength'] = isset($data['contentLength']) ? $data['contentLength'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name filename specified in the Content-Disposition header of the attachment - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets contentType - * - * @return string - */ - public function getContentType() - { - return $this->container['contentType']; - } - - /** - * Sets contentType - * - * @param string $contentType value of the Content-Type header of the attachment - * - * @return $this - */ - public function setContentType($contentType) - { - $this->container['contentType'] = $contentType; - - return $this; - } - - /** - * Gets contentId - * - * @return string - */ - public function getContentId() - { - return $this->container['contentId']; - } - - /** - * Sets contentId - * - * @param string $contentId value of the Content-ID header of the attachment. - * - * @return $this - */ - public function setContentId($contentId) - { - $this->container['contentId'] = $contentId; - - return $this; - } - - /** - * Gets contentLength - * - * @return int - */ - public function getContentLength() - { - return $this->container['contentLength']; - } - - /** - * Sets contentLength - * - * @param int $contentLength size of the attachment in bytes - * - * @return $this - */ - public function setContentLength($contentLength) - { - $this->container['contentLength'] = $contentLength; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetInboundEmailEventsByUuidAttachmentsInner.php b/lib/Models/GetInboundEmailEventsByUuidAttachmentsInner.php new file mode 100644 index 0000000..e384692 --- /dev/null +++ b/lib/Models/GetInboundEmailEventsByUuidAttachmentsInner.php @@ -0,0 +1,309 @@ + + */ +class GetInboundEmailEventsByUuidAttachmentsInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getInboundEmailEventsByUuid_attachments_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'contentType' => 'string', + 'contentId' => 'string', + 'contentLength' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'contentType' => null, + 'contentId' => null, + 'contentLength' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'contentType' => false, + 'contentId' => false, + 'contentLength' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'contentType' => 'contentType', + 'contentId' => 'contentId', + 'contentLength' => 'contentLength' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'contentType' => 'setContentType', + 'contentId' => 'setContentId', + 'contentLength' => 'setContentLength' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'contentType' => 'getContentType', + 'contentId' => 'getContentId', + 'contentLength' => 'getContentLength' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('contentType', $data ?? [], null); + $this->setIfExists('contentId', $data ?? [], null); + $this->setIfExists('contentLength', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name filename specified in the Content-Disposition header of the attachment + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets contentType + * + * @return string|null + */ + public function getContentType(): ?string + { + return $this->container['contentType']; + } + + /** + * Sets contentType + * + * @param string|null $contentType value of the Content-Type header of the attachment + * + * @return $this + */ + public function setContentType(?string $contentType): static + { + if (is_null($contentType)) { + throw new InvalidArgumentException('non-nullable contentType cannot be null'); + } + $this->container['contentType'] = $contentType; + + return $this; + } + + /** + * Gets contentId + * + * @return string|null + */ + public function getContentId(): ?string + { + return $this->container['contentId']; + } + + /** + * Sets contentId + * + * @param string|null $contentId value of the Content-ID header of the attachment. + * + * @return $this + */ + public function setContentId(?string $contentId): static + { + if (is_null($contentId)) { + throw new InvalidArgumentException('non-nullable contentId cannot be null'); + } + $this->container['contentId'] = $contentId; + + return $this; + } + + /** + * Gets contentLength + * + * @return int|null + */ + public function getContentLength(): ?int + { + return $this->container['contentLength']; + } + + /** + * Sets contentLength + * + * @param int|null $contentLength size of the attachment in bytes + * + * @return $this + */ + public function setContentLength(?int $contentLength): static + { + if (is_null($contentLength)) { + throw new InvalidArgumentException('non-nullable contentLength cannot be null'); + } + $this->container['contentLength'] = $contentLength; + + return $this; + } +} + + diff --git a/lib/Models/GetInboundEmailEventsByUuidLogs.php b/lib/Models/GetInboundEmailEventsByUuidLogs.php deleted file mode 100644 index 53657a6..0000000 --- a/lib/Models/GetInboundEmailEventsByUuidLogs.php +++ /dev/null @@ -1,371 +0,0 @@ - '\DateTime', - 'type' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'date' => 'date-time', - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'date' => 'date', - 'type' => 'type' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'date' => 'setDate', - 'type' => 'setType' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'date' => 'getDate', - '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_RECEIVED = 'received'; - const TYPE_PROCESSED = 'processed'; - const TYPE_WEBHOOK_FAILED = 'webhookFailed'; - const TYPE_WEBHOOK_DELIVERED = 'webhookDelivered'; - - - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getTypeAllowableValues() - { - return [ - self::TYPE_RECEIVED, - self::TYPE_PROCESSED, - self::TYPE_WEBHOOK_FAILED, - self::TYPE_WEBHOOK_DELIVERED, - ]; - } - - - /** - * 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['date'] = isset($data['date']) ? $data['date'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets date - * - * @return \DateTime - */ - public function getDate() - { - return $this->container['date']; - } - - /** - * Sets date - * - * @param \DateTime $date Date of the event - * - * @return $this - */ - public function setDate($date) - { - $this->container['date'] = $date; - - return $this; - } - - /** - * Gets type - * - * @return string - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param string $type Type of the event - * - * @return $this - */ - public function setType($type) - { - $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($type) && !in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'type', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['type'] = $type; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetInboundEmailEventsByUuidLogsInner.php b/lib/Models/GetInboundEmailEventsByUuidLogsInner.php new file mode 100644 index 0000000..cc62652 --- /dev/null +++ b/lib/Models/GetInboundEmailEventsByUuidLogsInner.php @@ -0,0 +1,279 @@ + + */ +class GetInboundEmailEventsByUuidLogsInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getInboundEmailEventsByUuid_logs_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'date' => '\DateTime', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'date' => 'date-time', + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'date' => false, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'date' => 'date', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'date' => 'setDate', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'date' => 'getDate', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const TYPE_RECEIVED = 'received'; + public const TYPE_PROCESSED = 'processed'; + public const TYPE_WEBHOOK_FAILED = 'webhookFailed'; + public const TYPE_WEBHOOK_DELIVERED = 'webhookDelivered'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_RECEIVED, + self::TYPE_PROCESSED, + self::TYPE_WEBHOOK_FAILED, + self::TYPE_WEBHOOK_DELIVERED, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate(): ?\DateTime + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Date of the event + * + * @return $this + */ + public function setDate(?\DateTime $date): static + { + if (is_null($date)) { + throw new InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType(): ?string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of the event + * + * @return $this + */ + public function setType(?string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } +} + + diff --git a/lib/Models/GetInboundEmailEventsEvents.php b/lib/Models/GetInboundEmailEventsEventsInner.php similarity index 51% rename from lib/Models/GetInboundEmailEventsEvents.php rename to lib/Models/GetInboundEmailEventsEventsInner.php index 9009829..7f2bd6a 100644 --- a/lib/Models/GetInboundEmailEventsEvents.php +++ b/lib/Models/GetInboundEmailEventsEventsInner.php @@ -1,62 +1,64 @@ */ -class GetInboundEmailEventsEvents implements ModelInterface, ArrayAccess +class GetInboundEmailEventsEventsInner extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getInboundEmailEvents_events'; + protected static string $openAPIModelName = 'getInboundEmailEvents_events_inner'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'uuid' => 'string', 'date' => '\DateTime', 'sender' => 'string', @@ -66,9 +68,9 @@ class GetInboundEmailEventsEvents implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'uuid' => 'uuid', 'date' => 'date-time', 'sender' => 'email', @@ -76,32 +78,31 @@ class GetInboundEmailEventsEvents implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'uuid' => false, + 'date' => false, + 'sender' => false, + 'recipient' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'uuid' => 'uuid', 'date' => 'date', 'sender' => 'sender', @@ -111,9 +112,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'uuid' => 'setUuid', 'date' => 'setDate', 'sender' => 'setSender', @@ -123,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'uuid' => 'getUuid', 'date' => 'getDate', 'sender' => 'getSender', @@ -136,9 +137,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +147,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,54 +157,40 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['uuid'] = isset($data['uuid']) ? $data['uuid'] : null; - $this->container['date'] = isset($data['date']) ? $data['date'] : null; - $this->container['sender'] = isset($data['sender']) ? $data['sender'] : null; - $this->container['recipient'] = isset($data['recipient']) ? $data['recipient'] : null; + $this->setIfExists('uuid', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('recipient', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -222,24 +209,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets uuid * * @return string */ - public function getUuid() + public function getUuid(): string { return $this->container['uuid']; } @@ -251,8 +226,11 @@ public function getUuid() * * @return $this */ - public function setUuid($uuid) + public function setUuid(string $uuid): static { + if (is_null($uuid)) { + throw new InvalidArgumentException('non-nullable uuid cannot be null'); + } $this->container['uuid'] = $uuid; return $this; @@ -263,7 +241,7 @@ public function setUuid($uuid) * * @return \DateTime */ - public function getDate() + public function getDate(): \DateTime { return $this->container['date']; } @@ -275,8 +253,11 @@ public function getDate() * * @return $this */ - public function setDate($date) + public function setDate(\DateTime $date): static { + if (is_null($date)) { + throw new InvalidArgumentException('non-nullable date cannot be null'); + } $this->container['date'] = $date; return $this; @@ -287,7 +268,7 @@ public function setDate($date) * * @return string */ - public function getSender() + public function getSender(): string { return $this->container['sender']; } @@ -299,8 +280,11 @@ public function getSender() * * @return $this */ - public function setSender($sender) + public function setSender(string $sender): static { + if (is_null($sender)) { + throw new InvalidArgumentException('non-nullable sender cannot be null'); + } $this->container['sender'] = $sender; return $this; @@ -311,7 +295,7 @@ public function setSender($sender) * * @return string */ - public function getRecipient() + public function getRecipient(): string { return $this->container['recipient']; } @@ -323,85 +307,15 @@ public function getRecipient() * * @return $this */ - public function setRecipient($recipient) + public function setRecipient(string $recipient): static { + if (is_null($recipient)) { + throw new InvalidArgumentException('non-nullable recipient cannot be null'); + } $this->container['recipient'] = $recipient; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetInvitedUsersList.php b/lib/Models/GetInvitedUsersList.php index ec8ea3b..70b1df1 100644 --- a/lib/Models/GetInvitedUsersList.php +++ b/lib/Models/GetInvitedUsersList.php @@ -2,118 +2,116 @@ /** * GetInvitedUsersList * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetInvitedUsersList Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetInvitedUsersList implements ModelInterface, ArrayAccess +class GetInvitedUsersList extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getInvitedUsersList'; + protected static string $openAPIModelName = 'getInvitedUsersList'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'users' => '\Brevo\Client\Models\GetInvitedUsersListUsers[]' + protected static array $openAPITypes = [ + 'users' => '\Brevo\Client\Models\GetInvitedUsersListUsersInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'users' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'users' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'users' => 'users' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'users' => 'setUsers' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'users' => 'getUsers' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,75 +139,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['users'] = isset($data['users']) ? $data['users'] : null; + $this->setIfExists('users', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets users * - * @return \Brevo\Client\Models\GetInvitedUsersListUsers[] + * @return \Brevo\Client\Models\GetInvitedUsersListUsersInner[]|null */ - public function getUsers() + public function getUsers(): ?array { return $this->container['users']; } @@ -217,89 +189,19 @@ public function getUsers() /** * Sets users * - * @param \Brevo\Client\Models\GetInvitedUsersListUsers[] $users Get invited users list + * @param \Brevo\Client\Models\GetInvitedUsersListUsersInner[]|null $users Get invited users list * * @return $this */ - public function setUsers($users) + public function setUsers(?array $users): static { + if (is_null($users)) { + throw new InvalidArgumentException('non-nullable users cannot be null'); + } $this->container['users'] = $users; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetInvitedUsersListFeatureAccess.php b/lib/Models/GetInvitedUsersListFeatureAccess.php deleted file mode 100644 index b17c4b9..0000000 --- a/lib/Models/GetInvitedUsersListFeatureAccess.php +++ /dev/null @@ -1,366 +0,0 @@ - 'object', - 'conversations' => 'object', - 'crm' => 'object' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'marketing' => 'string', - 'conversations' => 'string', - 'crm' => 'string' - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'marketing' => 'marketing', - 'conversations' => 'conversations', - 'crm' => 'crm' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'marketing' => 'setMarketing', - 'conversations' => 'setConversations', - 'crm' => 'setCrm' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'marketing' => 'getMarketing', - 'conversations' => 'getConversations', - 'crm' => 'getCrm' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['marketing'] = isset($data['marketing']) ? $data['marketing'] : null; - $this->container['conversations'] = isset($data['conversations']) ? $data['conversations'] : null; - $this->container['crm'] = isset($data['crm']) ? $data['crm'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets marketing - * - * @return object - */ - public function getMarketing() - { - return $this->container['marketing']; - } - - /** - * Sets marketing - * - * @param object $marketing Marketing features accessiblity. - * - * @return $this - */ - public function setMarketing($marketing) - { - $this->container['marketing'] = $marketing; - - return $this; - } - - /** - * Gets conversations - * - * @return object - */ - public function getConversations() - { - return $this->container['conversations']; - } - - /** - * Sets conversations - * - * @param object $conversations Conversations features accessiblity. - * - * @return $this - */ - public function setConversations($conversations) - { - $this->container['conversations'] = $conversations; - - return $this; - } - - /** - * Gets crm - * - * @return object - */ - public function getCrm() - { - return $this->container['crm']; - } - - /** - * Sets crm - * - * @param object $crm CRM features accessiblity. - * - * @return $this - */ - public function setCrm($crm) - { - $this->container['crm'] = $crm; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetInvitedUsersListUsers.php b/lib/Models/GetInvitedUsersListUsersInner.php similarity index 50% rename from lib/Models/GetInvitedUsersListUsers.php rename to lib/Models/GetInvitedUsersListUsersInner.php index ea39111..01eb253 100644 --- a/lib/Models/GetInvitedUsersListUsers.php +++ b/lib/Models/GetInvitedUsersListUsersInner.php @@ -1,74 +1,76 @@ */ -class GetInvitedUsersListUsers implements ModelInterface, ArrayAccess +class GetInvitedUsersListUsersInner extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getInvitedUsersList_users'; + protected static string $openAPIModelName = 'getInvitedUsersList_users_inner'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'email' => 'string', 'isOwner' => 'string', 'status' => 'string', - 'featureAccess' => '\Brevo\Client\Models\GetInvitedUsersListFeatureAccess' + 'featureAccess' => '\Brevo\Client\Models\GetInvitedUsersListUsersInnerFeatureAccess' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'email' => null, 'isOwner' => null, 'status' => null, @@ -76,32 +78,31 @@ class GetInvitedUsersListUsers implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'isOwner' => false, + 'status' => false, + 'featureAccess' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'email' => 'email', 'isOwner' => 'is_owner', 'status' => 'status', @@ -111,9 +112,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'email' => 'setEmail', 'isOwner' => 'setIsOwner', 'status' => 'setStatus', @@ -123,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'email' => 'getEmail', 'isOwner' => 'getIsOwner', 'status' => 'getStatus', @@ -136,9 +137,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +147,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,54 +157,40 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['isOwner'] = isset($data['isOwner']) ? $data['isOwner'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['featureAccess'] = isset($data['featureAccess']) ? $data['featureAccess'] : null; + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('isOwner', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('featureAccess', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -222,24 +209,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets email * * @return string */ - public function getEmail() + public function getEmail(): string { return $this->container['email']; } @@ -251,8 +226,11 @@ public function getEmail() * * @return $this */ - public function setEmail($email) + public function setEmail(string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -263,7 +241,7 @@ public function setEmail($email) * * @return string */ - public function getIsOwner() + public function getIsOwner(): string { return $this->container['isOwner']; } @@ -275,8 +253,11 @@ public function getIsOwner() * * @return $this */ - public function setIsOwner($isOwner) + public function setIsOwner(string $isOwner): static { + if (is_null($isOwner)) { + throw new InvalidArgumentException('non-nullable isOwner cannot be null'); + } $this->container['isOwner'] = $isOwner; return $this; @@ -287,7 +268,7 @@ public function setIsOwner($isOwner) * * @return string */ - public function getStatus() + public function getStatus(): string { return $this->container['status']; } @@ -299,8 +280,11 @@ public function getStatus() * * @return $this */ - public function setStatus($status) + public function setStatus(string $status): static { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -309,9 +293,9 @@ public function setStatus($status) /** * Gets featureAccess * - * @return \Brevo\Client\Models\GetInvitedUsersListFeatureAccess + * @return \Brevo\Client\Models\GetInvitedUsersListUsersInnerFeatureAccess */ - public function getFeatureAccess() + public function getFeatureAccess(): \Brevo\Client\Models\GetInvitedUsersListUsersInnerFeatureAccess { return $this->container['featureAccess']; } @@ -319,89 +303,19 @@ public function getFeatureAccess() /** * Sets featureAccess * - * @param \Brevo\Client\Models\GetInvitedUsersListFeatureAccess $featureAccess featureAccess + * @param \Brevo\Client\Models\GetInvitedUsersListUsersInnerFeatureAccess $featureAccess featureAccess * * @return $this */ - public function setFeatureAccess($featureAccess) + public function setFeatureAccess(\Brevo\Client\Models\GetInvitedUsersListUsersInnerFeatureAccess $featureAccess): static { + if (is_null($featureAccess)) { + throw new InvalidArgumentException('non-nullable featureAccess cannot be null'); + } $this->container['featureAccess'] = $featureAccess; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetInvitedUsersListUsersInnerFeatureAccess.php b/lib/Models/GetInvitedUsersListUsersInnerFeatureAccess.php new file mode 100644 index 0000000..98f0321 --- /dev/null +++ b/lib/Models/GetInvitedUsersListUsersInnerFeatureAccess.php @@ -0,0 +1,276 @@ + + */ +class GetInvitedUsersListUsersInnerFeatureAccess extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getInvitedUsersList_users_inner_feature_access'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'marketing' => 'string', + 'conversations' => 'string', + 'crm' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'marketing' => null, + 'conversations' => null, + 'crm' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'marketing' => false, + 'conversations' => false, + 'crm' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'marketing' => 'marketing', + 'conversations' => 'conversations', + 'crm' => 'crm' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'marketing' => 'setMarketing', + 'conversations' => 'setConversations', + 'crm' => 'setCrm' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'marketing' => 'getMarketing', + 'conversations' => 'getConversations', + 'crm' => 'getCrm' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('marketing', $data ?? [], null); + $this->setIfExists('conversations', $data ?? [], null); + $this->setIfExists('crm', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets marketing + * + * @return string|null + */ + public function getMarketing(): ?string + { + return $this->container['marketing']; + } + + /** + * Sets marketing + * + * @param string|null $marketing Marketing features accessiblity. + * + * @return $this + */ + public function setMarketing(?string $marketing): static + { + if (is_null($marketing)) { + throw new InvalidArgumentException('non-nullable marketing cannot be null'); + } + $this->container['marketing'] = $marketing; + + return $this; + } + + /** + * Gets conversations + * + * @return string|null + */ + public function getConversations(): ?string + { + return $this->container['conversations']; + } + + /** + * Sets conversations + * + * @param string|null $conversations Conversations features accessiblity. + * + * @return $this + */ + public function setConversations(?string $conversations): static + { + if (is_null($conversations)) { + throw new InvalidArgumentException('non-nullable conversations cannot be null'); + } + $this->container['conversations'] = $conversations; + + return $this; + } + + /** + * Gets crm + * + * @return string|null + */ + public function getCrm(): ?string + { + return $this->container['crm']; + } + + /** + * Sets crm + * + * @param string|null $crm CRM features accessiblity. + * + * @return $this + */ + public function setCrm(?string $crm): static + { + if (is_null($crm)) { + throw new InvalidArgumentException('non-nullable crm cannot be null'); + } + $this->container['crm'] = $crm; + + return $this; + } +} + + diff --git a/lib/Models/GetIp.php b/lib/Models/GetIp.php index cc58291..9901cf3 100644 --- a/lib/Models/GetIp.php +++ b/lib/Models/GetIp.php @@ -2,61 +2,63 @@ /** * GetIp * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetIp Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetIp implements ModelInterface, ArrayAccess +class GetIp extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getIp'; + protected static string $openAPIModelName = 'getIp'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'ip' => 'string', 'active' => 'bool', @@ -66,9 +68,9 @@ class GetIp implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'ip' => null, 'active' => null, @@ -76,32 +78,31 @@ class GetIp implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'ip' => false, + 'active' => false, + 'domain' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'ip' => 'ip', 'active' => 'active', @@ -111,9 +112,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'ip' => 'setIp', 'active' => 'setActive', @@ -123,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'ip' => 'getIp', 'active' => 'getActive', @@ -136,9 +137,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +147,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,54 +157,40 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['ip'] = isset($data['ip']) ? $data['ip'] : null; - $this->container['active'] = isset($data['active']) ? $data['active'] : null; - $this->container['domain'] = isset($data['domain']) ? $data['domain'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('ip', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('domain', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -222,24 +209,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -251,8 +226,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -263,7 +241,7 @@ public function setId($id) * * @return string */ - public function getIp() + public function getIp(): string { return $this->container['ip']; } @@ -275,8 +253,11 @@ public function getIp() * * @return $this */ - public function setIp($ip) + public function setIp(string $ip): static { + if (is_null($ip)) { + throw new InvalidArgumentException('non-nullable ip cannot be null'); + } $this->container['ip'] = $ip; return $this; @@ -287,7 +268,7 @@ public function setIp($ip) * * @return bool */ - public function getActive() + public function getActive(): bool { return $this->container['active']; } @@ -299,8 +280,11 @@ public function getActive() * * @return $this */ - public function setActive($active) + public function setActive(bool $active): static { + if (is_null($active)) { + throw new InvalidArgumentException('non-nullable active cannot be null'); + } $this->container['active'] = $active; return $this; @@ -311,7 +295,7 @@ public function setActive($active) * * @return string */ - public function getDomain() + public function getDomain(): string { return $this->container['domain']; } @@ -323,85 +307,15 @@ public function getDomain() * * @return $this */ - public function setDomain($domain) + public function setDomain(string $domain): static { + if (is_null($domain)) { + throw new InvalidArgumentException('non-nullable domain cannot be null'); + } $this->container['domain'] = $domain; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetIpFromSender.php b/lib/Models/GetIpFromSender.php index df0af00..4ec8579 100644 --- a/lib/Models/GetIpFromSender.php +++ b/lib/Models/GetIpFromSender.php @@ -2,61 +2,63 @@ /** * GetIpFromSender * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetIpFromSender Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetIpFromSender implements ModelInterface, ArrayAccess +class GetIpFromSender extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getIpFromSender'; + protected static string $openAPIModelName = 'getIpFromSender'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'ip' => 'string', 'domain' => 'string', @@ -66,9 +68,9 @@ class GetIpFromSender implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'ip' => null, 'domain' => null, @@ -76,32 +78,31 @@ class GetIpFromSender implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'ip' => false, + 'domain' => false, + 'weight' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'ip' => 'ip', 'domain' => 'domain', @@ -111,9 +112,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'ip' => 'setIp', 'domain' => 'setDomain', @@ -123,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'ip' => 'getIp', 'domain' => 'getDomain', @@ -136,9 +137,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +147,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,54 +157,40 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['ip'] = isset($data['ip']) ? $data['ip'] : null; - $this->container['domain'] = isset($data['domain']) ? $data['domain'] : null; - $this->container['weight'] = isset($data['weight']) ? $data['weight'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('ip', $data ?? [], null); + $this->setIfExists('domain', $data ?? [], null); + $this->setIfExists('weight', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -222,24 +209,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -251,8 +226,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -263,7 +241,7 @@ public function setId($id) * * @return string */ - public function getIp() + public function getIp(): string { return $this->container['ip']; } @@ -275,8 +253,11 @@ public function getIp() * * @return $this */ - public function setIp($ip) + public function setIp(string $ip): static { + if (is_null($ip)) { + throw new InvalidArgumentException('non-nullable ip cannot be null'); + } $this->container['ip'] = $ip; return $this; @@ -287,7 +268,7 @@ public function setIp($ip) * * @return string */ - public function getDomain() + public function getDomain(): string { return $this->container['domain']; } @@ -299,8 +280,11 @@ public function getDomain() * * @return $this */ - public function setDomain($domain) + public function setDomain(string $domain): static { + if (is_null($domain)) { + throw new InvalidArgumentException('non-nullable domain cannot be null'); + } $this->container['domain'] = $domain; return $this; @@ -311,7 +295,7 @@ public function setDomain($domain) * * @return int */ - public function getWeight() + public function getWeight(): int { return $this->container['weight']; } @@ -323,85 +307,15 @@ public function getWeight() * * @return $this */ - public function setWeight($weight) + public function setWeight(int $weight): static { + if (is_null($weight)) { + throw new InvalidArgumentException('non-nullable weight cannot be null'); + } $this->container['weight'] = $weight; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetIps.php b/lib/Models/GetIps.php index 169e1b1..69fb07a 100644 --- a/lib/Models/GetIps.php +++ b/lib/Models/GetIps.php @@ -2,118 +2,116 @@ /** * GetIps * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetIps Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetIps implements ModelInterface, ArrayAccess +class GetIps extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getIps'; + protected static string $openAPIModelName = 'getIps'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'ips' => '\Brevo\Client\Models\GetIp[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'ips' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'ips' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'ips' => 'ips' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'ips' => 'setIps' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'ips' => 'getIps' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,51 +139,37 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['ips'] = isset($data['ips']) ? $data['ips'] : null; + $this->setIfExists('ips', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -195,24 +179,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets ips * * @return \Brevo\Client\Models\GetIp[] */ - public function getIps() + public function getIps(): array { return $this->container['ips']; } @@ -224,85 +196,15 @@ public function getIps() * * @return $this */ - public function setIps($ips) + public function setIps(array $ips): static { + if (is_null($ips)) { + throw new InvalidArgumentException('non-nullable ips cannot be null'); + } $this->container['ips'] = $ips; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetIpsFromSender.php b/lib/Models/GetIpsFromSender.php index 7f02ace..a269bc8 100644 --- a/lib/Models/GetIpsFromSender.php +++ b/lib/Models/GetIpsFromSender.php @@ -2,118 +2,116 @@ /** * GetIpsFromSender * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetIpsFromSender Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetIpsFromSender implements ModelInterface, ArrayAccess +class GetIpsFromSender extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getIpsFromSender'; + protected static string $openAPIModelName = 'getIpsFromSender'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'ips' => '\Brevo\Client\Models\GetIpFromSender[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'ips' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'ips' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'ips' => 'ips' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'ips' => 'setIps' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'ips' => 'getIps' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,51 +139,37 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['ips'] = isset($data['ips']) ? $data['ips'] : null; + $this->setIfExists('ips', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -195,24 +179,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets ips * * @return \Brevo\Client\Models\GetIpFromSender[] */ - public function getIps() + public function getIps(): array { return $this->container['ips']; } @@ -224,85 +196,15 @@ public function getIps() * * @return $this */ - public function setIps($ips) + public function setIps(array $ips): static { + if (is_null($ips)) { + throw new InvalidArgumentException('non-nullable ips cannot be null'); + } $this->container['ips'] = $ips; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetList.php b/lib/Models/GetList.php index 4480dbe..d9ec8e3 100644 --- a/lib/Models/GetList.php +++ b/lib/Models/GetList.php @@ -2,61 +2,63 @@ /** * GetList * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetList Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetList implements ModelInterface, ArrayAccess +class GetList extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getList'; + protected static string $openAPIModelName = 'getList'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'totalBlacklisted' => 'int', @@ -67,9 +69,9 @@ class GetList implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'name' => null, 'totalBlacklisted' => 'int64', @@ -78,32 +80,32 @@ class GetList implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'totalBlacklisted' => false, + 'totalSubscribers' => false, + 'uniqueSubscribers' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name', 'totalBlacklisted' => 'totalBlacklisted', @@ -114,9 +116,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName', 'totalBlacklisted' => 'setTotalBlacklisted', @@ -127,9 +129,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName', 'totalBlacklisted' => 'getTotalBlacklisted', @@ -141,9 +143,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -151,9 +153,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -161,55 +163,41 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['totalBlacklisted'] = isset($data['totalBlacklisted']) ? $data['totalBlacklisted'] : null; - $this->container['totalSubscribers'] = isset($data['totalSubscribers']) ? $data['totalSubscribers'] : null; - $this->container['uniqueSubscribers'] = isset($data['uniqueSubscribers']) ? $data['uniqueSubscribers'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('totalBlacklisted', $data ?? [], null); + $this->setIfExists('totalSubscribers', $data ?? [], null); + $this->setIfExists('uniqueSubscribers', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -231,24 +219,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -260,8 +236,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -272,7 +251,7 @@ public function setId($id) * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -284,8 +263,11 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -296,7 +278,7 @@ public function setName($name) * * @return int */ - public function getTotalBlacklisted() + public function getTotalBlacklisted(): int { return $this->container['totalBlacklisted']; } @@ -308,8 +290,11 @@ public function getTotalBlacklisted() * * @return $this */ - public function setTotalBlacklisted($totalBlacklisted) + public function setTotalBlacklisted(int $totalBlacklisted): static { + if (is_null($totalBlacklisted)) { + throw new InvalidArgumentException('non-nullable totalBlacklisted cannot be null'); + } $this->container['totalBlacklisted'] = $totalBlacklisted; return $this; @@ -320,7 +305,7 @@ public function setTotalBlacklisted($totalBlacklisted) * * @return int */ - public function getTotalSubscribers() + public function getTotalSubscribers(): int { return $this->container['totalSubscribers']; } @@ -332,8 +317,11 @@ public function getTotalSubscribers() * * @return $this */ - public function setTotalSubscribers($totalSubscribers) + public function setTotalSubscribers(int $totalSubscribers): static { + if (is_null($totalSubscribers)) { + throw new InvalidArgumentException('non-nullable totalSubscribers cannot be null'); + } $this->container['totalSubscribers'] = $totalSubscribers; return $this; @@ -344,7 +332,7 @@ public function setTotalSubscribers($totalSubscribers) * * @return int */ - public function getUniqueSubscribers() + public function getUniqueSubscribers(): int { return $this->container['uniqueSubscribers']; } @@ -356,85 +344,15 @@ public function getUniqueSubscribers() * * @return $this */ - public function setUniqueSubscribers($uniqueSubscribers) + public function setUniqueSubscribers(int $uniqueSubscribers): static { + if (is_null($uniqueSubscribers)) { + throw new InvalidArgumentException('non-nullable uniqueSubscribers cannot be null'); + } $this->container['uniqueSubscribers'] = $uniqueSubscribers; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetLists.php b/lib/Models/GetLists.php index 0c803cc..2926c73 100644 --- a/lib/Models/GetLists.php +++ b/lib/Models/GetLists.php @@ -2,102 +2,101 @@ /** * GetLists * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetLists Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetLists implements ModelInterface, ArrayAccess +class GetLists extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getLists'; + protected static string $openAPIModelName = 'getLists'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'lists' => 'object[]', + protected static array $openAPITypes = [ + 'lists' => '\Brevo\Client\Models\GetListsListsInner[]', 'count' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'lists' => null, 'count' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'lists' => false, + 'count' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'lists' => 'lists', 'count' => 'count' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'lists' => 'setLists', 'count' => 'setCount' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'lists' => 'getLists', 'count' => 'getCount' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +145,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['lists'] = isset($data['lists']) ? $data['lists'] : null; - $this->container['count'] = isset($data['count']) ? $data['count'] : null; + $this->setIfExists('lists', $data ?? [], null); + $this->setIfExists('count', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets lists * - * @return object[] + * @return \Brevo\Client\Models\GetListsListsInner[]|null */ - public function getLists() + public function getLists(): ?array { return $this->container['lists']; } @@ -223,12 +196,15 @@ public function getLists() /** * Sets lists * - * @param object[] $lists Listing of all the lists available in your account + * @param \Brevo\Client\Models\GetListsListsInner[]|null $lists Listing of all the lists available in your account * * @return $this */ - public function setLists($lists) + public function setLists(?array $lists): static { + if (is_null($lists)) { + throw new InvalidArgumentException('non-nullable lists cannot be null'); + } $this->container['lists'] = $lists; return $this; @@ -237,9 +213,9 @@ public function setLists($lists) /** * Gets count * - * @return int + * @return int|null */ - public function getCount() + public function getCount(): ?int { return $this->container['count']; } @@ -247,89 +223,19 @@ public function getCount() /** * Sets count * - * @param int $count Number of lists in your account + * @param int|null $count Number of lists in your account * * @return $this */ - public function setCount($count) + public function setCount(?int $count): static { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } $this->container['count'] = $count; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetListsListsInner.php b/lib/Models/GetListsListsInner.php new file mode 100644 index 0000000..359f052 --- /dev/null +++ b/lib/Models/GetListsListsInner.php @@ -0,0 +1,395 @@ + + */ +class GetListsListsInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getLists_lists_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'name' => 'string', + 'totalBlacklisted' => 'int', + 'totalSubscribers' => 'int', + 'uniqueSubscribers' => 'int', + 'folderId' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'int64', + 'name' => null, + 'totalBlacklisted' => 'int64', + 'totalSubscribers' => 'int64', + 'uniqueSubscribers' => 'int64', + 'folderId' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'totalBlacklisted' => false, + 'totalSubscribers' => false, + 'uniqueSubscribers' => false, + 'folderId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'totalBlacklisted' => 'totalBlacklisted', + 'totalSubscribers' => 'totalSubscribers', + 'uniqueSubscribers' => 'uniqueSubscribers', + 'folderId' => 'folderId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'totalBlacklisted' => 'setTotalBlacklisted', + 'totalSubscribers' => 'setTotalSubscribers', + 'uniqueSubscribers' => 'setUniqueSubscribers', + 'folderId' => 'setFolderId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'totalBlacklisted' => 'getTotalBlacklisted', + 'totalSubscribers' => 'getTotalSubscribers', + 'uniqueSubscribers' => 'getUniqueSubscribers', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('totalBlacklisted', $data ?? [], null); + $this->setIfExists('totalSubscribers', $data ?? [], null); + $this->setIfExists('uniqueSubscribers', $data ?? [], null); + $this->setIfExists('folderId', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['totalBlacklisted'] === null) { + $invalidProperties[] = "'totalBlacklisted' can't be null"; + } + if ($this->container['totalSubscribers'] === null) { + $invalidProperties[] = "'totalSubscribers' can't be null"; + } + if ($this->container['uniqueSubscribers'] === null) { + $invalidProperties[] = "'uniqueSubscribers' can't be null"; + } + if ($this->container['folderId'] === null) { + $invalidProperties[] = "'folderId' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets id + * + * @return int + */ + public function getId(): int + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id ID of the list + * + * @return $this + */ + public function setId(int $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Name of the list + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets totalBlacklisted + * + * @return int + */ + public function getTotalBlacklisted(): int + { + return $this->container['totalBlacklisted']; + } + + /** + * Sets totalBlacklisted + * + * @param int $totalBlacklisted Number of blacklisted contacts in the list + * + * @return $this + */ + public function setTotalBlacklisted(int $totalBlacklisted): static + { + if (is_null($totalBlacklisted)) { + throw new InvalidArgumentException('non-nullable totalBlacklisted cannot be null'); + } + $this->container['totalBlacklisted'] = $totalBlacklisted; + + return $this; + } + + /** + * Gets totalSubscribers + * + * @return int + */ + public function getTotalSubscribers(): int + { + return $this->container['totalSubscribers']; + } + + /** + * Sets totalSubscribers + * + * @param int $totalSubscribers Number of contacts in the list + * + * @return $this + */ + public function setTotalSubscribers(int $totalSubscribers): static + { + if (is_null($totalSubscribers)) { + throw new InvalidArgumentException('non-nullable totalSubscribers cannot be null'); + } + $this->container['totalSubscribers'] = $totalSubscribers; + + return $this; + } + + /** + * Gets uniqueSubscribers + * + * @return int + */ + public function getUniqueSubscribers(): int + { + return $this->container['uniqueSubscribers']; + } + + /** + * Sets uniqueSubscribers + * + * @param int $uniqueSubscribers Number of unique contacts in the list + * + * @return $this + */ + public function setUniqueSubscribers(int $uniqueSubscribers): static + { + if (is_null($uniqueSubscribers)) { + throw new InvalidArgumentException('non-nullable uniqueSubscribers cannot be null'); + } + $this->container['uniqueSubscribers'] = $uniqueSubscribers; + + return $this; + } + + /** + * Gets folderId + * + * @return int + */ + public function getFolderId(): int + { + return $this->container['folderId']; + } + + /** + * Sets folderId + * + * @param int $folderId ID of the folder + * + * @return $this + */ + public function setFolderId(int $folderId): static + { + if (is_null($folderId)) { + throw new InvalidArgumentException('non-nullable folderId cannot be null'); + } + $this->container['folderId'] = $folderId; + + return $this; + } +} + + diff --git a/lib/Models/GetOrders.php b/lib/Models/GetOrders.php deleted file mode 100644 index f151445..0000000 --- a/lib/Models/GetOrders.php +++ /dev/null @@ -1,335 +0,0 @@ - 'object[]', - 'count' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'orders' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'orders' => 'orders', - 'count' => 'count' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'orders' => 'setOrders', - 'count' => 'setCount' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'orders' => 'getOrders', - '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 - */ - public function __construct(array $data = null) - { - $this->container['orders'] = isset($data['orders']) ? $data['orders'] : null; - $this->container['count'] = isset($data['count']) ? $data['count'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets orders - * - * @return object[] - */ - public function getOrders() - { - return $this->container['orders']; - } - - /** - * Sets orders - * - * @param object[] $orders orders - * - * @return $this - */ - public function setOrders($orders) - { - $this->container['orders'] = $orders; - - return $this; - } - - /** - * Gets count - * - * @return int - */ - public function getCount() - { - return $this->container['count']; - } - - /** - * Sets count - * - * @param int $count Number of orders - * - * @return $this - */ - public function setCount($count) - { - $this->container['count'] = $count; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetPaymentRequest.php b/lib/Models/GetPaymentRequest.php new file mode 100644 index 0000000..5a8c9b0 --- /dev/null +++ b/lib/Models/GetPaymentRequest.php @@ -0,0 +1,461 @@ + + */ +class GetPaymentRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getPaymentRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'reference' => 'string', + 'status' => 'string', + 'cart' => '\Brevo\Client\Models\Cart', + 'notification' => '\Brevo\Client\Models\Notification', + 'configuration' => '\Brevo\Client\Models\Configuration', + 'contactId' => 'int', + 'numberOfRemindersSent' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'reference' => null, + 'status' => null, + 'cart' => null, + 'notification' => null, + 'configuration' => null, + 'contactId' => 'int64', + 'numberOfRemindersSent' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'reference' => false, + 'status' => false, + 'cart' => false, + 'notification' => false, + 'configuration' => false, + 'contactId' => false, + 'numberOfRemindersSent' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'reference' => 'reference', + 'status' => 'status', + 'cart' => 'cart', + 'notification' => 'notification', + 'configuration' => 'configuration', + 'contactId' => 'contactId', + 'numberOfRemindersSent' => 'numberOfRemindersSent' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'reference' => 'setReference', + 'status' => 'setStatus', + 'cart' => 'setCart', + 'notification' => 'setNotification', + 'configuration' => 'setConfiguration', + 'contactId' => 'setContactId', + 'numberOfRemindersSent' => 'setNumberOfRemindersSent' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'reference' => 'getReference', + 'status' => 'getStatus', + 'cart' => 'getCart', + 'notification' => 'getNotification', + 'configuration' => 'getConfiguration', + 'contactId' => 'getContactId', + 'numberOfRemindersSent' => 'getNumberOfRemindersSent' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const STATUS_CREATED = 'created'; + public const STATUS_SENT = 'sent'; + public const STATUS_REMINDER_SENT = 'reminderSent'; + public const STATUS_PAID = 'paid'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_CREATED, + self::STATUS_SENT, + self::STATUS_REMINDER_SENT, + self::STATUS_PAID, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('reference', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('cart', $data ?? [], null); + $this->setIfExists('notification', $data ?? [], null); + $this->setIfExists('configuration', $data ?? [], null); + $this->setIfExists('contactId', $data ?? [], null); + $this->setIfExists('numberOfRemindersSent', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['reference'] === null) { + $invalidProperties[] = "'reference' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['cart'] === null) { + $invalidProperties[] = "'cart' can't be null"; + } + if ($this->container['notification'] === null) { + $invalidProperties[] = "'notification' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets reference + * + * @return string + */ + public function getReference(): string + { + return $this->container['reference']; + } + + /** + * Sets reference + * + * @param string $reference Reference of the payment request, it will appear on the payment page. + * + * @return $this + */ + public function setReference(string $reference): static + { + if (is_null($reference)) { + throw new InvalidArgumentException('non-nullable reference cannot be null'); + } + $this->container['reference'] = $reference; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus(): string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status Status of the payment request. + * + * @return $this + */ + public function setStatus(string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets cart + * + * @return \Brevo\Client\Models\Cart + */ + public function getCart(): \Brevo\Client\Models\Cart + { + return $this->container['cart']; + } + + /** + * Sets cart + * + * @param \Brevo\Client\Models\Cart $cart cart + * + * @return $this + */ + public function setCart(\Brevo\Client\Models\Cart $cart): static + { + if (is_null($cart)) { + throw new InvalidArgumentException('non-nullable cart cannot be null'); + } + $this->container['cart'] = $cart; + + return $this; + } + + /** + * Gets notification + * + * @return \Brevo\Client\Models\Notification + */ + public function getNotification(): \Brevo\Client\Models\Notification + { + return $this->container['notification']; + } + + /** + * Sets notification + * + * @param \Brevo\Client\Models\Notification $notification notification + * + * @return $this + */ + public function setNotification(\Brevo\Client\Models\Notification $notification): static + { + if (is_null($notification)) { + throw new InvalidArgumentException('non-nullable notification cannot be null'); + } + $this->container['notification'] = $notification; + + return $this; + } + + /** + * Gets configuration + * + * @return \Brevo\Client\Models\Configuration|null + */ + public function getConfiguration(): ?\Brevo\Client\Models\Configuration + { + return $this->container['configuration']; + } + + /** + * Sets configuration + * + * @param \Brevo\Client\Models\Configuration|null $configuration configuration + * + * @return $this + */ + public function setConfiguration(?\Brevo\Client\Models\Configuration $configuration): static + { + if (is_null($configuration)) { + throw new InvalidArgumentException('non-nullable configuration cannot be null'); + } + $this->container['configuration'] = $configuration; + + return $this; + } + + /** + * Gets contactId + * + * @return int|null + */ + public function getContactId(): ?int + { + return $this->container['contactId']; + } + + /** + * Sets contactId + * + * @param int|null $contactId Brevo ID of the contact requested to pay. + * + * @return $this + */ + public function setContactId(?int $contactId): static + { + if (is_null($contactId)) { + throw new InvalidArgumentException('non-nullable contactId cannot be null'); + } + $this->container['contactId'] = $contactId; + + return $this; + } + + /** + * Gets numberOfRemindersSent + * + * @return int|null + */ + public function getNumberOfRemindersSent(): ?int + { + return $this->container['numberOfRemindersSent']; + } + + /** + * Sets numberOfRemindersSent + * + * @param int|null $numberOfRemindersSent number of reminders sent. + * + * @return $this + */ + public function setNumberOfRemindersSent(?int $numberOfRemindersSent): static + { + if (is_null($numberOfRemindersSent)) { + throw new InvalidArgumentException('non-nullable numberOfRemindersSent cannot be null'); + } + $this->container['numberOfRemindersSent'] = $numberOfRemindersSent; + + return $this; + } +} + + diff --git a/lib/Models/GetProcess.php b/lib/Models/GetProcess.php index b26f897..74de193 100644 --- a/lib/Models/GetProcess.php +++ b/lib/Models/GetProcess.php @@ -2,61 +2,63 @@ /** * GetProcess * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetProcess Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetProcess implements ModelInterface, ArrayAccess +class GetProcess extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getProcess'; + protected static string $openAPIModelName = 'getProcess'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'status' => 'string', 'name' => 'string', @@ -66,9 +68,9 @@ class GetProcess implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'status' => null, 'name' => null, @@ -76,32 +78,31 @@ class GetProcess implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'status' => false, + 'name' => false, + 'exportUrl' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'status' => 'status', 'name' => 'name', @@ -111,9 +112,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'status' => 'setStatus', 'name' => 'setName', @@ -123,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'status' => 'getStatus', 'name' => 'getName', @@ -136,9 +137,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +147,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,28 +157,16 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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'; - - + public const STATUS_QUEUED = 'queued'; + public const STATUS_IN_PROCESS = 'in_process'; + public const STATUS_COMPLETED = 'completed'; /** * Gets allowable values of the enum @@ -193,34 +182,32 @@ public function getStatusAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['exportUrl'] = isset($data['exportUrl']) ? $data['exportUrl'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('exportUrl', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -233,7 +220,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -244,24 +232,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -273,8 +249,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -285,7 +264,7 @@ public function setId($id) * * @return string */ - public function getStatus() + public function getStatus(): string { return $this->container['status']; } @@ -297,13 +276,17 @@ public function getStatus() * * @return $this */ - public function setStatus($status) + public function setStatus(string $status): static { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); if (!in_array($status, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -318,7 +301,7 @@ public function setStatus($status) * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -330,8 +313,11 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -340,9 +326,9 @@ public function setName($name) /** * Gets exportUrl * - * @return string + * @return string|null */ - public function getExportUrl() + public function getExportUrl(): ?string { return $this->container['exportUrl']; } @@ -350,89 +336,19 @@ public function getExportUrl() /** * Sets exportUrl * - * @param string $exportUrl URL on which send export the of contacts once the process is completed + * @param string|null $exportUrl URL on which send export the of contacts once the process is completed * * @return $this */ - public function setExportUrl($exportUrl) + public function setExportUrl(?string $exportUrl): static { + if (is_null($exportUrl)) { + throw new InvalidArgumentException('non-nullable exportUrl cannot be null'); + } $this->container['exportUrl'] = $exportUrl; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetProcesses.php b/lib/Models/GetProcesses.php index 790d320..5d6c1fe 100644 --- a/lib/Models/GetProcesses.php +++ b/lib/Models/GetProcesses.php @@ -2,61 +2,63 @@ /** * GetProcesses * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetProcesses Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetProcesses implements ModelInterface, ArrayAccess +class GetProcesses extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getProcesses'; + protected static string $openAPIModelName = 'getProcesses'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'processes' => '\Brevo\Client\Models\GetProcess[]', 'count' => 'int' ]; @@ -64,40 +66,37 @@ class GetProcesses implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'processes' => null, 'count' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'processes' => false, + 'count' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'processes' => 'processes', 'count' => 'count' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'processes' => 'setProcesses', 'count' => 'setCount' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'processes' => 'getProcesses', 'count' => 'getCount' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +145,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['processes'] = isset($data['processes']) ? $data['processes'] : null; - $this->container['count'] = isset($data['count']) ? $data['count'] : null; + $this->setIfExists('processes', $data ?? [], null); + $this->setIfExists('count', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets processes * - * @return \Brevo\Client\Models\GetProcess[] + * @return \Brevo\Client\Models\GetProcess[]|null */ - public function getProcesses() + public function getProcesses(): ?array { return $this->container['processes']; } @@ -223,12 +196,15 @@ public function getProcesses() /** * Sets processes * - * @param \Brevo\Client\Models\GetProcess[] $processes List of processes available on your account + * @param \Brevo\Client\Models\GetProcess[]|null $processes List of processes available on your account * * @return $this */ - public function setProcesses($processes) + public function setProcesses(?array $processes): static { + if (is_null($processes)) { + throw new InvalidArgumentException('non-nullable processes cannot be null'); + } $this->container['processes'] = $processes; return $this; @@ -237,9 +213,9 @@ public function setProcesses($processes) /** * Gets count * - * @return int + * @return int|null */ - public function getCount() + public function getCount(): ?int { return $this->container['count']; } @@ -247,89 +223,19 @@ public function getCount() /** * Sets count * - * @param int $count Number of processes available on your account + * @param int|null $count Number of processes available on your account * * @return $this */ - public function setCount($count) + public function setCount(?int $count): static { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } $this->container['count'] = $count; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetProductDetails.php b/lib/Models/GetProductDetails.php index a607070..1425bf9 100644 --- a/lib/Models/GetProductDetails.php +++ b/lib/Models/GetProductDetails.php @@ -2,65 +2,69 @@ /** * GetProductDetails * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetProductDetails Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetProductDetails implements ModelInterface, ArrayAccess +class GetProductDetails extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getProductDetails'; + protected static string $openAPIModelName = 'getProductDetails'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'string', 'name' => 'string', 'createdAt' => 'string', 'modifiedAt' => 'string', + 's3ThumbAnalytics' => 'string', + 's3ThumbEditor' => 'string', 'url' => 'string', 'imageUrl' => 'string', 'sku' => 'string', @@ -68,22 +72,22 @@ class GetProductDetails implements ModelInterface, ArrayAccess 'categories' => 'string[]', 'parentId' => 'string', 's3Original' => 'string', - 's3ThumbAnalytics' => 'string', 'metaInfo' => 'object', - 's3ThumbEditor' => 'string', 'isDeleted' => 'bool' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'string', 'name' => 'string', 'createdAt' => null, 'modifiedAt' => null, + 's3ThumbAnalytics' => 'string', + 's3ThumbEditor' => 'string', 'url' => 'string', 'imageUrl' => 'string', 'sku' => 'string', @@ -91,43 +95,53 @@ class GetProductDetails implements ModelInterface, ArrayAccess 'categories' => null, 'parentId' => 'string', 's3Original' => 'string', - 's3ThumbAnalytics' => 'string', 'metaInfo' => null, - 's3ThumbEditor' => 'string', - 'isDeleted' => 'string' + 'isDeleted' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'createdAt' => false, + 'modifiedAt' => false, + 's3ThumbAnalytics' => false, + 's3ThumbEditor' => false, + 'url' => false, + 'imageUrl' => false, + 'sku' => false, + 'price' => false, + 'categories' => false, + 'parentId' => false, + 's3Original' => false, + 'metaInfo' => false, + 'isDeleted' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name', 'createdAt' => 'createdAt', 'modifiedAt' => 'modifiedAt', + 's3ThumbAnalytics' => 's3ThumbAnalytics', + 's3ThumbEditor' => 's3ThumbEditor', 'url' => 'url', 'imageUrl' => 'imageUrl', 'sku' => 'sku', @@ -135,22 +149,22 @@ public static function swaggerFormats() 'categories' => 'categories', 'parentId' => 'parentId', 's3Original' => 's3Original', - 's3ThumbAnalytics' => 's3ThumbAnalytics', 'metaInfo' => 'metaInfo', - 's3ThumbEditor' => 's3ThumbEditor', 'isDeleted' => 'isDeleted' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName', 'createdAt' => 'setCreatedAt', 'modifiedAt' => 'setModifiedAt', + 's3ThumbAnalytics' => 'setS3ThumbAnalytics', + 's3ThumbEditor' => 'setS3ThumbEditor', 'url' => 'setUrl', 'imageUrl' => 'setImageUrl', 'sku' => 'setSku', @@ -158,22 +172,22 @@ public static function swaggerFormats() 'categories' => 'setCategories', 'parentId' => 'setParentId', 's3Original' => 'setS3Original', - 's3ThumbAnalytics' => 'setS3ThumbAnalytics', 'metaInfo' => 'setMetaInfo', - 's3ThumbEditor' => 'setS3ThumbEditor', 'isDeleted' => 'setIsDeleted' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName', 'createdAt' => 'getCreatedAt', 'modifiedAt' => 'getModifiedAt', + 's3ThumbAnalytics' => 'getS3ThumbAnalytics', + 's3ThumbEditor' => 'getS3ThumbEditor', 'url' => 'getUrl', 'imageUrl' => 'getImageUrl', 'sku' => 'getSku', @@ -181,9 +195,7 @@ public static function swaggerFormats() 'categories' => 'getCategories', 'parentId' => 'getParentId', 's3Original' => 'getS3Original', - 's3ThumbAnalytics' => 'getS3ThumbAnalytics', 'metaInfo' => 'getMetaInfo', - 's3ThumbEditor' => 'getS3ThumbEditor', 'isDeleted' => 'getIsDeleted' ]; @@ -191,9 +203,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -201,9 +213,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -211,65 +223,51 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['modifiedAt'] = isset($data['modifiedAt']) ? $data['modifiedAt'] : null; - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['imageUrl'] = isset($data['imageUrl']) ? $data['imageUrl'] : null; - $this->container['sku'] = isset($data['sku']) ? $data['sku'] : null; - $this->container['price'] = isset($data['price']) ? $data['price'] : null; - $this->container['categories'] = isset($data['categories']) ? $data['categories'] : null; - $this->container['parentId'] = isset($data['parentId']) ? $data['parentId'] : null; - $this->container['s3Original'] = isset($data['s3Original']) ? $data['s3Original'] : null; - $this->container['s3ThumbAnalytics'] = isset($data['s3ThumbAnalytics']) ? $data['s3ThumbAnalytics'] : null; - $this->container['metaInfo'] = isset($data['metaInfo']) ? $data['metaInfo'] : null; - $this->container['s3ThumbEditor'] = isset($data['s3ThumbEditor']) ? $data['s3ThumbEditor'] : null; - $this->container['isDeleted'] = isset($data['isDeleted']) ? $data['isDeleted'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('modifiedAt', $data ?? [], null); + $this->setIfExists('s3ThumbAnalytics', $data ?? [], null); + $this->setIfExists('s3ThumbEditor', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('sku', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('parentId', $data ?? [], null); + $this->setIfExists('s3Original', $data ?? [], null); + $this->setIfExists('metaInfo', $data ?? [], null); + $this->setIfExists('isDeleted', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -294,24 +292,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return string */ - public function getId() + public function getId(): string { return $this->container['id']; } @@ -323,8 +309,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(string $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -335,7 +324,7 @@ public function setId($id) * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -347,8 +336,11 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -359,7 +351,7 @@ public function setName($name) * * @return string */ - public function getCreatedAt() + public function getCreatedAt(): string { return $this->container['createdAt']; } @@ -371,8 +363,11 @@ public function getCreatedAt() * * @return $this */ - public function setCreatedAt($createdAt) + public function setCreatedAt(string $createdAt): static { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } $this->container['createdAt'] = $createdAt; return $this; @@ -383,7 +378,7 @@ public function setCreatedAt($createdAt) * * @return string */ - public function getModifiedAt() + public function getModifiedAt(): string { return $this->container['modifiedAt']; } @@ -395,249 +390,282 @@ public function getModifiedAt() * * @return $this */ - public function setModifiedAt($modifiedAt) + public function setModifiedAt(string $modifiedAt): static { + if (is_null($modifiedAt)) { + throw new InvalidArgumentException('non-nullable modifiedAt cannot be null'); + } $this->container['modifiedAt'] = $modifiedAt; return $this; } /** - * Gets url + * Gets s3ThumbAnalytics * * @return string */ - public function getUrl() + public function getS3ThumbAnalytics(): string { - return $this->container['url']; + return $this->container['s3ThumbAnalytics']; } /** - * Sets url + * Sets s3ThumbAnalytics * - * @param string $url URL to the product + * @param string $s3ThumbAnalytics S3 thumbnail url of original image in 120x120 dimension for analytics section * * @return $this */ - public function setUrl($url) + public function setS3ThumbAnalytics(string $s3ThumbAnalytics): static { - $this->container['url'] = $url; + if (is_null($s3ThumbAnalytics)) { + throw new InvalidArgumentException('non-nullable s3ThumbAnalytics cannot be null'); + } + $this->container['s3ThumbAnalytics'] = $s3ThumbAnalytics; return $this; } /** - * Gets imageUrl + * Gets s3ThumbEditor * * @return string */ - public function getImageUrl() + public function getS3ThumbEditor(): string { - return $this->container['imageUrl']; + return $this->container['s3ThumbEditor']; } /** - * Sets imageUrl + * Sets s3ThumbEditor * - * @param string $imageUrl Absolute URL to the cover image of the product + * @param string $s3ThumbEditor S3 thumbnail url of original image in 600x400 dimension for editor section * * @return $this */ - public function setImageUrl($imageUrl) + public function setS3ThumbEditor(string $s3ThumbEditor): static { - $this->container['imageUrl'] = $imageUrl; + if (is_null($s3ThumbEditor)) { + throw new InvalidArgumentException('non-nullable s3ThumbEditor cannot be null'); + } + $this->container['s3ThumbEditor'] = $s3ThumbEditor; return $this; } /** - * Gets sku + * Gets url * - * @return string + * @return string|null */ - public function getSku() + public function getUrl(): ?string { - return $this->container['sku']; + return $this->container['url']; } /** - * Sets sku + * Sets url * - * @param string $sku Product identifier from the shop + * @param string|null $url URL to the product * * @return $this */ - public function setSku($sku) + public function setUrl(?string $url): static { - $this->container['sku'] = $sku; + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; return $this; } /** - * Gets price + * Gets imageUrl * - * @return float + * @return string|null */ - public function getPrice() + public function getImageUrl(): ?string { - return $this->container['price']; + return $this->container['imageUrl']; } /** - * Sets price + * Sets imageUrl * - * @param float $price Price of the product + * @param string|null $imageUrl Absolute URL to the cover image of the product * * @return $this */ - public function setPrice($price) + public function setImageUrl(?string $imageUrl): static { - $this->container['price'] = $price; + if (is_null($imageUrl)) { + throw new InvalidArgumentException('non-nullable imageUrl cannot be null'); + } + $this->container['imageUrl'] = $imageUrl; return $this; } /** - * Gets categories + * Gets sku * - * @return string[] + * @return string|null */ - public function getCategories() + public function getSku(): ?string { - return $this->container['categories']; + return $this->container['sku']; } /** - * Sets categories + * Sets sku * - * @param string[] $categories Category ID-s of the product + * @param string|null $sku Product identifier from the shop * * @return $this */ - public function setCategories($categories) + public function setSku(?string $sku): static { - $this->container['categories'] = $categories; + if (is_null($sku)) { + throw new InvalidArgumentException('non-nullable sku cannot be null'); + } + $this->container['sku'] = $sku; return $this; } /** - * Gets parentId + * Gets price * - * @return string + * @return float|null */ - public function getParentId() + public function getPrice(): ?float { - return $this->container['parentId']; + return $this->container['price']; } /** - * Sets parentId + * Sets price * - * @param string $parentId Parent product id of the product + * @param float|null $price Price of the product * * @return $this */ - public function setParentId($parentId) + public function setPrice(?float $price): static { - $this->container['parentId'] = $parentId; + if (is_null($price)) { + throw new InvalidArgumentException('non-nullable price cannot be null'); + } + $this->container['price'] = $price; return $this; } /** - * Gets s3Original + * Gets categories * - * @return string + * @return string[]|null */ - public function getS3Original() + public function getCategories(): ?array { - return $this->container['s3Original']; + return $this->container['categories']; } /** - * Sets s3Original + * Sets categories * - * @param string $s3Original S3 url of original image + * @param string[]|null $categories Category ID-s of the product * * @return $this */ - public function setS3Original($s3Original) + public function setCategories(?array $categories): static { - $this->container['s3Original'] = $s3Original; + if (is_null($categories)) { + throw new InvalidArgumentException('non-nullable categories cannot be null'); + } + $this->container['categories'] = $categories; return $this; } /** - * Gets s3ThumbAnalytics + * Gets parentId * - * @return string + * @return string|null */ - public function getS3ThumbAnalytics() + public function getParentId(): ?string { - return $this->container['s3ThumbAnalytics']; + return $this->container['parentId']; } /** - * Sets s3ThumbAnalytics + * Sets parentId * - * @param string $s3ThumbAnalytics S3 thumbnail url of original image in 120x120 dimension for analytics section + * @param string|null $parentId Parent product id of the product * * @return $this */ - public function setS3ThumbAnalytics($s3ThumbAnalytics) + public function setParentId(?string $parentId): static { - $this->container['s3ThumbAnalytics'] = $s3ThumbAnalytics; + if (is_null($parentId)) { + throw new InvalidArgumentException('non-nullable parentId cannot be null'); + } + $this->container['parentId'] = $parentId; return $this; } /** - * Gets metaInfo + * Gets s3Original * - * @return object + * @return string|null */ - public function getMetaInfo() + public function getS3Original(): ?string { - return $this->container['metaInfo']; + return $this->container['s3Original']; } /** - * Sets metaInfo + * Sets s3Original * - * @param object $metaInfo Meta data of product such as description, vendor, producer, stock level, etc. + * @param string|null $s3Original S3 url of original image * * @return $this */ - public function setMetaInfo($metaInfo) + public function setS3Original(?string $s3Original): static { - $this->container['metaInfo'] = $metaInfo; + if (is_null($s3Original)) { + throw new InvalidArgumentException('non-nullable s3Original cannot be null'); + } + $this->container['s3Original'] = $s3Original; return $this; } /** - * Gets s3ThumbEditor + * Gets metaInfo * - * @return string + * @return object|null */ - public function getS3ThumbEditor() + public function getMetaInfo(): ?object { - return $this->container['s3ThumbEditor']; + return $this->container['metaInfo']; } /** - * Sets s3ThumbEditor + * Sets metaInfo * - * @param string $s3ThumbEditor S3 thumbnail url of original image in 600x400 dimension for editor section + * @param object|null $metaInfo Meta data of product such as description, vendor, producer, stock level, etc. * * @return $this */ - public function setS3ThumbEditor($s3ThumbEditor) + public function setMetaInfo(?object $metaInfo): static { - $this->container['s3ThumbEditor'] = $s3ThumbEditor; + if (is_null($metaInfo)) { + throw new InvalidArgumentException('non-nullable metaInfo cannot be null'); + } + $this->container['metaInfo'] = $metaInfo; return $this; } @@ -645,9 +673,9 @@ public function setS3ThumbEditor($s3ThumbEditor) /** * Gets isDeleted * - * @return bool + * @return bool|null */ - public function getIsDeleted() + public function getIsDeleted(): ?bool { return $this->container['isDeleted']; } @@ -655,89 +683,19 @@ public function getIsDeleted() /** * Sets isDeleted * - * @param bool $isDeleted product deleted from the shop's database + * @param bool|null $isDeleted product deleted from the shop's database * * @return $this */ - public function setIsDeleted($isDeleted) + public function setIsDeleted(?bool $isDeleted): static { + if (is_null($isDeleted)) { + throw new InvalidArgumentException('non-nullable isDeleted cannot be null'); + } $this->container['isDeleted'] = $isDeleted; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetProducts.php b/lib/Models/GetProducts.php index 9d1dc33..de470ef 100644 --- a/lib/Models/GetProducts.php +++ b/lib/Models/GetProducts.php @@ -2,102 +2,101 @@ /** * GetProducts * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetProducts Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetProducts implements ModelInterface, ArrayAccess +class GetProducts extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getProducts'; + protected static string $openAPIModelName = 'getProducts'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'products' => 'object[]', + protected static array $openAPITypes = [ + 'products' => 'GetProductDetails[]', 'count' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'products' => null, 'count' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'products' => false, + 'count' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'products' => 'products', 'count' => 'count' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'products' => 'setProducts', 'count' => 'setCount' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'products' => 'getProducts', 'count' => 'getCount' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,52 +145,38 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['products'] = isset($data['products']) ? $data['products'] : null; - $this->container['count'] = isset($data['count']) ? $data['count'] : null; + $this->setIfExists('products', $data ?? [], null); + $this->setIfExists('count', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -204,24 +189,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets products * - * @return object[] + * @return GetProductDetails[] */ - public function getProducts() + public function getProducts(): array { return $this->container['products']; } @@ -229,12 +202,15 @@ public function getProducts() /** * Sets products * - * @param object[] $products products + * @param GetProductDetails[] $products products * * @return $this */ - public function setProducts($products) + public function setProducts(array $products): static { + if (is_null($products)) { + throw new InvalidArgumentException('non-nullable products cannot be null'); + } $this->container['products'] = $products; return $this; @@ -245,7 +221,7 @@ public function setProducts($products) * * @return int */ - public function getCount() + public function getCount(): int { return $this->container['count']; } @@ -257,85 +233,15 @@ public function getCount() * * @return $this */ - public function setCount($count) + public function setCount(int $count): static { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } $this->container['count'] = $count; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetReports.php b/lib/Models/GetReports.php index ff05088..19f48ac 100644 --- a/lib/Models/GetReports.php +++ b/lib/Models/GetReports.php @@ -2,118 +2,116 @@ /** * GetReports * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetReports Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetReports implements ModelInterface, ArrayAccess +class GetReports extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getReports'; + protected static string $openAPIModelName = 'getReports'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'reports' => '\Brevo\Client\Models\GetReportsReports[]' + protected static array $openAPITypes = [ + 'reports' => '\Brevo\Client\Models\GetReportsReportsInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'reports' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'reports' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'reports' => 'reports' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'reports' => 'setReports' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'reports' => 'getReports' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,75 +139,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['reports'] = isset($data['reports']) ? $data['reports'] : null; + $this->setIfExists('reports', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets reports * - * @return \Brevo\Client\Models\GetReportsReports[] + * @return \Brevo\Client\Models\GetReportsReportsInner[]|null */ - public function getReports() + public function getReports(): ?array { return $this->container['reports']; } @@ -217,89 +189,19 @@ public function getReports() /** * Sets reports * - * @param \Brevo\Client\Models\GetReportsReports[] $reports reports + * @param \Brevo\Client\Models\GetReportsReportsInner[]|null $reports reports * * @return $this */ - public function setReports($reports) + public function setReports(?array $reports): static { + if (is_null($reports)) { + throw new InvalidArgumentException('non-nullable reports cannot be null'); + } $this->container['reports'] = $reports; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetReportsReports.php b/lib/Models/GetReportsReportsInner.php similarity index 63% rename from lib/Models/GetReportsReports.php rename to lib/Models/GetReportsReportsInner.php index 81add3c..93b2581 100644 --- a/lib/Models/GetReportsReports.php +++ b/lib/Models/GetReportsReportsInner.php @@ -1,62 +1,64 @@ */ -class GetReportsReports implements ModelInterface, ArrayAccess +class GetReportsReportsInner extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getReports_reports'; + protected static string $openAPIModelName = 'getReports_reports_inner'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'date' => '\DateTime', 'requests' => 'int', 'delivered' => 'int', @@ -75,9 +77,9 @@ class GetReportsReports implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'date' => 'date', 'requests' => 'int64', 'delivered' => 'int64', @@ -94,32 +96,40 @@ class GetReportsReports implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'date' => false, + 'requests' => false, + 'delivered' => false, + 'hardBounces' => false, + 'softBounces' => false, + 'clicks' => false, + 'uniqueClicks' => false, + 'opens' => false, + 'uniqueOpens' => false, + 'spamReports' => false, + 'blocked' => false, + 'invalid' => false, + 'unsubscribed' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'date' => 'date', 'requests' => 'requests', 'delivered' => 'delivered', @@ -138,9 +148,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'date' => 'setDate', 'requests' => 'setRequests', 'delivered' => 'setDelivered', @@ -159,9 +169,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'date' => 'getDate', 'requests' => 'getRequests', 'delivered' => 'getDelivered', @@ -181,9 +191,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -191,9 +201,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -201,63 +211,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['date'] = isset($data['date']) ? $data['date'] : null; - $this->container['requests'] = isset($data['requests']) ? $data['requests'] : null; - $this->container['delivered'] = isset($data['delivered']) ? $data['delivered'] : null; - $this->container['hardBounces'] = isset($data['hardBounces']) ? $data['hardBounces'] : null; - $this->container['softBounces'] = isset($data['softBounces']) ? $data['softBounces'] : null; - $this->container['clicks'] = isset($data['clicks']) ? $data['clicks'] : null; - $this->container['uniqueClicks'] = isset($data['uniqueClicks']) ? $data['uniqueClicks'] : null; - $this->container['opens'] = isset($data['opens']) ? $data['opens'] : null; - $this->container['uniqueOpens'] = isset($data['uniqueOpens']) ? $data['uniqueOpens'] : null; - $this->container['spamReports'] = isset($data['spamReports']) ? $data['spamReports'] : null; - $this->container['blocked'] = isset($data['blocked']) ? $data['blocked'] : null; - $this->container['invalid'] = isset($data['invalid']) ? $data['invalid'] : null; - $this->container['unsubscribed'] = isset($data['unsubscribed']) ? $data['unsubscribed'] : null; + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('requests', $data ?? [], null); + $this->setIfExists('delivered', $data ?? [], null); + $this->setIfExists('hardBounces', $data ?? [], null); + $this->setIfExists('softBounces', $data ?? [], null); + $this->setIfExists('clicks', $data ?? [], null); + $this->setIfExists('uniqueClicks', $data ?? [], null); + $this->setIfExists('opens', $data ?? [], null); + $this->setIfExists('uniqueOpens', $data ?? [], null); + $this->setIfExists('spamReports', $data ?? [], null); + $this->setIfExists('blocked', $data ?? [], null); + $this->setIfExists('invalid', $data ?? [], null); + $this->setIfExists('unsubscribed', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -303,24 +299,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets date * * @return \DateTime */ - public function getDate() + public function getDate(): \DateTime { return $this->container['date']; } @@ -332,8 +316,11 @@ public function getDate() * * @return $this */ - public function setDate($date) + public function setDate(\DateTime $date): static { + if (is_null($date)) { + throw new InvalidArgumentException('non-nullable date cannot be null'); + } $this->container['date'] = $date; return $this; @@ -344,7 +331,7 @@ public function setDate($date) * * @return int */ - public function getRequests() + public function getRequests(): int { return $this->container['requests']; } @@ -356,8 +343,11 @@ public function getRequests() * * @return $this */ - public function setRequests($requests) + public function setRequests(int $requests): static { + if (is_null($requests)) { + throw new InvalidArgumentException('non-nullable requests cannot be null'); + } $this->container['requests'] = $requests; return $this; @@ -368,7 +358,7 @@ public function setRequests($requests) * * @return int */ - public function getDelivered() + public function getDelivered(): int { return $this->container['delivered']; } @@ -380,8 +370,11 @@ public function getDelivered() * * @return $this */ - public function setDelivered($delivered) + public function setDelivered(int $delivered): static { + if (is_null($delivered)) { + throw new InvalidArgumentException('non-nullable delivered cannot be null'); + } $this->container['delivered'] = $delivered; return $this; @@ -392,7 +385,7 @@ public function setDelivered($delivered) * * @return int */ - public function getHardBounces() + public function getHardBounces(): int { return $this->container['hardBounces']; } @@ -404,8 +397,11 @@ public function getHardBounces() * * @return $this */ - public function setHardBounces($hardBounces) + public function setHardBounces(int $hardBounces): static { + if (is_null($hardBounces)) { + throw new InvalidArgumentException('non-nullable hardBounces cannot be null'); + } $this->container['hardBounces'] = $hardBounces; return $this; @@ -416,7 +412,7 @@ public function setHardBounces($hardBounces) * * @return int */ - public function getSoftBounces() + public function getSoftBounces(): int { return $this->container['softBounces']; } @@ -428,8 +424,11 @@ public function getSoftBounces() * * @return $this */ - public function setSoftBounces($softBounces) + public function setSoftBounces(int $softBounces): static { + if (is_null($softBounces)) { + throw new InvalidArgumentException('non-nullable softBounces cannot be null'); + } $this->container['softBounces'] = $softBounces; return $this; @@ -440,7 +439,7 @@ public function setSoftBounces($softBounces) * * @return int */ - public function getClicks() + public function getClicks(): int { return $this->container['clicks']; } @@ -452,8 +451,11 @@ public function getClicks() * * @return $this */ - public function setClicks($clicks) + public function setClicks(int $clicks): static { + if (is_null($clicks)) { + throw new InvalidArgumentException('non-nullable clicks cannot be null'); + } $this->container['clicks'] = $clicks; return $this; @@ -464,7 +466,7 @@ public function setClicks($clicks) * * @return int */ - public function getUniqueClicks() + public function getUniqueClicks(): int { return $this->container['uniqueClicks']; } @@ -476,8 +478,11 @@ public function getUniqueClicks() * * @return $this */ - public function setUniqueClicks($uniqueClicks) + public function setUniqueClicks(int $uniqueClicks): static { + if (is_null($uniqueClicks)) { + throw new InvalidArgumentException('non-nullable uniqueClicks cannot be null'); + } $this->container['uniqueClicks'] = $uniqueClicks; return $this; @@ -488,7 +493,7 @@ public function setUniqueClicks($uniqueClicks) * * @return int */ - public function getOpens() + public function getOpens(): int { return $this->container['opens']; } @@ -500,8 +505,11 @@ public function getOpens() * * @return $this */ - public function setOpens($opens) + public function setOpens(int $opens): static { + if (is_null($opens)) { + throw new InvalidArgumentException('non-nullable opens cannot be null'); + } $this->container['opens'] = $opens; return $this; @@ -512,7 +520,7 @@ public function setOpens($opens) * * @return int */ - public function getUniqueOpens() + public function getUniqueOpens(): int { return $this->container['uniqueOpens']; } @@ -524,8 +532,11 @@ public function getUniqueOpens() * * @return $this */ - public function setUniqueOpens($uniqueOpens) + public function setUniqueOpens(int $uniqueOpens): static { + if (is_null($uniqueOpens)) { + throw new InvalidArgumentException('non-nullable uniqueOpens cannot be null'); + } $this->container['uniqueOpens'] = $uniqueOpens; return $this; @@ -536,7 +547,7 @@ public function setUniqueOpens($uniqueOpens) * * @return int */ - public function getSpamReports() + public function getSpamReports(): int { return $this->container['spamReports']; } @@ -548,8 +559,11 @@ public function getSpamReports() * * @return $this */ - public function setSpamReports($spamReports) + public function setSpamReports(int $spamReports): static { + if (is_null($spamReports)) { + throw new InvalidArgumentException('non-nullable spamReports cannot be null'); + } $this->container['spamReports'] = $spamReports; return $this; @@ -560,7 +574,7 @@ public function setSpamReports($spamReports) * * @return int */ - public function getBlocked() + public function getBlocked(): int { return $this->container['blocked']; } @@ -572,8 +586,11 @@ public function getBlocked() * * @return $this */ - public function setBlocked($blocked) + public function setBlocked(int $blocked): static { + if (is_null($blocked)) { + throw new InvalidArgumentException('non-nullable blocked cannot be null'); + } $this->container['blocked'] = $blocked; return $this; @@ -584,7 +601,7 @@ public function setBlocked($blocked) * * @return int */ - public function getInvalid() + public function getInvalid(): int { return $this->container['invalid']; } @@ -596,8 +613,11 @@ public function getInvalid() * * @return $this */ - public function setInvalid($invalid) + public function setInvalid(int $invalid): static { + if (is_null($invalid)) { + throw new InvalidArgumentException('non-nullable invalid cannot be null'); + } $this->container['invalid'] = $invalid; return $this; @@ -608,7 +628,7 @@ public function setInvalid($invalid) * * @return int */ - public function getUnsubscribed() + public function getUnsubscribed(): int { return $this->container['unsubscribed']; } @@ -620,85 +640,15 @@ public function getUnsubscribed() * * @return $this */ - public function setUnsubscribed($unsubscribed) + public function setUnsubscribed(int $unsubscribed): static { + if (is_null($unsubscribed)) { + throw new InvalidArgumentException('non-nullable unsubscribed cannot be null'); + } $this->container['unsubscribed'] = $unsubscribed; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetScheduledEmailByBatchId.php b/lib/Models/GetScheduledEmailByBatchId.php index 539a57e..0b71f1e 100644 --- a/lib/Models/GetScheduledEmailByBatchId.php +++ b/lib/Models/GetScheduledEmailByBatchId.php @@ -2,102 +2,101 @@ /** * GetScheduledEmailByBatchId * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetScheduledEmailByBatchId Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetScheduledEmailByBatchId implements ModelInterface, ArrayAccess +class GetScheduledEmailByBatchId extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getScheduledEmailByBatchId'; + protected static string $openAPIModelName = 'getScheduledEmailByBatchId'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'count' => 'int', - 'batches' => '\Brevo\Client\Models\GetScheduledEmailByBatchIdBatches[]' + 'batches' => '\Brevo\Client\Models\GetScheduledEmailByBatchIdBatchesInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'count' => null, 'batches' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'count' => false, + 'batches' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'count' => 'count', 'batches' => 'batches' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'count' => 'setCount', 'batches' => 'setBatches' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'count' => 'getCount', 'batches' => 'getBatches' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +145,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['count'] = isset($data['count']) ? $data['count'] : null; - $this->container['batches'] = isset($data['batches']) ? $data['batches'] : null; + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('batches', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets count * - * @return int + * @return int|null */ - public function getCount() + public function getCount(): ?int { return $this->container['count']; } @@ -223,12 +196,15 @@ public function getCount() /** * Sets count * - * @param int $count Total number of batches + * @param int|null $count Total number of batches * * @return $this */ - public function setCount($count) + public function setCount(?int $count): static { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } $this->container['count'] = $count; return $this; @@ -237,9 +213,9 @@ public function setCount($count) /** * Gets batches * - * @return \Brevo\Client\Models\GetScheduledEmailByBatchIdBatches[] + * @return \Brevo\Client\Models\GetScheduledEmailByBatchIdBatchesInner[]|null */ - public function getBatches() + public function getBatches(): ?array { return $this->container['batches']; } @@ -247,89 +223,19 @@ public function getBatches() /** * Sets batches * - * @param \Brevo\Client\Models\GetScheduledEmailByBatchIdBatches[] $batches batches + * @param \Brevo\Client\Models\GetScheduledEmailByBatchIdBatchesInner[]|null $batches batches * * @return $this */ - public function setBatches($batches) + public function setBatches(?array $batches): static { + if (is_null($batches)) { + throw new InvalidArgumentException('non-nullable batches cannot be null'); + } $this->container['batches'] = $batches; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetScheduledEmailByBatchIdBatches.php b/lib/Models/GetScheduledEmailByBatchIdBatchesInner.php similarity index 51% rename from lib/Models/GetScheduledEmailByBatchIdBatches.php rename to lib/Models/GetScheduledEmailByBatchIdBatchesInner.php index 30919b4..1d196d3 100644 --- a/lib/Models/GetScheduledEmailByBatchIdBatches.php +++ b/lib/Models/GetScheduledEmailByBatchIdBatchesInner.php @@ -1,62 +1,64 @@ */ -class GetScheduledEmailByBatchIdBatches implements ModelInterface, ArrayAccess +class GetScheduledEmailByBatchIdBatchesInner extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getScheduledEmailByBatchId_batches'; + protected static string $openAPIModelName = 'getScheduledEmailByBatchId_batches_inner'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'scheduledAt' => '\DateTime', 'createdAt' => '\DateTime', 'status' => 'string' @@ -65,41 +67,39 @@ class GetScheduledEmailByBatchIdBatches implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'scheduledAt' => 'date-time', 'createdAt' => 'date-time', 'status' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'scheduledAt' => false, + 'createdAt' => false, + 'status' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'scheduledAt' => 'scheduledAt', 'createdAt' => 'createdAt', 'status' => 'status' @@ -108,9 +108,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'scheduledAt' => 'setScheduledAt', 'createdAt' => 'setCreatedAt', 'status' => 'setStatus' @@ -119,9 +119,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'scheduledAt' => 'getScheduledAt', 'createdAt' => 'getCreatedAt', 'status' => 'getStatus' @@ -131,9 +131,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -141,9 +141,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -151,29 +151,17 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const STATUS_IN_PROGRESS = 'inProgress'; - const STATUS_QUEUED = 'queued'; - const STATUS_PROCESSED = 'processed'; - const STATUS_ERROR = 'error'; - - + public const STATUS_IN_PROGRESS = 'inProgress'; + public const STATUS_QUEUED = 'queued'; + public const STATUS_PROCESSED = 'processed'; + public const STATUS_ERROR = 'error'; /** * Gets allowable values of the enum @@ -190,33 +178,31 @@ public function getStatusAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['scheduledAt'] = isset($data['scheduledAt']) ? $data['scheduledAt'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; + $this->setIfExists('scheduledAt', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -232,7 +218,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -240,24 +227,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets scheduledAt * * @return \DateTime */ - public function getScheduledAt() + public function getScheduledAt(): \DateTime { return $this->container['scheduledAt']; } @@ -269,8 +244,11 @@ public function getScheduledAt() * * @return $this */ - public function setScheduledAt($scheduledAt) + public function setScheduledAt(\DateTime $scheduledAt): static { + if (is_null($scheduledAt)) { + throw new InvalidArgumentException('non-nullable scheduledAt cannot be null'); + } $this->container['scheduledAt'] = $scheduledAt; return $this; @@ -281,7 +259,7 @@ public function setScheduledAt($scheduledAt) * * @return \DateTime */ - public function getCreatedAt() + public function getCreatedAt(): \DateTime { return $this->container['createdAt']; } @@ -293,8 +271,11 @@ public function getCreatedAt() * * @return $this */ - public function setCreatedAt($createdAt) + public function setCreatedAt(\DateTime $createdAt): static { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } $this->container['createdAt'] = $createdAt; return $this; @@ -305,7 +286,7 @@ public function setCreatedAt($createdAt) * * @return string */ - public function getStatus() + public function getStatus(): string { return $this->container['status']; } @@ -317,13 +298,17 @@ public function getStatus() * * @return $this */ - public function setStatus($status) + public function setStatus(string $status): static { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); if (!in_array($status, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -332,79 +317,6 @@ public function setStatus($status) return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetScheduledEmailById200Response.php b/lib/Models/GetScheduledEmailById200Response.php new file mode 100644 index 0000000..25b60eb --- /dev/null +++ b/lib/Models/GetScheduledEmailById200Response.php @@ -0,0 +1,390 @@ + + */ +class GetScheduledEmailById200Response extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getScheduledEmailById_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'scheduledAt' => '\DateTime', + 'createdAt' => '\DateTime', + 'status' => 'string', + 'count' => 'int', + 'batches' => '\Brevo\Client\Models\GetScheduledEmailByBatchIdBatchesInner[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'scheduledAt' => 'date-time', + 'createdAt' => 'date-time', + 'status' => null, + 'count' => null, + 'batches' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'scheduledAt' => false, + 'createdAt' => false, + 'status' => false, + 'count' => false, + 'batches' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'scheduledAt' => 'scheduledAt', + 'createdAt' => 'createdAt', + 'status' => 'status', + 'count' => 'count', + 'batches' => 'batches' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'scheduledAt' => 'setScheduledAt', + 'createdAt' => 'setCreatedAt', + 'status' => 'setStatus', + 'count' => 'setCount', + 'batches' => 'setBatches' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'scheduledAt' => 'getScheduledAt', + 'createdAt' => 'getCreatedAt', + 'status' => 'getStatus', + 'count' => 'getCount', + 'batches' => 'getBatches' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const STATUS_IN_PROGRESS = 'inProgress'; + public const STATUS_QUEUED = 'queued'; + public const STATUS_PROCESSED = 'processed'; + public const STATUS_ERROR = 'error'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_IN_PROGRESS, + self::STATUS_QUEUED, + self::STATUS_PROCESSED, + self::STATUS_ERROR, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('scheduledAt', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('batches', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['scheduledAt'] === null) { + $invalidProperties[] = "'scheduledAt' can't be null"; + } + if ($this->container['createdAt'] === null) { + $invalidProperties[] = "'createdAt' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets scheduledAt + * + * @return \DateTime + */ + public function getScheduledAt(): \DateTime + { + return $this->container['scheduledAt']; + } + + /** + * Sets scheduledAt + * + * @param \DateTime $scheduledAt Datetime for which the email was scheduled + * + * @return $this + */ + public function setScheduledAt(\DateTime $scheduledAt): static + { + if (is_null($scheduledAt)) { + throw new InvalidArgumentException('non-nullable scheduledAt cannot be null'); + } + $this->container['scheduledAt'] = $scheduledAt; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime + */ + public function getCreatedAt(): \DateTime + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime $createdAt Datetime on which the email was scheduled + * + * @return $this + */ + public function setCreatedAt(\DateTime $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus(): string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status Current status of the scheduled email + * + * @return $this + */ + public function setStatus(string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount(): ?int + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Total number of batches + * + * @return $this + */ + public function setCount(?int $count): static + { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets batches + * + * @return \Brevo\Client\Models\GetScheduledEmailByBatchIdBatchesInner[]|null + */ + public function getBatches(): ?array + { + return $this->container['batches']; + } + + /** + * Sets batches + * + * @param \Brevo\Client\Models\GetScheduledEmailByBatchIdBatchesInner[]|null $batches batches + * + * @return $this + */ + public function setBatches(?array $batches): static + { + if (is_null($batches)) { + throw new InvalidArgumentException('non-nullable batches cannot be null'); + } + $this->container['batches'] = $batches; + + return $this; + } +} + + diff --git a/lib/Models/GetScheduledEmailByMessageId.php b/lib/Models/GetScheduledEmailByMessageId.php index abdebe3..d7c7902 100644 --- a/lib/Models/GetScheduledEmailByMessageId.php +++ b/lib/Models/GetScheduledEmailByMessageId.php @@ -2,61 +2,63 @@ /** * GetScheduledEmailByMessageId * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetScheduledEmailByMessageId Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetScheduledEmailByMessageId implements ModelInterface, ArrayAccess +class GetScheduledEmailByMessageId extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getScheduledEmailByMessageId'; + protected static string $openAPIModelName = 'getScheduledEmailByMessageId'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'scheduledAt' => '\DateTime', 'createdAt' => '\DateTime', 'status' => 'string' @@ -65,41 +67,39 @@ class GetScheduledEmailByMessageId implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'scheduledAt' => 'date-time', 'createdAt' => 'date-time', 'status' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'scheduledAt' => false, + 'createdAt' => false, + 'status' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'scheduledAt' => 'scheduledAt', 'createdAt' => 'createdAt', 'status' => 'status' @@ -108,9 +108,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'scheduledAt' => 'setScheduledAt', 'createdAt' => 'setCreatedAt', 'status' => 'setStatus' @@ -119,9 +119,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'scheduledAt' => 'getScheduledAt', 'createdAt' => 'getCreatedAt', 'status' => 'getStatus' @@ -131,9 +131,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -141,9 +141,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -151,30 +151,18 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const STATUS_IN_PROGRESS = 'inProgress'; - const STATUS_QUEUED = 'queued'; - const STATUS_PROCESSED = 'processed'; - const STATUS_ERROR = 'error'; - + public const STATUS_IN_PROGRESS = 'inProgress'; + public const STATUS_QUEUED = 'queued'; + public const STATUS_PROCESSED = 'processed'; + public const STATUS_ERROR = 'error'; - /** * Gets allowable values of the enum * @@ -189,34 +177,32 @@ public function getStatusAllowableValues() self::STATUS_ERROR, ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['scheduledAt'] = isset($data['scheduledAt']) ? $data['scheduledAt'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; + $this->setIfExists('scheduledAt', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -232,7 +218,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -240,24 +227,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets scheduledAt * * @return \DateTime */ - public function getScheduledAt() + public function getScheduledAt(): \DateTime { return $this->container['scheduledAt']; } @@ -269,8 +244,11 @@ public function getScheduledAt() * * @return $this */ - public function setScheduledAt($scheduledAt) + public function setScheduledAt(\DateTime $scheduledAt): static { + if (is_null($scheduledAt)) { + throw new InvalidArgumentException('non-nullable scheduledAt cannot be null'); + } $this->container['scheduledAt'] = $scheduledAt; return $this; @@ -281,7 +259,7 @@ public function setScheduledAt($scheduledAt) * * @return \DateTime */ - public function getCreatedAt() + public function getCreatedAt(): \DateTime { return $this->container['createdAt']; } @@ -293,8 +271,11 @@ public function getCreatedAt() * * @return $this */ - public function setCreatedAt($createdAt) + public function setCreatedAt(\DateTime $createdAt): static { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } $this->container['createdAt'] = $createdAt; return $this; @@ -305,7 +286,7 @@ public function setCreatedAt($createdAt) * * @return string */ - public function getStatus() + public function getStatus(): string { return $this->container['status']; } @@ -317,13 +298,17 @@ public function getStatus() * * @return $this */ - public function setStatus($status) + public function setStatus(string $status): static { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); if (!in_array($status, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -332,79 +317,6 @@ public function setStatus($status) return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetSegments.php b/lib/Models/GetSegments.php index 8b262dc..4af4e67 100644 --- a/lib/Models/GetSegments.php +++ b/lib/Models/GetSegments.php @@ -2,102 +2,101 @@ /** * GetSegments * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetSegments Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetSegments implements ModelInterface, ArrayAccess +class GetSegments extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getSegments'; + protected static string $openAPIModelName = 'getSegments'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'segments' => '\Brevo\Client\Models\GetSegmentsSegments', + protected static array $openAPITypes = [ + 'segments' => 'Segment[]', 'count' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'segments' => null, 'count' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'segments' => false, + 'count' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'segments' => 'segments', 'count' => 'count' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'segments' => 'setSegments', 'count' => 'setCount' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'segments' => 'getSegments', 'count' => 'getCount' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +145,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['segments'] = isset($data['segments']) ? $data['segments'] : null; - $this->container['count'] = isset($data['count']) ? $data['count'] : null; + $this->setIfExists('segments', $data ?? [], null); + $this->setIfExists('count', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets segments * - * @return \Brevo\Client\Models\GetSegmentsSegments + * @return Segment[]|null */ - public function getSegments() + public function getSegments(): ?array { return $this->container['segments']; } @@ -223,12 +196,15 @@ public function getSegments() /** * Sets segments * - * @param \Brevo\Client\Models\GetSegmentsSegments $segments segments + * @param Segment[]|null $segments Listing of all the segments available in your account * * @return $this */ - public function setSegments($segments) + public function setSegments(?array $segments): static { + if (is_null($segments)) { + throw new InvalidArgumentException('non-nullable segments cannot be null'); + } $this->container['segments'] = $segments; return $this; @@ -237,9 +213,9 @@ public function setSegments($segments) /** * Gets count * - * @return int + * @return int|null */ - public function getCount() + public function getCount(): ?int { return $this->container['count']; } @@ -247,89 +223,19 @@ public function getCount() /** * Sets count * - * @param int $count Number of Segments available in your account + * @param int|null $count Number of Segments in your account * * @return $this */ - public function setCount($count) + public function setCount(?int $count): static { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } $this->container['count'] = $count; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetSegmentsSegments.php b/lib/Models/GetSegmentsSegments.php deleted file mode 100644 index 62f591a..0000000 --- a/lib/Models/GetSegmentsSegments.php +++ /dev/null @@ -1,395 +0,0 @@ - 'int', - 'segmentName' => 'string', - 'categoryName' => 'string', - 'updatedAt' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => 'int64', - 'segmentName' => null, - 'categoryName' => 'string', - 'updatedAt' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'segmentName' => 'segmentName', - 'categoryName' => 'categoryName', - 'updatedAt' => 'updatedAt' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'segmentName' => 'setSegmentName', - 'categoryName' => 'setCategoryName', - 'updatedAt' => 'setUpdatedAt' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'segmentName' => 'getSegmentName', - 'categoryName' => 'getCategoryName', - 'updatedAt' => 'getUpdatedAt' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['segmentName'] = isset($data['segmentName']) ? $data['segmentName'] : null; - $this->container['categoryName'] = isset($data['categoryName']) ? $data['categoryName'] : null; - $this->container['updatedAt'] = isset($data['updatedAt']) ? $data['updatedAt'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return int - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param int $id ID of the list - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets segmentName - * - * @return string - */ - public function getSegmentName() - { - return $this->container['segmentName']; - } - - /** - * Sets segmentName - * - * @param string $segmentName Name of the Segment - * - * @return $this - */ - public function setSegmentName($segmentName) - { - $this->container['segmentName'] = $segmentName; - - return $this; - } - - /** - * Gets categoryName - * - * @return string - */ - public function getCategoryName() - { - return $this->container['categoryName']; - } - - /** - * Sets categoryName - * - * @param string $categoryName Name of the Segment Category - * - * @return $this - */ - public function setCategoryName($categoryName) - { - $this->container['categoryName'] = $categoryName; - - return $this; - } - - /** - * Gets updatedAt - * - * @return string - */ - public function getUpdatedAt() - { - return $this->container['updatedAt']; - } - - /** - * Sets updatedAt - * - * @param string $updatedAt Updation UTC date-time of the segment (YYYY-MM-DDTHH:mm:ss.SSSZ) - * - * @return $this - */ - public function setUpdatedAt($updatedAt) - { - $this->container['updatedAt'] = $updatedAt; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetSendersList.php b/lib/Models/GetSendersList.php index 6c3fe54..8c13872 100644 --- a/lib/Models/GetSendersList.php +++ b/lib/Models/GetSendersList.php @@ -2,118 +2,116 @@ /** * GetSendersList * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetSendersList Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetSendersList implements ModelInterface, ArrayAccess +class GetSendersList extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getSendersList'; + protected static string $openAPIModelName = 'getSendersList'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'senders' => '\Brevo\Client\Models\GetSendersListSenders[]' + protected static array $openAPITypes = [ + 'senders' => '\Brevo\Client\Models\GetSendersListSendersInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'senders' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'senders' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'senders' => 'senders' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'senders' => 'setSenders' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'senders' => 'getSenders' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,75 +139,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['senders'] = isset($data['senders']) ? $data['senders'] : null; + $this->setIfExists('senders', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets senders * - * @return \Brevo\Client\Models\GetSendersListSenders[] + * @return \Brevo\Client\Models\GetSendersListSendersInner[]|null */ - public function getSenders() + public function getSenders(): ?array { return $this->container['senders']; } @@ -217,89 +189,19 @@ public function getSenders() /** * Sets senders * - * @param \Brevo\Client\Models\GetSendersListSenders[] $senders List of the senders available in your account + * @param \Brevo\Client\Models\GetSendersListSendersInner[]|null $senders List of the senders available in your account * * @return $this */ - public function setSenders($senders) + public function setSenders(?array $senders): static { + if (is_null($senders)) { + throw new InvalidArgumentException('non-nullable senders cannot be null'); + } $this->container['senders'] = $senders; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetSendersListIps.php b/lib/Models/GetSendersListIps.php deleted file mode 100644 index 1ab3c0a..0000000 --- a/lib/Models/GetSendersListIps.php +++ /dev/null @@ -1,374 +0,0 @@ - 'string', - 'domain' => 'string', - 'weight' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'ip' => null, - 'domain' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'ip' => 'ip', - 'domain' => 'domain', - 'weight' => 'weight' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'ip' => 'setIp', - 'domain' => 'setDomain', - 'weight' => 'setWeight' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'ip' => 'getIp', - 'domain' => 'getDomain', - '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 - */ - public function __construct(array $data = null) - { - $this->container['ip'] = isset($data['ip']) ? $data['ip'] : null; - $this->container['domain'] = isset($data['domain']) ? $data['domain'] : null; - $this->container['weight'] = isset($data['weight']) ? $data['weight'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['ip'] === null) { - $invalidProperties[] = "'ip' can't be null"; - } - if ($this->container['domain'] === null) { - $invalidProperties[] = "'domain' can't be null"; - } - if ($this->container['weight'] === null) { - $invalidProperties[] = "'weight' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets ip - * - * @return string - */ - public function getIp() - { - return $this->container['ip']; - } - - /** - * Sets ip - * - * @param string $ip Dedicated IP available in your account - * - * @return $this - */ - public function setIp($ip) - { - $this->container['ip'] = $ip; - - return $this; - } - - /** - * Gets domain - * - * @return string - */ - public function getDomain() - { - return $this->container['domain']; - } - - /** - * Sets domain - * - * @param string $domain Domain of the IP - * - * @return $this - */ - public function setDomain($domain) - { - $this->container['domain'] = $domain; - - return $this; - } - - /** - * Gets weight - * - * @return int - */ - public function getWeight() - { - return $this->container['weight']; - } - - /** - * Sets weight - * - * @param int $weight Weight of the IP for this sender - * - * @return $this - */ - public function setWeight($weight) - { - $this->container['weight'] = $weight; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetSendersListSenders.php b/lib/Models/GetSendersListSendersInner.php similarity index 50% rename from lib/Models/GetSendersListSenders.php rename to lib/Models/GetSendersListSendersInner.php index bdf1ddf..36f0114 100644 --- a/lib/Models/GetSendersListSenders.php +++ b/lib/Models/GetSendersListSendersInner.php @@ -1,75 +1,77 @@ */ -class GetSendersListSenders implements ModelInterface, ArrayAccess +class GetSendersListSendersInner extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getSendersList_senders'; + protected static string $openAPIModelName = 'getSendersList_senders_inner'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'email' => 'string', 'active' => 'bool', - 'ips' => '\Brevo\Client\Models\GetSendersListIps[]' + 'ips' => '\Brevo\Client\Models\GetSendersListSendersInnerIpsInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'name' => null, 'email' => null, @@ -78,32 +80,32 @@ class GetSendersListSenders implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'email' => false, + 'active' => false, + 'ips' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name', 'email' => 'email', @@ -114,9 +116,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName', 'email' => 'setEmail', @@ -127,9 +129,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName', 'email' => 'getEmail', @@ -141,9 +143,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -151,9 +153,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -161,55 +163,41 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['active'] = isset($data['active']) ? $data['active'] : null; - $this->container['ips'] = isset($data['ips']) ? $data['ips'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('ips', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -228,24 +216,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -257,8 +233,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -269,7 +248,7 @@ public function setId($id) * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -281,8 +260,11 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -293,7 +275,7 @@ public function setName($name) * * @return string */ - public function getEmail() + public function getEmail(): string { return $this->container['email']; } @@ -305,8 +287,11 @@ public function getEmail() * * @return $this */ - public function setEmail($email) + public function setEmail(string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -317,7 +302,7 @@ public function setEmail($email) * * @return bool */ - public function getActive() + public function getActive(): bool { return $this->container['active']; } @@ -329,8 +314,11 @@ public function getActive() * * @return $this */ - public function setActive($active) + public function setActive(bool $active): static { + if (is_null($active)) { + throw new InvalidArgumentException('non-nullable active cannot be null'); + } $this->container['active'] = $active; return $this; @@ -339,9 +327,9 @@ public function setActive($active) /** * Gets ips * - * @return \Brevo\Client\Models\GetSendersListIps[] + * @return \Brevo\Client\Models\GetSendersListSendersInnerIpsInner[]|null */ - public function getIps() + public function getIps(): ?array { return $this->container['ips']; } @@ -349,89 +337,19 @@ public function getIps() /** * Sets ips * - * @param \Brevo\Client\Models\GetSendersListIps[] $ips List of dedicated IP(s) available in the account. This data is displayed only for dedicated IPs + * @param \Brevo\Client\Models\GetSendersListSendersInnerIpsInner[]|null $ips List of dedicated IP(s) available in the account. This data is displayed only for dedicated IPs * * @return $this */ - public function setIps($ips) + public function setIps(?array $ips): static { + if (is_null($ips)) { + throw new InvalidArgumentException('non-nullable ips cannot be null'); + } $this->container['ips'] = $ips; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetSendersListSendersInnerIpsInner.php b/lib/Models/GetSendersListSendersInnerIpsInner.php new file mode 100644 index 0000000..157cae7 --- /dev/null +++ b/lib/Models/GetSendersListSendersInnerIpsInner.php @@ -0,0 +1,284 @@ + + */ +class GetSendersListSendersInnerIpsInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getSendersList_senders_inner_ips_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'ip' => 'string', + 'domain' => 'string', + 'weight' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'ip' => null, + 'domain' => null, + 'weight' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'ip' => false, + 'domain' => false, + 'weight' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'ip' => 'ip', + 'domain' => 'domain', + 'weight' => 'weight' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'ip' => 'setIp', + 'domain' => 'setDomain', + 'weight' => 'setWeight' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'ip' => 'getIp', + 'domain' => 'getDomain', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('ip', $data ?? [], null); + $this->setIfExists('domain', $data ?? [], null); + $this->setIfExists('weight', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['ip'] === null) { + $invalidProperties[] = "'ip' can't be null"; + } + if ($this->container['domain'] === null) { + $invalidProperties[] = "'domain' can't be null"; + } + if ($this->container['weight'] === null) { + $invalidProperties[] = "'weight' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets ip + * + * @return string + */ + public function getIp(): string + { + return $this->container['ip']; + } + + /** + * Sets ip + * + * @param string $ip Dedicated IP available in your account + * + * @return $this + */ + public function setIp(string $ip): static + { + if (is_null($ip)) { + throw new InvalidArgumentException('non-nullable ip cannot be null'); + } + $this->container['ip'] = $ip; + + return $this; + } + + /** + * Gets domain + * + * @return string + */ + public function getDomain(): string + { + return $this->container['domain']; + } + + /** + * Sets domain + * + * @param string $domain Domain of the IP + * + * @return $this + */ + public function setDomain(string $domain): static + { + if (is_null($domain)) { + throw new InvalidArgumentException('non-nullable domain cannot be null'); + } + $this->container['domain'] = $domain; + + return $this; + } + + /** + * Gets weight + * + * @return int + */ + public function getWeight(): int + { + return $this->container['weight']; + } + + /** + * Sets weight + * + * @param int $weight Weight of the IP for this sender + * + * @return $this + */ + public function setWeight(int $weight): static + { + if (is_null($weight)) { + throw new InvalidArgumentException('non-nullable weight cannot be null'); + } + $this->container['weight'] = $weight; + + return $this; + } +} + + diff --git a/lib/Models/GetSharedTemplateUrl.php b/lib/Models/GetSharedTemplateUrl.php index ae0a083..62a189a 100644 --- a/lib/Models/GetSharedTemplateUrl.php +++ b/lib/Models/GetSharedTemplateUrl.php @@ -2,118 +2,116 @@ /** * GetSharedTemplateUrl * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetSharedTemplateUrl Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetSharedTemplateUrl implements ModelInterface, ArrayAccess +class GetSharedTemplateUrl extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getSharedTemplateUrl'; + protected static string $openAPIModelName = 'getSharedTemplateUrl'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'sharedUrl' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'sharedUrl' => 'url' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'sharedUrl' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'sharedUrl' => 'sharedUrl' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'sharedUrl' => 'setSharedUrl' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'sharedUrl' => 'getSharedUrl' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,51 +139,37 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['sharedUrl'] = isset($data['sharedUrl']) ? $data['sharedUrl'] : null; + $this->setIfExists('sharedUrl', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -195,24 +179,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets sharedUrl * * @return string */ - public function getSharedUrl() + public function getSharedUrl(): string { return $this->container['sharedUrl']; } @@ -224,85 +196,15 @@ public function getSharedUrl() * * @return $this */ - public function setSharedUrl($sharedUrl) + public function setSharedUrl(string $sharedUrl): static { + if (is_null($sharedUrl)) { + throw new InvalidArgumentException('non-nullable sharedUrl cannot be null'); + } $this->container['sharedUrl'] = $sharedUrl; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetSmsCampaign.php b/lib/Models/GetSmsCampaign.php index 248cb80..5c9657f 100644 --- a/lib/Models/GetSmsCampaign.php +++ b/lib/Models/GetSmsCampaign.php @@ -2,172 +2,180 @@ /** * GetSmsCampaign * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetSmsCampaign Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetSmsCampaign implements ModelInterface, ArrayAccess +class GetSmsCampaign extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getSmsCampaign'; + protected static string $openAPIModelName = 'getSmsCampaign'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'status' => 'string', 'content' => 'string', - 'scheduledAt' => 'string', 'sender' => 'string', 'createdAt' => 'string', 'modifiedAt' => 'string', 'recipients' => 'object', - 'statistics' => 'object' + 'statistics' => 'object', + 'scheduledAt' => 'string' ]; /** - @@ -75,14 +65,6 @@ class GetSmsCampaign implements ModelInterface, ArrayAccess - * @var string[] + * Array of property to format mappings. Used for (de)serialization + * + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'name' => null, 'status' => null, 'content' => null, - 'scheduledAt' => null, 'sender' => null, 'createdAt' => null, 'modifiedAt' => null, 'recipients' => null, - 'statistics' => null + 'statistics' => null, + 'scheduledAt' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'status' => false, + 'content' => false, + 'sender' => false, + 'createdAt' => false, + 'modifiedAt' => false, + 'recipients' => false, + 'statistics' => false, + 'scheduledAt' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name', 'status' => 'status', 'content' => 'content', - 'scheduledAt' => 'scheduledAt', 'sender' => 'sender', 'createdAt' => 'createdAt', 'modifiedAt' => 'modifiedAt', 'recipients' => 'recipients', - 'statistics' => 'statistics' + 'statistics' => 'statistics', + 'scheduledAt' => 'scheduledAt' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName', 'status' => 'setStatus', 'content' => 'setContent', - 'scheduledAt' => 'setScheduledAt', 'sender' => 'setSender', 'createdAt' => 'setCreatedAt', 'modifiedAt' => 'setModifiedAt', 'recipients' => 'setRecipients', - 'statistics' => 'setStatistics' + 'statistics' => 'setStatistics', + 'scheduledAt' => 'setScheduledAt' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName', 'status' => 'getStatus', 'content' => 'getContent', - 'scheduledAt' => 'getScheduledAt', 'sender' => 'getSender', 'createdAt' => 'getCreatedAt', 'modifiedAt' => 'getModifiedAt', 'recipients' => 'getRecipients', - 'statistics' => 'getStatistics' + 'statistics' => 'getStatistics', + 'scheduledAt' => 'getScheduledAt' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -175,9 +183,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -185,32 +193,19 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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'; - const STATUS_QUEUED = 'queued'; - const STATUS_SUSPENDED = 'suspended'; - const STATUS_IN_PROCESS = 'inProcess'; - - - + public const STATUS_DRAFT = 'draft'; + public const STATUS_SENT = 'sent'; + public const STATUS_ARCHIVE = 'archive'; + public const STATUS_QUEUED = 'queued'; + public const STATUS_SUSPENDED = 'suspended'; + public const STATUS_IN_PROCESS = 'inProcess'; /** * Gets allowable values of the enum @@ -229,40 +224,38 @@ public function getStatusAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['content'] = isset($data['content']) ? $data['content'] : null; - $this->container['scheduledAt'] = isset($data['scheduledAt']) ? $data['scheduledAt'] : null; - $this->container['sender'] = isset($data['sender']) ? $data['sender'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['modifiedAt'] = isset($data['modifiedAt']) ? $data['modifiedAt'] : null; - $this->container['recipients'] = isset($data['recipients']) ? $data['recipients'] : null; - $this->container['statistics'] = isset($data['statistics']) ? $data['statistics'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('modifiedAt', $data ?? [], null); + $this->setIfExists('recipients', $data ?? [], null); + $this->setIfExists('statistics', $data ?? [], null); + $this->setIfExists('scheduledAt', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -278,7 +271,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -304,24 +298,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -333,8 +315,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -345,7 +330,7 @@ public function setId($id) * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -357,8 +342,11 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -369,7 +357,7 @@ public function setName($name) * * @return string */ - public function getStatus() + public function getStatus(): string { return $this->container['status']; } @@ -381,13 +369,17 @@ public function getStatus() * * @return $this */ - public function setStatus($status) + public function setStatus(string $status): static { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); if (!in_array($status, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -402,7 +394,7 @@ public function setStatus($status) * * @return string */ - public function getContent() + public function getContent(): string { return $this->container['content']; } @@ -414,43 +406,22 @@ public function getContent() * * @return $this */ - public function setContent($content) + public function setContent(string $content): static { + if (is_null($content)) { + throw new InvalidArgumentException('non-nullable content cannot be null'); + } $this->container['content'] = $content; return $this; } - /** - * Gets scheduledAt - * - * @return string - */ - public function getScheduledAt() - { - return $this->container['scheduledAt']; - } - - /** - * Sets scheduledAt - * - * @param string $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) - { - $this->container['scheduledAt'] = $scheduledAt; - - return $this; - } - /** * Gets sender * * @return string */ - public function getSender() + public function getSender(): string { return $this->container['sender']; } @@ -462,8 +433,11 @@ public function getSender() * * @return $this */ - public function setSender($sender) + public function setSender(string $sender): static { + if (is_null($sender)) { + throw new InvalidArgumentException('non-nullable sender cannot be null'); + } $this->container['sender'] = $sender; return $this; @@ -474,7 +448,7 @@ public function setSender($sender) * * @return string */ - public function getCreatedAt() + public function getCreatedAt(): string { return $this->container['createdAt']; } @@ -486,8 +460,11 @@ public function getCreatedAt() * * @return $this */ - public function setCreatedAt($createdAt) + public function setCreatedAt(string $createdAt): static { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } $this->container['createdAt'] = $createdAt; return $this; @@ -498,7 +475,7 @@ public function setCreatedAt($createdAt) * * @return string */ - public function getModifiedAt() + public function getModifiedAt(): string { return $this->container['modifiedAt']; } @@ -510,8 +487,11 @@ public function getModifiedAt() * * @return $this */ - public function setModifiedAt($modifiedAt) + public function setModifiedAt(string $modifiedAt): static { + if (is_null($modifiedAt)) { + throw new InvalidArgumentException('non-nullable modifiedAt cannot be null'); + } $this->container['modifiedAt'] = $modifiedAt; return $this; @@ -522,7 +502,7 @@ public function setModifiedAt($modifiedAt) * * @return object */ - public function getRecipients() + public function getRecipients(): object { return $this->container['recipients']; } @@ -534,8 +514,11 @@ public function getRecipients() * * @return $this */ - public function setRecipients($recipients) + public function setRecipients(object $recipients): static { + if (is_null($recipients)) { + throw new InvalidArgumentException('non-nullable recipients cannot be null'); + } $this->container['recipients'] = $recipients; return $this; @@ -546,7 +529,7 @@ public function setRecipients($recipients) * * @return object */ - public function getStatistics() + public function getStatistics(): object { return $this->container['statistics']; } @@ -558,84 +541,41 @@ public function getStatistics() * * @return $this */ - public function setStatistics($statistics) + public function setStatistics(object $statistics): static { + if (is_null($statistics)) { + throw new InvalidArgumentException('non-nullable statistics cannot be null'); + } $this->container['statistics'] = $statistics; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 + * Gets scheduledAt * - * @return void + * @return string|null */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function getScheduledAt(): ?string { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } + return $this->container['scheduledAt']; } /** - * Unsets offset. - * - * @param integer $offset Offset + * Sets scheduledAt * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object + * @param string|null $scheduledAt UTC date-time on which SMS campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format * - * @return string + * @return $this */ - public function __toString() + public function setScheduledAt(?string $scheduledAt): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($scheduledAt)) { + throw new InvalidArgumentException('non-nullable scheduledAt cannot be null'); } + $this->container['scheduledAt'] = $scheduledAt; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/GetSmsCampaignOverview.php b/lib/Models/GetSmsCampaignOverview.php index 27aea91..cfb09d9 100644 --- a/lib/Models/GetSmsCampaignOverview.php +++ b/lib/Models/GetSmsCampaignOverview.php @@ -2,163 +2,168 @@ /** * GetSmsCampaignOverview * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetSmsCampaignOverview Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetSmsCampaignOverview implements ModelInterface, ArrayAccess +class GetSmsCampaignOverview extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getSmsCampaignOverview'; + protected static string $openAPIModelName = 'getSmsCampaignOverview'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'status' => 'string', 'content' => 'string', - 'scheduledAt' => 'string', 'sender' => 'string', 'createdAt' => 'string', - 'modifiedAt' => 'string' + 'modifiedAt' => 'string', + 'scheduledAt' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'name' => null, 'status' => null, 'content' => null, - 'scheduledAt' => null, 'sender' => null, 'createdAt' => null, - 'modifiedAt' => null + 'modifiedAt' => null, + 'scheduledAt' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'status' => false, + 'content' => false, + 'sender' => false, + 'createdAt' => false, + 'modifiedAt' => false, + 'scheduledAt' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name', 'status' => 'status', 'content' => 'content', - 'scheduledAt' => 'scheduledAt', 'sender' => 'sender', 'createdAt' => 'createdAt', - 'modifiedAt' => 'modifiedAt' + 'modifiedAt' => 'modifiedAt', + 'scheduledAt' => 'scheduledAt' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName', 'status' => 'setStatus', 'content' => 'setContent', - 'scheduledAt' => 'setScheduledAt', 'sender' => 'setSender', 'createdAt' => 'setCreatedAt', - 'modifiedAt' => 'setModifiedAt' + 'modifiedAt' => 'setModifiedAt', + 'scheduledAt' => 'setScheduledAt' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName', 'status' => 'getStatus', 'content' => 'getContent', - 'scheduledAt' => 'getScheduledAt', 'sender' => 'getSender', 'createdAt' => 'getCreatedAt', - 'modifiedAt' => 'getModifiedAt' + 'modifiedAt' => 'getModifiedAt', + 'scheduledAt' => 'getScheduledAt' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -166,9 +171,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -176,31 +181,19 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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'; - const STATUS_QUEUED = 'queued'; - const STATUS_SUSPENDED = 'suspended'; - const STATUS_IN_PROCESS = 'inProcess'; - - + public const STATUS_DRAFT = 'draft'; + public const STATUS_SENT = 'sent'; + public const STATUS_ARCHIVE = 'archive'; + public const STATUS_QUEUED = 'queued'; + public const STATUS_SUSPENDED = 'suspended'; + public const STATUS_IN_PROCESS = 'inProcess'; /** * Gets allowable values of the enum @@ -219,38 +212,36 @@ public function getStatusAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['content'] = isset($data['content']) ? $data['content'] : null; - $this->container['scheduledAt'] = isset($data['scheduledAt']) ? $data['scheduledAt'] : null; - $this->container['sender'] = isset($data['sender']) ? $data['sender'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['modifiedAt'] = isset($data['modifiedAt']) ? $data['modifiedAt'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('modifiedAt', $data ?? [], null); + $this->setIfExists('scheduledAt', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -266,7 +257,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -286,24 +278,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -315,8 +295,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -327,7 +310,7 @@ public function setId($id) * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -339,8 +322,11 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -351,7 +337,7 @@ public function setName($name) * * @return string */ - public function getStatus() + public function getStatus(): string { return $this->container['status']; } @@ -363,13 +349,17 @@ public function getStatus() * * @return $this */ - public function setStatus($status) + public function setStatus(string $status): static { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); if (!in_array($status, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -384,7 +374,7 @@ public function setStatus($status) * * @return string */ - public function getContent() + public function getContent(): string { return $this->container['content']; } @@ -396,43 +386,22 @@ public function getContent() * * @return $this */ - public function setContent($content) + public function setContent(string $content): static { + if (is_null($content)) { + throw new InvalidArgumentException('non-nullable content cannot be null'); + } $this->container['content'] = $content; return $this; } - /** - * Gets scheduledAt - * - * @return string - */ - public function getScheduledAt() - { - return $this->container['scheduledAt']; - } - - /** - * Sets scheduledAt - * - * @param string $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) - { - $this->container['scheduledAt'] = $scheduledAt; - - return $this; - } - /** * Gets sender * * @return string */ - public function getSender() + public function getSender(): string { return $this->container['sender']; } @@ -444,8 +413,11 @@ public function getSender() * * @return $this */ - public function setSender($sender) + public function setSender(string $sender): static { + if (is_null($sender)) { + throw new InvalidArgumentException('non-nullable sender cannot be null'); + } $this->container['sender'] = $sender; return $this; @@ -456,7 +428,7 @@ public function setSender($sender) * * @return string */ - public function getCreatedAt() + public function getCreatedAt(): string { return $this->container['createdAt']; } @@ -468,8 +440,11 @@ public function getCreatedAt() * * @return $this */ - public function setCreatedAt($createdAt) + public function setCreatedAt(string $createdAt): static { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } $this->container['createdAt'] = $createdAt; return $this; @@ -480,7 +455,7 @@ public function setCreatedAt($createdAt) * * @return string */ - public function getModifiedAt() + public function getModifiedAt(): string { return $this->container['modifiedAt']; } @@ -492,84 +467,41 @@ public function getModifiedAt() * * @return $this */ - public function setModifiedAt($modifiedAt) + public function setModifiedAt(string $modifiedAt): static { + if (is_null($modifiedAt)) { + throw new InvalidArgumentException('non-nullable modifiedAt cannot be null'); + } $this->container['modifiedAt'] = $modifiedAt; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 + * Gets scheduledAt * - * @return void + * @return string|null */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function getScheduledAt(): ?string { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } + return $this->container['scheduledAt']; } /** - * Unsets offset. + * Sets scheduledAt * - * @param integer $offset Offset + * @param string|null $scheduledAt UTC date-time on which SMS campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string + * @return $this */ - public function __toString() + public function setScheduledAt(?string $scheduledAt): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($scheduledAt)) { + throw new InvalidArgumentException('non-nullable scheduledAt cannot be null'); } + $this->container['scheduledAt'] = $scheduledAt; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/GetSmsCampaignRecipients.php b/lib/Models/GetSmsCampaignRecipients.php deleted file mode 100644 index 306d51f..0000000 --- a/lib/Models/GetSmsCampaignRecipients.php +++ /dev/null @@ -1,280 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetSmsCampaignStats.php b/lib/Models/GetSmsCampaignStats.php index c1ac408..dab8875 100644 --- a/lib/Models/GetSmsCampaignStats.php +++ b/lib/Models/GetSmsCampaignStats.php @@ -2,61 +2,63 @@ /** * GetSmsCampaignStats * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetSmsCampaignStats Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetSmsCampaignStats implements ModelInterface, ArrayAccess +class GetSmsCampaignStats extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getSmsCampaignStats'; + protected static string $openAPIModelName = 'getSmsCampaignStats'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'delivered' => 'int', 'sent' => 'int', 'processing' => 'int', @@ -69,9 +71,9 @@ class GetSmsCampaignStats implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'delivered' => 'int64', 'sent' => 'int64', 'processing' => 'int64', @@ -82,32 +84,34 @@ class GetSmsCampaignStats implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'delivered' => false, + 'sent' => false, + 'processing' => false, + 'softBounces' => false, + 'hardBounces' => false, + 'unsubscriptions' => false, + 'answered' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'delivered' => 'delivered', 'sent' => 'sent', 'processing' => 'processing', @@ -120,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'delivered' => 'setDelivered', 'sent' => 'setSent', 'processing' => 'setProcessing', @@ -135,9 +139,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'delivered' => 'getDelivered', 'sent' => 'getSent', 'processing' => 'getProcessing', @@ -151,9 +155,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -161,9 +165,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -171,57 +175,43 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['delivered'] = isset($data['delivered']) ? $data['delivered'] : null; - $this->container['sent'] = isset($data['sent']) ? $data['sent'] : null; - $this->container['processing'] = isset($data['processing']) ? $data['processing'] : null; - $this->container['softBounces'] = isset($data['softBounces']) ? $data['softBounces'] : null; - $this->container['hardBounces'] = isset($data['hardBounces']) ? $data['hardBounces'] : null; - $this->container['unsubscriptions'] = isset($data['unsubscriptions']) ? $data['unsubscriptions'] : null; - $this->container['answered'] = isset($data['answered']) ? $data['answered'] : null; + $this->setIfExists('delivered', $data ?? [], null); + $this->setIfExists('sent', $data ?? [], null); + $this->setIfExists('processing', $data ?? [], null); + $this->setIfExists('softBounces', $data ?? [], null); + $this->setIfExists('hardBounces', $data ?? [], null); + $this->setIfExists('unsubscriptions', $data ?? [], null); + $this->setIfExists('answered', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -249,24 +239,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets delivered * * @return int */ - public function getDelivered() + public function getDelivered(): int { return $this->container['delivered']; } @@ -278,8 +256,11 @@ public function getDelivered() * * @return $this */ - public function setDelivered($delivered) + public function setDelivered(int $delivered): static { + if (is_null($delivered)) { + throw new InvalidArgumentException('non-nullable delivered cannot be null'); + } $this->container['delivered'] = $delivered; return $this; @@ -290,7 +271,7 @@ public function setDelivered($delivered) * * @return int */ - public function getSent() + public function getSent(): int { return $this->container['sent']; } @@ -302,8 +283,11 @@ public function getSent() * * @return $this */ - public function setSent($sent) + public function setSent(int $sent): static { + if (is_null($sent)) { + throw new InvalidArgumentException('non-nullable sent cannot be null'); + } $this->container['sent'] = $sent; return $this; @@ -314,7 +298,7 @@ public function setSent($sent) * * @return int */ - public function getProcessing() + public function getProcessing(): int { return $this->container['processing']; } @@ -326,8 +310,11 @@ public function getProcessing() * * @return $this */ - public function setProcessing($processing) + public function setProcessing(int $processing): static { + if (is_null($processing)) { + throw new InvalidArgumentException('non-nullable processing cannot be null'); + } $this->container['processing'] = $processing; return $this; @@ -338,7 +325,7 @@ public function setProcessing($processing) * * @return int */ - public function getSoftBounces() + public function getSoftBounces(): int { return $this->container['softBounces']; } @@ -350,8 +337,11 @@ public function getSoftBounces() * * @return $this */ - public function setSoftBounces($softBounces) + public function setSoftBounces(int $softBounces): static { + if (is_null($softBounces)) { + throw new InvalidArgumentException('non-nullable softBounces cannot be null'); + } $this->container['softBounces'] = $softBounces; return $this; @@ -362,7 +352,7 @@ public function setSoftBounces($softBounces) * * @return int */ - public function getHardBounces() + public function getHardBounces(): int { return $this->container['hardBounces']; } @@ -374,8 +364,11 @@ public function getHardBounces() * * @return $this */ - public function setHardBounces($hardBounces) + public function setHardBounces(int $hardBounces): static { + if (is_null($hardBounces)) { + throw new InvalidArgumentException('non-nullable hardBounces cannot be null'); + } $this->container['hardBounces'] = $hardBounces; return $this; @@ -386,7 +379,7 @@ public function setHardBounces($hardBounces) * * @return int */ - public function getUnsubscriptions() + public function getUnsubscriptions(): int { return $this->container['unsubscriptions']; } @@ -398,8 +391,11 @@ public function getUnsubscriptions() * * @return $this */ - public function setUnsubscriptions($unsubscriptions) + public function setUnsubscriptions(int $unsubscriptions): static { + if (is_null($unsubscriptions)) { + throw new InvalidArgumentException('non-nullable unsubscriptions cannot be null'); + } $this->container['unsubscriptions'] = $unsubscriptions; return $this; @@ -410,7 +406,7 @@ public function setUnsubscriptions($unsubscriptions) * * @return int */ - public function getAnswered() + public function getAnswered(): int { return $this->container['answered']; } @@ -422,85 +418,15 @@ public function getAnswered() * * @return $this */ - public function setAnswered($answered) + public function setAnswered(int $answered): static { + if (is_null($answered)) { + throw new InvalidArgumentException('non-nullable answered cannot be null'); + } $this->container['answered'] = $answered; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetSmsCampaigns.php b/lib/Models/GetSmsCampaigns.php index 555778f..b9d093d 100644 --- a/lib/Models/GetSmsCampaigns.php +++ b/lib/Models/GetSmsCampaigns.php @@ -2,102 +2,101 @@ /** * GetSmsCampaigns * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetSmsCampaigns Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetSmsCampaigns implements ModelInterface, ArrayAccess +class GetSmsCampaigns extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getSmsCampaigns'; + protected static string $openAPIModelName = 'getSmsCampaigns'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'campaigns' => 'object[]', + protected static array $openAPITypes = [ + 'campaigns' => '\Brevo\Client\Models\GetSmsCampaignsCampaignsInner[]', 'count' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'campaigns' => null, 'count' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'campaigns' => false, + 'count' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'campaigns' => 'campaigns', 'count' => 'count' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'campaigns' => 'setCampaigns', 'count' => 'setCount' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'campaigns' => 'getCampaigns', 'count' => 'getCount' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +145,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['campaigns'] = isset($data['campaigns']) ? $data['campaigns'] : null; - $this->container['count'] = isset($data['count']) ? $data['count'] : null; + $this->setIfExists('campaigns', $data ?? [], null); + $this->setIfExists('count', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets campaigns * - * @return object[] + * @return \Brevo\Client\Models\GetSmsCampaignsCampaignsInner[]|null */ - public function getCampaigns() + public function getCampaigns(): ?array { return $this->container['campaigns']; } @@ -223,12 +196,15 @@ public function getCampaigns() /** * Sets campaigns * - * @param object[] $campaigns campaigns + * @param \Brevo\Client\Models\GetSmsCampaignsCampaignsInner[]|null $campaigns campaigns * * @return $this */ - public function setCampaigns($campaigns) + public function setCampaigns(?array $campaigns): static { + if (is_null($campaigns)) { + throw new InvalidArgumentException('non-nullable campaigns cannot be null'); + } $this->container['campaigns'] = $campaigns; return $this; @@ -237,9 +213,9 @@ public function setCampaigns($campaigns) /** * Gets count * - * @return int + * @return int|null */ - public function getCount() + public function getCount(): ?int { return $this->container['count']; } @@ -247,89 +223,19 @@ public function getCount() /** * Sets count * - * @param int $count Number of SMS campaigns retrieved + * @param int|null $count Number of SMS campaigns retrieved * * @return $this */ - public function setCount($count) + public function setCount(?int $count): static { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } $this->container['count'] = $count; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetSmsCampaignsCampaignsInner.php b/lib/Models/GetSmsCampaignsCampaignsInner.php new file mode 100644 index 0000000..9390b7f --- /dev/null +++ b/lib/Models/GetSmsCampaignsCampaignsInner.php @@ -0,0 +1,582 @@ + + */ +class GetSmsCampaignsCampaignsInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getSmsCampaigns_campaigns_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'name' => 'string', + 'status' => 'string', + 'content' => 'string', + 'sender' => 'string', + 'createdAt' => 'string', + 'modifiedAt' => 'string', + 'recipients' => '\Brevo\Client\Models\GetCampaignRecipients', + 'statistics' => '\Brevo\Client\Models\GetSmsCampaignStats', + 'scheduledAt' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'int64', + 'name' => null, + 'status' => null, + 'content' => null, + 'sender' => null, + 'createdAt' => null, + 'modifiedAt' => null, + 'recipients' => null, + 'statistics' => null, + 'scheduledAt' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'status' => false, + 'content' => false, + 'sender' => false, + 'createdAt' => false, + 'modifiedAt' => false, + 'recipients' => false, + 'statistics' => false, + 'scheduledAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'status' => 'status', + 'content' => 'content', + 'sender' => 'sender', + 'createdAt' => 'createdAt', + 'modifiedAt' => 'modifiedAt', + 'recipients' => 'recipients', + 'statistics' => 'statistics', + 'scheduledAt' => 'scheduledAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'status' => 'setStatus', + 'content' => 'setContent', + 'sender' => 'setSender', + 'createdAt' => 'setCreatedAt', + 'modifiedAt' => 'setModifiedAt', + 'recipients' => 'setRecipients', + 'statistics' => 'setStatistics', + 'scheduledAt' => 'setScheduledAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'status' => 'getStatus', + 'content' => 'getContent', + 'sender' => 'getSender', + 'createdAt' => 'getCreatedAt', + 'modifiedAt' => 'getModifiedAt', + 'recipients' => 'getRecipients', + 'statistics' => 'getStatistics', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const STATUS_DRAFT = 'draft'; + public const STATUS_SENT = 'sent'; + public const STATUS_ARCHIVE = 'archive'; + public const STATUS_QUEUED = 'queued'; + public const STATUS_SUSPENDED = 'suspended'; + public const STATUS_IN_PROCESS = 'inProcess'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_DRAFT, + self::STATUS_SENT, + self::STATUS_ARCHIVE, + self::STATUS_QUEUED, + self::STATUS_SUSPENDED, + self::STATUS_IN_PROCESS, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('modifiedAt', $data ?? [], null); + $this->setIfExists('recipients', $data ?? [], null); + $this->setIfExists('statistics', $data ?? [], null); + $this->setIfExists('scheduledAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['content'] === null) { + $invalidProperties[] = "'content' can't be null"; + } + if ($this->container['sender'] === null) { + $invalidProperties[] = "'sender' can't be null"; + } + if ($this->container['createdAt'] === null) { + $invalidProperties[] = "'createdAt' can't be null"; + } + if ($this->container['modifiedAt'] === null) { + $invalidProperties[] = "'modifiedAt' can't be null"; + } + if ($this->container['recipients'] === null) { + $invalidProperties[] = "'recipients' can't be null"; + } + if ($this->container['statistics'] === null) { + $invalidProperties[] = "'statistics' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets id + * + * @return int + */ + public function getId(): int + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id ID of the SMS Campaign + * + * @return $this + */ + public function setId(int $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Name of the SMS Campaign + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus(): string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status Status of the SMS Campaign + * + * @return $this + */ + public function setStatus(string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets content + * + * @return string + */ + public function getContent(): string + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param string $content Content of the SMS Campaign + * + * @return $this + */ + public function setContent(string $content): static + { + if (is_null($content)) { + throw new InvalidArgumentException('non-nullable content cannot be null'); + } + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets sender + * + * @return string + */ + public function getSender(): string + { + return $this->container['sender']; + } + + /** + * Sets sender + * + * @param string $sender Sender of the SMS Campaign + * + * @return $this + */ + public function setSender(string $sender): static + { + if (is_null($sender)) { + throw new InvalidArgumentException('non-nullable sender cannot be null'); + } + $this->container['sender'] = $sender; + + return $this; + } + + /** + * Gets createdAt + * + * @return string + */ + public function getCreatedAt(): string + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param string $createdAt Creation UTC date-time of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + * + * @return $this + */ + public function setCreatedAt(string $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets modifiedAt + * + * @return string + */ + public function getModifiedAt(): string + { + return $this->container['modifiedAt']; + } + + /** + * Sets modifiedAt + * + * @param string $modifiedAt UTC date-time of last modification of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + * + * @return $this + */ + public function setModifiedAt(string $modifiedAt): static + { + if (is_null($modifiedAt)) { + throw new InvalidArgumentException('non-nullable modifiedAt cannot be null'); + } + $this->container['modifiedAt'] = $modifiedAt; + + return $this; + } + + /** + * Gets recipients + * + * @return \Brevo\Client\Models\GetCampaignRecipients + */ + public function getRecipients(): \Brevo\Client\Models\GetCampaignRecipients + { + return $this->container['recipients']; + } + + /** + * Sets recipients + * + * @param \Brevo\Client\Models\GetCampaignRecipients $recipients recipients + * + * @return $this + */ + public function setRecipients(\Brevo\Client\Models\GetCampaignRecipients $recipients): static + { + if (is_null($recipients)) { + throw new InvalidArgumentException('non-nullable recipients cannot be null'); + } + $this->container['recipients'] = $recipients; + + return $this; + } + + /** + * Gets statistics + * + * @return \Brevo\Client\Models\GetSmsCampaignStats + */ + public function getStatistics(): \Brevo\Client\Models\GetSmsCampaignStats + { + return $this->container['statistics']; + } + + /** + * Sets statistics + * + * @param \Brevo\Client\Models\GetSmsCampaignStats $statistics statistics + * + * @return $this + */ + public function setStatistics(\Brevo\Client\Models\GetSmsCampaignStats $statistics): static + { + if (is_null($statistics)) { + throw new InvalidArgumentException('non-nullable statistics cannot be null'); + } + $this->container['statistics'] = $statistics; + + return $this; + } + + /** + * Gets scheduledAt + * + * @return string|null + */ + public function getScheduledAt(): ?string + { + return $this->container['scheduledAt']; + } + + /** + * Sets scheduledAt + * + * @param string|null $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(?string $scheduledAt): static + { + if (is_null($scheduledAt)) { + throw new InvalidArgumentException('non-nullable scheduledAt cannot be null'); + } + $this->container['scheduledAt'] = $scheduledAt; + + return $this; + } +} + + diff --git a/lib/Models/GetSmsEventReport.php b/lib/Models/GetSmsEventReport.php index e14dac0..ff4fb66 100644 --- a/lib/Models/GetSmsEventReport.php +++ b/lib/Models/GetSmsEventReport.php @@ -2,118 +2,116 @@ /** * GetSmsEventReport * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetSmsEventReport Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetSmsEventReport implements ModelInterface, ArrayAccess +class GetSmsEventReport extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getSmsEventReport'; + protected static string $openAPIModelName = 'getSmsEventReport'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'events' => '\Brevo\Client\Models\GetSmsEventReportEvents[]' + protected static array $openAPITypes = [ + 'events' => '\Brevo\Client\Models\GetSmsEventReportEventsInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'events' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'events' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'events' => 'events' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'events' => 'setEvents' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'events' => 'getEvents' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,75 +139,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['events'] = isset($data['events']) ? $data['events'] : null; + $this->setIfExists('events', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets events * - * @return \Brevo\Client\Models\GetSmsEventReportEvents[] + * @return \Brevo\Client\Models\GetSmsEventReportEventsInner[]|null */ - public function getEvents() + public function getEvents(): ?array { return $this->container['events']; } @@ -217,89 +189,19 @@ public function getEvents() /** * Sets events * - * @param \Brevo\Client\Models\GetSmsEventReportEvents[] $events events + * @param \Brevo\Client\Models\GetSmsEventReportEventsInner[]|null $events events * * @return $this */ - public function setEvents($events) + public function setEvents(?array $events): static { + if (is_null($events)) { + throw new InvalidArgumentException('non-nullable events cannot be null'); + } $this->container['events'] = $events; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetSmsEventReportEvents.php b/lib/Models/GetSmsEventReportEvents.php deleted file mode 100644 index c7e6ac3..0000000 --- a/lib/Models/GetSmsEventReportEvents.php +++ /dev/null @@ -1,533 +0,0 @@ - 'string', - 'date' => 'string', - 'messageId' => 'string', - 'event' => 'string', - 'reason' => 'string', - 'reply' => 'string', - 'tag' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'phoneNumber' => null, - 'date' => null, - 'messageId' => null, - 'event' => null, - 'reason' => null, - 'reply' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'phoneNumber' => 'phoneNumber', - 'date' => 'date', - 'messageId' => 'messageId', - 'event' => 'event', - 'reason' => 'reason', - 'reply' => 'reply', - 'tag' => 'tag' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'phoneNumber' => 'setPhoneNumber', - 'date' => 'setDate', - 'messageId' => 'setMessageId', - 'event' => 'setEvent', - 'reason' => 'setReason', - 'reply' => 'setReply', - 'tag' => 'setTag' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'phoneNumber' => 'getPhoneNumber', - 'date' => 'getDate', - 'messageId' => 'getMessageId', - 'event' => 'getEvent', - 'reason' => 'getReason', - 'reply' => 'getReply', - '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'; - const EVENT_DELIVERED = 'delivered'; - const EVENT_SENT = 'sent'; - const EVENT_ACCEPTED = 'accepted'; - const EVENT_UNSUBSCRIPTION = 'unsubscription'; - const EVENT_REPLIES = 'replies'; - const EVENT_BLOCKED = 'blocked'; - const EVENT_REJECTED = 'rejected'; - - - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getEventAllowableValues() - { - return [ - self::EVENT_BOUNCES, - self::EVENT_HARD_BOUNCES, - self::EVENT_SOFT_BOUNCES, - self::EVENT_DELIVERED, - self::EVENT_SENT, - self::EVENT_ACCEPTED, - self::EVENT_UNSUBSCRIPTION, - self::EVENT_REPLIES, - self::EVENT_BLOCKED, - self::EVENT_REJECTED, - ]; - } - - - /** - * 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['phoneNumber'] = isset($data['phoneNumber']) ? $data['phoneNumber'] : null; - $this->container['date'] = isset($data['date']) ? $data['date'] : null; - $this->container['messageId'] = isset($data['messageId']) ? $data['messageId'] : null; - $this->container['event'] = isset($data['event']) ? $data['event'] : null; - $this->container['reason'] = isset($data['reason']) ? $data['reason'] : null; - $this->container['reply'] = isset($data['reply']) ? $data['reply'] : null; - $this->container['tag'] = isset($data['tag']) ? $data['tag'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - $allowedValues = $this->getEventAllowableValues(); - if (!is_null($this->container['event']) && !in_array($this->container['event'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value for 'event', must be one of '%s'", - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets phoneNumber - * - * @return string - */ - public function getPhoneNumber() - { - return $this->container['phoneNumber']; - } - - /** - * Sets phoneNumber - * - * @param string $phoneNumber Phone number which has generated the event - * - * @return $this - */ - public function setPhoneNumber($phoneNumber) - { - $this->container['phoneNumber'] = $phoneNumber; - - return $this; - } - - /** - * Gets date - * - * @return string - */ - public function getDate() - { - return $this->container['date']; - } - - /** - * Sets date - * - * @param string $date UTC date-time on which the event has been generated - * - * @return $this - */ - public function setDate($date) - { - $this->container['date'] = $date; - - return $this; - } - - /** - * Gets messageId - * - * @return string - */ - public function getMessageId() - { - return $this->container['messageId']; - } - - /** - * Sets messageId - * - * @param string $messageId Message ID which generated the event - * - * @return $this - */ - public function setMessageId($messageId) - { - $this->container['messageId'] = $messageId; - - return $this; - } - - /** - * Gets event - * - * @return string - */ - public function getEvent() - { - return $this->container['event']; - } - - /** - * Sets event - * - * @param string $event Event which occurred - * - * @return $this - */ - public function setEvent($event) - { - $allowedValues = $this->getEventAllowableValues(); - if (!is_null($event) && !in_array($event, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'event', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['event'] = $event; - - return $this; - } - - /** - * Gets reason - * - * @return string - */ - public function getReason() - { - return $this->container['reason']; - } - - /** - * Sets reason - * - * @param string $reason Reason of bounce (only available if the event is hardbounce or softbounce) - * - * @return $this - */ - public function setReason($reason) - { - $this->container['reason'] = $reason; - - return $this; - } - - /** - * Gets reply - * - * @return string - */ - public function getReply() - { - return $this->container['reply']; - } - - /** - * Sets reply - * - * @param string $reply reply - * - * @return $this - */ - public function setReply($reply) - { - $this->container['reply'] = $reply; - - return $this; - } - - /** - * Gets tag - * - * @return string - */ - public function getTag() - { - return $this->container['tag']; - } - - /** - * Sets tag - * - * @param string $tag Tag of the SMS which generated the event - * - * @return $this - */ - public function setTag($tag) - { - $this->container['tag'] = $tag; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetSmsEventReportEventsInner.php b/lib/Models/GetSmsEventReportEventsInner.php new file mode 100644 index 0000000..1b26662 --- /dev/null +++ b/lib/Models/GetSmsEventReportEventsInner.php @@ -0,0 +1,463 @@ + + */ +class GetSmsEventReportEventsInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getSmsEventReport_events_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'phoneNumber' => 'string', + 'date' => 'string', + 'messageId' => 'string', + 'event' => 'string', + 'reason' => 'string', + 'reply' => 'string', + 'tag' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'phoneNumber' => null, + 'date' => null, + 'messageId' => null, + 'event' => null, + 'reason' => null, + 'reply' => null, + 'tag' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'phoneNumber' => false, + 'date' => false, + 'messageId' => false, + 'event' => false, + 'reason' => false, + 'reply' => false, + 'tag' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'phoneNumber' => 'phoneNumber', + 'date' => 'date', + 'messageId' => 'messageId', + 'event' => 'event', + 'reason' => 'reason', + 'reply' => 'reply', + 'tag' => 'tag' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'phoneNumber' => 'setPhoneNumber', + 'date' => 'setDate', + 'messageId' => 'setMessageId', + 'event' => 'setEvent', + 'reason' => 'setReason', + 'reply' => 'setReply', + 'tag' => 'setTag' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'phoneNumber' => 'getPhoneNumber', + 'date' => 'getDate', + 'messageId' => 'getMessageId', + 'event' => 'getEvent', + 'reason' => 'getReason', + 'reply' => 'getReply', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const EVENT_BOUNCES = 'bounces'; + public const EVENT_HARD_BOUNCES = 'hardBounces'; + public const EVENT_SOFT_BOUNCES = 'softBounces'; + public const EVENT_DELIVERED = 'delivered'; + public const EVENT_SENT = 'sent'; + public const EVENT_ACCEPTED = 'accepted'; + public const EVENT_UNSUBSCRIPTION = 'unsubscription'; + public const EVENT_REPLIES = 'replies'; + public const EVENT_BLOCKED = 'blocked'; + public const EVENT_REJECTED = 'rejected'; + public const EVENT_SKIPPED = 'skipped'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEventAllowableValues() + { + return [ + self::EVENT_BOUNCES, + self::EVENT_HARD_BOUNCES, + self::EVENT_SOFT_BOUNCES, + self::EVENT_DELIVERED, + self::EVENT_SENT, + self::EVENT_ACCEPTED, + self::EVENT_UNSUBSCRIPTION, + self::EVENT_REPLIES, + self::EVENT_BLOCKED, + self::EVENT_REJECTED, + self::EVENT_SKIPPED, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('phoneNumber', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('messageId', $data ?? [], null); + $this->setIfExists('event', $data ?? [], null); + $this->setIfExists('reason', $data ?? [], null); + $this->setIfExists('reply', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = $this->getEventAllowableValues(); + if (!is_null($this->container['event']) && !in_array($this->container['event'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'event', must be one of '%s'", + $this->container['event'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets phoneNumber + * + * @return string|null + */ + public function getPhoneNumber(): ?string + { + return $this->container['phoneNumber']; + } + + /** + * Sets phoneNumber + * + * @param string|null $phoneNumber Phone number which has generated the event + * + * @return $this + */ + public function setPhoneNumber(?string $phoneNumber): static + { + if (is_null($phoneNumber)) { + throw new InvalidArgumentException('non-nullable phoneNumber cannot be null'); + } + $this->container['phoneNumber'] = $phoneNumber; + + return $this; + } + + /** + * Gets date + * + * @return string|null + */ + public function getDate(): ?string + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param string|null $date UTC date-time on which the event has been generated + * + * @return $this + */ + public function setDate(?string $date): static + { + if (is_null($date)) { + throw new InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets messageId + * + * @return string|null + */ + public function getMessageId(): ?string + { + return $this->container['messageId']; + } + + /** + * Sets messageId + * + * @param string|null $messageId Message ID which generated the event + * + * @return $this + */ + public function setMessageId(?string $messageId): static + { + if (is_null($messageId)) { + throw new InvalidArgumentException('non-nullable messageId cannot be null'); + } + $this->container['messageId'] = $messageId; + + return $this; + } + + /** + * Gets event + * + * @return string|null + */ + public function getEvent(): ?string + { + return $this->container['event']; + } + + /** + * Sets event + * + * @param string|null $event Event which occurred + * + * @return $this + */ + public function setEvent(?string $event): static + { + if (is_null($event)) { + throw new InvalidArgumentException('non-nullable event cannot be null'); + } + $allowedValues = $this->getEventAllowableValues(); + if (!in_array($event, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'event', must be one of '%s'", + $event, + implode("', '", $allowedValues) + ) + ); + } + $this->container['event'] = $event; + + return $this; + } + + /** + * Gets reason + * + * @return string|null + */ + public function getReason(): ?string + { + return $this->container['reason']; + } + + /** + * Sets reason + * + * @param string|null $reason Reason of bounce (only available if the event is hardbounce or softbounce) + * + * @return $this + */ + public function setReason(?string $reason): static + { + if (is_null($reason)) { + throw new InvalidArgumentException('non-nullable reason cannot be null'); + } + $this->container['reason'] = $reason; + + return $this; + } + + /** + * Gets reply + * + * @return string|null + */ + public function getReply(): ?string + { + return $this->container['reply']; + } + + /** + * Sets reply + * + * @param string|null $reply reply + * + * @return $this + */ + public function setReply(?string $reply): static + { + if (is_null($reply)) { + throw new InvalidArgumentException('non-nullable reply cannot be null'); + } + $this->container['reply'] = $reply; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag Tag of the SMS which generated the event + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } + $this->container['tag'] = $tag; + + return $this; + } +} + + diff --git a/lib/Models/GetSmtpTemplateOverview.php b/lib/Models/GetSmtpTemplateOverview.php index a9d728e..9817c9a 100644 --- a/lib/Models/GetSmtpTemplateOverview.php +++ b/lib/Models/GetSmtpTemplateOverview.php @@ -2,61 +2,63 @@ /** * GetSmtpTemplateOverview * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetSmtpTemplateOverview Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetSmtpTemplateOverview implements ModelInterface, ArrayAccess +class GetSmtpTemplateOverview extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getSmtpTemplateOverview'; + protected static string $openAPIModelName = 'getSmtpTemplateOverview'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'subject' => 'string', @@ -75,9 +77,9 @@ class GetSmtpTemplateOverview implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'name' => null, 'subject' => null, @@ -94,32 +96,40 @@ class GetSmtpTemplateOverview implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'subject' => false, + 'isActive' => false, + 'testSent' => false, + 'sender' => false, + 'replyTo' => false, + 'toField' => false, + 'tag' => false, + 'htmlContent' => false, + 'createdAt' => false, + 'modifiedAt' => false, + 'doiTemplate' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name', 'subject' => 'subject', @@ -138,9 +148,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName', 'subject' => 'setSubject', @@ -159,9 +169,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName', 'subject' => 'getSubject', @@ -181,9 +191,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -191,9 +201,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -201,63 +211,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['subject'] = isset($data['subject']) ? $data['subject'] : null; - $this->container['isActive'] = isset($data['isActive']) ? $data['isActive'] : null; - $this->container['testSent'] = isset($data['testSent']) ? $data['testSent'] : null; - $this->container['sender'] = isset($data['sender']) ? $data['sender'] : null; - $this->container['replyTo'] = isset($data['replyTo']) ? $data['replyTo'] : null; - $this->container['toField'] = isset($data['toField']) ? $data['toField'] : null; - $this->container['tag'] = isset($data['tag']) ? $data['tag'] : null; - $this->container['htmlContent'] = isset($data['htmlContent']) ? $data['htmlContent'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['modifiedAt'] = isset($data['modifiedAt']) ? $data['modifiedAt'] : null; - $this->container['doiTemplate'] = isset($data['doiTemplate']) ? $data['doiTemplate'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('isActive', $data ?? [], null); + $this->setIfExists('testSent', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('replyTo', $data ?? [], null); + $this->setIfExists('toField', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('htmlContent', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('modifiedAt', $data ?? [], null); + $this->setIfExists('doiTemplate', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -300,24 +296,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -329,8 +313,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -341,7 +328,7 @@ public function setId($id) * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -353,8 +340,11 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -365,7 +355,7 @@ public function setName($name) * * @return string */ - public function getSubject() + public function getSubject(): string { return $this->container['subject']; } @@ -377,8 +367,11 @@ public function getSubject() * * @return $this */ - public function setSubject($subject) + public function setSubject(string $subject): static { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } $this->container['subject'] = $subject; return $this; @@ -389,7 +382,7 @@ public function setSubject($subject) * * @return bool */ - public function getIsActive() + public function getIsActive(): bool { return $this->container['isActive']; } @@ -401,8 +394,11 @@ public function getIsActive() * * @return $this */ - public function setIsActive($isActive) + public function setIsActive(bool $isActive): static { + if (is_null($isActive)) { + throw new InvalidArgumentException('non-nullable isActive cannot be null'); + } $this->container['isActive'] = $isActive; return $this; @@ -413,7 +409,7 @@ public function setIsActive($isActive) * * @return bool */ - public function getTestSent() + public function getTestSent(): bool { return $this->container['testSent']; } @@ -425,8 +421,11 @@ public function getTestSent() * * @return $this */ - public function setTestSent($testSent) + public function setTestSent(bool $testSent): static { + if (is_null($testSent)) { + throw new InvalidArgumentException('non-nullable testSent cannot be null'); + } $this->container['testSent'] = $testSent; return $this; @@ -437,7 +436,7 @@ public function setTestSent($testSent) * * @return \Brevo\Client\Models\GetSmtpTemplateOverviewSender */ - public function getSender() + public function getSender(): \Brevo\Client\Models\GetSmtpTemplateOverviewSender { return $this->container['sender']; } @@ -449,8 +448,11 @@ public function getSender() * * @return $this */ - public function setSender($sender) + public function setSender(\Brevo\Client\Models\GetSmtpTemplateOverviewSender $sender): static { + if (is_null($sender)) { + throw new InvalidArgumentException('non-nullable sender cannot be null'); + } $this->container['sender'] = $sender; return $this; @@ -461,7 +463,7 @@ public function setSender($sender) * * @return string */ - public function getReplyTo() + public function getReplyTo(): string { return $this->container['replyTo']; } @@ -473,8 +475,11 @@ public function getReplyTo() * * @return $this */ - public function setReplyTo($replyTo) + public function setReplyTo(string $replyTo): static { + if (is_null($replyTo)) { + throw new InvalidArgumentException('non-nullable replyTo cannot be null'); + } $this->container['replyTo'] = $replyTo; return $this; @@ -485,7 +490,7 @@ public function setReplyTo($replyTo) * * @return string */ - public function getToField() + public function getToField(): string { return $this->container['toField']; } @@ -497,8 +502,11 @@ public function getToField() * * @return $this */ - public function setToField($toField) + public function setToField(string $toField): static { + if (is_null($toField)) { + throw new InvalidArgumentException('non-nullable toField cannot be null'); + } $this->container['toField'] = $toField; return $this; @@ -509,7 +517,7 @@ public function setToField($toField) * * @return string */ - public function getTag() + public function getTag(): string { return $this->container['tag']; } @@ -521,8 +529,11 @@ public function getTag() * * @return $this */ - public function setTag($tag) + public function setTag(string $tag): static { + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } $this->container['tag'] = $tag; return $this; @@ -533,7 +544,7 @@ public function setTag($tag) * * @return string */ - public function getHtmlContent() + public function getHtmlContent(): string { return $this->container['htmlContent']; } @@ -545,8 +556,11 @@ public function getHtmlContent() * * @return $this */ - public function setHtmlContent($htmlContent) + public function setHtmlContent(string $htmlContent): static { + if (is_null($htmlContent)) { + throw new InvalidArgumentException('non-nullable htmlContent cannot be null'); + } $this->container['htmlContent'] = $htmlContent; return $this; @@ -557,7 +571,7 @@ public function setHtmlContent($htmlContent) * * @return string */ - public function getCreatedAt() + public function getCreatedAt(): string { return $this->container['createdAt']; } @@ -569,8 +583,11 @@ public function getCreatedAt() * * @return $this */ - public function setCreatedAt($createdAt) + public function setCreatedAt(string $createdAt): static { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } $this->container['createdAt'] = $createdAt; return $this; @@ -581,7 +598,7 @@ public function setCreatedAt($createdAt) * * @return string */ - public function getModifiedAt() + public function getModifiedAt(): string { return $this->container['modifiedAt']; } @@ -593,8 +610,11 @@ public function getModifiedAt() * * @return $this */ - public function setModifiedAt($modifiedAt) + public function setModifiedAt(string $modifiedAt): static { + if (is_null($modifiedAt)) { + throw new InvalidArgumentException('non-nullable modifiedAt cannot be null'); + } $this->container['modifiedAt'] = $modifiedAt; return $this; @@ -603,9 +623,9 @@ public function setModifiedAt($modifiedAt) /** * Gets doiTemplate * - * @return bool + * @return bool|null */ - public function getDoiTemplate() + public function getDoiTemplate(): ?bool { return $this->container['doiTemplate']; } @@ -613,89 +633,19 @@ public function getDoiTemplate() /** * Sets doiTemplate * - * @param bool $doiTemplate It is true if template is a valid Double opt-in (DOI) template, otherwise it is false. This field will be available only in case of single template detail call. + * @param bool|null $doiTemplate It is true if template is a valid Double opt-in (DOI) template, otherwise it is false. This field will be available only in case of single template detail call. * * @return $this */ - public function setDoiTemplate($doiTemplate) + public function setDoiTemplate(?bool $doiTemplate): static { + if (is_null($doiTemplate)) { + throw new InvalidArgumentException('non-nullable doiTemplate cannot be null'); + } $this->container['doiTemplate'] = $doiTemplate; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetSmtpTemplateOverviewSender.php b/lib/Models/GetSmtpTemplateOverviewSender.php index 350a104..d798547 100644 --- a/lib/Models/GetSmtpTemplateOverviewSender.php +++ b/lib/Models/GetSmtpTemplateOverviewSender.php @@ -2,61 +2,63 @@ /** * GetSmtpTemplateOverviewSender * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetSmtpTemplateOverviewSender Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetSmtpTemplateOverviewSender implements ModelInterface, ArrayAccess +class GetSmtpTemplateOverviewSender extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getSmtpTemplateOverview_sender'; + protected static string $openAPIModelName = 'getSmtpTemplateOverview_sender'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string', 'email' => 'string', 'id' => 'string' @@ -65,41 +67,39 @@ class GetSmtpTemplateOverviewSender implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null, 'email' => 'email', 'id' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'email' => false, + 'id' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name', 'email' => 'email', 'id' => 'id' @@ -108,9 +108,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName', 'email' => 'setEmail', 'id' => 'setId' @@ -119,9 +119,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName', 'email' => 'getEmail', 'id' => 'getId' @@ -131,9 +131,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -141,9 +141,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -151,77 +151,51 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * - * @return string + * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -229,12 +203,15 @@ public function getName() /** * Sets name * - * @param string $name From email for the template + * @param string|null $name From email for the template * * @return $this */ - public function setName($name) + public function setName(?string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -243,9 +220,9 @@ public function setName($name) /** * Gets email * - * @return string + * @return string|null */ - public function getEmail() + public function getEmail(): ?string { return $this->container['email']; } @@ -253,12 +230,15 @@ public function getEmail() /** * Sets email * - * @param string $email From email for the template + * @param string|null $email From email for the template * * @return $this */ - public function setEmail($email) + public function setEmail(?string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -267,9 +247,9 @@ public function setEmail($email) /** * Gets id * - * @return string + * @return string|null */ - public function getId() + public function getId(): ?string { return $this->container['id']; } @@ -277,89 +257,19 @@ public function getId() /** * Sets id * - * @param string $id Sender id of the template + * @param string|null $id Sender id of the template * * @return $this */ - public function setId($id) + public function setId(?string $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetSmtpTemplates.php b/lib/Models/GetSmtpTemplates.php index bc94a2c..a29991a 100644 --- a/lib/Models/GetSmtpTemplates.php +++ b/lib/Models/GetSmtpTemplates.php @@ -2,61 +2,63 @@ /** * GetSmtpTemplates * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetSmtpTemplates Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetSmtpTemplates implements ModelInterface, ArrayAccess +class GetSmtpTemplates extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getSmtpTemplates'; + protected static string $openAPIModelName = 'getSmtpTemplates'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'count' => 'int', 'templates' => '\Brevo\Client\Models\GetSmtpTemplateOverview[]' ]; @@ -64,40 +66,37 @@ class GetSmtpTemplates implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'count' => 'int64', 'templates' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'count' => false, + 'templates' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'count' => 'count', 'templates' => 'templates' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'count' => 'setCount', 'templates' => 'setTemplates' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'count' => 'getCount', 'templates' => 'getTemplates' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +145,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['count'] = isset($data['count']) ? $data['count'] : null; - $this->container['templates'] = isset($data['templates']) ? $data['templates'] : null; + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('templates', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets count * - * @return int + * @return int|null */ - public function getCount() + public function getCount(): ?int { return $this->container['count']; } @@ -223,12 +196,15 @@ public function getCount() /** * Sets count * - * @param int $count Count of transactional email templates + * @param int|null $count Count of transactional email templates * * @return $this */ - public function setCount($count) + public function setCount(?int $count): static { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } $this->container['count'] = $count; return $this; @@ -237,9 +213,9 @@ public function setCount($count) /** * Gets templates * - * @return \Brevo\Client\Models\GetSmtpTemplateOverview[] + * @return \Brevo\Client\Models\GetSmtpTemplateOverview[]|null */ - public function getTemplates() + public function getTemplates(): ?array { return $this->container['templates']; } @@ -247,89 +223,19 @@ public function getTemplates() /** * Sets templates * - * @param \Brevo\Client\Models\GetSmtpTemplateOverview[] $templates templates + * @param \Brevo\Client\Models\GetSmtpTemplateOverview[]|null $templates templates * * @return $this */ - public function setTemplates($templates) + public function setTemplates(?array $templates): static { + if (is_null($templates)) { + throw new InvalidArgumentException('non-nullable templates cannot be null'); + } $this->container['templates'] = $templates; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetSsoToken.php b/lib/Models/GetSsoToken.php index 4edbc99..b0f85cb 100644 --- a/lib/Models/GetSsoToken.php +++ b/lib/Models/GetSsoToken.php @@ -2,118 +2,116 @@ /** * GetSsoToken * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetSsoToken Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetSsoToken implements ModelInterface, ArrayAccess +class GetSsoToken extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getSsoToken'; + protected static string $openAPIModelName = 'getSsoToken'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'token' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'token' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'token' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'token' => 'token' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'token' => 'setToken' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'token' => 'getToken' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,51 +139,37 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['token'] = isset($data['token']) ? $data['token'] : null; + $this->setIfExists('token', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -195,24 +179,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets token * * @return string */ - public function getToken() + public function getToken(): string { return $this->container['token']; } @@ -224,85 +196,15 @@ public function getToken() * * @return $this */ - public function setToken($token) + public function setToken(string $token): static { + if (is_null($token)) { + throw new InvalidArgumentException('non-nullable token cannot be null'); + } $this->container['token'] = $token; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetStatsByBrowser.php b/lib/Models/GetStatsByBrowser.php deleted file mode 100644 index e860229..0000000 --- a/lib/Models/GetStatsByBrowser.php +++ /dev/null @@ -1,280 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetStatsByDevice.php b/lib/Models/GetStatsByDevice.php index ab755d3..49286a4 100644 --- a/lib/Models/GetStatsByDevice.php +++ b/lib/Models/GetStatsByDevice.php @@ -2,73 +2,75 @@ /** * GetStatsByDevice * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetStatsByDevice Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetStatsByDevice implements ModelInterface, ArrayAccess +class GetStatsByDevice extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getStatsByDevice'; + protected static string $openAPIModelName = 'getStatsByDevice'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'desktop' => 'map[string,\Brevo\Client\Models\GetDeviceBrowserStats]', - 'mobile' => 'map[string,\Brevo\Client\Models\GetDeviceBrowserStats]', - 'tablet' => 'map[string,\Brevo\Client\Models\GetDeviceBrowserStats]', - 'unknown' => 'map[string,\Brevo\Client\Models\GetDeviceBrowserStats]' + protected static array $openAPITypes = [ + 'desktop' => 'array', + 'mobile' => 'array', + 'tablet' => 'array', + 'unknown' => 'array' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'desktop' => null, 'mobile' => null, 'tablet' => null, @@ -76,32 +78,31 @@ class GetStatsByDevice implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'desktop' => false, + 'mobile' => false, + 'tablet' => false, + 'unknown' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'desktop' => 'desktop', 'mobile' => 'mobile', 'tablet' => 'tablet', @@ -111,9 +112,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'desktop' => 'setDesktop', 'mobile' => 'setMobile', 'tablet' => 'setTablet', @@ -123,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'desktop' => 'getDesktop', 'mobile' => 'getMobile', 'tablet' => 'getTablet', @@ -136,9 +137,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +147,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,78 +157,52 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['desktop'] = isset($data['desktop']) ? $data['desktop'] : null; - $this->container['mobile'] = isset($data['mobile']) ? $data['mobile'] : null; - $this->container['tablet'] = isset($data['tablet']) ? $data['tablet'] : null; - $this->container['unknown'] = isset($data['unknown']) ? $data['unknown'] : null; + $this->setIfExists('desktop', $data ?? [], null); + $this->setIfExists('mobile', $data ?? [], null); + $this->setIfExists('tablet', $data ?? [], null); + $this->setIfExists('unknown', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets desktop * - * @return map[string,\Brevo\Client\Models\GetDeviceBrowserStats] + * @return array|null */ - public function getDesktop() + public function getDesktop(): ?array { return $this->container['desktop']; } @@ -235,12 +210,15 @@ public function getDesktop() /** * Sets desktop * - * @param map[string,\Brevo\Client\Models\GetDeviceBrowserStats] $desktop Statistics of the campaign on the basis of desktop devices + * @param array|null $desktop Statistics of the campaign on the basis of desktop devices * * @return $this */ - public function setDesktop($desktop) + public function setDesktop(?array $desktop): static { + if (is_null($desktop)) { + throw new InvalidArgumentException('non-nullable desktop cannot be null'); + } $this->container['desktop'] = $desktop; return $this; @@ -249,9 +227,9 @@ public function setDesktop($desktop) /** * Gets mobile * - * @return map[string,\Brevo\Client\Models\GetDeviceBrowserStats] + * @return array|null */ - public function getMobile() + public function getMobile(): ?array { return $this->container['mobile']; } @@ -259,12 +237,15 @@ public function getMobile() /** * Sets mobile * - * @param map[string,\Brevo\Client\Models\GetDeviceBrowserStats] $mobile Statistics of the campaign on the basis of mobile devices + * @param array|null $mobile Statistics of the campaign on the basis of mobile devices * * @return $this */ - public function setMobile($mobile) + public function setMobile(?array $mobile): static { + if (is_null($mobile)) { + throw new InvalidArgumentException('non-nullable mobile cannot be null'); + } $this->container['mobile'] = $mobile; return $this; @@ -273,9 +254,9 @@ public function setMobile($mobile) /** * Gets tablet * - * @return map[string,\Brevo\Client\Models\GetDeviceBrowserStats] + * @return array|null */ - public function getTablet() + public function getTablet(): ?array { return $this->container['tablet']; } @@ -283,12 +264,15 @@ public function getTablet() /** * Sets tablet * - * @param map[string,\Brevo\Client\Models\GetDeviceBrowserStats] $tablet Statistics of the campaign on the basis of tablet devices + * @param array|null $tablet Statistics of the campaign on the basis of tablet devices * * @return $this */ - public function setTablet($tablet) + public function setTablet(?array $tablet): static { + if (is_null($tablet)) { + throw new InvalidArgumentException('non-nullable tablet cannot be null'); + } $this->container['tablet'] = $tablet; return $this; @@ -297,9 +281,9 @@ public function setTablet($tablet) /** * Gets unknown * - * @return map[string,\Brevo\Client\Models\GetDeviceBrowserStats] + * @return array|null */ - public function getUnknown() + public function getUnknown(): ?array { return $this->container['unknown']; } @@ -307,89 +291,19 @@ public function getUnknown() /** * Sets unknown * - * @param map[string,\Brevo\Client\Models\GetDeviceBrowserStats] $unknown Statistics of the campaign on the basis of unknown devices + * @param array|null $unknown Statistics of the campaign on the basis of unknown devices * * @return $this */ - public function setUnknown($unknown) + public function setUnknown(?array $unknown): static { + if (is_null($unknown)) { + throw new InvalidArgumentException('non-nullable unknown cannot be null'); + } $this->container['unknown'] = $unknown; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetStatsByDomain.php b/lib/Models/GetStatsByDomain.php deleted file mode 100644 index df8cf2a..0000000 --- a/lib/Models/GetStatsByDomain.php +++ /dev/null @@ -1,280 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetSubAccountGroups200ResponseInner.php b/lib/Models/GetSubAccountGroups200ResponseInner.php new file mode 100644 index 0000000..3205167 --- /dev/null +++ b/lib/Models/GetSubAccountGroups200ResponseInner.php @@ -0,0 +1,241 @@ + + */ +class GetSubAccountGroups200ResponseInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getSubAccountGroups_200_response_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'groupName' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'groupName' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'groupName' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'groupName' => 'groupName' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'groupName' => 'setGroupName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'groupName' => 'getGroupName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('groupName', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique id of the group + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets groupName + * + * @return string|null + */ + public function getGroupName(): ?string + { + return $this->container['groupName']; + } + + /** + * Sets groupName + * + * @param string|null $groupName The name of the group of sub-accounts + * + * @return $this + */ + public function setGroupName(?string $groupName): static + { + if (is_null($groupName)) { + throw new InvalidArgumentException('non-nullable groupName cannot be null'); + } + $this->container['groupName'] = $groupName; + + return $this; + } +} + + diff --git a/lib/Models/GetSubscriptionInfoResponse.php b/lib/Models/GetSubscriptionInfoResponse.php new file mode 100644 index 0000000..10da5de --- /dev/null +++ b/lib/Models/GetSubscriptionInfoResponse.php @@ -0,0 +1,309 @@ + + */ +class GetSubscriptionInfoResponse extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getSubscriptionInfoResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'balance' => '\Brevo\Client\Models\GetSubscriptionInfoResponseBalance', + 'tier' => '\Brevo\Client\Models\GetSubscriptionInfoResponseTierInner[]', + 'members' => '\Brevo\Client\Models\GetSubscriptionInfoResponseMembersInner[]', + 'reward' => '\Brevo\Client\Models\GetSubscriptionInfoResponseRewardInner[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'balance' => null, + 'tier' => null, + 'members' => null, + 'reward' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'balance' => false, + 'tier' => false, + 'members' => false, + 'reward' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'balance' => 'balance', + 'tier' => 'tier', + 'members' => 'members', + 'reward' => 'reward' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'balance' => 'setBalance', + 'tier' => 'setTier', + 'members' => 'setMembers', + 'reward' => 'setReward' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'balance' => 'getBalance', + 'tier' => 'getTier', + 'members' => 'getMembers', + 'reward' => 'getReward' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('tier', $data ?? [], null); + $this->setIfExists('members', $data ?? [], null); + $this->setIfExists('reward', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets balance + * + * @return \Brevo\Client\Models\GetSubscriptionInfoResponseBalance|null + */ + public function getBalance(): ?\Brevo\Client\Models\GetSubscriptionInfoResponseBalance + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param \Brevo\Client\Models\GetSubscriptionInfoResponseBalance|null $balance balance + * + * @return $this + */ + public function setBalance(?\Brevo\Client\Models\GetSubscriptionInfoResponseBalance $balance): static + { + if (is_null($balance)) { + throw new InvalidArgumentException('non-nullable balance cannot be null'); + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets tier + * + * @return \Brevo\Client\Models\GetSubscriptionInfoResponseTierInner[]|null + */ + public function getTier(): ?array + { + return $this->container['tier']; + } + + /** + * Sets tier + * + * @param \Brevo\Client\Models\GetSubscriptionInfoResponseTierInner[]|null $tier Tier Information + * + * @return $this + */ + public function setTier(?array $tier): static + { + if (is_null($tier)) { + throw new InvalidArgumentException('non-nullable tier cannot be null'); + } + $this->container['tier'] = $tier; + + return $this; + } + + /** + * Gets members + * + * @return \Brevo\Client\Models\GetSubscriptionInfoResponseMembersInner[]|null + */ + public function getMembers(): ?array + { + return $this->container['members']; + } + + /** + * Sets members + * + * @param \Brevo\Client\Models\GetSubscriptionInfoResponseMembersInner[]|null $members Subscription Member Information + * + * @return $this + */ + public function setMembers(?array $members): static + { + if (is_null($members)) { + throw new InvalidArgumentException('non-nullable members cannot be null'); + } + $this->container['members'] = $members; + + return $this; + } + + /** + * Gets reward + * + * @return \Brevo\Client\Models\GetSubscriptionInfoResponseRewardInner[]|null + */ + public function getReward(): ?array + { + return $this->container['reward']; + } + + /** + * Sets reward + * + * @param \Brevo\Client\Models\GetSubscriptionInfoResponseRewardInner[]|null $reward Reward Information + * + * @return $this + */ + public function setReward(?array $reward): static + { + if (is_null($reward)) { + throw new InvalidArgumentException('non-nullable reward cannot be null'); + } + $this->container['reward'] = $reward; + + return $this; + } +} + + diff --git a/lib/Models/GetSubscriptionInfoResponseBalance.php b/lib/Models/GetSubscriptionInfoResponseBalance.php new file mode 100644 index 0000000..1085e55 --- /dev/null +++ b/lib/Models/GetSubscriptionInfoResponseBalance.php @@ -0,0 +1,276 @@ + + */ +class GetSubscriptionInfoResponseBalance extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getSubscriptionInfoResponse_balance'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'loyaltyProgramId' => 'string', + 'contactId' => 'int', + 'balances' => '\Brevo\Client\Models\GetSubscriptionInfoResponseBalanceBalancesInner[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'loyaltyProgramId' => 'uuid', + 'contactId' => null, + 'balances' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'loyaltyProgramId' => false, + 'contactId' => false, + 'balances' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'loyaltyProgramId' => 'loyaltyProgramId', + 'contactId' => 'contactId', + 'balances' => 'balances' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'loyaltyProgramId' => 'setLoyaltyProgramId', + 'contactId' => 'setContactId', + 'balances' => 'setBalances' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'loyaltyProgramId' => 'getLoyaltyProgramId', + 'contactId' => 'getContactId', + 'balances' => 'getBalances' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('loyaltyProgramId', $data ?? [], null); + $this->setIfExists('contactId', $data ?? [], null); + $this->setIfExists('balances', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets loyaltyProgramId + * + * @return string|null + */ + public function getLoyaltyProgramId(): ?string + { + return $this->container['loyaltyProgramId']; + } + + /** + * Sets loyaltyProgramId + * + * @param string|null $loyaltyProgramId Loyalty Program Id + * + * @return $this + */ + public function setLoyaltyProgramId(?string $loyaltyProgramId): static + { + if (is_null($loyaltyProgramId)) { + throw new InvalidArgumentException('non-nullable loyaltyProgramId cannot be null'); + } + $this->container['loyaltyProgramId'] = $loyaltyProgramId; + + return $this; + } + + /** + * Gets contactId + * + * @return int|null + */ + public function getContactId(): ?int + { + return $this->container['contactId']; + } + + /** + * Sets contactId + * + * @param int|null $contactId one of contact id or loyalty subscription id is required + * + * @return $this + */ + public function setContactId(?int $contactId): static + { + if (is_null($contactId)) { + throw new InvalidArgumentException('non-nullable contactId cannot be null'); + } + $this->container['contactId'] = $contactId; + + return $this; + } + + /** + * Gets balances + * + * @return \Brevo\Client\Models\GetSubscriptionInfoResponseBalanceBalancesInner[]|null + */ + public function getBalances(): ?array + { + return $this->container['balances']; + } + + /** + * Sets balances + * + * @param \Brevo\Client\Models\GetSubscriptionInfoResponseBalanceBalancesInner[]|null $balances Balances + * + * @return $this + */ + public function setBalances(?array $balances): static + { + if (is_null($balances)) { + throw new InvalidArgumentException('non-nullable balances cannot be null'); + } + $this->container['balances'] = $balances; + + return $this; + } +} + + diff --git a/lib/Models/GetSubscriptionInfoResponseBalanceBalancesInner.php b/lib/Models/GetSubscriptionInfoResponseBalanceBalancesInner.php new file mode 100644 index 0000000..db3112e --- /dev/null +++ b/lib/Models/GetSubscriptionInfoResponseBalanceBalancesInner.php @@ -0,0 +1,241 @@ + + */ +class GetSubscriptionInfoResponseBalanceBalancesInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getSubscriptionInfoResponse_balance_balances_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'balanceDefinitionId' => 'string', + 'value' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'balanceDefinitionId' => 'uuid', + 'value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'balanceDefinitionId' => false, + 'value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'balanceDefinitionId' => 'balanceDefinitionId', + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'balanceDefinitionId' => 'setBalanceDefinitionId', + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'balanceDefinitionId' => 'getBalanceDefinitionId', + 'value' => 'getValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('balanceDefinitionId', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets balanceDefinitionId + * + * @return string|null + */ + public function getBalanceDefinitionId(): ?string + { + return $this->container['balanceDefinitionId']; + } + + /** + * Sets balanceDefinitionId + * + * @param string|null $balanceDefinitionId Balance Definition Id + * + * @return $this + */ + public function setBalanceDefinitionId(?string $balanceDefinitionId): static + { + if (is_null($balanceDefinitionId)) { + throw new InvalidArgumentException('non-nullable balanceDefinitionId cannot be null'); + } + $this->container['balanceDefinitionId'] = $balanceDefinitionId; + + return $this; + } + + /** + * Gets value + * + * @return int|null + */ + public function getValue(): ?int + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param int|null $value Value + * + * @return $this + */ + public function setValue(?int $value): static + { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } + $this->container['value'] = $value; + + return $this; + } +} + + diff --git a/lib/Models/GetSubscriptionInfoResponseMembersInner.php b/lib/Models/GetSubscriptionInfoResponseMembersInner.php new file mode 100644 index 0000000..88610d7 --- /dev/null +++ b/lib/Models/GetSubscriptionInfoResponseMembersInner.php @@ -0,0 +1,275 @@ + + */ +class GetSubscriptionInfoResponseMembersInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getSubscriptionInfoResponse_members_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'memberContactId' => 'int', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'memberContactId' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'memberContactId' => false, + 'createdAt' => false, + 'updatedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'memberContactId' => 'memberContactId', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'memberContactId' => 'setMemberContactId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'memberContactId' => 'getMemberContactId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('memberContactId', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets memberContactId + * + * @return int|null + */ + public function getMemberContactId(): ?int + { + return $this->container['memberContactId']; + } + + /** + * Sets memberContactId + * + * @param int|null $memberContactId Member Contact Id + * + * @return $this + */ + public function setMemberContactId(?int $memberContactId): static + { + if (is_null($memberContactId)) { + throw new InvalidArgumentException('non-nullable memberContactId cannot be null'); + } + $this->container['memberContactId'] = $memberContactId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Member creation date + * + * @return $this + */ + public function setCreatedAt(?\DateTime $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt(): ?\DateTime + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Member last modification date + * + * @return $this + */ + public function setUpdatedAt(?\DateTime $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } +} + + diff --git a/lib/Models/GetSubscriptionInfoResponseRewardInner.php b/lib/Models/GetSubscriptionInfoResponseRewardInner.php new file mode 100644 index 0000000..1988107 --- /dev/null +++ b/lib/Models/GetSubscriptionInfoResponseRewardInner.php @@ -0,0 +1,377 @@ + + */ +class GetSubscriptionInfoResponseRewardInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getSubscriptionInfoResponse_reward_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'rewardId' => 'string', + 'loyaltyProgramId' => 'string', + 'contactId' => 'int', + 'code' => 'string', + 'expirationDate' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'uuid', + 'rewardId' => 'uuid', + 'loyaltyProgramId' => 'uuid', + 'contactId' => null, + 'code' => null, + 'expirationDate' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'rewardId' => false, + 'loyaltyProgramId' => false, + 'contactId' => false, + 'code' => false, + 'expirationDate' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'rewardId' => 'rewardId', + 'loyaltyProgramId' => 'loyaltyProgramId', + 'contactId' => 'contactId', + 'code' => 'code', + 'expirationDate' => 'expirationDate' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'rewardId' => 'setRewardId', + 'loyaltyProgramId' => 'setLoyaltyProgramId', + 'contactId' => 'setContactId', + 'code' => 'setCode', + 'expirationDate' => 'setExpirationDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'rewardId' => 'getRewardId', + 'loyaltyProgramId' => 'getLoyaltyProgramId', + 'contactId' => 'getContactId', + 'code' => 'getCode', + 'expirationDate' => 'getExpirationDate' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('rewardId', $data ?? [], null); + $this->setIfExists('loyaltyProgramId', $data ?? [], null); + $this->setIfExists('contactId', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Reward Id + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets rewardId + * + * @return string|null + */ + public function getRewardId(): ?string + { + return $this->container['rewardId']; + } + + /** + * Sets rewardId + * + * @param string|null $rewardId Reward Id + * + * @return $this + */ + public function setRewardId(?string $rewardId): static + { + if (is_null($rewardId)) { + throw new InvalidArgumentException('non-nullable rewardId cannot be null'); + } + $this->container['rewardId'] = $rewardId; + + return $this; + } + + /** + * Gets loyaltyProgramId + * + * @return string|null + */ + public function getLoyaltyProgramId(): ?string + { + return $this->container['loyaltyProgramId']; + } + + /** + * Sets loyaltyProgramId + * + * @param string|null $loyaltyProgramId Loyalty Program Id + * + * @return $this + */ + public function setLoyaltyProgramId(?string $loyaltyProgramId): static + { + if (is_null($loyaltyProgramId)) { + throw new InvalidArgumentException('non-nullable loyaltyProgramId cannot be null'); + } + $this->container['loyaltyProgramId'] = $loyaltyProgramId; + + return $this; + } + + /** + * Gets contactId + * + * @return int|null + */ + public function getContactId(): ?int + { + return $this->container['contactId']; + } + + /** + * Sets contactId + * + * @param int|null $contactId Contact Id + * + * @return $this + */ + public function setContactId(?int $contactId): static + { + if (is_null($contactId)) { + throw new InvalidArgumentException('non-nullable contactId cannot be null'); + } + $this->container['contactId'] = $contactId; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode(): ?string + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code Reward Code + * + * @return $this + */ + public function setCode(?string $code): static + { + if (is_null($code)) { + throw new InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate(): ?\DateTime + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Reward expiration date + * + * @return $this + */ + public function setExpirationDate(?\DateTime $expirationDate): static + { + if (is_null($expirationDate)) { + throw new InvalidArgumentException('non-nullable expirationDate cannot be null'); + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } +} + + diff --git a/lib/Models/GetSubscriptionInfoResponseTierInner.php b/lib/Models/GetSubscriptionInfoResponseTierInner.php new file mode 100644 index 0000000..425af3d --- /dev/null +++ b/lib/Models/GetSubscriptionInfoResponseTierInner.php @@ -0,0 +1,377 @@ + + */ +class GetSubscriptionInfoResponseTierInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getSubscriptionInfoResponse_tier_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'tierId' => 'string', + 'loyaltyProgramId' => 'string', + 'contactId' => 'int', + 'groupId' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'tierId' => 'uuid', + 'loyaltyProgramId' => 'uuid', + 'contactId' => null, + 'groupId' => 'uuid', + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'tierId' => false, + 'loyaltyProgramId' => false, + 'contactId' => false, + 'groupId' => false, + 'createdAt' => false, + 'updatedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'tierId' => 'tierId', + 'loyaltyProgramId' => 'loyaltyProgramId', + 'contactId' => 'contactId', + 'groupId' => 'groupId', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'tierId' => 'setTierId', + 'loyaltyProgramId' => 'setLoyaltyProgramId', + 'contactId' => 'setContactId', + 'groupId' => 'setGroupId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'tierId' => 'getTierId', + 'loyaltyProgramId' => 'getLoyaltyProgramId', + 'contactId' => 'getContactId', + 'groupId' => 'getGroupId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('tierId', $data ?? [], null); + $this->setIfExists('loyaltyProgramId', $data ?? [], null); + $this->setIfExists('contactId', $data ?? [], null); + $this->setIfExists('groupId', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets tierId + * + * @return string|null + */ + public function getTierId(): ?string + { + return $this->container['tierId']; + } + + /** + * Sets tierId + * + * @param string|null $tierId Tier Id + * + * @return $this + */ + public function setTierId(?string $tierId): static + { + if (is_null($tierId)) { + throw new InvalidArgumentException('non-nullable tierId cannot be null'); + } + $this->container['tierId'] = $tierId; + + return $this; + } + + /** + * Gets loyaltyProgramId + * + * @return string|null + */ + public function getLoyaltyProgramId(): ?string + { + return $this->container['loyaltyProgramId']; + } + + /** + * Sets loyaltyProgramId + * + * @param string|null $loyaltyProgramId Loyalty Program Id + * + * @return $this + */ + public function setLoyaltyProgramId(?string $loyaltyProgramId): static + { + if (is_null($loyaltyProgramId)) { + throw new InvalidArgumentException('non-nullable loyaltyProgramId cannot be null'); + } + $this->container['loyaltyProgramId'] = $loyaltyProgramId; + + return $this; + } + + /** + * Gets contactId + * + * @return int|null + */ + public function getContactId(): ?int + { + return $this->container['contactId']; + } + + /** + * Sets contactId + * + * @param int|null $contactId Contact Id + * + * @return $this + */ + public function setContactId(?int $contactId): static + { + if (is_null($contactId)) { + throw new InvalidArgumentException('non-nullable contactId cannot be null'); + } + $this->container['contactId'] = $contactId; + + return $this; + } + + /** + * Gets groupId + * + * @return string|null + */ + public function getGroupId(): ?string + { + return $this->container['groupId']; + } + + /** + * Sets groupId + * + * @param string|null $groupId Group Id + * + * @return $this + */ + public function setGroupId(?string $groupId): static + { + if (is_null($groupId)) { + throw new InvalidArgumentException('non-nullable groupId cannot be null'); + } + $this->container['groupId'] = $groupId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Tier creation date + * + * @return $this + */ + public function setCreatedAt(?\DateTime $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt(): ?\DateTime + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Tier last modification date + * + * @return $this + */ + public function setUpdatedAt(?\DateTime $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } +} + + diff --git a/lib/Models/GetSubscriptionMemberResponse.php b/lib/Models/GetSubscriptionMemberResponse.php new file mode 100644 index 0000000..89031d9 --- /dev/null +++ b/lib/Models/GetSubscriptionMemberResponse.php @@ -0,0 +1,411 @@ + + */ +class GetSubscriptionMemberResponse extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getSubscriptionMemberResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'organizationId' => 'int', + 'loyaltyProgramId' => 'string', + 'versionId' => 'int', + 'memberContactId' => '\Brevo\Client\Models\GetSubscriptionMemberResponseMemberContactIdInner[]', + 'loyaltySubscriptionId' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'organizationId' => null, + 'loyaltyProgramId' => 'uuid', + 'versionId' => null, + 'memberContactId' => null, + 'loyaltySubscriptionId' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'organizationId' => false, + 'loyaltyProgramId' => false, + 'versionId' => false, + 'memberContactId' => false, + 'loyaltySubscriptionId' => false, + 'createdAt' => false, + 'updatedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'organizationId' => 'organizationId', + 'loyaltyProgramId' => 'loyaltyProgramId', + 'versionId' => 'versionId', + 'memberContactId' => 'memberContactId', + 'loyaltySubscriptionId' => 'loyaltySubscriptionId', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'organizationId' => 'setOrganizationId', + 'loyaltyProgramId' => 'setLoyaltyProgramId', + 'versionId' => 'setVersionId', + 'memberContactId' => 'setMemberContactId', + 'loyaltySubscriptionId' => 'setLoyaltySubscriptionId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'organizationId' => 'getOrganizationId', + 'loyaltyProgramId' => 'getLoyaltyProgramId', + 'versionId' => 'getVersionId', + 'memberContactId' => 'getMemberContactId', + 'loyaltySubscriptionId' => 'getLoyaltySubscriptionId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('organizationId', $data ?? [], null); + $this->setIfExists('loyaltyProgramId', $data ?? [], null); + $this->setIfExists('versionId', $data ?? [], null); + $this->setIfExists('memberContactId', $data ?? [], null); + $this->setIfExists('loyaltySubscriptionId', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets organizationId + * + * @return int|null + */ + public function getOrganizationId(): ?int + { + return $this->container['organizationId']; + } + + /** + * Sets organizationId + * + * @param int|null $organizationId Organization Id + * + * @return $this + */ + public function setOrganizationId(?int $organizationId): static + { + if (is_null($organizationId)) { + throw new InvalidArgumentException('non-nullable organizationId cannot be null'); + } + $this->container['organizationId'] = $organizationId; + + return $this; + } + + /** + * Gets loyaltyProgramId + * + * @return string|null + */ + public function getLoyaltyProgramId(): ?string + { + return $this->container['loyaltyProgramId']; + } + + /** + * Sets loyaltyProgramId + * + * @param string|null $loyaltyProgramId Loyalty Program Id + * + * @return $this + */ + public function setLoyaltyProgramId(?string $loyaltyProgramId): static + { + if (is_null($loyaltyProgramId)) { + throw new InvalidArgumentException('non-nullable loyaltyProgramId cannot be null'); + } + $this->container['loyaltyProgramId'] = $loyaltyProgramId; + + return $this; + } + + /** + * Gets versionId + * + * @return int|null + */ + public function getVersionId(): ?int + { + return $this->container['versionId']; + } + + /** + * Sets versionId + * + * @param int|null $versionId Version Id + * + * @return $this + */ + public function setVersionId(?int $versionId): static + { + if (is_null($versionId)) { + throw new InvalidArgumentException('non-nullable versionId cannot be null'); + } + $this->container['versionId'] = $versionId; + + return $this; + } + + /** + * Gets memberContactId + * + * @return \Brevo\Client\Models\GetSubscriptionMemberResponseMemberContactIdInner[]|null + */ + public function getMemberContactId(): ?array + { + return $this->container['memberContactId']; + } + + /** + * Sets memberContactId + * + * @param \Brevo\Client\Models\GetSubscriptionMemberResponseMemberContactIdInner[]|null $memberContactId memberContactId + * + * @return $this + */ + public function setMemberContactId(?array $memberContactId): static + { + if (is_null($memberContactId)) { + throw new InvalidArgumentException('non-nullable memberContactId cannot be null'); + } + $this->container['memberContactId'] = $memberContactId; + + return $this; + } + + /** + * Gets loyaltySubscriptionId + * + * @return string|null + */ + public function getLoyaltySubscriptionId(): ?string + { + return $this->container['loyaltySubscriptionId']; + } + + /** + * Sets loyaltySubscriptionId + * + * @param string|null $loyaltySubscriptionId Client Reference + * + * @return $this + */ + public function setLoyaltySubscriptionId(?string $loyaltySubscriptionId): static + { + if (is_null($loyaltySubscriptionId)) { + throw new InvalidArgumentException('non-nullable loyaltySubscriptionId cannot be null'); + } + $this->container['loyaltySubscriptionId'] = $loyaltySubscriptionId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Subscription creation date + * + * @return $this + */ + public function setCreatedAt(?\DateTime $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt(): ?\DateTime + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Subscription last modification date + * + * @return $this + */ + public function setUpdatedAt(?\DateTime $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } +} + + diff --git a/lib/Models/GetSubscriptionMemberResponseMemberContactIdInner.php b/lib/Models/GetSubscriptionMemberResponseMemberContactIdInner.php new file mode 100644 index 0000000..99fe909 --- /dev/null +++ b/lib/Models/GetSubscriptionMemberResponseMemberContactIdInner.php @@ -0,0 +1,275 @@ + + */ +class GetSubscriptionMemberResponseMemberContactIdInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getSubscriptionMemberResponse_memberContactId_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'memberContactId' => 'string[]', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'memberContactId' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'memberContactId' => false, + 'createdAt' => false, + 'updatedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'memberContactId' => 'memberContactId', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'memberContactId' => 'setMemberContactId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'memberContactId' => 'getMemberContactId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('memberContactId', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets memberContactId + * + * @return string[]|null + */ + public function getMemberContactId(): ?array + { + return $this->container['memberContactId']; + } + + /** + * Sets memberContactId + * + * @param string[]|null $memberContactId memberContactId + * + * @return $this + */ + public function setMemberContactId(?array $memberContactId): static + { + if (is_null($memberContactId)) { + throw new InvalidArgumentException('non-nullable memberContactId cannot be null'); + } + $this->container['memberContactId'] = $memberContactId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt createdAt + * + * @return $this + */ + public function setCreatedAt(?\DateTime $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt(): ?\DateTime + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt updatedAt + * + * @return $this + */ + public function setUpdatedAt(?\DateTime $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } +} + + diff --git a/lib/Models/GetTransacAggregatedSmsReport.php b/lib/Models/GetTransacAggregatedSmsReport.php index c80d5d6..4f1aedf 100644 --- a/lib/Models/GetTransacAggregatedSmsReport.php +++ b/lib/Models/GetTransacAggregatedSmsReport.php @@ -2,61 +2,63 @@ /** * GetTransacAggregatedSmsReport * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetTransacAggregatedSmsReport Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetTransacAggregatedSmsReport implements ModelInterface, ArrayAccess +class GetTransacAggregatedSmsReport extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getTransacAggregatedSmsReport'; + protected static string $openAPIModelName = 'getTransacAggregatedSmsReport'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'range' => 'string', 'requests' => 'int', 'delivered' => 'int', @@ -66,15 +68,16 @@ class GetTransacAggregatedSmsReport implements ModelInterface, ArrayAccess 'unsubscribed' => 'int', 'replied' => 'int', 'accepted' => 'int', - 'rejected' => 'int' + 'rejected' => 'int', + 'skipped' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'range' => null, 'requests' => 'int64', 'delivered' => 'int64', @@ -84,36 +87,43 @@ class GetTransacAggregatedSmsReport implements ModelInterface, ArrayAccess 'unsubscribed' => 'int64', 'replied' => 'int64', 'accepted' => 'int64', - 'rejected' => 'int64' + 'rejected' => 'int64', + 'skipped' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'range' => false, + 'requests' => false, + 'delivered' => false, + 'hardBounces' => false, + 'softBounces' => false, + 'blocked' => false, + 'unsubscribed' => false, + 'replied' => false, + 'accepted' => false, + 'rejected' => false, + 'skipped' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'range' => 'range', 'requests' => 'requests', 'delivered' => 'delivered', @@ -123,15 +133,16 @@ public static function swaggerFormats() 'unsubscribed' => 'unsubscribed', 'replied' => 'replied', 'accepted' => 'accepted', - 'rejected' => 'rejected' + 'rejected' => 'rejected', + 'skipped' => 'skipped' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'range' => 'setRange', 'requests' => 'setRequests', 'delivered' => 'setDelivered', @@ -141,15 +152,16 @@ public static function swaggerFormats() 'unsubscribed' => 'setUnsubscribed', 'replied' => 'setReplied', 'accepted' => 'setAccepted', - 'rejected' => 'setRejected' + 'rejected' => 'setRejected', + 'skipped' => 'setSkipped' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'range' => 'getRange', 'requests' => 'getRequests', 'delivered' => 'getDelivered', @@ -159,16 +171,17 @@ public static function swaggerFormats() 'unsubscribed' => 'getUnsubscribed', 'replied' => 'getReplied', 'accepted' => 'getAccepted', - 'rejected' => 'getRejected' + 'rejected' => 'getRejected', + 'skipped' => 'getSkipped' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -176,9 +189,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -186,84 +199,59 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['range'] = isset($data['range']) ? $data['range'] : null; - $this->container['requests'] = isset($data['requests']) ? $data['requests'] : null; - $this->container['delivered'] = isset($data['delivered']) ? $data['delivered'] : null; - $this->container['hardBounces'] = isset($data['hardBounces']) ? $data['hardBounces'] : null; - $this->container['softBounces'] = isset($data['softBounces']) ? $data['softBounces'] : null; - $this->container['blocked'] = isset($data['blocked']) ? $data['blocked'] : null; - $this->container['unsubscribed'] = isset($data['unsubscribed']) ? $data['unsubscribed'] : null; - $this->container['replied'] = isset($data['replied']) ? $data['replied'] : null; - $this->container['accepted'] = isset($data['accepted']) ? $data['accepted'] : null; - $this->container['rejected'] = isset($data['rejected']) ? $data['rejected'] : null; + $this->setIfExists('range', $data ?? [], null); + $this->setIfExists('requests', $data ?? [], null); + $this->setIfExists('delivered', $data ?? [], null); + $this->setIfExists('hardBounces', $data ?? [], null); + $this->setIfExists('softBounces', $data ?? [], null); + $this->setIfExists('blocked', $data ?? [], null); + $this->setIfExists('unsubscribed', $data ?? [], null); + $this->setIfExists('replied', $data ?? [], null); + $this->setIfExists('accepted', $data ?? [], null); + $this->setIfExists('rejected', $data ?? [], null); + $this->setIfExists('skipped', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets range * - * @return string + * @return string|null */ - public function getRange() + public function getRange(): ?string { return $this->container['range']; } @@ -271,12 +259,15 @@ public function getRange() /** * Sets range * - * @param string $range Time frame of the report + * @param string|null $range Time frame of the report * * @return $this */ - public function setRange($range) + public function setRange(?string $range): static { + if (is_null($range)) { + throw new InvalidArgumentException('non-nullable range cannot be null'); + } $this->container['range'] = $range; return $this; @@ -285,9 +276,9 @@ public function setRange($range) /** * Gets requests * - * @return int + * @return int|null */ - public function getRequests() + public function getRequests(): ?int { return $this->container['requests']; } @@ -295,12 +286,15 @@ public function getRequests() /** * Sets requests * - * @param int $requests Number of requests for the timeframe + * @param int|null $requests Number of requests for the timeframe * * @return $this */ - public function setRequests($requests) + public function setRequests(?int $requests): static { + if (is_null($requests)) { + throw new InvalidArgumentException('non-nullable requests cannot be null'); + } $this->container['requests'] = $requests; return $this; @@ -309,9 +303,9 @@ public function setRequests($requests) /** * Gets delivered * - * @return int + * @return int|null */ - public function getDelivered() + public function getDelivered(): ?int { return $this->container['delivered']; } @@ -319,12 +313,15 @@ public function getDelivered() /** * Sets delivered * - * @param int $delivered Number of delivered SMS for the timeframe + * @param int|null $delivered Number of delivered SMS for the timeframe * * @return $this */ - public function setDelivered($delivered) + public function setDelivered(?int $delivered): static { + if (is_null($delivered)) { + throw new InvalidArgumentException('non-nullable delivered cannot be null'); + } $this->container['delivered'] = $delivered; return $this; @@ -333,9 +330,9 @@ public function setDelivered($delivered) /** * Gets hardBounces * - * @return int + * @return int|null */ - public function getHardBounces() + public function getHardBounces(): ?int { return $this->container['hardBounces']; } @@ -343,12 +340,15 @@ public function getHardBounces() /** * Sets hardBounces * - * @param int $hardBounces Number of hardbounces for the timeframe + * @param int|null $hardBounces Number of hardbounces for the timeframe * * @return $this */ - public function setHardBounces($hardBounces) + public function setHardBounces(?int $hardBounces): static { + if (is_null($hardBounces)) { + throw new InvalidArgumentException('non-nullable hardBounces cannot be null'); + } $this->container['hardBounces'] = $hardBounces; return $this; @@ -357,9 +357,9 @@ public function setHardBounces($hardBounces) /** * Gets softBounces * - * @return int + * @return int|null */ - public function getSoftBounces() + public function getSoftBounces(): ?int { return $this->container['softBounces']; } @@ -367,12 +367,15 @@ public function getSoftBounces() /** * Sets softBounces * - * @param int $softBounces Number of softbounces for the timeframe + * @param int|null $softBounces Number of softbounces for the timeframe * * @return $this */ - public function setSoftBounces($softBounces) + public function setSoftBounces(?int $softBounces): static { + if (is_null($softBounces)) { + throw new InvalidArgumentException('non-nullable softBounces cannot be null'); + } $this->container['softBounces'] = $softBounces; return $this; @@ -381,9 +384,9 @@ public function setSoftBounces($softBounces) /** * Gets blocked * - * @return int + * @return int|null */ - public function getBlocked() + public function getBlocked(): ?int { return $this->container['blocked']; } @@ -391,12 +394,15 @@ public function getBlocked() /** * Sets blocked * - * @param int $blocked Number of blocked contact for the timeframe + * @param int|null $blocked Number of blocked contact for the timeframe * * @return $this */ - public function setBlocked($blocked) + public function setBlocked(?int $blocked): static { + if (is_null($blocked)) { + throw new InvalidArgumentException('non-nullable blocked cannot be null'); + } $this->container['blocked'] = $blocked; return $this; @@ -405,9 +411,9 @@ public function setBlocked($blocked) /** * Gets unsubscribed * - * @return int + * @return int|null */ - public function getUnsubscribed() + public function getUnsubscribed(): ?int { return $this->container['unsubscribed']; } @@ -415,12 +421,15 @@ public function getUnsubscribed() /** * Sets unsubscribed * - * @param int $unsubscribed Number of unsubscription for the timeframe + * @param int|null $unsubscribed Number of unsubscription for the timeframe * * @return $this */ - public function setUnsubscribed($unsubscribed) + public function setUnsubscribed(?int $unsubscribed): static { + if (is_null($unsubscribed)) { + throw new InvalidArgumentException('non-nullable unsubscribed cannot be null'); + } $this->container['unsubscribed'] = $unsubscribed; return $this; @@ -429,9 +438,9 @@ public function setUnsubscribed($unsubscribed) /** * Gets replied * - * @return int + * @return int|null */ - public function getReplied() + public function getReplied(): ?int { return $this->container['replied']; } @@ -439,12 +448,15 @@ public function getReplied() /** * Sets replied * - * @param int $replied Number of answered SMS for the timeframe + * @param int|null $replied Number of answered SMS for the timeframe * * @return $this */ - public function setReplied($replied) + public function setReplied(?int $replied): static { + if (is_null($replied)) { + throw new InvalidArgumentException('non-nullable replied cannot be null'); + } $this->container['replied'] = $replied; return $this; @@ -453,9 +465,9 @@ public function setReplied($replied) /** * Gets accepted * - * @return int + * @return int|null */ - public function getAccepted() + public function getAccepted(): ?int { return $this->container['accepted']; } @@ -463,12 +475,15 @@ public function getAccepted() /** * Sets accepted * - * @param int $accepted Number of accepted for the timeframe + * @param int|null $accepted Number of accepted SMS for the timeframe * * @return $this */ - public function setAccepted($accepted) + public function setAccepted(?int $accepted): static { + if (is_null($accepted)) { + throw new InvalidArgumentException('non-nullable accepted cannot be null'); + } $this->container['accepted'] = $accepted; return $this; @@ -477,9 +492,9 @@ public function setAccepted($accepted) /** * Gets rejected * - * @return int + * @return int|null */ - public function getRejected() + public function getRejected(): ?int { return $this->container['rejected']; } @@ -487,88 +502,45 @@ public function getRejected() /** * Sets rejected * - * @param int $rejected Number of rejected for the timeframe + * @param int|null $rejected Number of rejected SMS for the timeframe * * @return $this */ - public function setRejected($rejected) + public function setRejected(?int $rejected): static { + if (is_null($rejected)) { + throw new InvalidArgumentException('non-nullable rejected cannot be null'); + } $this->container['rejected'] = $rejected; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } /** - * Gets offset. + * Gets skipped * - * @param integer $offset Offset - * - * @return mixed + * @return int|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function getSkipped(): ?int { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container['skipped']; } /** - * Sets value based on offset. + * Sets skipped * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $skipped Number of skipped SMS for the timeframe * - * @return void - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string + * @return $this */ - public function __toString() + public function setSkipped(?int $skipped): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($skipped)) { + throw new InvalidArgumentException('non-nullable skipped cannot be null'); } + $this->container['skipped'] = $skipped; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/GetTransacBlockedContacts.php b/lib/Models/GetTransacBlockedContacts.php index 8bde94e..cf6480b 100644 --- a/lib/Models/GetTransacBlockedContacts.php +++ b/lib/Models/GetTransacBlockedContacts.php @@ -2,102 +2,101 @@ /** * GetTransacBlockedContacts * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetTransacBlockedContacts Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetTransacBlockedContacts implements ModelInterface, ArrayAccess +class GetTransacBlockedContacts extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getTransacBlockedContacts'; + protected static string $openAPIModelName = 'getTransacBlockedContacts'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'count' => 'int', - 'contacts' => '\Brevo\Client\Models\GetTransacBlockedContactsContacts[]' + 'contacts' => '\Brevo\Client\Models\GetTransacBlockedContactsContactsInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'count' => 'int64', 'contacts' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'count' => false, + 'contacts' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'count' => 'count', 'contacts' => 'contacts' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'count' => 'setCount', 'contacts' => 'setContacts' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'count' => 'getCount', 'contacts' => 'getContacts' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +145,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['count'] = isset($data['count']) ? $data['count'] : null; - $this->container['contacts'] = isset($data['contacts']) ? $data['contacts'] : null; + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('contacts', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets count * - * @return int + * @return int|null */ - public function getCount() + public function getCount(): ?int { return $this->container['count']; } @@ -223,12 +196,15 @@ public function getCount() /** * Sets count * - * @param int $count Count of blocked or unsubscribed contact + * @param int|null $count Count of blocked or unsubscribed contact * * @return $this */ - public function setCount($count) + public function setCount(?int $count): static { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } $this->container['count'] = $count; return $this; @@ -237,9 +213,9 @@ public function setCount($count) /** * Gets contacts * - * @return \Brevo\Client\Models\GetTransacBlockedContactsContacts[] + * @return \Brevo\Client\Models\GetTransacBlockedContactsContactsInner[]|null */ - public function getContacts() + public function getContacts(): ?array { return $this->container['contacts']; } @@ -247,89 +223,19 @@ public function getContacts() /** * Sets contacts * - * @param \Brevo\Client\Models\GetTransacBlockedContactsContacts[] $contacts contacts + * @param \Brevo\Client\Models\GetTransacBlockedContactsContactsInner[]|null $contacts contacts * * @return $this */ - public function setContacts($contacts) + public function setContacts(?array $contacts): static { + if (is_null($contacts)) { + throw new InvalidArgumentException('non-nullable contacts cannot be null'); + } $this->container['contacts'] = $contacts; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetTransacBlockedContactsContacts.php b/lib/Models/GetTransacBlockedContactsContactsInner.php similarity index 50% rename from lib/Models/GetTransacBlockedContactsContacts.php rename to lib/Models/GetTransacBlockedContactsContactsInner.php index d8312b4..06a7588 100644 --- a/lib/Models/GetTransacBlockedContactsContacts.php +++ b/lib/Models/GetTransacBlockedContactsContactsInner.php @@ -1,74 +1,76 @@ */ -class GetTransacBlockedContactsContacts implements ModelInterface, ArrayAccess +class GetTransacBlockedContactsContactsInner extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getTransacBlockedContacts_contacts'; + protected static string $openAPIModelName = 'getTransacBlockedContacts_contacts_inner'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'email' => 'string', 'senderEmail' => 'string', - 'reason' => '\Brevo\Client\Models\GetTransacBlockedContactsReason', + 'reason' => '\Brevo\Client\Models\GetTransacBlockedContactsContactsInnerReason', 'blockedAt' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'email' => 'email', 'senderEmail' => 'email', 'reason' => null, @@ -76,32 +78,31 @@ class GetTransacBlockedContactsContacts implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'senderEmail' => false, + 'reason' => false, + 'blockedAt' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'email' => 'email', 'senderEmail' => 'senderEmail', 'reason' => 'reason', @@ -111,9 +112,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'email' => 'setEmail', 'senderEmail' => 'setSenderEmail', 'reason' => 'setReason', @@ -123,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'email' => 'getEmail', 'senderEmail' => 'getSenderEmail', 'reason' => 'getReason', @@ -136,9 +137,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +147,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,54 +157,40 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['senderEmail'] = isset($data['senderEmail']) ? $data['senderEmail'] : null; - $this->container['reason'] = isset($data['reason']) ? $data['reason'] : null; - $this->container['blockedAt'] = isset($data['blockedAt']) ? $data['blockedAt'] : null; + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('senderEmail', $data ?? [], null); + $this->setIfExists('reason', $data ?? [], null); + $this->setIfExists('blockedAt', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -222,24 +209,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets email * * @return string */ - public function getEmail() + public function getEmail(): string { return $this->container['email']; } @@ -251,8 +226,11 @@ public function getEmail() * * @return $this */ - public function setEmail($email) + public function setEmail(string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -263,7 +241,7 @@ public function setEmail($email) * * @return string */ - public function getSenderEmail() + public function getSenderEmail(): string { return $this->container['senderEmail']; } @@ -275,8 +253,11 @@ public function getSenderEmail() * * @return $this */ - public function setSenderEmail($senderEmail) + public function setSenderEmail(string $senderEmail): static { + if (is_null($senderEmail)) { + throw new InvalidArgumentException('non-nullable senderEmail cannot be null'); + } $this->container['senderEmail'] = $senderEmail; return $this; @@ -285,9 +266,9 @@ public function setSenderEmail($senderEmail) /** * Gets reason * - * @return \Brevo\Client\Models\GetTransacBlockedContactsReason + * @return \Brevo\Client\Models\GetTransacBlockedContactsContactsInnerReason */ - public function getReason() + public function getReason(): \Brevo\Client\Models\GetTransacBlockedContactsContactsInnerReason { return $this->container['reason']; } @@ -295,12 +276,15 @@ public function getReason() /** * Sets reason * - * @param \Brevo\Client\Models\GetTransacBlockedContactsReason $reason reason + * @param \Brevo\Client\Models\GetTransacBlockedContactsContactsInnerReason $reason reason * * @return $this */ - public function setReason($reason) + public function setReason(\Brevo\Client\Models\GetTransacBlockedContactsContactsInnerReason $reason): static { + if (is_null($reason)) { + throw new InvalidArgumentException('non-nullable reason cannot be null'); + } $this->container['reason'] = $reason; return $this; @@ -311,7 +295,7 @@ public function setReason($reason) * * @return string */ - public function getBlockedAt() + public function getBlockedAt(): string { return $this->container['blockedAt']; } @@ -323,85 +307,15 @@ public function getBlockedAt() * * @return $this */ - public function setBlockedAt($blockedAt) + public function setBlockedAt(string $blockedAt): static { + if (is_null($blockedAt)) { + throw new InvalidArgumentException('non-nullable blockedAt cannot be null'); + } $this->container['blockedAt'] = $blockedAt; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetTransacBlockedContactsContactsInnerReason.php b/lib/Models/GetTransacBlockedContactsContactsInnerReason.php new file mode 100644 index 0000000..64ab073 --- /dev/null +++ b/lib/Models/GetTransacBlockedContactsContactsInnerReason.php @@ -0,0 +1,284 @@ + + */ +class GetTransacBlockedContactsContactsInnerReason extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getTransacBlockedContacts_contacts_inner_reason'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'code' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'code' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'code' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'code' => 'code', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'code' => 'setCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'code' => 'getCode', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const CODE_UNSUBSCRIBED_VIA_MA = 'unsubscribedViaMA'; + public const CODE_UNSUBSCRIBED_VIA_EMAIL = 'unsubscribedViaEmail'; + public const CODE_ADMIN_BLOCKED = 'adminBlocked'; + public const CODE_UNSUBSCRIBED_VIA_API = 'unsubscribedViaApi'; + public const CODE_HARD_BOUNCE = 'hardBounce'; + public const CODE_CONTACT_FLAGGED_AS_SPAM = 'contactFlaggedAsSpam'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCodeAllowableValues() + { + return [ + self::CODE_UNSUBSCRIBED_VIA_MA, + self::CODE_UNSUBSCRIBED_VIA_EMAIL, + self::CODE_ADMIN_BLOCKED, + self::CODE_UNSUBSCRIBED_VIA_API, + self::CODE_HARD_BOUNCE, + self::CODE_CONTACT_FLAGGED_AS_SPAM, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = $this->getCodeAllowableValues(); + if (!is_null($this->container['code']) && !in_array($this->container['code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'code', must be one of '%s'", + $this->container['code'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode(): ?string + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code Reason code for blocking / unsubscribing (This code is safe for comparison) + * + * @return $this + */ + public function setCode(?string $code): static + { + if (is_null($code)) { + throw new InvalidArgumentException('non-nullable code cannot be null'); + } + $allowedValues = $this->getCodeAllowableValues(); + if (!in_array($code, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'code', must be one of '%s'", + $code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage(): ?string + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message Reason for blocking / unsubscribing (This string is not safe for comparison) + * + * @return $this + */ + public function setMessage(?string $message): static + { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } +} + + diff --git a/lib/Models/GetTransacBlockedContactsReason.php b/lib/Models/GetTransacBlockedContactsReason.php deleted file mode 100644 index d1137b7..0000000 --- a/lib/Models/GetTransacBlockedContactsReason.php +++ /dev/null @@ -1,376 +0,0 @@ - 'string', - 'message' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'code' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'code' => 'code', - 'message' => 'message' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'code' => 'setCode', - 'message' => 'setMessage' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'code' => 'getCode', - '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_UNSUBSCRIBED_VIA_MA = 'unsubscribedViaMA'; - const CODE_UNSUBSCRIBED_VIA_EMAIL = 'unsubscribedViaEmail'; - const CODE_ADMIN_BLOCKED = 'adminBlocked'; - const CODE_UNSUBSCRIBED_VIA_API = 'unsubscribedViaApi'; - const CODE_HARD_BOUNCE = 'hardBounce'; - const CODE_CONTACT_FLAGGED_AS_SPAM = 'contactFlaggedAsSpam'; - - - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getCodeAllowableValues() - { - return [ - self::CODE_UNSUBSCRIBED_VIA_MA, - self::CODE_UNSUBSCRIBED_VIA_EMAIL, - self::CODE_ADMIN_BLOCKED, - self::CODE_UNSUBSCRIBED_VIA_API, - self::CODE_HARD_BOUNCE, - self::CODE_CONTACT_FLAGGED_AS_SPAM, - ]; - } - - - /** - * 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['code'] = isset($data['code']) ? $data['code'] : null; - $this->container['message'] = isset($data['message']) ? $data['message'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - $allowedValues = $this->getCodeAllowableValues(); - if (!is_null($this->container['code']) && !in_array($this->container['code'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value for 'code', must be one of '%s'", - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets code - * - * @return string - */ - public function getCode() - { - return $this->container['code']; - } - - /** - * Sets code - * - * @param string $code Reason code for blocking / unsubscribing (This code is safe for comparison) - * - * @return $this - */ - public function setCode($code) - { - $allowedValues = $this->getCodeAllowableValues(); - if (!is_null($code) && !in_array($code, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'code', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['code'] = $code; - - return $this; - } - - /** - * Gets message - * - * @return string - */ - public function getMessage() - { - return $this->container['message']; - } - - /** - * Sets message - * - * @param string $message Reason for blocking / unsubscribing (This string is not safe for comparison) - * - * @return $this - */ - public function setMessage($message) - { - $this->container['message'] = $message; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetTransacEmailContent.php b/lib/Models/GetTransacEmailContent.php index 9d06c4a..bf8fc08 100644 --- a/lib/Models/GetTransacEmailContent.php +++ b/lib/Models/GetTransacEmailContent.php @@ -2,158 +2,162 @@ /** * GetTransacEmailContent * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetTransacEmailContent Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetTransacEmailContent implements ModelInterface, ArrayAccess +class GetTransacEmailContent extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getTransacEmailContent'; + protected static string $openAPIModelName = 'getTransacEmailContent'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'email' => 'string', 'subject' => 'string', - 'templateId' => 'int', 'date' => 'string', - 'events' => '\Brevo\Client\Models\GetTransacEmailContentEvents[]', + 'events' => '\Brevo\Client\Models\GetTransacEmailContentEventsInner[]', 'body' => 'string', - 'attachmentCount' => 'int' + 'attachmentCount' => 'int', + 'templateId' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'email' => 'email', 'subject' => null, - 'templateId' => 'int64', 'date' => null, 'events' => null, 'body' => null, - 'attachmentCount' => 'int64' + 'attachmentCount' => 'int64', + 'templateId' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'subject' => false, + 'date' => false, + 'events' => false, + 'body' => false, + 'attachmentCount' => false, + 'templateId' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'email' => 'email', 'subject' => 'subject', - 'templateId' => 'templateId', 'date' => 'date', 'events' => 'events', 'body' => 'body', - 'attachmentCount' => 'attachmentCount' + 'attachmentCount' => 'attachmentCount', + 'templateId' => 'templateId' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'email' => 'setEmail', 'subject' => 'setSubject', - 'templateId' => 'setTemplateId', 'date' => 'setDate', 'events' => 'setEvents', 'body' => 'setBody', - 'attachmentCount' => 'setAttachmentCount' + 'attachmentCount' => 'setAttachmentCount', + 'templateId' => 'setTemplateId' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'email' => 'getEmail', 'subject' => 'getSubject', - 'templateId' => 'getTemplateId', 'date' => 'getDate', 'events' => 'getEvents', 'body' => 'getBody', - 'attachmentCount' => 'getAttachmentCount' + 'attachmentCount' => 'getAttachmentCount', + 'templateId' => 'getTemplateId' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -161,9 +165,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -171,57 +175,43 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['subject'] = isset($data['subject']) ? $data['subject'] : null; - $this->container['templateId'] = isset($data['templateId']) ? $data['templateId'] : null; - $this->container['date'] = isset($data['date']) ? $data['date'] : null; - $this->container['events'] = isset($data['events']) ? $data['events'] : null; - $this->container['body'] = isset($data['body']) ? $data['body'] : null; - $this->container['attachmentCount'] = isset($data['attachmentCount']) ? $data['attachmentCount'] : null; + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('events', $data ?? [], null); + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('attachmentCount', $data ?? [], null); + $this->setIfExists('templateId', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -246,24 +236,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets email * * @return string */ - public function getEmail() + public function getEmail(): string { return $this->container['email']; } @@ -275,8 +253,11 @@ public function getEmail() * * @return $this */ - public function setEmail($email) + public function setEmail(string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -287,7 +268,7 @@ public function setEmail($email) * * @return string */ - public function getSubject() + public function getSubject(): string { return $this->container['subject']; } @@ -299,43 +280,22 @@ public function getSubject() * * @return $this */ - public function setSubject($subject) + public function setSubject(string $subject): static { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } $this->container['subject'] = $subject; return $this; } - /** - * Gets templateId - * - * @return int - */ - public function getTemplateId() - { - return $this->container['templateId']; - } - - /** - * Sets templateId - * - * @param int $templateId Id of the template - * - * @return $this - */ - public function setTemplateId($templateId) - { - $this->container['templateId'] = $templateId; - - return $this; - } - /** * Gets date * * @return string */ - public function getDate() + public function getDate(): string { return $this->container['date']; } @@ -347,8 +307,11 @@ public function getDate() * * @return $this */ - public function setDate($date) + public function setDate(string $date): static { + if (is_null($date)) { + throw new InvalidArgumentException('non-nullable date cannot be null'); + } $this->container['date'] = $date; return $this; @@ -357,9 +320,9 @@ public function setDate($date) /** * Gets events * - * @return \Brevo\Client\Models\GetTransacEmailContentEvents[] + * @return \Brevo\Client\Models\GetTransacEmailContentEventsInner[] */ - public function getEvents() + public function getEvents(): array { return $this->container['events']; } @@ -367,12 +330,15 @@ public function getEvents() /** * Sets events * - * @param \Brevo\Client\Models\GetTransacEmailContentEvents[] $events Series of events which occurred on the transactional email + * @param \Brevo\Client\Models\GetTransacEmailContentEventsInner[] $events Series of events which occurred on the transactional email * * @return $this */ - public function setEvents($events) + public function setEvents(array $events): static { + if (is_null($events)) { + throw new InvalidArgumentException('non-nullable events cannot be null'); + } $this->container['events'] = $events; return $this; @@ -383,7 +349,7 @@ public function setEvents($events) * * @return string */ - public function getBody() + public function getBody(): string { return $this->container['body']; } @@ -395,8 +361,11 @@ public function getBody() * * @return $this */ - public function setBody($body) + public function setBody(string $body): static { + if (is_null($body)) { + throw new InvalidArgumentException('non-nullable body cannot be null'); + } $this->container['body'] = $body; return $this; @@ -407,7 +376,7 @@ public function setBody($body) * * @return int */ - public function getAttachmentCount() + public function getAttachmentCount(): int { return $this->container['attachmentCount']; } @@ -419,84 +388,41 @@ public function getAttachmentCount() * * @return $this */ - public function setAttachmentCount($attachmentCount) + public function setAttachmentCount(int $attachmentCount): static { + if (is_null($attachmentCount)) { + throw new InvalidArgumentException('non-nullable attachmentCount cannot be null'); + } $this->container['attachmentCount'] = $attachmentCount; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 + * Gets templateId * - * @return void + * @return int|null */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function getTemplateId(): ?int { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } + return $this->container['templateId']; } /** - * Unsets offset. - * - * @param integer $offset Offset + * Sets templateId * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object + * @param int|null $templateId Id of the template * - * @return string + * @return $this */ - public function __toString() + public function setTemplateId(?int $templateId): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($templateId)) { + throw new InvalidArgumentException('non-nullable templateId cannot be null'); } + $this->container['templateId'] = $templateId; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/GetTransacEmailContentEvents.php b/lib/Models/GetTransacEmailContentEvents.php deleted file mode 100644 index 21d96d9..0000000 --- a/lib/Models/GetTransacEmailContentEvents.php +++ /dev/null @@ -1,341 +0,0 @@ - 'string', - 'time' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'name' => null, - 'time' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'name' => 'name', - 'time' => 'time' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'name' => 'setName', - 'time' => 'setTime' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'name' => 'getName', - 'time' => 'getTime' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['time'] = isset($data['time']) ? $data['time'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['time'] === null) { - $invalidProperties[] = "'time' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Name of the event that occurred on the sent email - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets time - * - * @return string - */ - public function getTime() - { - return $this->container['time']; - } - - /** - * Sets time - * - * @param string $time Time at which the event occurred - * - * @return $this - */ - public function setTime($time) - { - $this->container['time'] = $time; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetTransacEmailContentEventsInner.php b/lib/Models/GetTransacEmailContentEventsInner.php new file mode 100644 index 0000000..1d94538 --- /dev/null +++ b/lib/Models/GetTransacEmailContentEventsInner.php @@ -0,0 +1,247 @@ + + */ +class GetTransacEmailContentEventsInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getTransacEmailContent_events_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'time' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'time' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'time' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'time' => 'time' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'time' => 'setTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'time' => 'getTime' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('time', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['time'] === null) { + $invalidProperties[] = "'time' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Name of the event that occurred on the sent email + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets time + * + * @return string + */ + public function getTime(): string + { + return $this->container['time']; + } + + /** + * Sets time + * + * @param string $time Time at which the event occurred + * + * @return $this + */ + public function setTime(string $time): static + { + if (is_null($time)) { + throw new InvalidArgumentException('non-nullable time cannot be null'); + } + $this->container['time'] = $time; + + return $this; + } +} + + diff --git a/lib/Models/GetTransacEmailsList.php b/lib/Models/GetTransacEmailsList.php index 218e746..a5825f7 100644 --- a/lib/Models/GetTransacEmailsList.php +++ b/lib/Models/GetTransacEmailsList.php @@ -2,102 +2,101 @@ /** * GetTransacEmailsList * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetTransacEmailsList Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetTransacEmailsList implements ModelInterface, ArrayAccess +class GetTransacEmailsList extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getTransacEmailsList'; + protected static string $openAPIModelName = 'getTransacEmailsList'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'count' => 'int', - 'transactionalEmails' => '\Brevo\Client\Models\GetTransacEmailsListTransactionalEmails[]' + 'transactionalEmails' => '\Brevo\Client\Models\GetTransacEmailsListTransactionalEmailsInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'count' => 'int64', 'transactionalEmails' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'count' => false, + 'transactionalEmails' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'count' => 'count', 'transactionalEmails' => 'transactionalEmails' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'count' => 'setCount', 'transactionalEmails' => 'setTransactionalEmails' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'count' => 'getCount', 'transactionalEmails' => 'getTransactionalEmails' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +145,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['count'] = isset($data['count']) ? $data['count'] : null; - $this->container['transactionalEmails'] = isset($data['transactionalEmails']) ? $data['transactionalEmails'] : null; + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('transactionalEmails', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets count * - * @return int + * @return int|null */ - public function getCount() + public function getCount(): ?int { return $this->container['count']; } @@ -223,12 +196,15 @@ public function getCount() /** * Sets count * - * @param int $count Total number of transactional emails available on your account according to the passed filter + * @param int|null $count Total number of transactional emails available on your account according to the passed filter * * @return $this */ - public function setCount($count) + public function setCount(?int $count): static { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } $this->container['count'] = $count; return $this; @@ -237,9 +213,9 @@ public function setCount($count) /** * Gets transactionalEmails * - * @return \Brevo\Client\Models\GetTransacEmailsListTransactionalEmails[] + * @return \Brevo\Client\Models\GetTransacEmailsListTransactionalEmailsInner[]|null */ - public function getTransactionalEmails() + public function getTransactionalEmails(): ?array { return $this->container['transactionalEmails']; } @@ -247,89 +223,19 @@ public function getTransactionalEmails() /** * Sets transactionalEmails * - * @param \Brevo\Client\Models\GetTransacEmailsListTransactionalEmails[] $transactionalEmails transactionalEmails + * @param \Brevo\Client\Models\GetTransacEmailsListTransactionalEmailsInner[]|null $transactionalEmails transactionalEmails * * @return $this */ - public function setTransactionalEmails($transactionalEmails) + public function setTransactionalEmails(?array $transactionalEmails): static { + if (is_null($transactionalEmails)) { + throw new InvalidArgumentException('non-nullable transactionalEmails cannot be null'); + } $this->container['transactionalEmails'] = $transactionalEmails; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetTransacEmailsListTransactionalEmails.php b/lib/Models/GetTransacEmailsListTransactionalEmailsInner.php similarity index 54% rename from lib/Models/GetTransacEmailsListTransactionalEmails.php rename to lib/Models/GetTransacEmailsListTransactionalEmailsInner.php index bbb5141..f35ef92 100644 --- a/lib/Models/GetTransacEmailsListTransactionalEmails.php +++ b/lib/Models/GetTransacEmailsListTransactionalEmailsInner.php @@ -1,68 +1,70 @@ */ -class GetTransacEmailsListTransactionalEmails implements ModelInterface, ArrayAccess +class GetTransacEmailsListTransactionalEmailsInner extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getTransacEmailsList_transactionalEmails'; + protected static string $openAPIModelName = 'getTransacEmailsList_transactionalEmails_inner'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'email' => 'string', 'subject' => 'string', - 'templateId' => 'int', 'messageId' => 'string', 'uuid' => 'string', 'date' => 'string', + 'templateId' => 'int', 'from' => 'string', 'tags' => 'string[]' ]; @@ -70,52 +72,55 @@ class GetTransacEmailsListTransactionalEmails implements ModelInterface, ArrayAc /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'email' => 'email', 'subject' => null, - 'templateId' => 'int64', 'messageId' => null, 'uuid' => null, 'date' => null, + 'templateId' => 'int64', 'from' => 'email', 'tags' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'subject' => false, + 'messageId' => false, + 'uuid' => false, + 'date' => false, + 'templateId' => false, + 'from' => false, + 'tags' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'email' => 'email', 'subject' => 'subject', - 'templateId' => 'templateId', 'messageId' => 'messageId', 'uuid' => 'uuid', 'date' => 'date', + 'templateId' => 'templateId', 'from' => 'from', 'tags' => 'tags' ]; @@ -123,15 +128,15 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'email' => 'setEmail', 'subject' => 'setSubject', - 'templateId' => 'setTemplateId', 'messageId' => 'setMessageId', 'uuid' => 'setUuid', 'date' => 'setDate', + 'templateId' => 'setTemplateId', 'from' => 'setFrom', 'tags' => 'setTags' ]; @@ -139,15 +144,15 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'email' => 'getEmail', 'subject' => 'getSubject', - 'templateId' => 'getTemplateId', 'messageId' => 'getMessageId', 'uuid' => 'getUuid', 'date' => 'getDate', + 'templateId' => 'getTemplateId', 'from' => 'getFrom', 'tags' => 'getTags' ]; @@ -156,9 +161,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -166,9 +171,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -176,58 +181,44 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['subject'] = isset($data['subject']) ? $data['subject'] : null; - $this->container['templateId'] = isset($data['templateId']) ? $data['templateId'] : null; - $this->container['messageId'] = isset($data['messageId']) ? $data['messageId'] : null; - $this->container['uuid'] = isset($data['uuid']) ? $data['uuid'] : null; - $this->container['date'] = isset($data['date']) ? $data['date'] : null; - $this->container['from'] = isset($data['from']) ? $data['from'] : null; - $this->container['tags'] = isset($data['tags']) ? $data['tags'] : null; + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('messageId', $data ?? [], null); + $this->setIfExists('uuid', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('templateId', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -249,24 +240,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets email * * @return string */ - public function getEmail() + public function getEmail(): string { return $this->container['email']; } @@ -278,8 +257,11 @@ public function getEmail() * * @return $this */ - public function setEmail($email) + public function setEmail(string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -290,7 +272,7 @@ public function setEmail($email) * * @return string */ - public function getSubject() + public function getSubject(): string { return $this->container['subject']; } @@ -302,43 +284,22 @@ public function getSubject() * * @return $this */ - public function setSubject($subject) + public function setSubject(string $subject): static { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } $this->container['subject'] = $subject; return $this; } - /** - * Gets templateId - * - * @return int - */ - public function getTemplateId() - { - return $this->container['templateId']; - } - - /** - * Sets templateId - * - * @param int $templateId Id of the template - * - * @return $this - */ - public function setTemplateId($templateId) - { - $this->container['templateId'] = $templateId; - - return $this; - } - /** * Gets messageId * * @return string */ - public function getMessageId() + public function getMessageId(): string { return $this->container['messageId']; } @@ -350,8 +311,11 @@ public function getMessageId() * * @return $this */ - public function setMessageId($messageId) + public function setMessageId(string $messageId): static { + if (is_null($messageId)) { + throw new InvalidArgumentException('non-nullable messageId cannot be null'); + } $this->container['messageId'] = $messageId; return $this; @@ -362,7 +326,7 @@ public function setMessageId($messageId) * * @return string */ - public function getUuid() + public function getUuid(): string { return $this->container['uuid']; } @@ -374,8 +338,11 @@ public function getUuid() * * @return $this */ - public function setUuid($uuid) + public function setUuid(string $uuid): static { + if (is_null($uuid)) { + throw new InvalidArgumentException('non-nullable uuid cannot be null'); + } $this->container['uuid'] = $uuid; return $this; @@ -386,7 +353,7 @@ public function setUuid($uuid) * * @return string */ - public function getDate() + public function getDate(): string { return $this->container['date']; } @@ -398,132 +365,95 @@ public function getDate() * * @return $this */ - public function setDate($date) + public function setDate(string $date): static { + if (is_null($date)) { + throw new InvalidArgumentException('non-nullable date cannot be null'); + } $this->container['date'] = $date; return $this; } /** - * Gets from + * Gets templateId * - * @return string + * @return int|null */ - public function getFrom() + public function getTemplateId(): ?int { - return $this->container['from']; + return $this->container['templateId']; } /** - * Sets from + * Sets templateId * - * @param string $from Email address of the sender from which the email was sent + * @param int|null $templateId Id of the template * * @return $this */ - public function setFrom($from) + public function setTemplateId(?int $templateId): static { - $this->container['from'] = $from; + if (is_null($templateId)) { + throw new InvalidArgumentException('non-nullable templateId cannot be null'); + } + $this->container['templateId'] = $templateId; return $this; } /** - * Gets tags + * Gets from * - * @return string[] + * @return string|null */ - public function getTags() + public function getFrom(): ?string { - return $this->container['tags']; + return $this->container['from']; } /** - * Sets tags + * Sets from * - * @param string[] $tags Tags used for your email + * @param string|null $from Email address of the sender from which the email was sent * * @return $this */ - public function setTags($tags) + public function setFrom(?string $from): static { - $this->container['tags'] = $tags; + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 + * Gets tags * - * @return void + * @return string[]|null */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function getTags(): ?array { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } + return $this->container['tags']; } /** - * Unsets offset. + * Sets tags * - * @param integer $offset Offset + * @param string[]|null $tags Tags used for your email * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string + * @return $this */ - public function __toString() + public function setTags(?array $tags): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($tags)) { + throw new InvalidArgumentException('non-nullable tags cannot be null'); } + $this->container['tags'] = $tags; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/GetTransacSmsReport.php b/lib/Models/GetTransacSmsReport.php index 6d04640..5444ad9 100644 --- a/lib/Models/GetTransacSmsReport.php +++ b/lib/Models/GetTransacSmsReport.php @@ -2,118 +2,116 @@ /** * GetTransacSmsReport * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetTransacSmsReport Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetTransacSmsReport implements ModelInterface, ArrayAccess +class GetTransacSmsReport extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getTransacSmsReport'; + protected static string $openAPIModelName = 'getTransacSmsReport'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'reports' => '\Brevo\Client\Models\GetTransacSmsReportReports[]' + protected static array $openAPITypes = [ + 'reports' => '\Brevo\Client\Models\GetTransacSmsReportReportsInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'reports' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'reports' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'reports' => 'reports' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'reports' => 'setReports' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'reports' => 'getReports' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,75 +139,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['reports'] = isset($data['reports']) ? $data['reports'] : null; + $this->setIfExists('reports', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets reports * - * @return \Brevo\Client\Models\GetTransacSmsReportReports[] + * @return \Brevo\Client\Models\GetTransacSmsReportReportsInner[]|null */ - public function getReports() + public function getReports(): ?array { return $this->container['reports']; } @@ -217,89 +189,19 @@ public function getReports() /** * Sets reports * - * @param \Brevo\Client\Models\GetTransacSmsReportReports[] $reports reports + * @param \Brevo\Client\Models\GetTransacSmsReportReportsInner[]|null $reports reports * * @return $this */ - public function setReports($reports) + public function setReports(?array $reports): static { + if (is_null($reports)) { + throw new InvalidArgumentException('non-nullable reports cannot be null'); + } $this->container['reports'] = $reports; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetTransacSmsReportReports.php b/lib/Models/GetTransacSmsReportReports.php deleted file mode 100644 index 081204b..0000000 --- a/lib/Models/GetTransacSmsReportReports.php +++ /dev/null @@ -1,575 +0,0 @@ - '\DateTime', - 'requests' => 'int', - 'delivered' => 'int', - 'hardBounces' => 'int', - 'softBounces' => 'int', - 'blocked' => 'int', - 'unsubscribed' => 'int', - 'replied' => 'int', - 'accepted' => 'int', - 'rejected' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'date' => 'date', - 'requests' => 'int64', - 'delivered' => 'int64', - 'hardBounces' => 'int64', - 'softBounces' => 'int64', - 'blocked' => 'int64', - 'unsubscribed' => 'int64', - 'replied' => 'int64', - 'accepted' => 'int64', - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'date' => 'date', - 'requests' => 'requests', - 'delivered' => 'delivered', - 'hardBounces' => 'hardBounces', - 'softBounces' => 'softBounces', - 'blocked' => 'blocked', - 'unsubscribed' => 'unsubscribed', - 'replied' => 'replied', - 'accepted' => 'accepted', - 'rejected' => 'rejected' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'date' => 'setDate', - 'requests' => 'setRequests', - 'delivered' => 'setDelivered', - 'hardBounces' => 'setHardBounces', - 'softBounces' => 'setSoftBounces', - 'blocked' => 'setBlocked', - 'unsubscribed' => 'setUnsubscribed', - 'replied' => 'setReplied', - 'accepted' => 'setAccepted', - 'rejected' => 'setRejected' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'date' => 'getDate', - 'requests' => 'getRequests', - 'delivered' => 'getDelivered', - 'hardBounces' => 'getHardBounces', - 'softBounces' => 'getSoftBounces', - 'blocked' => 'getBlocked', - 'unsubscribed' => 'getUnsubscribed', - 'replied' => 'getReplied', - 'accepted' => 'getAccepted', - '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 - */ - public function __construct(array $data = null) - { - $this->container['date'] = isset($data['date']) ? $data['date'] : null; - $this->container['requests'] = isset($data['requests']) ? $data['requests'] : null; - $this->container['delivered'] = isset($data['delivered']) ? $data['delivered'] : null; - $this->container['hardBounces'] = isset($data['hardBounces']) ? $data['hardBounces'] : null; - $this->container['softBounces'] = isset($data['softBounces']) ? $data['softBounces'] : null; - $this->container['blocked'] = isset($data['blocked']) ? $data['blocked'] : null; - $this->container['unsubscribed'] = isset($data['unsubscribed']) ? $data['unsubscribed'] : null; - $this->container['replied'] = isset($data['replied']) ? $data['replied'] : null; - $this->container['accepted'] = isset($data['accepted']) ? $data['accepted'] : null; - $this->container['rejected'] = isset($data['rejected']) ? $data['rejected'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets date - * - * @return \DateTime - */ - public function getDate() - { - return $this->container['date']; - } - - /** - * Sets date - * - * @param \DateTime $date Date for which statistics are retrieved - * - * @return $this - */ - public function setDate($date) - { - $this->container['date'] = $date; - - return $this; - } - - /** - * Gets requests - * - * @return int - */ - public function getRequests() - { - return $this->container['requests']; - } - - /** - * Sets requests - * - * @param int $requests Number of requests for the date - * - * @return $this - */ - public function setRequests($requests) - { - $this->container['requests'] = $requests; - - return $this; - } - - /** - * Gets delivered - * - * @return int - */ - public function getDelivered() - { - return $this->container['delivered']; - } - - /** - * Sets delivered - * - * @param int $delivered Number of delivered SMS for the date - * - * @return $this - */ - public function setDelivered($delivered) - { - $this->container['delivered'] = $delivered; - - return $this; - } - - /** - * Gets hardBounces - * - * @return int - */ - public function getHardBounces() - { - return $this->container['hardBounces']; - } - - /** - * Sets hardBounces - * - * @param int $hardBounces Number of hardbounces for the date - * - * @return $this - */ - public function setHardBounces($hardBounces) - { - $this->container['hardBounces'] = $hardBounces; - - return $this; - } - - /** - * Gets softBounces - * - * @return int - */ - public function getSoftBounces() - { - return $this->container['softBounces']; - } - - /** - * Sets softBounces - * - * @param int $softBounces Number of softbounces for the date - * - * @return $this - */ - public function setSoftBounces($softBounces) - { - $this->container['softBounces'] = $softBounces; - - return $this; - } - - /** - * Gets blocked - * - * @return int - */ - public function getBlocked() - { - return $this->container['blocked']; - } - - /** - * Sets blocked - * - * @param int $blocked Number of blocked contact for the date - * - * @return $this - */ - public function setBlocked($blocked) - { - $this->container['blocked'] = $blocked; - - return $this; - } - - /** - * Gets unsubscribed - * - * @return int - */ - public function getUnsubscribed() - { - return $this->container['unsubscribed']; - } - - /** - * Sets unsubscribed - * - * @param int $unsubscribed Number of unsubscription for the date - * - * @return $this - */ - public function setUnsubscribed($unsubscribed) - { - $this->container['unsubscribed'] = $unsubscribed; - - return $this; - } - - /** - * Gets replied - * - * @return int - */ - public function getReplied() - { - return $this->container['replied']; - } - - /** - * Sets replied - * - * @param int $replied Number of answered SMS for the date - * - * @return $this - */ - public function setReplied($replied) - { - $this->container['replied'] = $replied; - - return $this; - } - - /** - * Gets accepted - * - * @return int - */ - public function getAccepted() - { - return $this->container['accepted']; - } - - /** - * Sets accepted - * - * @param int $accepted Number of accepted for the date - * - * @return $this - */ - public function setAccepted($accepted) - { - $this->container['accepted'] = $accepted; - - return $this; - } - - /** - * Gets rejected - * - * @return int - */ - public function getRejected() - { - return $this->container['rejected']; - } - - /** - * Sets rejected - * - * @param int $rejected Number of rejected for the date - * - * @return $this - */ - public function setRejected($rejected) - { - $this->container['rejected'] = $rejected; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetTransacSmsReportReportsInner.php b/lib/Models/GetTransacSmsReportReportsInner.php new file mode 100644 index 0000000..bfffaee --- /dev/null +++ b/lib/Models/GetTransacSmsReportReportsInner.php @@ -0,0 +1,547 @@ + + */ +class GetTransacSmsReportReportsInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getTransacSmsReport_reports_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'date' => '\DateTime', + 'requests' => 'int', + 'delivered' => 'int', + 'hardBounces' => 'int', + 'softBounces' => 'int', + 'blocked' => 'int', + 'unsubscribed' => 'int', + 'replied' => 'int', + 'accepted' => 'int', + 'rejected' => 'int', + 'skipped' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'date' => 'date', + 'requests' => 'int64', + 'delivered' => 'int64', + 'hardBounces' => 'int64', + 'softBounces' => 'int64', + 'blocked' => 'int64', + 'unsubscribed' => 'int64', + 'replied' => 'int64', + 'accepted' => 'int64', + 'rejected' => 'int64', + 'skipped' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'date' => false, + 'requests' => false, + 'delivered' => false, + 'hardBounces' => false, + 'softBounces' => false, + 'blocked' => false, + 'unsubscribed' => false, + 'replied' => false, + 'accepted' => false, + 'rejected' => false, + 'skipped' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'date' => 'date', + 'requests' => 'requests', + 'delivered' => 'delivered', + 'hardBounces' => 'hardBounces', + 'softBounces' => 'softBounces', + 'blocked' => 'blocked', + 'unsubscribed' => 'unsubscribed', + 'replied' => 'replied', + 'accepted' => 'accepted', + 'rejected' => 'rejected', + 'skipped' => 'skipped' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'date' => 'setDate', + 'requests' => 'setRequests', + 'delivered' => 'setDelivered', + 'hardBounces' => 'setHardBounces', + 'softBounces' => 'setSoftBounces', + 'blocked' => 'setBlocked', + 'unsubscribed' => 'setUnsubscribed', + 'replied' => 'setReplied', + 'accepted' => 'setAccepted', + 'rejected' => 'setRejected', + 'skipped' => 'setSkipped' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'date' => 'getDate', + 'requests' => 'getRequests', + 'delivered' => 'getDelivered', + 'hardBounces' => 'getHardBounces', + 'softBounces' => 'getSoftBounces', + 'blocked' => 'getBlocked', + 'unsubscribed' => 'getUnsubscribed', + 'replied' => 'getReplied', + 'accepted' => 'getAccepted', + 'rejected' => 'getRejected', + 'skipped' => 'getSkipped' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('requests', $data ?? [], null); + $this->setIfExists('delivered', $data ?? [], null); + $this->setIfExists('hardBounces', $data ?? [], null); + $this->setIfExists('softBounces', $data ?? [], null); + $this->setIfExists('blocked', $data ?? [], null); + $this->setIfExists('unsubscribed', $data ?? [], null); + $this->setIfExists('replied', $data ?? [], null); + $this->setIfExists('accepted', $data ?? [], null); + $this->setIfExists('rejected', $data ?? [], null); + $this->setIfExists('skipped', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate(): ?\DateTime + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Date for which statistics are retrieved + * + * @return $this + */ + public function setDate(?\DateTime $date): static + { + if (is_null($date)) { + throw new InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets requests + * + * @return int|null + */ + public function getRequests(): ?int + { + return $this->container['requests']; + } + + /** + * Sets requests + * + * @param int|null $requests Number of requests for the date + * + * @return $this + */ + public function setRequests(?int $requests): static + { + if (is_null($requests)) { + throw new InvalidArgumentException('non-nullable requests cannot be null'); + } + $this->container['requests'] = $requests; + + return $this; + } + + /** + * Gets delivered + * + * @return int|null + */ + public function getDelivered(): ?int + { + return $this->container['delivered']; + } + + /** + * Sets delivered + * + * @param int|null $delivered Number of delivered SMS for the date + * + * @return $this + */ + public function setDelivered(?int $delivered): static + { + if (is_null($delivered)) { + throw new InvalidArgumentException('non-nullable delivered cannot be null'); + } + $this->container['delivered'] = $delivered; + + return $this; + } + + /** + * Gets hardBounces + * + * @return int|null + */ + public function getHardBounces(): ?int + { + return $this->container['hardBounces']; + } + + /** + * Sets hardBounces + * + * @param int|null $hardBounces Number of hardbounces for the date + * + * @return $this + */ + public function setHardBounces(?int $hardBounces): static + { + if (is_null($hardBounces)) { + throw new InvalidArgumentException('non-nullable hardBounces cannot be null'); + } + $this->container['hardBounces'] = $hardBounces; + + return $this; + } + + /** + * Gets softBounces + * + * @return int|null + */ + public function getSoftBounces(): ?int + { + return $this->container['softBounces']; + } + + /** + * Sets softBounces + * + * @param int|null $softBounces Number of softbounces for the date + * + * @return $this + */ + public function setSoftBounces(?int $softBounces): static + { + if (is_null($softBounces)) { + throw new InvalidArgumentException('non-nullable softBounces cannot be null'); + } + $this->container['softBounces'] = $softBounces; + + return $this; + } + + /** + * Gets blocked + * + * @return int|null + */ + public function getBlocked(): ?int + { + return $this->container['blocked']; + } + + /** + * Sets blocked + * + * @param int|null $blocked Number of blocked contact for the date + * + * @return $this + */ + public function setBlocked(?int $blocked): static + { + if (is_null($blocked)) { + throw new InvalidArgumentException('non-nullable blocked cannot be null'); + } + $this->container['blocked'] = $blocked; + + return $this; + } + + /** + * Gets unsubscribed + * + * @return int|null + */ + public function getUnsubscribed(): ?int + { + return $this->container['unsubscribed']; + } + + /** + * Sets unsubscribed + * + * @param int|null $unsubscribed Number of unsubscription for the date + * + * @return $this + */ + public function setUnsubscribed(?int $unsubscribed): static + { + if (is_null($unsubscribed)) { + throw new InvalidArgumentException('non-nullable unsubscribed cannot be null'); + } + $this->container['unsubscribed'] = $unsubscribed; + + return $this; + } + + /** + * Gets replied + * + * @return int|null + */ + public function getReplied(): ?int + { + return $this->container['replied']; + } + + /** + * Sets replied + * + * @param int|null $replied Number of answered SMS for the date + * + * @return $this + */ + public function setReplied(?int $replied): static + { + if (is_null($replied)) { + throw new InvalidArgumentException('non-nullable replied cannot be null'); + } + $this->container['replied'] = $replied; + + return $this; + } + + /** + * Gets accepted + * + * @return int|null + */ + public function getAccepted(): ?int + { + return $this->container['accepted']; + } + + /** + * Sets accepted + * + * @param int|null $accepted Number of accepted SMS for the date + * + * @return $this + */ + public function setAccepted(?int $accepted): static + { + if (is_null($accepted)) { + throw new InvalidArgumentException('non-nullable accepted cannot be null'); + } + $this->container['accepted'] = $accepted; + + return $this; + } + + /** + * Gets rejected + * + * @return int|null + */ + public function getRejected(): ?int + { + return $this->container['rejected']; + } + + /** + * Sets rejected + * + * @param int|null $rejected Number of rejected SMS for the date + * + * @return $this + */ + public function setRejected(?int $rejected): static + { + if (is_null($rejected)) { + throw new InvalidArgumentException('non-nullable rejected cannot be null'); + } + $this->container['rejected'] = $rejected; + + return $this; + } + + /** + * Gets skipped + * + * @return int|null + */ + public function getSkipped(): ?int + { + return $this->container['skipped']; + } + + /** + * Sets skipped + * + * @param int|null $skipped Number of skipped SMS for the date + * + * @return $this + */ + public function setSkipped(?int $skipped): static + { + if (is_null($skipped)) { + throw new InvalidArgumentException('non-nullable skipped cannot be null'); + } + $this->container['skipped'] = $skipped; + + return $this; + } +} + + diff --git a/lib/Models/GetUserPermission.php b/lib/Models/GetUserPermission.php index 039c183..0301463 100644 --- a/lib/Models/GetUserPermission.php +++ b/lib/Models/GetUserPermission.php @@ -2,105 +2,105 @@ /** * GetUserPermission * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetUserPermission Class Doc Comment * - * @category Class * @description Check user permission * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetUserPermission implements ModelInterface, ArrayAccess +class GetUserPermission extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getUserPermission'; + protected static string $openAPIModelName = 'getUserPermission'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'email' => 'string', 'status' => 'string', - 'privileges' => '\Brevo\Client\Models\GetUserPermissionPrivileges[]' + 'privileges' => '\Brevo\Client\Models\GetUserPermissionPrivilegesInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'email' => null, 'status' => null, 'privileges' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'status' => false, + 'privileges' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'email' => 'email', 'status' => 'status', 'privileges' => 'privileges' @@ -109,9 +109,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'email' => 'setEmail', 'status' => 'setStatus', 'privileges' => 'setPrivileges' @@ -120,9 +120,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'email' => 'getEmail', 'status' => 'getStatus', 'privileges' => 'getPrivileges' @@ -132,9 +132,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -142,9 +142,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -152,53 +152,39 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['privileges'] = isset($data['privileges']) ? $data['privileges'] : null; + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('privileges', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -214,24 +200,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets email * * @return string */ - public function getEmail() + public function getEmail(): string { return $this->container['email']; } @@ -243,8 +217,11 @@ public function getEmail() * * @return $this */ - public function setEmail($email) + public function setEmail(string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -255,7 +232,7 @@ public function setEmail($email) * * @return string */ - public function getStatus() + public function getStatus(): string { return $this->container['status']; } @@ -267,8 +244,11 @@ public function getStatus() * * @return $this */ - public function setStatus($status) + public function setStatus(string $status): static { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -277,9 +257,9 @@ public function setStatus($status) /** * Gets privileges * - * @return \Brevo\Client\Models\GetUserPermissionPrivileges[] + * @return \Brevo\Client\Models\GetUserPermissionPrivilegesInner[] */ - public function getPrivileges() + public function getPrivileges(): array { return $this->container['privileges']; } @@ -287,89 +267,19 @@ public function getPrivileges() /** * Sets privileges * - * @param \Brevo\Client\Models\GetUserPermissionPrivileges[] $privileges Granular feature permissions given to the user. + * @param \Brevo\Client\Models\GetUserPermissionPrivilegesInner[] $privileges Granular feature permissions given to the user. * * @return $this */ - public function setPrivileges($privileges) + public function setPrivileges(array $privileges): static { + if (is_null($privileges)) { + throw new InvalidArgumentException('non-nullable privileges cannot be null'); + } $this->container['privileges'] = $privileges; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetUserPermissionPrivileges.php b/lib/Models/GetUserPermissionPrivileges.php deleted file mode 100644 index 107f82d..0000000 --- a/lib/Models/GetUserPermissionPrivileges.php +++ /dev/null @@ -1,341 +0,0 @@ - 'string', - 'permissions' => 'string[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'feature' => null, - 'permissions' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'feature' => 'feature', - 'permissions' => 'permissions' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'feature' => 'setFeature', - 'permissions' => 'setPermissions' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'feature' => 'getFeature', - 'permissions' => 'getPermissions' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['feature'] = isset($data['feature']) ? $data['feature'] : null; - $this->container['permissions'] = isset($data['permissions']) ? $data['permissions'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['feature'] === null) { - $invalidProperties[] = "'feature' can't be null"; - } - if ($this->container['permissions'] === null) { - $invalidProperties[] = "'permissions' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets feature - * - * @return string - */ - public function getFeature() - { - return $this->container['feature']; - } - - /** - * Sets feature - * - * @param string $feature feature - * - * @return $this - */ - public function setFeature($feature) - { - $this->container['feature'] = $feature; - - return $this; - } - - /** - * Gets permissions - * - * @return string[] - */ - public function getPermissions() - { - return $this->container['permissions']; - } - - /** - * Sets permissions - * - * @param string[] $permissions permissions - * - * @return $this - */ - public function setPermissions($permissions) - { - $this->container['permissions'] = $permissions; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetUserPermissionPrivilegesInner.php b/lib/Models/GetUserPermissionPrivilegesInner.php new file mode 100644 index 0000000..a6afb39 --- /dev/null +++ b/lib/Models/GetUserPermissionPrivilegesInner.php @@ -0,0 +1,247 @@ + + */ +class GetUserPermissionPrivilegesInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getUserPermission_privileges_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'feature' => 'string', + 'permissions' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'feature' => null, + 'permissions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'feature' => false, + 'permissions' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'feature' => 'feature', + 'permissions' => 'permissions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'feature' => 'setFeature', + 'permissions' => 'setPermissions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'feature' => 'getFeature', + 'permissions' => 'getPermissions' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('feature', $data ?? [], null); + $this->setIfExists('permissions', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['feature'] === null) { + $invalidProperties[] = "'feature' can't be null"; + } + if ($this->container['permissions'] === null) { + $invalidProperties[] = "'permissions' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets feature + * + * @return string + */ + public function getFeature(): string + { + return $this->container['feature']; + } + + /** + * Sets feature + * + * @param string $feature feature + * + * @return $this + */ + public function setFeature(string $feature): static + { + if (is_null($feature)) { + throw new InvalidArgumentException('non-nullable feature cannot be null'); + } + $this->container['feature'] = $feature; + + return $this; + } + + /** + * Gets permissions + * + * @return string[] + */ + public function getPermissions(): array + { + return $this->container['permissions']; + } + + /** + * Sets permissions + * + * @param string[] $permissions permissions + * + * @return $this + */ + public function setPermissions(array $permissions): static + { + if (is_null($permissions)) { + throw new InvalidArgumentException('non-nullable permissions cannot be null'); + } + $this->container['permissions'] = $permissions; + + return $this; + } +} + + diff --git a/lib/Models/GetVersionInfoResponse.php b/lib/Models/GetVersionInfoResponse.php new file mode 100644 index 0000000..d8ca4a7 --- /dev/null +++ b/lib/Models/GetVersionInfoResponse.php @@ -0,0 +1,275 @@ + + */ +class GetVersionInfoResponse extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getVersionInfoResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'active' => '\Brevo\Client\Models\VersionInfo[]', + 'draft' => '\Brevo\Client\Models\VersionInfo[]', + 'inactive' => '\Brevo\Client\Models\VersionInfo[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'active' => null, + 'draft' => null, + 'inactive' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'active' => false, + 'draft' => false, + 'inactive' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'active' => 'active', + 'draft' => 'draft', + 'inactive' => 'inactive' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'active' => 'setActive', + 'draft' => 'setDraft', + 'inactive' => 'setInactive' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'active' => 'getActive', + 'draft' => 'getDraft', + 'inactive' => 'getInactive' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('draft', $data ?? [], null); + $this->setIfExists('inactive', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets active + * + * @return \Brevo\Client\Models\VersionInfo[]|null + */ + public function getActive(): ?array + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param \Brevo\Client\Models\VersionInfo[]|null $active Active Version Information + * + * @return $this + */ + public function setActive(?array $active): static + { + if (is_null($active)) { + throw new InvalidArgumentException('non-nullable active cannot be null'); + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets draft + * + * @return \Brevo\Client\Models\VersionInfo[]|null + */ + public function getDraft(): ?array + { + return $this->container['draft']; + } + + /** + * Sets draft + * + * @param \Brevo\Client\Models\VersionInfo[]|null $draft Draft Version Information + * + * @return $this + */ + public function setDraft(?array $draft): static + { + if (is_null($draft)) { + throw new InvalidArgumentException('non-nullable draft cannot be null'); + } + $this->container['draft'] = $draft; + + return $this; + } + + /** + * Gets inactive + * + * @return \Brevo\Client\Models\VersionInfo[]|null + */ + public function getInactive(): ?array + { + return $this->container['inactive']; + } + + /** + * Sets inactive + * + * @param \Brevo\Client\Models\VersionInfo[]|null $inactive Inactive Version Information + * + * @return $this + */ + public function setInactive(?array $inactive): static + { + if (is_null($inactive)) { + throw new InvalidArgumentException('non-nullable inactive cannot be null'); + } + $this->container['inactive'] = $inactive; + + return $this; + } +} + + diff --git a/lib/Models/GetWATemplates.php b/lib/Models/GetWATemplates.php deleted file mode 100644 index f9a81ff..0000000 --- a/lib/Models/GetWATemplates.php +++ /dev/null @@ -1,341 +0,0 @@ - '\Brevo\Client\Models\GetWATemplatesTemplates[]', - 'count' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'templates' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'templates' => 'templates', - 'count' => 'count' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'templates' => 'setTemplates', - 'count' => 'setCount' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'templates' => 'getTemplates', - '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 - */ - public function __construct(array $data = null) - { - $this->container['templates'] = isset($data['templates']) ? $data['templates'] : null; - $this->container['count'] = isset($data['count']) ? $data['count'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['templates'] === null) { - $invalidProperties[] = "'templates' can't be null"; - } - if ($this->container['count'] === null) { - $invalidProperties[] = "'count' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets templates - * - * @return \Brevo\Client\Models\GetWATemplatesTemplates[] - */ - public function getTemplates() - { - return $this->container['templates']; - } - - /** - * Sets templates - * - * @param \Brevo\Client\Models\GetWATemplatesTemplates[] $templates templates - * - * @return $this - */ - public function setTemplates($templates) - { - $this->container['templates'] = $templates; - - return $this; - } - - /** - * Gets count - * - * @return int - */ - public function getCount() - { - return $this->container['count']; - } - - /** - * Sets count - * - * @param int $count Number of whatsApp templates retrived - * - * @return $this - */ - public function setCount($count) - { - $this->container['count'] = $count; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetWebhook.php b/lib/Models/GetWebhook.php index e962291..8918a55 100644 --- a/lib/Models/GetWebhook.php +++ b/lib/Models/GetWebhook.php @@ -2,61 +2,63 @@ /** * GetWebhook * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetWebhook Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetWebhook implements ModelInterface, ArrayAccess +class GetWebhook extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getWebhook'; + protected static string $openAPIModelName = 'getWebhook'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'url' => 'string', 'id' => 'int', 'description' => 'string', @@ -65,16 +67,16 @@ class GetWebhook implements ModelInterface, ArrayAccess 'createdAt' => 'string', 'modifiedAt' => 'string', 'batched' => 'bool', - 'auth' => '\Brevo\Client\Models\GetWebhookAuth', - 'headers' => '\Brevo\Client\Models\GetWebhookHeaders[]' + 'auth' => 'object', + 'headers' => 'object[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'url' => 'url', 'id' => 'int64', 'description' => null, @@ -88,32 +90,37 @@ class GetWebhook implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'url' => false, + 'id' => false, + 'description' => false, + 'events' => false, + 'type' => false, + 'createdAt' => false, + 'modifiedAt' => false, + 'batched' => false, + 'auth' => false, + 'headers' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'url' => 'url', 'id' => 'id', 'description' => 'description', @@ -129,9 +136,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'url' => 'setUrl', 'id' => 'setId', 'description' => 'setDescription', @@ -147,9 +154,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'url' => 'getUrl', 'id' => 'getId', 'description' => 'getDescription', @@ -166,9 +173,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -176,9 +183,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -186,27 +193,15 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const TYPE_MARKETING = 'marketing'; - const TYPE_TRANSACTIONAL = 'transactional'; - - + public const TYPE_MARKETING = 'marketing'; + public const TYPE_TRANSACTIONAL = 'transactional'; /** * Gets allowable values of the enum @@ -221,40 +216,38 @@ public function getTypeAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - $this->container['events'] = isset($data['events']) ? $data['events'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['modifiedAt'] = isset($data['modifiedAt']) ? $data['modifiedAt'] : null; - $this->container['batched'] = isset($data['batched']) ? $data['batched'] : null; - $this->container['auth'] = isset($data['auth']) ? $data['auth'] : null; - $this->container['headers'] = isset($data['headers']) ? $data['headers'] : null; + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('events', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('modifiedAt', $data ?? [], null); + $this->setIfExists('batched', $data ?? [], null); + $this->setIfExists('auth', $data ?? [], null); + $this->setIfExists('headers', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -276,7 +269,8 @@ public function listInvalidProperties() $allowedValues = $this->getTypeAllowableValues(); if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], implode("', '", $allowedValues) ); } @@ -290,24 +284,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets url * * @return string */ - public function getUrl() + public function getUrl(): string { return $this->container['url']; } @@ -319,8 +301,11 @@ public function getUrl() * * @return $this */ - public function setUrl($url) + public function setUrl(string $url): static { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } $this->container['url'] = $url; return $this; @@ -331,7 +316,7 @@ public function setUrl($url) * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -343,8 +328,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -355,7 +343,7 @@ public function setId($id) * * @return string */ - public function getDescription() + public function getDescription(): string { return $this->container['description']; } @@ -367,8 +355,11 @@ public function getDescription() * * @return $this */ - public function setDescription($description) + public function setDescription(string $description): static { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } $this->container['description'] = $description; return $this; @@ -379,7 +370,7 @@ public function setDescription($description) * * @return string[] */ - public function getEvents() + public function getEvents(): array { return $this->container['events']; } @@ -391,8 +382,11 @@ public function getEvents() * * @return $this */ - public function setEvents($events) + public function setEvents(array $events): static { + if (is_null($events)) { + throw new InvalidArgumentException('non-nullable events cannot be null'); + } $this->container['events'] = $events; return $this; @@ -403,7 +397,7 @@ public function setEvents($events) * * @return string */ - public function getType() + public function getType(): string { return $this->container['type']; } @@ -415,13 +409,17 @@ public function getType() * * @return $this */ - public function setType($type) + public function setType(string $type): static { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $allowedValues = $this->getTypeAllowableValues(); if (!in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'type', must be one of '%s'", + "Invalid value '%s' for 'type', must be one of '%s'", + $type, implode("', '", $allowedValues) ) ); @@ -436,7 +434,7 @@ public function setType($type) * * @return string */ - public function getCreatedAt() + public function getCreatedAt(): string { return $this->container['createdAt']; } @@ -448,8 +446,11 @@ public function getCreatedAt() * * @return $this */ - public function setCreatedAt($createdAt) + public function setCreatedAt(string $createdAt): static { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } $this->container['createdAt'] = $createdAt; return $this; @@ -460,7 +461,7 @@ public function setCreatedAt($createdAt) * * @return string */ - public function getModifiedAt() + public function getModifiedAt(): string { return $this->container['modifiedAt']; } @@ -472,8 +473,11 @@ public function getModifiedAt() * * @return $this */ - public function setModifiedAt($modifiedAt) + public function setModifiedAt(string $modifiedAt): static { + if (is_null($modifiedAt)) { + throw new InvalidArgumentException('non-nullable modifiedAt cannot be null'); + } $this->container['modifiedAt'] = $modifiedAt; return $this; @@ -482,9 +486,9 @@ public function setModifiedAt($modifiedAt) /** * Gets batched * - * @return bool + * @return bool|null */ - public function getBatched() + public function getBatched(): ?bool { return $this->container['batched']; } @@ -492,12 +496,15 @@ public function getBatched() /** * Sets batched * - * @param bool $batched To send batched webhooks + * @param bool|null $batched Batching configuration of the webhook, we send batched webhooks if its true * * @return $this */ - public function setBatched($batched) + public function setBatched(?bool $batched): static { + if (is_null($batched)) { + throw new InvalidArgumentException('non-nullable batched cannot be null'); + } $this->container['batched'] = $batched; return $this; @@ -506,9 +513,9 @@ public function setBatched($batched) /** * Gets auth * - * @return \Brevo\Client\Models\GetWebhookAuth + * @return object|null */ - public function getAuth() + public function getAuth(): ?object { return $this->container['auth']; } @@ -516,12 +523,15 @@ public function getAuth() /** * Sets auth * - * @param \Brevo\Client\Models\GetWebhookAuth $auth auth + * @param object|null $auth Authentication header to be send with the webhook requests * * @return $this */ - public function setAuth($auth) + public function setAuth(?object $auth): static { + if (is_null($auth)) { + throw new InvalidArgumentException('non-nullable auth cannot be null'); + } $this->container['auth'] = $auth; return $this; @@ -530,9 +540,9 @@ public function setAuth($auth) /** * Gets headers * - * @return \Brevo\Client\Models\GetWebhookHeaders[] + * @return object[]|null */ - public function getHeaders() + public function getHeaders(): ?array { return $this->container['headers']; } @@ -540,89 +550,19 @@ public function getHeaders() /** * Sets headers * - * @param \Brevo\Client\Models\GetWebhookHeaders[] $headers Custom headers to be send with webhooks + * @param object[]|null $headers headers * * @return $this */ - public function setHeaders($headers) + public function setHeaders(?array $headers): static { + if (is_null($headers)) { + throw new InvalidArgumentException('non-nullable headers cannot be null'); + } $this->container['headers'] = $headers; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetWebhookAuth.php b/lib/Models/GetWebhookAuth.php deleted file mode 100644 index f4b3db1..0000000 --- a/lib/Models/GetWebhookAuth.php +++ /dev/null @@ -1,336 +0,0 @@ - 'string', - 'token' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'type' => null, - 'token' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'type' => 'type', - 'token' => 'token' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'type' => 'setType', - 'token' => 'setToken' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'type' => 'getType', - 'token' => 'getToken' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['token'] = isset($data['token']) ? $data['token'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets type - * - * @return string - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param string $type Type of authentication - * - * @return $this - */ - public function setType($type) - { - $this->container['type'] = $type; - - return $this; - } - - /** - * Gets token - * - * @return string - */ - public function getToken() - { - return $this->container['token']; - } - - /** - * Sets token - * - * @param string $token Webhook authentication token - * - * @return $this - */ - public function setToken($token) - { - $this->container['token'] = $token; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetWebhookHeaders.php b/lib/Models/GetWebhookHeaders.php deleted file mode 100644 index c4bf9ba..0000000 --- a/lib/Models/GetWebhookHeaders.php +++ /dev/null @@ -1,335 +0,0 @@ - 'string', - 'value' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'key' => null, - 'value' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'key' => 'key', - 'value' => 'value' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'key' => 'setKey', - 'value' => 'setValue' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'key' => 'getKey', - 'value' => 'getValue' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['key'] = isset($data['key']) ? $data['key'] : null; - $this->container['value'] = isset($data['value']) ? $data['value'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets key - * - * @return string - */ - public function getKey() - { - return $this->container['key']; - } - - /** - * Sets key - * - * @param string $key Header key name - * - * @return $this - */ - public function setKey($key) - { - $this->container['key'] = $key; - - return $this; - } - - /** - * Gets value - * - * @return string - */ - public function getValue() - { - return $this->container['value']; - } - - /** - * Sets value - * - * @param string $value Header value - * - * @return $this - */ - public function setValue($value) - { - $this->container['value'] = $value; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/GetWebhooks.php b/lib/Models/GetWebhooks.php index c964b21..9930421 100644 --- a/lib/Models/GetWebhooks.php +++ b/lib/Models/GetWebhooks.php @@ -2,118 +2,116 @@ /** * GetWebhooks * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetWebhooks Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetWebhooks implements ModelInterface, ArrayAccess +class GetWebhooks extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getWebhooks'; + protected static string $openAPIModelName = 'getWebhooks'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'webhooks' => 'object[]' + protected static array $openAPITypes = [ + 'webhooks' => 'GetWebhook[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'webhooks' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'webhooks' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'webhooks' => 'webhooks' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'webhooks' => 'setWebhooks' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'webhooks' => 'getWebhooks' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,51 +139,37 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['webhooks'] = isset($data['webhooks']) ? $data['webhooks'] : null; + $this->setIfExists('webhooks', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -195,24 +179,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets webhooks * - * @return object[] + * @return GetWebhook[] */ - public function getWebhooks() + public function getWebhooks(): array { return $this->container['webhooks']; } @@ -220,89 +192,19 @@ public function getWebhooks() /** * Sets webhooks * - * @param object[] $webhooks webhooks + * @param GetWebhook[] $webhooks webhooks * * @return $this */ - public function setWebhooks($webhooks) + public function setWebhooks(array $webhooks): static { + if (is_null($webhooks)) { + throw new InvalidArgumentException('non-nullable webhooks cannot be null'); + } $this->container['webhooks'] = $webhooks; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetWhatsAppConfig.php b/lib/Models/GetWhatsAppConfig.php index 50d1b03..d9bdd44 100644 --- a/lib/Models/GetWhatsAppConfig.php +++ b/lib/Models/GetWhatsAppConfig.php @@ -2,61 +2,63 @@ /** * GetWhatsAppConfig * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetWhatsAppConfig Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetWhatsAppConfig implements ModelInterface, ArrayAccess +class GetWhatsAppConfig extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getWhatsAppConfig'; + protected static string $openAPIModelName = 'getWhatsAppConfig'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'whatsappBusinessAccountId' => 'string', 'sendingLimit' => 'string', 'phoneNumberQuality' => 'string', @@ -68,9 +70,9 @@ class GetWhatsAppConfig implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'whatsappBusinessAccountId' => null, 'sendingLimit' => null, 'phoneNumberQuality' => null, @@ -80,32 +82,33 @@ class GetWhatsAppConfig implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'whatsappBusinessAccountId' => false, + 'sendingLimit' => false, + 'phoneNumberQuality' => false, + 'whatsappBusinessAccountStatus' => false, + 'businessStatus' => false, + 'phoneNumberNameStatus' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'whatsappBusinessAccountId' => 'whatsappBusinessAccountId', 'sendingLimit' => 'sendingLimit', 'phoneNumberQuality' => 'phoneNumberQuality', @@ -117,9 +120,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'whatsappBusinessAccountId' => 'setWhatsappBusinessAccountId', 'sendingLimit' => 'setSendingLimit', 'phoneNumberQuality' => 'setPhoneNumberQuality', @@ -131,9 +134,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'whatsappBusinessAccountId' => 'getWhatsappBusinessAccountId', 'sendingLimit' => 'getSendingLimit', 'phoneNumberQuality' => 'getPhoneNumberQuality', @@ -146,9 +149,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -156,9 +159,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -166,43 +169,48 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } + public const PHONE_NUMBER_QUALITY_GREEN = 'GREEN'; + public const PHONE_NUMBER_QUALITY_YELLOW = 'YELLOW'; + public const PHONE_NUMBER_QUALITY_RED = 'RED'; + public const WHATSAPP_BUSINESS_ACCOUNT_STATUS_APPROVED = 'APPROVED'; + public const WHATSAPP_BUSINESS_ACCOUNT_STATUS_PENDING = 'PENDING'; + public const WHATSAPP_BUSINESS_ACCOUNT_STATUS_REJECTED = 'REJECTED'; + public const PHONE_NUMBER_NAME_STATUS_APPROVED = 'APPROVED'; + public const PHONE_NUMBER_NAME_STATUS_PENDING = 'PENDING'; + public const PHONE_NUMBER_NAME_STATUS_REJECTED = 'REJECTED'; + /** - * The original name of the model. + * Gets allowable values of the enum * - * @return string + * @return string[] */ - public function getModelName() + public function getPhoneNumberQualityAllowableValues() { - return self::$swaggerModelName; + return [ + self::PHONE_NUMBER_QUALITY_GREEN, + self::PHONE_NUMBER_QUALITY_YELLOW, + self::PHONE_NUMBER_QUALITY_RED, + ]; } - const PHONE_NUMBER_QUALITY_GREEN = 'GREEN'; - const PHONE_NUMBER_QUALITY_YELLOW = 'YELLOW'; - const PHONE_NUMBER_QUALITY_RED = 'RED'; - const PHONE_NUMBER_NAME_STATUS_APPROVED = 'APPROVED'; - const PHONE_NUMBER_NAME_STATUS_PENDING = 'PENDING'; - const PHONE_NUMBER_NAME_STATUS_REJECTED = 'REJECTED'; - - - /** * Gets allowable values of the enum * * @return string[] */ - public function getPhoneNumberQualityAllowableValues() + public function getWhatsappBusinessAccountStatusAllowableValues() { return [ - self::PHONE_NUMBER_QUALITY_GREEN, - self::PHONE_NUMBER_QUALITY_YELLOW, - self::PHONE_NUMBER_QUALITY_RED, + self::WHATSAPP_BUSINESS_ACCOUNT_STATUS_APPROVED, + self::WHATSAPP_BUSINESS_ACCOUNT_STATUS_PENDING, + self::WHATSAPP_BUSINESS_ACCOUNT_STATUS_REJECTED, ]; } @@ -220,43 +228,51 @@ public function getPhoneNumberNameStatusAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['whatsappBusinessAccountId'] = isset($data['whatsappBusinessAccountId']) ? $data['whatsappBusinessAccountId'] : null; - $this->container['sendingLimit'] = isset($data['sendingLimit']) ? $data['sendingLimit'] : null; - $this->container['phoneNumberQuality'] = isset($data['phoneNumberQuality']) ? $data['phoneNumberQuality'] : null; - $this->container['whatsappBusinessAccountStatus'] = isset($data['whatsappBusinessAccountStatus']) ? $data['whatsappBusinessAccountStatus'] : null; - $this->container['businessStatus'] = isset($data['businessStatus']) ? $data['businessStatus'] : null; - $this->container['phoneNumberNameStatus'] = isset($data['phoneNumberNameStatus']) ? $data['phoneNumberNameStatus'] : null; + $this->setIfExists('whatsappBusinessAccountId', $data ?? [], null); + $this->setIfExists('sendingLimit', $data ?? [], null); + $this->setIfExists('phoneNumberQuality', $data ?? [], null); + $this->setIfExists('whatsappBusinessAccountStatus', $data ?? [], null); + $this->setIfExists('businessStatus', $data ?? [], null); + $this->setIfExists('phoneNumberNameStatus', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; $allowedValues = $this->getPhoneNumberQualityAllowableValues(); if (!is_null($this->container['phoneNumberQuality']) && !in_array($this->container['phoneNumberQuality'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'phoneNumberQuality', must be one of '%s'", + "invalid value '%s' for 'phoneNumberQuality', must be one of '%s'", + $this->container['phoneNumberQuality'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getWhatsappBusinessAccountStatusAllowableValues(); + if (!is_null($this->container['whatsappBusinessAccountStatus']) && !in_array($this->container['whatsappBusinessAccountStatus'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'whatsappBusinessAccountStatus', must be one of '%s'", + $this->container['whatsappBusinessAccountStatus'], implode("', '", $allowedValues) ); } @@ -264,7 +280,8 @@ public function listInvalidProperties() $allowedValues = $this->getPhoneNumberNameStatusAllowableValues(); if (!is_null($this->container['phoneNumberNameStatus']) && !in_array($this->container['phoneNumberNameStatus'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'phoneNumberNameStatus', must be one of '%s'", + "invalid value '%s' for 'phoneNumberNameStatus', must be one of '%s'", + $this->container['phoneNumberNameStatus'], implode("', '", $allowedValues) ); } @@ -272,24 +289,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets whatsappBusinessAccountId * - * @return string + * @return string|null */ - public function getWhatsappBusinessAccountId() + public function getWhatsappBusinessAccountId(): ?string { return $this->container['whatsappBusinessAccountId']; } @@ -297,12 +302,15 @@ public function getWhatsappBusinessAccountId() /** * Sets whatsappBusinessAccountId * - * @param string $whatsappBusinessAccountId Id of the WhatsApp business account + * @param string|null $whatsappBusinessAccountId Id of the WhatsApp business account * * @return $this */ - public function setWhatsappBusinessAccountId($whatsappBusinessAccountId) + public function setWhatsappBusinessAccountId(?string $whatsappBusinessAccountId): static { + if (is_null($whatsappBusinessAccountId)) { + throw new InvalidArgumentException('non-nullable whatsappBusinessAccountId cannot be null'); + } $this->container['whatsappBusinessAccountId'] = $whatsappBusinessAccountId; return $this; @@ -311,9 +319,9 @@ public function setWhatsappBusinessAccountId($whatsappBusinessAccountId) /** * Gets sendingLimit * - * @return string + * @return string|null */ - public function getSendingLimit() + public function getSendingLimit(): ?string { return $this->container['sendingLimit']; } @@ -321,12 +329,15 @@ public function getSendingLimit() /** * Sets sendingLimit * - * @param string $sendingLimit Sending limit Information of the WhatsApp API account + * @param string|null $sendingLimit Sending limit Information of the WhatsApp API account * * @return $this */ - public function setSendingLimit($sendingLimit) + public function setSendingLimit(?string $sendingLimit): static { + if (is_null($sendingLimit)) { + throw new InvalidArgumentException('non-nullable sendingLimit cannot be null'); + } $this->container['sendingLimit'] = $sendingLimit; return $this; @@ -335,9 +346,9 @@ public function setSendingLimit($sendingLimit) /** * Gets phoneNumberQuality * - * @return string + * @return string|null */ - public function getPhoneNumberQuality() + public function getPhoneNumberQuality(): ?string { return $this->container['phoneNumberQuality']; } @@ -345,17 +356,21 @@ public function getPhoneNumberQuality() /** * Sets phoneNumberQuality * - * @param string $phoneNumberQuality Quality status of phone number associated with WhatsApp account. There are three quality ratings. example - **High (GREEN) , Medium (YELLOW) and Low(RED)** + * @param string|null $phoneNumberQuality Quality status of phone number associated with WhatsApp account. There are three quality ratings. example - **High (GREEN) , Medium (YELLOW) and Low(RED)** * * @return $this */ - public function setPhoneNumberQuality($phoneNumberQuality) + public function setPhoneNumberQuality(?string $phoneNumberQuality): static { + if (is_null($phoneNumberQuality)) { + throw new InvalidArgumentException('non-nullable phoneNumberQuality cannot be null'); + } $allowedValues = $this->getPhoneNumberQualityAllowableValues(); - if (!is_null($phoneNumberQuality) && !in_array($phoneNumberQuality, $allowedValues, true)) { - throw new \InvalidArgumentException( + if (!in_array($phoneNumberQuality, $allowedValues, true)) { + throw new InvalidArgumentException( sprintf( - "Invalid value for 'phoneNumberQuality', must be one of '%s'", + "Invalid value '%s' for 'phoneNumberQuality', must be one of '%s'", + $phoneNumberQuality, implode("', '", $allowedValues) ) ); @@ -368,9 +383,9 @@ public function setPhoneNumberQuality($phoneNumberQuality) /** * Gets whatsappBusinessAccountStatus * - * @return string + * @return string|null */ - public function getWhatsappBusinessAccountStatus() + public function getWhatsappBusinessAccountStatus(): ?string { return $this->container['whatsappBusinessAccountStatus']; } @@ -378,12 +393,25 @@ public function getWhatsappBusinessAccountStatus() /** * Sets whatsappBusinessAccountStatus * - * @param string $whatsappBusinessAccountStatus Status information related to WhatsApp Api account + * @param string|null $whatsappBusinessAccountStatus Status information related to WhatsApp API account * * @return $this */ - public function setWhatsappBusinessAccountStatus($whatsappBusinessAccountStatus) + public function setWhatsappBusinessAccountStatus(?string $whatsappBusinessAccountStatus): static { + if (is_null($whatsappBusinessAccountStatus)) { + throw new InvalidArgumentException('non-nullable whatsappBusinessAccountStatus cannot be null'); + } + $allowedValues = $this->getWhatsappBusinessAccountStatusAllowableValues(); + if (!in_array($whatsappBusinessAccountStatus, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'whatsappBusinessAccountStatus', must be one of '%s'", + $whatsappBusinessAccountStatus, + implode("', '", $allowedValues) + ) + ); + } $this->container['whatsappBusinessAccountStatus'] = $whatsappBusinessAccountStatus; return $this; @@ -392,9 +420,9 @@ public function setWhatsappBusinessAccountStatus($whatsappBusinessAccountStatus) /** * Gets businessStatus * - * @return string + * @return string|null */ - public function getBusinessStatus() + public function getBusinessStatus(): ?string { return $this->container['businessStatus']; } @@ -402,12 +430,15 @@ public function getBusinessStatus() /** * Sets businessStatus * - * @param string $businessStatus Verification status information of the Business account + * @param string|null $businessStatus Verification status information of the Business account * * @return $this */ - public function setBusinessStatus($businessStatus) + public function setBusinessStatus(?string $businessStatus): static { + if (is_null($businessStatus)) { + throw new InvalidArgumentException('non-nullable businessStatus cannot be null'); + } $this->container['businessStatus'] = $businessStatus; return $this; @@ -416,9 +447,9 @@ public function setBusinessStatus($businessStatus) /** * Gets phoneNumberNameStatus * - * @return string + * @return string|null */ - public function getPhoneNumberNameStatus() + public function getPhoneNumberNameStatus(): ?string { return $this->container['phoneNumberNameStatus']; } @@ -426,17 +457,21 @@ public function getPhoneNumberNameStatus() /** * Sets phoneNumberNameStatus * - * @param string $phoneNumberNameStatus Status of the name associated with WhatsApp Phone number + * @param string|null $phoneNumberNameStatus Status of the name associated with WhatsApp Phone number * * @return $this */ - public function setPhoneNumberNameStatus($phoneNumberNameStatus) + public function setPhoneNumberNameStatus(?string $phoneNumberNameStatus): static { + if (is_null($phoneNumberNameStatus)) { + throw new InvalidArgumentException('non-nullable phoneNumberNameStatus cannot be null'); + } $allowedValues = $this->getPhoneNumberNameStatusAllowableValues(); - if (!is_null($phoneNumberNameStatus) && !in_array($phoneNumberNameStatus, $allowedValues, true)) { - throw new \InvalidArgumentException( + if (!in_array($phoneNumberNameStatus, $allowedValues, true)) { + throw new InvalidArgumentException( sprintf( - "Invalid value for 'phoneNumberNameStatus', must be one of '%s'", + "Invalid value '%s' for 'phoneNumberNameStatus', must be one of '%s'", + $phoneNumberNameStatus, implode("', '", $allowedValues) ) ); @@ -445,79 +480,6 @@ public function setPhoneNumberNameStatus($phoneNumberNameStatus) return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetWhatsappCampaignOverview.php b/lib/Models/GetWhatsappCampaignOverview.php index 4315b60..70f0b6f 100644 --- a/lib/Models/GetWhatsappCampaignOverview.php +++ b/lib/Models/GetWhatsappCampaignOverview.php @@ -2,168 +2,174 @@ /** * GetWhatsappCampaignOverview * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetWhatsappCampaignOverview Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetWhatsappCampaignOverview implements ModelInterface, ArrayAccess +class GetWhatsappCampaignOverview extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getWhatsappCampaignOverview'; + protected static string $openAPIModelName = 'getWhatsappCampaignOverview'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'campaignName' => 'string', 'campaignStatus' => 'string', - 'scheduledAt' => 'string', 'senderNumber' => 'string', - 'stats' => '\Brevo\Client\Models\WhatsappCampStats', 'template' => '\Brevo\Client\Models\WhatsappCampTemplate', 'createdAt' => 'string', - 'modifiedAt' => 'string' + 'modifiedAt' => 'string', + 'scheduledAt' => 'string', + 'stats' => '\Brevo\Client\Models\WhatsappCampStats' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'campaignName' => null, 'campaignStatus' => null, - 'scheduledAt' => null, 'senderNumber' => null, - 'stats' => null, 'template' => null, 'createdAt' => null, - 'modifiedAt' => null + 'modifiedAt' => null, + 'scheduledAt' => null, + 'stats' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'campaignName' => false, + 'campaignStatus' => false, + 'senderNumber' => false, + 'template' => false, + 'createdAt' => false, + 'modifiedAt' => false, + 'scheduledAt' => false, + 'stats' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'campaignName' => 'campaignName', 'campaignStatus' => 'campaignStatus', - 'scheduledAt' => 'scheduledAt', 'senderNumber' => 'senderNumber', - 'stats' => 'stats', 'template' => 'template', 'createdAt' => 'createdAt', - 'modifiedAt' => 'modifiedAt' + 'modifiedAt' => 'modifiedAt', + 'scheduledAt' => 'scheduledAt', + 'stats' => 'stats' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'campaignName' => 'setCampaignName', 'campaignStatus' => 'setCampaignStatus', - 'scheduledAt' => 'setScheduledAt', 'senderNumber' => 'setSenderNumber', - 'stats' => 'setStats', 'template' => 'setTemplate', 'createdAt' => 'setCreatedAt', - 'modifiedAt' => 'setModifiedAt' + 'modifiedAt' => 'setModifiedAt', + 'scheduledAt' => 'setScheduledAt', + 'stats' => 'setStats' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'campaignName' => 'getCampaignName', 'campaignStatus' => 'getCampaignStatus', - 'scheduledAt' => 'getScheduledAt', 'senderNumber' => 'getSenderNumber', - 'stats' => 'getStats', 'template' => 'getTemplate', 'createdAt' => 'getCreatedAt', - 'modifiedAt' => 'getModifiedAt' + 'modifiedAt' => 'getModifiedAt', + 'scheduledAt' => 'getScheduledAt', + 'stats' => 'getStats' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -171,9 +177,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -181,33 +187,21 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const CAMPAIGN_STATUS_DRAFT = 'draft'; - const CAMPAIGN_STATUS_SCHEDULED = 'scheduled'; - const CAMPAIGN_STATUS_PENDING = 'pending'; - const CAMPAIGN_STATUS_APPROVED = 'approved'; - const CAMPAIGN_STATUS_RUNNING = 'running'; - const CAMPAIGN_STATUS_SUSPENDED = 'suspended'; - const CAMPAIGN_STATUS_REJECTED = 'rejected'; - const CAMPAIGN_STATUS_SENT = 'sent'; - - + public const CAMPAIGN_STATUS_DRAFT = 'draft'; + public const CAMPAIGN_STATUS_SCHEDULED = 'scheduled'; + public const CAMPAIGN_STATUS_PENDING = 'pending'; + public const CAMPAIGN_STATUS_APPROVED = 'approved'; + public const CAMPAIGN_STATUS_RUNNING = 'running'; + public const CAMPAIGN_STATUS_SUSPENDED = 'suspended'; + public const CAMPAIGN_STATUS_REJECTED = 'rejected'; + public const CAMPAIGN_STATUS_SENT = 'sent'; /** * Gets allowable values of the enum @@ -228,39 +222,37 @@ public function getCampaignStatusAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['campaignName'] = isset($data['campaignName']) ? $data['campaignName'] : null; - $this->container['campaignStatus'] = isset($data['campaignStatus']) ? $data['campaignStatus'] : null; - $this->container['scheduledAt'] = isset($data['scheduledAt']) ? $data['scheduledAt'] : null; - $this->container['senderNumber'] = isset($data['senderNumber']) ? $data['senderNumber'] : null; - $this->container['stats'] = isset($data['stats']) ? $data['stats'] : null; - $this->container['template'] = isset($data['template']) ? $data['template'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['modifiedAt'] = isset($data['modifiedAt']) ? $data['modifiedAt'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('campaignName', $data ?? [], null); + $this->setIfExists('campaignStatus', $data ?? [], null); + $this->setIfExists('senderNumber', $data ?? [], null); + $this->setIfExists('template', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('modifiedAt', $data ?? [], null); + $this->setIfExists('scheduledAt', $data ?? [], null); + $this->setIfExists('stats', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -276,7 +268,8 @@ public function listInvalidProperties() $allowedValues = $this->getCampaignStatusAllowableValues(); if (!is_null($this->container['campaignStatus']) && !in_array($this->container['campaignStatus'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'campaignStatus', must be one of '%s'", + "invalid value '%s' for 'campaignStatus', must be one of '%s'", + $this->container['campaignStatus'], implode("', '", $allowedValues) ); } @@ -296,24 +289,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -325,8 +306,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -337,7 +321,7 @@ public function setId($id) * * @return string */ - public function getCampaignName() + public function getCampaignName(): string { return $this->container['campaignName']; } @@ -349,8 +333,11 @@ public function getCampaignName() * * @return $this */ - public function setCampaignName($campaignName) + public function setCampaignName(string $campaignName): static { + if (is_null($campaignName)) { + throw new InvalidArgumentException('non-nullable campaignName cannot be null'); + } $this->container['campaignName'] = $campaignName; return $this; @@ -361,7 +348,7 @@ public function setCampaignName($campaignName) * * @return string */ - public function getCampaignStatus() + public function getCampaignStatus(): string { return $this->container['campaignStatus']; } @@ -373,13 +360,17 @@ public function getCampaignStatus() * * @return $this */ - public function setCampaignStatus($campaignStatus) + public function setCampaignStatus(string $campaignStatus): static { + if (is_null($campaignStatus)) { + throw new InvalidArgumentException('non-nullable campaignStatus cannot be null'); + } $allowedValues = $this->getCampaignStatusAllowableValues(); if (!in_array($campaignStatus, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'campaignStatus', must be one of '%s'", + "Invalid value '%s' for 'campaignStatus', must be one of '%s'", + $campaignStatus, implode("', '", $allowedValues) ) ); @@ -389,36 +380,12 @@ public function setCampaignStatus($campaignStatus) return $this; } - /** - * Gets scheduledAt - * - * @return string - */ - public function getScheduledAt() - { - return $this->container['scheduledAt']; - } - - /** - * Sets scheduledAt - * - * @param string $scheduledAt UTC date-time on which WhatsApp campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format - * - * @return $this - */ - public function setScheduledAt($scheduledAt) - { - $this->container['scheduledAt'] = $scheduledAt; - - return $this; - } - /** * Gets senderNumber * * @return string */ - public function getSenderNumber() + public function getSenderNumber(): string { return $this->container['senderNumber']; } @@ -430,43 +397,22 @@ public function getSenderNumber() * * @return $this */ - public function setSenderNumber($senderNumber) + public function setSenderNumber(string $senderNumber): static { + if (is_null($senderNumber)) { + throw new InvalidArgumentException('non-nullable senderNumber cannot be null'); + } $this->container['senderNumber'] = $senderNumber; return $this; } - /** - * Gets stats - * - * @return \Brevo\Client\Models\WhatsappCampStats - */ - public function getStats() - { - return $this->container['stats']; - } - - /** - * Sets stats - * - * @param \Brevo\Client\Models\WhatsappCampStats $stats stats - * - * @return $this - */ - public function setStats($stats) - { - $this->container['stats'] = $stats; - - return $this; - } - /** * Gets template * * @return \Brevo\Client\Models\WhatsappCampTemplate */ - public function getTemplate() + public function getTemplate(): \Brevo\Client\Models\WhatsappCampTemplate { return $this->container['template']; } @@ -478,8 +424,11 @@ public function getTemplate() * * @return $this */ - public function setTemplate($template) + public function setTemplate(\Brevo\Client\Models\WhatsappCampTemplate $template): static { + if (is_null($template)) { + throw new InvalidArgumentException('non-nullable template cannot be null'); + } $this->container['template'] = $template; return $this; @@ -490,7 +439,7 @@ public function setTemplate($template) * * @return string */ - public function getCreatedAt() + public function getCreatedAt(): string { return $this->container['createdAt']; } @@ -502,8 +451,11 @@ public function getCreatedAt() * * @return $this */ - public function setCreatedAt($createdAt) + public function setCreatedAt(string $createdAt): static { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } $this->container['createdAt'] = $createdAt; return $this; @@ -514,7 +466,7 @@ public function setCreatedAt($createdAt) * * @return string */ - public function getModifiedAt() + public function getModifiedAt(): string { return $this->container['modifiedAt']; } @@ -526,84 +478,68 @@ public function getModifiedAt() * * @return $this */ - public function setModifiedAt($modifiedAt) + public function setModifiedAt(string $modifiedAt): static { + if (is_null($modifiedAt)) { + throw new InvalidArgumentException('non-nullable modifiedAt cannot be null'); + } $this->container['modifiedAt'] = $modifiedAt; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } /** - * Gets offset. - * - * @param integer $offset Offset + * Gets scheduledAt * - * @return mixed + * @return string|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function getScheduledAt(): ?string { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container['scheduledAt']; } /** - * Sets value based on offset. + * Sets scheduledAt * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param string|null $scheduledAt UTC date-time on which WhatsApp campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format * - * @return void + * @return $this */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function setScheduledAt(?string $scheduledAt): static { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; + if (is_null($scheduledAt)) { + throw new InvalidArgumentException('non-nullable scheduledAt cannot be null'); } + $this->container['scheduledAt'] = $scheduledAt; + + return $this; } /** - * Unsets offset. - * - * @param integer $offset Offset + * Gets stats * - * @return void + * @return \Brevo\Client\Models\WhatsappCampStats|null */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) + public function getStats(): ?\Brevo\Client\Models\WhatsappCampStats { - unset($this->container[$offset]); + return $this->container['stats']; } /** - * Gets the string presentation of the object + * Sets stats * - * @return string + * @param \Brevo\Client\Models\WhatsappCampStats|null $stats stats + * + * @return $this */ - public function __toString() + public function setStats(?\Brevo\Client\Models\WhatsappCampStats $stats): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($stats)) { + throw new InvalidArgumentException('non-nullable stats cannot be null'); } + $this->container['stats'] = $stats; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/GetWhatsappCampaigns.php b/lib/Models/GetWhatsappCampaigns.php index 92f53e7..7bfe7f7 100644 --- a/lib/Models/GetWhatsappCampaigns.php +++ b/lib/Models/GetWhatsappCampaigns.php @@ -2,102 +2,101 @@ /** * GetWhatsappCampaigns * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetWhatsappCampaigns Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetWhatsappCampaigns implements ModelInterface, ArrayAccess +class GetWhatsappCampaigns extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getWhatsappCampaigns'; + protected static string $openAPIModelName = 'getWhatsappCampaigns'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'campaigns' => '\Brevo\Client\Models\GetWhatsappCampaignsCampaigns[]', + protected static array $openAPITypes = [ + 'campaigns' => '\Brevo\Client\Models\GetWhatsappCampaignsCampaignsInner[]', 'count' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'campaigns' => null, 'count' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'campaigns' => false, + 'count' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'campaigns' => 'campaigns', 'count' => 'count' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'campaigns' => 'setCampaigns', 'count' => 'setCount' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'campaigns' => 'getCampaigns', 'count' => 'getCount' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +145,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['campaigns'] = isset($data['campaigns']) ? $data['campaigns'] : null; - $this->container['count'] = isset($data['count']) ? $data['count'] : null; + $this->setIfExists('campaigns', $data ?? [], null); + $this->setIfExists('count', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets campaigns * - * @return \Brevo\Client\Models\GetWhatsappCampaignsCampaigns[] + * @return \Brevo\Client\Models\GetWhatsappCampaignsCampaignsInner[]|null */ - public function getCampaigns() + public function getCampaigns(): ?array { return $this->container['campaigns']; } @@ -223,12 +196,15 @@ public function getCampaigns() /** * Sets campaigns * - * @param \Brevo\Client\Models\GetWhatsappCampaignsCampaigns[] $campaigns campaigns + * @param \Brevo\Client\Models\GetWhatsappCampaignsCampaignsInner[]|null $campaigns campaigns * * @return $this */ - public function setCampaigns($campaigns) + public function setCampaigns(?array $campaigns): static { + if (is_null($campaigns)) { + throw new InvalidArgumentException('non-nullable campaigns cannot be null'); + } $this->container['campaigns'] = $campaigns; return $this; @@ -237,9 +213,9 @@ public function setCampaigns($campaigns) /** * Gets count * - * @return int + * @return int|null */ - public function getCount() + public function getCount(): ?int { return $this->container['count']; } @@ -247,89 +223,19 @@ public function getCount() /** * Sets count * - * @param int $count Number of WhatsApp campaigns retrived + * @param int|null $count Number of WhatsApp campaigns retrieved * * @return $this */ - public function setCount($count) + public function setCount(?int $count): static { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } $this->container['count'] = $count; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetWhatsappCampaignsCampaigns.php b/lib/Models/GetWhatsappCampaignsCampaignsInner.php similarity index 56% rename from lib/Models/GetWhatsappCampaignsCampaigns.php rename to lib/Models/GetWhatsappCampaignsCampaignsInner.php index ab44aea..d971483 100644 --- a/lib/Models/GetWhatsappCampaignsCampaigns.php +++ b/lib/Models/GetWhatsappCampaignsCampaignsInner.php @@ -1,179 +1,187 @@ */ -class GetWhatsappCampaignsCampaigns implements ModelInterface, ArrayAccess +class GetWhatsappCampaignsCampaignsInner extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getWhatsappCampaigns_campaigns'; + protected static string $openAPIModelName = 'getWhatsappCampaigns_campaigns_inner'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'campaignName' => 'string', 'templateId' => 'string', 'campaignStatus' => 'string', 'scheduledAt' => 'string', + 'createdAt' => 'string', + 'modifiedAt' => 'string', 'errorReason' => 'string', 'invalidatedContacts' => 'int', 'readPercentage' => 'float', - 'stats' => '\Brevo\Client\Models\WhatsappCampStats', - 'createdAt' => 'string', - 'modifiedAt' => 'string' + 'stats' => '\Brevo\Client\Models\WhatsappCampStats' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'campaignName' => null, 'templateId' => null, 'campaignStatus' => null, 'scheduledAt' => null, + 'createdAt' => null, + 'modifiedAt' => null, 'errorReason' => null, 'invalidatedContacts' => 'int64', 'readPercentage' => 'float', - 'stats' => null, - 'createdAt' => null, - 'modifiedAt' => null + 'stats' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'campaignName' => false, + 'templateId' => false, + 'campaignStatus' => false, + 'scheduledAt' => false, + 'createdAt' => false, + 'modifiedAt' => false, + 'errorReason' => false, + 'invalidatedContacts' => false, + 'readPercentage' => false, + 'stats' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'campaignName' => 'campaignName', 'templateId' => 'templateId', 'campaignStatus' => 'campaignStatus', 'scheduledAt' => 'scheduledAt', + 'createdAt' => 'createdAt', + 'modifiedAt' => 'modifiedAt', 'errorReason' => 'errorReason', 'invalidatedContacts' => 'invalidatedContacts', 'readPercentage' => 'readPercentage', - 'stats' => 'stats', - 'createdAt' => 'createdAt', - 'modifiedAt' => 'modifiedAt' + 'stats' => 'stats' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'campaignName' => 'setCampaignName', 'templateId' => 'setTemplateId', 'campaignStatus' => 'setCampaignStatus', 'scheduledAt' => 'setScheduledAt', + 'createdAt' => 'setCreatedAt', + 'modifiedAt' => 'setModifiedAt', 'errorReason' => 'setErrorReason', 'invalidatedContacts' => 'setInvalidatedContacts', 'readPercentage' => 'setReadPercentage', - 'stats' => 'setStats', - 'createdAt' => 'setCreatedAt', - 'modifiedAt' => 'setModifiedAt' + 'stats' => 'setStats' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'campaignName' => 'getCampaignName', 'templateId' => 'getTemplateId', 'campaignStatus' => 'getCampaignStatus', 'scheduledAt' => 'getScheduledAt', + 'createdAt' => 'getCreatedAt', + 'modifiedAt' => 'getModifiedAt', 'errorReason' => 'getErrorReason', 'invalidatedContacts' => 'getInvalidatedContacts', 'readPercentage' => 'getReadPercentage', - 'stats' => 'getStats', - 'createdAt' => 'getCreatedAt', - 'modifiedAt' => 'getModifiedAt' + 'stats' => 'getStats' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -181,9 +189,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -191,34 +199,22 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } + public const CAMPAIGN_STATUS_DRAFT = 'draft'; + public const CAMPAIGN_STATUS_SCHEDULED = 'scheduled'; + public const CAMPAIGN_STATUS_PENDING = 'pending'; + public const CAMPAIGN_STATUS_APPROVED = 'approved'; + public const CAMPAIGN_STATUS_RUNNING = 'running'; + public const CAMPAIGN_STATUS_SUSPENDED = 'suspended'; + public const CAMPAIGN_STATUS_REJECTED = 'rejected'; + public const CAMPAIGN_STATUS_SENT = 'sent'; - const CAMPAIGN_STATUS_DRAFT = 'draft'; - const CAMPAIGN_STATUS_SCHEDULED = 'scheduled'; - const CAMPAIGN_STATUS_PENDING = 'pending'; - const CAMPAIGN_STATUS_APPROVED = 'approved'; - const CAMPAIGN_STATUS_RUNNING = 'running'; - const CAMPAIGN_STATUS_SUSPENDED = 'suspended'; - const CAMPAIGN_STATUS_REJECTED = 'rejected'; - const CAMPAIGN_STATUS_SENT = 'sent'; - - - /** * Gets allowable values of the enum * @@ -237,42 +233,40 @@ public function getCampaignStatusAllowableValues() self::CAMPAIGN_STATUS_SENT, ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['campaignName'] = isset($data['campaignName']) ? $data['campaignName'] : null; - $this->container['templateId'] = isset($data['templateId']) ? $data['templateId'] : null; - $this->container['campaignStatus'] = isset($data['campaignStatus']) ? $data['campaignStatus'] : null; - $this->container['scheduledAt'] = isset($data['scheduledAt']) ? $data['scheduledAt'] : null; - $this->container['errorReason'] = isset($data['errorReason']) ? $data['errorReason'] : null; - $this->container['invalidatedContacts'] = isset($data['invalidatedContacts']) ? $data['invalidatedContacts'] : null; - $this->container['readPercentage'] = isset($data['readPercentage']) ? $data['readPercentage'] : null; - $this->container['stats'] = isset($data['stats']) ? $data['stats'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['modifiedAt'] = isset($data['modifiedAt']) ? $data['modifiedAt'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('campaignName', $data ?? [], null); + $this->setIfExists('templateId', $data ?? [], null); + $this->setIfExists('campaignStatus', $data ?? [], null); + $this->setIfExists('scheduledAt', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('modifiedAt', $data ?? [], null); + $this->setIfExists('errorReason', $data ?? [], null); + $this->setIfExists('invalidatedContacts', $data ?? [], null); + $this->setIfExists('readPercentage', $data ?? [], null); + $this->setIfExists('stats', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -291,7 +285,8 @@ public function listInvalidProperties() $allowedValues = $this->getCampaignStatusAllowableValues(); if (!is_null($this->container['campaignStatus']) && !in_array($this->container['campaignStatus'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'campaignStatus', must be one of '%s'", + "invalid value '%s' for 'campaignStatus', must be one of '%s'", + $this->container['campaignStatus'], implode("', '", $allowedValues) ); } @@ -308,24 +303,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -337,8 +320,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -349,7 +335,7 @@ public function setId($id) * * @return string */ - public function getCampaignName() + public function getCampaignName(): string { return $this->container['campaignName']; } @@ -361,8 +347,11 @@ public function getCampaignName() * * @return $this */ - public function setCampaignName($campaignName) + public function setCampaignName(string $campaignName): static { + if (is_null($campaignName)) { + throw new InvalidArgumentException('non-nullable campaignName cannot be null'); + } $this->container['campaignName'] = $campaignName; return $this; @@ -373,7 +362,7 @@ public function setCampaignName($campaignName) * * @return string */ - public function getTemplateId() + public function getTemplateId(): string { return $this->container['templateId']; } @@ -385,8 +374,11 @@ public function getTemplateId() * * @return $this */ - public function setTemplateId($templateId) + public function setTemplateId(string $templateId): static { + if (is_null($templateId)) { + throw new InvalidArgumentException('non-nullable templateId cannot be null'); + } $this->container['templateId'] = $templateId; return $this; @@ -397,7 +389,7 @@ public function setTemplateId($templateId) * * @return string */ - public function getCampaignStatus() + public function getCampaignStatus(): string { return $this->container['campaignStatus']; } @@ -409,13 +401,17 @@ public function getCampaignStatus() * * @return $this */ - public function setCampaignStatus($campaignStatus) + public function setCampaignStatus(string $campaignStatus): static { + if (is_null($campaignStatus)) { + throw new InvalidArgumentException('non-nullable campaignStatus cannot be null'); + } $allowedValues = $this->getCampaignStatusAllowableValues(); if (!in_array($campaignStatus, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'campaignStatus', must be one of '%s'", + "Invalid value '%s' for 'campaignStatus', must be one of '%s'", + $campaignStatus, implode("', '", $allowedValues) ) ); @@ -430,7 +426,7 @@ public function setCampaignStatus($campaignStatus) * * @return string */ - public function getScheduledAt() + public function getScheduledAt(): string { return $this->container['scheduledAt']; } @@ -442,228 +438,176 @@ public function getScheduledAt() * * @return $this */ - public function setScheduledAt($scheduledAt) + public function setScheduledAt(string $scheduledAt): static { + if (is_null($scheduledAt)) { + throw new InvalidArgumentException('non-nullable scheduledAt cannot be null'); + } $this->container['scheduledAt'] = $scheduledAt; return $this; } /** - * Gets errorReason + * Gets createdAt * * @return string */ - public function getErrorReason() + public function getCreatedAt(): string { - return $this->container['errorReason']; + return $this->container['createdAt']; } /** - * Sets errorReason + * Sets createdAt * - * @param string $errorReason Error reason in the campaign creation + * @param string $createdAt Creation UTC date-time of the WhatsApp template (YYYY-MM-DDTHH:mm:ss.SSSZ) * * @return $this */ - public function setErrorReason($errorReason) + public function setCreatedAt(string $createdAt): static { - $this->container['errorReason'] = $errorReason; + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; return $this; } /** - * Gets invalidatedContacts + * Gets modifiedAt * - * @return int + * @return string */ - public function getInvalidatedContacts() + public function getModifiedAt(): string { - return $this->container['invalidatedContacts']; + return $this->container['modifiedAt']; } /** - * Sets invalidatedContacts + * Sets modifiedAt * - * @param int $invalidatedContacts Count of invalidated contacts + * @param string $modifiedAt UTC date-time of last modification of the WhatsApp template (YYYY-MM-DDTHH:mm:ss.SSSZ) * * @return $this */ - public function setInvalidatedContacts($invalidatedContacts) + public function setModifiedAt(string $modifiedAt): static { - $this->container['invalidatedContacts'] = $invalidatedContacts; + if (is_null($modifiedAt)) { + throw new InvalidArgumentException('non-nullable modifiedAt cannot be null'); + } + $this->container['modifiedAt'] = $modifiedAt; return $this; } /** - * Gets readPercentage + * Gets errorReason * - * @return float + * @return string|null */ - public function getReadPercentage() + public function getErrorReason(): ?string { - return $this->container['readPercentage']; + return $this->container['errorReason']; } /** - * Sets readPercentage + * Sets errorReason * - * @param float $readPercentage Read percentage of the the WhatsApp campaign created + * @param string|null $errorReason Error Reason associated with the WhatsApp campaign sending * * @return $this */ - public function setReadPercentage($readPercentage) + public function setErrorReason(?string $errorReason): static { - $this->container['readPercentage'] = $readPercentage; + if (is_null($errorReason)) { + throw new InvalidArgumentException('non-nullable errorReason cannot be null'); + } + $this->container['errorReason'] = $errorReason; return $this; } /** - * Gets stats + * Gets invalidatedContacts * - * @return \Brevo\Client\Models\WhatsappCampStats + * @return int|null */ - public function getStats() + public function getInvalidatedContacts(): ?int { - return $this->container['stats']; + return $this->container['invalidatedContacts']; } /** - * Sets stats + * Sets invalidatedContacts * - * @param \Brevo\Client\Models\WhatsappCampStats $stats stats + * @param int|null $invalidatedContacts Count of invalidated contacts * * @return $this */ - public function setStats($stats) + public function setInvalidatedContacts(?int $invalidatedContacts): static { - $this->container['stats'] = $stats; + if (is_null($invalidatedContacts)) { + throw new InvalidArgumentException('non-nullable invalidatedContacts cannot be null'); + } + $this->container['invalidatedContacts'] = $invalidatedContacts; return $this; } /** - * Gets createdAt + * Gets readPercentage * - * @return string + * @return float|null */ - public function getCreatedAt() + public function getReadPercentage(): ?float { - return $this->container['createdAt']; + return $this->container['readPercentage']; } /** - * Sets createdAt + * Sets readPercentage * - * @param string $createdAt Creation UTC date-time of the WhatsApp campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + * @param float|null $readPercentage Read percentage of the the WhatsApp campaign created * * @return $this */ - public function setCreatedAt($createdAt) + public function setReadPercentage(?float $readPercentage): static { - $this->container['createdAt'] = $createdAt; + if (is_null($readPercentage)) { + throw new InvalidArgumentException('non-nullable readPercentage cannot be null'); + } + $this->container['readPercentage'] = $readPercentage; return $this; } /** - * Gets modifiedAt + * Gets stats * - * @return string + * @return \Brevo\Client\Models\WhatsappCampStats|null */ - public function getModifiedAt() + public function getStats(): ?\Brevo\Client\Models\WhatsappCampStats { - return $this->container['modifiedAt']; + return $this->container['stats']; } /** - * Sets modifiedAt + * Sets stats * - * @param string $modifiedAt UTC date-time of last modification of the whatsapp template (YYYY-MM-DDTHH:mm:ss.SSSZ) + * @param \Brevo\Client\Models\WhatsappCampStats|null $stats stats * * @return $this */ - public function setModifiedAt($modifiedAt) + public function setStats(?\Brevo\Client\Models\WhatsappCampStats $stats): static { - $this->container['modifiedAt'] = $modifiedAt; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($stats)) { + throw new InvalidArgumentException('non-nullable stats cannot be null'); } + $this->container['stats'] = $stats; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/GetWhatsappEventReport.php b/lib/Models/GetWhatsappEventReport.php index 3724ecd..c953ffb 100644 --- a/lib/Models/GetWhatsappEventReport.php +++ b/lib/Models/GetWhatsappEventReport.php @@ -2,118 +2,116 @@ /** * GetWhatsappEventReport * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * GetWhatsappEventReport Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class GetWhatsappEventReport implements ModelInterface, ArrayAccess +class GetWhatsappEventReport extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getWhatsappEventReport'; + protected static string $openAPIModelName = 'getWhatsappEventReport'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'events' => '\Brevo\Client\Models\GetWhatsappEventReportEvents[]' + protected static array $openAPITypes = [ + 'events' => '\Brevo\Client\Models\GetWhatsappEventReportEventsInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'events' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'events' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'events' => 'events' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'events' => 'setEvents' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'events' => 'getEvents' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,75 +139,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['events'] = isset($data['events']) ? $data['events'] : null; + $this->setIfExists('events', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets events * - * @return \Brevo\Client\Models\GetWhatsappEventReportEvents[] + * @return \Brevo\Client\Models\GetWhatsappEventReportEventsInner[]|null */ - public function getEvents() + public function getEvents(): ?array { return $this->container['events']; } @@ -217,89 +189,19 @@ public function getEvents() /** * Sets events * - * @param \Brevo\Client\Models\GetWhatsappEventReportEvents[] $events events + * @param \Brevo\Client\Models\GetWhatsappEventReportEventsInner[]|null $events events * * @return $this */ - public function setEvents($events) + public function setEvents(?array $events): static { + if (is_null($events)) { + throw new InvalidArgumentException('non-nullable events cannot be null'); + } $this->container['events'] = $events; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/GetWhatsappEventReportEvents.php b/lib/Models/GetWhatsappEventReportEventsInner.php similarity index 53% rename from lib/Models/GetWhatsappEventReportEvents.php rename to lib/Models/GetWhatsappEventReportEventsInner.php index eeca293..26a7a79 100644 --- a/lib/Models/GetWhatsappEventReportEvents.php +++ b/lib/Models/GetWhatsappEventReportEventsInner.php @@ -1,164 +1,169 @@ */ -class GetWhatsappEventReportEvents implements ModelInterface, ArrayAccess +class GetWhatsappEventReportEventsInner extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getWhatsappEventReport_events'; + protected static string $openAPIModelName = 'getWhatsappEventReport_events_inner'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'contactNumber' => 'string', 'date' => 'string', 'messageId' => 'string', 'event' => 'string', + 'senderNumber' => 'string', 'reason' => 'string', 'body' => 'string', - 'mediaUrl' => 'string', - 'senderNumber' => 'string' + 'mediaUrl' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'contactNumber' => 'mobile', 'date' => null, 'messageId' => null, 'event' => null, + 'senderNumber' => 'mobile', 'reason' => null, 'body' => null, - 'mediaUrl' => 'url', - 'senderNumber' => 'mobile' + 'mediaUrl' => 'url' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'contactNumber' => false, + 'date' => false, + 'messageId' => false, + 'event' => false, + 'senderNumber' => false, + 'reason' => false, + 'body' => false, + 'mediaUrl' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'contactNumber' => 'contactNumber', 'date' => 'date', 'messageId' => 'messageId', 'event' => 'event', + 'senderNumber' => 'senderNumber', 'reason' => 'reason', 'body' => 'body', - 'mediaUrl' => 'mediaUrl', - 'senderNumber' => 'senderNumber' + 'mediaUrl' => 'mediaUrl' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'contactNumber' => 'setContactNumber', 'date' => 'setDate', 'messageId' => 'setMessageId', 'event' => 'setEvent', + 'senderNumber' => 'setSenderNumber', 'reason' => 'setReason', 'body' => 'setBody', - 'mediaUrl' => 'setMediaUrl', - 'senderNumber' => 'setSenderNumber' + 'mediaUrl' => 'setMediaUrl' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'contactNumber' => 'getContactNumber', 'date' => 'getDate', 'messageId' => 'getMessageId', 'event' => 'getEvent', + 'senderNumber' => 'getSenderNumber', 'reason' => 'getReason', 'body' => 'getBody', - 'mediaUrl' => 'getMediaUrl', - 'senderNumber' => 'getSenderNumber' + 'mediaUrl' => 'getMediaUrl' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -166,9 +171,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -176,32 +181,20 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const EVENT_SENT = 'sent'; - const EVENT_DELIVERED = 'delivered'; - const EVENT_READ = 'read'; - const EVENT_ERROR = 'error'; - const EVENT_UNSUBSCRIBE = 'unsubscribe'; - const EVENT_REPLY = 'reply'; - const EVENT_SOFT_BOUNCE = 'soft-bounce'; - - + public const EVENT_SENT = 'sent'; + public const EVENT_DELIVERED = 'delivered'; + public const EVENT_READ = 'read'; + public const EVENT_ERROR = 'error'; + public const EVENT_UNSUBSCRIBE = 'unsubscribe'; + public const EVENT_REPLY = 'reply'; + public const EVENT_SOFT_BOUNCE = 'soft-bounce'; /** * Gets allowable values of the enum @@ -221,38 +214,36 @@ public function getEventAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['contactNumber'] = isset($data['contactNumber']) ? $data['contactNumber'] : null; - $this->container['date'] = isset($data['date']) ? $data['date'] : null; - $this->container['messageId'] = isset($data['messageId']) ? $data['messageId'] : null; - $this->container['event'] = isset($data['event']) ? $data['event'] : null; - $this->container['reason'] = isset($data['reason']) ? $data['reason'] : null; - $this->container['body'] = isset($data['body']) ? $data['body'] : null; - $this->container['mediaUrl'] = isset($data['mediaUrl']) ? $data['mediaUrl'] : null; - $this->container['senderNumber'] = isset($data['senderNumber']) ? $data['senderNumber'] : null; + $this->setIfExists('contactNumber', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('messageId', $data ?? [], null); + $this->setIfExists('event', $data ?? [], null); + $this->setIfExists('senderNumber', $data ?? [], null); + $this->setIfExists('reason', $data ?? [], null); + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('mediaUrl', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -271,7 +262,8 @@ public function listInvalidProperties() $allowedValues = $this->getEventAllowableValues(); if (!is_null($this->container['event']) && !in_array($this->container['event'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'event', must be one of '%s'", + "invalid value '%s' for 'event', must be one of '%s'", + $this->container['event'], implode("', '", $allowedValues) ); } @@ -282,24 +274,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets contactNumber * * @return string */ - public function getContactNumber() + public function getContactNumber(): string { return $this->container['contactNumber']; } @@ -311,8 +291,11 @@ public function getContactNumber() * * @return $this */ - public function setContactNumber($contactNumber) + public function setContactNumber(string $contactNumber): static { + if (is_null($contactNumber)) { + throw new InvalidArgumentException('non-nullable contactNumber cannot be null'); + } $this->container['contactNumber'] = $contactNumber; return $this; @@ -323,7 +306,7 @@ public function setContactNumber($contactNumber) * * @return string */ - public function getDate() + public function getDate(): string { return $this->container['date']; } @@ -335,8 +318,11 @@ public function getDate() * * @return $this */ - public function setDate($date) + public function setDate(string $date): static { + if (is_null($date)) { + throw new InvalidArgumentException('non-nullable date cannot be null'); + } $this->container['date'] = $date; return $this; @@ -347,7 +333,7 @@ public function setDate($date) * * @return string */ - public function getMessageId() + public function getMessageId(): string { return $this->container['messageId']; } @@ -359,8 +345,11 @@ public function getMessageId() * * @return $this */ - public function setMessageId($messageId) + public function setMessageId(string $messageId): static { + if (is_null($messageId)) { + throw new InvalidArgumentException('non-nullable messageId cannot be null'); + } $this->container['messageId'] = $messageId; return $this; @@ -371,7 +360,7 @@ public function setMessageId($messageId) * * @return string */ - public function getEvent() + public function getEvent(): string { return $this->container['event']; } @@ -383,13 +372,17 @@ public function getEvent() * * @return $this */ - public function setEvent($event) + public function setEvent(string $event): static { + if (is_null($event)) { + throw new InvalidArgumentException('non-nullable event cannot be null'); + } $allowedValues = $this->getEventAllowableValues(); if (!in_array($event, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'event', must be one of '%s'", + "Invalid value '%s' for 'event', must be one of '%s'", + $event, implode("', '", $allowedValues) ) ); @@ -400,172 +393,111 @@ public function setEvent($event) } /** - * Gets reason + * Gets senderNumber * * @return string */ - public function getReason() + public function getSenderNumber(): string { - return $this->container['reason']; + return $this->container['senderNumber']; } /** - * Sets reason + * Sets senderNumber * - * @param string $reason Reason for the event (will be there in case of `error` and `soft-bounce` events) + * @param string $senderNumber WhatsApp Number with country code. Example, 85264318721 * * @return $this */ - public function setReason($reason) + public function setSenderNumber(string $senderNumber): static { - $this->container['reason'] = $reason; + if (is_null($senderNumber)) { + throw new InvalidArgumentException('non-nullable senderNumber cannot be null'); + } + $this->container['senderNumber'] = $senderNumber; return $this; } /** - * Gets body + * Gets reason * - * @return string + * @return string|null */ - public function getBody() + public function getReason(): ?string { - return $this->container['body']; + return $this->container['reason']; } /** - * Sets body + * Sets reason * - * @param string $body Text of the reply (will be there only in case of `reply` event with text) + * @param string|null $reason Reason for the event (will be there in case of `error` and `soft-bounce` events) * * @return $this */ - public function setBody($body) + public function setReason(?string $reason): static { - $this->container['body'] = $body; + if (is_null($reason)) { + throw new InvalidArgumentException('non-nullable reason cannot be null'); + } + $this->container['reason'] = $reason; return $this; } /** - * Gets mediaUrl + * Gets body * - * @return string + * @return string|null */ - public function getMediaUrl() + public function getBody(): ?string { - return $this->container['mediaUrl']; + return $this->container['body']; } /** - * Sets mediaUrl + * Sets body * - * @param string $mediaUrl Url of the media reply (will be there only in case of `reply` event with media) + * @param string|null $body Text of the reply (will be there only in case of `reply` event with text) * * @return $this */ - public function setMediaUrl($mediaUrl) + public function setBody(?string $body): static { - $this->container['mediaUrl'] = $mediaUrl; + if (is_null($body)) { + throw new InvalidArgumentException('non-nullable body cannot be null'); + } + $this->container['body'] = $body; return $this; } /** - * Gets senderNumber + * Gets mediaUrl * - * @return string + * @return string|null */ - public function getSenderNumber() + public function getMediaUrl(): ?string { - return $this->container['senderNumber']; + return $this->container['mediaUrl']; } /** - * Sets senderNumber + * Sets mediaUrl * - * @param string $senderNumber WhatsApp Number with country code. Example, 85264318721 + * @param string|null $mediaUrl Url of the media reply (will be there only in case of `reply` event with media) * * @return $this */ - public function setSenderNumber($senderNumber) - { - $this->container['senderNumber'] = $senderNumber; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() + public function setMediaUrl(?string $mediaUrl): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($mediaUrl)) { + throw new InvalidArgumentException('non-nullable mediaUrl cannot be null'); } + $this->container['mediaUrl'] = $mediaUrl; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/GetWhatsappTemplates.php b/lib/Models/GetWhatsappTemplates.php new file mode 100644 index 0000000..3fcd268 --- /dev/null +++ b/lib/Models/GetWhatsappTemplates.php @@ -0,0 +1,241 @@ + + */ +class GetWhatsappTemplates extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getWhatsappTemplates'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'templates' => '\Brevo\Client\Models\GetWhatsappTemplatesTemplatesInner[]', + 'count' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'templates' => null, + 'count' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'templates' => false, + 'count' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'templates' => 'templates', + 'count' => 'count' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'templates' => 'setTemplates', + 'count' => 'setCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'templates' => 'getTemplates', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('templates', $data ?? [], null); + $this->setIfExists('count', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets templates + * + * @return \Brevo\Client\Models\GetWhatsappTemplatesTemplatesInner[]|null + */ + public function getTemplates(): ?array + { + return $this->container['templates']; + } + + /** + * Sets templates + * + * @param \Brevo\Client\Models\GetWhatsappTemplatesTemplatesInner[]|null $templates templates + * + * @return $this + */ + public function setTemplates(?array $templates): static + { + if (is_null($templates)) { + throw new InvalidArgumentException('non-nullable templates cannot be null'); + } + $this->container['templates'] = $templates; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount(): ?int + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Number of WhatsApp templates retrieved + * + * @return $this + */ + public function setCount(?int $count): static + { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } + $this->container['count'] = $count; + + return $this; + } +} + + diff --git a/lib/Models/GetWATemplatesTemplates.php b/lib/Models/GetWhatsappTemplatesTemplatesInner.php similarity index 52% rename from lib/Models/GetWATemplatesTemplates.php rename to lib/Models/GetWhatsappTemplatesTemplatesInner.php index fe683c8..a886dad 100644 --- a/lib/Models/GetWATemplatesTemplates.php +++ b/lib/Models/GetWhatsappTemplatesTemplatesInner.php @@ -1,164 +1,169 @@ */ -class GetWATemplatesTemplates implements ModelInterface, ArrayAccess +class GetWhatsappTemplatesTemplatesInner extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'getWATemplates_templates'; + protected static string $openAPIModelName = 'getWhatsappTemplates_templates_inner'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'id' => 'string', + protected static array $openAPITypes = [ + 'id' => 'int', 'name' => 'string', 'status' => 'string', 'language' => 'string', 'category' => 'string', - 'errorReason' => 'string', 'createdAt' => 'string', - 'modifiedAt' => 'string' + 'modifiedAt' => 'string', + 'errorReason' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'id' => null, + protected static array $openAPIFormats = [ + 'id' => 'int64', 'name' => null, 'status' => null, 'language' => null, 'category' => null, - 'errorReason' => null, 'createdAt' => null, - 'modifiedAt' => null + 'modifiedAt' => null, + 'errorReason' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'status' => false, + 'language' => false, + 'category' => false, + 'createdAt' => false, + 'modifiedAt' => false, + 'errorReason' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name', 'status' => 'status', 'language' => 'language', 'category' => 'category', - 'errorReason' => 'errorReason', 'createdAt' => 'createdAt', - 'modifiedAt' => 'modifiedAt' + 'modifiedAt' => 'modifiedAt', + 'errorReason' => 'errorReason' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName', 'status' => 'setStatus', 'language' => 'setLanguage', 'category' => 'setCategory', - 'errorReason' => 'setErrorReason', 'createdAt' => 'setCreatedAt', - 'modifiedAt' => 'setModifiedAt' + 'modifiedAt' => 'setModifiedAt', + 'errorReason' => 'setErrorReason' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName', 'status' => 'getStatus', 'language' => 'getLanguage', 'category' => 'getCategory', - 'errorReason' => 'getErrorReason', 'createdAt' => 'getCreatedAt', - 'modifiedAt' => 'getModifiedAt' + 'modifiedAt' => 'getModifiedAt', + 'errorReason' => 'getErrorReason' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -166,9 +171,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -176,58 +181,44 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['language'] = isset($data['language']) ? $data['language'] : null; - $this->container['category'] = isset($data['category']) ? $data['category'] : null; - $this->container['errorReason'] = isset($data['errorReason']) ? $data['errorReason'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['modifiedAt'] = isset($data['modifiedAt']) ? $data['modifiedAt'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('language', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('modifiedAt', $data ?? [], null); + $this->setIfExists('errorReason', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -255,24 +246,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * - * @return string + * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -280,12 +259,15 @@ public function getId() /** * Sets id * - * @param string $id id of the template + * @param int $id ID of the WhatsApp template * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -296,7 +278,7 @@ public function setId($id) * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -308,8 +290,11 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName(string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -320,7 +305,7 @@ public function setName($name) * * @return string */ - public function getStatus() + public function getStatus(): string { return $this->container['status']; } @@ -332,8 +317,11 @@ public function getStatus() * * @return $this */ - public function setStatus($status) + public function setStatus(string $status): static { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -344,7 +332,7 @@ public function setStatus($status) * * @return string */ - public function getLanguage() + public function getLanguage(): string { return $this->container['language']; } @@ -356,8 +344,11 @@ public function getLanguage() * * @return $this */ - public function setLanguage($language) + public function setLanguage(string $language): static { + if (is_null($language)) { + throw new InvalidArgumentException('non-nullable language cannot be null'); + } $this->container['language'] = $language; return $this; @@ -368,7 +359,7 @@ public function setLanguage($language) * * @return string */ - public function getCategory() + public function getCategory(): string { return $this->container['category']; } @@ -380,43 +371,22 @@ public function getCategory() * * @return $this */ - public function setCategory($category) + public function setCategory(string $category): static { + if (is_null($category)) { + throw new InvalidArgumentException('non-nullable category cannot be null'); + } $this->container['category'] = $category; return $this; } - /** - * Gets errorReason - * - * @return string - */ - public function getErrorReason() - { - return $this->container['errorReason']; - } - - /** - * Sets errorReason - * - * @param string $errorReason Error reason in the template creation - * - * @return $this - */ - public function setErrorReason($errorReason) - { - $this->container['errorReason'] = $errorReason; - - return $this; - } - /** * Gets createdAt * * @return string */ - public function getCreatedAt() + public function getCreatedAt(): string { return $this->container['createdAt']; } @@ -424,12 +394,15 @@ public function getCreatedAt() /** * Sets createdAt * - * @param string $createdAt Creation UTC date-time of the whatsApp template (YYYY-MM-DDTHH:mm:ss.SSSZ) + * @param string $createdAt Creation UTC date-time of the WhatsApp template (YYYY-MM-DDTHH:mm:ss.SSSZ) * * @return $this */ - public function setCreatedAt($createdAt) + public function setCreatedAt(string $createdAt): static { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } $this->container['createdAt'] = $createdAt; return $this; @@ -440,7 +413,7 @@ public function setCreatedAt($createdAt) * * @return string */ - public function getModifiedAt() + public function getModifiedAt(): string { return $this->container['modifiedAt']; } @@ -448,88 +421,45 @@ public function getModifiedAt() /** * Sets modifiedAt * - * @param string $modifiedAt UTC date-time of last modification of the whatsApp template (YYYY-MM-DDTHH:mm:ss.SSSZ) + * @param string $modifiedAt UTC date-time of last modification of the WhatsApp template (YYYY-MM-DDTHH:mm:ss.SSSZ) * * @return $this */ - public function setModifiedAt($modifiedAt) + public function setModifiedAt(string $modifiedAt): static { + if (is_null($modifiedAt)) { + throw new InvalidArgumentException('non-nullable modifiedAt cannot be null'); + } $this->container['modifiedAt'] = $modifiedAt; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 + * Gets errorReason * - * @return void + * @return string|null */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function getErrorReason(): ?string { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } + return $this->container['errorReason']; } /** - * Unsets offset. - * - * @param integer $offset Offset + * Sets errorReason * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object + * @param string|null $errorReason Error reason in the template creation * - * @return string + * @return $this */ - public function __toString() + public function setErrorReason(?string $errorReason): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($errorReason)) { + throw new InvalidArgumentException('non-nullable errorReason cannot be null'); } + $this->container['errorReason'] = $errorReason; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/InlineResponse200.php b/lib/Models/InlineResponse200.php deleted file mode 100644 index 0df5afd..0000000 --- a/lib/Models/InlineResponse200.php +++ /dev/null @@ -1,335 +0,0 @@ - 'string', - 'groupName' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - 'groupName' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'groupName' => 'groupName' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'groupName' => 'setGroupName' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'groupName' => 'getGroupName' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['groupName'] = isset($data['groupName']) ? $data['groupName'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id Unique id of the group - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets groupName - * - * @return string - */ - public function getGroupName() - { - return $this->container['groupName']; - } - - /** - * Sets groupName - * - * @param string $groupName The name of the group of sub-accounts - * - * @return $this - */ - public function setGroupName($groupName) - { - $this->container['groupName'] = $groupName; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/InlineResponse2001.php b/lib/Models/InlineResponse2001.php deleted file mode 100644 index ad99f5f..0000000 --- a/lib/Models/InlineResponse2001.php +++ /dev/null @@ -1,309 +0,0 @@ - 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - '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 - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id Unique company id - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/InlineResponse2002.php b/lib/Models/InlineResponse2002.php deleted file mode 100644 index 897ef78..0000000 --- a/lib/Models/InlineResponse2002.php +++ /dev/null @@ -1,374 +0,0 @@ - 'string', - 'name' => 'string', - 'defaultCoupon' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => 'uuidv4', - 'name' => 'uuidv4', - 'defaultCoupon' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'name' => 'name', - 'defaultCoupon' => 'defaultCoupon' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'name' => 'setName', - 'defaultCoupon' => 'setDefaultCoupon' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'name' => 'getName', - 'defaultCoupon' => 'getDefaultCoupon' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['defaultCoupon'] = isset($data['defaultCoupon']) ? $data['defaultCoupon'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['defaultCoupon'] === null) { - $invalidProperties[] = "'defaultCoupon' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id The id of the collection - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name The name of the collection - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets defaultCoupon - * - * @return string - */ - public function getDefaultCoupon() - { - return $this->container['defaultCoupon']; - } - - /** - * Sets defaultCoupon - * - * @param string $defaultCoupon The default coupon of the collection - * - * @return $this - */ - public function setDefaultCoupon($defaultCoupon) - { - $this->container['defaultCoupon'] = $defaultCoupon; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/InlineResponse201.php b/lib/Models/InlineResponse201.php deleted file mode 100644 index 9618a07..0000000 --- a/lib/Models/InlineResponse201.php +++ /dev/null @@ -1,305 +0,0 @@ - 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - '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 - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id id - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/InlineResponse2011.php b/lib/Models/InlineResponse2011.php deleted file mode 100644 index dbe5594..0000000 --- a/lib/Models/InlineResponse2011.php +++ /dev/null @@ -1,309 +0,0 @@ - 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - '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 - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id Unique deal id - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/InlineResponse2012.php b/lib/Models/InlineResponse2012.php deleted file mode 100644 index 80ce895..0000000 --- a/lib/Models/InlineResponse2012.php +++ /dev/null @@ -1,309 +0,0 @@ - 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - '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 - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id Unique task id - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/InlineResponse2013.php b/lib/Models/InlineResponse2013.php deleted file mode 100644 index 86d6bed..0000000 --- a/lib/Models/InlineResponse2013.php +++ /dev/null @@ -1,308 +0,0 @@ - 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => 'uuidv4' - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - '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 - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id The id of the created collection - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/InlineResponse2014.php b/lib/Models/InlineResponse2014.php deleted file mode 100644 index 7410025..0000000 --- a/lib/Models/InlineResponse2014.php +++ /dev/null @@ -1,308 +0,0 @@ - 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'messageId' => 'uuidv4' - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - '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 - */ - public function __construct(array $data = null) - { - $this->container['messageId'] = isset($data['messageId']) ? $data['messageId'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['messageId'] === null) { - $invalidProperties[] = "'messageId' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets messageId - * - * @return string - */ - public function getMessageId() - { - return $this->container['messageId']; - } - - /** - * Sets messageId - * - * @param string $messageId messageId of sent message - * - * @return $this - */ - public function setMessageId($messageId) - { - $this->container['messageId'] = $messageId; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/InlineResponse2015.php b/lib/Models/InlineResponse2015.php deleted file mode 100644 index 36ee774..0000000 --- a/lib/Models/InlineResponse2015.php +++ /dev/null @@ -1,308 +0,0 @@ - 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => 'uuidv4' - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - '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 - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id ID of the object created - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/InviteAdminUser.php b/lib/Models/InviteAdminUser.php index 0f1564a..2ce48ff 100644 --- a/lib/Models/InviteAdminUser.php +++ b/lib/Models/InviteAdminUser.php @@ -2,143 +2,144 @@ /** * InviteAdminUser * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * InviteAdminUser Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class InviteAdminUser implements ModelInterface, ArrayAccess +class InviteAdminUser extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'inviteAdminUser'; + protected static string $openAPIModelName = 'inviteAdminUser'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'email' => 'string', 'allFeaturesAccess' => 'bool', - 'groupIds' => 'string[]', - 'privileges' => '\Brevo\Client\Models\InviteAdminUserPrivileges[]' + 'privileges' => '\Brevo\Client\Models\InviteAdminUserPrivilegesInner[]', + 'groupIds' => 'string[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'email' => 'email', 'allFeaturesAccess' => null, - 'groupIds' => null, - 'privileges' => null + 'privileges' => null, + 'groupIds' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'allFeaturesAccess' => false, + 'privileges' => false, + 'groupIds' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'email' => 'email', 'allFeaturesAccess' => 'all_features_access', - 'groupIds' => 'groupIds', - 'privileges' => 'privileges' + 'privileges' => 'privileges', + 'groupIds' => 'groupIds' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'email' => 'setEmail', 'allFeaturesAccess' => 'setAllFeaturesAccess', - 'groupIds' => 'setGroupIds', - 'privileges' => 'setPrivileges' + 'privileges' => 'setPrivileges', + 'groupIds' => 'setGroupIds' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'email' => 'getEmail', 'allFeaturesAccess' => 'getAllFeaturesAccess', - 'groupIds' => 'getGroupIds', - 'privileges' => 'getPrivileges' + 'privileges' => 'getPrivileges', + 'groupIds' => 'getGroupIds' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +147,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,54 +157,40 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['allFeaturesAccess'] = isset($data['allFeaturesAccess']) ? $data['allFeaturesAccess'] : null; - $this->container['groupIds'] = isset($data['groupIds']) ? $data['groupIds'] : null; - $this->container['privileges'] = isset($data['privileges']) ? $data['privileges'] : null; + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('allFeaturesAccess', $data ?? [], null); + $this->setIfExists('privileges', $data ?? [], null); + $this->setIfExists('groupIds', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -219,24 +206,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets email * * @return string */ - public function getEmail() + public function getEmail(): string { return $this->container['email']; } @@ -248,8 +223,11 @@ public function getEmail() * * @return $this */ - public function setEmail($email) + public function setEmail(string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -260,7 +238,7 @@ public function setEmail($email) * * @return bool */ - public function getAllFeaturesAccess() + public function getAllFeaturesAccess(): bool { return $this->container['allFeaturesAccess']; } @@ -272,43 +250,22 @@ public function getAllFeaturesAccess() * * @return $this */ - public function setAllFeaturesAccess($allFeaturesAccess) + public function setAllFeaturesAccess(bool $allFeaturesAccess): static { + if (is_null($allFeaturesAccess)) { + throw new InvalidArgumentException('non-nullable allFeaturesAccess cannot be null'); + } $this->container['allFeaturesAccess'] = $allFeaturesAccess; return $this; } - /** - * Gets groupIds - * - * @return string[] - */ - public function getGroupIds() - { - return $this->container['groupIds']; - } - - /** - * Sets groupIds - * - * @param string[] $groupIds Ids of Group - * - * @return $this - */ - public function setGroupIds($groupIds) - { - $this->container['groupIds'] = $groupIds; - - return $this; - } - /** * Gets privileges * - * @return \Brevo\Client\Models\InviteAdminUserPrivileges[] + * @return \Brevo\Client\Models\InviteAdminUserPrivilegesInner[] */ - public function getPrivileges() + public function getPrivileges(): array { return $this->container['privileges']; } @@ -316,88 +273,45 @@ public function getPrivileges() /** * Sets privileges * - * @param \Brevo\Client\Models\InviteAdminUserPrivileges[] $privileges privileges + * @param \Brevo\Client\Models\InviteAdminUserPrivilegesInner[] $privileges privileges * * @return $this */ - public function setPrivileges($privileges) + public function setPrivileges(array $privileges): static { + if (is_null($privileges)) { + throw new InvalidArgumentException('non-nullable privileges cannot be null'); + } $this->container['privileges'] = $privileges; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 + * Gets groupIds * - * @return void + * @return string[]|null */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function getGroupIds(): ?array { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } + return $this->container['groupIds']; } /** - * Unsets offset. + * Sets groupIds * - * @param integer $offset Offset + * @param string[]|null $groupIds Ids of Group * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string + * @return $this */ - public function __toString() + public function setGroupIds(?array $groupIds): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($groupIds)) { + throw new InvalidArgumentException('non-nullable groupIds cannot be null'); } + $this->container['groupIds'] = $groupIds; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/InviteAdminUserPrivileges.php b/lib/Models/InviteAdminUserPrivileges.php deleted file mode 100644 index e677bc3..0000000 --- a/lib/Models/InviteAdminUserPrivileges.php +++ /dev/null @@ -1,396 +0,0 @@ - 'string', - 'permissions' => 'string[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'feature' => null, - 'permissions' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'feature' => 'feature', - 'permissions' => 'permissions' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'feature' => 'setFeature', - 'permissions' => 'setPermissions' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'feature' => 'getFeature', - 'permissions' => 'getPermissions' - ]; - - /** - * 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 FEATURE_MY_PLAN = 'my_plan'; - const FEATURE_API = 'api'; - const FEATURE_USER_MANAGEMENT = 'user_management'; - const FEATURE_APP_MANAGEMENT = 'app_management'; - const PERMISSIONS_ALL = 'all'; - const PERMISSIONS_NONE = 'none'; - - - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getFeatureAllowableValues() - { - return [ - self::FEATURE_MY_PLAN, - self::FEATURE_API, - self::FEATURE_USER_MANAGEMENT, - self::FEATURE_APP_MANAGEMENT, - ]; - } - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getPermissionsAllowableValues() - { - return [ - self::PERMISSIONS_ALL, - self::PERMISSIONS_NONE, - ]; - } - - - /** - * 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['feature'] = isset($data['feature']) ? $data['feature'] : null; - $this->container['permissions'] = isset($data['permissions']) ? $data['permissions'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - $allowedValues = $this->getFeatureAllowableValues(); - if (!is_null($this->container['feature']) && !in_array($this->container['feature'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value for 'feature', must be one of '%s'", - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets feature - * - * @return string - */ - public function getFeature() - { - return $this->container['feature']; - } - - /** - * Sets feature - * - * @param string $feature Feature name - * - * @return $this - */ - public function setFeature($feature) - { - $allowedValues = $this->getFeatureAllowableValues(); - if (!is_null($feature) && !in_array($feature, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'feature', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['feature'] = $feature; - - return $this; - } - - /** - * Gets permissions - * - * @return string[] - */ - public function getPermissions() - { - return $this->container['permissions']; - } - - /** - * Sets permissions - * - * @param string[] $permissions Permissions for a given feature - * - * @return $this - */ - public function setPermissions($permissions) - { - $allowedValues = $this->getPermissionsAllowableValues(); - if (!is_null($permissions) && array_diff($permissions, $allowedValues)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'permissions', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['permissions'] = $permissions; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/InviteAdminUserPrivilegesInner.php b/lib/Models/InviteAdminUserPrivilegesInner.php new file mode 100644 index 0000000..ab6e52b --- /dev/null +++ b/lib/Models/InviteAdminUserPrivilegesInner.php @@ -0,0 +1,322 @@ + + */ +class InviteAdminUserPrivilegesInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'inviteAdminUser_privileges_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'feature' => 'string', + 'permissions' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'feature' => null, + 'permissions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'feature' => false, + 'permissions' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'feature' => 'feature', + 'permissions' => 'permissions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'feature' => 'setFeature', + 'permissions' => 'setPermissions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'feature' => 'getFeature', + 'permissions' => 'getPermissions' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const FEATURE_MY_PLAN = 'my_plan'; + public const FEATURE_API = 'api'; + public const FEATURE_USER_MANAGEMENT = 'user_management'; + public const FEATURE_APP_MANAGEMENT = 'app_management'; + public const FEATURE_SUB_ORGANIZATION_GROUPS = 'sub_organization_groups'; + public const FEATURE_CREATE_SUB_ORGANIZATIONS = 'create_sub_organizations'; + public const FEATURE_MANAGE_SUB_ORGANIZATIONS = 'manage_sub_organizations'; + public const FEATURE_ANALYTICS = 'analytics'; + public const FEATURE_SECURITY = 'security'; + public const PERMISSIONS_ALL = 'all'; + public const PERMISSIONS_NONE = 'none'; + public const PERMISSIONS_CREATE = 'create'; + public const PERMISSIONS_EDIT_DELETE = 'edit_delete'; + public const PERMISSIONS_DOWNLOAD_DATA = 'download_data'; + public const PERMISSIONS_CREATE_ALERTS = 'create_alerts'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFeatureAllowableValues() + { + return [ + self::FEATURE_MY_PLAN, + self::FEATURE_API, + self::FEATURE_USER_MANAGEMENT, + self::FEATURE_APP_MANAGEMENT, + self::FEATURE_SUB_ORGANIZATION_GROUPS, + self::FEATURE_CREATE_SUB_ORGANIZATIONS, + self::FEATURE_MANAGE_SUB_ORGANIZATIONS, + self::FEATURE_ANALYTICS, + self::FEATURE_SECURITY, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getPermissionsAllowableValues() + { + return [ + self::PERMISSIONS_ALL, + self::PERMISSIONS_NONE, + self::PERMISSIONS_CREATE, + self::PERMISSIONS_EDIT_DELETE, + self::PERMISSIONS_DOWNLOAD_DATA, + self::PERMISSIONS_CREATE_ALERTS, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('feature', $data ?? [], null); + $this->setIfExists('permissions', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = $this->getFeatureAllowableValues(); + if (!is_null($this->container['feature']) && !in_array($this->container['feature'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'feature', must be one of '%s'", + $this->container['feature'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets feature + * + * @return string|null + */ + public function getFeature(): ?string + { + return $this->container['feature']; + } + + /** + * Sets feature + * + * @param string|null $feature Feature name + * + * @return $this + */ + public function setFeature(?string $feature): static + { + if (is_null($feature)) { + throw new InvalidArgumentException('non-nullable feature cannot be null'); + } + $allowedValues = $this->getFeatureAllowableValues(); + if (!in_array($feature, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'feature', must be one of '%s'", + $feature, + implode("', '", $allowedValues) + ) + ); + } + $this->container['feature'] = $feature; + + return $this; + } + + /** + * Gets permissions + * + * @return string[]|null + */ + public function getPermissions(): ?array + { + return $this->container['permissions']; + } + + /** + * Sets permissions + * + * @param string[]|null $permissions Permissions for a given feature + * + * @return $this + */ + public function setPermissions(?array $permissions): static + { + if (is_null($permissions)) { + throw new InvalidArgumentException('non-nullable permissions cannot be null'); + } + $allowedValues = $this->getPermissionsAllowableValues(); + if (array_diff($permissions, $allowedValues)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value for 'permissions', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['permissions'] = $permissions; + + return $this; + } +} + + diff --git a/lib/Models/Inviteuser.php b/lib/Models/Inviteuser.php index 5f1ffdc..0994bc2 100644 --- a/lib/Models/Inviteuser.php +++ b/lib/Models/Inviteuser.php @@ -2,104 +2,104 @@ /** * Inviteuser * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * Inviteuser Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class Inviteuser implements ModelInterface, ArrayAccess +class Inviteuser extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'inviteuser'; + protected static string $openAPIModelName = 'inviteuser'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'email' => 'string', 'allFeaturesAccess' => 'bool', - 'privileges' => '\Brevo\Client\Models\InviteuserPrivileges[]' + 'privileges' => '\Brevo\Client\Models\InviteuserPrivilegesInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'email' => 'email', 'allFeaturesAccess' => null, 'privileges' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'allFeaturesAccess' => false, + 'privileges' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'email' => 'email', 'allFeaturesAccess' => 'all_features_access', 'privileges' => 'privileges' @@ -108,9 +108,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'email' => 'setEmail', 'allFeaturesAccess' => 'setAllFeaturesAccess', 'privileges' => 'setPrivileges' @@ -119,9 +119,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'email' => 'getEmail', 'allFeaturesAccess' => 'getAllFeaturesAccess', 'privileges' => 'getPrivileges' @@ -131,9 +131,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -141,9 +141,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -151,53 +151,39 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['allFeaturesAccess'] = isset($data['allFeaturesAccess']) ? $data['allFeaturesAccess'] : null; - $this->container['privileges'] = isset($data['privileges']) ? $data['privileges'] : null; + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('allFeaturesAccess', $data ?? [], null); + $this->setIfExists('privileges', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -213,24 +199,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets email * * @return string */ - public function getEmail() + public function getEmail(): string { return $this->container['email']; } @@ -242,8 +216,11 @@ public function getEmail() * * @return $this */ - public function setEmail($email) + public function setEmail(string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -254,7 +231,7 @@ public function setEmail($email) * * @return bool */ - public function getAllFeaturesAccess() + public function getAllFeaturesAccess(): bool { return $this->container['allFeaturesAccess']; } @@ -266,8 +243,11 @@ public function getAllFeaturesAccess() * * @return $this */ - public function setAllFeaturesAccess($allFeaturesAccess) + public function setAllFeaturesAccess(bool $allFeaturesAccess): static { + if (is_null($allFeaturesAccess)) { + throw new InvalidArgumentException('non-nullable allFeaturesAccess cannot be null'); + } $this->container['allFeaturesAccess'] = $allFeaturesAccess; return $this; @@ -276,9 +256,9 @@ public function setAllFeaturesAccess($allFeaturesAccess) /** * Gets privileges * - * @return \Brevo\Client\Models\InviteuserPrivileges[] + * @return \Brevo\Client\Models\InviteuserPrivilegesInner[] */ - public function getPrivileges() + public function getPrivileges(): array { return $this->container['privileges']; } @@ -286,89 +266,19 @@ public function getPrivileges() /** * Sets privileges * - * @param \Brevo\Client\Models\InviteuserPrivileges[] $privileges privileges + * @param \Brevo\Client\Models\InviteuserPrivilegesInner[] $privileges privileges * * @return $this */ - public function setPrivileges($privileges) + public function setPrivileges(array $privileges): static { + if (is_null($privileges)) { + throw new InvalidArgumentException('non-nullable privileges cannot be null'); + } $this->container['privileges'] = $privileges; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/InviteuserPrivileges.php b/lib/Models/InviteuserPrivileges.php deleted file mode 100644 index d1d61ba..0000000 --- a/lib/Models/InviteuserPrivileges.php +++ /dev/null @@ -1,468 +0,0 @@ - 'string', - 'permissions' => 'string[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'feature' => null, - 'permissions' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'feature' => 'feature', - 'permissions' => 'permissions' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'feature' => 'setFeature', - 'permissions' => 'setPermissions' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'feature' => 'getFeature', - 'permissions' => 'getPermissions' - ]; - - /** - * 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 FEATURE_EMAIL_CAMPAIGNS = 'email_campaigns'; - const FEATURE_SMS_CAMPAIGNS = 'sms_campaigns'; - const FEATURE_CONTACTS = 'contacts'; - const FEATURE_TEMPLATES = 'templates'; - const FEATURE_WORKFLOWS = 'workflows'; - const FEATURE_FACEBOOK_ADS = 'facebook_ads'; - const FEATURE_LANDING_PAGES = 'landing_pages'; - const FEATURE_TRANSACTIONAL_EMAILS = 'transactional_emails'; - const FEATURE_SMTP_API = 'smtp_api'; - const FEATURE_USER_MANAGEMENT = 'user_management'; - const FEATURE_SALES_PLATFORM = 'sales_platform'; - const FEATURE_PHONE = 'phone'; - const FEATURE_CONVERSATIONS = 'conversations'; - const FEATURE_SENDERS_DOMAINS_DEDICATED_IPS = 'senders_domains_dedicated_ips'; - const FEATURE_PUSH_NOTIFICATIONS = 'push_notifications'; - const PERMISSIONS_CREATE_EDIT_DELETE = 'create_edit_delete'; - const PERMISSIONS_SEND_SCHEDULE_SUSPEND = 'send_schedule_suspend'; - const PERMISSIONS_VIEW = 'view'; - const PERMISSIONS_IMPORT = 'import'; - const PERMISSIONS_EXPORT = 'export'; - const PERMISSIONS_LIST_AND_ATTRIBUTES = 'list_and_attributes'; - const PERMISSIONS_FORMS = 'forms'; - const PERMISSIONS_ACTIVATE_DEACTIVATE = 'activate_deactivate'; - const PERMISSIONS_ACTIVATE_DEACTIVATE_PAUSE = 'activate_deactivate_pause'; - const PERMISSIONS_SETTINGS = 'settings'; - const PERMISSIONS_SCHEDULE_PAUSE = 'schedule_pause'; - const PERMISSIONS_ALL = 'all'; - const PERMISSIONS_LOGS = 'logs'; - const PERMISSIONS_ACCESS = 'access'; - const PERMISSIONS_ASSIGN = 'assign'; - const PERMISSIONS_CONFIGURE = 'configure'; - const PERMISSIONS_MANAGE_OWNED_DEALS_TASKS_COMPANIES = 'manage_owned_deals_tasks_companies'; - const PERMISSIONS_MANAGE_OTHERS_DEALS_TASKS_COMPANIES = 'manage_others_deals_tasks_companies'; - const PERMISSIONS_REPORTS = 'reports'; - const PERMISSIONS_SENDERS_MANAGEMENT = 'senders_management'; - const PERMISSIONS_DOMAINS_MANAGEMENT = 'domains_management'; - const PERMISSIONS_DEDICATED_IPS_MANAGEMENT = 'dedicated_ips_management'; - const PERMISSIONS_SEND = 'send'; - const PERMISSIONS_SMTP = 'smtp'; - const PERMISSIONS_API_KEYS = 'api_keys'; - const PERMISSIONS_AUTHORIZED_IPS = 'authorized_ips'; - const PERMISSIONS_NONE = 'none'; - - - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getFeatureAllowableValues() - { - return [ - self::FEATURE_EMAIL_CAMPAIGNS, - self::FEATURE_SMS_CAMPAIGNS, - self::FEATURE_CONTACTS, - self::FEATURE_TEMPLATES, - self::FEATURE_WORKFLOWS, - self::FEATURE_FACEBOOK_ADS, - self::FEATURE_LANDING_PAGES, - self::FEATURE_TRANSACTIONAL_EMAILS, - self::FEATURE_SMTP_API, - self::FEATURE_USER_MANAGEMENT, - self::FEATURE_SALES_PLATFORM, - self::FEATURE_PHONE, - self::FEATURE_CONVERSATIONS, - self::FEATURE_SENDERS_DOMAINS_DEDICATED_IPS, - self::FEATURE_PUSH_NOTIFICATIONS, - ]; - } - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getPermissionsAllowableValues() - { - return [ - self::PERMISSIONS_CREATE_EDIT_DELETE, - self::PERMISSIONS_SEND_SCHEDULE_SUSPEND, - self::PERMISSIONS_VIEW, - self::PERMISSIONS_IMPORT, - self::PERMISSIONS_EXPORT, - self::PERMISSIONS_LIST_AND_ATTRIBUTES, - self::PERMISSIONS_FORMS, - self::PERMISSIONS_ACTIVATE_DEACTIVATE, - self::PERMISSIONS_ACTIVATE_DEACTIVATE_PAUSE, - self::PERMISSIONS_SETTINGS, - self::PERMISSIONS_SCHEDULE_PAUSE, - self::PERMISSIONS_ALL, - self::PERMISSIONS_LOGS, - self::PERMISSIONS_ACCESS, - self::PERMISSIONS_ASSIGN, - self::PERMISSIONS_CONFIGURE, - self::PERMISSIONS_MANAGE_OWNED_DEALS_TASKS_COMPANIES, - self::PERMISSIONS_MANAGE_OTHERS_DEALS_TASKS_COMPANIES, - self::PERMISSIONS_REPORTS, - self::PERMISSIONS_SENDERS_MANAGEMENT, - self::PERMISSIONS_DOMAINS_MANAGEMENT, - self::PERMISSIONS_DEDICATED_IPS_MANAGEMENT, - self::PERMISSIONS_SEND, - self::PERMISSIONS_SMTP, - self::PERMISSIONS_API_KEYS, - self::PERMISSIONS_AUTHORIZED_IPS, - self::PERMISSIONS_NONE, - ]; - } - - - /** - * 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['feature'] = isset($data['feature']) ? $data['feature'] : null; - $this->container['permissions'] = isset($data['permissions']) ? $data['permissions'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - $allowedValues = $this->getFeatureAllowableValues(); - if (!is_null($this->container['feature']) && !in_array($this->container['feature'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value for 'feature', must be one of '%s'", - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets feature - * - * @return string - */ - public function getFeature() - { - return $this->container['feature']; - } - - /** - * Sets feature - * - * @param string $feature Feature name - * - * @return $this - */ - public function setFeature($feature) - { - $allowedValues = $this->getFeatureAllowableValues(); - if (!is_null($feature) && !in_array($feature, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'feature', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['feature'] = $feature; - - return $this; - } - - /** - * Gets permissions - * - * @return string[] - */ - public function getPermissions() - { - return $this->container['permissions']; - } - - /** - * Sets permissions - * - * @param string[] $permissions Permissions for a given feature - * - * @return $this - */ - public function setPermissions($permissions) - { - $allowedValues = $this->getPermissionsAllowableValues(); - if (!is_null($permissions) && array_diff($permissions, $allowedValues)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'permissions', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['permissions'] = $permissions; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/InviteuserPrivilegesInner.php b/lib/Models/InviteuserPrivilegesInner.php new file mode 100644 index 0000000..88f0faa --- /dev/null +++ b/lib/Models/InviteuserPrivilegesInner.php @@ -0,0 +1,384 @@ + + */ +class InviteuserPrivilegesInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'inviteuser_privileges_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'feature' => 'string', + 'permissions' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'feature' => null, + 'permissions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'feature' => false, + 'permissions' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'feature' => 'feature', + 'permissions' => 'permissions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'feature' => 'setFeature', + 'permissions' => 'setPermissions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'feature' => 'getFeature', + 'permissions' => 'getPermissions' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const FEATURE_EMAIL_CAMPAIGNS = 'email_campaigns'; + public const FEATURE_SMS_CAMPAIGNS = 'sms_campaigns'; + public const FEATURE_CONTACTS = 'contacts'; + public const FEATURE_TEMPLATES = 'templates'; + public const FEATURE_WORKFLOWS = 'workflows'; + public const FEATURE_FACEBOOK_ADS = 'facebook_ads'; + public const FEATURE_LANDING_PAGES = 'landing_pages'; + public const FEATURE_TRANSACTIONAL_EMAILS = 'transactional_emails'; + public const FEATURE_SMTP_API = 'smtp_api'; + public const FEATURE_USER_MANAGEMENT = 'user_management'; + public const FEATURE_SALES_PLATFORM = 'sales_platform'; + public const FEATURE_PHONE = 'phone'; + public const FEATURE_CONVERSATIONS = 'conversations'; + public const FEATURE_SENDERS_DOMAINS_DEDICATED_IPS = 'senders_domains_dedicated_ips'; + public const FEATURE_PUSH_NOTIFICATIONS = 'push_notifications'; + public const FEATURE_COMPANIES = 'companies'; + public const PERMISSIONS_CREATE_EDIT_DELETE = 'create_edit_delete'; + public const PERMISSIONS_SEND_SCHEDULE_SUSPEND = 'send_schedule_suspend'; + public const PERMISSIONS_VIEW = 'view'; + public const PERMISSIONS_IMPORT = 'import'; + public const PERMISSIONS_EXPORT = 'export'; + public const PERMISSIONS_LIST_AND_ATTRIBUTES = 'list_and_attributes'; + public const PERMISSIONS_FORMS = 'forms'; + public const PERMISSIONS_ACTIVATE_DEACTIVATE = 'activate_deactivate'; + public const PERMISSIONS_ACTIVATE_DEACTIVATE_PAUSE = 'activate_deactivate_pause'; + public const PERMISSIONS_SETTINGS = 'settings'; + public const PERMISSIONS_SCHEDULE_PAUSE = 'schedule_pause'; + public const PERMISSIONS_ALL = 'all'; + public const PERMISSIONS_LOGS = 'logs'; + public const PERMISSIONS_ACCESS = 'access'; + public const PERMISSIONS_ASSIGN = 'assign'; + public const PERMISSIONS_CONFIGURE = 'configure'; + public const PERMISSIONS_CREATE_EDIT_DEALS = 'create_edit_deals'; + public const PERMISSIONS_DELETE_OWNED_DEALS = 'delete_owned_deals'; + public const PERMISSIONS_MANAGE_OTHERS_DEALS_TASKS = 'manage_others_deals_tasks'; + public const PERMISSIONS_MANAGE_OWNED_COMPANIES = 'manage_owned_companies'; + public const PERMISSIONS_MANAGE_OTHERS_COMPANIES = 'manage_others_companies'; + public const PERMISSIONS_REPORTS = 'reports'; + public const PERMISSIONS_SENDERS_MANAGEMENT = 'senders_management'; + public const PERMISSIONS_DOMAINS_MANAGEMENT = 'domains_management'; + public const PERMISSIONS_DEDICATED_IPS_MANAGEMENT = 'dedicated_ips_management'; + public const PERMISSIONS_SEND = 'send'; + public const PERMISSIONS_SMTP = 'smtp'; + public const PERMISSIONS_API_KEYS = 'api_keys'; + public const PERMISSIONS_AUTHORIZED_IPS = 'authorized_ips'; + public const PERMISSIONS_NONE = 'none'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFeatureAllowableValues() + { + return [ + self::FEATURE_EMAIL_CAMPAIGNS, + self::FEATURE_SMS_CAMPAIGNS, + self::FEATURE_CONTACTS, + self::FEATURE_TEMPLATES, + self::FEATURE_WORKFLOWS, + self::FEATURE_FACEBOOK_ADS, + self::FEATURE_LANDING_PAGES, + self::FEATURE_TRANSACTIONAL_EMAILS, + self::FEATURE_SMTP_API, + self::FEATURE_USER_MANAGEMENT, + self::FEATURE_SALES_PLATFORM, + self::FEATURE_PHONE, + self::FEATURE_CONVERSATIONS, + self::FEATURE_SENDERS_DOMAINS_DEDICATED_IPS, + self::FEATURE_PUSH_NOTIFICATIONS, + self::FEATURE_COMPANIES, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getPermissionsAllowableValues() + { + return [ + self::PERMISSIONS_CREATE_EDIT_DELETE, + self::PERMISSIONS_SEND_SCHEDULE_SUSPEND, + self::PERMISSIONS_VIEW, + self::PERMISSIONS_IMPORT, + self::PERMISSIONS_EXPORT, + self::PERMISSIONS_LIST_AND_ATTRIBUTES, + self::PERMISSIONS_FORMS, + self::PERMISSIONS_ACTIVATE_DEACTIVATE, + self::PERMISSIONS_ACTIVATE_DEACTIVATE_PAUSE, + self::PERMISSIONS_SETTINGS, + self::PERMISSIONS_SCHEDULE_PAUSE, + self::PERMISSIONS_ALL, + self::PERMISSIONS_LOGS, + self::PERMISSIONS_ACCESS, + self::PERMISSIONS_ASSIGN, + self::PERMISSIONS_CONFIGURE, + self::PERMISSIONS_CREATE_EDIT_DEALS, + self::PERMISSIONS_DELETE_OWNED_DEALS, + self::PERMISSIONS_MANAGE_OTHERS_DEALS_TASKS, + self::PERMISSIONS_MANAGE_OWNED_COMPANIES, + self::PERMISSIONS_MANAGE_OTHERS_COMPANIES, + self::PERMISSIONS_REPORTS, + self::PERMISSIONS_SENDERS_MANAGEMENT, + self::PERMISSIONS_DOMAINS_MANAGEMENT, + self::PERMISSIONS_DEDICATED_IPS_MANAGEMENT, + self::PERMISSIONS_SEND, + self::PERMISSIONS_SMTP, + self::PERMISSIONS_API_KEYS, + self::PERMISSIONS_AUTHORIZED_IPS, + self::PERMISSIONS_NONE, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('feature', $data ?? [], null); + $this->setIfExists('permissions', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = $this->getFeatureAllowableValues(); + if (!is_null($this->container['feature']) && !in_array($this->container['feature'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'feature', must be one of '%s'", + $this->container['feature'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets feature + * + * @return string|null + */ + public function getFeature(): ?string + { + return $this->container['feature']; + } + + /** + * Sets feature + * + * @param string|null $feature Feature name + * + * @return $this + */ + public function setFeature(?string $feature): static + { + if (is_null($feature)) { + throw new InvalidArgumentException('non-nullable feature cannot be null'); + } + $allowedValues = $this->getFeatureAllowableValues(); + if (!in_array($feature, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'feature', must be one of '%s'", + $feature, + implode("', '", $allowedValues) + ) + ); + } + $this->container['feature'] = $feature; + + return $this; + } + + /** + * Gets permissions + * + * @return string[]|null + */ + public function getPermissions(): ?array + { + return $this->container['permissions']; + } + + /** + * Sets permissions + * + * @param string[]|null $permissions Permissions for a given feature + * + * @return $this + */ + public function setPermissions(?array $permissions): static + { + if (is_null($permissions)) { + throw new InvalidArgumentException('non-nullable permissions cannot be null'); + } + $allowedValues = $this->getPermissionsAllowableValues(); + if (array_diff($permissions, $allowedValues)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value for 'permissions', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['permissions'] = $permissions; + + return $this; + } +} + + diff --git a/lib/Models/InviteuserResponse.php b/lib/Models/InviteuserResponse.php new file mode 100644 index 0000000..41a38d7 --- /dev/null +++ b/lib/Models/InviteuserResponse.php @@ -0,0 +1,244 @@ + + */ +class InviteuserResponse extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'inviteuserResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'status' => 'string', + 'invoiceId' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'status' => null, + 'invoiceId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'status' => false, + 'invoiceId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'status' => 'status', + 'invoiceId' => 'invoice_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'status' => 'setStatus', + 'invoiceId' => 'setInvoiceId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'status' => 'getStatus', + 'invoiceId' => 'getInvoiceId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('invoiceId', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus(): string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status Status of the API operation. + * + * @return $this + */ + public function setStatus(string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets invoiceId + * + * @return string[]|null + */ + public function getInvoiceId(): ?array + { + return $this->container['invoiceId']; + } + + /** + * Sets invoiceId + * + * @param string[]|null $invoiceId Invoice id + * + * @return $this + */ + public function setInvoiceId(?array $invoiceId): static + { + if (is_null($invoiceId)) { + throw new InvalidArgumentException('non-nullable invoiceId cannot be null'); + } + $this->container['invoiceId'] = $invoiceId; + + return $this; + } +} + + diff --git a/lib/Models/LoyaltyProgram.php b/lib/Models/LoyaltyProgram.php new file mode 100644 index 0000000..a1851e4 --- /dev/null +++ b/lib/Models/LoyaltyProgram.php @@ -0,0 +1,445 @@ + + */ +class LoyaltyProgram extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'loyaltyProgram'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'description' => 'string', + 'meta' => 'object', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'state' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'uuid', + 'name' => null, + 'description' => null, + 'meta' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'state' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'description' => false, + 'meta' => false, + 'createdAt' => false, + 'updatedAt' => false, + 'state' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'description' => 'description', + 'meta' => 'meta', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt', + 'state' => 'state' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'description' => 'setDescription', + 'meta' => 'setMeta', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'state' => 'setState' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'description' => 'getDescription', + 'meta' => 'getMeta', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'state' => 'getState' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const STATE_INACTIVE = 'inactive'; + public const STATE_ACTIVE = 'active'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStateAllowableValues() + { + return [ + self::STATE_INACTIVE, + self::STATE_ACTIVE, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('meta', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = $this->getStateAllowableValues(); + if (!is_null($this->container['state']) && !in_array($this->container['state'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'state', must be one of '%s'", + $this->container['state'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Loyalty Program ID + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Loyalty Program name + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Loyalty Program description + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets meta + * + * @return object|null + */ + public function getMeta(): ?object + { + return $this->container['meta']; + } + + /** + * Sets meta + * + * @param object|null $meta Loyalty Program meta data + * + * @return $this + */ + public function setMeta(?object $meta): static + { + if (is_null($meta)) { + throw new InvalidArgumentException('non-nullable meta cannot be null'); + } + $this->container['meta'] = $meta; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Loyalty Program creation date + * + * @return $this + */ + public function setCreatedAt(?\DateTime $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt(): ?\DateTime + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Loyalty Program last modification date + * + * @return $this + */ + public function setUpdatedAt(?\DateTime $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState(): ?string + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state Loyalty Program state + * + * @return $this + */ + public function setState(?string $state): static + { + if (is_null($state)) { + throw new InvalidArgumentException('non-nullable state cannot be null'); + } + $allowedValues = $this->getStateAllowableValues(); + if (!in_array($state, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'state', must be one of '%s'", + $state, + implode("', '", $allowedValues) + ) + ); + } + $this->container['state'] = $state; + + return $this; + } +} + + diff --git a/lib/Models/LoyaltyProgramPage.php b/lib/Models/LoyaltyProgramPage.php new file mode 100644 index 0000000..b4c13ec --- /dev/null +++ b/lib/Models/LoyaltyProgramPage.php @@ -0,0 +1,207 @@ + + */ +class LoyaltyProgramPage extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'loyaltyProgramPage'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'items' => '\Brevo\Client\Models\LoyaltyProgram[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'items' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'items' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'items' => 'items' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'items' => 'setItems' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'items' => 'getItems' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('items', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets items + * + * @return \Brevo\Client\Models\LoyaltyProgram[]|null + */ + public function getItems(): ?array + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \Brevo\Client\Models\LoyaltyProgram[]|null $items Loyalty Program list + * + * @return $this + */ + public function setItems(?array $items): static + { + if (is_null($items)) { + throw new InvalidArgumentException('non-nullable items cannot be null'); + } + $this->container['items'] = $items; + + return $this; + } +} + + diff --git a/lib/Models/LoyaltyProgramValidationError.php b/lib/Models/LoyaltyProgramValidationError.php new file mode 100644 index 0000000..6aaf60b --- /dev/null +++ b/lib/Models/LoyaltyProgramValidationError.php @@ -0,0 +1,275 @@ + + */ +class LoyaltyProgramValidationError extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'loyaltyProgramValidationError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'path' => 'string', + 'rule' => 'string', + 'error' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'path' => null, + 'rule' => null, + 'error' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'path' => false, + 'rule' => false, + 'error' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'path' => 'path', + 'rule' => 'rule', + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'path' => 'setPath', + 'rule' => 'setRule', + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'path' => 'getPath', + 'rule' => 'getRule', + 'error' => 'getError' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('path', $data ?? [], null); + $this->setIfExists('rule', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets path + * + * @return string|null + */ + public function getPath(): ?string + { + return $this->container['path']; + } + + /** + * Sets path + * + * @param string|null $path Path of data that failed validation + * + * @return $this + */ + public function setPath(?string $path): static + { + if (is_null($path)) { + throw new InvalidArgumentException('non-nullable path cannot be null'); + } + $this->container['path'] = $path; + + return $this; + } + + /** + * Gets rule + * + * @return string|null + */ + public function getRule(): ?string + { + return $this->container['rule']; + } + + /** + * Sets rule + * + * @param string|null $rule Rule that failed validation + * + * @return $this + */ + public function setRule(?string $rule): static + { + if (is_null($rule)) { + throw new InvalidArgumentException('non-nullable rule cannot be null'); + } + $this->container['rule'] = $rule; + + return $this; + } + + /** + * Gets error + * + * @return string|null + */ + public function getError(): ?string + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string|null $error Validation error message + * + * @return $this + */ + public function setError(?string $error): static + { + if (is_null($error)) { + throw new InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } +} + + diff --git a/lib/Models/LoyaltyTierPage.php b/lib/Models/LoyaltyTierPage.php new file mode 100644 index 0000000..522de66 --- /dev/null +++ b/lib/Models/LoyaltyTierPage.php @@ -0,0 +1,207 @@ + + */ +class LoyaltyTierPage extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'loyaltyTierPage'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'items' => '\Brevo\Client\Models\Tier[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'items' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'items' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'items' => 'items' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'items' => 'setItems' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'items' => 'getItems' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('items', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets items + * + * @return \Brevo\Client\Models\Tier[]|null + */ + public function getItems(): ?array + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \Brevo\Client\Models\Tier[]|null $items items + * + * @return $this + */ + public function setItems(?array $items): static + { + if (is_null($items)) { + throw new InvalidArgumentException('non-nullable items cannot be null'); + } + $this->container['items'] = $items; + + return $this; + } +} + + diff --git a/lib/Models/ManageIp.php b/lib/Models/ManageIp.php deleted file mode 100644 index 40aaed2..0000000 --- a/lib/Models/ManageIp.php +++ /dev/null @@ -1,305 +0,0 @@ - 'string' - ]; - - /** - * 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 - * - * @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 - */ - public function __construct(array $data = null) - { - $this->container['ip'] = isset($data['ip']) ? $data['ip'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets ip - * - * @return string - */ - public function getIp() - { - return $this->container['ip']; - } - - /** - * Sets ip - * - * @param string $ip Dedicated ID - * - * @return $this - */ - public function setIp($ip) - { - $this->container['ip'] = $ip; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/MasterDetailsResponse.php b/lib/Models/MasterDetailsResponse.php index d02bb9f..f9a25f5 100644 --- a/lib/Models/MasterDetailsResponse.php +++ b/lib/Models/MasterDetailsResponse.php @@ -2,61 +2,63 @@ /** * MasterDetailsResponse * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * MasterDetailsResponse Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class MasterDetailsResponse implements ModelInterface, ArrayAccess +class MasterDetailsResponse extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'masterDetailsResponse'; + protected static string $openAPIModelName = 'masterDetailsResponse'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'email' => 'string', 'companyName' => 'string', 'id' => 'int', @@ -69,9 +71,9 @@ class MasterDetailsResponse implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'email' => null, 'companyName' => null, 'id' => 'int64', @@ -82,32 +84,34 @@ class MasterDetailsResponse implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'companyName' => false, + 'id' => false, + 'currencyCode' => false, + 'timezone' => false, + 'billingInfo' => false, + 'planInfo' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'email' => 'email', 'companyName' => 'companyName', 'id' => 'id', @@ -120,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'email' => 'setEmail', 'companyName' => 'setCompanyName', 'id' => 'setId', @@ -135,9 +139,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'email' => 'getEmail', 'companyName' => 'getCompanyName', 'id' => 'getId', @@ -151,9 +155,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -161,9 +165,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -171,81 +175,55 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['companyName'] = isset($data['companyName']) ? $data['companyName'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['currencyCode'] = isset($data['currencyCode']) ? $data['currencyCode'] : null; - $this->container['timezone'] = isset($data['timezone']) ? $data['timezone'] : null; - $this->container['billingInfo'] = isset($data['billingInfo']) ? $data['billingInfo'] : null; - $this->container['planInfo'] = isset($data['planInfo']) ? $data['planInfo'] : null; + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('companyName', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('currencyCode', $data ?? [], null); + $this->setIfExists('timezone', $data ?? [], null); + $this->setIfExists('billingInfo', $data ?? [], null); + $this->setIfExists('planInfo', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets email * - * @return string + * @return string|null */ - public function getEmail() + public function getEmail(): ?string { return $this->container['email']; } @@ -253,12 +231,15 @@ public function getEmail() /** * Sets email * - * @param string $email Email id of master account + * @param string|null $email Email id of master account * * @return $this */ - public function setEmail($email) + public function setEmail(?string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -267,9 +248,9 @@ public function setEmail($email) /** * Gets companyName * - * @return string + * @return string|null */ - public function getCompanyName() + public function getCompanyName(): ?string { return $this->container['companyName']; } @@ -277,12 +258,15 @@ public function getCompanyName() /** * Sets companyName * - * @param string $companyName Company name of master account organization + * @param string|null $companyName Company name of master account organization * * @return $this */ - public function setCompanyName($companyName) + public function setCompanyName(?string $companyName): static { + if (is_null($companyName)) { + throw new InvalidArgumentException('non-nullable companyName cannot be null'); + } $this->container['companyName'] = $companyName; return $this; @@ -291,9 +275,9 @@ public function setCompanyName($companyName) /** * Gets id * - * @return int + * @return int|null */ - public function getId() + public function getId(): ?int { return $this->container['id']; } @@ -301,12 +285,15 @@ public function getId() /** * Sets id * - * @param int $id Unique identifier of the master account organization + * @param int|null $id Unique identifier of the master account organization * * @return $this */ - public function setId($id) + public function setId(?int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -315,9 +302,9 @@ public function setId($id) /** * Gets currencyCode * - * @return string + * @return string|null */ - public function getCurrencyCode() + public function getCurrencyCode(): ?string { return $this->container['currencyCode']; } @@ -325,12 +312,15 @@ public function getCurrencyCode() /** * Sets currencyCode * - * @param string $currencyCode Currency code of the master account organization + * @param string|null $currencyCode Currency code of the master account organization * * @return $this */ - public function setCurrencyCode($currencyCode) + public function setCurrencyCode(?string $currencyCode): static { + if (is_null($currencyCode)) { + throw new InvalidArgumentException('non-nullable currencyCode cannot be null'); + } $this->container['currencyCode'] = $currencyCode; return $this; @@ -339,9 +329,9 @@ public function setCurrencyCode($currencyCode) /** * Gets timezone * - * @return string + * @return string|null */ - public function getTimezone() + public function getTimezone(): ?string { return $this->container['timezone']; } @@ -349,12 +339,15 @@ public function getTimezone() /** * Sets timezone * - * @param string $timezone Timezone of the master account organization + * @param string|null $timezone Timezone of the master account organization * * @return $this */ - public function setTimezone($timezone) + public function setTimezone(?string $timezone): static { + if (is_null($timezone)) { + throw new InvalidArgumentException('non-nullable timezone cannot be null'); + } $this->container['timezone'] = $timezone; return $this; @@ -363,9 +356,9 @@ public function setTimezone($timezone) /** * Gets billingInfo * - * @return \Brevo\Client\Models\MasterDetailsResponseBillingInfo + * @return \Brevo\Client\Models\MasterDetailsResponseBillingInfo|null */ - public function getBillingInfo() + public function getBillingInfo(): ?\Brevo\Client\Models\MasterDetailsResponseBillingInfo { return $this->container['billingInfo']; } @@ -373,12 +366,15 @@ public function getBillingInfo() /** * Sets billingInfo * - * @param \Brevo\Client\Models\MasterDetailsResponseBillingInfo $billingInfo billingInfo + * @param \Brevo\Client\Models\MasterDetailsResponseBillingInfo|null $billingInfo billingInfo * * @return $this */ - public function setBillingInfo($billingInfo) + public function setBillingInfo(?\Brevo\Client\Models\MasterDetailsResponseBillingInfo $billingInfo): static { + if (is_null($billingInfo)) { + throw new InvalidArgumentException('non-nullable billingInfo cannot be null'); + } $this->container['billingInfo'] = $billingInfo; return $this; @@ -387,9 +383,9 @@ public function setBillingInfo($billingInfo) /** * Gets planInfo * - * @return \Brevo\Client\Models\MasterDetailsResponsePlanInfo + * @return \Brevo\Client\Models\MasterDetailsResponsePlanInfo|null */ - public function getPlanInfo() + public function getPlanInfo(): ?\Brevo\Client\Models\MasterDetailsResponsePlanInfo { return $this->container['planInfo']; } @@ -397,89 +393,19 @@ public function getPlanInfo() /** * Sets planInfo * - * @param \Brevo\Client\Models\MasterDetailsResponsePlanInfo $planInfo planInfo + * @param \Brevo\Client\Models\MasterDetailsResponsePlanInfo|null $planInfo planInfo * * @return $this */ - public function setPlanInfo($planInfo) + public function setPlanInfo(?\Brevo\Client\Models\MasterDetailsResponsePlanInfo $planInfo): static { + if (is_null($planInfo)) { + throw new InvalidArgumentException('non-nullable planInfo cannot be null'); + } $this->container['planInfo'] = $planInfo; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/MasterDetailsResponseBillingInfo.php b/lib/Models/MasterDetailsResponseBillingInfo.php index 80ff499..7907ba4 100644 --- a/lib/Models/MasterDetailsResponseBillingInfo.php +++ b/lib/Models/MasterDetailsResponseBillingInfo.php @@ -2,62 +2,64 @@ /** * MasterDetailsResponseBillingInfo * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * MasterDetailsResponseBillingInfo Class Doc Comment * - * @category Class * @description Billing details of the master account organization * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class MasterDetailsResponseBillingInfo implements ModelInterface, ArrayAccess +class MasterDetailsResponseBillingInfo extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'masterDetailsResponse_billingInfo'; + protected static string $openAPIModelName = 'masterDetailsResponse_billingInfo'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'email' => 'string', 'companyName' => 'string', 'name' => '\Brevo\Client\Models\MasterDetailsResponseBillingInfoName', @@ -67,9 +69,9 @@ class MasterDetailsResponseBillingInfo implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'email' => null, 'companyName' => null, 'name' => null, @@ -77,32 +79,31 @@ class MasterDetailsResponseBillingInfo implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'companyName' => false, + 'name' => false, + 'address' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'email' => 'email', 'companyName' => 'companyName', 'name' => 'name', @@ -112,9 +113,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'email' => 'setEmail', 'companyName' => 'setCompanyName', 'name' => 'setName', @@ -124,9 +125,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'email' => 'getEmail', 'companyName' => 'getCompanyName', 'name' => 'getName', @@ -137,9 +138,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -147,9 +148,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -157,78 +158,52 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['companyName'] = isset($data['companyName']) ? $data['companyName'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['address'] = isset($data['address']) ? $data['address'] : null; + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('companyName', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('address', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets email * - * @return string + * @return string|null */ - public function getEmail() + public function getEmail(): ?string { return $this->container['email']; } @@ -236,12 +211,15 @@ public function getEmail() /** * Sets email * - * @param string $email Billing email id of master account + * @param string|null $email Billing email id of master account * * @return $this */ - public function setEmail($email) + public function setEmail(?string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -250,9 +228,9 @@ public function setEmail($email) /** * Gets companyName * - * @return string + * @return string|null */ - public function getCompanyName() + public function getCompanyName(): ?string { return $this->container['companyName']; } @@ -260,12 +238,15 @@ public function getCompanyName() /** * Sets companyName * - * @param string $companyName Company name of master account + * @param string|null $companyName Company name of master account * * @return $this */ - public function setCompanyName($companyName) + public function setCompanyName(?string $companyName): static { + if (is_null($companyName)) { + throw new InvalidArgumentException('non-nullable companyName cannot be null'); + } $this->container['companyName'] = $companyName; return $this; @@ -274,9 +255,9 @@ public function setCompanyName($companyName) /** * Gets name * - * @return \Brevo\Client\Models\MasterDetailsResponseBillingInfoName + * @return \Brevo\Client\Models\MasterDetailsResponseBillingInfoName|null */ - public function getName() + public function getName(): ?\Brevo\Client\Models\MasterDetailsResponseBillingInfoName { return $this->container['name']; } @@ -284,12 +265,15 @@ public function getName() /** * Sets name * - * @param \Brevo\Client\Models\MasterDetailsResponseBillingInfoName $name name + * @param \Brevo\Client\Models\MasterDetailsResponseBillingInfoName|null $name name * * @return $this */ - public function setName($name) + public function setName(?\Brevo\Client\Models\MasterDetailsResponseBillingInfoName $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -298,9 +282,9 @@ public function setName($name) /** * Gets address * - * @return \Brevo\Client\Models\MasterDetailsResponseBillingInfoAddress + * @return \Brevo\Client\Models\MasterDetailsResponseBillingInfoAddress|null */ - public function getAddress() + public function getAddress(): ?\Brevo\Client\Models\MasterDetailsResponseBillingInfoAddress { return $this->container['address']; } @@ -308,89 +292,19 @@ public function getAddress() /** * Sets address * - * @param \Brevo\Client\Models\MasterDetailsResponseBillingInfoAddress $address address + * @param \Brevo\Client\Models\MasterDetailsResponseBillingInfoAddress|null $address address * * @return $this */ - public function setAddress($address) + public function setAddress(?\Brevo\Client\Models\MasterDetailsResponseBillingInfoAddress $address): static { + if (is_null($address)) { + throw new InvalidArgumentException('non-nullable address cannot be null'); + } $this->container['address'] = $address; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/MasterDetailsResponseBillingInfoAddress.php b/lib/Models/MasterDetailsResponseBillingInfoAddress.php index 90fbfb8..d2bbcd2 100644 --- a/lib/Models/MasterDetailsResponseBillingInfoAddress.php +++ b/lib/Models/MasterDetailsResponseBillingInfoAddress.php @@ -2,62 +2,64 @@ /** * MasterDetailsResponseBillingInfoAddress * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * MasterDetailsResponseBillingInfoAddress Class Doc Comment * - * @category Class * @description Billing address of master account * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class MasterDetailsResponseBillingInfoAddress implements ModelInterface, ArrayAccess +class MasterDetailsResponseBillingInfoAddress extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'masterDetailsResponse_billingInfo_address'; + protected static string $openAPIModelName = 'masterDetailsResponse_billingInfo_address'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'streetAddress' => 'string', 'locality' => 'string', 'postalCode' => 'string', @@ -68,9 +70,9 @@ class MasterDetailsResponseBillingInfoAddress implements ModelInterface, ArrayAc /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'streetAddress' => null, 'locality' => null, 'postalCode' => null, @@ -79,32 +81,32 @@ class MasterDetailsResponseBillingInfoAddress implements ModelInterface, ArrayAc ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'streetAddress' => false, + 'locality' => false, + 'postalCode' => false, + 'stateCode' => false, + 'countryCode' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'streetAddress' => 'streetAddress', 'locality' => 'locality', 'postalCode' => 'postalCode', @@ -115,9 +117,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'streetAddress' => 'setStreetAddress', 'locality' => 'setLocality', 'postalCode' => 'setPostalCode', @@ -128,9 +130,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'streetAddress' => 'getStreetAddress', 'locality' => 'getLocality', 'postalCode' => 'getPostalCode', @@ -142,9 +144,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -152,9 +154,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -162,79 +164,53 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['streetAddress'] = isset($data['streetAddress']) ? $data['streetAddress'] : null; - $this->container['locality'] = isset($data['locality']) ? $data['locality'] : null; - $this->container['postalCode'] = isset($data['postalCode']) ? $data['postalCode'] : null; - $this->container['stateCode'] = isset($data['stateCode']) ? $data['stateCode'] : null; - $this->container['countryCode'] = isset($data['countryCode']) ? $data['countryCode'] : null; + $this->setIfExists('streetAddress', $data ?? [], null); + $this->setIfExists('locality', $data ?? [], null); + $this->setIfExists('postalCode', $data ?? [], null); + $this->setIfExists('stateCode', $data ?? [], null); + $this->setIfExists('countryCode', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets streetAddress * - * @return string + * @return string|null */ - public function getStreetAddress() + public function getStreetAddress(): ?string { return $this->container['streetAddress']; } @@ -242,12 +218,15 @@ public function getStreetAddress() /** * Sets streetAddress * - * @param string $streetAddress Street address + * @param string|null $streetAddress Street address * * @return $this */ - public function setStreetAddress($streetAddress) + public function setStreetAddress(?string $streetAddress): static { + if (is_null($streetAddress)) { + throw new InvalidArgumentException('non-nullable streetAddress cannot be null'); + } $this->container['streetAddress'] = $streetAddress; return $this; @@ -256,9 +235,9 @@ public function setStreetAddress($streetAddress) /** * Gets locality * - * @return string + * @return string|null */ - public function getLocality() + public function getLocality(): ?string { return $this->container['locality']; } @@ -266,12 +245,15 @@ public function getLocality() /** * Sets locality * - * @param string $locality Locality + * @param string|null $locality Locality * * @return $this */ - public function setLocality($locality) + public function setLocality(?string $locality): static { + if (is_null($locality)) { + throw new InvalidArgumentException('non-nullable locality cannot be null'); + } $this->container['locality'] = $locality; return $this; @@ -280,9 +262,9 @@ public function setLocality($locality) /** * Gets postalCode * - * @return string + * @return string|null */ - public function getPostalCode() + public function getPostalCode(): ?string { return $this->container['postalCode']; } @@ -290,12 +272,15 @@ public function getPostalCode() /** * Sets postalCode * - * @param string $postalCode Postal code + * @param string|null $postalCode Postal code * * @return $this */ - public function setPostalCode($postalCode) + public function setPostalCode(?string $postalCode): static { + if (is_null($postalCode)) { + throw new InvalidArgumentException('non-nullable postalCode cannot be null'); + } $this->container['postalCode'] = $postalCode; return $this; @@ -304,9 +289,9 @@ public function setPostalCode($postalCode) /** * Gets stateCode * - * @return string + * @return string|null */ - public function getStateCode() + public function getStateCode(): ?string { return $this->container['stateCode']; } @@ -314,12 +299,15 @@ public function getStateCode() /** * Sets stateCode * - * @param string $stateCode State code + * @param string|null $stateCode State code * * @return $this */ - public function setStateCode($stateCode) + public function setStateCode(?string $stateCode): static { + if (is_null($stateCode)) { + throw new InvalidArgumentException('non-nullable stateCode cannot be null'); + } $this->container['stateCode'] = $stateCode; return $this; @@ -328,9 +316,9 @@ public function setStateCode($stateCode) /** * Gets countryCode * - * @return string + * @return string|null */ - public function getCountryCode() + public function getCountryCode(): ?string { return $this->container['countryCode']; } @@ -338,89 +326,19 @@ public function getCountryCode() /** * Sets countryCode * - * @param string $countryCode Country code + * @param string|null $countryCode Country code * * @return $this */ - public function setCountryCode($countryCode) + public function setCountryCode(?string $countryCode): static { + if (is_null($countryCode)) { + throw new InvalidArgumentException('non-nullable countryCode cannot be null'); + } $this->container['countryCode'] = $countryCode; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/MasterDetailsResponseBillingInfoName.php b/lib/Models/MasterDetailsResponseBillingInfoName.php index 9181de4..64f6c54 100644 --- a/lib/Models/MasterDetailsResponseBillingInfoName.php +++ b/lib/Models/MasterDetailsResponseBillingInfoName.php @@ -2,62 +2,64 @@ /** * MasterDetailsResponseBillingInfoName * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * MasterDetailsResponseBillingInfoName Class Doc Comment * - * @category Class * @description Billing name of master account holder * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class MasterDetailsResponseBillingInfoName implements ModelInterface, ArrayAccess +class MasterDetailsResponseBillingInfoName extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'masterDetailsResponse_billingInfo_name'; + protected static string $openAPIModelName = 'masterDetailsResponse_billingInfo_name'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'givenName' => 'string', 'familyName' => 'string' ]; @@ -65,40 +67,37 @@ class MasterDetailsResponseBillingInfoName implements ModelInterface, ArrayAcces /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'givenName' => null, 'familyName' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'givenName' => false, + 'familyName' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'givenName' => 'givenName', 'familyName' => 'familyName' ]; @@ -106,9 +105,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'givenName' => 'setGivenName', 'familyName' => 'setFamilyName' ]; @@ -116,9 +115,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'givenName' => 'getGivenName', 'familyName' => 'getFamilyName' ]; @@ -127,9 +126,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -137,9 +136,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -147,76 +146,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['givenName'] = isset($data['givenName']) ? $data['givenName'] : null; - $this->container['familyName'] = isset($data['familyName']) ? $data['familyName'] : null; + $this->setIfExists('givenName', $data ?? [], null); + $this->setIfExists('familyName', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets givenName * - * @return string + * @return string|null */ - public function getGivenName() + public function getGivenName(): ?string { return $this->container['givenName']; } @@ -224,12 +197,15 @@ public function getGivenName() /** * Sets givenName * - * @param string $givenName First name for billing + * @param string|null $givenName First name for billing * * @return $this */ - public function setGivenName($givenName) + public function setGivenName(?string $givenName): static { + if (is_null($givenName)) { + throw new InvalidArgumentException('non-nullable givenName cannot be null'); + } $this->container['givenName'] = $givenName; return $this; @@ -238,9 +214,9 @@ public function setGivenName($givenName) /** * Gets familyName * - * @return string + * @return string|null */ - public function getFamilyName() + public function getFamilyName(): ?string { return $this->container['familyName']; } @@ -248,89 +224,19 @@ public function getFamilyName() /** * Sets familyName * - * @param string $familyName Last name for billing + * @param string|null $familyName Last name for billing * * @return $this */ - public function setFamilyName($familyName) + public function setFamilyName(?string $familyName): static { + if (is_null($familyName)) { + throw new InvalidArgumentException('non-nullable familyName cannot be null'); + } $this->container['familyName'] = $familyName; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/MasterDetailsResponsePlanInfo.php b/lib/Models/MasterDetailsResponsePlanInfo.php index ec4c5a1..7095dfc 100644 --- a/lib/Models/MasterDetailsResponsePlanInfo.php +++ b/lib/Models/MasterDetailsResponsePlanInfo.php @@ -2,76 +2,78 @@ /** * MasterDetailsResponsePlanInfo * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * MasterDetailsResponsePlanInfo Class Doc Comment * - * @category Class * @description Plan details * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class MasterDetailsResponsePlanInfo implements ModelInterface, ArrayAccess +class MasterDetailsResponsePlanInfo extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'masterDetailsResponse_planInfo'; + protected static string $openAPIModelName = 'masterDetailsResponse_planInfo'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'currencyCode' => 'string', 'nextBillingAt' => 'int', 'price' => 'float', 'planPeriod' => 'string', 'subAccounts' => 'int', - 'features' => '\Brevo\Client\Models\MasterDetailsResponsePlanInfoFeatures[]' + 'features' => '\Brevo\Client\Models\MasterDetailsResponsePlanInfoFeaturesInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'currencyCode' => null, 'nextBillingAt' => 'int64', 'price' => null, @@ -81,32 +83,33 @@ class MasterDetailsResponsePlanInfo implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'currencyCode' => false, + 'nextBillingAt' => false, + 'price' => false, + 'planPeriod' => false, + 'subAccounts' => false, + 'features' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'currencyCode' => 'currencyCode', 'nextBillingAt' => 'nextBillingAt', 'price' => 'price', @@ -118,9 +121,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'currencyCode' => 'setCurrencyCode', 'nextBillingAt' => 'setNextBillingAt', 'price' => 'setPrice', @@ -132,9 +135,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'currencyCode' => 'getCurrencyCode', 'nextBillingAt' => 'getNextBillingAt', 'price' => 'getPrice', @@ -147,9 +150,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -157,9 +160,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -167,28 +170,16 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } + public const PLAN_PERIOD_MONTH = 'month'; + public const PLAN_PERIOD_YEAR = 'year'; - const PLAN_PERIOD_MONTH = 'month'; - const PLAN_PERIOD_YEAR = 'year'; - - - /** * Gets allowable values of the enum * @@ -201,44 +192,43 @@ public function getPlanPeriodAllowableValues() self::PLAN_PERIOD_YEAR, ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['currencyCode'] = isset($data['currencyCode']) ? $data['currencyCode'] : null; - $this->container['nextBillingAt'] = isset($data['nextBillingAt']) ? $data['nextBillingAt'] : null; - $this->container['price'] = isset($data['price']) ? $data['price'] : null; - $this->container['planPeriod'] = isset($data['planPeriod']) ? $data['planPeriod'] : null; - $this->container['subAccounts'] = isset($data['subAccounts']) ? $data['subAccounts'] : null; - $this->container['features'] = isset($data['features']) ? $data['features'] : null; + $this->setIfExists('currencyCode', $data ?? [], null); + $this->setIfExists('nextBillingAt', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('planPeriod', $data ?? [], null); + $this->setIfExists('subAccounts', $data ?? [], null); + $this->setIfExists('features', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; $allowedValues = $this->getPlanPeriodAllowableValues(); if (!is_null($this->container['planPeriod']) && !in_array($this->container['planPeriod'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'planPeriod', must be one of '%s'", + "invalid value '%s' for 'planPeriod', must be one of '%s'", + $this->container['planPeriod'], implode("', '", $allowedValues) ); } @@ -246,24 +236,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets currencyCode * - * @return string + * @return string|null */ - public function getCurrencyCode() + public function getCurrencyCode(): ?string { return $this->container['currencyCode']; } @@ -271,12 +249,15 @@ public function getCurrencyCode() /** * Sets currencyCode * - * @param string $currencyCode Plan currency + * @param string|null $currencyCode Plan currency * * @return $this */ - public function setCurrencyCode($currencyCode) + public function setCurrencyCode(?string $currencyCode): static { + if (is_null($currencyCode)) { + throw new InvalidArgumentException('non-nullable currencyCode cannot be null'); + } $this->container['currencyCode'] = $currencyCode; return $this; @@ -285,9 +266,9 @@ public function setCurrencyCode($currencyCode) /** * Gets nextBillingAt * - * @return int + * @return int|null */ - public function getNextBillingAt() + public function getNextBillingAt(): ?int { return $this->container['nextBillingAt']; } @@ -295,12 +276,15 @@ public function getNextBillingAt() /** * Sets nextBillingAt * - * @param int $nextBillingAt Timestamp of next billing date + * @param int|null $nextBillingAt Timestamp of next billing date * * @return $this */ - public function setNextBillingAt($nextBillingAt) + public function setNextBillingAt(?int $nextBillingAt): static { + if (is_null($nextBillingAt)) { + throw new InvalidArgumentException('non-nullable nextBillingAt cannot be null'); + } $this->container['nextBillingAt'] = $nextBillingAt; return $this; @@ -309,9 +293,9 @@ public function setNextBillingAt($nextBillingAt) /** * Gets price * - * @return float + * @return float|null */ - public function getPrice() + public function getPrice(): ?float { return $this->container['price']; } @@ -319,12 +303,15 @@ public function getPrice() /** * Sets price * - * @param float $price Plan amount + * @param float|null $price Plan amount * * @return $this */ - public function setPrice($price) + public function setPrice(?float $price): static { + if (is_null($price)) { + throw new InvalidArgumentException('non-nullable price cannot be null'); + } $this->container['price'] = $price; return $this; @@ -333,9 +320,9 @@ public function setPrice($price) /** * Gets planPeriod * - * @return string + * @return string|null */ - public function getPlanPeriod() + public function getPlanPeriod(): ?string { return $this->container['planPeriod']; } @@ -343,17 +330,21 @@ public function getPlanPeriod() /** * Sets planPeriod * - * @param string $planPeriod Plan period type + * @param string|null $planPeriod Plan period type * * @return $this */ - public function setPlanPeriod($planPeriod) + public function setPlanPeriod(?string $planPeriod): static { + if (is_null($planPeriod)) { + throw new InvalidArgumentException('non-nullable planPeriod cannot be null'); + } $allowedValues = $this->getPlanPeriodAllowableValues(); - if (!is_null($planPeriod) && !in_array($planPeriod, $allowedValues, true)) { - throw new \InvalidArgumentException( + if (!in_array($planPeriod, $allowedValues, true)) { + throw new InvalidArgumentException( sprintf( - "Invalid value for 'planPeriod', must be one of '%s'", + "Invalid value '%s' for 'planPeriod', must be one of '%s'", + $planPeriod, implode("', '", $allowedValues) ) ); @@ -366,9 +357,9 @@ public function setPlanPeriod($planPeriod) /** * Gets subAccounts * - * @return int + * @return int|null */ - public function getSubAccounts() + public function getSubAccounts(): ?int { return $this->container['subAccounts']; } @@ -376,12 +367,15 @@ public function getSubAccounts() /** * Sets subAccounts * - * @param int $subAccounts Number of sub-accounts + * @param int|null $subAccounts Number of sub-accounts * * @return $this */ - public function setSubAccounts($subAccounts) + public function setSubAccounts(?int $subAccounts): static { + if (is_null($subAccounts)) { + throw new InvalidArgumentException('non-nullable subAccounts cannot be null'); + } $this->container['subAccounts'] = $subAccounts; return $this; @@ -390,9 +384,9 @@ public function setSubAccounts($subAccounts) /** * Gets features * - * @return \Brevo\Client\Models\MasterDetailsResponsePlanInfoFeatures[] + * @return \Brevo\Client\Models\MasterDetailsResponsePlanInfoFeaturesInner[]|null */ - public function getFeatures() + public function getFeatures(): ?array { return $this->container['features']; } @@ -400,89 +394,19 @@ public function getFeatures() /** * Sets features * - * @param \Brevo\Client\Models\MasterDetailsResponsePlanInfoFeatures[] $features List of provided features in the plan + * @param \Brevo\Client\Models\MasterDetailsResponsePlanInfoFeaturesInner[]|null $features List of provided features in the plan * * @return $this */ - public function setFeatures($features) + public function setFeatures(?array $features): static { + if (is_null($features)) { + throw new InvalidArgumentException('non-nullable features cannot be null'); + } $this->container['features'] = $features; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/MasterDetailsResponsePlanInfoFeatures.php b/lib/Models/MasterDetailsResponsePlanInfoFeatures.php deleted file mode 100644 index d64a597..0000000 --- a/lib/Models/MasterDetailsResponsePlanInfoFeatures.php +++ /dev/null @@ -1,485 +0,0 @@ - 'string', - 'unitValue' => 'string', - 'quantity' => 'int', - 'quantityWithOverages' => 'int', - 'used' => 'int', - 'usedOverages' => 'int', - 'remaining' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'name' => null, - 'unitValue' => null, - 'quantity' => 'int64', - 'quantityWithOverages' => 'int64', - 'used' => 'int64', - 'usedOverages' => 'int64', - 'remaining' => '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'name' => 'name', - 'unitValue' => 'unitValue', - 'quantity' => 'quantity', - 'quantityWithOverages' => 'quantityWithOverages', - 'used' => 'used', - 'usedOverages' => 'usedOverages', - 'remaining' => 'remaining' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'name' => 'setName', - 'unitValue' => 'setUnitValue', - 'quantity' => 'setQuantity', - 'quantityWithOverages' => 'setQuantityWithOverages', - 'used' => 'setUsed', - 'usedOverages' => 'setUsedOverages', - 'remaining' => 'setRemaining' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'name' => 'getName', - 'unitValue' => 'getUnitValue', - 'quantity' => 'getQuantity', - 'quantityWithOverages' => 'getQuantityWithOverages', - 'used' => 'getUsed', - 'usedOverages' => 'getUsedOverages', - 'remaining' => 'getRemaining' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['unitValue'] = isset($data['unitValue']) ? $data['unitValue'] : null; - $this->container['quantity'] = isset($data['quantity']) ? $data['quantity'] : null; - $this->container['quantityWithOverages'] = isset($data['quantityWithOverages']) ? $data['quantityWithOverages'] : null; - $this->container['used'] = isset($data['used']) ? $data['used'] : null; - $this->container['usedOverages'] = isset($data['usedOverages']) ? $data['usedOverages'] : null; - $this->container['remaining'] = isset($data['remaining']) ? $data['remaining'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Name of the feature - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets unitValue - * - * @return string - */ - public function getUnitValue() - { - return $this->container['unitValue']; - } - - /** - * Sets unitValue - * - * @param string $unitValue Unit value of the feature - * - * @return $this - */ - public function setUnitValue($unitValue) - { - $this->container['unitValue'] = $unitValue; - - return $this; - } - - /** - * Gets quantity - * - * @return int - */ - public function getQuantity() - { - return $this->container['quantity']; - } - - /** - * Sets quantity - * - * @param int $quantity Quantity provided in the plan - * - * @return $this - */ - public function setQuantity($quantity) - { - $this->container['quantity'] = $quantity; - - return $this; - } - - /** - * Gets quantityWithOverages - * - * @return int - */ - public function getQuantityWithOverages() - { - return $this->container['quantityWithOverages']; - } - - /** - * Sets quantityWithOverages - * - * @param int $quantityWithOverages Quantity with overages provided in the plan (only applicable on ENTv2) - * - * @return $this - */ - public function setQuantityWithOverages($quantityWithOverages) - { - $this->container['quantityWithOverages'] = $quantityWithOverages; - - return $this; - } - - /** - * Gets used - * - * @return int - */ - public function getUsed() - { - return $this->container['used']; - } - - /** - * Sets used - * - * @param int $used Quantity consumed by master - * - * @return $this - */ - public function setUsed($used) - { - $this->container['used'] = $used; - - return $this; - } - - /** - * Gets usedOverages - * - * @return int - */ - public function getUsedOverages() - { - return $this->container['usedOverages']; - } - - /** - * Sets usedOverages - * - * @param int $usedOverages Quantity consumed by sub-organizations over the admin plan limit (only applicable on ENTv2) - * - * @return $this - */ - public function setUsedOverages($usedOverages) - { - $this->container['usedOverages'] = $usedOverages; - - return $this; - } - - /** - * Gets remaining - * - * @return int - */ - public function getRemaining() - { - return $this->container['remaining']; - } - - /** - * Sets remaining - * - * @param int $remaining Quantity remaining in the plan - * - * @return $this - */ - public function setRemaining($remaining) - { - $this->container['remaining'] = $remaining; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/MasterDetailsResponsePlanInfoFeaturesInner.php b/lib/Models/MasterDetailsResponsePlanInfoFeaturesInner.php new file mode 100644 index 0000000..5e113ff --- /dev/null +++ b/lib/Models/MasterDetailsResponsePlanInfoFeaturesInner.php @@ -0,0 +1,411 @@ + + */ +class MasterDetailsResponsePlanInfoFeaturesInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'masterDetailsResponse_planInfo_features_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'unitValue' => 'string', + 'quantity' => 'int', + 'quantityWithOverages' => 'int', + 'used' => 'int', + 'usedOverages' => 'int', + 'remaining' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'unitValue' => null, + 'quantity' => 'int64', + 'quantityWithOverages' => 'int64', + 'used' => 'int64', + 'usedOverages' => 'int64', + 'remaining' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'unitValue' => false, + 'quantity' => false, + 'quantityWithOverages' => false, + 'used' => false, + 'usedOverages' => false, + 'remaining' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'unitValue' => 'unitValue', + 'quantity' => 'quantity', + 'quantityWithOverages' => 'quantityWithOverages', + 'used' => 'used', + 'usedOverages' => 'usedOverages', + 'remaining' => 'remaining' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'unitValue' => 'setUnitValue', + 'quantity' => 'setQuantity', + 'quantityWithOverages' => 'setQuantityWithOverages', + 'used' => 'setUsed', + 'usedOverages' => 'setUsedOverages', + 'remaining' => 'setRemaining' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'unitValue' => 'getUnitValue', + 'quantity' => 'getQuantity', + 'quantityWithOverages' => 'getQuantityWithOverages', + 'used' => 'getUsed', + 'usedOverages' => 'getUsedOverages', + 'remaining' => 'getRemaining' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('unitValue', $data ?? [], null); + $this->setIfExists('quantity', $data ?? [], null); + $this->setIfExists('quantityWithOverages', $data ?? [], null); + $this->setIfExists('used', $data ?? [], null); + $this->setIfExists('usedOverages', $data ?? [], null); + $this->setIfExists('remaining', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the feature + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets unitValue + * + * @return string|null + */ + public function getUnitValue(): ?string + { + return $this->container['unitValue']; + } + + /** + * Sets unitValue + * + * @param string|null $unitValue Unit value of the feature + * + * @return $this + */ + public function setUnitValue(?string $unitValue): static + { + if (is_null($unitValue)) { + throw new InvalidArgumentException('non-nullable unitValue cannot be null'); + } + $this->container['unitValue'] = $unitValue; + + return $this; + } + + /** + * Gets quantity + * + * @return int|null + */ + public function getQuantity(): ?int + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity Quantity provided in the plan + * + * @return $this + */ + public function setQuantity(?int $quantity): static + { + if (is_null($quantity)) { + throw new InvalidArgumentException('non-nullable quantity cannot be null'); + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets quantityWithOverages + * + * @return int|null + */ + public function getQuantityWithOverages(): ?int + { + return $this->container['quantityWithOverages']; + } + + /** + * Sets quantityWithOverages + * + * @param int|null $quantityWithOverages Quantity with overages provided in the plan (only applicable on ENTv2) + * + * @return $this + */ + public function setQuantityWithOverages(?int $quantityWithOverages): static + { + if (is_null($quantityWithOverages)) { + throw new InvalidArgumentException('non-nullable quantityWithOverages cannot be null'); + } + $this->container['quantityWithOverages'] = $quantityWithOverages; + + return $this; + } + + /** + * Gets used + * + * @return int|null + */ + public function getUsed(): ?int + { + return $this->container['used']; + } + + /** + * Sets used + * + * @param int|null $used Quantity consumed by master + * + * @return $this + */ + public function setUsed(?int $used): static + { + if (is_null($used)) { + throw new InvalidArgumentException('non-nullable used cannot be null'); + } + $this->container['used'] = $used; + + return $this; + } + + /** + * Gets usedOverages + * + * @return int|null + */ + public function getUsedOverages(): ?int + { + return $this->container['usedOverages']; + } + + /** + * Sets usedOverages + * + * @param int|null $usedOverages Quantity consumed by sub-organizations over the admin plan limit (only applicable on ENTv2) + * + * @return $this + */ + public function setUsedOverages(?int $usedOverages): static + { + if (is_null($usedOverages)) { + throw new InvalidArgumentException('non-nullable usedOverages cannot be null'); + } + $this->container['usedOverages'] = $usedOverages; + + return $this; + } + + /** + * Gets remaining + * + * @return int|null + */ + public function getRemaining(): ?int + { + return $this->container['remaining']; + } + + /** + * Sets remaining + * + * @param int|null $remaining Quantity remaining in the plan + * + * @return $this + */ + public function setRemaining(?int $remaining): static + { + if (is_null($remaining)) { + throw new InvalidArgumentException('non-nullable remaining cannot be null'); + } + $this->container['remaining'] = $remaining; + + return $this; + } +} + + diff --git a/lib/Models/ModelInterface.php b/lib/Models/ModelInterface.php index 2fd91a2..21347ef 100644 --- a/lib/Models/ModelInterface.php +++ b/lib/Models/ModelInterface.php @@ -2,28 +2,27 @@ /** * ModelInterface * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client\Models - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ @@ -33,7 +32,7 @@ * Interface abstracting model access. * * @package Brevo\Client\Models - * @author Swagger Codegen team + * @author OpenAPI Generator team */ interface ModelInterface { @@ -42,49 +41,49 @@ interface ModelInterface * * @return string */ - public function getModelName(); + public function getModelName(): string; /** * Array of property to type mappings. Used for (de)serialization * * @return array */ - public static function swaggerTypes(); + public static function openAPITypes(): array; /** * Array of property to format mappings. Used for (de)serialization * * @return array */ - public static function swaggerFormats(); + public static function openAPIFormats(): array; /** * Array of attributes where the key is the local name, and the value is the original name * * @return array */ - public static function attributeMap(); + public static function attributeMap(): array; /** * Array of attributes to setter functions (for deserialization of responses) * * @return array */ - public static function setters(); + public static function setters(): array; /** * Array of attributes to getter functions (for serialization of requests) * * @return array */ - public static function getters(); + public static function getters(): array; /** * Show all the invalid properties with reasons. * * @return array */ - public function listInvalidProperties(); + public function listInvalidProperties(): array; /** * Validate all the properties in the model @@ -92,5 +91,21 @@ public function listInvalidProperties(); * * @return bool */ - public function valid(); + public function valid(): bool; + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool; + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool; } diff --git a/lib/Models/Note.php b/lib/Models/Note.php index 930bdcb..36c9118 100644 --- a/lib/Models/Note.php +++ b/lib/Models/Note.php @@ -2,64 +2,66 @@ /** * Note * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * Note Class Doc Comment * - * @category Class * @description Note Details * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class Note implements ModelInterface, ArrayAccess +class Note extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'Note'; + protected static string $openAPIModelName = 'Note'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'id' => 'string', + protected static array $openAPITypes = [ 'text' => 'string', + 'id' => 'string', 'contactIds' => 'int[]', 'dealIds' => 'string[]', 'authorId' => 'object', @@ -70,11 +72,11 @@ class Note implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'id' => null, + protected static array $openAPIFormats = [ 'text' => null, + 'id' => null, 'contactIds' => null, 'dealIds' => null, 'authorId' => null, @@ -83,34 +85,36 @@ class Note implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'text' => false, + 'id' => false, + 'contactIds' => false, + 'dealIds' => false, + 'authorId' => false, + 'createdAt' => false, + 'updatedAt' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ - 'id' => 'id', + protected static array $attributeMap = [ 'text' => 'text', + 'id' => 'id', 'contactIds' => 'contactIds', 'dealIds' => 'dealIds', 'authorId' => 'authorId', @@ -121,11 +125,11 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ - 'id' => 'setId', + protected static array $setters = [ 'text' => 'setText', + 'id' => 'setId', 'contactIds' => 'setContactIds', 'dealIds' => 'setDealIds', 'authorId' => 'setAuthorId', @@ -136,11 +140,11 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ - 'id' => 'getId', + protected static array $getters = [ 'text' => 'getText', + 'id' => 'getId', 'contactIds' => 'getContactIds', 'dealIds' => 'getDealIds', 'authorId' => 'getAuthorId', @@ -152,9 +156,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -162,9 +166,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -172,57 +176,43 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['text'] = isset($data['text']) ? $data['text'] : null; - $this->container['contactIds'] = isset($data['contactIds']) ? $data['contactIds'] : null; - $this->container['dealIds'] = isset($data['dealIds']) ? $data['dealIds'] : null; - $this->container['authorId'] = isset($data['authorId']) ? $data['authorId'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['updatedAt'] = isset($data['updatedAt']) ? $data['updatedAt'] : null; + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('contactIds', $data ?? [], null); + $this->setIfExists('dealIds', $data ?? [], null); + $this->setIfExists('authorId', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -241,68 +231,62 @@ public function listInvalidProperties() } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id + * Gets text * * @return string */ - public function getId() + public function getText(): string { - return $this->container['id']; + return $this->container['text']; } /** - * Sets id + * Sets text * - * @param string $id Unique note Id + * @param string $text Text content of a note * * @return $this */ - public function setId($id) + public function setText(string $text): static { - $this->container['id'] = $id; + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + if ((mb_strlen($text) > 3000)) { + throw new InvalidArgumentException('invalid length for $text when calling Note., must be smaller than or equal to 3000.'); + } + if ((mb_strlen($text) < 1)) { + throw new InvalidArgumentException('invalid length for $text when calling Note., must be bigger than or equal to 1.'); + } + + $this->container['text'] = $text; return $this; } /** - * Gets text + * Gets id * - * @return string + * @return string|null */ - public function getText() + public function getId(): ?string { - return $this->container['text']; + return $this->container['id']; } /** - * Sets text + * Sets id * - * @param string $text Text content of a note + * @param string|null $id Unique note Id * * @return $this */ - public function setText($text) + public function setId(?string $id): static { - if ((mb_strlen($text) > 3000)) { - throw new \InvalidArgumentException('invalid length for $text when calling Note., must be smaller than or equal to 3000.'); - } - if ((mb_strlen($text) < 1)) { - throw new \InvalidArgumentException('invalid length for $text when calling Note., must be bigger than or equal to 1.'); + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); } - - $this->container['text'] = $text; + $this->container['id'] = $id; return $this; } @@ -310,9 +294,9 @@ public function setText($text) /** * Gets contactIds * - * @return int[] + * @return int[]|null */ - public function getContactIds() + public function getContactIds(): ?array { return $this->container['contactIds']; } @@ -320,12 +304,15 @@ public function getContactIds() /** * Sets contactIds * - * @param int[] $contactIds Contact ids linked to a note + * @param int[]|null $contactIds Contact ids linked to a note * * @return $this */ - public function setContactIds($contactIds) + public function setContactIds(?array $contactIds): static { + if (is_null($contactIds)) { + throw new InvalidArgumentException('non-nullable contactIds cannot be null'); + } $this->container['contactIds'] = $contactIds; return $this; @@ -334,9 +321,9 @@ public function setContactIds($contactIds) /** * Gets dealIds * - * @return string[] + * @return string[]|null */ - public function getDealIds() + public function getDealIds(): ?array { return $this->container['dealIds']; } @@ -344,12 +331,15 @@ public function getDealIds() /** * Sets dealIds * - * @param string[] $dealIds Deal ids linked to a note + * @param string[]|null $dealIds Deal ids linked to a note * * @return $this */ - public function setDealIds($dealIds) + public function setDealIds(?array $dealIds): static { + if (is_null($dealIds)) { + throw new InvalidArgumentException('non-nullable dealIds cannot be null'); + } $this->container['dealIds'] = $dealIds; return $this; @@ -358,9 +348,9 @@ public function setDealIds($dealIds) /** * Gets authorId * - * @return object + * @return object|null */ - public function getAuthorId() + public function getAuthorId(): ?object { return $this->container['authorId']; } @@ -368,12 +358,15 @@ public function getAuthorId() /** * Sets authorId * - * @param object $authorId Account details of user which created the note + * @param object|null $authorId Account details of user which created the note * * @return $this */ - public function setAuthorId($authorId) + public function setAuthorId(?object $authorId): static { + if (is_null($authorId)) { + throw new InvalidArgumentException('non-nullable authorId cannot be null'); + } $this->container['authorId'] = $authorId; return $this; @@ -382,9 +375,9 @@ public function setAuthorId($authorId) /** * Gets createdAt * - * @return \DateTime + * @return \DateTime|null */ - public function getCreatedAt() + public function getCreatedAt(): ?\DateTime { return $this->container['createdAt']; } @@ -392,12 +385,15 @@ public function getCreatedAt() /** * Sets createdAt * - * @param \DateTime $createdAt Note created date/time + * @param \DateTime|null $createdAt Note created date/time * * @return $this */ - public function setCreatedAt($createdAt) + public function setCreatedAt(?\DateTime $createdAt): static { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } $this->container['createdAt'] = $createdAt; return $this; @@ -406,9 +402,9 @@ public function setCreatedAt($createdAt) /** * Gets updatedAt * - * @return \DateTime + * @return \DateTime|null */ - public function getUpdatedAt() + public function getUpdatedAt(): ?\DateTime { return $this->container['updatedAt']; } @@ -416,89 +412,19 @@ public function getUpdatedAt() /** * Sets updatedAt * - * @param \DateTime $updatedAt Note updated date/time + * @param \DateTime|null $updatedAt Note updated date/time * * @return $this */ - public function setUpdatedAt($updatedAt) + public function setUpdatedAt(?\DateTime $updatedAt): static { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } $this->container['updatedAt'] = $updatedAt; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/NoteData.php b/lib/Models/NoteData.php index 0f9e248..86aca24 100644 --- a/lib/Models/NoteData.php +++ b/lib/Models/NoteData.php @@ -2,62 +2,64 @@ /** * NoteData * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * NoteData Class Doc Comment * - * @category Class * @description Note data to be saved * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class NoteData implements ModelInterface, ArrayAccess +class NoteData extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'NoteData'; + protected static string $openAPIModelName = 'NoteData'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'text' => 'string', 'contactIds' => 'int[]', 'dealIds' => 'string[]', @@ -67,9 +69,9 @@ class NoteData implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'text' => null, 'contactIds' => null, 'dealIds' => null, @@ -77,32 +79,31 @@ class NoteData implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'text' => false, + 'contactIds' => false, + 'dealIds' => false, + 'companyIds' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'text' => 'text', 'contactIds' => 'contactIds', 'dealIds' => 'dealIds', @@ -112,9 +113,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'text' => 'setText', 'contactIds' => 'setContactIds', 'dealIds' => 'setDealIds', @@ -124,9 +125,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'text' => 'getText', 'contactIds' => 'getContactIds', 'dealIds' => 'getDealIds', @@ -137,9 +138,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -147,9 +148,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -157,54 +158,40 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['text'] = isset($data['text']) ? $data['text'] : null; - $this->container['contactIds'] = isset($data['contactIds']) ? $data['contactIds'] : null; - $this->container['dealIds'] = isset($data['dealIds']) ? $data['dealIds'] : null; - $this->container['companyIds'] = isset($data['companyIds']) ? $data['companyIds'] : null; + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('contactIds', $data ?? [], null); + $this->setIfExists('dealIds', $data ?? [], null); + $this->setIfExists('companyIds', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -222,24 +209,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets text * * @return string */ - public function getText() + public function getText(): string { return $this->container['text']; } @@ -251,13 +226,16 @@ public function getText() * * @return $this */ - public function setText($text) + public function setText(string $text): static { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } if ((mb_strlen($text) > 3000)) { - throw new \InvalidArgumentException('invalid length for $text when calling NoteData., must be smaller than or equal to 3000.'); + throw new InvalidArgumentException('invalid length for $text when calling NoteData., must be smaller than or equal to 3000.'); } if ((mb_strlen($text) < 1)) { - throw new \InvalidArgumentException('invalid length for $text when calling NoteData., must be bigger than or equal to 1.'); + throw new InvalidArgumentException('invalid length for $text when calling NoteData., must be bigger than or equal to 1.'); } $this->container['text'] = $text; @@ -268,9 +246,9 @@ public function setText($text) /** * Gets contactIds * - * @return int[] + * @return int[]|null */ - public function getContactIds() + public function getContactIds(): ?array { return $this->container['contactIds']; } @@ -278,12 +256,15 @@ public function getContactIds() /** * Sets contactIds * - * @param int[] $contactIds Contact Ids linked to a note + * @param int[]|null $contactIds Contact Ids linked to a note * * @return $this */ - public function setContactIds($contactIds) + public function setContactIds(?array $contactIds): static { + if (is_null($contactIds)) { + throw new InvalidArgumentException('non-nullable contactIds cannot be null'); + } $this->container['contactIds'] = $contactIds; return $this; @@ -292,9 +273,9 @@ public function setContactIds($contactIds) /** * Gets dealIds * - * @return string[] + * @return string[]|null */ - public function getDealIds() + public function getDealIds(): ?array { return $this->container['dealIds']; } @@ -302,12 +283,15 @@ public function getDealIds() /** * Sets dealIds * - * @param string[] $dealIds Deal Ids linked to a note + * @param string[]|null $dealIds Deal Ids linked to a note * * @return $this */ - public function setDealIds($dealIds) + public function setDealIds(?array $dealIds): static { + if (is_null($dealIds)) { + throw new InvalidArgumentException('non-nullable dealIds cannot be null'); + } $this->container['dealIds'] = $dealIds; return $this; @@ -316,9 +300,9 @@ public function setDealIds($dealIds) /** * Gets companyIds * - * @return string[] + * @return string[]|null */ - public function getCompanyIds() + public function getCompanyIds(): ?array { return $this->container['companyIds']; } @@ -326,89 +310,19 @@ public function getCompanyIds() /** * Sets companyIds * - * @param string[] $companyIds Company Ids linked to a note + * @param string[]|null $companyIds Company Ids linked to a note * * @return $this */ - public function setCompanyIds($companyIds) + public function setCompanyIds(?array $companyIds): static { + if (is_null($companyIds)) { + throw new InvalidArgumentException('non-nullable companyIds cannot be null'); + } $this->container['companyIds'] = $companyIds; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/NoteId.php b/lib/Models/NoteId.php index 70cb27f..535a2c5 100644 --- a/lib/Models/NoteId.php +++ b/lib/Models/NoteId.php @@ -2,119 +2,117 @@ /** * NoteId * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * NoteId Class Doc Comment * - * @category Class * @description Updated Note ID * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class NoteId implements ModelInterface, ArrayAccess +class NoteId extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'NoteId'; + protected static string $openAPIModelName = 'NoteId'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId' ]; @@ -122,9 +120,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -132,9 +130,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -142,75 +140,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->setIfExists('id', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * - * @return string + * @return string|null */ - public function getId() + public function getId(): ?string { return $this->container['id']; } @@ -218,89 +190,19 @@ public function getId() /** * Sets id * - * @param string $id Unique note Id + * @param string|null $id Unique note Id * * @return $this */ - public function setId($id) + public function setId(?string $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/NoteList.php b/lib/Models/NoteList.php deleted file mode 100644 index 65f7a81..0000000 --- a/lib/Models/NoteList.php +++ /dev/null @@ -1,281 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/Notification.php b/lib/Models/Notification.php new file mode 100644 index 0000000..add2ab5 --- /dev/null +++ b/lib/Models/Notification.php @@ -0,0 +1,280 @@ + + */ +class Notification extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'notification'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'channel' => 'string', + 'text' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'channel' => null, + 'text' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'channel' => false, + 'text' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'channel' => 'channel', + 'text' => 'text' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'channel' => 'setChannel', + 'text' => 'setText' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'channel' => 'getChannel', + 'text' => 'getText' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const CHANNEL_EMAIL = 'email'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getChannelAllowableValues() + { + return [ + self::CHANNEL_EMAIL, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['channel'] === null) { + $invalidProperties[] = "'channel' can't be null"; + } + $allowedValues = $this->getChannelAllowableValues(); + if (!is_null($this->container['channel']) && !in_array($this->container['channel'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'channel', must be one of '%s'", + $this->container['channel'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['text'] === null) { + $invalidProperties[] = "'text' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets channel + * + * @return string + */ + public function getChannel(): string + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param string $channel Channel used to send the notifications. + * + * @return $this + */ + public function setChannel(string $channel): static + { + if (is_null($channel)) { + throw new InvalidArgumentException('non-nullable channel cannot be null'); + } + $allowedValues = $this->getChannelAllowableValues(); + if (!in_array($channel, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'channel', must be one of '%s'", + $channel, + implode("', '", $allowedValues) + ) + ); + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets text + * + * @return string + */ + public function getText(): string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string $text Use this field if you want to give more context to your contact about the payment request. + * + * @return $this + */ + public function setText(string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + $this->container['text'] = $text; + + return $this; + } +} + + diff --git a/lib/Models/Offer.php b/lib/Models/Offer.php new file mode 100644 index 0000000..e58c7e2 --- /dev/null +++ b/lib/Models/Offer.php @@ -0,0 +1,449 @@ + + */ +class Offer extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'offer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'loyaltyProgramId' => 'string', + 'name' => 'string', + 'state' => 'string', + 'publicImageUrl' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'uuid', + 'loyaltyProgramId' => 'uuid', + 'name' => null, + 'state' => null, + 'publicImageUrl' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'loyaltyProgramId' => false, + 'name' => false, + 'state' => false, + 'publicImageUrl' => false, + 'createdAt' => false, + 'updatedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'loyaltyProgramId' => 'loyaltyProgramId', + 'name' => 'name', + 'state' => 'state', + 'publicImageUrl' => 'publicImageUrl', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'loyaltyProgramId' => 'setLoyaltyProgramId', + 'name' => 'setName', + 'state' => 'setState', + 'publicImageUrl' => 'setPublicImageUrl', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'loyaltyProgramId' => 'getLoyaltyProgramId', + 'name' => 'getName', + 'state' => 'getState', + 'publicImageUrl' => 'getPublicImageUrl', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const STATE_ACTIVE = 'active'; + public const STATE_PENDING = 'pending'; + public const STATE_DISABLED = 'disabled'; + public const STATE_EXPIRED = 'expired'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStateAllowableValues() + { + return [ + self::STATE_ACTIVE, + self::STATE_PENDING, + self::STATE_DISABLED, + self::STATE_EXPIRED, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('loyaltyProgramId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('publicImageUrl', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = $this->getStateAllowableValues(); + if (!is_null($this->container['state']) && !in_array($this->container['state'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'state', must be one of '%s'", + $this->container['state'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Offer id + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets loyaltyProgramId + * + * @return string|null + */ + public function getLoyaltyProgramId(): ?string + { + return $this->container['loyaltyProgramId']; + } + + /** + * Sets loyaltyProgramId + * + * @param string|null $loyaltyProgramId Loyalty program id + * + * @return $this + */ + public function setLoyaltyProgramId(?string $loyaltyProgramId): static + { + if (is_null($loyaltyProgramId)) { + throw new InvalidArgumentException('non-nullable loyaltyProgramId cannot be null'); + } + $this->container['loyaltyProgramId'] = $loyaltyProgramId; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Offer name + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState(): ?string + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state Offer state + * + * @return $this + */ + public function setState(?string $state): static + { + if (is_null($state)) { + throw new InvalidArgumentException('non-nullable state cannot be null'); + } + $allowedValues = $this->getStateAllowableValues(); + if (!in_array($state, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'state', must be one of '%s'", + $state, + implode("', '", $allowedValues) + ) + ); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets publicImageUrl + * + * @return string|null + */ + public function getPublicImageUrl(): ?string + { + return $this->container['publicImageUrl']; + } + + /** + * Sets publicImageUrl + * + * @param string|null $publicImageUrl Offer image url + * + * @return $this + */ + public function setPublicImageUrl(?string $publicImageUrl): static + { + if (is_null($publicImageUrl)) { + throw new InvalidArgumentException('non-nullable publicImageUrl cannot be null'); + } + $this->container['publicImageUrl'] = $publicImageUrl; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Offer creation date + * + * @return $this + */ + public function setCreatedAt(?\DateTime $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt(): ?\DateTime + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Offer update date + * + * @return $this + */ + public function setUpdatedAt(?\DateTime $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } +} + + diff --git a/lib/Models/OfferList.php b/lib/Models/OfferList.php new file mode 100644 index 0000000..1f62fec --- /dev/null +++ b/lib/Models/OfferList.php @@ -0,0 +1,207 @@ + + */ +class OfferList extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'offerList'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'items' => '\Brevo\Client\Models\Offer[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'items' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'items' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'items' => 'items' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'items' => 'setItems' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'items' => 'getItems' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('items', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets items + * + * @return \Brevo\Client\Models\Offer[]|null + */ + public function getItems(): ?array + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \Brevo\Client\Models\Offer[]|null $items List of offers + * + * @return $this + */ + public function setItems(?array $items): static + { + if (is_null($items)) { + throw new InvalidArgumentException('non-nullable items cannot be null'); + } + $this->container['items'] = $items; + + return $this; + } +} + + diff --git a/lib/Models/OffersListResponse.php b/lib/Models/OffersListResponse.php new file mode 100644 index 0000000..291da96 --- /dev/null +++ b/lib/Models/OffersListResponse.php @@ -0,0 +1,241 @@ + + */ +class OffersListResponse extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'offersListResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'totalCount' => 'int', + 'items' => '\Brevo\Client\Models\Offer[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'totalCount' => null, + 'items' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'totalCount' => false, + 'items' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'totalCount' => 'totalCount', + 'items' => 'items' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'totalCount' => 'setTotalCount', + 'items' => 'setItems' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'totalCount' => 'getTotalCount', + 'items' => 'getItems' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('totalCount', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets totalCount + * + * @return int|null + */ + public function getTotalCount(): ?int + { + return $this->container['totalCount']; + } + + /** + * Sets totalCount + * + * @param int|null $totalCount Total count of offers + * + * @return $this + */ + public function setTotalCount(?int $totalCount): static + { + if (is_null($totalCount)) { + throw new InvalidArgumentException('non-nullable totalCount cannot be null'); + } + $this->container['totalCount'] = $totalCount; + + return $this; + } + + /** + * Gets items + * + * @return \Brevo\Client\Models\Offer[]|null + */ + public function getItems(): ?array + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \Brevo\Client\Models\Offer[]|null $items List of offers + * + * @return $this + */ + public function setItems(?array $items): static + { + if (is_null($items)) { + throw new InvalidArgumentException('non-nullable items cannot be null'); + } + $this->container['items'] = $items; + + return $this; + } +} + + diff --git a/lib/Models/Order.php b/lib/Models/Order.php index a47cf06..8ed9c59 100644 --- a/lib/Models/Order.php +++ b/lib/Models/Order.php @@ -2,68 +2,71 @@ /** * Order * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * Order Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class Order implements ModelInterface, ArrayAccess +class Order extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'order'; + protected static string $openAPIModelName = 'order'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'string', 'createdAt' => 'string', 'updatedAt' => 'string', 'status' => 'string', 'amount' => 'float', - 'products' => '\Brevo\Client\Models\OrderProducts[]', - 'email' => 'string', + 'products' => '\Brevo\Client\Models\OrderProductsInner[]', + 'storeId' => 'string', + 'identifiers' => '\Brevo\Client\Models\OrderIdentifiers', 'billing' => '\Brevo\Client\Models\OrderBilling', 'coupons' => 'string[]' ]; @@ -71,54 +74,61 @@ class Order implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => null, 'createdAt' => null, 'updatedAt' => null, 'status' => null, 'amount' => null, 'products' => null, - 'email' => null, + 'storeId' => null, + 'identifiers' => null, 'billing' => null, 'coupons' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'createdAt' => false, + 'updatedAt' => false, + 'status' => false, + 'amount' => false, + 'products' => false, + 'storeId' => false, + 'identifiers' => false, + 'billing' => false, + 'coupons' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'createdAt' => 'createdAt', 'updatedAt' => 'updatedAt', 'status' => 'status', 'amount' => 'amount', 'products' => 'products', - 'email' => 'email', + 'storeId' => 'storeId', + 'identifiers' => 'identifiers', 'billing' => 'billing', 'coupons' => 'coupons' ]; @@ -126,16 +136,17 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'createdAt' => 'setCreatedAt', 'updatedAt' => 'setUpdatedAt', 'status' => 'setStatus', 'amount' => 'setAmount', 'products' => 'setProducts', - 'email' => 'setEmail', + 'storeId' => 'setStoreId', + 'identifiers' => 'setIdentifiers', 'billing' => 'setBilling', 'coupons' => 'setCoupons' ]; @@ -143,16 +154,17 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'createdAt' => 'getCreatedAt', 'updatedAt' => 'getUpdatedAt', 'status' => 'getStatus', 'amount' => 'getAmount', 'products' => 'getProducts', - 'email' => 'getEmail', + 'storeId' => 'getStoreId', + 'identifiers' => 'getIdentifiers', 'billing' => 'getBilling', 'coupons' => 'getCoupons' ]; @@ -161,9 +173,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -171,9 +183,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -181,59 +193,46 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; - $this->container['updatedAt'] = isset($data['updatedAt']) ? $data['updatedAt'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['products'] = isset($data['products']) ? $data['products'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['billing'] = isset($data['billing']) ? $data['billing'] : null; - $this->container['coupons'] = isset($data['coupons']) ? $data['coupons'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('products', $data ?? [], null); + $this->setIfExists('storeId', $data ?? [], null); + $this->setIfExists('identifiers', $data ?? [], null); + $this->setIfExists('billing', $data ?? [], null); + $this->setIfExists('coupons', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -258,24 +257,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return string */ - public function getId() + public function getId(): string { return $this->container['id']; } @@ -287,8 +274,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(string $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -299,7 +289,7 @@ public function setId($id) * * @return string */ - public function getCreatedAt() + public function getCreatedAt(): string { return $this->container['createdAt']; } @@ -311,8 +301,11 @@ public function getCreatedAt() * * @return $this */ - public function setCreatedAt($createdAt) + public function setCreatedAt(string $createdAt): static { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } $this->container['createdAt'] = $createdAt; return $this; @@ -323,7 +316,7 @@ public function setCreatedAt($createdAt) * * @return string */ - public function getUpdatedAt() + public function getUpdatedAt(): string { return $this->container['updatedAt']; } @@ -335,8 +328,11 @@ public function getUpdatedAt() * * @return $this */ - public function setUpdatedAt($updatedAt) + public function setUpdatedAt(string $updatedAt): static { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } $this->container['updatedAt'] = $updatedAt; return $this; @@ -347,7 +343,7 @@ public function setUpdatedAt($updatedAt) * * @return string */ - public function getStatus() + public function getStatus(): string { return $this->container['status']; } @@ -359,8 +355,11 @@ public function getStatus() * * @return $this */ - public function setStatus($status) + public function setStatus(string $status): static { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -371,7 +370,7 @@ public function setStatus($status) * * @return float */ - public function getAmount() + public function getAmount(): float { return $this->container['amount']; } @@ -383,8 +382,11 @@ public function getAmount() * * @return $this */ - public function setAmount($amount) + public function setAmount(float $amount): static { + if (is_null($amount)) { + throw new InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -393,9 +395,9 @@ public function setAmount($amount) /** * Gets products * - * @return \Brevo\Client\Models\OrderProducts[] + * @return \Brevo\Client\Models\OrderProductsInner[] */ - public function getProducts() + public function getProducts(): array { return $this->container['products']; } @@ -403,160 +405,126 @@ public function getProducts() /** * Sets products * - * @param \Brevo\Client\Models\OrderProducts[] $products products + * @param \Brevo\Client\Models\OrderProductsInner[] $products products * * @return $this */ - public function setProducts($products) + public function setProducts(array $products): static { + if (is_null($products)) { + throw new InvalidArgumentException('non-nullable products cannot be null'); + } $this->container['products'] = $products; return $this; } /** - * Gets email + * Gets storeId * - * @return string + * @return string|null */ - public function getEmail() + public function getStoreId(): ?string { - return $this->container['email']; + return $this->container['storeId']; } /** - * Sets email + * Sets storeId * - * @param string $email Email of the contact, Mandatory if \"phone\" field is not passed in \"billing\" parameter. + * @param string|null $storeId ID of store where the order is placed * * @return $this */ - public function setEmail($email) + public function setStoreId(?string $storeId): static { - $this->container['email'] = $email; + if (is_null($storeId)) { + throw new InvalidArgumentException('non-nullable storeId cannot be null'); + } + $this->container['storeId'] = $storeId; return $this; } /** - * Gets billing + * Gets identifiers * - * @return \Brevo\Client\Models\OrderBilling + * @return \Brevo\Client\Models\OrderIdentifiers|null */ - public function getBilling() + public function getIdentifiers(): ?\Brevo\Client\Models\OrderIdentifiers { - return $this->container['billing']; + return $this->container['identifiers']; } /** - * Sets billing + * Sets identifiers * - * @param \Brevo\Client\Models\OrderBilling $billing billing + * @param \Brevo\Client\Models\OrderIdentifiers|null $identifiers identifiers * * @return $this */ - public function setBilling($billing) + public function setIdentifiers(?\Brevo\Client\Models\OrderIdentifiers $identifiers): static { - $this->container['billing'] = $billing; + if (is_null($identifiers)) { + throw new InvalidArgumentException('non-nullable identifiers cannot be null'); + } + $this->container['identifiers'] = $identifiers; return $this; } /** - * Gets coupons + * Gets billing * - * @return string[] + * @return \Brevo\Client\Models\OrderBilling|null */ - public function getCoupons() + public function getBilling(): ?\Brevo\Client\Models\OrderBilling { - return $this->container['coupons']; + return $this->container['billing']; } /** - * Sets coupons + * Sets billing * - * @param string[] $coupons Coupons applied to the order. Stored case insensitive. + * @param \Brevo\Client\Models\OrderBilling|null $billing billing * * @return $this */ - public function setCoupons($coupons) + public function setBilling(?\Brevo\Client\Models\OrderBilling $billing): static { - $this->container['coupons'] = $coupons; + if (is_null($billing)) { + throw new InvalidArgumentException('non-nullable billing cannot be null'); + } + $this->container['billing'] = $billing; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 + * Gets coupons * - * @return void + * @return string[]|null */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function getCoupons(): ?array { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } + return $this->container['coupons']; } /** - * Unsets offset. - * - * @param integer $offset Offset + * Sets coupons * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object + * @param string[]|null $coupons Coupons applied to the order. Stored case insensitive. * - * @return string + * @return $this */ - public function __toString() + public function setCoupons(?array $coupons): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($coupons)) { + throw new InvalidArgumentException('non-nullable coupons cannot be null'); } + $this->container['coupons'] = $coupons; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/OrderBatch.php b/lib/Models/OrderBatch.php index 117ee04..bb6471c 100644 --- a/lib/Models/OrderBatch.php +++ b/lib/Models/OrderBatch.php @@ -2,61 +2,63 @@ /** * OrderBatch * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * OrderBatch Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class OrderBatch implements ModelInterface, ArrayAccess +class OrderBatch extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'orderBatch'; + protected static string $openAPIModelName = 'orderBatch'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'orders' => '\Brevo\Client\Models\Order[]', 'notifyUrl' => 'string', 'historical' => 'bool' @@ -65,41 +67,39 @@ class OrderBatch implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'orders' => null, 'notifyUrl' => null, 'historical' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'orders' => false, + 'notifyUrl' => false, + 'historical' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'orders' => 'orders', 'notifyUrl' => 'notifyUrl', 'historical' => 'historical' @@ -108,9 +108,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'orders' => 'setOrders', 'notifyUrl' => 'setNotifyUrl', 'historical' => 'setHistorical' @@ -119,9 +119,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'orders' => 'getOrders', 'notifyUrl' => 'getNotifyUrl', 'historical' => 'getHistorical' @@ -131,9 +131,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -141,9 +141,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -151,53 +151,39 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['orders'] = isset($data['orders']) ? $data['orders'] : null; - $this->container['notifyUrl'] = isset($data['notifyUrl']) ? $data['notifyUrl'] : null; - $this->container['historical'] = isset($data['historical']) ? $data['historical'] : true; + $this->setIfExists('orders', $data ?? [], null); + $this->setIfExists('notifyUrl', $data ?? [], null); + $this->setIfExists('historical', $data ?? [], true); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -207,24 +193,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets orders * * @return \Brevo\Client\Models\Order[] */ - public function getOrders() + public function getOrders(): array { return $this->container['orders']; } @@ -236,8 +210,11 @@ public function getOrders() * * @return $this */ - public function setOrders($orders) + public function setOrders(array $orders): static { + if (is_null($orders)) { + throw new InvalidArgumentException('non-nullable orders cannot be null'); + } $this->container['orders'] = $orders; return $this; @@ -246,9 +223,9 @@ public function setOrders($orders) /** * Gets notifyUrl * - * @return string + * @return string|null */ - public function getNotifyUrl() + public function getNotifyUrl(): ?string { return $this->container['notifyUrl']; } @@ -256,12 +233,15 @@ public function getNotifyUrl() /** * Sets notifyUrl * - * @param string $notifyUrl Notify Url provided by client to get the status of batch request + * @param string|null $notifyUrl Notify Url provided by client to get the status of batch request * * @return $this */ - public function setNotifyUrl($notifyUrl) + public function setNotifyUrl(?string $notifyUrl): static { + if (is_null($notifyUrl)) { + throw new InvalidArgumentException('non-nullable notifyUrl cannot be null'); + } $this->container['notifyUrl'] = $notifyUrl; return $this; @@ -270,9 +250,9 @@ public function setNotifyUrl($notifyUrl) /** * Gets historical * - * @return bool + * @return bool|null */ - public function getHistorical() + public function getHistorical(): ?bool { return $this->container['historical']; } @@ -280,89 +260,19 @@ public function getHistorical() /** * Sets historical * - * @param bool $historical Defines wether you want your orders to be considered as live data or as historical data (import of past data, synchronising data). True: orders will not trigger any automation workflows. False: orders will trigger workflows as usual. + * @param bool|null $historical Defines wether you want your orders to be considered as live data or as historical data (import of past data, synchronising data). True: orders will not trigger any automation workflows. False: orders will trigger workflows as usual. * * @return $this */ - public function setHistorical($historical) + public function setHistorical(?bool $historical): static { + if (is_null($historical)) { + throw new InvalidArgumentException('non-nullable historical cannot be null'); + } $this->container['historical'] = $historical; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/OrderBilling.php b/lib/Models/OrderBilling.php index 6171da5..607b19d 100644 --- a/lib/Models/OrderBilling.php +++ b/lib/Models/OrderBilling.php @@ -2,65 +2,68 @@ /** * OrderBilling * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * OrderBilling Class Doc Comment * - * @category Class * @description Billing details of an order. * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class OrderBilling implements ModelInterface, ArrayAccess +class OrderBilling extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'order_billing'; + protected static string $openAPIModelName = 'order_billing'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'address' => 'string', 'city' => 'string', 'countryCode' => 'string', + 'country' => 'string', 'phone' => 'string', 'postCode' => 'string', 'paymentMethod' => 'string', @@ -70,12 +73,13 @@ class OrderBilling implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'address' => null, 'city' => null, 'countryCode' => null, + 'country' => null, 'phone' => null, 'postCode' => null, 'paymentMethod' => null, @@ -83,35 +87,39 @@ class OrderBilling implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'address' => false, + 'city' => false, + 'countryCode' => false, + 'country' => false, + 'phone' => false, + 'postCode' => false, + 'paymentMethod' => false, + 'region' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'address' => 'address', 'city' => 'city', 'countryCode' => 'countryCode', + 'country' => 'country', 'phone' => 'phone', 'postCode' => 'postCode', 'paymentMethod' => 'paymentMethod', @@ -121,12 +129,13 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'address' => 'setAddress', 'city' => 'setCity', 'countryCode' => 'setCountryCode', + 'country' => 'setCountry', 'phone' => 'setPhone', 'postCode' => 'setPostCode', 'paymentMethod' => 'setPaymentMethod', @@ -136,12 +145,13 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'address' => 'getAddress', 'city' => 'getCity', 'countryCode' => 'getCountryCode', + 'country' => 'getCountry', 'phone' => 'getPhone', 'postCode' => 'getPostCode', 'paymentMethod' => 'getPaymentMethod', @@ -152,9 +162,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -162,9 +172,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -172,81 +182,56 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['address'] = isset($data['address']) ? $data['address'] : null; - $this->container['city'] = isset($data['city']) ? $data['city'] : null; - $this->container['countryCode'] = isset($data['countryCode']) ? $data['countryCode'] : null; - $this->container['phone'] = isset($data['phone']) ? $data['phone'] : null; - $this->container['postCode'] = isset($data['postCode']) ? $data['postCode'] : null; - $this->container['paymentMethod'] = isset($data['paymentMethod']) ? $data['paymentMethod'] : null; - $this->container['region'] = isset($data['region']) ? $data['region'] : null; + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('city', $data ?? [], null); + $this->setIfExists('countryCode', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('postCode', $data ?? [], null); + $this->setIfExists('paymentMethod', $data ?? [], null); + $this->setIfExists('region', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets address * - * @return string + * @return string|null */ - public function getAddress() + public function getAddress(): ?string { return $this->container['address']; } @@ -254,12 +239,15 @@ public function getAddress() /** * Sets address * - * @param string $address Full billing address. + * @param string|null $address Full billing address. * * @return $this */ - public function setAddress($address) + public function setAddress(?string $address): static { + if (is_null($address)) { + throw new InvalidArgumentException('non-nullable address cannot be null'); + } $this->container['address'] = $address; return $this; @@ -268,9 +256,9 @@ public function setAddress($address) /** * Gets city * - * @return string + * @return string|null */ - public function getCity() + public function getCity(): ?string { return $this->container['city']; } @@ -278,12 +266,15 @@ public function getCity() /** * Sets city * - * @param string $city Exact city of the address. + * @param string|null $city Exact city of the address. * * @return $this */ - public function setCity($city) + public function setCity(?string $city): static { + if (is_null($city)) { + throw new InvalidArgumentException('non-nullable city cannot be null'); + } $this->container['city'] = $city; return $this; @@ -292,9 +283,9 @@ public function setCity($city) /** * Gets countryCode * - * @return string + * @return string|null */ - public function getCountryCode() + public function getCountryCode(): ?string { return $this->container['countryCode']; } @@ -302,23 +293,53 @@ public function getCountryCode() /** * Sets countryCode * - * @param string $countryCode Billing country 2-letter ISO code. + * @param string|null $countryCode Billing country 2-letter ISO code. * * @return $this */ - public function setCountryCode($countryCode) + public function setCountryCode(?string $countryCode): static { + if (is_null($countryCode)) { + throw new InvalidArgumentException('non-nullable countryCode cannot be null'); + } $this->container['countryCode'] = $countryCode; return $this; } + /** + * Gets country + * + * @return string|null + */ + public function getCountry(): ?string + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country Billing country name. + * + * @return $this + */ + public function setCountry(?string $country): static + { + if (is_null($country)) { + throw new InvalidArgumentException('non-nullable country cannot be null'); + } + $this->container['country'] = $country; + + return $this; + } + /** * Gets phone * - * @return string + * @return string|null */ - public function getPhone() + public function getPhone(): ?string { return $this->container['phone']; } @@ -326,12 +347,15 @@ public function getPhone() /** * Sets phone * - * @param string $phone Phone number to contact for further details about the order, Mandatory if \"email\" field is not passed. + * @param string|null $phone Billing phone number. * * @return $this */ - public function setPhone($phone) + public function setPhone(?string $phone): static { + if (is_null($phone)) { + throw new InvalidArgumentException('non-nullable phone cannot be null'); + } $this->container['phone'] = $phone; return $this; @@ -340,9 +364,9 @@ public function setPhone($phone) /** * Gets postCode * - * @return string + * @return string|null */ - public function getPostCode() + public function getPostCode(): ?string { return $this->container['postCode']; } @@ -350,12 +374,15 @@ public function getPostCode() /** * Sets postCode * - * @param string $postCode Postcode for delivery and billing. + * @param string|null $postCode Postcode for delivery and billing. * * @return $this */ - public function setPostCode($postCode) + public function setPostCode(?string $postCode): static { + if (is_null($postCode)) { + throw new InvalidArgumentException('non-nullable postCode cannot be null'); + } $this->container['postCode'] = $postCode; return $this; @@ -364,9 +391,9 @@ public function setPostCode($postCode) /** * Gets paymentMethod * - * @return string + * @return string|null */ - public function getPaymentMethod() + public function getPaymentMethod(): ?string { return $this->container['paymentMethod']; } @@ -374,12 +401,15 @@ public function getPaymentMethod() /** * Sets paymentMethod * - * @param string $paymentMethod How the visitor will pay for the item(s), e.g. paypal, check, etc. + * @param string|null $paymentMethod How the visitor will pay for the item(s), e.g. paypal, check, etc. * * @return $this */ - public function setPaymentMethod($paymentMethod) + public function setPaymentMethod(?string $paymentMethod): static { + if (is_null($paymentMethod)) { + throw new InvalidArgumentException('non-nullable paymentMethod cannot be null'); + } $this->container['paymentMethod'] = $paymentMethod; return $this; @@ -388,9 +418,9 @@ public function setPaymentMethod($paymentMethod) /** * Gets region * - * @return string + * @return string|null */ - public function getRegion() + public function getRegion(): ?string { return $this->container['region']; } @@ -398,89 +428,19 @@ public function getRegion() /** * Sets region * - * @param string $region Exact region (state/province) for delivery and billing. + * @param string|null $region Exact region (state/province) for delivery and billing. * * @return $this */ - public function setRegion($region) + public function setRegion(?string $region): static { + if (is_null($region)) { + throw new InvalidArgumentException('non-nullable region cannot be null'); + } $this->container['region'] = $region; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/OrderIdentifiers.php b/lib/Models/OrderIdentifiers.php new file mode 100644 index 0000000..5a59a71 --- /dev/null +++ b/lib/Models/OrderIdentifiers.php @@ -0,0 +1,310 @@ + + */ +class OrderIdentifiers extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'order_identifiers'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'extId' => 'string', + 'loyaltySubscriptionId' => 'string', + 'phoneId' => 'string', + 'emailId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'extId' => null, + 'loyaltySubscriptionId' => null, + 'phoneId' => null, + 'emailId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'extId' => false, + 'loyaltySubscriptionId' => false, + 'phoneId' => false, + 'emailId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'extId' => 'ext_id', + 'loyaltySubscriptionId' => 'loyalty_subscription_id', + 'phoneId' => 'phone_id', + 'emailId' => 'email_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'extId' => 'setExtId', + 'loyaltySubscriptionId' => 'setLoyaltySubscriptionId', + 'phoneId' => 'setPhoneId', + 'emailId' => 'setEmailId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'extId' => 'getExtId', + 'loyaltySubscriptionId' => 'getLoyaltySubscriptionId', + 'phoneId' => 'getPhoneId', + 'emailId' => 'getEmailId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('extId', $data ?? [], null); + $this->setIfExists('loyaltySubscriptionId', $data ?? [], null); + $this->setIfExists('phoneId', $data ?? [], null); + $this->setIfExists('emailId', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets extId + * + * @return string|null + */ + public function getExtId(): ?string + { + return $this->container['extId']; + } + + /** + * Sets extId + * + * @param string|null $extId ext_id associated with the order + * + * @return $this + */ + public function setExtId(?string $extId): static + { + if (is_null($extId)) { + throw new InvalidArgumentException('non-nullable extId cannot be null'); + } + $this->container['extId'] = $extId; + + return $this; + } + + /** + * Gets loyaltySubscriptionId + * + * @return string|null + */ + public function getLoyaltySubscriptionId(): ?string + { + return $this->container['loyaltySubscriptionId']; + } + + /** + * Sets loyaltySubscriptionId + * + * @param string|null $loyaltySubscriptionId loyalty_subscription_id associated with the order + * + * @return $this + */ + public function setLoyaltySubscriptionId(?string $loyaltySubscriptionId): static + { + if (is_null($loyaltySubscriptionId)) { + throw new InvalidArgumentException('non-nullable loyaltySubscriptionId cannot be null'); + } + $this->container['loyaltySubscriptionId'] = $loyaltySubscriptionId; + + return $this; + } + + /** + * Gets phoneId + * + * @return string|null + */ + public function getPhoneId(): ?string + { + return $this->container['phoneId']; + } + + /** + * Sets phoneId + * + * @param string|null $phoneId Phone number of the contact associated with the order + * + * @return $this + */ + public function setPhoneId(?string $phoneId): static + { + if (is_null($phoneId)) { + throw new InvalidArgumentException('non-nullable phoneId cannot be null'); + } + $this->container['phoneId'] = $phoneId; + + return $this; + } + + /** + * Gets emailId + * + * @return string|null + */ + public function getEmailId(): ?string + { + return $this->container['emailId']; + } + + /** + * Sets emailId + * + * @param string|null $emailId Email of the contact associated with the order + * + * @return $this + */ + public function setEmailId(?string $emailId): static + { + if (is_null($emailId)) { + throw new InvalidArgumentException('non-nullable emailId cannot be null'); + } + $this->container['emailId'] = $emailId; + + return $this; + } +} + + diff --git a/lib/Models/OrderProducts.php b/lib/Models/OrderProducts.php deleted file mode 100644 index 2e2127e..0000000 --- a/lib/Models/OrderProducts.php +++ /dev/null @@ -1,405 +0,0 @@ - 'string', - 'quantity' => 'float', - 'variantId' => 'string', - 'price' => 'float' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'productId' => null, - 'quantity' => null, - 'variantId' => null, - 'price' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'productId' => 'productId', - 'quantity' => 'quantity', - 'variantId' => 'variantId', - 'price' => 'price' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'productId' => 'setProductId', - 'quantity' => 'setQuantity', - 'variantId' => 'setVariantId', - 'price' => 'setPrice' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'productId' => 'getProductId', - 'quantity' => 'getQuantity', - 'variantId' => 'getVariantId', - 'price' => 'getPrice' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['productId'] = isset($data['productId']) ? $data['productId'] : null; - $this->container['quantity'] = isset($data['quantity']) ? $data['quantity'] : null; - $this->container['variantId'] = isset($data['variantId']) ? $data['variantId'] : null; - $this->container['price'] = isset($data['price']) ? $data['price'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['productId'] === null) { - $invalidProperties[] = "'productId' can't be null"; - } - if ($this->container['quantity'] === null) { - $invalidProperties[] = "'quantity' can't be null"; - } - if ($this->container['price'] === null) { - $invalidProperties[] = "'price' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets productId - * - * @return string - */ - public function getProductId() - { - return $this->container['productId']; - } - - /** - * Sets productId - * - * @param string $productId ID of the product. - * - * @return $this - */ - public function setProductId($productId) - { - $this->container['productId'] = $productId; - - return $this; - } - - /** - * Gets quantity - * - * @return float - */ - public function getQuantity() - { - return $this->container['quantity']; - } - - /** - * Sets quantity - * - * @param float $quantity How many pieces of the product the visitor has added to the cart. - * - * @return $this - */ - public function setQuantity($quantity) - { - $this->container['quantity'] = $quantity; - - return $this; - } - - /** - * Gets variantId - * - * @return string - */ - public function getVariantId() - { - return $this->container['variantId']; - } - - /** - * Sets variantId - * - * @param string $variantId Product ID of the red color shirts. - * - * @return $this - */ - public function setVariantId($variantId) - { - $this->container['variantId'] = $variantId; - - return $this; - } - - /** - * Gets price - * - * @return float - */ - public function getPrice() - { - return $this->container['price']; - } - - /** - * Sets price - * - * @param float $price The price of a unit of product - * - * @return $this - */ - public function setPrice($price) - { - $this->container['price'] = $price; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/OrderProductsInner.php b/lib/Models/OrderProductsInner.php new file mode 100644 index 0000000..f9694af --- /dev/null +++ b/lib/Models/OrderProductsInner.php @@ -0,0 +1,319 @@ + + */ +class OrderProductsInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'order_products_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'productId' => 'string', + 'quantity' => 'float', + 'price' => 'float', + 'variantId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'productId' => null, + 'quantity' => null, + 'price' => null, + 'variantId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'productId' => false, + 'quantity' => false, + 'price' => false, + 'variantId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'productId' => 'productId', + 'quantity' => 'quantity', + 'price' => 'price', + 'variantId' => 'variantId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'productId' => 'setProductId', + 'quantity' => 'setQuantity', + 'price' => 'setPrice', + 'variantId' => 'setVariantId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'productId' => 'getProductId', + 'quantity' => 'getQuantity', + 'price' => 'getPrice', + 'variantId' => 'getVariantId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('quantity', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('variantId', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['productId'] === null) { + $invalidProperties[] = "'productId' can't be null"; + } + if ($this->container['quantity'] === null) { + $invalidProperties[] = "'quantity' can't be null"; + } + if ($this->container['price'] === null) { + $invalidProperties[] = "'price' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets productId + * + * @return string + */ + public function getProductId(): string + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param string $productId ID of the product. + * + * @return $this + */ + public function setProductId(string $productId): static + { + if (is_null($productId)) { + throw new InvalidArgumentException('non-nullable productId cannot be null'); + } + $this->container['productId'] = $productId; + + return $this; + } + + /** + * Gets quantity + * + * @return float + */ + public function getQuantity(): float + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param float $quantity How many pieces of the product the visitor has added to the cart. + * + * @return $this + */ + public function setQuantity(float $quantity): static + { + if (is_null($quantity)) { + throw new InvalidArgumentException('non-nullable quantity cannot be null'); + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets price + * + * @return float + */ + public function getPrice(): float + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param float $price The price of a unit of product + * + * @return $this + */ + public function setPrice(float $price): static + { + if (is_null($price)) { + throw new InvalidArgumentException('non-nullable price cannot be null'); + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets variantId + * + * @return string|null + */ + public function getVariantId(): ?string + { + return $this->container['variantId']; + } + + /** + * Sets variantId + * + * @param string|null $variantId Product ID of the red color shirts. + * + * @return $this + */ + public function setVariantId(?string $variantId): static + { + if (is_null($variantId)) { + throw new InvalidArgumentException('non-nullable variantId cannot be null'); + } + $this->container['variantId'] = $variantId; + + return $this; + } +} + + diff --git a/lib/Models/Otp.php b/lib/Models/Otp.php index 29c9610..1fd4424 100644 --- a/lib/Models/Otp.php +++ b/lib/Models/Otp.php @@ -2,128 +2,126 @@ /** * Otp * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * Otp Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class Otp implements ModelInterface, ArrayAccess +class Otp extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'otp'; + protected static string $openAPIModelName = 'otp'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'name' => 'int' + protected static array $openAPITypes = [ + 'otp' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'name' => null + protected static array $openAPIFormats = [ + 'otp' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'otp' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ - 'name' => 'name' + protected static array $attributeMap = [ + 'otp' => 'otp' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ - 'name' => 'setName' + protected static array $setters = [ + 'otp' => 'setOtp' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ - 'name' => 'getName' + protected static array $getters = [ + 'otp' => 'getOtp' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,164 +139,71 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('otp', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; + if ($this->container['otp'] === null) { + $invalidProperties[] = "'otp' can't be null"; + } return $invalidProperties; } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets name + * Gets otp * * @return int */ - public function getName() + public function getOtp(): int { - return $this->container['name']; + return $this->container['otp']; } /** - * Sets name + * Sets otp * - * @param int $name 6 digit OTP received on email + * @param int $otp 6 digit OTP received on email * * @return $this */ - public function setName($name) + public function setOtp(int $otp): static { - $this->container['name'] = $name; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($otp)) { + throw new InvalidArgumentException('non-nullable otp cannot be null'); } + $this->container['otp'] = $otp; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/PatchLoyaltyProgramPayload.php b/lib/Models/PatchLoyaltyProgramPayload.php new file mode 100644 index 0000000..cf3159e --- /dev/null +++ b/lib/Models/PatchLoyaltyProgramPayload.php @@ -0,0 +1,275 @@ + + */ +class PatchLoyaltyProgramPayload extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'patchLoyaltyProgramPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'description' => 'string', + 'meta' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'description' => null, + 'meta' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'description' => false, + 'meta' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'description' => 'description', + 'meta' => 'meta' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'description' => 'setDescription', + 'meta' => 'setMeta' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'description' => 'getDescription', + 'meta' => 'getMeta' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('meta', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Loyalty Program name + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Loyalty Program description + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets meta + * + * @return object|null + */ + public function getMeta(): ?object + { + return $this->container['meta']; + } + + /** + * Sets meta + * + * @param object|null $meta Loyalty Program meta data + * + * @return $this + */ + public function setMeta(?object $meta): static + { + if (is_null($meta)) { + throw new InvalidArgumentException('non-nullable meta cannot be null'); + } + $this->container['meta'] = $meta; + + return $this; + } +} + + diff --git a/lib/Models/Pipeline.php b/lib/Models/Pipeline.php index effb700..407efd4 100644 --- a/lib/Models/Pipeline.php +++ b/lib/Models/Pipeline.php @@ -2,129 +2,129 @@ /** * Pipeline * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * Pipeline Class Doc Comment * - * @category Class * @description List of stages * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class Pipeline implements ModelInterface, ArrayAccess +class Pipeline extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'Pipeline'; + protected static string $openAPIModelName = 'Pipeline'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'pipeline' => 'string', + protected static array $openAPITypes = [ 'pipelineName' => 'string', + 'pipeline' => 'string', 'stages' => '\Brevo\Client\Models\PipelineStage[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'pipeline' => null, + protected static array $openAPIFormats = [ 'pipelineName' => null, + 'pipeline' => null, 'stages' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'pipelineName' => false, + 'pipeline' => false, + 'stages' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ - 'pipeline' => 'pipeline', + protected static array $attributeMap = [ 'pipelineName' => 'pipeline_name', + 'pipeline' => 'pipeline', 'stages' => 'stages' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ - 'pipeline' => 'setPipeline', + protected static array $setters = [ 'pipelineName' => 'setPipelineName', + 'pipeline' => 'setPipeline', 'stages' => 'setStages' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ - 'pipeline' => 'getPipeline', + protected static array $getters = [ 'pipelineName' => 'getPipelineName', + 'pipeline' => 'getPipeline', 'stages' => 'getStages' ]; @@ -132,9 +132,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -142,9 +142,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -152,53 +152,39 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['pipeline'] = isset($data['pipeline']) ? $data['pipeline'] : null; - $this->container['pipelineName'] = isset($data['pipelineName']) ? $data['pipelineName'] : null; - $this->container['stages'] = isset($data['stages']) ? $data['stages'] : null; + $this->setIfExists('pipelineName', $data ?? [], null); + $this->setIfExists('pipeline', $data ?? [], null); + $this->setIfExists('stages', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -206,61 +192,55 @@ public function listInvalidProperties() } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets pipeline + * Gets pipelineName * - * @return string + * @return string|null */ - public function getPipeline() + public function getPipelineName(): ?string { - return $this->container['pipeline']; + return $this->container['pipelineName']; } /** - * Sets pipeline + * Sets pipelineName * - * @param string $pipeline Pipeline id + * @param string|null $pipelineName Pipeline name * * @return $this */ - public function setPipeline($pipeline) + public function setPipelineName(?string $pipelineName): static { - $this->container['pipeline'] = $pipeline; + if (is_null($pipelineName)) { + throw new InvalidArgumentException('non-nullable pipelineName cannot be null'); + } + $this->container['pipelineName'] = $pipelineName; return $this; } /** - * Gets pipelineName + * Gets pipeline * - * @return string + * @return string|null */ - public function getPipelineName() + public function getPipeline(): ?string { - return $this->container['pipelineName']; + return $this->container['pipeline']; } /** - * Sets pipelineName + * Sets pipeline * - * @param string $pipelineName Pipeline Name + * @param string|null $pipeline Pipeline id * * @return $this */ - public function setPipelineName($pipelineName) + public function setPipeline(?string $pipeline): static { - $this->container['pipelineName'] = $pipelineName; + if (is_null($pipeline)) { + throw new InvalidArgumentException('non-nullable pipeline cannot be null'); + } + $this->container['pipeline'] = $pipeline; return $this; } @@ -268,9 +248,9 @@ public function setPipelineName($pipelineName) /** * Gets stages * - * @return \Brevo\Client\Models\PipelineStage[] + * @return \Brevo\Client\Models\PipelineStage[]|null */ - public function getStages() + public function getStages(): ?array { return $this->container['stages']; } @@ -278,89 +258,19 @@ public function getStages() /** * Sets stages * - * @param \Brevo\Client\Models\PipelineStage[] $stages List of stages + * @param \Brevo\Client\Models\PipelineStage[]|null $stages List of stages * * @return $this */ - public function setStages($stages) + public function setStages(?array $stages): static { + if (is_null($stages)) { + throw new InvalidArgumentException('non-nullable stages cannot be null'); + } $this->container['stages'] = $stages; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/PipelineStage.php b/lib/Models/PipelineStage.php index 6b3135f..181d1f8 100644 --- a/lib/Models/PipelineStage.php +++ b/lib/Models/PipelineStage.php @@ -2,62 +2,64 @@ /** * PipelineStage * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * PipelineStage Class Doc Comment * - * @category Class * @description List of stages * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class PipelineStage implements ModelInterface, ArrayAccess +class PipelineStage extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PipelineStage'; + protected static string $openAPIModelName = 'PipelineStage'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'string', 'name' => 'string' ]; @@ -65,40 +67,37 @@ class PipelineStage implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => null, 'name' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name' ]; @@ -106,9 +105,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName' ]; @@ -116,9 +115,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName' ]; @@ -127,9 +126,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -137,9 +136,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -147,76 +146,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * - * @return string + * @return string|null */ - public function getId() + public function getId(): ?string { return $this->container['id']; } @@ -224,12 +197,15 @@ public function getId() /** * Sets id * - * @param string $id Stage id + * @param string|null $id Stage id * * @return $this */ - public function setId($id) + public function setId(?string $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -238,9 +214,9 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -248,89 +224,19 @@ public function getName() /** * Sets name * - * @param string $name Stage name + * @param string|null $name Stage name * * @return $this */ - public function setName($name) + public function setName(?string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/Pipelines.php b/lib/Models/Pipelines.php deleted file mode 100644 index 9e98b53..0000000 --- a/lib/Models/Pipelines.php +++ /dev/null @@ -1,281 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/PostContactInfo.php b/lib/Models/PostContactInfo.php index c93b0fe..3fba65c 100644 --- a/lib/Models/PostContactInfo.php +++ b/lib/Models/PostContactInfo.php @@ -2,118 +2,116 @@ /** * PostContactInfo * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * PostContactInfo Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class PostContactInfo implements ModelInterface, ArrayAccess +class PostContactInfo extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'postContactInfo'; + protected static string $openAPIModelName = 'postContactInfo'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'contacts' => '\Brevo\Client\Models\PostContactInfoContacts' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'contacts' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'contacts' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'contacts' => 'contacts' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'contacts' => 'setContacts' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'contacts' => 'getContacts' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,51 +139,37 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['contacts'] = isset($data['contacts']) ? $data['contacts'] : null; + $this->setIfExists('contacts', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -195,24 +179,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets contacts * * @return \Brevo\Client\Models\PostContactInfoContacts */ - public function getContacts() + public function getContacts(): \Brevo\Client\Models\PostContactInfoContacts { return $this->container['contacts']; } @@ -224,85 +196,15 @@ public function getContacts() * * @return $this */ - public function setContacts($contacts) + public function setContacts(\Brevo\Client\Models\PostContactInfoContacts $contacts): static { + if (is_null($contacts)) { + throw new InvalidArgumentException('non-nullable contacts cannot be null'); + } $this->container['contacts'] = $contacts; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/PostContactInfoContacts.php b/lib/Models/PostContactInfoContacts.php index 8687357..f28e628 100644 --- a/lib/Models/PostContactInfoContacts.php +++ b/lib/Models/PostContactInfoContacts.php @@ -2,63 +2,65 @@ /** * PostContactInfoContacts * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * PostContactInfoContacts Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class PostContactInfoContacts implements ModelInterface, ArrayAccess +class PostContactInfoContacts extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'postContactInfo_contacts'; + protected static string $openAPIModelName = 'postContactInfo_contacts'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'success' => 'string[]', - 'failure' => 'string[]', + protected static array $openAPITypes = [ + 'success' => '\Brevo\Client\Models\PostContactInfoContactsSuccess', + 'failure' => '\Brevo\Client\Models\PostContactInfoContactsFailure', 'total' => 'int', 'processId' => 'int' ]; @@ -66,42 +68,41 @@ class PostContactInfoContacts implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'success' => 'email', - 'failure' => 'email', + protected static array $openAPIFormats = [ + 'success' => null, + 'failure' => null, 'total' => 'int64', 'processId' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'success' => false, + 'failure' => false, + 'total' => false, + 'processId' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'success' => 'success', 'failure' => 'failure', 'total' => 'total', @@ -111,9 +112,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'success' => 'setSuccess', 'failure' => 'setFailure', 'total' => 'setTotal', @@ -123,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'success' => 'getSuccess', 'failure' => 'getFailure', 'total' => 'getTotal', @@ -136,9 +137,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +147,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,78 +157,52 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['success'] = isset($data['success']) ? $data['success'] : null; - $this->container['failure'] = isset($data['failure']) ? $data['failure'] : null; - $this->container['total'] = isset($data['total']) ? $data['total'] : null; - $this->container['processId'] = isset($data['processId']) ? $data['processId'] : null; + $this->setIfExists('success', $data ?? [], null); + $this->setIfExists('failure', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('processId', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets success * - * @return string[] + * @return \Brevo\Client\Models\PostContactInfoContactsSuccess|null */ - public function getSuccess() + public function getSuccess(): ?\Brevo\Client\Models\PostContactInfoContactsSuccess { return $this->container['success']; } @@ -235,12 +210,15 @@ public function getSuccess() /** * Sets success * - * @param string[] $success success + * @param \Brevo\Client\Models\PostContactInfoContactsSuccess|null $success success * * @return $this */ - public function setSuccess($success) + public function setSuccess(?\Brevo\Client\Models\PostContactInfoContactsSuccess $success): static { + if (is_null($success)) { + throw new InvalidArgumentException('non-nullable success cannot be null'); + } $this->container['success'] = $success; return $this; @@ -249,9 +227,9 @@ public function setSuccess($success) /** * Gets failure * - * @return string[] + * @return \Brevo\Client\Models\PostContactInfoContactsFailure|null */ - public function getFailure() + public function getFailure(): ?\Brevo\Client\Models\PostContactInfoContactsFailure { return $this->container['failure']; } @@ -259,12 +237,15 @@ public function getFailure() /** * Sets failure * - * @param string[] $failure failure + * @param \Brevo\Client\Models\PostContactInfoContactsFailure|null $failure failure * * @return $this */ - public function setFailure($failure) + public function setFailure(?\Brevo\Client\Models\PostContactInfoContactsFailure $failure): static { + if (is_null($failure)) { + throw new InvalidArgumentException('non-nullable failure cannot be null'); + } $this->container['failure'] = $failure; return $this; @@ -273,9 +254,9 @@ public function setFailure($failure) /** * Gets total * - * @return int + * @return int|null */ - public function getTotal() + public function getTotal(): ?int { return $this->container['total']; } @@ -283,12 +264,15 @@ public function getTotal() /** * Sets total * - * @param int $total Displays the count of total number of contacts removed from list when user opts for \"all\" option. + * @param int|null $total Displays the count of total number of contacts removed from list when user opts for \"all\" option. * * @return $this */ - public function setTotal($total) + public function setTotal(?int $total): static { + if (is_null($total)) { + throw new InvalidArgumentException('non-nullable total cannot be null'); + } $this->container['total'] = $total; return $this; @@ -297,9 +281,9 @@ public function setTotal($total) /** * Gets processId * - * @return int + * @return int|null */ - public function getProcessId() + public function getProcessId(): ?int { return $this->container['processId']; } @@ -307,89 +291,19 @@ public function getProcessId() /** * Sets processId * - * @param int $processId Id of the process created to remove contacts from list when user opts for \"all\" option. + * @param int|null $processId Id of the process created to remove contacts from list when user opts for \"all\" option. * * @return $this */ - public function setProcessId($processId) + public function setProcessId(?int $processId): static { + if (is_null($processId)) { + throw new InvalidArgumentException('non-nullable processId cannot be null'); + } $this->container['processId'] = $processId; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/PostContactInfoContactsFailure.php b/lib/Models/PostContactInfoContactsFailure.php new file mode 100644 index 0000000..145ce61 --- /dev/null +++ b/lib/Models/PostContactInfoContactsFailure.php @@ -0,0 +1,179 @@ + + */ +class PostContactInfoContactsFailure extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'postContactInfo_contacts_failure'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } +} + + diff --git a/lib/Models/PostContactInfoContactsSuccess.php b/lib/Models/PostContactInfoContactsSuccess.php new file mode 100644 index 0000000..2d222bb --- /dev/null +++ b/lib/Models/PostContactInfoContactsSuccess.php @@ -0,0 +1,179 @@ + + */ +class PostContactInfoContactsSuccess extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'postContactInfo_contacts_success'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } +} + + diff --git a/lib/Models/PostSendFailed.php b/lib/Models/PostSendFailed.php index 3f93078..0d0ee51 100644 --- a/lib/Models/PostSendFailed.php +++ b/lib/Models/PostSendFailed.php @@ -2,62 +2,64 @@ /** * PostSendFailed * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * PostSendFailed Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class PostSendFailed implements ModelInterface, ArrayAccess +class PostSendFailed extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'postSendFailed'; + protected static string $openAPIModelName = 'postSendFailed'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'code' => 'int', + protected static array $openAPITypes = [ + 'code' => 'string', 'message' => 'string', 'unexistingEmails' => 'string[]', 'withoutListEmails' => 'string[]', @@ -67,10 +69,10 @@ class PostSendFailed implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'code' => 'int64', + protected static array $openAPIFormats = [ + 'code' => null, 'message' => null, 'unexistingEmails' => 'email', 'withoutListEmails' => 'email', @@ -78,32 +80,32 @@ class PostSendFailed implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'code' => false, + 'message' => false, + 'unexistingEmails' => false, + 'withoutListEmails' => false, + 'blackListedEmails' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'code' => 'code', 'message' => 'message', 'unexistingEmails' => 'unexistingEmails', @@ -114,9 +116,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'code' => 'setCode', 'message' => 'setMessage', 'unexistingEmails' => 'setUnexistingEmails', @@ -127,9 +129,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'code' => 'getCode', 'message' => 'getMessage', 'unexistingEmails' => 'getUnexistingEmails', @@ -141,9 +143,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -151,9 +153,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -161,55 +163,41 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['code'] = isset($data['code']) ? $data['code'] : null; - $this->container['message'] = isset($data['message']) ? $data['message'] : null; - $this->container['unexistingEmails'] = isset($data['unexistingEmails']) ? $data['unexistingEmails'] : null; - $this->container['withoutListEmails'] = isset($data['withoutListEmails']) ? $data['withoutListEmails'] : null; - $this->container['blackListedEmails'] = isset($data['blackListedEmails']) ? $data['blackListedEmails'] : null; + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('unexistingEmails', $data ?? [], null); + $this->setIfExists('withoutListEmails', $data ?? [], null); + $this->setIfExists('blackListedEmails', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -222,24 +210,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets code * - * @return int + * @return string */ - public function getCode() + public function getCode(): string { return $this->container['code']; } @@ -247,12 +223,15 @@ public function getCode() /** * Sets code * - * @param int $code Response code + * @param string $code Response code * * @return $this */ - public function setCode($code) + public function setCode(string $code): static { + if (is_null($code)) { + throw new InvalidArgumentException('non-nullable code cannot be null'); + } $this->container['code'] = $code; return $this; @@ -263,7 +242,7 @@ public function setCode($code) * * @return string */ - public function getMessage() + public function getMessage(): string { return $this->container['message']; } @@ -275,8 +254,11 @@ public function getMessage() * * @return $this */ - public function setMessage($message) + public function setMessage(string $message): static { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; @@ -285,9 +267,9 @@ public function setMessage($message) /** * Gets unexistingEmails * - * @return string[] + * @return string[]|null */ - public function getUnexistingEmails() + public function getUnexistingEmails(): ?array { return $this->container['unexistingEmails']; } @@ -295,12 +277,15 @@ public function getUnexistingEmails() /** * Sets unexistingEmails * - * @param string[] $unexistingEmails unexistingEmails + * @param string[]|null $unexistingEmails unexistingEmails * * @return $this */ - public function setUnexistingEmails($unexistingEmails) + public function setUnexistingEmails(?array $unexistingEmails): static { + if (is_null($unexistingEmails)) { + throw new InvalidArgumentException('non-nullable unexistingEmails cannot be null'); + } $this->container['unexistingEmails'] = $unexistingEmails; return $this; @@ -309,9 +294,9 @@ public function setUnexistingEmails($unexistingEmails) /** * Gets withoutListEmails * - * @return string[] + * @return string[]|null */ - public function getWithoutListEmails() + public function getWithoutListEmails(): ?array { return $this->container['withoutListEmails']; } @@ -319,12 +304,15 @@ public function getWithoutListEmails() /** * Sets withoutListEmails * - * @param string[] $withoutListEmails withoutListEmails + * @param string[]|null $withoutListEmails withoutListEmails * * @return $this */ - public function setWithoutListEmails($withoutListEmails) + public function setWithoutListEmails(?array $withoutListEmails): static { + if (is_null($withoutListEmails)) { + throw new InvalidArgumentException('non-nullable withoutListEmails cannot be null'); + } $this->container['withoutListEmails'] = $withoutListEmails; return $this; @@ -333,9 +321,9 @@ public function setWithoutListEmails($withoutListEmails) /** * Gets blackListedEmails * - * @return string[] + * @return string[]|null */ - public function getBlackListedEmails() + public function getBlackListedEmails(): ?array { return $this->container['blackListedEmails']; } @@ -343,89 +331,19 @@ public function getBlackListedEmails() /** * Sets blackListedEmails * - * @param string[] $blackListedEmails blackListedEmails + * @param string[]|null $blackListedEmails blackListedEmails * * @return $this */ - public function setBlackListedEmails($blackListedEmails) + public function setBlackListedEmails(?array $blackListedEmails): static { + if (is_null($blackListedEmails)) { + throw new InvalidArgumentException('non-nullable blackListedEmails cannot be null'); + } $this->container['blackListedEmails'] = $blackListedEmails; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/PostSendSmsTestFailed.php b/lib/Models/PostSendSmsTestFailed.php index 95c6f5b..328b41f 100644 --- a/lib/Models/PostSendSmsTestFailed.php +++ b/lib/Models/PostSendSmsTestFailed.php @@ -2,62 +2,64 @@ /** * PostSendSmsTestFailed * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * PostSendSmsTestFailed Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class PostSendSmsTestFailed implements ModelInterface, ArrayAccess +class PostSendSmsTestFailed extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'postSendSmsTestFailed'; + protected static string $openAPIModelName = 'postSendSmsTestFailed'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'code' => 'int', + protected static array $openAPITypes = [ + 'code' => 'string', 'message' => 'string', 'unexistingSms' => 'string[]', 'withoutListSms' => 'string[]' @@ -66,42 +68,41 @@ class PostSendSmsTestFailed implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'code' => 'int64', + protected static array $openAPIFormats = [ + 'code' => null, 'message' => null, 'unexistingSms' => 'email', 'withoutListSms' => 'email' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'code' => false, + 'message' => false, + 'unexistingSms' => false, + 'withoutListSms' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'code' => 'code', 'message' => 'message', 'unexistingSms' => 'unexistingSms', @@ -111,9 +112,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'code' => 'setCode', 'message' => 'setMessage', 'unexistingSms' => 'setUnexistingSms', @@ -123,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'code' => 'getCode', 'message' => 'getMessage', 'unexistingSms' => 'getUnexistingSms', @@ -136,9 +137,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +147,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,54 +157,40 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['code'] = isset($data['code']) ? $data['code'] : null; - $this->container['message'] = isset($data['message']) ? $data['message'] : null; - $this->container['unexistingSms'] = isset($data['unexistingSms']) ? $data['unexistingSms'] : null; - $this->container['withoutListSms'] = isset($data['withoutListSms']) ? $data['withoutListSms'] : null; + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('unexistingSms', $data ?? [], null); + $this->setIfExists('withoutListSms', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -216,24 +203,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets code * - * @return int + * @return string */ - public function getCode() + public function getCode(): string { return $this->container['code']; } @@ -241,12 +216,15 @@ public function getCode() /** * Sets code * - * @param int $code Response code + * @param string $code Response code * * @return $this */ - public function setCode($code) + public function setCode(string $code): static { + if (is_null($code)) { + throw new InvalidArgumentException('non-nullable code cannot be null'); + } $this->container['code'] = $code; return $this; @@ -257,7 +235,7 @@ public function setCode($code) * * @return string */ - public function getMessage() + public function getMessage(): string { return $this->container['message']; } @@ -269,8 +247,11 @@ public function getMessage() * * @return $this */ - public function setMessage($message) + public function setMessage(string $message): static { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; @@ -279,9 +260,9 @@ public function setMessage($message) /** * Gets unexistingSms * - * @return string[] + * @return string[]|null */ - public function getUnexistingSms() + public function getUnexistingSms(): ?array { return $this->container['unexistingSms']; } @@ -289,12 +270,15 @@ public function getUnexistingSms() /** * Sets unexistingSms * - * @param string[] $unexistingSms unexistingSms + * @param string[]|null $unexistingSms unexistingSms * * @return $this */ - public function setUnexistingSms($unexistingSms) + public function setUnexistingSms(?array $unexistingSms): static { + if (is_null($unexistingSms)) { + throw new InvalidArgumentException('non-nullable unexistingSms cannot be null'); + } $this->container['unexistingSms'] = $unexistingSms; return $this; @@ -303,9 +287,9 @@ public function setUnexistingSms($unexistingSms) /** * Gets withoutListSms * - * @return string[] + * @return string[]|null */ - public function getWithoutListSms() + public function getWithoutListSms(): ?array { return $this->container['withoutListSms']; } @@ -313,89 +297,19 @@ public function getWithoutListSms() /** * Sets withoutListSms * - * @param string[] $withoutListSms withoutListSms + * @param string[]|null $withoutListSms withoutListSms * * @return $this */ - public function setWithoutListSms($withoutListSms) + public function setWithoutListSms(?array $withoutListSms): static { + if (is_null($withoutListSms)) { + throw new InvalidArgumentException('non-nullable withoutListSms cannot be null'); + } $this->container['withoutListSms'] = $withoutListSms; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/PutRevokeUserPermission.php b/lib/Models/PutRevokeUserPermission.php index 6f89332..98a41c2 100644 --- a/lib/Models/PutRevokeUserPermission.php +++ b/lib/Models/PutRevokeUserPermission.php @@ -2,119 +2,117 @@ /** * PutRevokeUserPermission * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * PutRevokeUserPermission Class Doc Comment * - * @category Class * @description Revoke user permission * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class PutRevokeUserPermission implements ModelInterface, ArrayAccess +class PutRevokeUserPermission extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'putRevokeUserPermission'; + protected static string $openAPIModelName = 'putRevokeUserPermission'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'email' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'email' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'email' => 'email' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'email' => 'setEmail' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'email' => 'getEmail' ]; @@ -122,9 +120,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -132,9 +130,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -142,51 +140,37 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; + $this->setIfExists('email', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -196,24 +180,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets email * * @return string */ - public function getEmail() + public function getEmail(): string { return $this->container['email']; } @@ -225,85 +197,15 @@ public function getEmail() * * @return $this */ - public function setEmail($email) + public function setEmail(string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/PutRevokeUserPermissionResponse.php b/lib/Models/PutRevokeUserPermissionResponse.php new file mode 100644 index 0000000..4dc7efa --- /dev/null +++ b/lib/Models/PutRevokeUserPermissionResponse.php @@ -0,0 +1,244 @@ + + */ +class PutRevokeUserPermissionResponse extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'putRevokeUserPermissionResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'status' => 'string', + 'creditNotes' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'status' => null, + 'creditNotes' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'status' => false, + 'creditNotes' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'status' => 'status', + 'creditNotes' => 'credit_notes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'status' => 'setStatus', + 'creditNotes' => 'setCreditNotes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'status' => 'getStatus', + 'creditNotes' => 'getCreditNotes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('creditNotes', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus(): string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status Status of the API operation. + * + * @return $this + */ + public function setStatus(string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets creditNotes + * + * @return string[]|null + */ + public function getCreditNotes(): ?array + { + return $this->container['creditNotes']; + } + + /** + * Sets creditNotes + * + * @param string[]|null $creditNotes Credit note + * + * @return $this + */ + public function setCreditNotes(?array $creditNotes): static + { + if (is_null($creditNotes)) { + throw new InvalidArgumentException('non-nullable creditNotes cannot be null'); + } + $this->container['creditNotes'] = $creditNotes; + + return $this; + } +} + + diff --git a/lib/Models/Putresendcancelinvitation.php b/lib/Models/Putresendcancelinvitation.php index 860236e..d081480 100644 --- a/lib/Models/Putresendcancelinvitation.php +++ b/lib/Models/Putresendcancelinvitation.php @@ -2,119 +2,117 @@ /** * Putresendcancelinvitation * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * Putresendcancelinvitation Class Doc Comment * - * @category Class * @description Revoke user permission * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class Putresendcancelinvitation implements ModelInterface, ArrayAccess +class Putresendcancelinvitation extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'putresendcancelinvitation'; + protected static string $openAPIModelName = 'putresendcancelinvitation'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'email' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'email' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'email' => 'email' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'email' => 'setEmail' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'email' => 'getEmail' ]; @@ -122,9 +120,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -132,9 +130,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -142,51 +140,37 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; + $this->setIfExists('email', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -196,24 +180,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets email * * @return string */ - public function getEmail() + public function getEmail(): string { return $this->container['email']; } @@ -225,85 +197,15 @@ public function getEmail() * * @return $this */ - public function setEmail($email) + public function setEmail(string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/PutresendcancelinvitationResponse.php b/lib/Models/PutresendcancelinvitationResponse.php new file mode 100644 index 0000000..689d780 --- /dev/null +++ b/lib/Models/PutresendcancelinvitationResponse.php @@ -0,0 +1,244 @@ + + */ +class PutresendcancelinvitationResponse extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'putresendcancelinvitationResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'status' => 'string', + 'creditNotes' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'status' => null, + 'creditNotes' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'status' => false, + 'creditNotes' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'status' => 'status', + 'creditNotes' => 'credit_notes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'status' => 'setStatus', + 'creditNotes' => 'setCreditNotes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'status' => 'getStatus', + 'creditNotes' => 'getCreditNotes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('creditNotes', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus(): string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status Status of the API operation. + * + * @return $this + */ + public function setStatus(string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets creditNotes + * + * @return string[]|null + */ + public function getCreditNotes(): ?array + { + return $this->container['creditNotes']; + } + + /** + * Sets creditNotes + * + * @param string[]|null $creditNotes Credit note + * + * @return $this + */ + public function setCreditNotes(?array $creditNotes): static + { + if (is_null($creditNotes)) { + throw new InvalidArgumentException('non-nullable creditNotes cannot be null'); + } + $this->container['creditNotes'] = $creditNotes; + + return $this; + } +} + + diff --git a/lib/Models/RedeemRewardPayload.php b/lib/Models/RedeemRewardPayload.php new file mode 100644 index 0000000..3a71652 --- /dev/null +++ b/lib/Models/RedeemRewardPayload.php @@ -0,0 +1,343 @@ + + */ +class RedeemRewardPayload extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'redeemRewardPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'code' => 'string', + 'attributedRewardId' => 'string', + 'posId' => 'string', + 'contactId' => 'float', + 'loyaltySubscriptionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'code' => null, + 'attributedRewardId' => 'uuid', + 'posId' => 'uuid', + 'contactId' => null, + 'loyaltySubscriptionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'code' => false, + 'attributedRewardId' => false, + 'posId' => false, + 'contactId' => false, + 'loyaltySubscriptionId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'code' => 'code', + 'attributedRewardId' => 'attributedRewardId', + 'posId' => 'posId', + 'contactId' => 'contactId', + 'loyaltySubscriptionId' => 'loyaltySubscriptionId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'code' => 'setCode', + 'attributedRewardId' => 'setAttributedRewardId', + 'posId' => 'setPosId', + 'contactId' => 'setContactId', + 'loyaltySubscriptionId' => 'setLoyaltySubscriptionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'code' => 'getCode', + 'attributedRewardId' => 'getAttributedRewardId', + 'posId' => 'getPosId', + 'contactId' => 'getContactId', + 'loyaltySubscriptionId' => 'getLoyaltySubscriptionId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('attributedRewardId', $data ?? [], null); + $this->setIfExists('posId', $data ?? [], null); + $this->setIfExists('contactId', $data ?? [], null); + $this->setIfExists('loyaltySubscriptionId', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode(): ?string + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code Code to validate + * + * @return $this + */ + public function setCode(?string $code): static + { + if (is_null($code)) { + throw new InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets attributedRewardId + * + * @return string|null + */ + public function getAttributedRewardId(): ?string + { + return $this->container['attributedRewardId']; + } + + /** + * Sets attributedRewardId + * + * @param string|null $attributedRewardId One of code or attributed reward id is required + * + * @return $this + */ + public function setAttributedRewardId(?string $attributedRewardId): static + { + if (is_null($attributedRewardId)) { + throw new InvalidArgumentException('non-nullable attributedRewardId cannot be null'); + } + $this->container['attributedRewardId'] = $attributedRewardId; + + return $this; + } + + /** + * Gets posId + * + * @return string|null + */ + public function getPosId(): ?string + { + return $this->container['posId']; + } + + /** + * Sets posId + * + * @param string|null $posId Point of sale reward id + * + * @return $this + */ + public function setPosId(?string $posId): static + { + if (is_null($posId)) { + throw new InvalidArgumentException('non-nullable posId cannot be null'); + } + $this->container['posId'] = $posId; + + return $this; + } + + /** + * Gets contactId + * + * @return float|null + */ + public function getContactId(): ?float + { + return $this->container['contactId']; + } + + /** + * Sets contactId + * + * @param float|null $contactId Contact to attribute the reward + * + * @return $this + */ + public function setContactId(?float $contactId): static + { + if (is_null($contactId)) { + throw new InvalidArgumentException('non-nullable contactId cannot be null'); + } + $this->container['contactId'] = $contactId; + + return $this; + } + + /** + * Gets loyaltySubscriptionId + * + * @return string|null + */ + public function getLoyaltySubscriptionId(): ?string + { + return $this->container['loyaltySubscriptionId']; + } + + /** + * Sets loyaltySubscriptionId + * + * @param string|null $loyaltySubscriptionId One of contactId or loyaltySubscriptionId is required + * + * @return $this + */ + public function setLoyaltySubscriptionId(?string $loyaltySubscriptionId): static + { + if (is_null($loyaltySubscriptionId)) { + throw new InvalidArgumentException('non-nullable loyaltySubscriptionId cannot be null'); + } + $this->container['loyaltySubscriptionId'] = $loyaltySubscriptionId; + + return $this; + } +} + + diff --git a/lib/Models/RedeemedRewardFailedConditionErrorResponse.php b/lib/Models/RedeemedRewardFailedConditionErrorResponse.php new file mode 100644 index 0000000..927ecff --- /dev/null +++ b/lib/Models/RedeemedRewardFailedConditionErrorResponse.php @@ -0,0 +1,207 @@ + + */ +class RedeemedRewardFailedConditionErrorResponse extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'redeemedRewardFailedConditionErrorResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'error' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'error' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'error' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'error' => 'getError' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets error + * + * @return string|null + */ + public function getError(): ?string + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string|null $error error + * + * @return $this + */ + public function setError(?string $error): static + { + if (is_null($error)) { + throw new InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } +} + + diff --git a/lib/Models/RemainingCreditModel.php b/lib/Models/RemainingCreditModel.php deleted file mode 100644 index 4551bb0..0000000 --- a/lib/Models/RemainingCreditModel.php +++ /dev/null @@ -1,341 +0,0 @@ - '\Brevo\Client\Models\RemainingCreditModelChild', - 'reseller' => '\Brevo\Client\Models\RemainingCreditModelReseller' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'child' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'child' => 'child', - 'reseller' => 'reseller' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'child' => 'setChild', - 'reseller' => 'setReseller' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'child' => 'getChild', - '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 - */ - public function __construct(array $data = null) - { - $this->container['child'] = isset($data['child']) ? $data['child'] : null; - $this->container['reseller'] = isset($data['reseller']) ? $data['reseller'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - 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 - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets child - * - * @return \Brevo\Client\Models\RemainingCreditModelChild - */ - public function getChild() - { - return $this->container['child']; - } - - /** - * Sets child - * - * @param \Brevo\Client\Models\RemainingCreditModelChild $child child - * - * @return $this - */ - public function setChild($child) - { - $this->container['child'] = $child; - - return $this; - } - - /** - * Gets reseller - * - * @return \Brevo\Client\Models\RemainingCreditModelReseller - */ - public function getReseller() - { - return $this->container['reseller']; - } - - /** - * Sets reseller - * - * @param \Brevo\Client\Models\RemainingCreditModelReseller $reseller reseller - * - * @return $this - */ - public function setReseller($reseller) - { - $this->container['reseller'] = $reseller; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/RemainingCreditModelChild.php b/lib/Models/RemainingCreditModelChild.php deleted file mode 100644 index 6689df9..0000000 --- a/lib/Models/RemainingCreditModelChild.php +++ /dev/null @@ -1,342 +0,0 @@ - 'double', - 'email' => 'double' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'sms' => 'double', - 'email' => 'double' - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'sms' => 'sms', - 'email' => 'email' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'sms' => 'setSms', - 'email' => 'setEmail' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'sms' => 'getSms', - '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 - */ - public function __construct(array $data = null) - { - $this->container['sms'] = isset($data['sms']) ? $data['sms'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['sms'] === null) { - $invalidProperties[] = "'sms' can't be null"; - } - if ($this->container['email'] === null) { - $invalidProperties[] = "'email' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets sms - * - * @return double - */ - public function getSms() - { - return $this->container['sms']; - } - - /** - * Sets sms - * - * @param double $sms SMS Credits remaining for child account - * - * @return $this - */ - public function setSms($sms) - { - $this->container['sms'] = $sms; - - return $this; - } - - /** - * Gets email - * - * @return double - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param double $email Email Credits remaining for child account - * - * @return $this - */ - public function setEmail($email) - { - $this->container['email'] = $email; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/RemainingCreditModelReseller.php b/lib/Models/RemainingCreditModelReseller.php deleted file mode 100644 index e83291c..0000000 --- a/lib/Models/RemainingCreditModelReseller.php +++ /dev/null @@ -1,341 +0,0 @@ - 'double', - 'email' => 'double' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'sms' => 'double', - 'email' => 'double' - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'sms' => 'sms', - 'email' => 'email' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'sms' => 'setSms', - 'email' => 'setEmail' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'sms' => 'getSms', - '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 - */ - public function __construct(array $data = null) - { - $this->container['sms'] = isset($data['sms']) ? $data['sms'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['sms'] === null) { - $invalidProperties[] = "'sms' can't be null"; - } - if ($this->container['email'] === null) { - $invalidProperties[] = "'email' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets sms - * - * @return double - */ - public function getSms() - { - return $this->container['sms']; - } - - /** - * Sets sms - * - * @param double $sms SMS Credits remaining for reseller account - * - * @return $this - */ - public function setSms($sms) - { - $this->container['sms'] = $sms; - - return $this; - } - - /** - * Gets email - * - * @return double - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param double $email Email Credits remaining for reseller account - * - * @return $this - */ - public function setEmail($email) - { - $this->container['email'] = $email; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/RemoveContactFromList.php b/lib/Models/RemoveContactFromList.php deleted file mode 100644 index 7770f62..0000000 --- a/lib/Models/RemoveContactFromList.php +++ /dev/null @@ -1,365 +0,0 @@ - 'string[]', - 'ids' => 'int[]', - 'all' => 'bool' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'emails' => null, - 'ids' => 'int64', - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'emails' => 'emails', - 'ids' => 'ids', - 'all' => 'all' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'emails' => 'setEmails', - 'ids' => 'setIds', - 'all' => 'setAll' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'emails' => 'getEmails', - 'ids' => 'getIds', - '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 - */ - public function __construct(array $data = null) - { - $this->container['emails'] = isset($data['emails']) ? $data['emails'] : null; - $this->container['ids'] = isset($data['ids']) ? $data['ids'] : null; - $this->container['all'] = isset($data['all']) ? $data['all'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets emails - * - * @return string[] - */ - public function getEmails() - { - return $this->container['emails']; - } - - /** - * Sets emails - * - * @param string[] $emails Required if 'all' is false. Emails to remove from a list. You can pass a maximum of 150 emails for removal in one request. - * - * @return $this - */ - public function setEmails($emails) - { - $this->container['emails'] = $emails; - - return $this; - } - - /** - * Gets ids - * - * @return int[] - */ - public function getIds() - { - return $this->container['ids']; - } - - /** - * Sets ids - * - * @param int[] $ids Mandatory if Emails are not passed, ignored otherwise. Emails to add to a list. You can pass a maximum of 150 emails for addition in one request. If you need to add the emails in bulk, please prefer /contacts/import api. - * - * @return $this - */ - public function setIds($ids) - { - $this->container['ids'] = $ids; - - return $this; - } - - /** - * Gets all - * - * @return bool - */ - public function getAll() - { - return $this->container['all']; - } - - /** - * Sets all - * - * @param bool $all Required if none of 'emails' or 'ids' are passed. Remove all existing contacts from a list. A process will be created in this scenario. You can fetch the process details to know about the progress - * - * @return $this - */ - public function setAll($all) - { - $this->container['all'] = $all; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/RemoveContactFromListByAll.php b/lib/Models/RemoveContactFromListByAll.php new file mode 100644 index 0000000..65ee0ac --- /dev/null +++ b/lib/Models/RemoveContactFromListByAll.php @@ -0,0 +1,207 @@ + + */ +class RemoveContactFromListByAll extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'removeContactFromListByAll'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'all' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'all' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'all' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'all' => 'all' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'all' => 'setAll' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('all', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets all + * + * @return bool|null + */ + public function getAll(): ?bool + { + return $this->container['all']; + } + + /** + * Sets all + * + * @param bool|null $all **Required if 'emails', 'extIds' and 'ids' are empty.** Remove all existing contacts from a list. A process will be created in this scenario. You can fetch the process details to know about the progress + * + * @return $this + */ + public function setAll(?bool $all): static + { + if (is_null($all)) { + throw new InvalidArgumentException('non-nullable all cannot be null'); + } + $this->container['all'] = $all; + + return $this; + } +} + + diff --git a/lib/Models/RemoveContactFromListByEmails.php b/lib/Models/RemoveContactFromListByEmails.php new file mode 100644 index 0000000..2a6da82 --- /dev/null +++ b/lib/Models/RemoveContactFromListByEmails.php @@ -0,0 +1,222 @@ + + */ +class RemoveContactFromListByEmails extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'removeContactFromListByEmails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'emails' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'emails' => 'email' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'emails' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'emails' => 'emails' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'emails' => 'setEmails' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('emails', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['emails']) && (count($this->container['emails']) > 150)) { + $invalidProperties[] = "invalid value for 'emails', number of items must be less than or equal to 150."; + } + + if (!is_null($this->container['emails']) && (count($this->container['emails']) < 1)) { + $invalidProperties[] = "invalid value for 'emails', number of items must be greater than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Gets emails + * + * @return string[]|null + */ + public function getEmails(): ?array + { + return $this->container['emails']; + } + + /** + * Sets emails + * + * @param string[]|null $emails **Required if 'all' is false and 'ids', 'extIds' are empty.** Emails to remove from a list. You can pass a **maximum of 150 emails** for removal in one request. + * + * @return $this + */ + public function setEmails(?array $emails): static + { + if (is_null($emails)) { + throw new InvalidArgumentException('non-nullable emails cannot be null'); + } + + if ((count($emails) > 150)) { + throw new InvalidArgumentException('invalid value for $emails when calling RemoveContactFromListByEmails., number of items must be less than or equal to 150.'); + } + if ((count($emails) < 1)) { + throw new InvalidArgumentException('invalid length for $emails when calling RemoveContactFromListByEmails., number of items must be greater than or equal to 1.'); + } + $this->container['emails'] = $emails; + + return $this; + } +} + + diff --git a/lib/Models/RemoveContactFromListByExtIDs.php b/lib/Models/RemoveContactFromListByExtIDs.php new file mode 100644 index 0000000..ef65f7e --- /dev/null +++ b/lib/Models/RemoveContactFromListByExtIDs.php @@ -0,0 +1,222 @@ + + */ +class RemoveContactFromListByExtIDs extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'removeContactFromListByExtIDs'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'extIds' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'extIds' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'extIds' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'extIds' => 'extIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'extIds' => 'setExtIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'extIds' => 'getExtIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('extIds', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['extIds']) && (count($this->container['extIds']) > 150)) { + $invalidProperties[] = "invalid value for 'extIds', number of items must be less than or equal to 150."; + } + + if (!is_null($this->container['extIds']) && (count($this->container['extIds']) < 1)) { + $invalidProperties[] = "invalid value for 'extIds', number of items must be greater than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Gets extIds + * + * @return string[]|null + */ + public function getExtIds(): ?array + { + return $this->container['extIds']; + } + + /** + * Sets extIds + * + * @param string[]|null $extIds **Required if 'all' is false, 'ids' and 'emails' are empty.** EXT_ID attributes to remove from a list. You can pass a **maximum of 150 EXT_ID attributes** for removal in one request. + * + * @return $this + */ + public function setExtIds(?array $extIds): static + { + if (is_null($extIds)) { + throw new InvalidArgumentException('non-nullable extIds cannot be null'); + } + + if ((count($extIds) > 150)) { + throw new InvalidArgumentException('invalid value for $extIds when calling RemoveContactFromListByExtIDs., number of items must be less than or equal to 150.'); + } + if ((count($extIds) < 1)) { + throw new InvalidArgumentException('invalid length for $extIds when calling RemoveContactFromListByExtIDs., number of items must be greater than or equal to 1.'); + } + $this->container['extIds'] = $extIds; + + return $this; + } +} + + diff --git a/lib/Models/RemoveContactFromListByIDs.php b/lib/Models/RemoveContactFromListByIDs.php new file mode 100644 index 0000000..ea988e8 --- /dev/null +++ b/lib/Models/RemoveContactFromListByIDs.php @@ -0,0 +1,222 @@ + + */ +class RemoveContactFromListByIDs extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'removeContactFromListByIDs'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'ids' => 'int[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'ids' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'ids' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'ids' => 'ids' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'ids' => 'setIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'ids' => 'getIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('ids', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['ids']) && (count($this->container['ids']) > 150)) { + $invalidProperties[] = "invalid value for 'ids', number of items must be less than or equal to 150."; + } + + if (!is_null($this->container['ids']) && (count($this->container['ids']) < 1)) { + $invalidProperties[] = "invalid value for 'ids', number of items must be greater than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Gets ids + * + * @return int[]|null + */ + public function getIds(): ?array + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param int[]|null $ids **Required if 'all' is false and 'emails', 'extIds' are empty.** IDs to remove from a list. You can pass a **maximum of 150 IDs** for removal in one request. + * + * @return $this + */ + public function setIds(?array $ids): static + { + if (is_null($ids)) { + throw new InvalidArgumentException('non-nullable ids cannot be null'); + } + + if ((count($ids) > 150)) { + throw new InvalidArgumentException('invalid value for $ids when calling RemoveContactFromListByIDs., number of items must be less than or equal to 150.'); + } + if ((count($ids) < 1)) { + throw new InvalidArgumentException('invalid length for $ids when calling RemoveContactFromListByIDs., number of items must be greater than or equal to 1.'); + } + $this->container['ids'] = $ids; + + return $this; + } +} + + diff --git a/lib/Models/RemoveContactFromListRequest.php b/lib/Models/RemoveContactFromListRequest.php new file mode 100644 index 0000000..f8c2eb1 --- /dev/null +++ b/lib/Models/RemoveContactFromListRequest.php @@ -0,0 +1,354 @@ + + */ +class RemoveContactFromListRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'removeContactFromList_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'emails' => 'string[]', + 'ids' => 'int[]', + 'all' => 'bool', + 'extIds' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'emails' => 'email', + 'ids' => 'int64', + 'all' => null, + 'extIds' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'emails' => false, + 'ids' => false, + 'all' => false, + 'extIds' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'emails' => 'emails', + 'ids' => 'ids', + 'all' => 'all', + 'extIds' => 'extIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'emails' => 'setEmails', + 'ids' => 'setIds', + 'all' => 'setAll', + 'extIds' => 'setExtIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'emails' => 'getEmails', + 'ids' => 'getIds', + 'all' => 'getAll', + 'extIds' => 'getExtIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('emails', $data ?? [], null); + $this->setIfExists('ids', $data ?? [], null); + $this->setIfExists('all', $data ?? [], null); + $this->setIfExists('extIds', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['emails']) && (count($this->container['emails']) > 150)) { + $invalidProperties[] = "invalid value for 'emails', number of items must be less than or equal to 150."; + } + + if (!is_null($this->container['emails']) && (count($this->container['emails']) < 1)) { + $invalidProperties[] = "invalid value for 'emails', number of items must be greater than or equal to 1."; + } + + if (!is_null($this->container['ids']) && (count($this->container['ids']) > 150)) { + $invalidProperties[] = "invalid value for 'ids', number of items must be less than or equal to 150."; + } + + if (!is_null($this->container['ids']) && (count($this->container['ids']) < 1)) { + $invalidProperties[] = "invalid value for 'ids', number of items must be greater than or equal to 1."; + } + + if (!is_null($this->container['extIds']) && (count($this->container['extIds']) > 150)) { + $invalidProperties[] = "invalid value for 'extIds', number of items must be less than or equal to 150."; + } + + if (!is_null($this->container['extIds']) && (count($this->container['extIds']) < 1)) { + $invalidProperties[] = "invalid value for 'extIds', number of items must be greater than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Gets emails + * + * @return string[]|null + */ + public function getEmails(): ?array + { + return $this->container['emails']; + } + + /** + * Sets emails + * + * @param string[]|null $emails **Required if 'all' is false and 'ids', 'extIds' are empty.** Emails to remove from a list. You can pass a **maximum of 150 emails** for removal in one request. + * + * @return $this + */ + public function setEmails(?array $emails): static + { + if (is_null($emails)) { + throw new InvalidArgumentException('non-nullable emails cannot be null'); + } + + if ((count($emails) > 150)) { + throw new InvalidArgumentException('invalid value for $emails when calling RemoveContactFromListRequest., number of items must be less than or equal to 150.'); + } + if ((count($emails) < 1)) { + throw new InvalidArgumentException('invalid length for $emails when calling RemoveContactFromListRequest., number of items must be greater than or equal to 1.'); + } + $this->container['emails'] = $emails; + + return $this; + } + + /** + * Gets ids + * + * @return int[]|null + */ + public function getIds(): ?array + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param int[]|null $ids **Required if 'all' is false and 'emails', 'extIds' are empty.** IDs to remove from a list. You can pass a **maximum of 150 IDs** for removal in one request. + * + * @return $this + */ + public function setIds(?array $ids): static + { + if (is_null($ids)) { + throw new InvalidArgumentException('non-nullable ids cannot be null'); + } + + if ((count($ids) > 150)) { + throw new InvalidArgumentException('invalid value for $ids when calling RemoveContactFromListRequest., number of items must be less than or equal to 150.'); + } + if ((count($ids) < 1)) { + throw new InvalidArgumentException('invalid length for $ids when calling RemoveContactFromListRequest., number of items must be greater than or equal to 1.'); + } + $this->container['ids'] = $ids; + + return $this; + } + + /** + * Gets all + * + * @return bool|null + */ + public function getAll(): ?bool + { + return $this->container['all']; + } + + /** + * Sets all + * + * @param bool|null $all **Required if 'emails', 'extIds' and 'ids' are empty.** Remove all existing contacts from a list. A process will be created in this scenario. You can fetch the process details to know about the progress + * + * @return $this + */ + public function setAll(?bool $all): static + { + if (is_null($all)) { + throw new InvalidArgumentException('non-nullable all cannot be null'); + } + $this->container['all'] = $all; + + return $this; + } + + /** + * Gets extIds + * + * @return string[]|null + */ + public function getExtIds(): ?array + { + return $this->container['extIds']; + } + + /** + * Sets extIds + * + * @param string[]|null $extIds **Required if 'all' is false, 'ids' and 'emails' are empty.** EXT_ID attributes to remove from a list. You can pass a **maximum of 150 EXT_ID attributes** for removal in one request. + * + * @return $this + */ + public function setExtIds(?array $extIds): static + { + if (is_null($extIds)) { + throw new InvalidArgumentException('non-nullable extIds cannot be null'); + } + + if ((count($extIds) > 150)) { + throw new InvalidArgumentException('invalid value for $extIds when calling RemoveContactFromListRequest., number of items must be less than or equal to 150.'); + } + if ((count($extIds) < 1)) { + throw new InvalidArgumentException('invalid length for $extIds when calling RemoveContactFromListRequest., number of items must be greater than or equal to 1.'); + } + $this->container['extIds'] = $extIds; + + return $this; + } +} + + diff --git a/lib/Models/RemoveCredits.php b/lib/Models/RemoveCredits.php deleted file mode 100644 index 3a953d0..0000000 --- a/lib/Models/RemoveCredits.php +++ /dev/null @@ -1,335 +0,0 @@ - 'int', - 'email' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'sms' => 'int64', - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'sms' => 'sms', - 'email' => 'email' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'sms' => 'setSms', - 'email' => 'setEmail' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'sms' => 'getSms', - '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 - */ - public function __construct(array $data = null) - { - $this->container['sms'] = isset($data['sms']) ? $data['sms'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets sms - * - * @return int - */ - public function getSms() - { - return $this->container['sms']; - } - - /** - * 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) - { - $this->container['sms'] = $sms; - - return $this; - } - - /** - * Gets email - * - * @return int - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * 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) - { - $this->container['email'] = $email; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/RequestContactExport.php b/lib/Models/RequestContactExport.php index 2b673c8..61ab00f 100644 --- a/lib/Models/RequestContactExport.php +++ b/lib/Models/RequestContactExport.php @@ -2,128 +2,128 @@ /** * RequestContactExport * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * RequestContactExport Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class RequestContactExport implements ModelInterface, ArrayAccess +class RequestContactExport extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'requestContactExport'; + protected static string $openAPIModelName = 'requestContactExport'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'exportAttributes' => 'string[]', + protected static array $openAPITypes = [ 'customContactFilter' => '\Brevo\Client\Models\RequestContactExportCustomContactFilter', + 'exportAttributes' => 'string[]', 'notifyUrl' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'exportAttributes' => null, + protected static array $openAPIFormats = [ 'customContactFilter' => null, + 'exportAttributes' => null, 'notifyUrl' => 'url' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'customContactFilter' => false, + 'exportAttributes' => false, + 'notifyUrl' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ - 'exportAttributes' => 'exportAttributes', + protected static array $attributeMap = [ 'customContactFilter' => 'customContactFilter', + 'exportAttributes' => 'exportAttributes', 'notifyUrl' => 'notifyUrl' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ - 'exportAttributes' => 'setExportAttributes', + protected static array $setters = [ 'customContactFilter' => 'setCustomContactFilter', + 'exportAttributes' => 'setExportAttributes', 'notifyUrl' => 'setNotifyUrl' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ - 'exportAttributes' => 'getExportAttributes', + protected static array $getters = [ 'customContactFilter' => 'getCustomContactFilter', + 'exportAttributes' => 'getExportAttributes', 'notifyUrl' => 'getNotifyUrl' ]; @@ -131,9 +131,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -141,9 +141,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -151,53 +151,39 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['exportAttributes'] = isset($data['exportAttributes']) ? $data['exportAttributes'] : null; - $this->container['customContactFilter'] = isset($data['customContactFilter']) ? $data['customContactFilter'] : null; - $this->container['notifyUrl'] = isset($data['notifyUrl']) ? $data['notifyUrl'] : null; + $this->setIfExists('customContactFilter', $data ?? [], null); + $this->setIfExists('exportAttributes', $data ?? [], null); + $this->setIfExists('notifyUrl', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -207,48 +193,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets exportAttributes - * - * @return string[] - */ - public function getExportAttributes() - { - return $this->container['exportAttributes']; - } - - /** - * Sets exportAttributes - * - * @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) - { - $this->container['exportAttributes'] = $exportAttributes; - - return $this; - } - /** * Gets customContactFilter * * @return \Brevo\Client\Models\RequestContactExportCustomContactFilter */ - public function getCustomContactFilter() + public function getCustomContactFilter(): \Brevo\Client\Models\RequestContactExportCustomContactFilter { return $this->container['customContactFilter']; } @@ -260,108 +210,68 @@ public function getCustomContactFilter() * * @return $this */ - public function setCustomContactFilter($customContactFilter) + public function setCustomContactFilter(\Brevo\Client\Models\RequestContactExportCustomContactFilter $customContactFilter): static { + if (is_null($customContactFilter)) { + throw new InvalidArgumentException('non-nullable customContactFilter cannot be null'); + } $this->container['customContactFilter'] = $customContactFilter; return $this; } /** - * Gets notifyUrl + * Gets exportAttributes * - * @return string + * @return string[]|null */ - public function getNotifyUrl() + public function getExportAttributes(): ?array { - return $this->container['notifyUrl']; + return $this->container['exportAttributes']; } /** - * Sets notifyUrl + * Sets exportAttributes * - * @param string $notifyUrl Webhook that will be called once the export process is finished. For reference, https://help.brevo.com/hc/en-us/articles/360007666479 + * @param string[]|null $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 setNotifyUrl($notifyUrl) + public function setExportAttributes(?array $exportAttributes): static { - $this->container['notifyUrl'] = $notifyUrl; + if (is_null($exportAttributes)) { + throw new InvalidArgumentException('non-nullable exportAttributes cannot be null'); + } + $this->container['exportAttributes'] = $exportAttributes; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 + * Gets notifyUrl * - * @return void + * @return string|null */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function getNotifyUrl(): ?string { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } + return $this->container['notifyUrl']; } /** - * Unsets offset. + * Sets notifyUrl * - * @param integer $offset Offset + * @param string|null $notifyUrl Webhook that will be called once the export process is finished. For reference, https://help.brevo.com/hc/en-us/articles/360007666479 * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string + * @return $this */ - public function __toString() + public function setNotifyUrl(?string $notifyUrl): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($notifyUrl)) { + throw new InvalidArgumentException('non-nullable notifyUrl cannot be null'); } + $this->container['notifyUrl'] = $notifyUrl; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/RequestContactExportCustomContactFilter.php b/lib/Models/RequestContactExportCustomContactFilter.php index c6ada0e..df21552 100644 --- a/lib/Models/RequestContactExportCustomContactFilter.php +++ b/lib/Models/RequestContactExportCustomContactFilter.php @@ -2,62 +2,64 @@ /** * RequestContactExportCustomContactFilter * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * RequestContactExportCustomContactFilter Class Doc Comment * - * @category Class * @description Set the filter for the contacts to be exported. * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class RequestContactExportCustomContactFilter implements ModelInterface, ArrayAccess +class RequestContactExportCustomContactFilter extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'requestContactExport_customContactFilter'; + protected static string $openAPIModelName = 'requestContactExport_customContactFilter'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'actionForContacts' => 'string', 'actionForEmailCampaigns' => 'string', 'actionForSmsCampaigns' => 'string', @@ -69,9 +71,9 @@ class RequestContactExportCustomContactFilter implements ModelInterface, ArrayAc /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'actionForContacts' => null, 'actionForEmailCampaigns' => null, 'actionForSmsCampaigns' => null, @@ -81,32 +83,33 @@ class RequestContactExportCustomContactFilter implements ModelInterface, ArrayAc ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'actionForContacts' => false, + 'actionForEmailCampaigns' => false, + 'actionForSmsCampaigns' => false, + 'listId' => false, + 'emailCampaignId' => false, + 'smsCampaignId' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'actionForContacts' => 'actionForContacts', 'actionForEmailCampaigns' => 'actionForEmailCampaigns', 'actionForSmsCampaigns' => 'actionForSmsCampaigns', @@ -118,9 +121,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'actionForContacts' => 'setActionForContacts', 'actionForEmailCampaigns' => 'setActionForEmailCampaigns', 'actionForSmsCampaigns' => 'setActionForSmsCampaigns', @@ -132,9 +135,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'actionForContacts' => 'getActionForContacts', 'actionForEmailCampaigns' => 'getActionForEmailCampaigns', 'actionForSmsCampaigns' => 'getActionForSmsCampaigns', @@ -147,9 +150,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -157,9 +160,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -167,39 +170,27 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const ACTION_FOR_CONTACTS_ALL_CONTACTS = 'allContacts'; - const ACTION_FOR_CONTACTS_SUBSCRIBED = 'subscribed'; - const ACTION_FOR_CONTACTS_UNSUBSCRIBED = 'unsubscribed'; - const ACTION_FOR_CONTACTS_UNSUBSCRIBED_PER_LIST = 'unsubscribedPerList'; - const ACTION_FOR_EMAIL_CAMPAIGNS_OPENERS = 'openers'; - const ACTION_FOR_EMAIL_CAMPAIGNS_NON_OPENERS = 'nonOpeners'; - const ACTION_FOR_EMAIL_CAMPAIGNS_CLICKERS = 'clickers'; - const ACTION_FOR_EMAIL_CAMPAIGNS_NON_CLICKERS = 'nonClickers'; - const ACTION_FOR_EMAIL_CAMPAIGNS_UNSUBSCRIBED = 'unsubscribed'; - const ACTION_FOR_EMAIL_CAMPAIGNS_HARD_BOUNCES = 'hardBounces'; - const ACTION_FOR_EMAIL_CAMPAIGNS_SOFT_BOUNCES = 'softBounces'; - const ACTION_FOR_SMS_CAMPAIGNS_HARD_BOUNCES = 'hardBounces'; - const ACTION_FOR_SMS_CAMPAIGNS_SOFT_BOUNCES = 'softBounces'; - const ACTION_FOR_SMS_CAMPAIGNS_UNSUBSCRIBED = 'unsubscribed'; - - + public const ACTION_FOR_CONTACTS_ALL_CONTACTS = 'allContacts'; + public const ACTION_FOR_CONTACTS_SUBSCRIBED = 'subscribed'; + public const ACTION_FOR_CONTACTS_UNSUBSCRIBED = 'unsubscribed'; + public const ACTION_FOR_CONTACTS_UNSUBSCRIBED_PER_LIST = 'unsubscribedPerList'; + public const ACTION_FOR_EMAIL_CAMPAIGNS_OPENERS = 'openers'; + public const ACTION_FOR_EMAIL_CAMPAIGNS_NON_OPENERS = 'nonOpeners'; + public const ACTION_FOR_EMAIL_CAMPAIGNS_CLICKERS = 'clickers'; + public const ACTION_FOR_EMAIL_CAMPAIGNS_NON_CLICKERS = 'nonClickers'; + public const ACTION_FOR_EMAIL_CAMPAIGNS_UNSUBSCRIBED = 'unsubscribed'; + public const ACTION_FOR_EMAIL_CAMPAIGNS_HARD_BOUNCES = 'hardBounces'; + public const ACTION_FOR_EMAIL_CAMPAIGNS_SOFT_BOUNCES = 'softBounces'; + public const ACTION_FOR_SMS_CAMPAIGNS_HARD_BOUNCES = 'hardBounces'; + public const ACTION_FOR_SMS_CAMPAIGNS_SOFT_BOUNCES = 'softBounces'; + public const ACTION_FOR_SMS_CAMPAIGNS_UNSUBSCRIBED = 'unsubscribed'; /** * Gets allowable values of the enum @@ -248,43 +239,42 @@ public function getActionForSmsCampaignsAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['actionForContacts'] = isset($data['actionForContacts']) ? $data['actionForContacts'] : null; - $this->container['actionForEmailCampaigns'] = isset($data['actionForEmailCampaigns']) ? $data['actionForEmailCampaigns'] : null; - $this->container['actionForSmsCampaigns'] = isset($data['actionForSmsCampaigns']) ? $data['actionForSmsCampaigns'] : null; - $this->container['listId'] = isset($data['listId']) ? $data['listId'] : null; - $this->container['emailCampaignId'] = isset($data['emailCampaignId']) ? $data['emailCampaignId'] : null; - $this->container['smsCampaignId'] = isset($data['smsCampaignId']) ? $data['smsCampaignId'] : null; + $this->setIfExists('actionForContacts', $data ?? [], null); + $this->setIfExists('actionForEmailCampaigns', $data ?? [], null); + $this->setIfExists('actionForSmsCampaigns', $data ?? [], null); + $this->setIfExists('listId', $data ?? [], null); + $this->setIfExists('emailCampaignId', $data ?? [], null); + $this->setIfExists('smsCampaignId', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; $allowedValues = $this->getActionForContactsAllowableValues(); if (!is_null($this->container['actionForContacts']) && !in_array($this->container['actionForContacts'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'actionForContacts', must be one of '%s'", + "invalid value '%s' for 'actionForContacts', must be one of '%s'", + $this->container['actionForContacts'], implode("', '", $allowedValues) ); } @@ -292,7 +282,8 @@ public function listInvalidProperties() $allowedValues = $this->getActionForEmailCampaignsAllowableValues(); if (!is_null($this->container['actionForEmailCampaigns']) && !in_array($this->container['actionForEmailCampaigns'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'actionForEmailCampaigns', must be one of '%s'", + "invalid value '%s' for 'actionForEmailCampaigns', must be one of '%s'", + $this->container['actionForEmailCampaigns'], implode("', '", $allowedValues) ); } @@ -300,7 +291,8 @@ public function listInvalidProperties() $allowedValues = $this->getActionForSmsCampaignsAllowableValues(); if (!is_null($this->container['actionForSmsCampaigns']) && !in_array($this->container['actionForSmsCampaigns'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'actionForSmsCampaigns', must be one of '%s'", + "invalid value '%s' for 'actionForSmsCampaigns', must be one of '%s'", + $this->container['actionForSmsCampaigns'], implode("', '", $allowedValues) ); } @@ -308,24 +300,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets actionForContacts * - * @return string + * @return string|null */ - public function getActionForContacts() + public function getActionForContacts(): ?string { return $this->container['actionForContacts']; } @@ -333,17 +313,21 @@ public function getActionForContacts() /** * Sets actionForContacts * - * @param string $actionForContacts Mandatory if neither actionForEmailCampaigns nor actionForSmsCampaigns is passed. This will export the contacts on the basis of provided action applied on contacts as per the list id. * allContacts - Fetch the list of all contacts for a particular list. * subscribed & unsubscribed - Fetch the list of subscribed / unsubscribed (blacklisted via any means) contacts for a particular list. * unsubscribedPerList - Fetch the list of contacts that are unsubscribed from a particular list only. + * @param string|null $actionForContacts **Mandatory if neither actionForEmailCampaigns nor actionForSmsCampaigns is passed.** This will export the contacts on the basis of provided action applied on contacts as per the list id. * **allContacts** - Fetch the list of all contacts for a particular list. * **subscribed & unsubscribed** - Fetch the list of subscribed / unsubscribed (blacklisted via any means) contacts for a particular list. * **unsubscribedPerList** - Fetch the list of contacts that are unsubscribed from a particular list only. * * @return $this */ - public function setActionForContacts($actionForContacts) + public function setActionForContacts(?string $actionForContacts): static { + if (is_null($actionForContacts)) { + throw new InvalidArgumentException('non-nullable actionForContacts cannot be null'); + } $allowedValues = $this->getActionForContactsAllowableValues(); - if (!is_null($actionForContacts) && !in_array($actionForContacts, $allowedValues, true)) { - throw new \InvalidArgumentException( + if (!in_array($actionForContacts, $allowedValues, true)) { + throw new InvalidArgumentException( sprintf( - "Invalid value for 'actionForContacts', must be one of '%s'", + "Invalid value '%s' for 'actionForContacts', must be one of '%s'", + $actionForContacts, implode("', '", $allowedValues) ) ); @@ -356,9 +340,9 @@ public function setActionForContacts($actionForContacts) /** * Gets actionForEmailCampaigns * - * @return string + * @return string|null */ - public function getActionForEmailCampaigns() + public function getActionForEmailCampaigns(): ?string { return $this->container['actionForEmailCampaigns']; } @@ -366,17 +350,21 @@ public function getActionForEmailCampaigns() /** * Sets actionForEmailCampaigns * - * @param string $actionForEmailCampaigns Mandatory if neither actionForContacts nor actionForSmsCampaigns is passed. This will export the contacts on the basis of provided action applied on email campaigns. * openers & nonOpeners - emailCampaignId is mandatory. Fetch the list of readers / non-readers for a particular email campaign. * clickers & nonClickers - emailCampaignId is mandatory. Fetch the list of clickers / non-clickers for a particular email campaign. * unsubscribed - emailCampaignId is mandatory. Fetch the list of all unsubscribed (blacklisted via any means) contacts for a particular email campaign. * hardBounces & softBounces - emailCampaignId is optional. Fetch the list of hard bounces / soft bounces for a particular / all email campaign(s). + * @param string|null $actionForEmailCampaigns **Mandatory if neither actionForContacts nor actionForSmsCampaigns is passed.** This will export the contacts on the basis of provided action applied on email campaigns. * **openers & nonOpeners** - emailCampaignId is mandatory. Fetch the list of readers / non-readers for a particular email campaign. * **clickers & nonClickers** - emailCampaignId is mandatory. Fetch the list of clickers / non-clickers for a particular email campaign. * **unsubscribed** - emailCampaignId is mandatory. Fetch the list of all unsubscribed (blacklisted via any means) contacts for a particular email campaign. * **hardBounces & softBounces** - emailCampaignId is optional. Fetch the list of hard bounces / soft bounces for a particular / all email campaign(s). * * @return $this */ - public function setActionForEmailCampaigns($actionForEmailCampaigns) + public function setActionForEmailCampaigns(?string $actionForEmailCampaigns): static { + if (is_null($actionForEmailCampaigns)) { + throw new InvalidArgumentException('non-nullable actionForEmailCampaigns cannot be null'); + } $allowedValues = $this->getActionForEmailCampaignsAllowableValues(); - if (!is_null($actionForEmailCampaigns) && !in_array($actionForEmailCampaigns, $allowedValues, true)) { - throw new \InvalidArgumentException( + if (!in_array($actionForEmailCampaigns, $allowedValues, true)) { + throw new InvalidArgumentException( sprintf( - "Invalid value for 'actionForEmailCampaigns', must be one of '%s'", + "Invalid value '%s' for 'actionForEmailCampaigns', must be one of '%s'", + $actionForEmailCampaigns, implode("', '", $allowedValues) ) ); @@ -389,9 +377,9 @@ public function setActionForEmailCampaigns($actionForEmailCampaigns) /** * Gets actionForSmsCampaigns * - * @return string + * @return string|null */ - public function getActionForSmsCampaigns() + public function getActionForSmsCampaigns(): ?string { return $this->container['actionForSmsCampaigns']; } @@ -399,17 +387,21 @@ public function getActionForSmsCampaigns() /** * Sets actionForSmsCampaigns * - * @param string $actionForSmsCampaigns Mandatory if neither actionForContacts nor actionForEmailCampaigns is passed. This will export the contacts on the basis of provided action applied on sms campaigns. * unsubscribed - Fetch the list of all unsubscribed (blacklisted via any means) contacts for all / particular sms campaigns. * hardBounces & softBounces - Fetch the list of hard bounces / soft bounces for all / particular sms campaigns. + * @param string|null $actionForSmsCampaigns **Mandatory if neither actionForContacts nor actionForEmailCampaigns is passed.** This will export the contacts on the basis of provided action applied on sms campaigns. * **unsubscribed** - Fetch the list of all unsubscribed (blacklisted via any means) contacts for all / particular sms campaigns. * **hardBounces & softBounces** - Fetch the list of hard bounces / soft bounces for all / particular sms campaigns. * * @return $this */ - public function setActionForSmsCampaigns($actionForSmsCampaigns) + public function setActionForSmsCampaigns(?string $actionForSmsCampaigns): static { + if (is_null($actionForSmsCampaigns)) { + throw new InvalidArgumentException('non-nullable actionForSmsCampaigns cannot be null'); + } $allowedValues = $this->getActionForSmsCampaignsAllowableValues(); - if (!is_null($actionForSmsCampaigns) && !in_array($actionForSmsCampaigns, $allowedValues, true)) { - throw new \InvalidArgumentException( + if (!in_array($actionForSmsCampaigns, $allowedValues, true)) { + throw new InvalidArgumentException( sprintf( - "Invalid value for 'actionForSmsCampaigns', must be one of '%s'", + "Invalid value '%s' for 'actionForSmsCampaigns', must be one of '%s'", + $actionForSmsCampaigns, implode("', '", $allowedValues) ) ); @@ -422,9 +414,9 @@ public function setActionForSmsCampaigns($actionForSmsCampaigns) /** * Gets listId * - * @return int + * @return int|null */ - public function getListId() + public function getListId(): ?int { return $this->container['listId']; } @@ -432,12 +424,15 @@ public function getListId() /** * Sets listId * - * @param int $listId Mandatory if actionForContacts is passed, ignored otherwise. Id of the list for which the corresponding action shall be applied in the filter. + * @param int|null $listId **Mandatory if actionForContacts is passed, ignored otherwise.** Id of the list for which the corresponding action shall be applied in the filter. * * @return $this */ - public function setListId($listId) + public function setListId(?int $listId): static { + if (is_null($listId)) { + throw new InvalidArgumentException('non-nullable listId cannot be null'); + } $this->container['listId'] = $listId; return $this; @@ -446,9 +441,9 @@ public function setListId($listId) /** * Gets emailCampaignId * - * @return int + * @return int|null */ - public function getEmailCampaignId() + public function getEmailCampaignId(): ?int { return $this->container['emailCampaignId']; } @@ -456,12 +451,15 @@ public function getEmailCampaignId() /** * Sets emailCampaignId * - * @param int $emailCampaignId Considered only if actionForEmailCampaigns is passed, ignored otherwise. Mandatory if action is one of the following - openers, nonOpeners, clickers, nonClickers, unsubscribed. The id of the email campaign for which the corresponding action shall be applied in the filter. + * @param int|null $emailCampaignId Considered only if **actionForEmailCampaigns** is passed, ignored otherwise. **Mandatory if action is one of the following - openers, nonOpeners, clickers, nonClickers, unsubscribed.** The id of the email campaign for which the corresponding action shall be applied in the filter. * * @return $this */ - public function setEmailCampaignId($emailCampaignId) + public function setEmailCampaignId(?int $emailCampaignId): static { + if (is_null($emailCampaignId)) { + throw new InvalidArgumentException('non-nullable emailCampaignId cannot be null'); + } $this->container['emailCampaignId'] = $emailCampaignId; return $this; @@ -470,9 +468,9 @@ public function setEmailCampaignId($emailCampaignId) /** * Gets smsCampaignId * - * @return int + * @return int|null */ - public function getSmsCampaignId() + public function getSmsCampaignId(): ?int { return $this->container['smsCampaignId']; } @@ -480,89 +478,19 @@ public function getSmsCampaignId() /** * Sets smsCampaignId * - * @param int $smsCampaignId Considered only if actionForSmsCampaigns is passed, ignored otherwise. The id of sms campaign for which the corresponding action shall be applied in the filter. + * @param int|null $smsCampaignId Considered only if **actionForSmsCampaigns** is passed, ignored otherwise. The id of sms campaign for which the corresponding action shall be applied in the filter. * * @return $this */ - public function setSmsCampaignId($smsCampaignId) + public function setSmsCampaignId(?int $smsCampaignId): static { + if (is_null($smsCampaignId)) { + throw new InvalidArgumentException('non-nullable smsCampaignId cannot be null'); + } $this->container['smsCampaignId'] = $smsCampaignId; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/RequestContactImport.php b/lib/Models/RequestContactImport.php index 926521f..4676153 100644 --- a/lib/Models/RequestContactImport.php +++ b/lib/Models/RequestContactImport.php @@ -2,64 +2,66 @@ /** * RequestContactImport * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * RequestContactImport Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class RequestContactImport implements ModelInterface, ArrayAccess +class RequestContactImport extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'requestContactImport'; + protected static string $openAPIModelName = 'requestContactImport'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'fileUrl' => 'string', 'fileBody' => 'string', - 'jsonBody' => '\Brevo\Client\Models\RequestContactImportJsonBody[]', + 'jsonBody' => '\Brevo\Client\Models\RequestContactImportJsonBodyInner[]', 'listIds' => 'int[]', 'notifyUrl' => 'string', 'newList' => '\Brevo\Client\Models\RequestContactImportNewList', @@ -73,9 +75,9 @@ class RequestContactImport implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'fileUrl' => 'url', 'fileBody' => null, 'jsonBody' => null, @@ -90,32 +92,38 @@ class RequestContactImport implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'fileUrl' => false, + 'fileBody' => false, + 'jsonBody' => false, + 'listIds' => false, + 'notifyUrl' => false, + 'newList' => false, + 'emailBlacklist' => false, + 'disableNotification' => false, + 'smsBlacklist' => false, + 'updateExistingContacts' => false, + 'emptyContactsAttributes' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'fileUrl' => 'fileUrl', 'fileBody' => 'fileBody', 'jsonBody' => 'jsonBody', @@ -132,9 +140,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'fileUrl' => 'setFileUrl', 'fileBody' => 'setFileBody', 'jsonBody' => 'setJsonBody', @@ -151,9 +159,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'fileUrl' => 'getFileUrl', 'fileBody' => 'getFileBody', 'jsonBody' => 'getJsonBody', @@ -171,9 +179,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -181,9 +189,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -191,85 +199,59 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['fileUrl'] = isset($data['fileUrl']) ? $data['fileUrl'] : null; - $this->container['fileBody'] = isset($data['fileBody']) ? $data['fileBody'] : null; - $this->container['jsonBody'] = isset($data['jsonBody']) ? $data['jsonBody'] : 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['disableNotification'] = isset($data['disableNotification']) ? $data['disableNotification'] : false; - $this->container['smsBlacklist'] = isset($data['smsBlacklist']) ? $data['smsBlacklist'] : false; - $this->container['updateExistingContacts'] = isset($data['updateExistingContacts']) ? $data['updateExistingContacts'] : true; - $this->container['emptyContactsAttributes'] = isset($data['emptyContactsAttributes']) ? $data['emptyContactsAttributes'] : false; + $this->setIfExists('fileUrl', $data ?? [], null); + $this->setIfExists('fileBody', $data ?? [], null); + $this->setIfExists('jsonBody', $data ?? [], null); + $this->setIfExists('listIds', $data ?? [], null); + $this->setIfExists('notifyUrl', $data ?? [], null); + $this->setIfExists('newList', $data ?? [], null); + $this->setIfExists('emailBlacklist', $data ?? [], false); + $this->setIfExists('disableNotification', $data ?? [], false); + $this->setIfExists('smsBlacklist', $data ?? [], false); + $this->setIfExists('updateExistingContacts', $data ?? [], true); + $this->setIfExists('emptyContactsAttributes', $data ?? [], false); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets fileUrl * - * @return string + * @return string|null */ - public function getFileUrl() + public function getFileUrl(): ?string { return $this->container['fileUrl']; } @@ -277,12 +259,15 @@ public function getFileUrl() /** * Sets fileUrl * - * @param string $fileUrl Mandatory if fileBody or jsonBody is not defined. URL of the file to be imported (no local file). Possible file formats: .txt, .csv, .json + * @param string|null $fileUrl **Mandatory if fileBody and jsonBody is not defined.** URL of the file to be imported (**no local file**). Possible file formats: #### .txt, .csv, .json * * @return $this */ - public function setFileUrl($fileUrl) + public function setFileUrl(?string $fileUrl): static { + if (is_null($fileUrl)) { + throw new InvalidArgumentException('non-nullable fileUrl cannot be null'); + } $this->container['fileUrl'] = $fileUrl; return $this; @@ -291,9 +276,9 @@ public function setFileUrl($fileUrl) /** * Gets fileBody * - * @return string + * @return string|null */ - public function getFileBody() + public function getFileBody(): ?string { return $this->container['fileBody']; } @@ -301,12 +286,15 @@ public function getFileBody() /** * Sets fileBody * - * @param string $fileBody Mandatory if fileUrl and jsonBody is not defined. CSV content to be imported. Use semicolon to separate multiple attributes. Maximum allowed file body size is 10MB . However we recommend a safe limit of around 8 MB to avoid the issues caused due to increase of file body size while parsing. Please use fileUrl instead to import bigger files. + * @param string|null $fileBody **Mandatory if fileUrl and jsonBody is not defined.** CSV content to be imported. Use semicolon to separate multiple attributes. **Maximum allowed file body size is 10MB** . However we recommend a safe limit of around 8 MB to avoid the issues caused due to increase of file body size while parsing. Please use fileUrl instead to import bigger files. * * @return $this */ - public function setFileBody($fileBody) + public function setFileBody(?string $fileBody): static { + if (is_null($fileBody)) { + throw new InvalidArgumentException('non-nullable fileBody cannot be null'); + } $this->container['fileBody'] = $fileBody; return $this; @@ -315,9 +303,9 @@ public function setFileBody($fileBody) /** * Gets jsonBody * - * @return \Brevo\Client\Models\RequestContactImportJsonBody[] + * @return \Brevo\Client\Models\RequestContactImportJsonBodyInner[]|null */ - public function getJsonBody() + public function getJsonBody(): ?array { return $this->container['jsonBody']; } @@ -325,12 +313,15 @@ public function getJsonBody() /** * Sets jsonBody * - * @param \Brevo\Client\Models\RequestContactImportJsonBody[] $jsonBody **Mandatory if fileUrl and fileBody is not defined.** JSON content to be imported. **Maximum allowed json body size is 10MB** . However we recommend a safe limit of around 8 MB to avoid the issues caused due to increase of json body size while parsing. Please use fileUrl instead to import bigger files. + * @param \Brevo\Client\Models\RequestContactImportJsonBodyInner[]|null $jsonBody **Mandatory if fileUrl and fileBody is not defined.** JSON content to be imported. **Maximum allowed json body size is 10MB** . However we recommend a safe limit of around 8 MB to avoid the issues caused due to increase of json body size while parsing. Please use fileUrl instead to import bigger files. * * @return $this */ - public function setJsonBody($jsonBody) + public function setJsonBody(?array $jsonBody): static { + if (is_null($jsonBody)) { + throw new InvalidArgumentException('non-nullable jsonBody cannot be null'); + } $this->container['jsonBody'] = $jsonBody; return $this; @@ -339,9 +330,9 @@ public function setJsonBody($jsonBody) /** * Gets listIds * - * @return int[] + * @return int[]|null */ - public function getListIds() + public function getListIds(): ?array { return $this->container['listIds']; } @@ -349,12 +340,15 @@ public function getListIds() /** * Sets listIds * - * @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]. + * @param int[]|null $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) + public function setListIds(?array $listIds): static { + if (is_null($listIds)) { + throw new InvalidArgumentException('non-nullable listIds cannot be null'); + } $this->container['listIds'] = $listIds; return $this; @@ -363,9 +357,9 @@ public function setListIds($listIds) /** * Gets notifyUrl * - * @return string + * @return string|null */ - public function getNotifyUrl() + public function getNotifyUrl(): ?string { return $this->container['notifyUrl']; } @@ -373,12 +367,15 @@ public function getNotifyUrl() /** * Sets notifyUrl * - * @param string $notifyUrl URL that will be called once the import process is finished. For reference, https://help.brevo.com/hc/en-us/articles/360007666479 + * @param string|null $notifyUrl URL that will be called once the import process is finished. For reference, https://help.brevo.com/hc/en-us/articles/360007666479 * * @return $this */ - public function setNotifyUrl($notifyUrl) + public function setNotifyUrl(?string $notifyUrl): static { + if (is_null($notifyUrl)) { + throw new InvalidArgumentException('non-nullable notifyUrl cannot be null'); + } $this->container['notifyUrl'] = $notifyUrl; return $this; @@ -387,9 +384,9 @@ public function setNotifyUrl($notifyUrl) /** * Gets newList * - * @return \Brevo\Client\Models\RequestContactImportNewList + * @return \Brevo\Client\Models\RequestContactImportNewList|null */ - public function getNewList() + public function getNewList(): ?\Brevo\Client\Models\RequestContactImportNewList { return $this->container['newList']; } @@ -397,12 +394,15 @@ public function getNewList() /** * Sets newList * - * @param \Brevo\Client\Models\RequestContactImportNewList $newList newList + * @param \Brevo\Client\Models\RequestContactImportNewList|null $newList newList * * @return $this */ - public function setNewList($newList) + public function setNewList(?\Brevo\Client\Models\RequestContactImportNewList $newList): static { + if (is_null($newList)) { + throw new InvalidArgumentException('non-nullable newList cannot be null'); + } $this->container['newList'] = $newList; return $this; @@ -411,9 +411,9 @@ public function setNewList($newList) /** * Gets emailBlacklist * - * @return bool + * @return bool|null */ - public function getEmailBlacklist() + public function getEmailBlacklist(): ?bool { return $this->container['emailBlacklist']; } @@ -421,12 +421,15 @@ public function getEmailBlacklist() /** * Sets emailBlacklist * - * @param bool $emailBlacklist To blacklist all the contacts for email + * @param bool|null $emailBlacklist To blacklist all the contacts for email * * @return $this */ - public function setEmailBlacklist($emailBlacklist) + public function setEmailBlacklist(?bool $emailBlacklist): static { + if (is_null($emailBlacklist)) { + throw new InvalidArgumentException('non-nullable emailBlacklist cannot be null'); + } $this->container['emailBlacklist'] = $emailBlacklist; return $this; @@ -435,9 +438,9 @@ public function setEmailBlacklist($emailBlacklist) /** * Gets disableNotification * - * @return bool + * @return bool|null */ - public function getDisableNotification() + public function getDisableNotification(): ?bool { return $this->container['disableNotification']; } @@ -445,12 +448,15 @@ public function getDisableNotification() /** * Sets disableNotification * - * @param bool $disableNotification To disable email notification + * @param bool|null $disableNotification To disable email notification * * @return $this */ - public function setDisableNotification($disableNotification) + public function setDisableNotification(?bool $disableNotification): static { + if (is_null($disableNotification)) { + throw new InvalidArgumentException('non-nullable disableNotification cannot be null'); + } $this->container['disableNotification'] = $disableNotification; return $this; @@ -459,9 +465,9 @@ public function setDisableNotification($disableNotification) /** * Gets smsBlacklist * - * @return bool + * @return bool|null */ - public function getSmsBlacklist() + public function getSmsBlacklist(): ?bool { return $this->container['smsBlacklist']; } @@ -469,12 +475,15 @@ public function getSmsBlacklist() /** * Sets smsBlacklist * - * @param bool $smsBlacklist To blacklist all the contacts for sms + * @param bool|null $smsBlacklist To blacklist all the contacts for sms * * @return $this */ - public function setSmsBlacklist($smsBlacklist) + public function setSmsBlacklist(?bool $smsBlacklist): static { + if (is_null($smsBlacklist)) { + throw new InvalidArgumentException('non-nullable smsBlacklist cannot be null'); + } $this->container['smsBlacklist'] = $smsBlacklist; return $this; @@ -483,9 +492,9 @@ public function setSmsBlacklist($smsBlacklist) /** * Gets updateExistingContacts * - * @return bool + * @return bool|null */ - public function getUpdateExistingContacts() + public function getUpdateExistingContacts(): ?bool { return $this->container['updateExistingContacts']; } @@ -493,12 +502,15 @@ public function getUpdateExistingContacts() /** * Sets updateExistingContacts * - * @param bool $updateExistingContacts To facilitate the choice to update the existing contacts + * @param bool|null $updateExistingContacts To facilitate the choice to update the existing contacts * * @return $this */ - public function setUpdateExistingContacts($updateExistingContacts) + public function setUpdateExistingContacts(?bool $updateExistingContacts): static { + if (is_null($updateExistingContacts)) { + throw new InvalidArgumentException('non-nullable updateExistingContacts cannot be null'); + } $this->container['updateExistingContacts'] = $updateExistingContacts; return $this; @@ -507,9 +519,9 @@ public function setUpdateExistingContacts($updateExistingContacts) /** * Gets emptyContactsAttributes * - * @return bool + * @return bool|null */ - public function getEmptyContactsAttributes() + public function getEmptyContactsAttributes(): ?bool { return $this->container['emptyContactsAttributes']; } @@ -517,89 +529,19 @@ public function getEmptyContactsAttributes() /** * Sets emptyContactsAttributes * - * @param bool $emptyContactsAttributes To facilitate the choice to erase any attribute of the existing contacts with empty value. emptyContactsAttributes = true means the empty fields in your import will erase any attribute that currently contain data in Brevo, & emptyContactsAttributes = false means the empty fields will not affect your existing data ( only available if `updateExistingContacts` set to true ) + * @param bool|null $emptyContactsAttributes To facilitate the choice to erase any attribute of the existing contacts with empty value. emptyContactsAttributes = true means the empty fields in your import will erase any attribute that currently contain data in Brevo, & emptyContactsAttributes = false means the empty fields will not affect your existing data ( **only available if `updateExistingContacts` set to true **) * * @return $this */ - public function setEmptyContactsAttributes($emptyContactsAttributes) + public function setEmptyContactsAttributes(?bool $emptyContactsAttributes): static { + if (is_null($emptyContactsAttributes)) { + throw new InvalidArgumentException('non-nullable emptyContactsAttributes cannot be null'); + } $this->container['emptyContactsAttributes'] = $emptyContactsAttributes; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/RequestContactImportJsonBody.php b/lib/Models/RequestContactImportJsonBody.php deleted file mode 100644 index 88c57ed..0000000 --- a/lib/Models/RequestContactImportJsonBody.php +++ /dev/null @@ -1,335 +0,0 @@ - 'string', - 'attributes' => 'object' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'email' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'email' => 'email', - 'attributes' => 'attributes' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'email' => 'setEmail', - 'attributes' => 'setAttributes' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'email' => 'getEmail', - '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 - */ - public function __construct(array $data = null) - { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['attributes'] = isset($data['attributes']) ? $data['attributes'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets email - * - * @return string - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string $email email - * - * @return $this - */ - public function setEmail($email) - { - $this->container['email'] = $email; - - return $this; - } - - /** - * Gets attributes - * - * @return object - */ - public function getAttributes() - { - return $this->container['attributes']; - } - - /** - * Sets attributes - * - * @param object $attributes List of attributes to be imported - * - * @return $this - */ - public function setAttributes($attributes) - { - $this->container['attributes'] = $attributes; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/RequestContactImportJsonBodyInner.php b/lib/Models/RequestContactImportJsonBodyInner.php new file mode 100644 index 0000000..05eae97 --- /dev/null +++ b/lib/Models/RequestContactImportJsonBodyInner.php @@ -0,0 +1,241 @@ + + */ +class RequestContactImportJsonBodyInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'requestContactImport_jsonBody_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'email' => 'string', + 'attributes' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'email' => null, + 'attributes' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'attributes' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'email' => 'email', + 'attributes' => 'attributes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'email' => 'setEmail', + 'attributes' => 'setAttributes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'email' => 'getEmail', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail(): ?string + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email email + * + * @return $this + */ + public function setEmail(?string $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets attributes + * + * @return array|null + */ + public function getAttributes(): ?array + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param array|null $attributes List of attributes to be imported + * + * @return $this + */ + public function setAttributes(?array $attributes): static + { + if (is_null($attributes)) { + throw new InvalidArgumentException('non-nullable attributes cannot be null'); + } + $this->container['attributes'] = $attributes; + + return $this; + } +} + + diff --git a/lib/Models/RequestContactImportNewList.php b/lib/Models/RequestContactImportNewList.php index 60b24c3..078c798 100644 --- a/lib/Models/RequestContactImportNewList.php +++ b/lib/Models/RequestContactImportNewList.php @@ -2,62 +2,64 @@ /** * RequestContactImportNewList * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * RequestContactImportNewList Class Doc Comment * - * @category Class * @description To create a new list and import the contacts into it, pass the listName and an optional folderId. * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class RequestContactImportNewList implements ModelInterface, ArrayAccess +class RequestContactImportNewList extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'requestContactImport_newList'; + protected static string $openAPIModelName = 'requestContactImport_newList'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'listName' => 'string', 'folderId' => 'int' ]; @@ -65,40 +67,37 @@ class RequestContactImportNewList implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'listName' => null, 'folderId' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'listName' => false, + 'folderId' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'listName' => 'listName', 'folderId' => 'folderId' ]; @@ -106,9 +105,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'listName' => 'setListName', 'folderId' => 'setFolderId' ]; @@ -116,9 +115,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'listName' => 'getListName', 'folderId' => 'getFolderId' ]; @@ -127,9 +126,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -137,9 +136,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -147,76 +146,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['listName'] = isset($data['listName']) ? $data['listName'] : null; - $this->container['folderId'] = isset($data['folderId']) ? $data['folderId'] : null; + $this->setIfExists('listName', $data ?? [], null); + $this->setIfExists('folderId', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets listName * - * @return string + * @return string|null */ - public function getListName() + public function getListName(): ?string { return $this->container['listName']; } @@ -224,12 +197,15 @@ 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). + * @param string|null $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) + public function setListName(?string $listName): static { + if (is_null($listName)) { + throw new InvalidArgumentException('non-nullable listName cannot be null'); + } $this->container['listName'] = $listName; return $this; @@ -238,9 +214,9 @@ public function setListName($listName) /** * Gets folderId * - * @return int + * @return int|null */ - public function getFolderId() + public function getFolderId(): ?int { return $this->container['folderId']; } @@ -248,89 +224,19 @@ public function getFolderId() /** * Sets folderId * - * @param int $folderId Id of the folder where this new list shall be created (Mandatory if listName is not empty). + * @param int|null $folderId Id of the folder where this new list shall be created. **Mandatory if listName is not empty** * * @return $this */ - public function setFolderId($folderId) + public function setFolderId(?int $folderId): static { + if (is_null($folderId)) { + throw new InvalidArgumentException('non-nullable folderId cannot be null'); + } $this->container['folderId'] = $folderId; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/RequestSmsRecipientExport.php b/lib/Models/RequestSmsRecipientExport.php index 4881788..9b46e66 100644 --- a/lib/Models/RequestSmsRecipientExport.php +++ b/lib/Models/RequestSmsRecipientExport.php @@ -2,133 +2,132 @@ /** * RequestSmsRecipientExport * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * RequestSmsRecipientExport Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class RequestSmsRecipientExport implements ModelInterface, ArrayAccess +class RequestSmsRecipientExport extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'requestSmsRecipientExport'; + protected static string $openAPIModelName = 'requestSmsRecipientExport'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'notifyURL' => 'string', - 'recipientsType' => 'string' + protected static array $openAPITypes = [ + 'recipientsType' => 'string', + 'notifyURL' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'notifyURL' => 'url', - 'recipientsType' => null + protected static array $openAPIFormats = [ + 'recipientsType' => null, + 'notifyURL' => 'url' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'recipientsType' => false, + 'notifyURL' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ - 'notifyURL' => 'notifyURL', - 'recipientsType' => 'recipientsType' + protected static array $attributeMap = [ + 'recipientsType' => 'recipientsType', + 'notifyURL' => 'notifyURL' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ - 'notifyURL' => 'setNotifyURL', - 'recipientsType' => 'setRecipientsType' + protected static array $setters = [ + 'recipientsType' => 'setRecipientsType', + 'notifyURL' => 'setNotifyURL' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ - 'notifyURL' => 'getNotifyURL', - 'recipientsType' => 'getRecipientsType' + protected static array $getters = [ + 'recipientsType' => 'getRecipientsType', + 'notifyURL' => 'getNotifyURL' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,32 +145,20 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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'; - const RECIPIENTS_TYPE_SOFT_BOUNCES = 'softBounces'; - const RECIPIENTS_TYPE_HARD_BOUNCES = 'hardBounces'; - const RECIPIENTS_TYPE_UNSUBSCRIBED = 'unsubscribed'; - + public const RECIPIENTS_TYPE_ALL = 'all'; + public const RECIPIENTS_TYPE_DELIVERED = 'delivered'; + public const RECIPIENTS_TYPE_ANSWERED = 'answered'; + public const RECIPIENTS_TYPE_SOFT_BOUNCES = 'softBounces'; + public const RECIPIENTS_TYPE_HARD_BOUNCES = 'hardBounces'; + public const RECIPIENTS_TYPE_UNSUBSCRIBED = 'unsubscribed'; - /** * Gets allowable values of the enum * @@ -188,33 +175,31 @@ public function getRecipientsTypeAllowableValues() self::RECIPIENTS_TYPE_UNSUBSCRIBED, ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['notifyURL'] = isset($data['notifyURL']) ? $data['notifyURL'] : null; - $this->container['recipientsType'] = isset($data['recipientsType']) ? $data['recipientsType'] : null; + $this->setIfExists('recipientsType', $data ?? [], null); + $this->setIfExists('notifyURL', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -224,7 +209,8 @@ public function listInvalidProperties() $allowedValues = $this->getRecipientsTypeAllowableValues(); if (!is_null($this->container['recipientsType']) && !in_array($this->container['recipientsType'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'recipientsType', must be one of '%s'", + "invalid value '%s' for 'recipientsType', must be one of '%s'", + $this->container['recipientsType'], implode("', '", $allowedValues) ); } @@ -232,48 +218,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets notifyURL - * - * @return string - */ - public function getNotifyURL() - { - return $this->container['notifyURL']; - } - - /** - * Sets notifyURL - * - * @param string $notifyURL URL that will be called once the export process is finished. For reference, https://help.brevo.com/hc/en-us/articles/360007666479 - * - * @return $this - */ - public function setNotifyURL($notifyURL) - { - $this->container['notifyURL'] = $notifyURL; - - return $this; - } - /** * Gets recipientsType * * @return string */ - public function getRecipientsType() + public function getRecipientsType(): string { return $this->container['recipientsType']; } @@ -285,13 +235,17 @@ public function getRecipientsType() * * @return $this */ - public function setRecipientsType($recipientsType) + public function setRecipientsType(string $recipientsType): static { + if (is_null($recipientsType)) { + throw new InvalidArgumentException('non-nullable recipientsType cannot be null'); + } $allowedValues = $this->getRecipientsTypeAllowableValues(); if (!in_array($recipientsType, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'recipientsType', must be one of '%s'", + "Invalid value '%s' for 'recipientsType', must be one of '%s'", + $recipientsType, implode("', '", $allowedValues) ) ); @@ -300,78 +254,32 @@ public function setRecipientsType($recipientsType) return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 + * Gets notifyURL * - * @return void + * @return string|null */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function getNotifyURL(): ?string { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } + return $this->container['notifyURL']; } /** - * Unsets offset. + * Sets notifyURL * - * @param integer $offset Offset + * @param string|null $notifyURL URL that will be called once the export process is finished. For reference, https://help.brevo.com/hc/en-us/articles/360007666479 * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string + * @return $this */ - public function __toString() + public function setNotifyURL(?string $notifyURL): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($notifyURL)) { + throw new InvalidArgumentException('non-nullable notifyURL cannot be null'); } + $this->container['notifyURL'] = $notifyURL; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/RewardAttributionResponse.php b/lib/Models/RewardAttributionResponse.php new file mode 100644 index 0000000..106abb6 --- /dev/null +++ b/lib/Models/RewardAttributionResponse.php @@ -0,0 +1,479 @@ + + */ +class RewardAttributionResponse extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'rewardAttributionResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'rewardId' => 'string', + 'loyaltyProgramId' => 'string', + 'contactId' => 'float', + 'code' => 'string', + 'expirationDate' => '\DateTime', + 'consumedAt' => '\DateTime', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'uuid', + 'rewardId' => 'uuid', + 'loyaltyProgramId' => 'uuid', + 'contactId' => null, + 'code' => null, + 'expirationDate' => 'date-time', + 'consumedAt' => 'date-time', + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'rewardId' => false, + 'loyaltyProgramId' => false, + 'contactId' => false, + 'code' => false, + 'expirationDate' => false, + 'consumedAt' => false, + 'createdAt' => false, + 'updatedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'rewardId' => 'rewardId', + 'loyaltyProgramId' => 'loyaltyProgramId', + 'contactId' => 'contactId', + 'code' => 'code', + 'expirationDate' => 'expirationDate', + 'consumedAt' => 'consumedAt', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'rewardId' => 'setRewardId', + 'loyaltyProgramId' => 'setLoyaltyProgramId', + 'contactId' => 'setContactId', + 'code' => 'setCode', + 'expirationDate' => 'setExpirationDate', + 'consumedAt' => 'setConsumedAt', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'rewardId' => 'getRewardId', + 'loyaltyProgramId' => 'getLoyaltyProgramId', + 'contactId' => 'getContactId', + 'code' => 'getCode', + 'expirationDate' => 'getExpirationDate', + 'consumedAt' => 'getConsumedAt', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('rewardId', $data ?? [], null); + $this->setIfExists('loyaltyProgramId', $data ?? [], null); + $this->setIfExists('contactId', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('consumedAt', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Attributed reward Id + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets rewardId + * + * @return string|null + */ + public function getRewardId(): ?string + { + return $this->container['rewardId']; + } + + /** + * Sets rewardId + * + * @param string|null $rewardId Reward id which ias attributed + * + * @return $this + */ + public function setRewardId(?string $rewardId): static + { + if (is_null($rewardId)) { + throw new InvalidArgumentException('non-nullable rewardId cannot be null'); + } + $this->container['rewardId'] = $rewardId; + + return $this; + } + + /** + * Gets loyaltyProgramId + * + * @return string|null + */ + public function getLoyaltyProgramId(): ?string + { + return $this->container['loyaltyProgramId']; + } + + /** + * Sets loyaltyProgramId + * + * @param string|null $loyaltyProgramId Loyalty program id + * + * @return $this + */ + public function setLoyaltyProgramId(?string $loyaltyProgramId): static + { + if (is_null($loyaltyProgramId)) { + throw new InvalidArgumentException('non-nullable loyaltyProgramId cannot be null'); + } + $this->container['loyaltyProgramId'] = $loyaltyProgramId; + + return $this; + } + + /** + * Gets contactId + * + * @return float|null + */ + public function getContactId(): ?float + { + return $this->container['contactId']; + } + + /** + * Sets contactId + * + * @param float|null $contactId Contact to which reward is attributed + * + * @return $this + */ + public function setContactId(?float $contactId): static + { + if (is_null($contactId)) { + throw new InvalidArgumentException('non-nullable contactId cannot be null'); + } + $this->container['contactId'] = $contactId; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode(): ?string + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code code associated to the attributed reward + * + * @return $this + */ + public function setCode(?string $code): static + { + if (is_null($code)) { + throw new InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate(): ?\DateTime + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate expirationDate + * + * @return $this + */ + public function setExpirationDate(?\DateTime $expirationDate): static + { + if (is_null($expirationDate)) { + throw new InvalidArgumentException('non-nullable expirationDate cannot be null'); + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets consumedAt + * + * @return \DateTime|null + */ + public function getConsumedAt(): ?\DateTime + { + return $this->container['consumedAt']; + } + + /** + * Sets consumedAt + * + * @param \DateTime|null $consumedAt consumedAt + * + * @return $this + */ + public function setConsumedAt(?\DateTime $consumedAt): static + { + if (is_null($consumedAt)) { + throw new InvalidArgumentException('non-nullable consumedAt cannot be null'); + } + $this->container['consumedAt'] = $consumedAt; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt createdAt + * + * @return $this + */ + public function setCreatedAt(?\DateTime $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt(): ?\DateTime + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt updatedAt + * + * @return $this + */ + public function setUpdatedAt(?\DateTime $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } +} + + diff --git a/lib/Models/RewardRedeemResponse.php b/lib/Models/RewardRedeemResponse.php new file mode 100644 index 0000000..a665e86 --- /dev/null +++ b/lib/Models/RewardRedeemResponse.php @@ -0,0 +1,479 @@ + + */ +class RewardRedeemResponse extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'rewardRedeemResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'rewardId' => 'string', + 'loyaltyProgramId' => 'string', + 'contactId' => 'float', + 'code' => 'string', + 'consumedAt' => '\DateTime', + 'expirationDate' => '\DateTime', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'uuid', + 'rewardId' => 'uuid', + 'loyaltyProgramId' => 'uuid', + 'contactId' => null, + 'code' => null, + 'consumedAt' => 'date-time', + 'expirationDate' => 'date-time', + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'rewardId' => false, + 'loyaltyProgramId' => false, + 'contactId' => false, + 'code' => false, + 'consumedAt' => false, + 'expirationDate' => false, + 'createdAt' => false, + 'updatedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'rewardId' => 'rewardId', + 'loyaltyProgramId' => 'loyaltyProgramId', + 'contactId' => 'contactId', + 'code' => 'code', + 'consumedAt' => 'consumedAt', + 'expirationDate' => 'expirationDate', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'rewardId' => 'setRewardId', + 'loyaltyProgramId' => 'setLoyaltyProgramId', + 'contactId' => 'setContactId', + 'code' => 'setCode', + 'consumedAt' => 'setConsumedAt', + 'expirationDate' => 'setExpirationDate', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'rewardId' => 'getRewardId', + 'loyaltyProgramId' => 'getLoyaltyProgramId', + 'contactId' => 'getContactId', + 'code' => 'getCode', + 'consumedAt' => 'getConsumedAt', + 'expirationDate' => 'getExpirationDate', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('rewardId', $data ?? [], null); + $this->setIfExists('loyaltyProgramId', $data ?? [], null); + $this->setIfExists('contactId', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('consumedAt', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Attributed reward Id + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets rewardId + * + * @return string|null + */ + public function getRewardId(): ?string + { + return $this->container['rewardId']; + } + + /** + * Sets rewardId + * + * @param string|null $rewardId Reward id which ias attributed + * + * @return $this + */ + public function setRewardId(?string $rewardId): static + { + if (is_null($rewardId)) { + throw new InvalidArgumentException('non-nullable rewardId cannot be null'); + } + $this->container['rewardId'] = $rewardId; + + return $this; + } + + /** + * Gets loyaltyProgramId + * + * @return string|null + */ + public function getLoyaltyProgramId(): ?string + { + return $this->container['loyaltyProgramId']; + } + + /** + * Sets loyaltyProgramId + * + * @param string|null $loyaltyProgramId Loyalty program id + * + * @return $this + */ + public function setLoyaltyProgramId(?string $loyaltyProgramId): static + { + if (is_null($loyaltyProgramId)) { + throw new InvalidArgumentException('non-nullable loyaltyProgramId cannot be null'); + } + $this->container['loyaltyProgramId'] = $loyaltyProgramId; + + return $this; + } + + /** + * Gets contactId + * + * @return float|null + */ + public function getContactId(): ?float + { + return $this->container['contactId']; + } + + /** + * Sets contactId + * + * @param float|null $contactId Contact to which reward is attributed + * + * @return $this + */ + public function setContactId(?float $contactId): static + { + if (is_null($contactId)) { + throw new InvalidArgumentException('non-nullable contactId cannot be null'); + } + $this->container['contactId'] = $contactId; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode(): ?string + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code code associated to the attributed reward + * + * @return $this + */ + public function setCode(?string $code): static + { + if (is_null($code)) { + throw new InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets consumedAt + * + * @return \DateTime|null + */ + public function getConsumedAt(): ?\DateTime + { + return $this->container['consumedAt']; + } + + /** + * Sets consumedAt + * + * @param \DateTime|null $consumedAt consumedAt + * + * @return $this + */ + public function setConsumedAt(?\DateTime $consumedAt): static + { + if (is_null($consumedAt)) { + throw new InvalidArgumentException('non-nullable consumedAt cannot be null'); + } + $this->container['consumedAt'] = $consumedAt; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate(): ?\DateTime + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate expirationDate + * + * @return $this + */ + public function setExpirationDate(?\DateTime $expirationDate): static + { + if (is_null($expirationDate)) { + throw new InvalidArgumentException('non-nullable expirationDate cannot be null'); + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt createdAt + * + * @return $this + */ + public function setCreatedAt(?\DateTime $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt(): ?\DateTime + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt updatedAt + * + * @return $this + */ + public function setUpdatedAt(?\DateTime $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } +} + + diff --git a/lib/Models/ScheduleSmtpEmail.php b/lib/Models/ScheduleSmtpEmail.php index 4c18304..f0af35c 100644 --- a/lib/Models/ScheduleSmtpEmail.php +++ b/lib/Models/ScheduleSmtpEmail.php @@ -2,61 +2,63 @@ /** * ScheduleSmtpEmail * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * ScheduleSmtpEmail Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class ScheduleSmtpEmail implements ModelInterface, ArrayAccess +class ScheduleSmtpEmail extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'scheduleSmtpEmail'; + protected static string $openAPIModelName = 'scheduleSmtpEmail'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'messageId' => 'string', 'messageIds' => 'string[]', 'batchId' => 'string' @@ -65,41 +67,39 @@ class ScheduleSmtpEmail implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'messageId' => null, 'messageIds' => null, 'batchId' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'messageId' => false, + 'messageIds' => false, + 'batchId' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'messageId' => 'messageId', 'messageIds' => 'messageIds', 'batchId' => 'batchId' @@ -108,9 +108,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'messageId' => 'setMessageId', 'messageIds' => 'setMessageIds', 'batchId' => 'setBatchId' @@ -119,9 +119,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'messageId' => 'getMessageId', 'messageIds' => 'getMessageIds', 'batchId' => 'getBatchId' @@ -131,9 +131,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -141,9 +141,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -151,77 +151,51 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['messageId'] = isset($data['messageId']) ? $data['messageId'] : null; - $this->container['messageIds'] = isset($data['messageIds']) ? $data['messageIds'] : null; - $this->container['batchId'] = isset($data['batchId']) ? $data['batchId'] : null; + $this->setIfExists('messageId', $data ?? [], null); + $this->setIfExists('messageIds', $data ?? [], null); + $this->setIfExists('batchId', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets messageId * - * @return string + * @return string|null */ - public function getMessageId() + public function getMessageId(): ?string { return $this->container['messageId']; } @@ -229,12 +203,15 @@ public function getMessageId() /** * Sets messageId * - * @param string $messageId Message ID of the transactional email scheduled + * @param string|null $messageId Message ID of the transactional email scheduled * * @return $this */ - public function setMessageId($messageId) + public function setMessageId(?string $messageId): static { + if (is_null($messageId)) { + throw new InvalidArgumentException('non-nullable messageId cannot be null'); + } $this->container['messageId'] = $messageId; return $this; @@ -243,9 +220,9 @@ public function setMessageId($messageId) /** * Gets messageIds * - * @return string[] + * @return string[]|null */ - public function getMessageIds() + public function getMessageIds(): ?array { return $this->container['messageIds']; } @@ -253,12 +230,15 @@ public function getMessageIds() /** * Sets messageIds * - * @param string[] $messageIds messageIds + * @param string[]|null $messageIds messageIds * * @return $this */ - public function setMessageIds($messageIds) + public function setMessageIds(?array $messageIds): static { + if (is_null($messageIds)) { + throw new InvalidArgumentException('non-nullable messageIds cannot be null'); + } $this->container['messageIds'] = $messageIds; return $this; @@ -267,9 +247,9 @@ public function setMessageIds($messageIds) /** * Gets batchId * - * @return string + * @return string|null */ - public function getBatchId() + public function getBatchId(): ?string { return $this->container['batchId']; } @@ -277,89 +257,19 @@ public function getBatchId() /** * Sets batchId * - * @param string $batchId Batch ID of the batch transactional email scheduled + * @param string|null $batchId Batch ID of the batch transactional email scheduled * * @return $this */ - public function setBatchId($batchId) + public function setBatchId(?string $batchId): static { + if (is_null($batchId)) { + throw new InvalidArgumentException('non-nullable batchId cannot be null'); + } $this->container['batchId'] = $batchId; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/Segment.php b/lib/Models/Segment.php new file mode 100644 index 0000000..8c210b0 --- /dev/null +++ b/lib/Models/Segment.php @@ -0,0 +1,318 @@ + + */ +class Segment extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'Segment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'segmentName' => 'string', + 'categoryName' => 'string', + 'updatedAt' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'int64', + 'segmentName' => null, + 'categoryName' => 'string', + 'updatedAt' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'segmentName' => false, + 'categoryName' => false, + 'updatedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'segmentName' => 'segmentName', + 'categoryName' => 'categoryName', + 'updatedAt' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'segmentName' => 'setSegmentName', + 'categoryName' => 'setCategoryName', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'segmentName' => 'getSegmentName', + 'categoryName' => 'getCategoryName', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('segmentName', $data ?? [], null); + $this->setIfExists('categoryName', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['segmentName'] === null) { + $invalidProperties[] = "'segmentName' can't be null"; + } + if ($this->container['categoryName'] === null) { + $invalidProperties[] = "'categoryName' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets id + * + * @return int + */ + public function getId(): int + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id ID of the list + * + * @return $this + */ + public function setId(int $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets segmentName + * + * @return string + */ + public function getSegmentName(): string + { + return $this->container['segmentName']; + } + + /** + * Sets segmentName + * + * @param string $segmentName Name of the Segment + * + * @return $this + */ + public function setSegmentName(string $segmentName): static + { + if (is_null($segmentName)) { + throw new InvalidArgumentException('non-nullable segmentName cannot be null'); + } + $this->container['segmentName'] = $segmentName; + + return $this; + } + + /** + * Gets categoryName + * + * @return string + */ + public function getCategoryName(): string + { + return $this->container['categoryName']; + } + + /** + * Sets categoryName + * + * @param string $categoryName Name of the Segment Category + * + * @return $this + */ + public function setCategoryName(string $categoryName): static + { + if (is_null($categoryName)) { + throw new InvalidArgumentException('non-nullable categoryName cannot be null'); + } + $this->container['categoryName'] = $categoryName; + + return $this; + } + + /** + * Gets updatedAt + * + * @return string|null + */ + public function getUpdatedAt(): ?string + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param string|null $updatedAt Updation UTC date-time of the segment (YYYY-MM-DDTHH:mm:ss.SSSZ) + * + * @return $this + */ + public function setUpdatedAt(?string $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } +} + + diff --git a/lib/Models/SendReport.php b/lib/Models/SendReport.php index 5a4cc62..b3a3a1e 100644 --- a/lib/Models/SendReport.php +++ b/lib/Models/SendReport.php @@ -2,133 +2,132 @@ /** * SendReport * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SendReport Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SendReport implements ModelInterface, ArrayAccess +class SendReport extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'sendReport'; + protected static string $openAPIModelName = 'sendReport'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'language' => 'string', - 'email' => '\Brevo\Client\Models\SendReportEmail' + protected static array $openAPITypes = [ + 'email' => '\Brevo\Client\Models\SendReportEmail', + 'language' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'language' => null, - 'email' => null + protected static array $openAPIFormats = [ + 'email' => null, + 'language' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'language' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ - 'language' => 'language', - 'email' => 'email' + protected static array $attributeMap = [ + 'email' => 'email', + 'language' => 'language' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ - 'language' => 'setLanguage', - 'email' => 'setEmail' + protected static array $setters = [ + 'email' => 'setEmail', + 'language' => 'setLanguage' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ - 'language' => 'getLanguage', - 'email' => 'getEmail' + protected static array $getters = [ + 'email' => 'getEmail', + 'language' => 'getLanguage' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,32 +145,20 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } + public const LANGUAGE_FR = 'fr'; + public const LANGUAGE_ES = 'es'; + public const LANGUAGE_PT = 'pt'; + public const LANGUAGE_IT = 'it'; + public const LANGUAGE_DE = 'de'; + public const LANGUAGE_EN = 'en'; - const LANGUAGE_FR = 'fr'; - const LANGUAGE_ES = 'es'; - const LANGUAGE_PT = 'pt'; - const LANGUAGE_IT = 'it'; - const LANGUAGE_DE = 'de'; - const LANGUAGE_EN = 'en'; - - - /** * Gets allowable values of the enum * @@ -188,101 +175,55 @@ public function getLanguageAllowableValues() self::LANGUAGE_EN, ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['language'] = isset($data['language']) ? $data['language'] : 'fr'; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('language', $data ?? [], 'fr'); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; + if ($this->container['email'] === null) { + $invalidProperties[] = "'email' can't be null"; + } $allowedValues = $this->getLanguageAllowableValues(); if (!is_null($this->container['language']) && !in_array($this->container['language'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'language', must be one of '%s'", + "invalid value '%s' for 'language', must be one of '%s'", + $this->container['language'], implode("', '", $allowedValues) ); } - if ($this->container['email'] === null) { - $invalidProperties[] = "'email' can't be null"; - } return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets language - * - * @return string - */ - public function getLanguage() - { - return $this->container['language']; - } - - /** - * Sets language - * - * @param string $language Language of email content for campaign report sending. - * - * @return $this - */ - public function setLanguage($language) - { - $allowedValues = $this->getLanguageAllowableValues(); - if (!is_null($language) && !in_array($language, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'language', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['language'] = $language; - - return $this; - } - /** * Gets email * * @return \Brevo\Client\Models\SendReportEmail */ - public function getEmail() + public function getEmail(): \Brevo\Client\Models\SendReportEmail { return $this->container['email']; } @@ -294,84 +235,51 @@ public function getEmail() * * @return $this */ - public function setEmail($email) + public function setEmail(\Brevo\Client\Models\SendReportEmail $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } /** - * Gets offset. - * - * @param integer $offset Offset + * Gets language * - * @return mixed + * @return string|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function getLanguage(): ?string { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container['language']; } /** - * Sets value based on offset. + * Sets language * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param string|null $language Language of email content for campaign report sending. * - * @return void + * @return $this */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function setLanguage(?string $language): static { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; + if (is_null($language)) { + throw new InvalidArgumentException('non-nullable language cannot be null'); } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + $allowedValues = $this->getLanguageAllowableValues(); + if (!in_array($language, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'language', must be one of '%s'", + $language, + implode("', '", $allowedValues) + ) ); } + $this->container['language'] = $language; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/SendReportEmail.php b/lib/Models/SendReportEmail.php index 37c6a25..4437fbf 100644 --- a/lib/Models/SendReportEmail.php +++ b/lib/Models/SendReportEmail.php @@ -2,62 +2,64 @@ /** * SendReportEmail * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SendReportEmail Class Doc Comment * - * @category Class * @description Custom attributes for the report email. * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SendReportEmail implements ModelInterface, ArrayAccess +class SendReportEmail extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'sendReport_email'; + protected static string $openAPIModelName = 'sendReport_email'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'to' => 'string[]', 'body' => 'string' ]; @@ -65,40 +67,37 @@ class SendReportEmail implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'to' => 'email', 'body' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'to' => false, + 'body' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'to' => 'to', 'body' => 'body' ]; @@ -106,9 +105,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'to' => 'setTo', 'body' => 'setBody' ]; @@ -116,9 +115,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'to' => 'getTo', 'body' => 'getBody' ]; @@ -127,9 +126,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -137,9 +136,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -147,52 +146,38 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['to'] = isset($data['to']) ? $data['to'] : null; - $this->container['body'] = isset($data['body']) ? $data['body'] : null; + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('body', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -205,24 +190,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets to * * @return string[] */ - public function getTo() + public function getTo(): array { return $this->container['to']; } @@ -234,8 +207,11 @@ public function getTo() * * @return $this */ - public function setTo($to) + public function setTo(array $to): static { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } $this->container['to'] = $to; return $this; @@ -246,7 +222,7 @@ public function setTo($to) * * @return string */ - public function getBody() + public function getBody(): string { return $this->container['body']; } @@ -258,85 +234,15 @@ public function getBody() * * @return $this */ - public function setBody($body) + public function setBody(string $body): static { + if (is_null($body)) { + throw new InvalidArgumentException('non-nullable body cannot be null'); + } $this->container['body'] = $body; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/SendSms.php b/lib/Models/SendSms.php index 0b49e80..aad8e3e 100644 --- a/lib/Models/SendSms.php +++ b/lib/Models/SendSms.php @@ -2,61 +2,63 @@ /** * SendSms * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SendSms Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SendSms implements ModelInterface, ArrayAccess +class SendSms extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'sendSms'; + protected static string $openAPIModelName = 'sendSms'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'reference' => 'string', 'messageId' => 'int', 'smsCount' => 'int', @@ -67,9 +69,9 @@ class SendSms implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'reference' => null, 'messageId' => 'int64', 'smsCount' => 'int64', @@ -78,32 +80,32 @@ class SendSms implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'reference' => false, + 'messageId' => false, + 'smsCount' => false, + 'usedCredits' => false, + 'remainingCredits' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'reference' => 'reference', 'messageId' => 'messageId', 'smsCount' => 'smsCount', @@ -114,9 +116,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'reference' => 'setReference', 'messageId' => 'setMessageId', 'smsCount' => 'setSmsCount', @@ -127,9 +129,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'reference' => 'getReference', 'messageId' => 'getMessageId', 'smsCount' => 'getSmsCount', @@ -141,9 +143,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -151,9 +153,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -161,55 +163,41 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['reference'] = isset($data['reference']) ? $data['reference'] : null; - $this->container['messageId'] = isset($data['messageId']) ? $data['messageId'] : null; - $this->container['smsCount'] = isset($data['smsCount']) ? $data['smsCount'] : null; - $this->container['usedCredits'] = isset($data['usedCredits']) ? $data['usedCredits'] : null; - $this->container['remainingCredits'] = isset($data['remainingCredits']) ? $data['remainingCredits'] : null; + $this->setIfExists('reference', $data ?? [], null); + $this->setIfExists('messageId', $data ?? [], null); + $this->setIfExists('smsCount', $data ?? [], null); + $this->setIfExists('usedCredits', $data ?? [], null); + $this->setIfExists('remainingCredits', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -222,24 +210,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets reference * * @return string */ - public function getReference() + public function getReference(): string { return $this->container['reference']; } @@ -251,8 +227,11 @@ public function getReference() * * @return $this */ - public function setReference($reference) + public function setReference(string $reference): static { + if (is_null($reference)) { + throw new InvalidArgumentException('non-nullable reference cannot be null'); + } $this->container['reference'] = $reference; return $this; @@ -263,7 +242,7 @@ public function setReference($reference) * * @return int */ - public function getMessageId() + public function getMessageId(): int { return $this->container['messageId']; } @@ -275,8 +254,11 @@ public function getMessageId() * * @return $this */ - public function setMessageId($messageId) + public function setMessageId(int $messageId): static { + if (is_null($messageId)) { + throw new InvalidArgumentException('non-nullable messageId cannot be null'); + } $this->container['messageId'] = $messageId; return $this; @@ -285,9 +267,9 @@ public function setMessageId($messageId) /** * Gets smsCount * - * @return int + * @return int|null */ - public function getSmsCount() + public function getSmsCount(): ?int { return $this->container['smsCount']; } @@ -295,12 +277,15 @@ public function getSmsCount() /** * Sets smsCount * - * @param int $smsCount Count of SMS's to send multiple text messages + * @param int|null $smsCount Count of SMS's to send multiple text messages * * @return $this */ - public function setSmsCount($smsCount) + public function setSmsCount(?int $smsCount): static { + if (is_null($smsCount)) { + throw new InvalidArgumentException('non-nullable smsCount cannot be null'); + } $this->container['smsCount'] = $smsCount; return $this; @@ -309,9 +294,9 @@ public function setSmsCount($smsCount) /** * Gets usedCredits * - * @return float + * @return float|null */ - public function getUsedCredits() + public function getUsedCredits(): ?float { return $this->container['usedCredits']; } @@ -319,12 +304,15 @@ public function getUsedCredits() /** * Sets usedCredits * - * @param float $usedCredits SMS credits used per text message + * @param float|null $usedCredits SMS credits used per text message * * @return $this */ - public function setUsedCredits($usedCredits) + public function setUsedCredits(?float $usedCredits): static { + if (is_null($usedCredits)) { + throw new InvalidArgumentException('non-nullable usedCredits cannot be null'); + } $this->container['usedCredits'] = $usedCredits; return $this; @@ -333,9 +321,9 @@ public function setUsedCredits($usedCredits) /** * Gets remainingCredits * - * @return float + * @return float|null */ - public function getRemainingCredits() + public function getRemainingCredits(): ?float { return $this->container['remainingCredits']; } @@ -343,89 +331,19 @@ public function getRemainingCredits() /** * Sets remainingCredits * - * @param float $remainingCredits Remaining SMS credits of the user + * @param float|null $remainingCredits Remaining SMS credits of the user * * @return $this */ - public function setRemainingCredits($remainingCredits) + public function setRemainingCredits(?float $remainingCredits): static { + if (is_null($remainingCredits)) { + throw new InvalidArgumentException('non-nullable remainingCredits cannot be null'); + } $this->container['remainingCredits'] = $remainingCredits; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/SendSmtpEmail.php b/lib/Models/SendSmtpEmail.php index d892bcc..f309549 100644 --- a/lib/Models/SendSmtpEmail.php +++ b/lib/Models/SendSmtpEmail.php @@ -2,74 +2,76 @@ /** * SendSmtpEmail * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SendSmtpEmail Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SendSmtpEmail implements ModelInterface, ArrayAccess +class SendSmtpEmail extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'sendSmtpEmail'; + protected static string $openAPIModelName = 'sendSmtpEmail'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'sender' => '\Brevo\Client\Models\SendSmtpEmailSender', - 'to' => '\Brevo\Client\Models\SendSmtpEmailTo[]', - 'bcc' => '\Brevo\Client\Models\SendSmtpEmailBcc[]', - 'cc' => '\Brevo\Client\Models\SendSmtpEmailCc[]', + 'to' => '\Brevo\Client\Models\SendSmtpEmailToInner[]', + 'bcc' => '\Brevo\Client\Models\SendSmtpEmailBccInner[]', + 'cc' => '\Brevo\Client\Models\SendSmtpEmailCcInner[]', 'htmlContent' => 'string', 'textContent' => 'string', 'subject' => 'string', 'replyTo' => '\Brevo\Client\Models\SendSmtpEmailReplyTo', - 'attachment' => '\Brevo\Client\Models\SendSmtpEmailAttachment[]', - 'headers' => 'object', + 'attachment' => '\Brevo\Client\Models\SendSmtpEmailAttachmentInner[]', + 'headers' => 'array', 'templateId' => 'int', - 'params' => 'object', - 'messageVersions' => '\Brevo\Client\Models\SendSmtpEmailMessageVersions[]', + 'params' => 'array', + 'messageVersions' => '\Brevo\Client\Models\SendSmtpEmailMessageVersionsInner[]', 'tags' => 'string[]', 'scheduledAt' => '\DateTime', 'batchId' => 'string' @@ -78,9 +80,9 @@ class SendSmtpEmail implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'sender' => null, 'to' => null, 'bcc' => null, @@ -100,32 +102,43 @@ class SendSmtpEmail implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'sender' => false, + 'to' => false, + 'bcc' => false, + 'cc' => false, + 'htmlContent' => false, + 'textContent' => false, + 'subject' => false, + 'replyTo' => false, + 'attachment' => false, + 'headers' => false, + 'templateId' => false, + 'params' => false, + 'messageVersions' => false, + 'tags' => false, + 'scheduledAt' => false, + 'batchId' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'sender' => 'sender', 'to' => 'to', 'bcc' => 'bcc', @@ -147,9 +160,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'sender' => 'setSender', 'to' => 'setTo', 'bcc' => 'setBcc', @@ -171,9 +184,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'sender' => 'getSender', 'to' => 'getTo', 'bcc' => 'getBcc', @@ -196,9 +209,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -206,9 +219,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -216,90 +229,64 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['sender'] = isset($data['sender']) ? $data['sender'] : null; - $this->container['to'] = isset($data['to']) ? $data['to'] : null; - $this->container['bcc'] = isset($data['bcc']) ? $data['bcc'] : null; - $this->container['cc'] = isset($data['cc']) ? $data['cc'] : null; - $this->container['htmlContent'] = isset($data['htmlContent']) ? $data['htmlContent'] : null; - $this->container['textContent'] = isset($data['textContent']) ? $data['textContent'] : null; - $this->container['subject'] = isset($data['subject']) ? $data['subject'] : null; - $this->container['replyTo'] = isset($data['replyTo']) ? $data['replyTo'] : null; - $this->container['attachment'] = isset($data['attachment']) ? $data['attachment'] : 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['messageVersions'] = isset($data['messageVersions']) ? $data['messageVersions'] : null; - $this->container['tags'] = isset($data['tags']) ? $data['tags'] : null; - $this->container['scheduledAt'] = isset($data['scheduledAt']) ? $data['scheduledAt'] : null; - $this->container['batchId'] = isset($data['batchId']) ? $data['batchId'] : null; + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('bcc', $data ?? [], null); + $this->setIfExists('cc', $data ?? [], null); + $this->setIfExists('htmlContent', $data ?? [], null); + $this->setIfExists('textContent', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('replyTo', $data ?? [], null); + $this->setIfExists('attachment', $data ?? [], null); + $this->setIfExists('headers', $data ?? [], null); + $this->setIfExists('templateId', $data ?? [], null); + $this->setIfExists('params', $data ?? [], null); + $this->setIfExists('messageVersions', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); + $this->setIfExists('scheduledAt', $data ?? [], null); + $this->setIfExists('batchId', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets sender * - * @return \Brevo\Client\Models\SendSmtpEmailSender + * @return \Brevo\Client\Models\SendSmtpEmailSender|null */ - public function getSender() + public function getSender(): ?\Brevo\Client\Models\SendSmtpEmailSender { return $this->container['sender']; } @@ -307,12 +294,15 @@ public function getSender() /** * Sets sender * - * @param \Brevo\Client\Models\SendSmtpEmailSender $sender sender + * @param \Brevo\Client\Models\SendSmtpEmailSender|null $sender sender * * @return $this */ - public function setSender($sender) + public function setSender(?\Brevo\Client\Models\SendSmtpEmailSender $sender): static { + if (is_null($sender)) { + throw new InvalidArgumentException('non-nullable sender cannot be null'); + } $this->container['sender'] = $sender; return $this; @@ -321,9 +311,9 @@ public function setSender($sender) /** * Gets to * - * @return \Brevo\Client\Models\SendSmtpEmailTo[] + * @return \Brevo\Client\Models\SendSmtpEmailToInner[]|null */ - public function getTo() + public function getTo(): ?array { return $this->container['to']; } @@ -331,12 +321,15 @@ public function getTo() /** * Sets to * - * @param \Brevo\Client\Models\SendSmtpEmailTo[] $to Mandatory if messageVersions are not passed, ignored if messageVersions are passed. List of email addresses and names (optional) of the recipients. For example, [{\"name\":\"Jimmy\", \"email\":\"jimmy98@example.com\"}, {\"name\":\"Joe\", \"email\":\"joe@example.com\"}] + * @param \Brevo\Client\Models\SendSmtpEmailToInner[]|null $to **Mandatory if messageVersions are not passed, ignored if messageVersions are passed** 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) + public function setTo(?array $to): static { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } $this->container['to'] = $to; return $this; @@ -345,9 +338,9 @@ public function setTo($to) /** * Gets bcc * - * @return \Brevo\Client\Models\SendSmtpEmailBcc[] + * @return \Brevo\Client\Models\SendSmtpEmailBccInner[]|null */ - public function getBcc() + public function getBcc(): ?array { return $this->container['bcc']; } @@ -355,12 +348,15 @@ public function getBcc() /** * Sets bcc * - * @param \Brevo\Client\Models\SendSmtpEmailBcc[] $bcc List of email addresses and names (optional) of the recipients in bcc + * @param \Brevo\Client\Models\SendSmtpEmailBccInner[]|null $bcc List of email addresses and names (_optional_) of the recipients in bcc * * @return $this */ - public function setBcc($bcc) + public function setBcc(?array $bcc): static { + if (is_null($bcc)) { + throw new InvalidArgumentException('non-nullable bcc cannot be null'); + } $this->container['bcc'] = $bcc; return $this; @@ -369,9 +365,9 @@ public function setBcc($bcc) /** * Gets cc * - * @return \Brevo\Client\Models\SendSmtpEmailCc[] + * @return \Brevo\Client\Models\SendSmtpEmailCcInner[]|null */ - public function getCc() + public function getCc(): ?array { return $this->container['cc']; } @@ -379,12 +375,15 @@ public function getCc() /** * Sets cc * - * @param \Brevo\Client\Models\SendSmtpEmailCc[] $cc List of email addresses and names (optional) of the recipients in cc + * @param \Brevo\Client\Models\SendSmtpEmailCcInner[]|null $cc List of email addresses and names (_optional_) of the recipients in cc * * @return $this */ - public function setCc($cc) + public function setCc(?array $cc): static { + if (is_null($cc)) { + throw new InvalidArgumentException('non-nullable cc cannot be null'); + } $this->container['cc'] = $cc; return $this; @@ -393,9 +392,9 @@ public function setCc($cc) /** * Gets htmlContent * - * @return string + * @return string|null */ - public function getHtmlContent() + public function getHtmlContent(): ?string { return $this->container['htmlContent']; } @@ -403,12 +402,15 @@ public function getHtmlContent() /** * Sets htmlContent * - * @param string $htmlContent HTML body of the message ( Mandatory if 'templateId' is not passed, ignored if 'templateId' is passed ) + * @param string|null $htmlContent HTML body of the message. **Mandatory if 'templateId' is not passed, ignored if 'templateId' is passed** * * @return $this */ - public function setHtmlContent($htmlContent) + public function setHtmlContent(?string $htmlContent): static { + if (is_null($htmlContent)) { + throw new InvalidArgumentException('non-nullable htmlContent cannot be null'); + } $this->container['htmlContent'] = $htmlContent; return $this; @@ -417,9 +419,9 @@ public function setHtmlContent($htmlContent) /** * Gets textContent * - * @return string + * @return string|null */ - public function getTextContent() + public function getTextContent(): ?string { return $this->container['textContent']; } @@ -427,12 +429,15 @@ public function getTextContent() /** * Sets textContent * - * @param string $textContent Plain Text body of the message ( Ignored if 'templateId' is passed ) + * @param string|null $textContent Plain Text body of the message. **Ignored if 'templateId' is passed** * * @return $this */ - public function setTextContent($textContent) + public function setTextContent(?string $textContent): static { + if (is_null($textContent)) { + throw new InvalidArgumentException('non-nullable textContent cannot be null'); + } $this->container['textContent'] = $textContent; return $this; @@ -441,9 +446,9 @@ public function setTextContent($textContent) /** * Gets subject * - * @return string + * @return string|null */ - public function getSubject() + public function getSubject(): ?string { return $this->container['subject']; } @@ -451,12 +456,15 @@ public function getSubject() /** * Sets subject * - * @param string $subject Subject of the message. Mandatory if 'templateId' is not passed + * @param string|null $subject Subject of the message. **Mandatory if 'templateId' is not passed** * * @return $this */ - public function setSubject($subject) + public function setSubject(?string $subject): static { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } $this->container['subject'] = $subject; return $this; @@ -465,9 +473,9 @@ public function setSubject($subject) /** * Gets replyTo * - * @return \Brevo\Client\Models\SendSmtpEmailReplyTo + * @return \Brevo\Client\Models\SendSmtpEmailReplyTo|null */ - public function getReplyTo() + public function getReplyTo(): ?\Brevo\Client\Models\SendSmtpEmailReplyTo { return $this->container['replyTo']; } @@ -475,12 +483,15 @@ public function getReplyTo() /** * Sets replyTo * - * @param \Brevo\Client\Models\SendSmtpEmailReplyTo $replyTo replyTo + * @param \Brevo\Client\Models\SendSmtpEmailReplyTo|null $replyTo replyTo * * @return $this */ - public function setReplyTo($replyTo) + public function setReplyTo(?\Brevo\Client\Models\SendSmtpEmailReplyTo $replyTo): static { + if (is_null($replyTo)) { + throw new InvalidArgumentException('non-nullable replyTo cannot be null'); + } $this->container['replyTo'] = $replyTo; return $this; @@ -489,9 +500,9 @@ public function setReplyTo($replyTo) /** * Gets attachment * - * @return \Brevo\Client\Models\SendSmtpEmailAttachment[] + * @return \Brevo\Client\Models\SendSmtpEmailAttachmentInner[]|null */ - public function getAttachment() + public function getAttachment(): ?array { return $this->container['attachment']; } @@ -499,12 +510,15 @@ public function getAttachment() /** * Sets attachment * - * @param \Brevo\Client\Models\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\":\"myAttachmentFromUrl.jpg\"}, {\"content\":\"base64 example content\", \"name\":\"myAttachmentFromBase64.jpg\"}]`. 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, eps, odt, mp3, m4a, m4v, wma, ogg, flac, wav, aif, aifc, aiff, mp4, mov, avi, mkv, mpeg, mpg, wmv, pkpass and xlsm ( If 'templateId' is passed and is in New Template Language format then both attachment url and content are accepted. If template is in Old template Language format, then 'attachment' is ignored ) + * @param \Brevo\Client\Models\SendSmtpEmailAttachmentInner[]|null $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\":\"myAttachmentFromUrl.jpg\"}, {\"content\":\"base64 example content\", \"name\":\"myAttachmentFromBase64.jpg\"}]**. 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, eps, odt, mp3, m4a, m4v, wma, ogg, flac, wav, aif, aifc, aiff, mp4, mov, avi, mkv, mpeg, mpg, wmv, pkpass and xlsm. If `templateId` is passed and is in New Template Language format then both attachment url and content are accepted. If template is in Old template Language format, then `attachment` is ignored * * @return $this */ - public function setAttachment($attachment) + public function setAttachment(?array $attachment): static { + if (is_null($attachment)) { + throw new InvalidArgumentException('non-nullable attachment cannot be null'); + } $this->container['attachment'] = $attachment; return $this; @@ -513,9 +527,9 @@ public function setAttachment($attachment) /** * Gets headers * - * @return object + * @return array|null */ - public function getHeaders() + public function getHeaders(): ?array { return $this->container['headers']; } @@ -523,12 +537,15 @@ public function getHeaders() /** * Sets headers * - * @param object $headers Pass the set of custom headers (not the standard headers) that shall be sent along the mail headers in the original email. 'sender.ip' header can be set (only for dedicated ip users) to mention the IP to be used for sending transactional emails. Headers are allowed in `This-Case-Only` (i.e. words separated by hyphen with first letter of each word in capital letter), they will be converted to such case styling if not in this format in the request payload. For example, `{\"sender.ip\":\"1.2.3.4\", \"X-Mailin-custom\":\"some_custom_header\", \"idempotencyKey\":\"abc-123\"}`. + * @param array|null $headers Pass the set of custom headers (_not the standard headers_) that shall be sent along the mail headers in the original email. **'sender.ip'** header can be set (**only for dedicated ip users**) to mention the IP to be used for sending transactional emails. Headers are allowed in `This-Case-Only` (i.e. words separated by hyphen with first letter of each word in capital letter), they will be converted to such case styling if not in this format in the request payload. For example, **{\"sender.ip\":\"1.2.3.4\", \"X-Mailin-custom\":\"some_custom_header\", \"idempotencyKey\":\"abc-123\"}**. * * @return $this */ - public function setHeaders($headers) + public function setHeaders(?array $headers): static { + if (is_null($headers)) { + throw new InvalidArgumentException('non-nullable headers cannot be null'); + } $this->container['headers'] = $headers; return $this; @@ -537,9 +554,9 @@ public function setHeaders($headers) /** * Gets templateId * - * @return int + * @return int|null */ - public function getTemplateId() + public function getTemplateId(): ?int { return $this->container['templateId']; } @@ -547,12 +564,15 @@ public function getTemplateId() /** * Sets templateId * - * @param int $templateId Id of the template. + * @param int|null $templateId Id of the template. * * @return $this */ - public function setTemplateId($templateId) + public function setTemplateId(?int $templateId): static { + if (is_null($templateId)) { + throw new InvalidArgumentException('non-nullable templateId cannot be null'); + } $this->container['templateId'] = $templateId; return $this; @@ -561,9 +581,9 @@ public function setTemplateId($templateId) /** * Gets params * - * @return object + * @return array|null */ - public function getParams() + public function getParams(): ?array { return $this->container['params']; } @@ -571,12 +591,15 @@ public function getParams() /** * Sets params * - * @param object $params Pass the set of attributes to customize the template. For example, {\"FNAME\":\"Joe\", \"LNAME\":\"Doe\"}. It's considered only if template is in New Template Language format. + * @param array|null $params Pass the set of attributes to customize the template. For example, **{\"FNAME\":\"Joe\", \"LNAME\":\"Doe\"}**. It's **considered only if template is in New Template Language format**. * * @return $this */ - public function setParams($params) + public function setParams(?array $params): static { + if (is_null($params)) { + throw new InvalidArgumentException('non-nullable params cannot be null'); + } $this->container['params'] = $params; return $this; @@ -585,9 +608,9 @@ public function setParams($params) /** * Gets messageVersions * - * @return \Brevo\Client\Models\SendSmtpEmailMessageVersions[] + * @return \Brevo\Client\Models\SendSmtpEmailMessageVersionsInner[]|null */ - public function getMessageVersions() + public function getMessageVersions(): ?array { return $this->container['messageVersions']; } @@ -595,12 +618,15 @@ public function getMessageVersions() /** * Sets messageVersions * - * @param \Brevo\Client\Models\SendSmtpEmailMessageVersions[] $messageVersions You can customize and send out multiple versions of a mail. templateId can be customized only if global parameter contains templateId. htmlContent and textContent can be customized only if any of the two, htmlContent or textContent, is present in global parameters. Some global parameters such as **to(mandatory), bcc, cc, replyTo, subject** can also be customized specific to each version. Total number of recipients in one API request must not exceed 2000. However, you can still pass upto 99 recipients maximum in one message version. The size of individual params in all the messageVersions shall not exceed 100 KB limit and that of cumulative params shall not exceed 1000 KB. You can follow this **step-by-step guide** on how to use **messageVersions** to batch send emails - https://developers.brevo.com/docs/batch-send-transactional-emails + * @param \Brevo\Client\Models\SendSmtpEmailMessageVersionsInner[]|null $messageVersions You can customize and send out multiple versions of a mail. **templateId** can be customized only if global parameter contains templateId. **htmlContent and textContent** can be customized only if any of the two, htmlContent or textContent, is present in global parameters. Some global parameters such as **to(mandatory), bcc, cc, replyTo, subject** can also be customized specific to each version. Total number of recipients in one API request must not exceed 2000. However, you can still pass upto 99 recipients maximum in one message version. The size of individual params in all the messageVersions shall not exceed **100 KB** limit and that of cumulative params shall not exceed **1000 KB**. You can follow this **step-by-step guide** on how to use **messageVersions** to batch send emails - **https://developers.brevo.com/docs/batch-send-transactional-emails** * * @return $this */ - public function setMessageVersions($messageVersions) + public function setMessageVersions(?array $messageVersions): static { + if (is_null($messageVersions)) { + throw new InvalidArgumentException('non-nullable messageVersions cannot be null'); + } $this->container['messageVersions'] = $messageVersions; return $this; @@ -609,9 +635,9 @@ public function setMessageVersions($messageVersions) /** * Gets tags * - * @return string[] + * @return string[]|null */ - public function getTags() + public function getTags(): ?array { return $this->container['tags']; } @@ -619,12 +645,15 @@ public function getTags() /** * Sets tags * - * @param string[] $tags Tag your emails to find them more easily + * @param string[]|null $tags Tag your emails to find them more easily * * @return $this */ - public function setTags($tags) + public function setTags(?array $tags): static { + if (is_null($tags)) { + throw new InvalidArgumentException('non-nullable tags cannot be null'); + } $this->container['tags'] = $tags; return $this; @@ -633,9 +662,9 @@ public function setTags($tags) /** * Gets scheduledAt * - * @return \DateTime + * @return \DateTime|null */ - public function getScheduledAt() + public function getScheduledAt(): ?\DateTime { return $this->container['scheduledAt']; } @@ -643,12 +672,15 @@ public function getScheduledAt() /** * Sets scheduledAt * - * @param \DateTime $scheduledAt UTC date-time on which the email has to schedule (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for scheduling. There can be an expected delay of +5 minutes in scheduled email delivery. **Please note this feature is currently a public beta**. + * @param \DateTime|null $scheduledAt UTC date-time on which the email has to schedule (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for scheduling. There can be an expected delay of +5 minutes in scheduled email delivery. * * @return $this */ - public function setScheduledAt($scheduledAt) + public function setScheduledAt(?\DateTime $scheduledAt): static { + if (is_null($scheduledAt)) { + throw new InvalidArgumentException('non-nullable scheduledAt cannot be null'); + } $this->container['scheduledAt'] = $scheduledAt; return $this; @@ -657,9 +689,9 @@ public function setScheduledAt($scheduledAt) /** * Gets batchId * - * @return string + * @return string|null */ - public function getBatchId() + public function getBatchId(): ?string { return $this->container['batchId']; } @@ -667,89 +699,19 @@ public function getBatchId() /** * Sets batchId * - * @param string $batchId Valid UUIDv4 batch id to identify the scheduled batches transactional email. If not passed we will create a valid UUIDv4 batch id at our end. + * @param string|null $batchId Valid UUIDv4 batch id to identify the scheduled batches transactional email. If not passed we will create a valid UUIDv4 batch id at our end. * * @return $this */ - public function setBatchId($batchId) + public function setBatchId(?string $batchId): static { + if (is_null($batchId)) { + throw new InvalidArgumentException('non-nullable batchId cannot be null'); + } $this->container['batchId'] = $batchId; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/SendSmtpEmailAttachment.php b/lib/Models/SendSmtpEmailAttachment.php deleted file mode 100644 index 7421133..0000000 --- a/lib/Models/SendSmtpEmailAttachment.php +++ /dev/null @@ -1,374 +0,0 @@ - 'string', - 'content' => 'string', - 'name' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'url' => 'url', - 'content' => 'byte', - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'url' => 'url', - 'content' => 'content', - 'name' => 'name' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'url' => 'setUrl', - 'content' => 'setContent', - 'name' => 'setName' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'url' => 'getUrl', - 'content' => 'getContent', - '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 - */ - public function __construct(array $data = null) - { - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['content'] = isset($data['content']) ? $data['content'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $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'])) { - $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 $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets url - * - * @return string - */ - public function getUrl() - { - return $this->container['url']; - } - - /** - * Sets url - * - * @param string $url Absolute url of the attachment (no local file). - * - * @return $this - */ - public function setUrl($url) - { - $this->container['url'] = $url; - - return $this; - } - - /** - * Gets content - * - * @return string - */ - public function getContent() - { - return $this->container['content']; - } - - /** - * 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))) { - throw new \InvalidArgumentException("invalid value for $content when calling SendSmtpEmailAttachment., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); - } - - $this->container['content'] = $content; - - return $this; - } - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Required if content is passed. Name of the attachment - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/SendSmtpEmailAttachmentInner.php b/lib/Models/SendSmtpEmailAttachmentInner.php new file mode 100644 index 0000000..49002d8 --- /dev/null +++ b/lib/Models/SendSmtpEmailAttachmentInner.php @@ -0,0 +1,284 @@ + + */ +class SendSmtpEmailAttachmentInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'sendSmtpEmail_attachment_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'url' => 'string', + 'content' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'url' => 'url', + 'content' => 'byte', + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'url' => false, + 'content' => false, + 'name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'url' => 'url', + 'content' => 'content', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'url' => 'setUrl', + 'content' => 'setContent', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'url' => 'getUrl', + 'content' => 'getContent', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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'])) { + $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 $invalidProperties; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl(): ?string + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url Absolute url of the attachment (**no local file**). + * + * @return $this + */ + public function setUrl(?string $url): static + { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets content + * + * @return string|null + */ + public function getContent(): ?string + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param string|null $content Base64 encoded chunk data of the attachment generated on the fly + * + * @return $this + */ + public function setContent(?string $content): static + { + if (is_null($content)) { + throw new InvalidArgumentException('non-nullable content cannot be null'); + } + + if ((!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", ObjectSerializer::toString($content)))) { + throw new InvalidArgumentException("invalid value for \$content when calling SendSmtpEmailAttachmentInner., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name **Required if content is passed**. Name of the attachment + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } +} + + diff --git a/lib/Models/SendSmtpEmailBcc.php b/lib/Models/SendSmtpEmailBcc.php deleted file mode 100644 index c079efb..0000000 --- a/lib/Models/SendSmtpEmailBcc.php +++ /dev/null @@ -1,338 +0,0 @@ - 'string', - 'name' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'email' => 'email', - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'email' => 'email', - 'name' => 'name' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'email' => 'setEmail', - 'name' => 'setName' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'email' => 'getEmail', - '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 - */ - public function __construct(array $data = null) - { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['email'] === null) { - $invalidProperties[] = "'email' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets email - * - * @return string - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string $email Email address of the recipient in bcc - * - * @return $this - */ - public function setEmail($email) - { - $this->container['email'] = $email; - - return $this; - } - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Name of the recipient in bcc. Maximum allowed characters are 70. - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/SendSmtpEmailBccInner.php b/lib/Models/SendSmtpEmailBccInner.php new file mode 100644 index 0000000..580db5b --- /dev/null +++ b/lib/Models/SendSmtpEmailBccInner.php @@ -0,0 +1,244 @@ + + */ +class SendSmtpEmailBccInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'sendSmtpEmail_bcc_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'email' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'email' => 'email', + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'email' => 'email', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'email' => 'setEmail', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'email' => 'getEmail', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['email'] === null) { + $invalidProperties[] = "'email' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets email + * + * @return string + */ + public function getEmail(): string + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string $email Email address of the recipient in bcc + * + * @return $this + */ + public function setEmail(string $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the recipient in bcc. **Maximum allowed characters are 70**. + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } +} + + diff --git a/lib/Models/SendSmtpEmailCc.php b/lib/Models/SendSmtpEmailCc.php deleted file mode 100644 index 485af01..0000000 --- a/lib/Models/SendSmtpEmailCc.php +++ /dev/null @@ -1,338 +0,0 @@ - 'string', - 'name' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'email' => 'email', - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'email' => 'email', - 'name' => 'name' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'email' => 'setEmail', - 'name' => 'setName' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'email' => 'getEmail', - '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 - */ - public function __construct(array $data = null) - { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['email'] === null) { - $invalidProperties[] = "'email' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets email - * - * @return string - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string $email Email address of the recipient in cc - * - * @return $this - */ - public function setEmail($email) - { - $this->container['email'] = $email; - - return $this; - } - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Name of the recipient in cc. Maximum allowed characters are 70. - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/SendSmtpEmailCcInner.php b/lib/Models/SendSmtpEmailCcInner.php new file mode 100644 index 0000000..a00454e --- /dev/null +++ b/lib/Models/SendSmtpEmailCcInner.php @@ -0,0 +1,244 @@ + + */ +class SendSmtpEmailCcInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'sendSmtpEmail_cc_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'email' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'email' => 'email', + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'email' => 'email', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'email' => 'setEmail', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'email' => 'getEmail', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['email'] === null) { + $invalidProperties[] = "'email' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets email + * + * @return string + */ + public function getEmail(): string + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string $email Email address of the recipient in cc + * + * @return $this + */ + public function setEmail(string $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the recipient in cc. **Maximum allowed characters are 70**. + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } +} + + diff --git a/lib/Models/SendSmtpEmailMessageVersions.php b/lib/Models/SendSmtpEmailMessageVersions.php deleted file mode 100644 index 7edc596..0000000 --- a/lib/Models/SendSmtpEmailMessageVersions.php +++ /dev/null @@ -1,458 +0,0 @@ - '\Brevo\Client\Models\SendSmtpEmailTo1[]', - 'params' => 'map[string,object]', - 'bcc' => '\Brevo\Client\Models\SendSmtpEmailBcc[]', - 'cc' => '\Brevo\Client\Models\SendSmtpEmailCc[]', - 'replyTo' => '\Brevo\Client\Models\SendSmtpEmailReplyTo1', - 'subject' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'to' => null, - 'params' => null, - 'bcc' => null, - 'cc' => null, - 'replyTo' => null, - 'subject' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'to' => 'to', - 'params' => 'params', - 'bcc' => 'bcc', - 'cc' => 'cc', - 'replyTo' => 'replyTo', - 'subject' => 'subject' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'to' => 'setTo', - 'params' => 'setParams', - 'bcc' => 'setBcc', - 'cc' => 'setCc', - 'replyTo' => 'setReplyTo', - 'subject' => 'setSubject' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'to' => 'getTo', - 'params' => 'getParams', - 'bcc' => 'getBcc', - 'cc' => 'getCc', - 'replyTo' => 'getReplyTo', - 'subject' => 'getSubject' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['to'] = isset($data['to']) ? $data['to'] : null; - $this->container['params'] = isset($data['params']) ? $data['params'] : null; - $this->container['bcc'] = isset($data['bcc']) ? $data['bcc'] : null; - $this->container['cc'] = isset($data['cc']) ? $data['cc'] : null; - $this->container['replyTo'] = isset($data['replyTo']) ? $data['replyTo'] : null; - $this->container['subject'] = isset($data['subject']) ? $data['subject'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['to'] === null) { - $invalidProperties[] = "'to' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets to - * - * @return \Brevo\Client\Models\SendSmtpEmailTo1[] - */ - public function getTo() - { - return $this->container['to']; - } - - /** - * Sets to - * - * @param \Brevo\Client\Models\SendSmtpEmailTo1[] $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) - { - $this->container['to'] = $to; - - return $this; - } - - /** - * Gets params - * - * @return map[string,object] - */ - public function getParams() - { - return $this->container['params']; - } - - /** - * Sets params - * - * @param map[string,object] $params Pass the set of attributes to customize the template. For example, {\"FNAME\":\"Joe\", \"LNAME\":\"Doe\"}. It's considered only if template is in New Template Language format. - * - * @return $this - */ - public function setParams($params) - { - $this->container['params'] = $params; - - return $this; - } - - /** - * Gets bcc - * - * @return \Brevo\Client\Models\SendSmtpEmailBcc[] - */ - public function getBcc() - { - return $this->container['bcc']; - } - - /** - * Sets bcc - * - * @param \Brevo\Client\Models\SendSmtpEmailBcc[] $bcc List of email addresses and names (optional) of the recipients in bcc - * - * @return $this - */ - public function setBcc($bcc) - { - $this->container['bcc'] = $bcc; - - return $this; - } - - /** - * Gets cc - * - * @return \Brevo\Client\Models\SendSmtpEmailCc[] - */ - public function getCc() - { - return $this->container['cc']; - } - - /** - * Sets cc - * - * @param \Brevo\Client\Models\SendSmtpEmailCc[] $cc List of email addresses and names (optional) of the recipients in cc - * - * @return $this - */ - public function setCc($cc) - { - $this->container['cc'] = $cc; - - return $this; - } - - /** - * Gets replyTo - * - * @return \Brevo\Client\Models\SendSmtpEmailReplyTo1 - */ - public function getReplyTo() - { - return $this->container['replyTo']; - } - - /** - * Sets replyTo - * - * @param \Brevo\Client\Models\SendSmtpEmailReplyTo1 $replyTo replyTo - * - * @return $this - */ - public function setReplyTo($replyTo) - { - $this->container['replyTo'] = $replyTo; - - return $this; - } - - /** - * Gets subject - * - * @return string - */ - public function getSubject() - { - return $this->container['subject']; - } - - /** - * Sets subject - * - * @param string $subject Custom subject specific to message version - * - * @return $this - */ - public function setSubject($subject) - { - $this->container['subject'] = $subject; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/SendSmtpEmailMessageVersionsInner.php b/lib/Models/SendSmtpEmailMessageVersionsInner.php new file mode 100644 index 0000000..beba24d --- /dev/null +++ b/lib/Models/SendSmtpEmailMessageVersionsInner.php @@ -0,0 +1,448 @@ + + */ +class SendSmtpEmailMessageVersionsInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'sendSmtpEmail_messageVersions_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'to' => '\Brevo\Client\Models\SendSmtpEmailToInner[]', + 'params' => 'array', + 'bcc' => '\Brevo\Client\Models\SendSmtpEmailBccInner[]', + 'cc' => '\Brevo\Client\Models\SendSmtpEmailCcInner[]', + 'replyTo' => '\Brevo\Client\Models\SendSmtpEmailReplyTo', + 'subject' => 'string', + 'htmlContent' => 'string', + 'textContent' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'to' => null, + 'params' => null, + 'bcc' => null, + 'cc' => null, + 'replyTo' => null, + 'subject' => null, + 'htmlContent' => null, + 'textContent' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'to' => false, + 'params' => false, + 'bcc' => false, + 'cc' => false, + 'replyTo' => false, + 'subject' => false, + 'htmlContent' => false, + 'textContent' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'to' => 'to', + 'params' => 'params', + 'bcc' => 'bcc', + 'cc' => 'cc', + 'replyTo' => 'replyTo', + 'subject' => 'subject', + 'htmlContent' => 'htmlContent', + 'textContent' => 'textContent' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'to' => 'setTo', + 'params' => 'setParams', + 'bcc' => 'setBcc', + 'cc' => 'setCc', + 'replyTo' => 'setReplyTo', + 'subject' => 'setSubject', + 'htmlContent' => 'setHtmlContent', + 'textContent' => 'setTextContent' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'to' => 'getTo', + 'params' => 'getParams', + 'bcc' => 'getBcc', + 'cc' => 'getCc', + 'replyTo' => 'getReplyTo', + 'subject' => 'getSubject', + 'htmlContent' => 'getHtmlContent', + 'textContent' => 'getTextContent' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('params', $data ?? [], null); + $this->setIfExists('bcc', $data ?? [], null); + $this->setIfExists('cc', $data ?? [], null); + $this->setIfExists('replyTo', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('htmlContent', $data ?? [], null); + $this->setIfExists('textContent', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets to + * + * @return \Brevo\Client\Models\SendSmtpEmailToInner[] + */ + public function getTo(): array + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param \Brevo\Client\Models\SendSmtpEmailToInner[] $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(array $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets params + * + * @return array|null + */ + public function getParams(): ?array + { + return $this->container['params']; + } + + /** + * Sets params + * + * @param array|null $params Pass the set of attributes to customize the template. For example, **{\"FNAME\":\"Joe\", \"LNAME\":\"Doe\"}**. It's **considered only if template is in New Template Language format**. + * + * @return $this + */ + public function setParams(?array $params): static + { + if (is_null($params)) { + throw new InvalidArgumentException('non-nullable params cannot be null'); + } + $this->container['params'] = $params; + + return $this; + } + + /** + * Gets bcc + * + * @return \Brevo\Client\Models\SendSmtpEmailBccInner[]|null + */ + public function getBcc(): ?array + { + return $this->container['bcc']; + } + + /** + * Sets bcc + * + * @param \Brevo\Client\Models\SendSmtpEmailBccInner[]|null $bcc List of email addresses and names (_optional_) of the recipients in bcc + * + * @return $this + */ + public function setBcc(?array $bcc): static + { + if (is_null($bcc)) { + throw new InvalidArgumentException('non-nullable bcc cannot be null'); + } + $this->container['bcc'] = $bcc; + + return $this; + } + + /** + * Gets cc + * + * @return \Brevo\Client\Models\SendSmtpEmailCcInner[]|null + */ + public function getCc(): ?array + { + return $this->container['cc']; + } + + /** + * Sets cc + * + * @param \Brevo\Client\Models\SendSmtpEmailCcInner[]|null $cc List of email addresses and names (_optional_) of the recipients in cc + * + * @return $this + */ + public function setCc(?array $cc): static + { + if (is_null($cc)) { + throw new InvalidArgumentException('non-nullable cc cannot be null'); + } + $this->container['cc'] = $cc; + + return $this; + } + + /** + * Gets replyTo + * + * @return \Brevo\Client\Models\SendSmtpEmailReplyTo|null + */ + public function getReplyTo(): ?\Brevo\Client\Models\SendSmtpEmailReplyTo + { + return $this->container['replyTo']; + } + + /** + * Sets replyTo + * + * @param \Brevo\Client\Models\SendSmtpEmailReplyTo|null $replyTo replyTo + * + * @return $this + */ + public function setReplyTo(?\Brevo\Client\Models\SendSmtpEmailReplyTo $replyTo): static + { + if (is_null($replyTo)) { + throw new InvalidArgumentException('non-nullable replyTo cannot be null'); + } + $this->container['replyTo'] = $replyTo; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject(): ?string + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject Custom subject specific to message version + * + * @return $this + */ + public function setSubject(?string $subject): static + { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets htmlContent + * + * @return string|null + */ + public function getHtmlContent(): ?string + { + return $this->container['htmlContent']; + } + + /** + * Sets htmlContent + * + * @param string|null $htmlContent HTML body of the message. **Mandatory if 'templateId' is not passed, ignored if 'templateId' is passed** + * + * @return $this + */ + public function setHtmlContent(?string $htmlContent): static + { + if (is_null($htmlContent)) { + throw new InvalidArgumentException('non-nullable htmlContent cannot be null'); + } + $this->container['htmlContent'] = $htmlContent; + + return $this; + } + + /** + * Gets textContent + * + * @return string|null + */ + public function getTextContent(): ?string + { + return $this->container['textContent']; + } + + /** + * Sets textContent + * + * @param string|null $textContent Plain Text body of the message. **Ignored if 'templateId' is passed** + * + * @return $this + */ + public function setTextContent(?string $textContent): static + { + if (is_null($textContent)) { + throw new InvalidArgumentException('non-nullable textContent cannot be null'); + } + $this->container['textContent'] = $textContent; + + return $this; + } +} + + diff --git a/lib/Models/SendSmtpEmailReplyTo.php b/lib/Models/SendSmtpEmailReplyTo.php index caf08dc..8580933 100644 --- a/lib/Models/SendSmtpEmailReplyTo.php +++ b/lib/Models/SendSmtpEmailReplyTo.php @@ -2,62 +2,64 @@ /** * SendSmtpEmailReplyTo * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SendSmtpEmailReplyTo Class Doc Comment * - * @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\"}. + * @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 Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SendSmtpEmailReplyTo implements ModelInterface, ArrayAccess +class SendSmtpEmailReplyTo extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'sendSmtpEmail_replyTo'; + protected static string $openAPIModelName = 'sendSmtpEmail_replyTo'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'email' => 'string', 'name' => 'string' ]; @@ -65,40 +67,37 @@ class SendSmtpEmailReplyTo implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'email' => 'email', 'name' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'name' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'email' => 'email', 'name' => 'name' ]; @@ -106,9 +105,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'email' => 'setEmail', 'name' => 'setName' ]; @@ -116,9 +115,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'email' => 'getEmail', 'name' => 'getName' ]; @@ -127,9 +126,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -137,9 +136,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -147,52 +146,38 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -202,24 +187,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets email * * @return string */ - public function getEmail() + public function getEmail(): string { return $this->container['email']; } @@ -231,8 +204,11 @@ public function getEmail() * * @return $this */ - public function setEmail($email) + public function setEmail(string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -241,9 +217,9 @@ public function setEmail($email) /** * Gets name * - * @return string + * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -251,89 +227,19 @@ public function getName() /** * Sets name * - * @param string $name Name in reply to. Maximum allowed characters are 70. + * @param string|null $name Name in reply to. **Maximum allowed characters are 70**. * * @return $this */ - public function setName($name) + public function setName(?string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/SendSmtpEmailReplyTo1.php b/lib/Models/SendSmtpEmailReplyTo1.php deleted file mode 100644 index e2a83d4..0000000 --- a/lib/Models/SendSmtpEmailReplyTo1.php +++ /dev/null @@ -1,339 +0,0 @@ - 'string', - 'name' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'email' => 'email', - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'email' => 'email', - 'name' => 'name' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'email' => 'setEmail', - 'name' => 'setName' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'email' => 'getEmail', - '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 - */ - public function __construct(array $data = null) - { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['email'] === null) { - $invalidProperties[] = "'email' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets email - * - * @return string - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string $email Email address in reply to - * - * @return $this - */ - public function setEmail($email) - { - $this->container['email'] = $email; - - return $this; - } - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Name in reply to. Maximum allowed characters are 70. - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/SendSmtpEmailSender.php b/lib/Models/SendSmtpEmailSender.php index d64d7ce..0e4fb4f 100644 --- a/lib/Models/SendSmtpEmailSender.php +++ b/lib/Models/SendSmtpEmailSender.php @@ -2,62 +2,64 @@ /** * SendSmtpEmailSender * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SendSmtpEmailSender Class Doc Comment * - * @category Class - * @description Mandatory if `templateId` is not passed. Pass `name` (optional) and `email` OR `id` of sender from which emails will be sent. `name` will be ignored if passed along with sender `id`. For example, {\"name\":\"Mary from MyShop\", \"email\":\"no-reply@myshop.com\"} or {\"id\":2} + * @description **Mandatory if `templateId` is not passed**. Pass name (_optional_) and email or id of sender from which emails will be sent. **`name` will be ignored if passed along with sender `id`**. For example, **{\"name\":\"Mary from MyShop\", \"email\":\"no-reply@myshop.com\"}** **{\"id\":2}** * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SendSmtpEmailSender implements ModelInterface, ArrayAccess +class SendSmtpEmailSender extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'sendSmtpEmail_sender'; + protected static string $openAPIModelName = 'sendSmtpEmail_sender'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string', 'email' => 'string', 'id' => 'int' @@ -66,41 +68,39 @@ class SendSmtpEmailSender implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null, 'email' => 'email', 'id' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'email' => false, + 'id' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name', 'email' => 'email', 'id' => 'id' @@ -109,9 +109,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName', 'email' => 'setEmail', 'id' => 'setId' @@ -120,9 +120,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName', 'email' => 'getEmail', 'id' => 'getId' @@ -132,9 +132,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -142,9 +142,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -152,77 +152,51 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * - * @return string + * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -230,12 +204,15 @@ public function getName() /** * Sets name * - * @param string $name Name of the sender from which the emails will be sent. Maximum allowed characters are 70. Applicable only when email is passed. + * @param string|null $name description: Name of the sender from which the emails will be sent. **Maximum allowed characters are 70**. Applicable only when email is passed. * * @return $this */ - public function setName($name) + public function setName(?string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -244,9 +221,9 @@ public function setName($name) /** * Gets email * - * @return string + * @return string|null */ - public function getEmail() + public function getEmail(): ?string { return $this->container['email']; } @@ -254,12 +231,15 @@ public function getEmail() /** * Sets email * - * @param string $email Email of the sender from which the emails will be sent. Mandatory if sender id is not passed. + * @param string|null $email Email of the sender from which the emails will be sent. Mandatory if sender id is not passed. * * @return $this */ - public function setEmail($email) + public function setEmail(?string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -268,9 +248,9 @@ public function setEmail($email) /** * Gets id * - * @return int + * @return int|null */ - public function getId() + public function getId(): ?int { return $this->container['id']; } @@ -278,89 +258,19 @@ public function getId() /** * Sets id * - * @param int $id Id of the sender from which the emails will be sent. In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email). Mandatory if email is not passed. + * @param int|null $id Id of the sender from which the emails will be sent. In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email). Mandatory if email is not passed. * * @return $this */ - public function setId($id) + public function setId(?int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/SendSmtpEmailTo.php b/lib/Models/SendSmtpEmailTo.php deleted file mode 100644 index 5d06a00..0000000 --- a/lib/Models/SendSmtpEmailTo.php +++ /dev/null @@ -1,338 +0,0 @@ - 'string', - 'name' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'email' => 'email', - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'email' => 'email', - 'name' => 'name' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'email' => 'setEmail', - 'name' => 'setName' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'email' => 'getEmail', - '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 - */ - public function __construct(array $data = null) - { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['email'] === null) { - $invalidProperties[] = "'email' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets email - * - * @return string - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string $email Email address of the recipient - * - * @return $this - */ - public function setEmail($email) - { - $this->container['email'] = $email; - - return $this; - } - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Name of the recipient. Maximum allowed characters are 70. - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/SendSmtpEmailTo1.php b/lib/Models/SendSmtpEmailTo1.php deleted file mode 100644 index 91abc02..0000000 --- a/lib/Models/SendSmtpEmailTo1.php +++ /dev/null @@ -1,338 +0,0 @@ - 'string', - 'name' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'email' => 'email', - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'email' => 'email', - 'name' => 'name' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'email' => 'setEmail', - 'name' => 'setName' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'email' => 'getEmail', - '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 - */ - public function __construct(array $data = null) - { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['email'] === null) { - $invalidProperties[] = "'email' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets email - * - * @return string - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string $email Email address of the recipient - * - * @return $this - */ - public function setEmail($email) - { - $this->container['email'] = $email; - - return $this; - } - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Name of the recipient. **Maximum allowed characters are 70**. - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/SendSmtpEmailToInner.php b/lib/Models/SendSmtpEmailToInner.php new file mode 100644 index 0000000..be78646 --- /dev/null +++ b/lib/Models/SendSmtpEmailToInner.php @@ -0,0 +1,244 @@ + + */ +class SendSmtpEmailToInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'sendSmtpEmail_to_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'email' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'email' => 'email', + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'email' => 'email', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'email' => 'setEmail', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'email' => 'getEmail', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['email'] === null) { + $invalidProperties[] = "'email' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets email + * + * @return string + */ + public function getEmail(): string + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string $email Email address of the recipient + * + * @return $this + */ + public function setEmail(string $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the recipient. **Maximum allowed characters are 70**. + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } +} + + diff --git a/lib/Models/SendTestEmail.php b/lib/Models/SendTestEmail.php index a798afb..210e952 100644 --- a/lib/Models/SendTestEmail.php +++ b/lib/Models/SendTestEmail.php @@ -2,118 +2,116 @@ /** * SendTestEmail * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SendTestEmail Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SendTestEmail implements ModelInterface, ArrayAccess +class SendTestEmail extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'sendTestEmail'; + protected static string $openAPIModelName = 'sendTestEmail'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'emailTo' => 'string[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'emailTo' => 'email' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'emailTo' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'emailTo' => 'emailTo' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'emailTo' => 'setEmailTo' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'emailTo' => 'getEmailTo' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,75 +139,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['emailTo'] = isset($data['emailTo']) ? $data['emailTo'] : null; + $this->setIfExists('emailTo', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets emailTo * - * @return string[] + * @return string[]|null */ - public function getEmailTo() + public function getEmailTo(): ?array { return $this->container['emailTo']; } @@ -217,89 +189,19 @@ public function getEmailTo() /** * Sets emailTo * - * @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. You can not send more than 50 test emails per day. + * @param string[]|null $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. You can not send more than 50 test emails per day_. * * @return $this */ - public function setEmailTo($emailTo) + public function setEmailTo(?array $emailTo): static { + if (is_null($emailTo)) { + throw new InvalidArgumentException('non-nullable emailTo cannot be null'); + } $this->container['emailTo'] = $emailTo; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/SendTestSms.php b/lib/Models/SendTestSms.php index 39ccb47..29b5e14 100644 --- a/lib/Models/SendTestSms.php +++ b/lib/Models/SendTestSms.php @@ -2,118 +2,116 @@ /** * SendTestSms * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SendTestSms Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SendTestSms implements ModelInterface, ArrayAccess +class SendTestSms extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'sendTestSms'; + protected static string $openAPIModelName = 'sendTestSms'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'phoneNumber' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'phoneNumber' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'phoneNumber' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'phoneNumber' => 'phoneNumber' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'phoneNumber' => 'setPhoneNumber' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'phoneNumber' => 'getPhoneNumber' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,75 +139,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['phoneNumber'] = isset($data['phoneNumber']) ? $data['phoneNumber'] : null; + $this->setIfExists('phoneNumber', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets phoneNumber * - * @return string + * @return string|null */ - public function getPhoneNumber() + public function getPhoneNumber(): ?string { return $this->container['phoneNumber']; } @@ -217,89 +189,19 @@ public function getPhoneNumber() /** * Sets phoneNumber * - * @param string $phoneNumber Mobile number of the recipient with the country code. This number must belong to one of your contacts in Brevo account and must not be blacklisted + * @param string|null $phoneNumber Mobile number of the recipient with the country code. This number **must belong to one of your contacts in Brevo account and must not be blacklisted** * * @return $this */ - public function setPhoneNumber($phoneNumber) + public function setPhoneNumber(?string $phoneNumber): static { + if (is_null($phoneNumber)) { + throw new InvalidArgumentException('non-nullable phoneNumber cannot be null'); + } $this->container['phoneNumber'] = $phoneNumber; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/SendTransacSms.php b/lib/Models/SendTransacSms.php index a44ecf2..987cef8 100644 --- a/lib/Models/SendTransacSms.php +++ b/lib/Models/SendTransacSms.php @@ -2,61 +2,63 @@ /** * SendTransacSms * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SendTransacSms Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SendTransacSms implements ModelInterface, ArrayAccess +class SendTransacSms extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'sendTransacSms'; + protected static string $openAPIModelName = 'sendTransacSms'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'sender' => 'string', 'recipient' => 'string', 'content' => 'string', @@ -70,9 +72,9 @@ class SendTransacSms implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'sender' => null, 'recipient' => null, 'content' => null, @@ -84,32 +86,35 @@ class SendTransacSms implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'sender' => false, + 'recipient' => false, + 'content' => false, + 'type' => false, + 'tag' => false, + 'webUrl' => false, + 'unicodeEnabled' => false, + 'organisationPrefix' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'sender' => 'sender', 'recipient' => 'recipient', 'content' => 'content', @@ -123,9 +128,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'sender' => 'setSender', 'recipient' => 'setRecipient', 'content' => 'setContent', @@ -139,9 +144,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'sender' => 'getSender', 'recipient' => 'getRecipient', 'content' => 'getContent', @@ -156,9 +161,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -166,9 +171,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -176,27 +181,15 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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'; - - + public const TYPE_TRANSACTIONAL = 'transactional'; + public const TYPE_MARKETING = 'marketing'; /** * Gets allowable values of the enum @@ -211,38 +204,36 @@ public function getTypeAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['sender'] = isset($data['sender']) ? $data['sender'] : null; - $this->container['recipient'] = isset($data['recipient']) ? $data['recipient'] : null; - $this->container['content'] = isset($data['content']) ? $data['content'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : 'transactional'; - $this->container['tag'] = isset($data['tag']) ? $data['tag'] : null; - $this->container['webUrl'] = isset($data['webUrl']) ? $data['webUrl'] : null; - $this->container['unicodeEnabled'] = isset($data['unicodeEnabled']) ? $data['unicodeEnabled'] : false; - $this->container['organisationPrefix'] = isset($data['organisationPrefix']) ? $data['organisationPrefix'] : null; + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('recipient', $data ?? [], null); + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('type', $data ?? [], 'transactional'); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('webUrl', $data ?? [], null); + $this->setIfExists('unicodeEnabled', $data ?? [], false); + $this->setIfExists('organisationPrefix', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -262,7 +253,8 @@ public function listInvalidProperties() $allowedValues = $this->getTypeAllowableValues(); if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], implode("', '", $allowedValues) ); } @@ -270,24 +262,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets sender * * @return string */ - public function getSender() + public function getSender(): string { return $this->container['sender']; } @@ -299,10 +279,13 @@ public function getSender() * * @return $this */ - public function setSender($sender) + public function setSender(string $sender): static { + if (is_null($sender)) { + throw new InvalidArgumentException('non-nullable sender cannot be null'); + } if ((mb_strlen($sender) > 15)) { - throw new \InvalidArgumentException('invalid length for $sender when calling SendTransacSms., must be smaller than or equal to 15.'); + throw new InvalidArgumentException('invalid length for $sender when calling SendTransacSms., must be smaller than or equal to 15.'); } $this->container['sender'] = $sender; @@ -315,7 +298,7 @@ public function setSender($sender) * * @return string */ - public function getRecipient() + public function getRecipient(): string { return $this->container['recipient']; } @@ -327,8 +310,11 @@ public function getRecipient() * * @return $this */ - public function setRecipient($recipient) + public function setRecipient(string $recipient): static { + if (is_null($recipient)) { + throw new InvalidArgumentException('non-nullable recipient cannot be null'); + } $this->container['recipient'] = $recipient; return $this; @@ -339,7 +325,7 @@ public function setRecipient($recipient) * * @return string */ - public function getContent() + public function getContent(): string { return $this->container['content']; } @@ -347,12 +333,15 @@ public function getContent() /** * Sets content * - * @param string $content Content of the message. If more than 160 characters long, will be sent as multiple text messages + * @param string $content Content of the message. If more than **160 characters** long, will be sent as multiple text messages * * @return $this */ - public function setContent($content) + public function setContent(string $content): static { + if (is_null($content)) { + throw new InvalidArgumentException('non-nullable content cannot be null'); + } $this->container['content'] = $content; return $this; @@ -361,9 +350,9 @@ public function setContent($content) /** * Gets type * - * @return string + * @return string|null */ - public function getType() + public function getType(): ?string { return $this->container['type']; } @@ -371,17 +360,21 @@ public function getType() /** * Sets type * - * @param string $type Type of the SMS. Marketing SMS messages are those sent typically with marketing content. Transactional SMS messages are sent to individuals and are triggered in response to some action, such as a sign-up, purchase, etc. + * @param string|null $type Type of the SMS. Marketing SMS messages are those sent typically with marketing content. Transactional SMS messages are sent to individuals and are triggered in response to some action, such as a sign-up, purchase, etc. * * @return $this */ - public function setType($type) + public function setType(?string $type): static { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($type) && !in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( sprintf( - "Invalid value for 'type', must be one of '%s'", + "Invalid value '%s' for 'type', must be one of '%s'", + $type, implode("', '", $allowedValues) ) ); @@ -394,9 +387,9 @@ public function setType($type) /** * Gets tag * - * @return string + * @return string|null */ - public function getTag() + public function getTag(): ?string { return $this->container['tag']; } @@ -404,12 +397,15 @@ public function getTag() /** * Sets tag * - * @param string $tag Tag of the message + * @param string|null $tag Tag of the message * * @return $this */ - public function setTag($tag) + public function setTag(?string $tag): static { + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } $this->container['tag'] = $tag; return $this; @@ -418,9 +414,9 @@ public function setTag($tag) /** * Gets webUrl * - * @return string + * @return string|null */ - public function getWebUrl() + public function getWebUrl(): ?string { return $this->container['webUrl']; } @@ -428,12 +424,15 @@ public function getWebUrl() /** * Sets webUrl * - * @param string $webUrl Webhook to call for each event triggered by the message (delivered etc.) + * @param string|null $webUrl Webhook to call for each event triggered by the message (delivered etc.) * * @return $this */ - public function setWebUrl($webUrl) + public function setWebUrl(?string $webUrl): static { + if (is_null($webUrl)) { + throw new InvalidArgumentException('non-nullable webUrl cannot be null'); + } $this->container['webUrl'] = $webUrl; return $this; @@ -442,9 +441,9 @@ public function setWebUrl($webUrl) /** * Gets unicodeEnabled * - * @return bool + * @return bool|null */ - public function getUnicodeEnabled() + public function getUnicodeEnabled(): ?bool { return $this->container['unicodeEnabled']; } @@ -452,12 +451,15 @@ public function getUnicodeEnabled() /** * Sets unicodeEnabled * - * @param bool $unicodeEnabled Format of the message. It indicates whether the content should be treated as unicode or not. + * @param bool|null $unicodeEnabled Format of the message. It indicates whether the content should be treated as unicode or not. * * @return $this */ - public function setUnicodeEnabled($unicodeEnabled) + public function setUnicodeEnabled(?bool $unicodeEnabled): static { + if (is_null($unicodeEnabled)) { + throw new InvalidArgumentException('non-nullable unicodeEnabled cannot be null'); + } $this->container['unicodeEnabled'] = $unicodeEnabled; return $this; @@ -466,9 +468,9 @@ public function setUnicodeEnabled($unicodeEnabled) /** * Gets organisationPrefix * - * @return string + * @return string|null */ - public function getOrganisationPrefix() + public function getOrganisationPrefix(): ?string { return $this->container['organisationPrefix']; } @@ -476,89 +478,19 @@ public function getOrganisationPrefix() /** * Sets organisationPrefix * - * @param string $organisationPrefix A recognizable prefix will ensure your audience knows who you are. Recommended by U.S. carriers. This will be added as your Brand Name before the message content. **Prefer verifying maximum length of 160 characters including this prefix in message content to avoid multiple sending of same sms.** + * @param string|null $organisationPrefix A recognizable prefix will ensure your audience knows who you are. Recommended by U.S. carriers. This will be added as your Brand Name before the message content. **Prefer verifying maximum length of 160 characters including this prefix in message content to avoid multiple sending of same sms.** * * @return $this */ - public function setOrganisationPrefix($organisationPrefix) + public function setOrganisationPrefix(?string $organisationPrefix): static { + if (is_null($organisationPrefix)) { + throw new InvalidArgumentException('non-nullable organisationPrefix cannot be null'); + } $this->container['organisationPrefix'] = $organisationPrefix; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/SendWhatsappMessage.php b/lib/Models/SendWhatsappMessage.php deleted file mode 100644 index d985d8d..0000000 --- a/lib/Models/SendWhatsappMessage.php +++ /dev/null @@ -1,431 +0,0 @@ - 'int', - 'text' => 'string', - 'senderNumber' => 'string', - 'params' => 'object', - 'contactNumbers' => 'string[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'templateId' => null, - 'text' => null, - 'senderNumber' => 'mobile', - 'params' => null, - 'contactNumbers' => 'mobile' - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'templateId' => 'templateId', - 'text' => 'text', - 'senderNumber' => 'senderNumber', - 'params' => 'params', - 'contactNumbers' => 'contactNumbers' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'templateId' => 'setTemplateId', - 'text' => 'setText', - 'senderNumber' => 'setSenderNumber', - 'params' => 'setParams', - 'contactNumbers' => 'setContactNumbers' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'templateId' => 'getTemplateId', - 'text' => 'getText', - 'senderNumber' => 'getSenderNumber', - 'params' => 'getParams', - 'contactNumbers' => 'getContactNumbers' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['templateId'] = isset($data['templateId']) ? $data['templateId'] : null; - $this->container['text'] = isset($data['text']) ? $data['text'] : null; - $this->container['senderNumber'] = isset($data['senderNumber']) ? $data['senderNumber'] : null; - $this->container['params'] = isset($data['params']) ? $data['params'] : null; - $this->container['contactNumbers'] = isset($data['contactNumbers']) ? $data['contactNumbers'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['senderNumber'] === null) { - $invalidProperties[] = "'senderNumber' can't be null"; - } - if ($this->container['contactNumbers'] === null) { - $invalidProperties[] = "'contactNumbers' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets templateId - * - * @return int - */ - public function getTemplateId() - { - return $this->container['templateId']; - } - - /** - * Sets templateId - * - * @param int $templateId ID of the template to send - * - * @return $this - */ - public function setTemplateId($templateId) - { - $this->container['templateId'] = $templateId; - - return $this; - } - - /** - * Gets text - * - * @return string - */ - public function getText() - { - return $this->container['text']; - } - - /** - * Sets text - * - * @param string $text Text to be sent as message body (will be overridden if templateId is passed in the same request) - * - * @return $this - */ - public function setText($text) - { - $this->container['text'] = $text; - - return $this; - } - - /** - * Gets senderNumber - * - * @return string - */ - public function getSenderNumber() - { - return $this->container['senderNumber']; - } - - /** - * Sets senderNumber - * - * @param string $senderNumber WhatsApp Number with country code. Example, 85264318721 - * - * @return $this - */ - public function setSenderNumber($senderNumber) - { - $this->container['senderNumber'] = $senderNumber; - - return $this; - } - - /** - * Gets params - * - * @return object - */ - public function getParams() - { - return $this->container['params']; - } - - /** - * Sets 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) - { - $this->container['params'] = $params; - - return $this; - } - - /** - * Gets contactNumbers - * - * @return string[] - */ - public function getContactNumbers() - { - return $this->container['contactNumbers']; - } - - /** - * Sets contactNumbers - * - * @param string[] $contactNumbers List of phone numbers of the contacts - * - * @return $this - */ - public function setContactNumbers($contactNumbers) - { - $this->container['contactNumbers'] = $contactNumbers; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/SendWhatsappMessage201Response.php b/lib/Models/SendWhatsappMessage201Response.php new file mode 100644 index 0000000..50725a4 --- /dev/null +++ b/lib/Models/SendWhatsappMessage201Response.php @@ -0,0 +1,210 @@ + + */ +class SendWhatsappMessage201Response extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'sendWhatsappMessage_201_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'messageId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'messageId' => 'uuidv4' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'messageId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'messageId' => 'messageId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'messageId' => 'setMessageId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('messageId', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['messageId'] === null) { + $invalidProperties[] = "'messageId' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets messageId + * + * @return string + */ + public function getMessageId(): string + { + return $this->container['messageId']; + } + + /** + * Sets messageId + * + * @param string $messageId messageId of sent message + * + * @return $this + */ + public function setMessageId(string $messageId): static + { + if (is_null($messageId)) { + throw new InvalidArgumentException('non-nullable messageId cannot be null'); + } + $this->container['messageId'] = $messageId; + + return $this; + } +} + + diff --git a/lib/Models/SendWhatsappMessageRequest.php b/lib/Models/SendWhatsappMessageRequest.php new file mode 100644 index 0000000..505bbfe --- /dev/null +++ b/lib/Models/SendWhatsappMessageRequest.php @@ -0,0 +1,355 @@ + + */ +class SendWhatsappMessageRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'sendWhatsappMessage_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'templateId' => 'int', + 'senderNumber' => 'string', + 'contactNumbers' => 'string[]', + 'text' => 'string', + 'params' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'templateId' => null, + 'senderNumber' => 'mobile', + 'contactNumbers' => 'mobile', + 'text' => null, + 'params' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'templateId' => false, + 'senderNumber' => false, + 'contactNumbers' => false, + 'text' => false, + 'params' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'templateId' => 'templateId', + 'senderNumber' => 'senderNumber', + 'contactNumbers' => 'contactNumbers', + 'text' => 'text', + 'params' => 'params' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'templateId' => 'setTemplateId', + 'senderNumber' => 'setSenderNumber', + 'contactNumbers' => 'setContactNumbers', + 'text' => 'setText', + 'params' => 'setParams' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'templateId' => 'getTemplateId', + 'senderNumber' => 'getSenderNumber', + 'contactNumbers' => 'getContactNumbers', + 'text' => 'getText', + 'params' => 'getParams' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('templateId', $data ?? [], null); + $this->setIfExists('senderNumber', $data ?? [], null); + $this->setIfExists('contactNumbers', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('params', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['templateId'] === null) { + $invalidProperties[] = "'templateId' can't be null"; + } + if ($this->container['senderNumber'] === null) { + $invalidProperties[] = "'senderNumber' can't be null"; + } + if ($this->container['contactNumbers'] === null) { + $invalidProperties[] = "'contactNumbers' can't be null"; + } + if ($this->container['text'] === null) { + $invalidProperties[] = "'text' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets templateId + * + * @return int + */ + public function getTemplateId(): int + { + return $this->container['templateId']; + } + + /** + * Sets templateId + * + * @param int $templateId ID of the template to send + * + * @return $this + */ + public function setTemplateId(int $templateId): static + { + if (is_null($templateId)) { + throw new InvalidArgumentException('non-nullable templateId cannot be null'); + } + $this->container['templateId'] = $templateId; + + return $this; + } + + /** + * Gets senderNumber + * + * @return string + */ + public function getSenderNumber(): string + { + return $this->container['senderNumber']; + } + + /** + * Sets senderNumber + * + * @param string $senderNumber WhatsApp Number with country code. Example, 85264318721 + * + * @return $this + */ + public function setSenderNumber(string $senderNumber): static + { + if (is_null($senderNumber)) { + throw new InvalidArgumentException('non-nullable senderNumber cannot be null'); + } + $this->container['senderNumber'] = $senderNumber; + + return $this; + } + + /** + * Gets contactNumbers + * + * @return string[] + */ + public function getContactNumbers(): array + { + return $this->container['contactNumbers']; + } + + /** + * Sets contactNumbers + * + * @param string[] $contactNumbers List of phone numbers of the contacts + * + * @return $this + */ + public function setContactNumbers(array $contactNumbers): static + { + if (is_null($contactNumbers)) { + throw new InvalidArgumentException('non-nullable contactNumbers cannot be null'); + } + $this->container['contactNumbers'] = $contactNumbers; + + return $this; + } + + /** + * Gets text + * + * @return string + */ + public function getText(): string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string $text Text to be sent as message body (will be overridden if templateId is passed in the same request) + * + * @return $this + */ + public function setText(string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets params + * + * @return object|null + */ + public function getParams(): ?object + { + return $this->container['params']; + } + + /** + * Sets params + * + * @param object|null $params Pass the set of attributes to customize the template. For example, {\"FNAME\":\"Joe\", \"LNAME\":\"Doe\"}. + * + * @return $this + */ + public function setParams(?object $params): static + { + if (is_null($params)) { + throw new InvalidArgumentException('non-nullable params cannot be null'); + } + $this->container['params'] = $params; + + return $this; + } +} + + diff --git a/lib/Models/SendWhatsappMessageTemplate.php b/lib/Models/SendWhatsappMessageTemplate.php new file mode 100644 index 0000000..308f2a6 --- /dev/null +++ b/lib/Models/SendWhatsappMessageTemplate.php @@ -0,0 +1,318 @@ + + */ +class SendWhatsappMessageTemplate extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'sendWhatsappMessageTemplate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'templateId' => 'int', + 'senderNumber' => 'string', + 'contactNumbers' => 'string[]', + 'params' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'templateId' => null, + 'senderNumber' => 'mobile', + 'contactNumbers' => 'mobile', + 'params' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'templateId' => false, + 'senderNumber' => false, + 'contactNumbers' => false, + 'params' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'templateId' => 'templateId', + 'senderNumber' => 'senderNumber', + 'contactNumbers' => 'contactNumbers', + 'params' => 'params' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'templateId' => 'setTemplateId', + 'senderNumber' => 'setSenderNumber', + 'contactNumbers' => 'setContactNumbers', + 'params' => 'setParams' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'templateId' => 'getTemplateId', + 'senderNumber' => 'getSenderNumber', + 'contactNumbers' => 'getContactNumbers', + 'params' => 'getParams' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('templateId', $data ?? [], null); + $this->setIfExists('senderNumber', $data ?? [], null); + $this->setIfExists('contactNumbers', $data ?? [], null); + $this->setIfExists('params', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['templateId'] === null) { + $invalidProperties[] = "'templateId' can't be null"; + } + if ($this->container['senderNumber'] === null) { + $invalidProperties[] = "'senderNumber' can't be null"; + } + if ($this->container['contactNumbers'] === null) { + $invalidProperties[] = "'contactNumbers' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets templateId + * + * @return int + */ + public function getTemplateId(): int + { + return $this->container['templateId']; + } + + /** + * Sets templateId + * + * @param int $templateId ID of the template to send + * + * @return $this + */ + public function setTemplateId(int $templateId): static + { + if (is_null($templateId)) { + throw new InvalidArgumentException('non-nullable templateId cannot be null'); + } + $this->container['templateId'] = $templateId; + + return $this; + } + + /** + * Gets senderNumber + * + * @return string + */ + public function getSenderNumber(): string + { + return $this->container['senderNumber']; + } + + /** + * Sets senderNumber + * + * @param string $senderNumber WhatsApp Number with country code. Example, 85264318721 + * + * @return $this + */ + public function setSenderNumber(string $senderNumber): static + { + if (is_null($senderNumber)) { + throw new InvalidArgumentException('non-nullable senderNumber cannot be null'); + } + $this->container['senderNumber'] = $senderNumber; + + return $this; + } + + /** + * Gets contactNumbers + * + * @return string[] + */ + public function getContactNumbers(): array + { + return $this->container['contactNumbers']; + } + + /** + * Sets contactNumbers + * + * @param string[] $contactNumbers List of phone numbers of the contacts + * + * @return $this + */ + public function setContactNumbers(array $contactNumbers): static + { + if (is_null($contactNumbers)) { + throw new InvalidArgumentException('non-nullable contactNumbers cannot be null'); + } + $this->container['contactNumbers'] = $contactNumbers; + + return $this; + } + + /** + * Gets params + * + * @return object|null + */ + public function getParams(): ?object + { + return $this->container['params']; + } + + /** + * Sets params + * + * @param object|null $params Pass the set of attributes to customize the template. For example, {\"FNAME\":\"Joe\", \"LNAME\":\"Doe\"}. + * + * @return $this + */ + public function setParams(?object $params): static + { + if (is_null($params)) { + throw new InvalidArgumentException('non-nullable params cannot be null'); + } + $this->container['params'] = $params; + + return $this; + } +} + + diff --git a/lib/Models/SendWhatsappMessageText.php b/lib/Models/SendWhatsappMessageText.php new file mode 100644 index 0000000..50c5f42 --- /dev/null +++ b/lib/Models/SendWhatsappMessageText.php @@ -0,0 +1,284 @@ + + */ +class SendWhatsappMessageText extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'sendWhatsappMessageText'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'senderNumber' => 'string', + 'text' => 'string', + 'contactNumbers' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'senderNumber' => 'mobile', + 'text' => null, + 'contactNumbers' => 'mobile' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'senderNumber' => false, + 'text' => false, + 'contactNumbers' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'senderNumber' => 'senderNumber', + 'text' => 'text', + 'contactNumbers' => 'contactNumbers' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'senderNumber' => 'setSenderNumber', + 'text' => 'setText', + 'contactNumbers' => 'setContactNumbers' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'senderNumber' => 'getSenderNumber', + 'text' => 'getText', + 'contactNumbers' => 'getContactNumbers' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('senderNumber', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('contactNumbers', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['senderNumber'] === null) { + $invalidProperties[] = "'senderNumber' can't be null"; + } + if ($this->container['text'] === null) { + $invalidProperties[] = "'text' can't be null"; + } + if ($this->container['contactNumbers'] === null) { + $invalidProperties[] = "'contactNumbers' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets senderNumber + * + * @return string + */ + public function getSenderNumber(): string + { + return $this->container['senderNumber']; + } + + /** + * Sets senderNumber + * + * @param string $senderNumber WhatsApp Number with country code. Example, 85264318721 + * + * @return $this + */ + public function setSenderNumber(string $senderNumber): static + { + if (is_null($senderNumber)) { + throw new InvalidArgumentException('non-nullable senderNumber cannot be null'); + } + $this->container['senderNumber'] = $senderNumber; + + return $this; + } + + /** + * Gets text + * + * @return string + */ + public function getText(): string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string $text Text to be sent as message body (will be overridden if templateId is passed in the same request) + * + * @return $this + */ + public function setText(string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets contactNumbers + * + * @return string[] + */ + public function getContactNumbers(): array + { + return $this->container['contactNumbers']; + } + + /** + * Sets contactNumbers + * + * @param string[] $contactNumbers List of phone numbers of the contacts + * + * @return $this + */ + public function setContactNumbers(array $contactNumbers): static + { + if (is_null($contactNumbers)) { + throw new InvalidArgumentException('non-nullable contactNumbers cannot be null'); + } + $this->container['contactNumbers'] = $contactNumbers; + + return $this; + } +} + + diff --git a/lib/Models/SsoTokenRequest.php b/lib/Models/SsoTokenRequest.php deleted file mode 100644 index 183df46..0000000 --- a/lib/Models/SsoTokenRequest.php +++ /dev/null @@ -1,442 +0,0 @@ - 'int', - 'email' => 'string', - 'target' => 'string', - 'url' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => 'int64', - 'email' => null, - 'target' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'email' => 'email', - 'target' => 'target', - 'url' => 'url' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'email' => 'setEmail', - 'target' => 'setTarget', - 'url' => 'setUrl' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'email' => 'getEmail', - 'target' => 'getTarget', - '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; - } - - const TARGET_AUTOMATION = 'automation'; - const TARGET_EMAIL_CAMPAIGN = 'email_campaign'; - const TARGET_CONTACTS = 'contacts'; - const TARGET_LANDING_PAGES = 'landing_pages'; - const TARGET_EMAIL_TRANSACTIONAL = 'email_transactional'; - const TARGET_SENDERS = 'senders'; - const TARGET_SMS_CAMPAIGN = 'sms_campaign'; - const TARGET_SMS_TRANSACTIONAL = 'sms_transactional'; - - - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getTargetAllowableValues() - { - return [ - self::TARGET_AUTOMATION, - self::TARGET_EMAIL_CAMPAIGN, - self::TARGET_CONTACTS, - self::TARGET_LANDING_PAGES, - self::TARGET_EMAIL_TRANSACTIONAL, - self::TARGET_SENDERS, - self::TARGET_SMS_CAMPAIGN, - self::TARGET_SMS_TRANSACTIONAL, - ]; - } - - - /** - * 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['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['target'] = isset($data['target']) ? $data['target'] : null; - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } - $allowedValues = $this->getTargetAllowableValues(); - if (!is_null($this->container['target']) && !in_array($this->container['target'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value for 'target', must be one of '%s'", - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return int - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param int $id Id of the sub-account organization - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets email - * - * @return string - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string $email User email of sub-account organization - * - * @return $this - */ - public function setEmail($email) - { - $this->container['email'] = $email; - - return $this; - } - - /** - * Gets target - * - * @return string - */ - public function getTarget() - { - return $this->container['target']; - } - - /** - * Sets target - * - * @param string $target Set target after login success * automation - Redirect to Automation after login * email_campaign - Redirect to Email Campaign after login * contacts - Redirect to Contacts after login * landing_pages - Redirect to Landing Pages after login * email_transactional - Redirect to Email Transactional after login * senders - Redirect to Contacts after login * sms_campaign - Redirect to Sms Campaign after login * sms_transactional - Redirect to Sms Transactional after login - * - * @return $this - */ - public function setTarget($target) - { - $allowedValues = $this->getTargetAllowableValues(); - if (!is_null($target) && !in_array($target, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'target', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['target'] = $target; - - return $this; - } - - /** - * Gets url - * - * @return string - */ - public function getUrl() - { - return $this->container['url']; - } - - /** - * Sets url - * - * @param string $url Set the full target URL after login success. The user will land directly on this target URL after login - * - * @return $this - */ - public function setUrl($url) - { - $this->container['url'] = $url; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/SubAccountAppsToggleRequest.php b/lib/Models/SubAccountAppsToggleRequest.php index f255c00..81858a0 100644 --- a/lib/Models/SubAccountAppsToggleRequest.php +++ b/lib/Models/SubAccountAppsToggleRequest.php @@ -2,62 +2,64 @@ /** * SubAccountAppsToggleRequest * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SubAccountAppsToggleRequest Class Doc Comment * - * @category Class * @description List of enable/disable applications on the sub-account * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SubAccountAppsToggleRequest implements ModelInterface, ArrayAccess +class SubAccountAppsToggleRequest extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'subAccountAppsToggleRequest'; + protected static string $openAPIModelName = 'subAccountAppsToggleRequest'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'inbox' => 'bool', 'whatsapp' => 'bool', 'automation' => 'bool', @@ -76,9 +78,9 @@ class SubAccountAppsToggleRequest implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'inbox' => null, 'whatsapp' => null, 'automation' => null, @@ -95,32 +97,40 @@ class SubAccountAppsToggleRequest implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'inbox' => false, + 'whatsapp' => false, + 'automation' => false, + 'emailCampaigns' => false, + 'smsCampaigns' => false, + 'landingPages' => false, + 'transactionalEmails' => false, + 'transactionalSms' => false, + 'facebookAds' => false, + 'webPush' => false, + 'meetings' => false, + 'conversations' => false, + 'crm' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'inbox' => 'inbox', 'whatsapp' => 'whatsapp', 'automation' => 'automation', @@ -139,9 +149,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'inbox' => 'setInbox', 'whatsapp' => 'setWhatsapp', 'automation' => 'setAutomation', @@ -160,9 +170,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'inbox' => 'getInbox', 'whatsapp' => 'getWhatsapp', 'automation' => 'getAutomation', @@ -182,9 +192,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -192,9 +202,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -202,87 +212,61 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['inbox'] = isset($data['inbox']) ? $data['inbox'] : null; - $this->container['whatsapp'] = isset($data['whatsapp']) ? $data['whatsapp'] : null; - $this->container['automation'] = isset($data['automation']) ? $data['automation'] : null; - $this->container['emailCampaigns'] = isset($data['emailCampaigns']) ? $data['emailCampaigns'] : null; - $this->container['smsCampaigns'] = isset($data['smsCampaigns']) ? $data['smsCampaigns'] : null; - $this->container['landingPages'] = isset($data['landingPages']) ? $data['landingPages'] : null; - $this->container['transactionalEmails'] = isset($data['transactionalEmails']) ? $data['transactionalEmails'] : null; - $this->container['transactionalSms'] = isset($data['transactionalSms']) ? $data['transactionalSms'] : null; - $this->container['facebookAds'] = isset($data['facebookAds']) ? $data['facebookAds'] : null; - $this->container['webPush'] = isset($data['webPush']) ? $data['webPush'] : null; - $this->container['meetings'] = isset($data['meetings']) ? $data['meetings'] : null; - $this->container['conversations'] = isset($data['conversations']) ? $data['conversations'] : null; - $this->container['crm'] = isset($data['crm']) ? $data['crm'] : null; + $this->setIfExists('inbox', $data ?? [], null); + $this->setIfExists('whatsapp', $data ?? [], null); + $this->setIfExists('automation', $data ?? [], null); + $this->setIfExists('emailCampaigns', $data ?? [], null); + $this->setIfExists('smsCampaigns', $data ?? [], null); + $this->setIfExists('landingPages', $data ?? [], null); + $this->setIfExists('transactionalEmails', $data ?? [], null); + $this->setIfExists('transactionalSms', $data ?? [], null); + $this->setIfExists('facebookAds', $data ?? [], null); + $this->setIfExists('webPush', $data ?? [], null); + $this->setIfExists('meetings', $data ?? [], null); + $this->setIfExists('conversations', $data ?? [], null); + $this->setIfExists('crm', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets inbox * - * @return bool + * @return bool|null */ - public function getInbox() + public function getInbox(): ?bool { return $this->container['inbox']; } @@ -290,12 +274,15 @@ public function getInbox() /** * Sets inbox * - * @param bool $inbox Set this field to enable or disable Inbox on the sub-account / Not applicable on ENTv2 + * @param bool|null $inbox Set this field to enable or disable Inbox on the sub-account / Not applicable on ENTv2 * * @return $this */ - public function setInbox($inbox) + public function setInbox(?bool $inbox): static { + if (is_null($inbox)) { + throw new InvalidArgumentException('non-nullable inbox cannot be null'); + } $this->container['inbox'] = $inbox; return $this; @@ -304,9 +291,9 @@ public function setInbox($inbox) /** * Gets whatsapp * - * @return bool + * @return bool|null */ - public function getWhatsapp() + public function getWhatsapp(): ?bool { return $this->container['whatsapp']; } @@ -314,12 +301,15 @@ public function getWhatsapp() /** * Sets whatsapp * - * @param bool $whatsapp Set this field to enable or disable Whatsapp campaigns on the sub-account + * @param bool|null $whatsapp Set this field to enable or disable Whatsapp campaigns on the sub-account * * @return $this */ - public function setWhatsapp($whatsapp) + public function setWhatsapp(?bool $whatsapp): static { + if (is_null($whatsapp)) { + throw new InvalidArgumentException('non-nullable whatsapp cannot be null'); + } $this->container['whatsapp'] = $whatsapp; return $this; @@ -328,9 +318,9 @@ public function setWhatsapp($whatsapp) /** * Gets automation * - * @return bool + * @return bool|null */ - public function getAutomation() + public function getAutomation(): ?bool { return $this->container['automation']; } @@ -338,12 +328,15 @@ public function getAutomation() /** * Sets automation * - * @param bool $automation Set this field to enable or disable Automation on the sub-account + * @param bool|null $automation Set this field to enable or disable Automation on the sub-account * * @return $this */ - public function setAutomation($automation) + public function setAutomation(?bool $automation): static { + if (is_null($automation)) { + throw new InvalidArgumentException('non-nullable automation cannot be null'); + } $this->container['automation'] = $automation; return $this; @@ -352,9 +345,9 @@ public function setAutomation($automation) /** * Gets emailCampaigns * - * @return bool + * @return bool|null */ - public function getEmailCampaigns() + public function getEmailCampaigns(): ?bool { return $this->container['emailCampaigns']; } @@ -362,12 +355,15 @@ public function getEmailCampaigns() /** * Sets emailCampaigns * - * @param bool $emailCampaigns Set this field to enable or disable Email Campaigns on the sub-account + * @param bool|null $emailCampaigns Set this field to enable or disable Email Campaigns on the sub-account * * @return $this */ - public function setEmailCampaigns($emailCampaigns) + public function setEmailCampaigns(?bool $emailCampaigns): static { + if (is_null($emailCampaigns)) { + throw new InvalidArgumentException('non-nullable emailCampaigns cannot be null'); + } $this->container['emailCampaigns'] = $emailCampaigns; return $this; @@ -376,9 +372,9 @@ public function setEmailCampaigns($emailCampaigns) /** * Gets smsCampaigns * - * @return bool + * @return bool|null */ - public function getSmsCampaigns() + public function getSmsCampaigns(): ?bool { return $this->container['smsCampaigns']; } @@ -386,12 +382,15 @@ public function getSmsCampaigns() /** * Sets smsCampaigns * - * @param bool $smsCampaigns Set this field to enable or disable SMS Marketing on the sub-account + * @param bool|null $smsCampaigns Set this field to enable or disable SMS Marketing on the sub-account * * @return $this */ - public function setSmsCampaigns($smsCampaigns) + public function setSmsCampaigns(?bool $smsCampaigns): static { + if (is_null($smsCampaigns)) { + throw new InvalidArgumentException('non-nullable smsCampaigns cannot be null'); + } $this->container['smsCampaigns'] = $smsCampaigns; return $this; @@ -400,9 +399,9 @@ public function setSmsCampaigns($smsCampaigns) /** * Gets landingPages * - * @return bool + * @return bool|null */ - public function getLandingPages() + public function getLandingPages(): ?bool { return $this->container['landingPages']; } @@ -410,12 +409,15 @@ public function getLandingPages() /** * Sets landingPages * - * @param bool $landingPages Set this field to enable or disable Landing pages on the sub-account + * @param bool|null $landingPages Set this field to enable or disable Landing pages on the sub-account * * @return $this */ - public function setLandingPages($landingPages) + public function setLandingPages(?bool $landingPages): static { + if (is_null($landingPages)) { + throw new InvalidArgumentException('non-nullable landingPages cannot be null'); + } $this->container['landingPages'] = $landingPages; return $this; @@ -424,9 +426,9 @@ public function setLandingPages($landingPages) /** * Gets transactionalEmails * - * @return bool + * @return bool|null */ - public function getTransactionalEmails() + public function getTransactionalEmails(): ?bool { return $this->container['transactionalEmails']; } @@ -434,12 +436,15 @@ public function getTransactionalEmails() /** * Sets transactionalEmails * - * @param bool $transactionalEmails Set this field to enable or disable Transactional Email on the sub-account + * @param bool|null $transactionalEmails Set this field to enable or disable Transactional Email on the sub-account * * @return $this */ - public function setTransactionalEmails($transactionalEmails) + public function setTransactionalEmails(?bool $transactionalEmails): static { + if (is_null($transactionalEmails)) { + throw new InvalidArgumentException('non-nullable transactionalEmails cannot be null'); + } $this->container['transactionalEmails'] = $transactionalEmails; return $this; @@ -448,9 +453,9 @@ public function setTransactionalEmails($transactionalEmails) /** * Gets transactionalSms * - * @return bool + * @return bool|null */ - public function getTransactionalSms() + public function getTransactionalSms(): ?bool { return $this->container['transactionalSms']; } @@ -458,12 +463,15 @@ public function getTransactionalSms() /** * Sets transactionalSms * - * @param bool $transactionalSms Set this field to enable or disable Transactional SMS on the sub-account + * @param bool|null $transactionalSms Set this field to enable or disable Transactional SMS on the sub-account * * @return $this */ - public function setTransactionalSms($transactionalSms) + public function setTransactionalSms(?bool $transactionalSms): static { + if (is_null($transactionalSms)) { + throw new InvalidArgumentException('non-nullable transactionalSms cannot be null'); + } $this->container['transactionalSms'] = $transactionalSms; return $this; @@ -472,9 +480,9 @@ public function setTransactionalSms($transactionalSms) /** * Gets facebookAds * - * @return bool + * @return bool|null */ - public function getFacebookAds() + public function getFacebookAds(): ?bool { return $this->container['facebookAds']; } @@ -482,12 +490,15 @@ public function getFacebookAds() /** * Sets facebookAds * - * @param bool $facebookAds Set this field to enable or disable Facebook ads on the sub-account + * @param bool|null $facebookAds Set this field to enable or disable Facebook ads on the sub-account * * @return $this */ - public function setFacebookAds($facebookAds) + public function setFacebookAds(?bool $facebookAds): static { + if (is_null($facebookAds)) { + throw new InvalidArgumentException('non-nullable facebookAds cannot be null'); + } $this->container['facebookAds'] = $facebookAds; return $this; @@ -496,9 +507,9 @@ public function setFacebookAds($facebookAds) /** * Gets webPush * - * @return bool + * @return bool|null */ - public function getWebPush() + public function getWebPush(): ?bool { return $this->container['webPush']; } @@ -506,12 +517,15 @@ public function getWebPush() /** * Sets webPush * - * @param bool $webPush Set this field to enable or disable Web Push on the sub-account + * @param bool|null $webPush Set this field to enable or disable Web Push on the sub-account * * @return $this */ - public function setWebPush($webPush) + public function setWebPush(?bool $webPush): static { + if (is_null($webPush)) { + throw new InvalidArgumentException('non-nullable webPush cannot be null'); + } $this->container['webPush'] = $webPush; return $this; @@ -520,9 +534,9 @@ public function setWebPush($webPush) /** * Gets meetings * - * @return bool + * @return bool|null */ - public function getMeetings() + public function getMeetings(): ?bool { return $this->container['meetings']; } @@ -530,12 +544,15 @@ public function getMeetings() /** * Sets meetings * - * @param bool $meetings Set this field to enable or disable Meetings on the sub-account + * @param bool|null $meetings Set this field to enable or disable Meetings on the sub-account * * @return $this */ - public function setMeetings($meetings) + public function setMeetings(?bool $meetings): static { + if (is_null($meetings)) { + throw new InvalidArgumentException('non-nullable meetings cannot be null'); + } $this->container['meetings'] = $meetings; return $this; @@ -544,9 +561,9 @@ public function setMeetings($meetings) /** * Gets conversations * - * @return bool + * @return bool|null */ - public function getConversations() + public function getConversations(): ?bool { return $this->container['conversations']; } @@ -554,12 +571,15 @@ public function getConversations() /** * Sets conversations * - * @param bool $conversations Set this field to enable or disable Conversations on the sub-account + * @param bool|null $conversations Set this field to enable or disable Conversations on the sub-account * * @return $this */ - public function setConversations($conversations) + public function setConversations(?bool $conversations): static { + if (is_null($conversations)) { + throw new InvalidArgumentException('non-nullable conversations cannot be null'); + } $this->container['conversations'] = $conversations; return $this; @@ -568,9 +588,9 @@ public function setConversations($conversations) /** * Gets crm * - * @return bool + * @return bool|null */ - public function getCrm() + public function getCrm(): ?bool { return $this->container['crm']; } @@ -578,89 +598,19 @@ public function getCrm() /** * Sets crm * - * @param bool $crm Set this field to enable or disable Sales CRM on the sub-account + * @param bool|null $crm Set this field to enable or disable Sales CRM on the sub-account * * @return $this */ - public function setCrm($crm) + public function setCrm(?bool $crm): static { + if (is_null($crm)) { + throw new InvalidArgumentException('non-nullable crm cannot be null'); + } $this->container['crm'] = $crm; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/SubAccountDetailsResponse.php b/lib/Models/SubAccountDetailsResponse.php index 55a7fd4..94f8b1c 100644 --- a/lib/Models/SubAccountDetailsResponse.php +++ b/lib/Models/SubAccountDetailsResponse.php @@ -2,133 +2,140 @@ /** * SubAccountDetailsResponse * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SubAccountDetailsResponse Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SubAccountDetailsResponse implements ModelInterface, ArrayAccess +class SubAccountDetailsResponse extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'subAccountDetailsResponse'; + protected static string $openAPIModelName = 'subAccountDetailsResponse'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string', 'email' => 'string', 'companyName' => 'string', + 'groups' => '\Brevo\Client\Models\SubAccountDetailsResponseGroupsInner[]', 'planInfo' => '\Brevo\Client\Models\SubAccountDetailsResponsePlanInfo' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null, 'email' => null, 'companyName' => null, + 'groups' => null, 'planInfo' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'email' => false, + 'companyName' => false, + 'groups' => false, + 'planInfo' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name', 'email' => 'email', 'companyName' => 'companyName', + 'groups' => 'groups', 'planInfo' => 'planInfo' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName', 'email' => 'setEmail', 'companyName' => 'setCompanyName', + 'groups' => 'setGroups', 'planInfo' => 'setPlanInfo' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName', 'email' => 'getEmail', 'companyName' => 'getCompanyName', + 'groups' => 'getGroups', 'planInfo' => 'getPlanInfo' ]; @@ -136,9 +143,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +153,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,78 +163,53 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['companyName'] = isset($data['companyName']) ? $data['companyName'] : null; - $this->container['planInfo'] = isset($data['planInfo']) ? $data['planInfo'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('companyName', $data ?? [], null); + $this->setIfExists('groups', $data ?? [], null); + $this->setIfExists('planInfo', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * - * @return string + * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -235,12 +217,15 @@ public function getName() /** * Sets name * - * @param string $name Name of the sub-account user + * @param string|null $name Name of the sub-account user * * @return $this */ - public function setName($name) + public function setName(?string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -249,9 +234,9 @@ public function setName($name) /** * Gets email * - * @return string + * @return string|null */ - public function getEmail() + public function getEmail(): ?string { return $this->container['email']; } @@ -259,12 +244,15 @@ public function getEmail() /** * Sets email * - * @param string $email Email id of the sub-account organization + * @param string|null $email Email id of the sub-account organization * * @return $this */ - public function setEmail($email) + public function setEmail(?string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -273,9 +261,9 @@ public function setEmail($email) /** * Gets companyName * - * @return string + * @return string|null */ - public function getCompanyName() + public function getCompanyName(): ?string { return $this->container['companyName']; } @@ -283,112 +271,72 @@ public function getCompanyName() /** * Sets companyName * - * @param string $companyName Sub-account company name + * @param string|null $companyName Sub-account company name * * @return $this */ - public function setCompanyName($companyName) + public function setCompanyName(?string $companyName): static { + if (is_null($companyName)) { + throw new InvalidArgumentException('non-nullable companyName cannot be null'); + } $this->container['companyName'] = $companyName; return $this; } /** - * Gets planInfo + * Gets groups * - * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfo + * @return \Brevo\Client\Models\SubAccountDetailsResponseGroupsInner[]|null */ - public function getPlanInfo() + public function getGroups(): ?array { - return $this->container['planInfo']; + return $this->container['groups']; } /** - * Sets planInfo + * Sets groups * - * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfo $planInfo planInfo + * @param \Brevo\Client\Models\SubAccountDetailsResponseGroupsInner[]|null $groups groups * * @return $this */ - public function setPlanInfo($planInfo) + public function setGroups(?array $groups): static { - $this->container['planInfo'] = $planInfo; + if (is_null($groups)) { + throw new InvalidArgumentException('non-nullable groups cannot be null'); + } + $this->container['groups'] = $groups; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 + * Gets planInfo * - * @return void + * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfo|null */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function getPlanInfo(): ?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfo { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } + return $this->container['planInfo']; } /** - * Unsets offset. - * - * @param integer $offset Offset + * Sets planInfo * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object + * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfo|null $planInfo planInfo * - * @return string + * @return $this */ - public function __toString() + public function setPlanInfo(?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfo $planInfo): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($planInfo)) { + throw new InvalidArgumentException('non-nullable planInfo cannot be null'); } + $this->container['planInfo'] = $planInfo; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/SubAccountDetailsResponseGroupsInner.php b/lib/Models/SubAccountDetailsResponseGroupsInner.php new file mode 100644 index 0000000..0bde7b6 --- /dev/null +++ b/lib/Models/SubAccountDetailsResponseGroupsInner.php @@ -0,0 +1,241 @@ + + */ +class SubAccountDetailsResponseGroupsInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'subAccountDetailsResponse_groups_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Group id + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the group + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } +} + + diff --git a/lib/Models/SubAccountDetailsResponsePlanInfo.php b/lib/Models/SubAccountDetailsResponsePlanInfo.php index 5926a80..1eed788 100644 --- a/lib/Models/SubAccountDetailsResponsePlanInfo.php +++ b/lib/Models/SubAccountDetailsResponsePlanInfo.php @@ -2,62 +2,64 @@ /** * SubAccountDetailsResponsePlanInfo * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SubAccountDetailsResponsePlanInfo Class Doc Comment * - * @category Class * @description Sub-account plan details * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SubAccountDetailsResponsePlanInfo implements ModelInterface, ArrayAccess +class SubAccountDetailsResponsePlanInfo extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'subAccountDetailsResponse_planInfo'; + protected static string $openAPIModelName = 'subAccountDetailsResponse_planInfo'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'credits' => '\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCredits', 'features' => '\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeatures', 'planType' => 'string' @@ -66,41 +68,39 @@ class SubAccountDetailsResponsePlanInfo implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'credits' => null, 'features' => null, 'planType' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'credits' => false, + 'features' => false, + 'planType' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'credits' => 'credits', 'features' => 'features', 'planType' => 'planType' @@ -109,9 +109,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'credits' => 'setCredits', 'features' => 'setFeatures', 'planType' => 'setPlanType' @@ -120,9 +120,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'credits' => 'getCredits', 'features' => 'getFeatures', 'planType' => 'getPlanType' @@ -132,9 +132,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -142,9 +142,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -152,77 +152,51 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['credits'] = isset($data['credits']) ? $data['credits'] : null; - $this->container['features'] = isset($data['features']) ? $data['features'] : null; - $this->container['planType'] = isset($data['planType']) ? $data['planType'] : null; + $this->setIfExists('credits', $data ?? [], null); + $this->setIfExists('features', $data ?? [], null); + $this->setIfExists('planType', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets credits * - * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCredits + * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCredits|null */ - public function getCredits() + public function getCredits(): ?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCredits { return $this->container['credits']; } @@ -230,12 +204,15 @@ public function getCredits() /** * Sets credits * - * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCredits $credits credits + * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCredits|null $credits credits * * @return $this */ - public function setCredits($credits) + public function setCredits(?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCredits $credits): static { + if (is_null($credits)) { + throw new InvalidArgumentException('non-nullable credits cannot be null'); + } $this->container['credits'] = $credits; return $this; @@ -244,9 +221,9 @@ public function setCredits($credits) /** * Gets features * - * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeatures + * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeatures|null */ - public function getFeatures() + public function getFeatures(): ?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeatures { return $this->container['features']; } @@ -254,12 +231,15 @@ public function getFeatures() /** * Sets features * - * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeatures $features features + * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeatures|null $features features * * @return $this */ - public function setFeatures($features) + public function setFeatures(?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeatures $features): static { + if (is_null($features)) { + throw new InvalidArgumentException('non-nullable features cannot be null'); + } $this->container['features'] = $features; return $this; @@ -268,9 +248,9 @@ public function setFeatures($features) /** * Gets planType * - * @return string + * @return string|null */ - public function getPlanType() + public function getPlanType(): ?string { return $this->container['planType']; } @@ -278,89 +258,19 @@ public function getPlanType() /** * Sets planType * - * @param string $planType type of the plan + * @param string|null $planType type of the plan * * @return $this */ - public function setPlanType($planType) + public function setPlanType(?string $planType): static { + if (is_null($planType)) { + throw new InvalidArgumentException('non-nullable planType cannot be null'); + } $this->container['planType'] = $planType; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/SubAccountDetailsResponsePlanInfoCredits.php b/lib/Models/SubAccountDetailsResponsePlanInfoCredits.php index b336841..069f082 100644 --- a/lib/Models/SubAccountDetailsResponsePlanInfoCredits.php +++ b/lib/Models/SubAccountDetailsResponsePlanInfoCredits.php @@ -2,134 +2,151 @@ /** * SubAccountDetailsResponsePlanInfoCredits * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SubAccountDetailsResponsePlanInfoCredits Class Doc Comment * - * @category Class * @description Credits quota and remaining credits on the sub-account * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SubAccountDetailsResponsePlanInfoCredits implements ModelInterface, ArrayAccess +class SubAccountDetailsResponsePlanInfoCredits extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'subAccountDetailsResponse_planInfo_credits'; + protected static string $openAPIModelName = 'subAccountDetailsResponse_planInfo_credits'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'sms' => 'int', - 'emails' => '\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsEmails' + protected static array $openAPITypes = [ + 'emails' => '\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsEmails', + 'sms' => '\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsSms', + 'wpSubscribers' => '\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsWpSubscribers', + 'whatsapp' => '\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsWhatsapp', + 'externalFeeds' => '\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsExternalFeeds' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'sms' => 'int64', - 'emails' => null + protected static array $openAPIFormats = [ + 'emails' => null, + 'sms' => null, + 'wpSubscribers' => null, + 'whatsapp' => null, + 'externalFeeds' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'emails' => false, + 'sms' => false, + 'wpSubscribers' => false, + 'whatsapp' => false, + 'externalFeeds' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ + 'emails' => 'emails', 'sms' => 'sms', - 'emails' => 'emails' + 'wpSubscribers' => 'wpSubscribers', + 'whatsapp' => 'whatsapp', + 'externalFeeds' => 'externalFeeds' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ + 'emails' => 'setEmails', 'sms' => 'setSms', - 'emails' => 'setEmails' + 'wpSubscribers' => 'setWpSubscribers', + 'whatsapp' => 'setWhatsapp', + 'externalFeeds' => 'setExternalFeeds' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ + 'emails' => 'getEmails', 'sms' => 'getSms', - 'emails' => 'getEmails' + 'wpSubscribers' => 'getWpSubscribers', + 'whatsapp' => 'getWhatsapp', + 'externalFeeds' => 'getExternalFeeds' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -137,9 +154,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -147,52 +164,41 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['sms'] = isset($data['sms']) ? $data['sms'] : null; - $this->container['emails'] = isset($data['emails']) ? $data['emails'] : null; + $this->setIfExists('emails', $data ?? [], null); + $this->setIfExists('sms', $data ?? [], null); + $this->setIfExists('wpSubscribers', $data ?? [], null); + $this->setIfExists('whatsapp', $data ?? [], null); + $this->setIfExists('externalFeeds', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -200,23 +206,38 @@ public function listInvalidProperties() } /** - * Validate all the properties in the model - * return true if all passed + * Gets emails * - * @return bool True if all properties are valid + * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsEmails|null */ - public function valid() + public function getEmails(): ?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsEmails { - return count($this->listInvalidProperties()) === 0; + return $this->container['emails']; } + /** + * Sets emails + * + * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsEmails|null $emails emails + * + * @return $this + */ + public function setEmails(?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsEmails $emails): static + { + if (is_null($emails)) { + throw new InvalidArgumentException('non-nullable emails cannot be null'); + } + $this->container['emails'] = $emails; + + return $this; + } /** * Gets sms * - * @return int + * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsSms|null */ - public function getSms() + public function getSms(): ?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsSms { return $this->container['sms']; } @@ -224,112 +245,99 @@ public function getSms() /** * Sets sms * - * @param int $sms SMS credits remaining on the sub-account + * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsSms|null $sms sms * * @return $this */ - public function setSms($sms) + public function setSms(?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsSms $sms): static { + if (is_null($sms)) { + throw new InvalidArgumentException('non-nullable sms cannot be null'); + } $this->container['sms'] = $sms; return $this; } /** - * Gets emails + * Gets wpSubscribers * - * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsEmails + * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsWpSubscribers|null */ - public function getEmails() + public function getWpSubscribers(): ?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsWpSubscribers { - return $this->container['emails']; + return $this->container['wpSubscribers']; } /** - * Sets emails + * Sets wpSubscribers * - * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsEmails $emails emails + * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsWpSubscribers|null $wpSubscribers wpSubscribers * * @return $this */ - public function setEmails($emails) + public function setWpSubscribers(?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsWpSubscribers $wpSubscribers): static { - $this->container['emails'] = $emails; + if (is_null($wpSubscribers)) { + throw new InvalidArgumentException('non-nullable wpSubscribers cannot be null'); + } + $this->container['wpSubscribers'] = $wpSubscribers; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } /** - * Gets offset. - * - * @param integer $offset Offset + * Gets whatsapp * - * @return mixed + * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsWhatsapp|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function getWhatsapp(): ?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsWhatsapp { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container['whatsapp']; } /** - * Sets value based on offset. + * Sets whatsapp * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsWhatsapp|null $whatsapp whatsapp * - * @return void + * @return $this */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function setWhatsapp(?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsWhatsapp $whatsapp): static { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; + if (is_null($whatsapp)) { + throw new InvalidArgumentException('non-nullable whatsapp cannot be null'); } + $this->container['whatsapp'] = $whatsapp; + + return $this; } /** - * Unsets offset. - * - * @param integer $offset Offset + * Gets externalFeeds * - * @return void + * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsExternalFeeds|null */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) + public function getExternalFeeds(): ?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsExternalFeeds { - unset($this->container[$offset]); + return $this->container['externalFeeds']; } /** - * Gets the string presentation of the object + * Sets externalFeeds * - * @return string + * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsExternalFeeds|null $externalFeeds externalFeeds + * + * @return $this */ - public function __toString() + public function setExternalFeeds(?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoCreditsExternalFeeds $externalFeeds): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($externalFeeds)) { + throw new InvalidArgumentException('non-nullable externalFeeds cannot be null'); } + $this->container['externalFeeds'] = $externalFeeds; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/SubAccountDetailsResponsePlanInfoCreditsEmails.php b/lib/Models/SubAccountDetailsResponsePlanInfoCreditsEmails.php index 1817f27..830b6c8 100644 --- a/lib/Models/SubAccountDetailsResponsePlanInfoCreditsEmails.php +++ b/lib/Models/SubAccountDetailsResponsePlanInfoCreditsEmails.php @@ -2,62 +2,64 @@ /** * SubAccountDetailsResponsePlanInfoCreditsEmails * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SubAccountDetailsResponsePlanInfoCreditsEmails Class Doc Comment * - * @category Class * @description Email credits remaining on the sub-account * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SubAccountDetailsResponsePlanInfoCreditsEmails implements ModelInterface, ArrayAccess +class SubAccountDetailsResponsePlanInfoCreditsEmails extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'subAccountDetailsResponse_planInfo_credits_emails'; + protected static string $openAPIModelName = 'subAccountDetailsResponse_planInfo_credits_emails'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'quantity' => 'int', 'remaining' => 'int' ]; @@ -65,40 +67,37 @@ class SubAccountDetailsResponsePlanInfoCreditsEmails implements ModelInterface, /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'quantity' => 'int64', 'remaining' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'quantity' => false, + 'remaining' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'quantity' => 'quantity', 'remaining' => 'remaining' ]; @@ -106,9 +105,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'quantity' => 'setQuantity', 'remaining' => 'setRemaining' ]; @@ -116,9 +115,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'quantity' => 'getQuantity', 'remaining' => 'getRemaining' ]; @@ -127,9 +126,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -137,9 +136,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -147,76 +146,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['quantity'] = isset($data['quantity']) ? $data['quantity'] : null; - $this->container['remaining'] = isset($data['remaining']) ? $data['remaining'] : null; + $this->setIfExists('quantity', $data ?? [], null); + $this->setIfExists('remaining', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets quantity * - * @return int + * @return int|null */ - public function getQuantity() + public function getQuantity(): ?int { return $this->container['quantity']; } @@ -224,12 +197,15 @@ public function getQuantity() /** * Sets quantity * - * @param int $quantity Quantity of email messaging limits provided + * @param int|null $quantity Quantity of email messaging limits provided * * @return $this */ - public function setQuantity($quantity) + public function setQuantity(?int $quantity): static { + if (is_null($quantity)) { + throw new InvalidArgumentException('non-nullable quantity cannot be null'); + } $this->container['quantity'] = $quantity; return $this; @@ -238,9 +214,9 @@ public function setQuantity($quantity) /** * Gets remaining * - * @return int + * @return int|null */ - public function getRemaining() + public function getRemaining(): ?int { return $this->container['remaining']; } @@ -248,89 +224,19 @@ public function getRemaining() /** * Sets remaining * - * @param int $remaining Available email messaging limits for use + * @param int|null $remaining Available email messaging limits for use * * @return $this */ - public function setRemaining($remaining) + public function setRemaining(?int $remaining): static { + if (is_null($remaining)) { + throw new InvalidArgumentException('non-nullable remaining cannot be null'); + } $this->container['remaining'] = $remaining; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/SubAccountDetailsResponsePlanInfoCreditsExternalFeeds.php b/lib/Models/SubAccountDetailsResponsePlanInfoCreditsExternalFeeds.php new file mode 100644 index 0000000..980e644 --- /dev/null +++ b/lib/Models/SubAccountDetailsResponsePlanInfoCreditsExternalFeeds.php @@ -0,0 +1,242 @@ + + */ +class SubAccountDetailsResponsePlanInfoCreditsExternalFeeds extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'subAccountDetailsResponse_planInfo_credits_externalFeeds'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'quantity' => 'int', + 'remaining' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'quantity' => 'int64', + 'remaining' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'quantity' => false, + 'remaining' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'quantity' => 'quantity', + 'remaining' => 'remaining' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'quantity' => 'setQuantity', + 'remaining' => 'setRemaining' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'quantity' => 'getQuantity', + 'remaining' => 'getRemaining' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('quantity', $data ?? [], null); + $this->setIfExists('remaining', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets quantity + * + * @return int|null + */ + public function getQuantity(): ?int + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity Quantity of externalFeeds messaging limits provided + * + * @return $this + */ + public function setQuantity(?int $quantity): static + { + if (is_null($quantity)) { + throw new InvalidArgumentException('non-nullable quantity cannot be null'); + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets remaining + * + * @return int|null + */ + public function getRemaining(): ?int + { + return $this->container['remaining']; + } + + /** + * Sets remaining + * + * @param int|null $remaining Available externalFeeds messaging limits for use + * + * @return $this + */ + public function setRemaining(?int $remaining): static + { + if (is_null($remaining)) { + throw new InvalidArgumentException('non-nullable remaining cannot be null'); + } + $this->container['remaining'] = $remaining; + + return $this; + } +} + + diff --git a/lib/Models/SubAccountDetailsResponsePlanInfoCreditsSms.php b/lib/Models/SubAccountDetailsResponsePlanInfoCreditsSms.php new file mode 100644 index 0000000..dbdef8e --- /dev/null +++ b/lib/Models/SubAccountDetailsResponsePlanInfoCreditsSms.php @@ -0,0 +1,242 @@ + + */ +class SubAccountDetailsResponsePlanInfoCreditsSms extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'subAccountDetailsResponse_planInfo_credits_sms'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'quantity' => 'int', + 'remaining' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'quantity' => 'int64', + 'remaining' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'quantity' => false, + 'remaining' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'quantity' => 'quantity', + 'remaining' => 'remaining' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'quantity' => 'setQuantity', + 'remaining' => 'setRemaining' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'quantity' => 'getQuantity', + 'remaining' => 'getRemaining' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('quantity', $data ?? [], null); + $this->setIfExists('remaining', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets quantity + * + * @return int|null + */ + public function getQuantity(): ?int + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity Quantity of SMS messaging limits provided + * + * @return $this + */ + public function setQuantity(?int $quantity): static + { + if (is_null($quantity)) { + throw new InvalidArgumentException('non-nullable quantity cannot be null'); + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets remaining + * + * @return int|null + */ + public function getRemaining(): ?int + { + return $this->container['remaining']; + } + + /** + * Sets remaining + * + * @param int|null $remaining Available SMS messaging limits for use + * + * @return $this + */ + public function setRemaining(?int $remaining): static + { + if (is_null($remaining)) { + throw new InvalidArgumentException('non-nullable remaining cannot be null'); + } + $this->container['remaining'] = $remaining; + + return $this; + } +} + + diff --git a/lib/Models/SubAccountDetailsResponsePlanInfoCreditsWhatsapp.php b/lib/Models/SubAccountDetailsResponsePlanInfoCreditsWhatsapp.php new file mode 100644 index 0000000..918f4dc --- /dev/null +++ b/lib/Models/SubAccountDetailsResponsePlanInfoCreditsWhatsapp.php @@ -0,0 +1,242 @@ + + */ +class SubAccountDetailsResponsePlanInfoCreditsWhatsapp extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'subAccountDetailsResponse_planInfo_credits_whatsapp'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'quantity' => 'int', + 'remaining' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'quantity' => 'int64', + 'remaining' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'quantity' => false, + 'remaining' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'quantity' => 'quantity', + 'remaining' => 'remaining' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'quantity' => 'setQuantity', + 'remaining' => 'setRemaining' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'quantity' => 'getQuantity', + 'remaining' => 'getRemaining' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('quantity', $data ?? [], null); + $this->setIfExists('remaining', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets quantity + * + * @return int|null + */ + public function getQuantity(): ?int + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity Quantity of whatsapp messaging limits provided + * + * @return $this + */ + public function setQuantity(?int $quantity): static + { + if (is_null($quantity)) { + throw new InvalidArgumentException('non-nullable quantity cannot be null'); + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets remaining + * + * @return int|null + */ + public function getRemaining(): ?int + { + return $this->container['remaining']; + } + + /** + * Sets remaining + * + * @param int|null $remaining Available whatsapp messaging limits for use + * + * @return $this + */ + public function setRemaining(?int $remaining): static + { + if (is_null($remaining)) { + throw new InvalidArgumentException('non-nullable remaining cannot be null'); + } + $this->container['remaining'] = $remaining; + + return $this; + } +} + + diff --git a/lib/Models/SubAccountDetailsResponsePlanInfoCreditsWpSubscribers.php b/lib/Models/SubAccountDetailsResponsePlanInfoCreditsWpSubscribers.php new file mode 100644 index 0000000..1809b61 --- /dev/null +++ b/lib/Models/SubAccountDetailsResponsePlanInfoCreditsWpSubscribers.php @@ -0,0 +1,242 @@ + + */ +class SubAccountDetailsResponsePlanInfoCreditsWpSubscribers extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'subAccountDetailsResponse_planInfo_credits_wpSubscribers'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'quantity' => 'int', + 'remaining' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'quantity' => 'int64', + 'remaining' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'quantity' => false, + 'remaining' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'quantity' => 'quantity', + 'remaining' => 'remaining' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'quantity' => 'setQuantity', + 'remaining' => 'setRemaining' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'quantity' => 'getQuantity', + 'remaining' => 'getRemaining' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('quantity', $data ?? [], null); + $this->setIfExists('remaining', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets quantity + * + * @return int|null + */ + public function getQuantity(): ?int + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity Quantity of Push sending limits provided + * + * @return $this + */ + public function setQuantity(?int $quantity): static + { + if (is_null($quantity)) { + throw new InvalidArgumentException('non-nullable quantity cannot be null'); + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets remaining + * + * @return int|null + */ + public function getRemaining(): ?int + { + return $this->container['remaining']; + } + + /** + * Sets remaining + * + * @param int|null $remaining Available Push sending limits for use + * + * @return $this + */ + public function setRemaining(?int $remaining): static + { + if (is_null($remaining)) { + throw new InvalidArgumentException('non-nullable remaining cannot be null'); + } + $this->container['remaining'] = $remaining; + + return $this; + } +} + + diff --git a/lib/Models/SubAccountDetailsResponsePlanInfoFeatures.php b/lib/Models/SubAccountDetailsResponsePlanInfoFeatures.php index 9993e7e..06823f4 100644 --- a/lib/Models/SubAccountDetailsResponsePlanInfoFeatures.php +++ b/lib/Models/SubAccountDetailsResponsePlanInfoFeatures.php @@ -2,62 +2,64 @@ /** * SubAccountDetailsResponsePlanInfoFeatures * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SubAccountDetailsResponsePlanInfoFeatures Class Doc Comment * - * @category Class * @description Features available on the sub-account * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SubAccountDetailsResponsePlanInfoFeatures implements ModelInterface, ArrayAccess +class SubAccountDetailsResponsePlanInfoFeatures extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'subAccountDetailsResponse_planInfo_features'; + protected static string $openAPIModelName = 'subAccountDetailsResponse_planInfo_features'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'inbox' => '\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesInbox', 'landingPage' => '\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesLandingPage', 'users' => '\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesUsers' @@ -66,41 +68,39 @@ class SubAccountDetailsResponsePlanInfoFeatures implements ModelInterface, Array /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'inbox' => null, 'landingPage' => null, 'users' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'inbox' => false, + 'landingPage' => false, + 'users' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'inbox' => 'inbox', 'landingPage' => 'landingPage', 'users' => 'users' @@ -109,9 +109,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'inbox' => 'setInbox', 'landingPage' => 'setLandingPage', 'users' => 'setUsers' @@ -120,9 +120,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'inbox' => 'getInbox', 'landingPage' => 'getLandingPage', 'users' => 'getUsers' @@ -132,9 +132,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -142,9 +142,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -152,77 +152,51 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['inbox'] = isset($data['inbox']) ? $data['inbox'] : null; - $this->container['landingPage'] = isset($data['landingPage']) ? $data['landingPage'] : null; - $this->container['users'] = isset($data['users']) ? $data['users'] : null; + $this->setIfExists('inbox', $data ?? [], null); + $this->setIfExists('landingPage', $data ?? [], null); + $this->setIfExists('users', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets inbox * - * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesInbox + * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesInbox|null */ - public function getInbox() + public function getInbox(): ?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesInbox { return $this->container['inbox']; } @@ -230,12 +204,15 @@ public function getInbox() /** * Sets inbox * - * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesInbox $inbox inbox + * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesInbox|null $inbox inbox * * @return $this */ - public function setInbox($inbox) + public function setInbox(?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesInbox $inbox): static { + if (is_null($inbox)) { + throw new InvalidArgumentException('non-nullable inbox cannot be null'); + } $this->container['inbox'] = $inbox; return $this; @@ -244,9 +221,9 @@ public function setInbox($inbox) /** * Gets landingPage * - * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesLandingPage + * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesLandingPage|null */ - public function getLandingPage() + public function getLandingPage(): ?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesLandingPage { return $this->container['landingPage']; } @@ -254,12 +231,15 @@ public function getLandingPage() /** * Sets landingPage * - * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesLandingPage $landingPage landingPage + * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesLandingPage|null $landingPage landingPage * * @return $this */ - public function setLandingPage($landingPage) + public function setLandingPage(?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesLandingPage $landingPage): static { + if (is_null($landingPage)) { + throw new InvalidArgumentException('non-nullable landingPage cannot be null'); + } $this->container['landingPage'] = $landingPage; return $this; @@ -268,9 +248,9 @@ public function setLandingPage($landingPage) /** * Gets users * - * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesUsers + * @return \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesUsers|null */ - public function getUsers() + public function getUsers(): ?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesUsers { return $this->container['users']; } @@ -278,89 +258,19 @@ public function getUsers() /** * Sets users * - * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesUsers $users users + * @param \Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesUsers|null $users users * * @return $this */ - public function setUsers($users) + public function setUsers(?\Brevo\Client\Models\SubAccountDetailsResponsePlanInfoFeaturesUsers $users): static { + if (is_null($users)) { + throw new InvalidArgumentException('non-nullable users cannot be null'); + } $this->container['users'] = $users; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/SubAccountDetailsResponsePlanInfoFeaturesInbox.php b/lib/Models/SubAccountDetailsResponsePlanInfoFeaturesInbox.php index f2812e6..4196b5d 100644 --- a/lib/Models/SubAccountDetailsResponsePlanInfoFeaturesInbox.php +++ b/lib/Models/SubAccountDetailsResponsePlanInfoFeaturesInbox.php @@ -2,62 +2,64 @@ /** * SubAccountDetailsResponsePlanInfoFeaturesInbox * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SubAccountDetailsResponsePlanInfoFeaturesInbox Class Doc Comment * - * @category Class * @description Inbox details / Not available on ENTv2 * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SubAccountDetailsResponsePlanInfoFeaturesInbox implements ModelInterface, ArrayAccess +class SubAccountDetailsResponsePlanInfoFeaturesInbox extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'subAccountDetailsResponse_planInfo_features_inbox'; + protected static string $openAPIModelName = 'subAccountDetailsResponse_planInfo_features_inbox'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'quantity' => 'int', 'remaining' => 'int' ]; @@ -65,40 +67,37 @@ class SubAccountDetailsResponsePlanInfoFeaturesInbox implements ModelInterface, /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'quantity' => 'int64', 'remaining' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'quantity' => false, + 'remaining' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'quantity' => 'quantity', 'remaining' => 'remaining' ]; @@ -106,9 +105,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'quantity' => 'setQuantity', 'remaining' => 'setRemaining' ]; @@ -116,9 +115,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'quantity' => 'getQuantity', 'remaining' => 'getRemaining' ]; @@ -127,9 +126,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -137,9 +136,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -147,76 +146,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['quantity'] = isset($data['quantity']) ? $data['quantity'] : null; - $this->container['remaining'] = isset($data['remaining']) ? $data['remaining'] : null; + $this->setIfExists('quantity', $data ?? [], null); + $this->setIfExists('remaining', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets quantity * - * @return int + * @return int|null */ - public function getQuantity() + public function getQuantity(): ?int { return $this->container['quantity']; } @@ -224,12 +197,15 @@ public function getQuantity() /** * Sets quantity * - * @param int $quantity Quantity of inbox provided + * @param int|null $quantity Quantity of inbox provided * * @return $this */ - public function setQuantity($quantity) + public function setQuantity(?int $quantity): static { + if (is_null($quantity)) { + throw new InvalidArgumentException('non-nullable quantity cannot be null'); + } $this->container['quantity'] = $quantity; return $this; @@ -238,9 +214,9 @@ public function setQuantity($quantity) /** * Gets remaining * - * @return int + * @return int|null */ - public function getRemaining() + public function getRemaining(): ?int { return $this->container['remaining']; } @@ -248,89 +224,19 @@ public function getRemaining() /** * Sets remaining * - * @param int $remaining Available inboxes for use + * @param int|null $remaining Available inboxes for use * * @return $this */ - public function setRemaining($remaining) + public function setRemaining(?int $remaining): static { + if (is_null($remaining)) { + throw new InvalidArgumentException('non-nullable remaining cannot be null'); + } $this->container['remaining'] = $remaining; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/SubAccountDetailsResponsePlanInfoFeaturesLandingPage.php b/lib/Models/SubAccountDetailsResponsePlanInfoFeaturesLandingPage.php index 614cf47..f38a448 100644 --- a/lib/Models/SubAccountDetailsResponsePlanInfoFeaturesLandingPage.php +++ b/lib/Models/SubAccountDetailsResponsePlanInfoFeaturesLandingPage.php @@ -2,62 +2,64 @@ /** * SubAccountDetailsResponsePlanInfoFeaturesLandingPage * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SubAccountDetailsResponsePlanInfoFeaturesLandingPage Class Doc Comment * - * @category Class * @description Landing page details / Not available on ENTv2 * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SubAccountDetailsResponsePlanInfoFeaturesLandingPage implements ModelInterface, ArrayAccess +class SubAccountDetailsResponsePlanInfoFeaturesLandingPage extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'subAccountDetailsResponse_planInfo_features_landingPage'; + protected static string $openAPIModelName = 'subAccountDetailsResponse_planInfo_features_landingPage'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'quantity' => 'int', 'remaining' => 'int' ]; @@ -65,40 +67,37 @@ class SubAccountDetailsResponsePlanInfoFeaturesLandingPage implements ModelInter /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'quantity' => 'int64', 'remaining' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'quantity' => false, + 'remaining' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'quantity' => 'quantity', 'remaining' => 'remaining' ]; @@ -106,9 +105,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'quantity' => 'setQuantity', 'remaining' => 'setRemaining' ]; @@ -116,9 +115,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'quantity' => 'getQuantity', 'remaining' => 'getRemaining' ]; @@ -127,9 +126,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -137,9 +136,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -147,76 +146,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['quantity'] = isset($data['quantity']) ? $data['quantity'] : null; - $this->container['remaining'] = isset($data['remaining']) ? $data['remaining'] : null; + $this->setIfExists('quantity', $data ?? [], null); + $this->setIfExists('remaining', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets quantity * - * @return int + * @return int|null */ - public function getQuantity() + public function getQuantity(): ?int { return $this->container['quantity']; } @@ -224,12 +197,15 @@ public function getQuantity() /** * Sets quantity * - * @param int $quantity Quantity of landing pages provided + * @param int|null $quantity Quantity of landing pages provided * * @return $this */ - public function setQuantity($quantity) + public function setQuantity(?int $quantity): static { + if (is_null($quantity)) { + throw new InvalidArgumentException('non-nullable quantity cannot be null'); + } $this->container['quantity'] = $quantity; return $this; @@ -238,9 +214,9 @@ public function setQuantity($quantity) /** * Gets remaining * - * @return int + * @return int|null */ - public function getRemaining() + public function getRemaining(): ?int { return $this->container['remaining']; } @@ -248,89 +224,19 @@ public function getRemaining() /** * Sets remaining * - * @param int $remaining Available landing pages for use + * @param int|null $remaining Available landing pages for use * * @return $this */ - public function setRemaining($remaining) + public function setRemaining(?int $remaining): static { + if (is_null($remaining)) { + throw new InvalidArgumentException('non-nullable remaining cannot be null'); + } $this->container['remaining'] = $remaining; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/SubAccountDetailsResponsePlanInfoFeaturesUsers.php b/lib/Models/SubAccountDetailsResponsePlanInfoFeaturesUsers.php index d1636e5..97da19b 100644 --- a/lib/Models/SubAccountDetailsResponsePlanInfoFeaturesUsers.php +++ b/lib/Models/SubAccountDetailsResponsePlanInfoFeaturesUsers.php @@ -2,62 +2,64 @@ /** * SubAccountDetailsResponsePlanInfoFeaturesUsers * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SubAccountDetailsResponsePlanInfoFeaturesUsers Class Doc Comment * - * @category Class * @description Multi-account details * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SubAccountDetailsResponsePlanInfoFeaturesUsers implements ModelInterface, ArrayAccess +class SubAccountDetailsResponsePlanInfoFeaturesUsers extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'subAccountDetailsResponse_planInfo_features_users'; + protected static string $openAPIModelName = 'subAccountDetailsResponse_planInfo_features_users'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'quantity' => 'int', 'remaining' => 'int' ]; @@ -65,40 +67,37 @@ class SubAccountDetailsResponsePlanInfoFeaturesUsers implements ModelInterface, /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'quantity' => 'int64', 'remaining' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'quantity' => false, + 'remaining' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'quantity' => 'quantity', 'remaining' => 'remaining' ]; @@ -106,9 +105,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'quantity' => 'setQuantity', 'remaining' => 'setRemaining' ]; @@ -116,9 +115,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'quantity' => 'getQuantity', 'remaining' => 'getRemaining' ]; @@ -127,9 +126,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -137,9 +136,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -147,76 +146,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['quantity'] = isset($data['quantity']) ? $data['quantity'] : null; - $this->container['remaining'] = isset($data['remaining']) ? $data['remaining'] : null; + $this->setIfExists('quantity', $data ?? [], null); + $this->setIfExists('remaining', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets quantity * - * @return int + * @return int|null */ - public function getQuantity() + public function getQuantity(): ?int { return $this->container['quantity']; } @@ -224,12 +197,15 @@ public function getQuantity() /** * Sets quantity * - * @param int $quantity Quantity of multi-account's provided + * @param int|null $quantity Quantity of multi-account's provided * * @return $this */ - public function setQuantity($quantity) + public function setQuantity(?int $quantity): static { + if (is_null($quantity)) { + throw new InvalidArgumentException('non-nullable quantity cannot be null'); + } $this->container['quantity'] = $quantity; return $this; @@ -238,9 +214,9 @@ public function setQuantity($quantity) /** * Gets remaining * - * @return int + * @return int|null */ - public function getRemaining() + public function getRemaining(): ?int { return $this->container['remaining']; } @@ -248,89 +224,19 @@ public function getRemaining() /** * Sets remaining * - * @param int $remaining Available multi-accounts for use + * @param int|null $remaining Available multi-accounts for use * * @return $this */ - public function setRemaining($remaining) + public function setRemaining(?int $remaining): static { + if (is_null($remaining)) { + throw new InvalidArgumentException('non-nullable remaining cannot be null'); + } $this->container['remaining'] = $remaining; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/SubAccountUpdatePlanRequest.php b/lib/Models/SubAccountUpdatePlanRequest.php index 3a58801..55078bb 100644 --- a/lib/Models/SubAccountUpdatePlanRequest.php +++ b/lib/Models/SubAccountUpdatePlanRequest.php @@ -2,62 +2,64 @@ /** * SubAccountUpdatePlanRequest * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SubAccountUpdatePlanRequest Class Doc Comment * - * @category Class * @description Details of the plan to be changed * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SubAccountUpdatePlanRequest implements ModelInterface, ArrayAccess +class SubAccountUpdatePlanRequest extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'subAccountUpdatePlanRequest'; + protected static string $openAPIModelName = 'subAccountUpdatePlanRequest'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'credits' => '\Brevo\Client\Models\SubAccountUpdatePlanRequestCredits', 'features' => '\Brevo\Client\Models\SubAccountUpdatePlanRequestFeatures' ]; @@ -65,40 +67,37 @@ class SubAccountUpdatePlanRequest implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'credits' => null, 'features' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'credits' => false, + 'features' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'credits' => 'credits', 'features' => 'features' ]; @@ -106,9 +105,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'credits' => 'setCredits', 'features' => 'setFeatures' ]; @@ -116,9 +115,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'credits' => 'getCredits', 'features' => 'getFeatures' ]; @@ -127,9 +126,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -137,9 +136,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -147,76 +146,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['credits'] = isset($data['credits']) ? $data['credits'] : null; - $this->container['features'] = isset($data['features']) ? $data['features'] : null; + $this->setIfExists('credits', $data ?? [], null); + $this->setIfExists('features', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets credits * - * @return \Brevo\Client\Models\SubAccountUpdatePlanRequestCredits + * @return \Brevo\Client\Models\SubAccountUpdatePlanRequestCredits|null */ - public function getCredits() + public function getCredits(): ?\Brevo\Client\Models\SubAccountUpdatePlanRequestCredits { return $this->container['credits']; } @@ -224,12 +197,15 @@ public function getCredits() /** * Sets credits * - * @param \Brevo\Client\Models\SubAccountUpdatePlanRequestCredits $credits credits + * @param \Brevo\Client\Models\SubAccountUpdatePlanRequestCredits|null $credits credits * * @return $this */ - public function setCredits($credits) + public function setCredits(?\Brevo\Client\Models\SubAccountUpdatePlanRequestCredits $credits): static { + if (is_null($credits)) { + throw new InvalidArgumentException('non-nullable credits cannot be null'); + } $this->container['credits'] = $credits; return $this; @@ -238,9 +214,9 @@ public function setCredits($credits) /** * Gets features * - * @return \Brevo\Client\Models\SubAccountUpdatePlanRequestFeatures + * @return \Brevo\Client\Models\SubAccountUpdatePlanRequestFeatures|null */ - public function getFeatures() + public function getFeatures(): ?\Brevo\Client\Models\SubAccountUpdatePlanRequestFeatures { return $this->container['features']; } @@ -248,89 +224,19 @@ public function getFeatures() /** * Sets features * - * @param \Brevo\Client\Models\SubAccountUpdatePlanRequestFeatures $features features + * @param \Brevo\Client\Models\SubAccountUpdatePlanRequestFeatures|null $features features * * @return $this */ - public function setFeatures($features) + public function setFeatures(?\Brevo\Client\Models\SubAccountUpdatePlanRequestFeatures $features): static { + if (is_null($features)) { + throw new InvalidArgumentException('non-nullable features cannot be null'); + } $this->container['features'] = $features; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/SubAccountUpdatePlanRequestCredits.php b/lib/Models/SubAccountUpdatePlanRequestCredits.php index 03f4cb6..0071144 100644 --- a/lib/Models/SubAccountUpdatePlanRequestCredits.php +++ b/lib/Models/SubAccountUpdatePlanRequestCredits.php @@ -2,129 +2,151 @@ /** * SubAccountUpdatePlanRequestCredits * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SubAccountUpdatePlanRequestCredits Class Doc Comment * - * @category Class * @description Credit details to update * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SubAccountUpdatePlanRequestCredits implements ModelInterface, ArrayAccess +class SubAccountUpdatePlanRequestCredits extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'subAccountUpdatePlanRequest_credits'; + protected static string $openAPIModelName = 'subAccountUpdatePlanRequest_credits'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'email' => 'int' + protected static array $openAPITypes = [ + 'email' => 'int', + 'sms' => 'float', + 'wpSubscribers' => 'int', + 'externalFeeds' => 'float', + 'whatsapp' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'email' => 'int64' + protected static array $openAPIFormats = [ + 'email' => 'int64', + 'sms' => 'float', + 'wpSubscribers' => 'int64', + 'externalFeeds' => 'int64', + 'whatsapp' => 'float' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'sms' => false, + 'wpSubscribers' => false, + 'externalFeeds' => false, + 'whatsapp' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ - 'email' => 'email' + protected static array $attributeMap = [ + 'email' => 'email', + 'sms' => 'sms', + 'wpSubscribers' => 'wpSubscribers', + 'externalFeeds' => 'externalFeeds', + 'whatsapp' => 'whatsapp' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ - 'email' => 'setEmail' + protected static array $setters = [ + 'email' => 'setEmail', + 'sms' => 'setSms', + 'wpSubscribers' => 'setWpSubscribers', + 'externalFeeds' => 'setExternalFeeds', + 'whatsapp' => 'setWhatsapp' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ - 'email' => 'getEmail' + protected static array $getters = [ + 'email' => 'getEmail', + 'sms' => 'getSms', + 'wpSubscribers' => 'getWpSubscribers', + 'externalFeeds' => 'getExternalFeeds', + 'whatsapp' => 'getWhatsapp' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -132,9 +154,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -142,51 +164,41 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('sms', $data ?? [], null); + $this->setIfExists('wpSubscribers', $data ?? [], null); + $this->setIfExists('externalFeeds', $data ?? [], null); + $this->setIfExists('whatsapp', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -194,112 +206,138 @@ public function listInvalidProperties() } /** - * Validate all the properties in the model - * return true if all passed + * Gets email * - * @return bool True if all properties are valid + * @return int|null */ - public function valid() + public function getEmail(): ?int { - return count($this->listInvalidProperties()) === 0; + return $this->container['email']; } + /** + * Sets email + * + * @param int|null $email Number of email credits | Pass the value -1 for unlimited emails in ENTv2 only + * + * @return $this + */ + public function setEmail(?int $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } /** - * Gets email + * Gets sms * - * @return int + * @return float|null */ - public function getEmail() + public function getSms(): ?float { - return $this->container['email']; + return $this->container['sms']; } /** - * Sets email + * Sets sms * - * @param int $email Number of email credits + * @param float|null $sms Number of SMS credits | Pass the value -1 for unlimited SMS in ENTv2 only * * @return $this */ - public function setEmail($email) + public function setSms(?float $sms): static { - $this->container['email'] = $email; + if (is_null($sms)) { + throw new InvalidArgumentException('non-nullable sms cannot be null'); + } + $this->container['sms'] = $sms; return $this; } + /** - * Returns true if offset exists. False otherwise. + * Gets wpSubscribers * - * @param integer $offset Offset - * - * @return boolean + * @return int|null */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) + public function getWpSubscribers(): ?int { - return isset($this->container[$offset]); + return $this->container['wpSubscribers']; } /** - * Gets offset. + * Sets wpSubscribers + * + * @param int|null $wpSubscribers Number of Push credits, possible value is 0 and -1 | available in ENT-v2 only * - * @param integer $offset Offset + * @return $this + */ + public function setWpSubscribers(?int $wpSubscribers): static + { + if (is_null($wpSubscribers)) { + throw new InvalidArgumentException('non-nullable wpSubscribers cannot be null'); + } + $this->container['wpSubscribers'] = $wpSubscribers; + + return $this; + } + + /** + * Gets externalFeeds * - * @return mixed + * @return float|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function getExternalFeeds(): ?float { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container['externalFeeds']; } /** - * Sets value based on offset. + * Sets externalFeeds * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param float|null $externalFeeds Number of externalFeeds credits, possible values are 0 or 1 |available in ENTv2 only * - * @return void + * @return $this */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function setExternalFeeds(?float $externalFeeds): static { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; + if (is_null($externalFeeds)) { + throw new InvalidArgumentException('non-nullable externalFeeds cannot be null'); } + $this->container['externalFeeds'] = $externalFeeds; + + return $this; } /** - * Unsets offset. - * - * @param integer $offset Offset + * Gets whatsapp * - * @return void + * @return float|null */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) + public function getWhatsapp(): ?float { - unset($this->container[$offset]); + return $this->container['whatsapp']; } /** - * Gets the string presentation of the object + * Sets whatsapp * - * @return string + * @param float|null $whatsapp Number of whatsapp credits | Pass the value -1 for unlimited whatsapp in ENTv2 only + * + * @return $this */ - public function __toString() + public function setWhatsapp(?float $whatsapp): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($whatsapp)) { + throw new InvalidArgumentException('non-nullable whatsapp cannot be null'); } + $this->container['whatsapp'] = $whatsapp; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/SubAccountUpdatePlanRequestFeatures.php b/lib/Models/SubAccountUpdatePlanRequestFeatures.php index 902cd42..31f4bb8 100644 --- a/lib/Models/SubAccountUpdatePlanRequestFeatures.php +++ b/lib/Models/SubAccountUpdatePlanRequestFeatures.php @@ -2,62 +2,64 @@ /** * SubAccountUpdatePlanRequestFeatures * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SubAccountUpdatePlanRequestFeatures Class Doc Comment * - * @category Class * @description Features details to update * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SubAccountUpdatePlanRequestFeatures implements ModelInterface, ArrayAccess +class SubAccountUpdatePlanRequestFeatures extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'subAccountUpdatePlanRequest_features'; + protected static string $openAPIModelName = 'subAccountUpdatePlanRequest_features'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'users' => 'int', 'landingPage' => 'int', 'inbox' => 'int' @@ -66,41 +68,39 @@ class SubAccountUpdatePlanRequestFeatures implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'users' => 'int64', 'landingPage' => 'int64', 'inbox' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'users' => false, + 'landingPage' => false, + 'inbox' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'users' => 'users', 'landingPage' => 'landingPage', 'inbox' => 'inbox' @@ -109,9 +109,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'users' => 'setUsers', 'landingPage' => 'setLandingPage', 'inbox' => 'setInbox' @@ -120,9 +120,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'users' => 'getUsers', 'landingPage' => 'getLandingPage', 'inbox' => 'getInbox' @@ -132,9 +132,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -142,9 +142,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -152,77 +152,51 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['users'] = isset($data['users']) ? $data['users'] : null; - $this->container['landingPage'] = isset($data['landingPage']) ? $data['landingPage'] : null; - $this->container['inbox'] = isset($data['inbox']) ? $data['inbox'] : null; + $this->setIfExists('users', $data ?? [], null); + $this->setIfExists('landingPage', $data ?? [], null); + $this->setIfExists('inbox', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets users * - * @return int + * @return int|null */ - public function getUsers() + public function getUsers(): ?int { return $this->container['users']; } @@ -230,12 +204,15 @@ public function getUsers() /** * Sets users * - * @param int $users Number of multi-users + * @param int|null $users Number of multi-users * * @return $this */ - public function setUsers($users) + public function setUsers(?int $users): static { + if (is_null($users)) { + throw new InvalidArgumentException('non-nullable users cannot be null'); + } $this->container['users'] = $users; return $this; @@ -244,9 +221,9 @@ public function setUsers($users) /** * Gets landingPage * - * @return int + * @return int|null */ - public function getLandingPage() + public function getLandingPage(): ?int { return $this->container['landingPage']; } @@ -254,12 +231,15 @@ public function getLandingPage() /** * Sets landingPage * - * @param int $landingPage Number of landing pages / Not required on ENTv2 + * @param int|null $landingPage Number of landing pages * * @return $this */ - public function setLandingPage($landingPage) + public function setLandingPage(?int $landingPage): static { + if (is_null($landingPage)) { + throw new InvalidArgumentException('non-nullable landingPage cannot be null'); + } $this->container['landingPage'] = $landingPage; return $this; @@ -268,9 +248,9 @@ public function setLandingPage($landingPage) /** * Gets inbox * - * @return int + * @return int|null */ - public function getInbox() + public function getInbox(): ?int { return $this->container['inbox']; } @@ -278,89 +258,19 @@ public function getInbox() /** * Sets inbox * - * @param int $inbox Number of inboxes / Not required on ENTv2 + * @param int|null $inbox Number of inboxes / Not required on ENTv2 * * @return $this */ - public function setInbox($inbox) + public function setInbox(?int $inbox): static { + if (is_null($inbox)) { + throw new InvalidArgumentException('non-nullable inbox cannot be null'); + } $this->container['inbox'] = $inbox; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/SubAccountsResponse.php b/lib/Models/SubAccountsResponse.php index 982d901..d126f9b 100644 --- a/lib/Models/SubAccountsResponse.php +++ b/lib/Models/SubAccountsResponse.php @@ -2,102 +2,101 @@ /** * SubAccountsResponse * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * SubAccountsResponse Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class SubAccountsResponse implements ModelInterface, ArrayAccess +class SubAccountsResponse extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'subAccountsResponse'; + protected static string $openAPIModelName = 'subAccountsResponse'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'count' => 'int', - 'subAccounts' => '\Brevo\Client\Models\SubAccountsResponseSubAccounts[]' + 'subAccounts' => '\Brevo\Client\Models\SubAccountsResponseSubAccountsInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'count' => null, 'subAccounts' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'count' => false, + 'subAccounts' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'count' => 'count', 'subAccounts' => 'subAccounts' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'count' => 'setCount', 'subAccounts' => 'setSubAccounts' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'count' => 'getCount', 'subAccounts' => 'getSubAccounts' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +145,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['count'] = isset($data['count']) ? $data['count'] : null; - $this->container['subAccounts'] = isset($data['subAccounts']) ? $data['subAccounts'] : null; + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('subAccounts', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets count * - * @return int + * @return int|null */ - public function getCount() + public function getCount(): ?int { return $this->container['count']; } @@ -223,12 +196,15 @@ public function getCount() /** * Sets count * - * @param int $count Total number of subaccounts + * @param int|null $count Total number of subaccounts * * @return $this */ - public function setCount($count) + public function setCount(?int $count): static { + if (is_null($count)) { + throw new InvalidArgumentException('non-nullable count cannot be null'); + } $this->container['count'] = $count; return $this; @@ -237,9 +213,9 @@ public function setCount($count) /** * Gets subAccounts * - * @return \Brevo\Client\Models\SubAccountsResponseSubAccounts[] + * @return \Brevo\Client\Models\SubAccountsResponseSubAccountsInner[]|null */ - public function getSubAccounts() + public function getSubAccounts(): ?array { return $this->container['subAccounts']; } @@ -247,89 +223,19 @@ public function getSubAccounts() /** * Sets subAccounts * - * @param \Brevo\Client\Models\SubAccountsResponseSubAccounts[] $subAccounts subAccounts + * @param \Brevo\Client\Models\SubAccountsResponseSubAccountsInner[]|null $subAccounts subAccounts * * @return $this */ - public function setSubAccounts($subAccounts) + public function setSubAccounts(?array $subAccounts): static { + if (is_null($subAccounts)) { + throw new InvalidArgumentException('non-nullable subAccounts cannot be null'); + } $this->container['subAccounts'] = $subAccounts; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/SubAccountsResponseSubAccounts.php b/lib/Models/SubAccountsResponseSubAccountsInner.php similarity index 50% rename from lib/Models/SubAccountsResponseSubAccounts.php rename to lib/Models/SubAccountsResponseSubAccountsInner.php index 00cc7d7..1ad34aa 100644 --- a/lib/Models/SubAccountsResponseSubAccounts.php +++ b/lib/Models/SubAccountsResponseSubAccountsInner.php @@ -1,144 +1,151 @@ */ -class SubAccountsResponseSubAccounts implements ModelInterface, ArrayAccess +class SubAccountsResponseSubAccountsInner extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'subAccountsResponse_subAccounts'; + protected static string $openAPIModelName = 'subAccountsResponse_subAccounts_inner'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'companyName' => 'string', 'active' => 'bool', - 'createdAt' => 'int' + 'createdAt' => 'int', + 'groups' => '\Brevo\Client\Models\SubAccountsResponseSubAccountsInnerGroupsInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'companyName' => null, 'active' => null, - 'createdAt' => 'int64' + 'createdAt' => 'int64', + 'groups' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'companyName' => false, + 'active' => false, + 'createdAt' => false, + 'groups' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'companyName' => 'companyName', 'active' => 'active', - 'createdAt' => 'createdAt' + 'createdAt' => 'createdAt', + 'groups' => 'groups' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'companyName' => 'setCompanyName', 'active' => 'setActive', - 'createdAt' => 'setCreatedAt' + 'createdAt' => 'setCreatedAt', + 'groups' => 'setGroups' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'companyName' => 'getCompanyName', 'active' => 'getActive', - 'createdAt' => 'getCreatedAt' + 'createdAt' => 'getCreatedAt', + 'groups' => 'getGroups' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +153,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,54 +163,41 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['companyName'] = isset($data['companyName']) ? $data['companyName'] : null; - $this->container['active'] = isset($data['active']) ? $data['active'] : null; - $this->container['createdAt'] = isset($data['createdAt']) ? $data['createdAt'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('companyName', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('groups', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -219,27 +213,18 @@ public function listInvalidProperties() if ($this->container['createdAt'] === null) { $invalidProperties[] = "'createdAt' can't be null"; } + if ($this->container['groups'] === null) { + $invalidProperties[] = "'groups' can't be null"; + } return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * * @return int */ - public function getId() + public function getId(): int { return $this->container['id']; } @@ -251,8 +236,11 @@ public function getId() * * @return $this */ - public function setId($id) + public function setId(int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -263,7 +251,7 @@ public function setId($id) * * @return string */ - public function getCompanyName() + public function getCompanyName(): string { return $this->container['companyName']; } @@ -275,8 +263,11 @@ public function getCompanyName() * * @return $this */ - public function setCompanyName($companyName) + public function setCompanyName(string $companyName): static { + if (is_null($companyName)) { + throw new InvalidArgumentException('non-nullable companyName cannot be null'); + } $this->container['companyName'] = $companyName; return $this; @@ -287,7 +278,7 @@ public function setCompanyName($companyName) * * @return bool */ - public function getActive() + public function getActive(): bool { return $this->container['active']; } @@ -299,8 +290,11 @@ public function getActive() * * @return $this */ - public function setActive($active) + public function setActive(bool $active): static { + if (is_null($active)) { + throw new InvalidArgumentException('non-nullable active cannot be null'); + } $this->container['active'] = $active; return $this; @@ -311,7 +305,7 @@ public function setActive($active) * * @return int */ - public function getCreatedAt() + public function getCreatedAt(): int { return $this->container['createdAt']; } @@ -323,84 +317,41 @@ public function getCreatedAt() * * @return $this */ - public function setCreatedAt($createdAt) + public function setCreatedAt(int $createdAt): static { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } $this->container['createdAt'] = $createdAt; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } /** - * Gets offset. - * - * @param integer $offset Offset + * Gets groups * - * @return mixed + * @return \Brevo\Client\Models\SubAccountsResponseSubAccountsInnerGroupsInner[] */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function getGroups(): array { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container['groups']; } /** - * Sets value based on offset. + * Sets groups * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param \Brevo\Client\Models\SubAccountsResponseSubAccountsInnerGroupsInner[] $groups Group details * - * @return void - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string + * @return $this */ - public function __toString() + public function setGroups(array $groups): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($groups)) { + throw new InvalidArgumentException('non-nullable groups cannot be null'); } + $this->container['groups'] = $groups; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/SubAccountsResponseSubAccountsInnerGroupsInner.php b/lib/Models/SubAccountsResponseSubAccountsInnerGroupsInner.php new file mode 100644 index 0000000..1c14bb1 --- /dev/null +++ b/lib/Models/SubAccountsResponseSubAccountsInnerGroupsInner.php @@ -0,0 +1,241 @@ + + */ +class SubAccountsResponseSubAccountsInnerGroupsInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'subAccountsResponse_subAccounts_inner_groups_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Group identifier + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the group + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } +} + + diff --git a/lib/Models/SubscriptionNotFoundErrorResponse.php b/lib/Models/SubscriptionNotFoundErrorResponse.php new file mode 100644 index 0000000..d9989f6 --- /dev/null +++ b/lib/Models/SubscriptionNotFoundErrorResponse.php @@ -0,0 +1,207 @@ + + */ +class SubscriptionNotFoundErrorResponse extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'subscriptionNotFoundErrorResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'error' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'error' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'error' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'error' => 'getError' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error', $data ?? [], 'subscription not found'); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets error + * + * @return string|null + */ + public function getError(): ?string + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string|null $error error + * + * @return $this + */ + public function setError(?string $error): static + { + if (is_null($error)) { + throw new InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } +} + + diff --git a/lib/Models/Task.php b/lib/Models/Task.php index 4a32253..d54ad4a 100644 --- a/lib/Models/Task.php +++ b/lib/Models/Task.php @@ -2,65 +2,67 @@ /** * Task * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * Task Class Doc Comment * - * @category Class * @description Task Details * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class Task implements ModelInterface, ArrayAccess +class Task extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'Task'; + protected static string $openAPIModelName = 'Task'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'id' => 'string', + protected static array $openAPITypes = [ 'taskTypeId' => 'string', 'name' => 'string', + 'id' => 'string', 'contactsIds' => 'int[]', 'dealsIds' => 'string[]', 'companiesIds' => 'string[]' @@ -69,47 +71,48 @@ class Task implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'id' => null, + protected static array $openAPIFormats = [ 'taskTypeId' => null, 'name' => null, + 'id' => null, 'contactsIds' => null, 'dealsIds' => null, 'companiesIds' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'taskTypeId' => false, + 'name' => false, + 'id' => false, + 'contactsIds' => false, + 'dealsIds' => false, + 'companiesIds' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ - 'id' => 'id', + protected static array $attributeMap = [ 'taskTypeId' => 'taskTypeId', 'name' => 'name', + 'id' => 'id', 'contactsIds' => 'contactsIds', 'dealsIds' => 'dealsIds', 'companiesIds' => 'companiesIds' @@ -118,12 +121,12 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ - 'id' => 'setId', + protected static array $setters = [ 'taskTypeId' => 'setTaskTypeId', 'name' => 'setName', + 'id' => 'setId', 'contactsIds' => 'setContactsIds', 'dealsIds' => 'setDealsIds', 'companiesIds' => 'setCompaniesIds' @@ -132,12 +135,12 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ - 'id' => 'getId', + protected static array $getters = [ 'taskTypeId' => 'getTaskTypeId', 'name' => 'getName', + 'id' => 'getId', 'contactsIds' => 'getContactsIds', 'dealsIds' => 'getDealsIds', 'companiesIds' => 'getCompaniesIds' @@ -147,9 +150,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -157,9 +160,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -167,56 +170,42 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['taskTypeId'] = isset($data['taskTypeId']) ? $data['taskTypeId'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['contactsIds'] = isset($data['contactsIds']) ? $data['contactsIds'] : null; - $this->container['dealsIds'] = isset($data['dealsIds']) ? $data['dealsIds'] : null; - $this->container['companiesIds'] = isset($data['companiesIds']) ? $data['companiesIds'] : null; + $this->setIfExists('taskTypeId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('contactsIds', $data ?? [], null); + $this->setIfExists('dealsIds', $data ?? [], null); + $this->setIfExists('companiesIds', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -230,85 +219,82 @@ public function listInvalidProperties() } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id + * Gets taskTypeId * * @return string */ - public function getId() + public function getTaskTypeId(): string { - return $this->container['id']; + return $this->container['taskTypeId']; } /** - * Sets id + * Sets taskTypeId * - * @param string $id Unique task id + * @param string $taskTypeId Id for type of task e.g Call / Email / Meeting etc. * * @return $this */ - public function setId($id) + public function setTaskTypeId(string $taskTypeId): static { - $this->container['id'] = $id; + if (is_null($taskTypeId)) { + throw new InvalidArgumentException('non-nullable taskTypeId cannot be null'); + } + $this->container['taskTypeId'] = $taskTypeId; return $this; } /** - * Gets taskTypeId + * Gets name * * @return string */ - public function getTaskTypeId() + public function getName(): string { - return $this->container['taskTypeId']; + return $this->container['name']; } /** - * Sets taskTypeId + * Sets name * - * @param string $taskTypeId Id for type of task e.g Call / Email / Meeting etc. + * @param string $name Name of task * * @return $this */ - public function setTaskTypeId($taskTypeId) + public function setName(string $name): static { - $this->container['taskTypeId'] = $taskTypeId; + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; return $this; } /** - * Gets name + * Gets id * - * @return string + * @return string|null */ - public function getName() + public function getId(): ?string { - return $this->container['name']; + return $this->container['id']; } /** - * Sets name + * Sets id * - * @param string $name Name of task + * @param string|null $id Unique task id * * @return $this */ - public function setName($name) + public function setId(?string $id): static { - $this->container['name'] = $name; + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; return $this; } @@ -316,9 +302,9 @@ public function setName($name) /** * Gets contactsIds * - * @return int[] + * @return int[]|null */ - public function getContactsIds() + public function getContactsIds(): ?array { return $this->container['contactsIds']; } @@ -326,12 +312,15 @@ public function getContactsIds() /** * Sets contactsIds * - * @param int[] $contactsIds Contact ids for contacts linked to this task + * @param int[]|null $contactsIds Contact ids for contacts linked to this task * * @return $this */ - public function setContactsIds($contactsIds) + public function setContactsIds(?array $contactsIds): static { + if (is_null($contactsIds)) { + throw new InvalidArgumentException('non-nullable contactsIds cannot be null'); + } $this->container['contactsIds'] = $contactsIds; return $this; @@ -340,9 +329,9 @@ public function setContactsIds($contactsIds) /** * Gets dealsIds * - * @return string[] + * @return string[]|null */ - public function getDealsIds() + public function getDealsIds(): ?array { return $this->container['dealsIds']; } @@ -350,12 +339,15 @@ public function getDealsIds() /** * Sets dealsIds * - * @param string[] $dealsIds Deal ids for deals a task is linked to + * @param string[]|null $dealsIds Deal ids for deals a task is linked to * * @return $this */ - public function setDealsIds($dealsIds) + public function setDealsIds(?array $dealsIds): static { + if (is_null($dealsIds)) { + throw new InvalidArgumentException('non-nullable dealsIds cannot be null'); + } $this->container['dealsIds'] = $dealsIds; return $this; @@ -364,9 +356,9 @@ public function setDealsIds($dealsIds) /** * Gets companiesIds * - * @return string[] + * @return string[]|null */ - public function getCompaniesIds() + public function getCompaniesIds(): ?array { return $this->container['companiesIds']; } @@ -374,89 +366,19 @@ public function getCompaniesIds() /** * Sets companiesIds * - * @param string[] $companiesIds Companies ids for companies a task is linked to + * @param string[]|null $companiesIds Companies ids for companies a task is linked to * * @return $this */ - public function setCompaniesIds($companiesIds) + public function setCompaniesIds(?array $companiesIds): static { + if (is_null($companiesIds)) { + throw new InvalidArgumentException('non-nullable companiesIds cannot be null'); + } $this->container['companiesIds'] = $companiesIds; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/TaskList.php b/lib/Models/TaskList.php index 8589d53..d45c011 100644 --- a/lib/Models/TaskList.php +++ b/lib/Models/TaskList.php @@ -2,119 +2,117 @@ /** * TaskList * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * TaskList Class Doc Comment * - * @category Class * @description List of tasks * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class TaskList implements ModelInterface, ArrayAccess +class TaskList extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TaskList'; + protected static string $openAPIModelName = 'TaskList'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'items' => '\Brevo\Client\Models\Task[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'items' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'items' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'items' => 'items' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'items' => 'setItems' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'items' => 'getItems' ]; @@ -122,9 +120,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -132,9 +130,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -142,75 +140,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['items'] = isset($data['items']) ? $data['items'] : null; + $this->setIfExists('items', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets items * - * @return \Brevo\Client\Models\Task[] + * @return \Brevo\Client\Models\Task[]|null */ - public function getItems() + public function getItems(): ?array { return $this->container['items']; } @@ -218,89 +190,19 @@ public function getItems() /** * Sets items * - * @param \Brevo\Client\Models\Task[] $items List of tasks + * @param \Brevo\Client\Models\Task[]|null $items List of tasks * * @return $this */ - public function setItems($items) + public function setItems(?array $items): static { + if (is_null($items)) { + throw new InvalidArgumentException('non-nullable items cannot be null'); + } $this->container['items'] = $items; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/TaskReminder.php b/lib/Models/TaskReminder.php index 3312fe7..d5fd220 100644 --- a/lib/Models/TaskReminder.php +++ b/lib/Models/TaskReminder.php @@ -2,62 +2,64 @@ /** * TaskReminder * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * TaskReminder Class Doc Comment * - * @category Class * @description Task reminder date/time for a task * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class TaskReminder implements ModelInterface, ArrayAccess +class TaskReminder extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TaskReminder'; + protected static string $openAPIModelName = 'TaskReminder'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'value' => 'int', 'unit' => 'string', 'types' => 'string[]' @@ -66,41 +68,39 @@ class TaskReminder implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'value' => null, 'unit' => null, 'types' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'value' => false, + 'unit' => false, + 'types' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'value' => 'value', 'unit' => 'unit', 'types' => 'types' @@ -109,9 +109,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'value' => 'setValue', 'unit' => 'setUnit', 'types' => 'setTypes' @@ -120,9 +120,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'value' => 'getValue', 'unit' => 'getUnit', 'types' => 'getTypes' @@ -132,9 +132,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -142,9 +142,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -152,29 +152,19 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const UNIT_MINUTES = 'minutes'; - const UNIT_HOURS = 'hours'; - const UNIT_WEEKS = 'weeks'; - const UNIT_DAYS = 'days'; - - + public const UNIT_MINUTES = 'minutes'; + public const UNIT_HOURS = 'hours'; + public const UNIT_WEEKS = 'weeks'; + public const UNIT_DAYS = 'days'; + public const TYPES_EMAIL = 'email'; + public const TYPES_PUSH = 'push'; /** * Gets allowable values of the enum @@ -191,33 +181,44 @@ public function getUnitAllowableValues() ]; } + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypesAllowableValues() + { + return [ + self::TYPES_EMAIL, + self::TYPES_PUSH, + ]; + } /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['value'] = isset($data['value']) ? $data['value'] : null; - $this->container['unit'] = isset($data['unit']) ? $data['unit'] : null; - $this->container['types'] = isset($data['types']) ? $data['types'] : null; + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('unit', $data ?? [], null); + $this->setIfExists('types', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -230,7 +231,8 @@ public function listInvalidProperties() $allowedValues = $this->getUnitAllowableValues(); if (!is_null($this->container['unit']) && !in_array($this->container['unit'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'unit', must be one of '%s'", + "invalid value '%s' for 'unit', must be one of '%s'", + $this->container['unit'], implode("', '", $allowedValues) ); } @@ -241,24 +243,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets value * * @return int */ - public function getValue() + public function getValue(): int { return $this->container['value']; } @@ -270,8 +260,11 @@ public function getValue() * * @return $this */ - public function setValue($value) + public function setValue(int $value): static { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -282,7 +275,7 @@ public function setValue($value) * * @return string */ - public function getUnit() + public function getUnit(): string { return $this->container['unit']; } @@ -294,13 +287,17 @@ public function getUnit() * * @return $this */ - public function setUnit($unit) + public function setUnit(string $unit): static { + if (is_null($unit)) { + throw new InvalidArgumentException('non-nullable unit cannot be null'); + } $allowedValues = $this->getUnitAllowableValues(); if (!in_array($unit, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( - "Invalid value for 'unit', must be one of '%s'", + "Invalid value '%s' for 'unit', must be one of '%s'", + $unit, implode("', '", $allowedValues) ) ); @@ -315,7 +312,7 @@ public function setUnit($unit) * * @return string[] */ - public function getTypes() + public function getTypes(): array { return $this->container['types']; } @@ -327,84 +324,23 @@ public function getTypes() * * @return $this */ - public function setTypes($types) - { - $this->container['types'] = $types; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) + public function setTypes(array $types): static { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; + if (is_null($types)) { + throw new InvalidArgumentException('non-nullable types cannot be null'); } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + $allowedValues = $this->getTypesAllowableValues(); + if (array_diff($types, $allowedValues)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value for 'types', must be one of '%s'", + implode("', '", $allowedValues) + ) ); } + $this->container['types'] = $types; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/TaskTypes.php b/lib/Models/TaskTypes.php index 3bb56ef..ee0b86e 100644 --- a/lib/Models/TaskTypes.php +++ b/lib/Models/TaskTypes.php @@ -2,62 +2,64 @@ /** * TaskTypes * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * TaskTypes Class Doc Comment * - * @category Class * @description Task types details * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class TaskTypes implements ModelInterface, ArrayAccess +class TaskTypes extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TaskTypes'; + protected static string $openAPIModelName = 'TaskTypes'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'id' => 'string', 'title' => 'string' ]; @@ -65,40 +67,37 @@ class TaskTypes implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'id' => null, 'title' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'title' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'title' => 'title' ]; @@ -106,9 +105,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'title' => 'setTitle' ]; @@ -116,9 +115,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'title' => 'getTitle' ]; @@ -127,9 +126,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -137,9 +136,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -147,76 +146,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['title'] = isset($data['title']) ? $data['title'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets id * - * @return string + * @return string|null */ - public function getId() + public function getId(): ?string { return $this->container['id']; } @@ -224,12 +197,15 @@ public function getId() /** * Sets id * - * @param string $id Id of task type + * @param string|null $id Id of task type * * @return $this */ - public function setId($id) + public function setId(?string $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -238,9 +214,9 @@ public function setId($id) /** * Gets title * - * @return string + * @return string|null */ - public function getTitle() + public function getTitle(): ?string { return $this->container['title']; } @@ -248,89 +224,19 @@ public function getTitle() /** * Sets title * - * @param string $title Title of task type + * @param string|null $title Title of task type * * @return $this */ - public function setTitle($title) + public function setTitle(?string $title): static { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } $this->container['title'] = $title; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/Tier.php b/lib/Models/Tier.php new file mode 100644 index 0000000..f69b09c --- /dev/null +++ b/lib/Models/Tier.php @@ -0,0 +1,479 @@ + + */ +class Tier extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'tier'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'tierId' => 'string', + 'name' => 'string', + 'imageRef' => 'string', + 'loyaltyProgramId' => 'string', + 'groupId' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'accessConditions' => '\Brevo\Client\Models\TierAccessConditionsInner[]', + 'tierRewards' => '\Brevo\Client\Models\TierTierRewardsInner[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'tierId' => 'uuid', + 'name' => null, + 'imageRef' => null, + 'loyaltyProgramId' => 'uuid', + 'groupId' => 'uuid', + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'accessConditions' => null, + 'tierRewards' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'tierId' => false, + 'name' => false, + 'imageRef' => false, + 'loyaltyProgramId' => false, + 'groupId' => false, + 'createdAt' => false, + 'updatedAt' => false, + 'accessConditions' => false, + 'tierRewards' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'tierId' => 'tierId', + 'name' => 'name', + 'imageRef' => 'imageRef', + 'loyaltyProgramId' => 'loyaltyProgramId', + 'groupId' => 'groupId', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt', + 'accessConditions' => 'accessConditions', + 'tierRewards' => 'tierRewards' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'tierId' => 'setTierId', + 'name' => 'setName', + 'imageRef' => 'setImageRef', + 'loyaltyProgramId' => 'setLoyaltyProgramId', + 'groupId' => 'setGroupId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'accessConditions' => 'setAccessConditions', + 'tierRewards' => 'setTierRewards' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'tierId' => 'getTierId', + 'name' => 'getName', + 'imageRef' => 'getImageRef', + 'loyaltyProgramId' => 'getLoyaltyProgramId', + 'groupId' => 'getGroupId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'accessConditions' => 'getAccessConditions', + 'tierRewards' => 'getTierRewards' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('tierId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('imageRef', $data ?? [], null); + $this->setIfExists('loyaltyProgramId', $data ?? [], null); + $this->setIfExists('groupId', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('accessConditions', $data ?? [], null); + $this->setIfExists('tierRewards', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets tierId + * + * @return string|null + */ + public function getTierId(): ?string + { + return $this->container['tierId']; + } + + /** + * Sets tierId + * + * @param string|null $tierId Tier id + * + * @return $this + */ + public function setTierId(?string $tierId): static + { + if (is_null($tierId)) { + throw new InvalidArgumentException('non-nullable tierId cannot be null'); + } + $this->container['tierId'] = $tierId; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Tier name + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets imageRef + * + * @return string|null + */ + public function getImageRef(): ?string + { + return $this->container['imageRef']; + } + + /** + * Sets imageRef + * + * @param string|null $imageRef Tier image reference + * + * @return $this + */ + public function setImageRef(?string $imageRef): static + { + if (is_null($imageRef)) { + throw new InvalidArgumentException('non-nullable imageRef cannot be null'); + } + $this->container['imageRef'] = $imageRef; + + return $this; + } + + /** + * Gets loyaltyProgramId + * + * @return string|null + */ + public function getLoyaltyProgramId(): ?string + { + return $this->container['loyaltyProgramId']; + } + + /** + * Sets loyaltyProgramId + * + * @param string|null $loyaltyProgramId Associated loyalty program Id + * + * @return $this + */ + public function setLoyaltyProgramId(?string $loyaltyProgramId): static + { + if (is_null($loyaltyProgramId)) { + throw new InvalidArgumentException('non-nullable loyaltyProgramId cannot be null'); + } + $this->container['loyaltyProgramId'] = $loyaltyProgramId; + + return $this; + } + + /** + * Gets groupId + * + * @return string|null + */ + public function getGroupId(): ?string + { + return $this->container['groupId']; + } + + /** + * Sets groupId + * + * @param string|null $groupId Associated group Id + * + * @return $this + */ + public function setGroupId(?string $groupId): static + { + if (is_null($groupId)) { + throw new InvalidArgumentException('non-nullable groupId cannot be null'); + } + $this->container['groupId'] = $groupId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt createdAt + * + * @return $this + */ + public function setCreatedAt(?\DateTime $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt(): ?\DateTime + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt updatedAt + * + * @return $this + */ + public function setUpdatedAt(?\DateTime $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets accessConditions + * + * @return \Brevo\Client\Models\TierAccessConditionsInner[]|null + */ + public function getAccessConditions(): ?array + { + return $this->container['accessConditions']; + } + + /** + * Sets accessConditions + * + * @param \Brevo\Client\Models\TierAccessConditionsInner[]|null $accessConditions Conditions required to access this tier + * + * @return $this + */ + public function setAccessConditions(?array $accessConditions): static + { + if (is_null($accessConditions)) { + throw new InvalidArgumentException('non-nullable accessConditions cannot be null'); + } + $this->container['accessConditions'] = $accessConditions; + + return $this; + } + + /** + * Gets tierRewards + * + * @return \Brevo\Client\Models\TierTierRewardsInner[]|null + */ + public function getTierRewards(): ?array + { + return $this->container['tierRewards']; + } + + /** + * Sets tierRewards + * + * @param \Brevo\Client\Models\TierTierRewardsInner[]|null $tierRewards Rewards associated with this tier + * + * @return $this + */ + public function setTierRewards(?array $tierRewards): static + { + if (is_null($tierRewards)) { + throw new InvalidArgumentException('non-nullable tierRewards cannot be null'); + } + $this->container['tierRewards'] = $tierRewards; + + return $this; + } +} + + diff --git a/lib/Models/TierAccessConditionsInner.php b/lib/Models/TierAccessConditionsInner.php new file mode 100644 index 0000000..b203e9c --- /dev/null +++ b/lib/Models/TierAccessConditionsInner.php @@ -0,0 +1,309 @@ + + */ +class TierAccessConditionsInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'tier_accessConditions_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'balanceDefinitionId' => 'string', + 'minimumValue' => 'int', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'balanceDefinitionId' => 'uuid', + 'minimumValue' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'balanceDefinitionId' => false, + 'minimumValue' => false, + 'createdAt' => false, + 'updatedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'balanceDefinitionId' => 'balanceDefinitionId', + 'minimumValue' => 'minimumValue', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'balanceDefinitionId' => 'setBalanceDefinitionId', + 'minimumValue' => 'setMinimumValue', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'balanceDefinitionId' => 'getBalanceDefinitionId', + 'minimumValue' => 'getMinimumValue', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('balanceDefinitionId', $data ?? [], null); + $this->setIfExists('minimumValue', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets balanceDefinitionId + * + * @return string|null + */ + public function getBalanceDefinitionId(): ?string + { + return $this->container['balanceDefinitionId']; + } + + /** + * Sets balanceDefinitionId + * + * @param string|null $balanceDefinitionId Balance definition identifier + * + * @return $this + */ + public function setBalanceDefinitionId(?string $balanceDefinitionId): static + { + if (is_null($balanceDefinitionId)) { + throw new InvalidArgumentException('non-nullable balanceDefinitionId cannot be null'); + } + $this->container['balanceDefinitionId'] = $balanceDefinitionId; + + return $this; + } + + /** + * Gets minimumValue + * + * @return int|null + */ + public function getMinimumValue(): ?int + { + return $this->container['minimumValue']; + } + + /** + * Sets minimumValue + * + * @param int|null $minimumValue Minimum value required to access this tier + * + * @return $this + */ + public function setMinimumValue(?int $minimumValue): static + { + if (is_null($minimumValue)) { + throw new InvalidArgumentException('non-nullable minimumValue cannot be null'); + } + $this->container['minimumValue'] = $minimumValue; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt createdAt + * + * @return $this + */ + public function setCreatedAt(?\DateTime $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt(): ?\DateTime + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt updatedAt + * + * @return $this + */ + public function setUpdatedAt(?\DateTime $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } +} + + diff --git a/lib/Models/TierForContact.php b/lib/Models/TierForContact.php new file mode 100644 index 0000000..452f03b --- /dev/null +++ b/lib/Models/TierForContact.php @@ -0,0 +1,377 @@ + + */ +class TierForContact extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'tierForContact'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'tierId' => 'string', + 'loyaltyProgramId' => 'string', + 'groupId' => 'string', + 'contactId' => 'int', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'tierId' => 'uuid', + 'loyaltyProgramId' => 'uuid', + 'groupId' => 'uuid', + 'contactId' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'tierId' => false, + 'loyaltyProgramId' => false, + 'groupId' => false, + 'contactId' => false, + 'createdAt' => false, + 'updatedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'tierId' => 'tierId', + 'loyaltyProgramId' => 'loyaltyProgramId', + 'groupId' => 'groupId', + 'contactId' => 'contactId', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'tierId' => 'setTierId', + 'loyaltyProgramId' => 'setLoyaltyProgramId', + 'groupId' => 'setGroupId', + 'contactId' => 'setContactId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'tierId' => 'getTierId', + 'loyaltyProgramId' => 'getLoyaltyProgramId', + 'groupId' => 'getGroupId', + 'contactId' => 'getContactId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('tierId', $data ?? [], null); + $this->setIfExists('loyaltyProgramId', $data ?? [], null); + $this->setIfExists('groupId', $data ?? [], null); + $this->setIfExists('contactId', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets tierId + * + * @return string|null + */ + public function getTierId(): ?string + { + return $this->container['tierId']; + } + + /** + * Sets tierId + * + * @param string|null $tierId Unique identifier for the assigned tier + * + * @return $this + */ + public function setTierId(?string $tierId): static + { + if (is_null($tierId)) { + throw new InvalidArgumentException('non-nullable tierId cannot be null'); + } + $this->container['tierId'] = $tierId; + + return $this; + } + + /** + * Gets loyaltyProgramId + * + * @return string|null + */ + public function getLoyaltyProgramId(): ?string + { + return $this->container['loyaltyProgramId']; + } + + /** + * Sets loyaltyProgramId + * + * @param string|null $loyaltyProgramId Associated loyalty program Id + * + * @return $this + */ + public function setLoyaltyProgramId(?string $loyaltyProgramId): static + { + if (is_null($loyaltyProgramId)) { + throw new InvalidArgumentException('non-nullable loyaltyProgramId cannot be null'); + } + $this->container['loyaltyProgramId'] = $loyaltyProgramId; + + return $this; + } + + /** + * Gets groupId + * + * @return string|null + */ + public function getGroupId(): ?string + { + return $this->container['groupId']; + } + + /** + * Sets groupId + * + * @param string|null $groupId Group Id to which the tier is associated + * + * @return $this + */ + public function setGroupId(?string $groupId): static + { + if (is_null($groupId)) { + throw new InvalidArgumentException('non-nullable groupId cannot be null'); + } + $this->container['groupId'] = $groupId; + + return $this; + } + + /** + * Gets contactId + * + * @return int|null + */ + public function getContactId(): ?int + { + return $this->container['contactId']; + } + + /** + * Sets contactId + * + * @param int|null $contactId Contact to which the tier is assigned + * + * @return $this + */ + public function setContactId(?int $contactId): static + { + if (is_null($contactId)) { + throw new InvalidArgumentException('non-nullable contactId cannot be null'); + } + $this->container['contactId'] = $contactId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt createdAt + * + * @return $this + */ + public function setCreatedAt(?\DateTime $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt(): ?\DateTime + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt updatedAt + * + * @return $this + */ + public function setUpdatedAt(?\DateTime $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } +} + + diff --git a/lib/Models/TierGroup.php b/lib/Models/TierGroup.php new file mode 100644 index 0000000..e6b8652 --- /dev/null +++ b/lib/Models/TierGroup.php @@ -0,0 +1,513 @@ + + */ +class TierGroup extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'tierGroup'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'tierOrder' => 'string[]', + 'loyaltyProgramId' => 'string', + 'upgradeStrategy' => 'string', + 'downgradeStrategy' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'uuid', + 'name' => null, + 'tierOrder' => 'uuid', + 'loyaltyProgramId' => 'uuid', + 'upgradeStrategy' => null, + 'downgradeStrategy' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'tierOrder' => false, + 'loyaltyProgramId' => false, + 'upgradeStrategy' => false, + 'downgradeStrategy' => false, + 'createdAt' => false, + 'updatedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'tierOrder' => 'tierOrder', + 'loyaltyProgramId' => 'loyaltyProgramId', + 'upgradeStrategy' => 'upgradeStrategy', + 'downgradeStrategy' => 'downgradeStrategy', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'tierOrder' => 'setTierOrder', + 'loyaltyProgramId' => 'setLoyaltyProgramId', + 'upgradeStrategy' => 'setUpgradeStrategy', + 'downgradeStrategy' => 'setDowngradeStrategy', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'tierOrder' => 'getTierOrder', + 'loyaltyProgramId' => 'getLoyaltyProgramId', + 'upgradeStrategy' => 'getUpgradeStrategy', + 'downgradeStrategy' => 'getDowngradeStrategy', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const UPGRADE_STRATEGY_REAL_TIME = 'real_time'; + public const UPGRADE_STRATEGY_ANNIVERSARY = 'anniversary'; + public const DOWNGRADE_STRATEGY_REAL_TIME = 'real_time'; + public const DOWNGRADE_STRATEGY_ANNIVERSARY = 'anniversary'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getUpgradeStrategyAllowableValues() + { + return [ + self::UPGRADE_STRATEGY_REAL_TIME, + self::UPGRADE_STRATEGY_ANNIVERSARY, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDowngradeStrategyAllowableValues() + { + return [ + self::DOWNGRADE_STRATEGY_REAL_TIME, + self::DOWNGRADE_STRATEGY_ANNIVERSARY, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('tierOrder', $data ?? [], null); + $this->setIfExists('loyaltyProgramId', $data ?? [], null); + $this->setIfExists('upgradeStrategy', $data ?? [], 'real_time'); + $this->setIfExists('downgradeStrategy', $data ?? [], 'real_time'); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = $this->getUpgradeStrategyAllowableValues(); + if (!is_null($this->container['upgradeStrategy']) && !in_array($this->container['upgradeStrategy'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'upgradeStrategy', must be one of '%s'", + $this->container['upgradeStrategy'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDowngradeStrategyAllowableValues(); + if (!is_null($this->container['downgradeStrategy']) && !in_array($this->container['downgradeStrategy'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'downgradeStrategy', must be one of '%s'", + $this->container['downgradeStrategy'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Tier group unique identifier + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Tier group name + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets tierOrder + * + * @return string[]|null + */ + public function getTierOrder(): ?array + { + return $this->container['tierOrder']; + } + + /** + * Sets tierOrder + * + * @param string[]|null $tierOrder Order of the tiers in the group in ascending order + * + * @return $this + */ + public function setTierOrder(?array $tierOrder): static + { + if (is_null($tierOrder)) { + throw new InvalidArgumentException('non-nullable tierOrder cannot be null'); + } + $this->container['tierOrder'] = $tierOrder; + + return $this; + } + + /** + * Gets loyaltyProgramId + * + * @return string|null + */ + public function getLoyaltyProgramId(): ?string + { + return $this->container['loyaltyProgramId']; + } + + /** + * Sets loyaltyProgramId + * + * @param string|null $loyaltyProgramId Associated loyalty program Id + * + * @return $this + */ + public function setLoyaltyProgramId(?string $loyaltyProgramId): static + { + if (is_null($loyaltyProgramId)) { + throw new InvalidArgumentException('non-nullable loyaltyProgramId cannot be null'); + } + $this->container['loyaltyProgramId'] = $loyaltyProgramId; + + return $this; + } + + /** + * Gets upgradeStrategy + * + * @return string|null + */ + public function getUpgradeStrategy(): ?string + { + return $this->container['upgradeStrategy']; + } + + /** + * Sets upgradeStrategy + * + * @param string|null $upgradeStrategy Select real_time to upgrade tier on real time balance updates. Select anniversary to upgrade tier on subscription anniversary. + * + * @return $this + */ + public function setUpgradeStrategy(?string $upgradeStrategy): static + { + if (is_null($upgradeStrategy)) { + throw new InvalidArgumentException('non-nullable upgradeStrategy cannot be null'); + } + $allowedValues = $this->getUpgradeStrategyAllowableValues(); + if (!in_array($upgradeStrategy, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'upgradeStrategy', must be one of '%s'", + $upgradeStrategy, + implode("', '", $allowedValues) + ) + ); + } + $this->container['upgradeStrategy'] = $upgradeStrategy; + + return $this; + } + + /** + * Gets downgradeStrategy + * + * @return string|null + */ + public function getDowngradeStrategy(): ?string + { + return $this->container['downgradeStrategy']; + } + + /** + * Sets downgradeStrategy + * + * @param string|null $downgradeStrategy Select real_time to downgrade tier on real time balance updates. Select anniversary to downgrade tier on subscription anniversary. + * + * @return $this + */ + public function setDowngradeStrategy(?string $downgradeStrategy): static + { + if (is_null($downgradeStrategy)) { + throw new InvalidArgumentException('non-nullable downgradeStrategy cannot be null'); + } + $allowedValues = $this->getDowngradeStrategyAllowableValues(); + if (!in_array($downgradeStrategy, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'downgradeStrategy', must be one of '%s'", + $downgradeStrategy, + implode("', '", $allowedValues) + ) + ); + } + $this->container['downgradeStrategy'] = $downgradeStrategy; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp when the tier group was created + * + * @return $this + */ + public function setCreatedAt(?\DateTime $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt(): ?\DateTime + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp when the tier group was last updated + * + * @return $this + */ + public function setUpdatedAt(?\DateTime $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } +} + + diff --git a/lib/Models/TierGroupPage.php b/lib/Models/TierGroupPage.php new file mode 100644 index 0000000..bfc725b --- /dev/null +++ b/lib/Models/TierGroupPage.php @@ -0,0 +1,207 @@ + + */ +class TierGroupPage extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'tierGroupPage'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'items' => '\Brevo\Client\Models\TierGroup[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'items' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'items' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'items' => 'items' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'items' => 'setItems' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'items' => 'getItems' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('items', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets items + * + * @return \Brevo\Client\Models\TierGroup[]|null + */ + public function getItems(): ?array + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \Brevo\Client\Models\TierGroup[]|null $items items + * + * @return $this + */ + public function setItems(?array $items): static + { + if (is_null($items)) { + throw new InvalidArgumentException('non-nullable items cannot be null'); + } + $this->container['items'] = $items; + + return $this; + } +} + + diff --git a/lib/Models/TierRequest.php b/lib/Models/TierRequest.php new file mode 100644 index 0000000..8c6dd64 --- /dev/null +++ b/lib/Models/TierRequest.php @@ -0,0 +1,281 @@ + + */ +class TierRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'tierRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'accessConditions' => '\Brevo\Client\Models\TierRequestAccessConditionsInner[]', + 'tierRewards' => '\Brevo\Client\Models\TierRequestTierRewardsInner[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'accessConditions' => null, + 'tierRewards' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'accessConditions' => false, + 'tierRewards' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'accessConditions' => 'accessConditions', + 'tierRewards' => 'tierRewards' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'accessConditions' => 'setAccessConditions', + 'tierRewards' => 'setTierRewards' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'accessConditions' => 'getAccessConditions', + 'tierRewards' => 'getTierRewards' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('accessConditions', $data ?? [], null); + $this->setIfExists('tierRewards', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['accessConditions'] === null) { + $invalidProperties[] = "'accessConditions' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Name of the tier to be created + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets accessConditions + * + * @return \Brevo\Client\Models\TierRequestAccessConditionsInner[] + */ + public function getAccessConditions(): array + { + return $this->container['accessConditions']; + } + + /** + * Sets accessConditions + * + * @param \Brevo\Client\Models\TierRequestAccessConditionsInner[] $accessConditions accessConditions + * + * @return $this + */ + public function setAccessConditions(array $accessConditions): static + { + if (is_null($accessConditions)) { + throw new InvalidArgumentException('non-nullable accessConditions cannot be null'); + } + $this->container['accessConditions'] = $accessConditions; + + return $this; + } + + /** + * Gets tierRewards + * + * @return \Brevo\Client\Models\TierRequestTierRewardsInner[]|null + */ + public function getTierRewards(): ?array + { + return $this->container['tierRewards']; + } + + /** + * Sets tierRewards + * + * @param \Brevo\Client\Models\TierRequestTierRewardsInner[]|null $tierRewards tierRewards + * + * @return $this + */ + public function setTierRewards(?array $tierRewards): static + { + if (is_null($tierRewards)) { + throw new InvalidArgumentException('non-nullable tierRewards cannot be null'); + } + $this->container['tierRewards'] = $tierRewards; + + return $this; + } +} + + diff --git a/lib/Models/TierRequestAccessConditionsInner.php b/lib/Models/TierRequestAccessConditionsInner.php new file mode 100644 index 0000000..6359a05 --- /dev/null +++ b/lib/Models/TierRequestAccessConditionsInner.php @@ -0,0 +1,241 @@ + + */ +class TierRequestAccessConditionsInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'tierRequest_accessConditions_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'balanceDefinitionId' => 'string', + 'minimumValue' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'balanceDefinitionId' => 'uuid', + 'minimumValue' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'balanceDefinitionId' => false, + 'minimumValue' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'balanceDefinitionId' => 'balanceDefinitionId', + 'minimumValue' => 'minimumValue' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'balanceDefinitionId' => 'setBalanceDefinitionId', + 'minimumValue' => 'setMinimumValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'balanceDefinitionId' => 'getBalanceDefinitionId', + 'minimumValue' => 'getMinimumValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('balanceDefinitionId', $data ?? [], null); + $this->setIfExists('minimumValue', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets balanceDefinitionId + * + * @return string|null + */ + public function getBalanceDefinitionId(): ?string + { + return $this->container['balanceDefinitionId']; + } + + /** + * Sets balanceDefinitionId + * + * @param string|null $balanceDefinitionId Balance definition identifier for accessing the tier + * + * @return $this + */ + public function setBalanceDefinitionId(?string $balanceDefinitionId): static + { + if (is_null($balanceDefinitionId)) { + throw new InvalidArgumentException('non-nullable balanceDefinitionId cannot be null'); + } + $this->container['balanceDefinitionId'] = $balanceDefinitionId; + + return $this; + } + + /** + * Gets minimumValue + * + * @return int|null + */ + public function getMinimumValue(): ?int + { + return $this->container['minimumValue']; + } + + /** + * Sets minimumValue + * + * @param int|null $minimumValue Minimum value required to access the tier + * + * @return $this + */ + public function setMinimumValue(?int $minimumValue): static + { + if (is_null($minimumValue)) { + throw new InvalidArgumentException('non-nullable minimumValue cannot be null'); + } + $this->container['minimumValue'] = $minimumValue; + + return $this; + } +} + + diff --git a/lib/Models/TierRequestTierRewardsInner.php b/lib/Models/TierRequestTierRewardsInner.php new file mode 100644 index 0000000..a9c1f94 --- /dev/null +++ b/lib/Models/TierRequestTierRewardsInner.php @@ -0,0 +1,207 @@ + + */ +class TierRequestTierRewardsInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'tierRequest_tierRewards_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'rewardId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'rewardId' => 'uuid' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'rewardId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'rewardId' => 'rewardId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'rewardId' => 'setRewardId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'rewardId' => 'getRewardId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('rewardId', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets rewardId + * + * @return string|null + */ + public function getRewardId(): ?string + { + return $this->container['rewardId']; + } + + /** + * Sets rewardId + * + * @param string|null $rewardId Reward unique identifier + * + * @return $this + */ + public function setRewardId(?string $rewardId): static + { + if (is_null($rewardId)) { + throw new InvalidArgumentException('non-nullable rewardId cannot be null'); + } + $this->container['rewardId'] = $rewardId; + + return $this; + } +} + + diff --git a/lib/Models/TierTierRewardsInner.php b/lib/Models/TierTierRewardsInner.php new file mode 100644 index 0000000..7952c64 --- /dev/null +++ b/lib/Models/TierTierRewardsInner.php @@ -0,0 +1,275 @@ + + */ +class TierTierRewardsInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'tier_tierRewards_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'rewardId' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'rewardId' => 'uuid', + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'rewardId' => false, + 'createdAt' => false, + 'updatedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'rewardId' => 'rewardId', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'rewardId' => 'setRewardId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'rewardId' => 'getRewardId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('rewardId', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets rewardId + * + * @return string|null + */ + public function getRewardId(): ?string + { + return $this->container['rewardId']; + } + + /** + * Sets rewardId + * + * @param string|null $rewardId Reward to be attributed on tier assignment + * + * @return $this + */ + public function setRewardId(?string $rewardId): static + { + if (is_null($rewardId)) { + throw new InvalidArgumentException('non-nullable rewardId cannot be null'); + } + $this->container['rewardId'] = $rewardId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt createdAt + * + * @return $this + */ + public function setCreatedAt(?\DateTime $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt(): ?\DateTime + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt updatedAt + * + * @return $this + */ + public function setUpdatedAt(?\DateTime $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } +} + + diff --git a/lib/Models/Transaction.php b/lib/Models/Transaction.php new file mode 100644 index 0000000..604019c --- /dev/null +++ b/lib/Models/Transaction.php @@ -0,0 +1,587 @@ + + */ +class Transaction extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'transaction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'status' => 'string', + 'amount' => 'float', + 'meta' => 'object', + 'rejectedAt' => '\DateTime', + 'rejectReason' => 'string', + 'expirationDate' => '\DateTime', + 'completedAt' => '\DateTime', + 'cancelledAt' => '\DateTime', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'uuid', + 'status' => null, + 'amount' => null, + 'meta' => null, + 'rejectedAt' => 'date-time', + 'rejectReason' => null, + 'expirationDate' => 'date-time', + 'completedAt' => 'date-time', + 'cancelledAt' => 'date-time', + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'status' => false, + 'amount' => false, + 'meta' => false, + 'rejectedAt' => false, + 'rejectReason' => false, + 'expirationDate' => false, + 'completedAt' => false, + 'cancelledAt' => false, + 'createdAt' => false, + 'updatedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'status' => 'status', + 'amount' => 'amount', + 'meta' => 'meta', + 'rejectedAt' => 'rejectedAt', + 'rejectReason' => 'rejectReason', + 'expirationDate' => 'expirationDate', + 'completedAt' => 'completedAt', + 'cancelledAt' => 'cancelledAt', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'status' => 'setStatus', + 'amount' => 'setAmount', + 'meta' => 'setMeta', + 'rejectedAt' => 'setRejectedAt', + 'rejectReason' => 'setRejectReason', + 'expirationDate' => 'setExpirationDate', + 'completedAt' => 'setCompletedAt', + 'cancelledAt' => 'setCancelledAt', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'status' => 'getStatus', + 'amount' => 'getAmount', + 'meta' => 'getMeta', + 'rejectedAt' => 'getRejectedAt', + 'rejectReason' => 'getRejectReason', + 'expirationDate' => 'getExpirationDate', + 'completedAt' => 'getCompletedAt', + 'cancelledAt' => 'getCancelledAt', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const STATUS_DRAFT = 'draft'; + public const STATUS_COMPLETE = 'complete'; + public const STATUS_CANCELLED = 'cancelled'; + public const STATUS_REJECTED = 'rejected'; + public const STATUS_EXPIRED = 'expired'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_DRAFT, + self::STATUS_COMPLETE, + self::STATUS_CANCELLED, + self::STATUS_REJECTED, + self::STATUS_EXPIRED, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('meta', $data ?? [], null); + $this->setIfExists('rejectedAt', $data ?? [], null); + $this->setIfExists('rejectReason', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('completedAt', $data ?? [], null); + $this->setIfExists('cancelledAt', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique identifier for the transaction. + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus(): ?string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Current status of the transaction, indicating its state (draft/complete/cancelled/rejected/expired) + * + * @return $this + */ + public function setStatus(?string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount(): ?float + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount The monetary value of the transaction. + * + * @return $this + */ + public function setAmount(?float $amount): static + { + if (is_null($amount)) { + throw new InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets meta + * + * @return object|null + */ + public function getMeta(): ?object + { + return $this->container['meta']; + } + + /** + * Sets meta + * + * @param object|null $meta Additional metadata related to the transaction. + * + * @return $this + */ + public function setMeta(?object $meta): static + { + if (is_null($meta)) { + throw new InvalidArgumentException('non-nullable meta cannot be null'); + } + $this->container['meta'] = $meta; + + return $this; + } + + /** + * Gets rejectedAt + * + * @return \DateTime|null + */ + public function getRejectedAt(): ?\DateTime + { + return $this->container['rejectedAt']; + } + + /** + * Sets rejectedAt + * + * @param \DateTime|null $rejectedAt Timestamp indicating when the transaction was rejected + * + * @return $this + */ + public function setRejectedAt(?\DateTime $rejectedAt): static + { + if (is_null($rejectedAt)) { + throw new InvalidArgumentException('non-nullable rejectedAt cannot be null'); + } + $this->container['rejectedAt'] = $rejectedAt; + + return $this; + } + + /** + * Gets rejectReason + * + * @return string|null + */ + public function getRejectReason(): ?string + { + return $this->container['rejectReason']; + } + + /** + * Sets rejectReason + * + * @param string|null $rejectReason Reason for rejecting the transaction + * + * @return $this + */ + public function setRejectReason(?string $rejectReason): static + { + if (is_null($rejectReason)) { + throw new InvalidArgumentException('non-nullable rejectReason cannot be null'); + } + $this->container['rejectReason'] = $rejectReason; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate(): ?\DateTime + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Date when the transaction expires if not completed. + * + * @return $this + */ + public function setExpirationDate(?\DateTime $expirationDate): static + { + if (is_null($expirationDate)) { + throw new InvalidArgumentException('non-nullable expirationDate cannot be null'); + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets completedAt + * + * @return \DateTime|null + */ + public function getCompletedAt(): ?\DateTime + { + return $this->container['completedAt']; + } + + /** + * Sets completedAt + * + * @param \DateTime|null $completedAt completedAt + * + * @return $this + */ + public function setCompletedAt(?\DateTime $completedAt): static + { + if (is_null($completedAt)) { + throw new InvalidArgumentException('non-nullable completedAt cannot be null'); + } + $this->container['completedAt'] = $completedAt; + + return $this; + } + + /** + * Gets cancelledAt + * + * @return \DateTime|null + */ + public function getCancelledAt(): ?\DateTime + { + return $this->container['cancelledAt']; + } + + /** + * Sets cancelledAt + * + * @param \DateTime|null $cancelledAt cancelledAt + * + * @return $this + */ + public function setCancelledAt(?\DateTime $cancelledAt): static + { + if (is_null($cancelledAt)) { + throw new InvalidArgumentException('non-nullable cancelledAt cannot be null'); + } + $this->container['cancelledAt'] = $cancelledAt; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt createdAt + * + * @return $this + */ + public function setCreatedAt(?\DateTime $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt(): ?\DateTime + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt updatedAt + * + * @return $this + */ + public function setUpdatedAt(?\DateTime $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } +} + + diff --git a/lib/Models/UnauthorizedResponse.php b/lib/Models/UnauthorizedResponse.php new file mode 100644 index 0000000..46223f0 --- /dev/null +++ b/lib/Models/UnauthorizedResponse.php @@ -0,0 +1,207 @@ + + */ +class UnauthorizedResponse extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'unauthorizedResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'error' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'error' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'error' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'error' => 'getError' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets error + * + * @return string|null + */ + public function getError(): ?string + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string|null $error Request Authentication Failed + * + * @return $this + */ + public function setError(?string $error): static + { + if (is_null($error)) { + throw new InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } +} + + diff --git a/lib/Models/UpdateAttribute.php b/lib/Models/UpdateAttribute.php index 0aa8bf3..aeadcbd 100644 --- a/lib/Models/UpdateAttribute.php +++ b/lib/Models/UpdateAttribute.php @@ -2,133 +2,138 @@ /** * UpdateAttribute * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * UpdateAttribute Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class UpdateAttribute implements ModelInterface, ArrayAccess +class UpdateAttribute extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'updateAttribute'; + protected static string $openAPIModelName = 'updateAttribute'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'value' => 'string', - 'enumeration' => '\Brevo\Client\Models\UpdateAttributeEnumeration[]' + 'enumeration' => '\Brevo\Client\Models\UpdateAttributeEnumerationInner[]', + 'multiCategoryOptions' => 'string[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'value' => null, - 'enumeration' => null + 'enumeration' => null, + 'multiCategoryOptions' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'value' => false, + 'enumeration' => false, + 'multiCategoryOptions' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'value' => 'value', - 'enumeration' => 'enumeration' + 'enumeration' => 'enumeration', + 'multiCategoryOptions' => 'multiCategoryOptions' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'value' => 'setValue', - 'enumeration' => 'setEnumeration' + 'enumeration' => 'setEnumeration', + 'multiCategoryOptions' => 'setMultiCategoryOptions' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'value' => 'getValue', - 'enumeration' => 'getEnumeration' + 'enumeration' => 'getEnumeration', + 'multiCategoryOptions' => 'getMultiCategoryOptions' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +141,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +151,51 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['value'] = isset($data['value']) ? $data['value'] : null; - $this->container['enumeration'] = isset($data['enumeration']) ? $data['enumeration'] : null; + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('enumeration', $data ?? [], null); + $this->setIfExists('multiCategoryOptions', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets value * - * @return string + * @return string|null */ - public function getValue() + public function getValue(): ?string { return $this->container['value']; } @@ -223,12 +203,15 @@ public function getValue() /** * Sets value * - * @param string $value Value of the attribute to update. Use only if the attribute's category is 'calculated' or 'global' + * @param string|null $value Value of the attribute to update. **Use only if the attribute's category is 'calculated' or 'global'** * * @return $this */ - public function setValue($value) + public function setValue(?string $value): static { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -237,9 +220,9 @@ public function setValue($value) /** * Gets enumeration * - * @return \Brevo\Client\Models\UpdateAttributeEnumeration[] + * @return \Brevo\Client\Models\UpdateAttributeEnumerationInner[]|null */ - public function getEnumeration() + public function getEnumeration(): ?array { return $this->container['enumeration']; } @@ -247,88 +230,45 @@ public function getEnumeration() /** * Sets enumeration * - * @param \Brevo\Client\Models\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\"}] + * @param \Brevo\Client\Models\UpdateAttributeEnumerationInner[]|null $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) + public function setEnumeration(?array $enumeration): static { + if (is_null($enumeration)) { + throw new InvalidArgumentException('non-nullable enumeration cannot be null'); + } $this->container['enumeration'] = $enumeration; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } /** - * Gets offset. - * - * @param integer $offset Offset + * Gets multiCategoryOptions * - * @return mixed + * @return string[]|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function getMultiCategoryOptions(): ?array { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container['multiCategoryOptions']; } /** - * Sets value based on offset. + * Sets multiCategoryOptions * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param string[]|null $multiCategoryOptions Use this option to add multiple-choice attributes options only if the attribute's category is \"normal\". **This option is specifically designed for updating multiple-choice attributes**. For example: **[\"USA\",\"INDIA\"]** * - * @return void - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string + * @return $this */ - public function __toString() + public function setMultiCategoryOptions(?array $multiCategoryOptions): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($multiCategoryOptions)) { + throw new InvalidArgumentException('non-nullable multiCategoryOptions cannot be null'); } + $this->container['multiCategoryOptions'] = $multiCategoryOptions; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/UpdateAttributeEnumeration.php b/lib/Models/UpdateAttributeEnumeration.php deleted file mode 100644 index 0e2b120..0000000 --- a/lib/Models/UpdateAttributeEnumeration.php +++ /dev/null @@ -1,341 +0,0 @@ - 'int', - 'label' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'value' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'value' => 'value', - 'label' => 'label' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'value' => 'setValue', - 'label' => 'setLabel' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'value' => 'getValue', - '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 - */ - public function __construct(array $data = null) - { - $this->container['value'] = isset($data['value']) ? $data['value'] : null; - $this->container['label'] = isset($data['label']) ? $data['label'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['value'] === null) { - $invalidProperties[] = "'value' can't be null"; - } - if ($this->container['label'] === null) { - $invalidProperties[] = "'label' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets value - * - * @return int - */ - public function getValue() - { - return $this->container['value']; - } - - /** - * Sets value - * - * @param int $value Id of the value - * - * @return $this - */ - public function setValue($value) - { - $this->container['value'] = $value; - - return $this; - } - - /** - * Gets label - * - * @return string - */ - public function getLabel() - { - return $this->container['label']; - } - - /** - * Sets label - * - * @param string $label Label of the value - * - * @return $this - */ - public function setLabel($label) - { - $this->container['label'] = $label; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/UpdateAttributeEnumerationInner.php b/lib/Models/UpdateAttributeEnumerationInner.php new file mode 100644 index 0000000..2e6014d --- /dev/null +++ b/lib/Models/UpdateAttributeEnumerationInner.php @@ -0,0 +1,247 @@ + + */ +class UpdateAttributeEnumerationInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'updateAttribute_enumeration_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'value' => 'int', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'value' => null, + 'label' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'value' => false, + 'label' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'value' => 'value', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'value' => 'setValue', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'value' => 'getValue', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets value + * + * @return int + */ + public function getValue(): int + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param int $value Id of the value + * + * @return $this + */ + public function setValue(int $value): static + { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets label + * + * @return string + */ + public function getLabel(): string + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string $label Label of the value + * + * @return $this + */ + public function setLabel(string $label): static + { + if (is_null($label)) { + throw new InvalidArgumentException('non-nullable label cannot be null'); + } + $this->container['label'] = $label; + + return $this; + } +} + + diff --git a/lib/Models/UpdateBalanceDefinitionPayload.php b/lib/Models/UpdateBalanceDefinitionPayload.php new file mode 100644 index 0000000..16a61cf --- /dev/null +++ b/lib/Models/UpdateBalanceDefinitionPayload.php @@ -0,0 +1,933 @@ + + */ +class UpdateBalanceDefinitionPayload extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'updateBalanceDefinitionPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'unit' => 'string', + 'description' => 'string', + 'meta' => 'object', + 'minAmount' => 'float', + 'maxAmount' => 'float', + 'maxCreditAmountLimit' => 'float', + 'maxDebitAmountLimit' => 'float', + 'balanceOptionAmountOvertakingStrategy' => 'string', + 'balanceOptionCreditRounding' => 'string', + 'balanceOptionDebitRounding' => 'string', + 'balanceAvailabilityDurationValue' => 'float', + 'balanceAvailabilityDurationUnit' => 'string', + 'balanceAvailabilityDurationModifier' => 'string', + 'balanceExpirationDate' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'unit' => null, + 'description' => null, + 'meta' => null, + 'minAmount' => null, + 'maxAmount' => null, + 'maxCreditAmountLimit' => null, + 'maxDebitAmountLimit' => null, + 'balanceOptionAmountOvertakingStrategy' => null, + 'balanceOptionCreditRounding' => null, + 'balanceOptionDebitRounding' => null, + 'balanceAvailabilityDurationValue' => null, + 'balanceAvailabilityDurationUnit' => null, + 'balanceAvailabilityDurationModifier' => null, + 'balanceExpirationDate' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'unit' => false, + 'description' => false, + 'meta' => false, + 'minAmount' => false, + 'maxAmount' => false, + 'maxCreditAmountLimit' => false, + 'maxDebitAmountLimit' => false, + 'balanceOptionAmountOvertakingStrategy' => false, + 'balanceOptionCreditRounding' => false, + 'balanceOptionDebitRounding' => false, + 'balanceAvailabilityDurationValue' => false, + 'balanceAvailabilityDurationUnit' => false, + 'balanceAvailabilityDurationModifier' => false, + 'balanceExpirationDate' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'unit' => 'unit', + 'description' => 'description', + 'meta' => 'meta', + 'minAmount' => 'minAmount', + 'maxAmount' => 'maxAmount', + 'maxCreditAmountLimit' => 'maxCreditAmountLimit', + 'maxDebitAmountLimit' => 'maxDebitAmountLimit', + 'balanceOptionAmountOvertakingStrategy' => 'balanceOptionAmountOvertakingStrategy', + 'balanceOptionCreditRounding' => 'balanceOptionCreditRounding', + 'balanceOptionDebitRounding' => 'balanceOptionDebitRounding', + 'balanceAvailabilityDurationValue' => 'balanceAvailabilityDurationValue', + 'balanceAvailabilityDurationUnit' => 'balanceAvailabilityDurationUnit', + 'balanceAvailabilityDurationModifier' => 'balanceAvailabilityDurationModifier', + 'balanceExpirationDate' => 'balanceExpirationDate' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'unit' => 'setUnit', + 'description' => 'setDescription', + 'meta' => 'setMeta', + 'minAmount' => 'setMinAmount', + 'maxAmount' => 'setMaxAmount', + 'maxCreditAmountLimit' => 'setMaxCreditAmountLimit', + 'maxDebitAmountLimit' => 'setMaxDebitAmountLimit', + 'balanceOptionAmountOvertakingStrategy' => 'setBalanceOptionAmountOvertakingStrategy', + 'balanceOptionCreditRounding' => 'setBalanceOptionCreditRounding', + 'balanceOptionDebitRounding' => 'setBalanceOptionDebitRounding', + 'balanceAvailabilityDurationValue' => 'setBalanceAvailabilityDurationValue', + 'balanceAvailabilityDurationUnit' => 'setBalanceAvailabilityDurationUnit', + 'balanceAvailabilityDurationModifier' => 'setBalanceAvailabilityDurationModifier', + 'balanceExpirationDate' => 'setBalanceExpirationDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'unit' => 'getUnit', + 'description' => 'getDescription', + 'meta' => 'getMeta', + 'minAmount' => 'getMinAmount', + 'maxAmount' => 'getMaxAmount', + 'maxCreditAmountLimit' => 'getMaxCreditAmountLimit', + 'maxDebitAmountLimit' => 'getMaxDebitAmountLimit', + 'balanceOptionAmountOvertakingStrategy' => 'getBalanceOptionAmountOvertakingStrategy', + 'balanceOptionCreditRounding' => 'getBalanceOptionCreditRounding', + 'balanceOptionDebitRounding' => 'getBalanceOptionDebitRounding', + 'balanceAvailabilityDurationValue' => 'getBalanceAvailabilityDurationValue', + 'balanceAvailabilityDurationUnit' => 'getBalanceAvailabilityDurationUnit', + 'balanceAvailabilityDurationModifier' => 'getBalanceAvailabilityDurationModifier', + 'balanceExpirationDate' => 'getBalanceExpirationDate' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const UNIT_POINTS = 'points'; + public const UNIT_EUR = 'EUR'; + public const UNIT_USD = 'USD'; + public const UNIT_MXN = 'MXN'; + public const UNIT_GBP = 'GBP'; + public const UNIT_INR = 'INR'; + public const UNIT_CAD = 'CAD'; + public const UNIT_SGD = 'SGD'; + public const UNIT_RON = 'RON'; + public const UNIT_JPY = 'JPY'; + public const UNIT_MYR = 'MYR'; + public const UNIT_CLP = 'CLP'; + public const UNIT_PEN = 'PEN'; + public const UNIT_MAD = 'MAD'; + public const UNIT_AUD = 'AUD'; + public const UNIT_CHF = 'CHF'; + public const UNIT_BRL = 'BRL'; + public const BALANCE_OPTION_AMOUNT_OVERTAKING_STRATEGY_STRICT = 'strict'; + public const BALANCE_OPTION_AMOUNT_OVERTAKING_STRATEGY_PARTIAL = 'partial'; + public const BALANCE_OPTION_CREDIT_ROUNDING_NATURAL = 'natural'; + public const BALANCE_OPTION_CREDIT_ROUNDING_UPPER = 'upper'; + public const BALANCE_OPTION_CREDIT_ROUNDING_LOWER = 'lower'; + public const BALANCE_OPTION_DEBIT_ROUNDING_NATURAL = 'natural'; + public const BALANCE_OPTION_DEBIT_ROUNDING_UPPER = 'upper'; + public const BALANCE_OPTION_DEBIT_ROUNDING_LOWER = 'lower'; + public const BALANCE_AVAILABILITY_DURATION_UNIT_DAY = 'day'; + public const BALANCE_AVAILABILITY_DURATION_UNIT_WEEK = 'week'; + public const BALANCE_AVAILABILITY_DURATION_UNIT_MONTH = 'month'; + public const BALANCE_AVAILABILITY_DURATION_UNIT_YEAR = 'year'; + public const BALANCE_AVAILABILITY_DURATION_MODIFIER_START_OF_PERIOD = 'startOfPeriod'; + public const BALANCE_AVAILABILITY_DURATION_MODIFIER_END_OF_PERIOD = 'endOfPeriod'; + public const BALANCE_AVAILABILITY_DURATION_MODIFIER_NO_MODIFICATION = 'noModification'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getUnitAllowableValues() + { + return [ + self::UNIT_POINTS, + self::UNIT_EUR, + self::UNIT_USD, + self::UNIT_MXN, + self::UNIT_GBP, + self::UNIT_INR, + self::UNIT_CAD, + self::UNIT_SGD, + self::UNIT_RON, + self::UNIT_JPY, + self::UNIT_MYR, + self::UNIT_CLP, + self::UNIT_PEN, + self::UNIT_MAD, + self::UNIT_AUD, + self::UNIT_CHF, + self::UNIT_BRL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getBalanceOptionAmountOvertakingStrategyAllowableValues() + { + return [ + self::BALANCE_OPTION_AMOUNT_OVERTAKING_STRATEGY_STRICT, + self::BALANCE_OPTION_AMOUNT_OVERTAKING_STRATEGY_PARTIAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getBalanceOptionCreditRoundingAllowableValues() + { + return [ + self::BALANCE_OPTION_CREDIT_ROUNDING_NATURAL, + self::BALANCE_OPTION_CREDIT_ROUNDING_UPPER, + self::BALANCE_OPTION_CREDIT_ROUNDING_LOWER, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getBalanceOptionDebitRoundingAllowableValues() + { + return [ + self::BALANCE_OPTION_DEBIT_ROUNDING_NATURAL, + self::BALANCE_OPTION_DEBIT_ROUNDING_UPPER, + self::BALANCE_OPTION_DEBIT_ROUNDING_LOWER, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getBalanceAvailabilityDurationUnitAllowableValues() + { + return [ + self::BALANCE_AVAILABILITY_DURATION_UNIT_DAY, + self::BALANCE_AVAILABILITY_DURATION_UNIT_WEEK, + self::BALANCE_AVAILABILITY_DURATION_UNIT_MONTH, + self::BALANCE_AVAILABILITY_DURATION_UNIT_YEAR, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getBalanceAvailabilityDurationModifierAllowableValues() + { + return [ + self::BALANCE_AVAILABILITY_DURATION_MODIFIER_START_OF_PERIOD, + self::BALANCE_AVAILABILITY_DURATION_MODIFIER_END_OF_PERIOD, + self::BALANCE_AVAILABILITY_DURATION_MODIFIER_NO_MODIFICATION, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('unit', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('meta', $data ?? [], null); + $this->setIfExists('minAmount', $data ?? [], null); + $this->setIfExists('maxAmount', $data ?? [], null); + $this->setIfExists('maxCreditAmountLimit', $data ?? [], null); + $this->setIfExists('maxDebitAmountLimit', $data ?? [], null); + $this->setIfExists('balanceOptionAmountOvertakingStrategy', $data ?? [], 'strict'); + $this->setIfExists('balanceOptionCreditRounding', $data ?? [], 'natural'); + $this->setIfExists('balanceOptionDebitRounding', $data ?? [], 'natural'); + $this->setIfExists('balanceAvailabilityDurationValue', $data ?? [], null); + $this->setIfExists('balanceAvailabilityDurationUnit', $data ?? [], 'day'); + $this->setIfExists('balanceAvailabilityDurationModifier', $data ?? [], 'noModification'); + $this->setIfExists('balanceExpirationDate', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['unit'] === null) { + $invalidProperties[] = "'unit' can't be null"; + } + $allowedValues = $this->getUnitAllowableValues(); + if (!is_null($this->container['unit']) && !in_array($this->container['unit'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'unit', must be one of '%s'", + $this->container['unit'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getBalanceOptionAmountOvertakingStrategyAllowableValues(); + if (!is_null($this->container['balanceOptionAmountOvertakingStrategy']) && !in_array($this->container['balanceOptionAmountOvertakingStrategy'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'balanceOptionAmountOvertakingStrategy', must be one of '%s'", + $this->container['balanceOptionAmountOvertakingStrategy'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getBalanceOptionCreditRoundingAllowableValues(); + if (!is_null($this->container['balanceOptionCreditRounding']) && !in_array($this->container['balanceOptionCreditRounding'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'balanceOptionCreditRounding', must be one of '%s'", + $this->container['balanceOptionCreditRounding'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getBalanceOptionDebitRoundingAllowableValues(); + if (!is_null($this->container['balanceOptionDebitRounding']) && !in_array($this->container['balanceOptionDebitRounding'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'balanceOptionDebitRounding', must be one of '%s'", + $this->container['balanceOptionDebitRounding'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getBalanceAvailabilityDurationUnitAllowableValues(); + if (!is_null($this->container['balanceAvailabilityDurationUnit']) && !in_array($this->container['balanceAvailabilityDurationUnit'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'balanceAvailabilityDurationUnit', must be one of '%s'", + $this->container['balanceAvailabilityDurationUnit'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getBalanceAvailabilityDurationModifierAllowableValues(); + if (!is_null($this->container['balanceAvailabilityDurationModifier']) && !in_array($this->container['balanceAvailabilityDurationModifier'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'balanceAvailabilityDurationModifier', must be one of '%s'", + $this->container['balanceAvailabilityDurationModifier'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Name for the balance definition + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets unit + * + * @return string + */ + public function getUnit(): string + { + return $this->container['unit']; + } + + /** + * Sets unit + * + * @param string $unit The unit for this balance definition. + * + * @return $this + */ + public function setUnit(string $unit): static + { + if (is_null($unit)) { + throw new InvalidArgumentException('non-nullable unit cannot be null'); + } + $allowedValues = $this->getUnitAllowableValues(); + if (!in_array($unit, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'unit', must be one of '%s'", + $unit, + implode("', '", $allowedValues) + ) + ); + } + $this->container['unit'] = $unit; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Description for the balance definition + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets meta + * + * @return object|null + */ + public function getMeta(): ?object + { + return $this->container['meta']; + } + + /** + * Sets meta + * + * @param object|null $meta Additional metadata related to the balance definition. + * + * @return $this + */ + public function setMeta(?object $meta): static + { + if (is_null($meta)) { + throw new InvalidArgumentException('non-nullable meta cannot be null'); + } + $this->container['meta'] = $meta; + + return $this; + } + + /** + * Gets minAmount + * + * @return float|null + */ + public function getMinAmount(): ?float + { + return $this->container['minAmount']; + } + + /** + * Sets minAmount + * + * @param float|null $minAmount Minimum possible amount for balance + * + * @return $this + */ + public function setMinAmount(?float $minAmount): static + { + if (is_null($minAmount)) { + throw new InvalidArgumentException('non-nullable minAmount cannot be null'); + } + $this->container['minAmount'] = $minAmount; + + return $this; + } + + /** + * Gets maxAmount + * + * @return float|null + */ + public function getMaxAmount(): ?float + { + return $this->container['maxAmount']; + } + + /** + * Sets maxAmount + * + * @param float|null $maxAmount Maximum possible amount for balance + * + * @return $this + */ + public function setMaxAmount(?float $maxAmount): static + { + if (is_null($maxAmount)) { + throw new InvalidArgumentException('non-nullable maxAmount cannot be null'); + } + $this->container['maxAmount'] = $maxAmount; + + return $this; + } + + /** + * Gets maxCreditAmountLimit + * + * @return float|null + */ + public function getMaxCreditAmountLimit(): ?float + { + return $this->container['maxCreditAmountLimit']; + } + + /** + * Sets maxCreditAmountLimit + * + * @param float|null $maxCreditAmountLimit Maximum credit amount limit per operation + * + * @return $this + */ + public function setMaxCreditAmountLimit(?float $maxCreditAmountLimit): static + { + if (is_null($maxCreditAmountLimit)) { + throw new InvalidArgumentException('non-nullable maxCreditAmountLimit cannot be null'); + } + $this->container['maxCreditAmountLimit'] = $maxCreditAmountLimit; + + return $this; + } + + /** + * Gets maxDebitAmountLimit + * + * @return float|null + */ + public function getMaxDebitAmountLimit(): ?float + { + return $this->container['maxDebitAmountLimit']; + } + + /** + * Sets maxDebitAmountLimit + * + * @param float|null $maxDebitAmountLimit Maximum debit amount limit per operation + * + * @return $this + */ + public function setMaxDebitAmountLimit(?float $maxDebitAmountLimit): static + { + if (is_null($maxDebitAmountLimit)) { + throw new InvalidArgumentException('non-nullable maxDebitAmountLimit cannot be null'); + } + $this->container['maxDebitAmountLimit'] = $maxDebitAmountLimit; + + return $this; + } + + /** + * Gets balanceOptionAmountOvertakingStrategy + * + * @return string|null + */ + public function getBalanceOptionAmountOvertakingStrategy(): ?string + { + return $this->container['balanceOptionAmountOvertakingStrategy']; + } + + /** + * Sets balanceOptionAmountOvertakingStrategy + * + * @param string|null $balanceOptionAmountOvertakingStrategy Select partial to enable partial credit of balance if maximum balance limit is reaching. Select strict to reject the transaction if it will breach the max credit amount limit. + * + * @return $this + */ + public function setBalanceOptionAmountOvertakingStrategy(?string $balanceOptionAmountOvertakingStrategy): static + { + if (is_null($balanceOptionAmountOvertakingStrategy)) { + throw new InvalidArgumentException('non-nullable balanceOptionAmountOvertakingStrategy cannot be null'); + } + $allowedValues = $this->getBalanceOptionAmountOvertakingStrategyAllowableValues(); + if (!in_array($balanceOptionAmountOvertakingStrategy, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'balanceOptionAmountOvertakingStrategy', must be one of '%s'", + $balanceOptionAmountOvertakingStrategy, + implode("', '", $allowedValues) + ) + ); + } + $this->container['balanceOptionAmountOvertakingStrategy'] = $balanceOptionAmountOvertakingStrategy; + + return $this; + } + + /** + * Gets balanceOptionCreditRounding + * + * @return string|null + */ + public function getBalanceOptionCreditRounding(): ?string + { + return $this->container['balanceOptionCreditRounding']; + } + + /** + * Sets balanceOptionCreditRounding + * + * @param string|null $balanceOptionCreditRounding Select natural to round to nearest integer. Select upper to round up . Select lower to round down + * + * @return $this + */ + public function setBalanceOptionCreditRounding(?string $balanceOptionCreditRounding): static + { + if (is_null($balanceOptionCreditRounding)) { + throw new InvalidArgumentException('non-nullable balanceOptionCreditRounding cannot be null'); + } + $allowedValues = $this->getBalanceOptionCreditRoundingAllowableValues(); + if (!in_array($balanceOptionCreditRounding, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'balanceOptionCreditRounding', must be one of '%s'", + $balanceOptionCreditRounding, + implode("', '", $allowedValues) + ) + ); + } + $this->container['balanceOptionCreditRounding'] = $balanceOptionCreditRounding; + + return $this; + } + + /** + * Gets balanceOptionDebitRounding + * + * @return string|null + */ + public function getBalanceOptionDebitRounding(): ?string + { + return $this->container['balanceOptionDebitRounding']; + } + + /** + * Sets balanceOptionDebitRounding + * + * @param string|null $balanceOptionDebitRounding Select natural to round to nearest integer. Select upper to round up . Select lower to round down + * + * @return $this + */ + public function setBalanceOptionDebitRounding(?string $balanceOptionDebitRounding): static + { + if (is_null($balanceOptionDebitRounding)) { + throw new InvalidArgumentException('non-nullable balanceOptionDebitRounding cannot be null'); + } + $allowedValues = $this->getBalanceOptionDebitRoundingAllowableValues(); + if (!in_array($balanceOptionDebitRounding, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'balanceOptionDebitRounding', must be one of '%s'", + $balanceOptionDebitRounding, + implode("', '", $allowedValues) + ) + ); + } + $this->container['balanceOptionDebitRounding'] = $balanceOptionDebitRounding; + + return $this; + } + + /** + * Gets balanceAvailabilityDurationValue + * + * @return float|null + */ + public function getBalanceAvailabilityDurationValue(): ?float + { + return $this->container['balanceAvailabilityDurationValue']; + } + + /** + * Sets balanceAvailabilityDurationValue + * + * @param float|null $balanceAvailabilityDurationValue Number of days/weeks/month/year for balance expiry + * + * @return $this + */ + public function setBalanceAvailabilityDurationValue(?float $balanceAvailabilityDurationValue): static + { + if (is_null($balanceAvailabilityDurationValue)) { + throw new InvalidArgumentException('non-nullable balanceAvailabilityDurationValue cannot be null'); + } + $this->container['balanceAvailabilityDurationValue'] = $balanceAvailabilityDurationValue; + + return $this; + } + + /** + * Gets balanceAvailabilityDurationUnit + * + * @return string|null + */ + public function getBalanceAvailabilityDurationUnit(): ?string + { + return $this->container['balanceAvailabilityDurationUnit']; + } + + /** + * Sets balanceAvailabilityDurationUnit + * + * @param string|null $balanceAvailabilityDurationUnit Unit of time for the balance's availability (e.g., day/week/month/year). + * + * @return $this + */ + public function setBalanceAvailabilityDurationUnit(?string $balanceAvailabilityDurationUnit): static + { + if (is_null($balanceAvailabilityDurationUnit)) { + throw new InvalidArgumentException('non-nullable balanceAvailabilityDurationUnit cannot be null'); + } + $allowedValues = $this->getBalanceAvailabilityDurationUnitAllowableValues(); + if (!in_array($balanceAvailabilityDurationUnit, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'balanceAvailabilityDurationUnit', must be one of '%s'", + $balanceAvailabilityDurationUnit, + implode("', '", $allowedValues) + ) + ); + } + $this->container['balanceAvailabilityDurationUnit'] = $balanceAvailabilityDurationUnit; + + return $this; + } + + /** + * Gets balanceAvailabilityDurationModifier + * + * @return string|null + */ + public function getBalanceAvailabilityDurationModifier(): ?string + { + return $this->container['balanceAvailabilityDurationModifier']; + } + + /** + * Sets balanceAvailabilityDurationModifier + * + * @param string|null $balanceAvailabilityDurationModifier Select startOfPeriod to configure balance expiry on start of day/week/month/year. Select endOfPeriod to configure balance expiry on end of day/week/month/year, else select noModification + * + * @return $this + */ + public function setBalanceAvailabilityDurationModifier(?string $balanceAvailabilityDurationModifier): static + { + if (is_null($balanceAvailabilityDurationModifier)) { + throw new InvalidArgumentException('non-nullable balanceAvailabilityDurationModifier cannot be null'); + } + $allowedValues = $this->getBalanceAvailabilityDurationModifierAllowableValues(); + if (!in_array($balanceAvailabilityDurationModifier, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'balanceAvailabilityDurationModifier', must be one of '%s'", + $balanceAvailabilityDurationModifier, + implode("', '", $allowedValues) + ) + ); + } + $this->container['balanceAvailabilityDurationModifier'] = $balanceAvailabilityDurationModifier; + + return $this; + } + + /** + * Gets balanceExpirationDate + * + * @return string|null + */ + public function getBalanceExpirationDate(): ?string + { + return $this->container['balanceExpirationDate']; + } + + /** + * Sets balanceExpirationDate + * + * @param string|null $balanceExpirationDate Date when the balance expires and can no longer be used, in dd/mm format. The balance will be expired when this date appears next in the calendar and only one of balanceExpirationDate or balance availability fields can be used. + * + * @return $this + */ + public function setBalanceExpirationDate(?string $balanceExpirationDate): static + { + if (is_null($balanceExpirationDate)) { + throw new InvalidArgumentException('non-nullable balanceExpirationDate cannot be null'); + } + $this->container['balanceExpirationDate'] = $balanceExpirationDate; + + return $this; + } +} + + diff --git a/lib/Models/UpdateBatchContacts.php b/lib/Models/UpdateBatchContacts.php index d97a34f..8f57d63 100644 --- a/lib/Models/UpdateBatchContacts.php +++ b/lib/Models/UpdateBatchContacts.php @@ -2,118 +2,116 @@ /** * UpdateBatchContacts * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * UpdateBatchContacts Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class UpdateBatchContacts implements ModelInterface, ArrayAccess +class UpdateBatchContacts extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'updateBatchContacts'; + protected static string $openAPIModelName = 'updateBatchContacts'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'contacts' => '\Brevo\Client\Models\UpdateBatchContactsContacts[]' + protected static array $openAPITypes = [ + 'contacts' => '\Brevo\Client\Models\UpdateBatchContactsContactsInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'contacts' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'contacts' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'contacts' => 'contacts' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'contacts' => 'setContacts' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'contacts' => 'getContacts' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,75 +139,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['contacts'] = isset($data['contacts']) ? $data['contacts'] : null; + $this->setIfExists('contacts', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets contacts * - * @return \Brevo\Client\Models\UpdateBatchContactsContacts[] + * @return \Brevo\Client\Models\UpdateBatchContactsContactsInner[]|null */ - public function getContacts() + public function getContacts(): ?array { return $this->container['contacts']; } @@ -217,89 +189,19 @@ public function getContacts() /** * Sets contacts * - * @param \Brevo\Client\Models\UpdateBatchContactsContacts[] $contacts List of contacts to be updated + * @param \Brevo\Client\Models\UpdateBatchContactsContactsInner[]|null $contacts List of contacts to be updated * * @return $this */ - public function setContacts($contacts) + public function setContacts(?array $contacts): static { + if (is_null($contacts)) { + throw new InvalidArgumentException('non-nullable contacts cannot be null'); + } $this->container['contacts'] = $contacts; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/UpdateBatchContactsContacts.php b/lib/Models/UpdateBatchContactsContacts.php deleted file mode 100644 index 8ecfec7..0000000 --- a/lib/Models/UpdateBatchContactsContacts.php +++ /dev/null @@ -1,575 +0,0 @@ - 'string', - 'id' => 'int', - 'sms' => 'string', - 'extId' => 'string', - 'attributes' => 'map[string,object]', - 'emailBlacklisted' => 'bool', - 'smsBlacklisted' => 'bool', - 'listIds' => 'int[]', - 'unlinkListIds' => 'int[]', - 'smtpBlacklistSender' => 'string[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'email' => 'email', - 'id' => 'int64', - 'sms' => null, - 'extId' => null, - 'attributes' => null, - 'emailBlacklisted' => null, - 'smsBlacklisted' => null, - 'listIds' => 'int64', - 'unlinkListIds' => 'int64', - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'email' => 'email', - 'id' => 'id', - 'sms' => 'sms', - 'extId' => 'ext_id', - 'attributes' => 'attributes', - 'emailBlacklisted' => 'emailBlacklisted', - 'smsBlacklisted' => 'smsBlacklisted', - 'listIds' => 'listIds', - 'unlinkListIds' => 'unlinkListIds', - 'smtpBlacklistSender' => 'smtpBlacklistSender' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'email' => 'setEmail', - 'id' => 'setId', - 'sms' => 'setSms', - 'extId' => 'setExtId', - 'attributes' => 'setAttributes', - 'emailBlacklisted' => 'setEmailBlacklisted', - 'smsBlacklisted' => 'setSmsBlacklisted', - 'listIds' => 'setListIds', - 'unlinkListIds' => 'setUnlinkListIds', - 'smtpBlacklistSender' => 'setSmtpBlacklistSender' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'email' => 'getEmail', - 'id' => 'getId', - 'sms' => 'getSms', - 'extId' => 'getExtId', - 'attributes' => 'getAttributes', - 'emailBlacklisted' => 'getEmailBlacklisted', - 'smsBlacklisted' => 'getSmsBlacklisted', - 'listIds' => 'getListIds', - 'unlinkListIds' => 'getUnlinkListIds', - '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 - */ - public function __construct(array $data = null) - { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['sms'] = isset($data['sms']) ? $data['sms'] : null; - $this->container['extId'] = isset($data['extId']) ? $data['extId'] : null; - $this->container['attributes'] = isset($data['attributes']) ? $data['attributes'] : null; - $this->container['emailBlacklisted'] = isset($data['emailBlacklisted']) ? $data['emailBlacklisted'] : null; - $this->container['smsBlacklisted'] = isset($data['smsBlacklisted']) ? $data['smsBlacklisted'] : null; - $this->container['listIds'] = isset($data['listIds']) ? $data['listIds'] : null; - $this->container['unlinkListIds'] = isset($data['unlinkListIds']) ? $data['unlinkListIds'] : null; - $this->container['smtpBlacklistSender'] = isset($data['smtpBlacklistSender']) ? $data['smtpBlacklistSender'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets email - * - * @return string - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string $email Email address of the user to be updated (For each operation only pass one of the supported contact identifiers. Email, id or sms) - * - * @return $this - */ - public function setEmail($email) - { - $this->container['email'] = $email; - - return $this; - } - - /** - * Gets id - * - * @return int - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param int $id id of the user to be updated (For each operation only pass one of the supported contact identifiers. Email, id or sms) - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets sms - * - * @return string - */ - public function getSms() - { - return $this->container['sms']; - } - - /** - * Sets sms - * - * @param string $sms SMS of the user to be updated (For each operation only pass one of the supported contact identifiers. Email, id or sms) - * - * @return $this - */ - public function setSms($sms) - { - $this->container['sms'] = $sms; - - return $this; - } - - /** - * Gets extId - * - * @return string - */ - public function getExtId() - { - return $this->container['extId']; - } - - /** - * Sets extId - * - * @param string $extId Pass your own Id to update ext_id of a contact. - * - * @return $this - */ - public function setExtId($extId) - { - $this->container['extId'] = $extId; - - return $this; - } - - /** - * Gets attributes - * - * @return map[string,object] - */ - public function getAttributes() - { - return $this->container['attributes']; - } - - /** - * Sets attributes - * - * @param map[string,object] $attributes Pass the set of attributes to be updated. **These attributes must be present in your account**. To update existing email address of a contact with the new one please pass EMAIL in attribtes. For example, **{ \"EMAIL\":\"newemail@domain.com\", \"FNAME\":\"Ellie\", \"LNAME\":\"Roger\"}**. Keep in mind transactional attributes can be updated the same way as normal attributes. Mobile Number in **SMS** field should be passed with proper country code. For example: **{\"SMS\":\"+91xxxxxxxxxx\"} or {\"SMS\":\"0091xxxxxxxxxx\"}** - * - * @return $this - */ - public function setAttributes($attributes) - { - $this->container['attributes'] = $attributes; - - return $this; - } - - /** - * Gets emailBlacklisted - * - * @return bool - */ - public function getEmailBlacklisted() - { - return $this->container['emailBlacklisted']; - } - - /** - * Sets emailBlacklisted - * - * @param bool $emailBlacklisted Set/unset this field to blacklist/allow the contact for emails (emailBlacklisted = true) - * - * @return $this - */ - public function setEmailBlacklisted($emailBlacklisted) - { - $this->container['emailBlacklisted'] = $emailBlacklisted; - - return $this; - } - - /** - * Gets smsBlacklisted - * - * @return bool - */ - public function getSmsBlacklisted() - { - return $this->container['smsBlacklisted']; - } - - /** - * Sets smsBlacklisted - * - * @param bool $smsBlacklisted Set/unset this field to blacklist/allow the contact for SMS (smsBlacklisted = true) - * - * @return $this - */ - public function setSmsBlacklisted($smsBlacklisted) - { - $this->container['smsBlacklisted'] = $smsBlacklisted; - - return $this; - } - - /** - * Gets listIds - * - * @return int[] - */ - public function getListIds() - { - return $this->container['listIds']; - } - - /** - * Sets listIds - * - * @param int[] $listIds Ids of the lists to add the contact to - * - * @return $this - */ - public function setListIds($listIds) - { - $this->container['listIds'] = $listIds; - - return $this; - } - - /** - * Gets unlinkListIds - * - * @return int[] - */ - public function getUnlinkListIds() - { - return $this->container['unlinkListIds']; - } - - /** - * Sets unlinkListIds - * - * @param int[] $unlinkListIds Ids of the lists to remove the contact from - * - * @return $this - */ - public function setUnlinkListIds($unlinkListIds) - { - $this->container['unlinkListIds'] = $unlinkListIds; - - return $this; - } - - /** - * Gets smtpBlacklistSender - * - * @return string[] - */ - public function getSmtpBlacklistSender() - { - return $this->container['smtpBlacklistSender']; - } - - /** - * Sets smtpBlacklistSender - * - * @param string[] $smtpBlacklistSender transactional email forbidden sender for contact. Use only for email Contact - * - * @return $this - */ - public function setSmtpBlacklistSender($smtpBlacklistSender) - { - $this->container['smtpBlacklistSender'] = $smtpBlacklistSender; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/UpdateBatchContactsContactsInner.php b/lib/Models/UpdateBatchContactsContactsInner.php new file mode 100644 index 0000000..23a3e10 --- /dev/null +++ b/lib/Models/UpdateBatchContactsContactsInner.php @@ -0,0 +1,513 @@ + + */ +class UpdateBatchContactsContactsInner extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'updateBatchContacts_contacts_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'email' => 'string', + 'id' => 'int', + 'sms' => 'string', + 'extId' => 'string', + 'attributes' => 'array', + 'emailBlacklisted' => 'bool', + 'smsBlacklisted' => 'bool', + 'listIds' => 'int[]', + 'unlinkListIds' => 'int[]', + 'smtpBlacklistSender' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'email' => 'email', + 'id' => 'int64', + 'sms' => null, + 'extId' => null, + 'attributes' => null, + 'emailBlacklisted' => null, + 'smsBlacklisted' => null, + 'listIds' => 'int64', + 'unlinkListIds' => 'int64', + 'smtpBlacklistSender' => 'email' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'id' => false, + 'sms' => false, + 'extId' => false, + 'attributes' => false, + 'emailBlacklisted' => false, + 'smsBlacklisted' => false, + 'listIds' => false, + 'unlinkListIds' => false, + 'smtpBlacklistSender' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'email' => 'email', + 'id' => 'id', + 'sms' => 'sms', + 'extId' => 'ext_id', + 'attributes' => 'attributes', + 'emailBlacklisted' => 'emailBlacklisted', + 'smsBlacklisted' => 'smsBlacklisted', + 'listIds' => 'listIds', + 'unlinkListIds' => 'unlinkListIds', + 'smtpBlacklistSender' => 'smtpBlacklistSender' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'email' => 'setEmail', + 'id' => 'setId', + 'sms' => 'setSms', + 'extId' => 'setExtId', + 'attributes' => 'setAttributes', + 'emailBlacklisted' => 'setEmailBlacklisted', + 'smsBlacklisted' => 'setSmsBlacklisted', + 'listIds' => 'setListIds', + 'unlinkListIds' => 'setUnlinkListIds', + 'smtpBlacklistSender' => 'setSmtpBlacklistSender' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'email' => 'getEmail', + 'id' => 'getId', + 'sms' => 'getSms', + 'extId' => 'getExtId', + 'attributes' => 'getAttributes', + 'emailBlacklisted' => 'getEmailBlacklisted', + 'smsBlacklisted' => 'getSmsBlacklisted', + 'listIds' => 'getListIds', + 'unlinkListIds' => 'getUnlinkListIds', + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('sms', $data ?? [], null); + $this->setIfExists('extId', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('emailBlacklisted', $data ?? [], null); + $this->setIfExists('smsBlacklisted', $data ?? [], null); + $this->setIfExists('listIds', $data ?? [], null); + $this->setIfExists('unlinkListIds', $data ?? [], null); + $this->setIfExists('smtpBlacklistSender', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail(): ?string + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Email address of the user to be updated (For each operation only pass one of the supported contact identifiers. Email, id or sms) + * + * @return $this + */ + public function setEmail(?string $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets id + * + * @return int|null + */ + public function getId(): ?int + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int|null $id id of the user to be updated (For each operation only pass one of the supported contact identifiers. Email, id or sms) + * + * @return $this + */ + public function setId(?int $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sms + * + * @return string|null + */ + public function getSms(): ?string + { + return $this->container['sms']; + } + + /** + * Sets sms + * + * @param string|null $sms SMS of the user to be updated (For each operation only pass one of the supported contact identifiers. Email, id or sms) + * + * @return $this + */ + public function setSms(?string $sms): static + { + if (is_null($sms)) { + throw new InvalidArgumentException('non-nullable sms cannot be null'); + } + $this->container['sms'] = $sms; + + return $this; + } + + /** + * Gets extId + * + * @return string|null + */ + public function getExtId(): ?string + { + return $this->container['extId']; + } + + /** + * Sets extId + * + * @param string|null $extId Pass your own Id to update ext_id of a contact. + * + * @return $this + */ + public function setExtId(?string $extId): static + { + if (is_null($extId)) { + throw new InvalidArgumentException('non-nullable extId cannot be null'); + } + $this->container['extId'] = $extId; + + return $this; + } + + /** + * Gets attributes + * + * @return array|null + */ + public function getAttributes(): ?array + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param array|null $attributes Pass the set of attributes to be updated. **These attributes must be present in your account**. To update existing email address of a contact with the new one please pass EMAIL in attribtes. For example, **{ \"EMAIL\":\"newemail@domain.com\", \"FNAME\":\"Ellie\", \"LNAME\":\"Roger\"}**. Keep in mind transactional attributes can be updated the same way as normal attributes. Mobile Number in **SMS** field should be passed with proper country code. For example: **{\"SMS\":\"+91xxxxxxxxxx\"} or {\"SMS\":\"0091xxxxxxxxxx\"}** + * + * @return $this + */ + public function setAttributes(?array $attributes): static + { + if (is_null($attributes)) { + throw new InvalidArgumentException('non-nullable attributes cannot be null'); + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets emailBlacklisted + * + * @return bool|null + */ + public function getEmailBlacklisted(): ?bool + { + return $this->container['emailBlacklisted']; + } + + /** + * Sets emailBlacklisted + * + * @param bool|null $emailBlacklisted Set/unset this field to blacklist/allow the contact for emails (emailBlacklisted = true) + * + * @return $this + */ + public function setEmailBlacklisted(?bool $emailBlacklisted): static + { + if (is_null($emailBlacklisted)) { + throw new InvalidArgumentException('non-nullable emailBlacklisted cannot be null'); + } + $this->container['emailBlacklisted'] = $emailBlacklisted; + + return $this; + } + + /** + * Gets smsBlacklisted + * + * @return bool|null + */ + public function getSmsBlacklisted(): ?bool + { + return $this->container['smsBlacklisted']; + } + + /** + * Sets smsBlacklisted + * + * @param bool|null $smsBlacklisted Set/unset this field to blacklist/allow the contact for SMS (smsBlacklisted = true) + * + * @return $this + */ + public function setSmsBlacklisted(?bool $smsBlacklisted): static + { + if (is_null($smsBlacklisted)) { + throw new InvalidArgumentException('non-nullable smsBlacklisted cannot be null'); + } + $this->container['smsBlacklisted'] = $smsBlacklisted; + + return $this; + } + + /** + * Gets listIds + * + * @return int[]|null + */ + public function getListIds(): ?array + { + return $this->container['listIds']; + } + + /** + * Sets listIds + * + * @param int[]|null $listIds Ids of the lists to add the contact to + * + * @return $this + */ + public function setListIds(?array $listIds): static + { + if (is_null($listIds)) { + throw new InvalidArgumentException('non-nullable listIds cannot be null'); + } + $this->container['listIds'] = $listIds; + + return $this; + } + + /** + * Gets unlinkListIds + * + * @return int[]|null + */ + public function getUnlinkListIds(): ?array + { + return $this->container['unlinkListIds']; + } + + /** + * Sets unlinkListIds + * + * @param int[]|null $unlinkListIds Ids of the lists to remove the contact from + * + * @return $this + */ + public function setUnlinkListIds(?array $unlinkListIds): static + { + if (is_null($unlinkListIds)) { + throw new InvalidArgumentException('non-nullable unlinkListIds cannot be null'); + } + $this->container['unlinkListIds'] = $unlinkListIds; + + return $this; + } + + /** + * Gets smtpBlacklistSender + * + * @return string[]|null + */ + public function getSmtpBlacklistSender(): ?array + { + return $this->container['smtpBlacklistSender']; + } + + /** + * Sets smtpBlacklistSender + * + * @param string[]|null $smtpBlacklistSender transactional email forbidden sender for contact. Use only for email Contact + * + * @return $this + */ + public function setSmtpBlacklistSender(?array $smtpBlacklistSender): static + { + if (is_null($smtpBlacklistSender)) { + throw new InvalidArgumentException('non-nullable smtpBlacklistSender cannot be null'); + } + $this->container['smtpBlacklistSender'] = $smtpBlacklistSender; + + return $this; + } +} + + diff --git a/lib/Models/UpdateBatchContactsModel.php b/lib/Models/UpdateBatchContactsModel.php index 2060e07..fc952c2 100644 --- a/lib/Models/UpdateBatchContactsModel.php +++ b/lib/Models/UpdateBatchContactsModel.php @@ -2,61 +2,63 @@ /** * UpdateBatchContactsModel * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * UpdateBatchContactsModel Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class UpdateBatchContactsModel implements ModelInterface, ArrayAccess +class UpdateBatchContactsModel extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'updateBatchContactsModel'; + protected static string $openAPIModelName = 'updateBatchContactsModel'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'successIds' => 'int[]', 'failureIds' => 'int[]' ]; @@ -64,40 +66,37 @@ class UpdateBatchContactsModel implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'successIds' => 'int64', 'failureIds' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'successIds' => false, + 'failureIds' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'successIds' => 'successIds', 'failureIds' => 'failureIds' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'successIds' => 'setSuccessIds', 'failureIds' => 'setFailureIds' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'successIds' => 'getSuccessIds', 'failureIds' => 'getFailureIds' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +145,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['successIds'] = isset($data['successIds']) ? $data['successIds'] : null; - $this->container['failureIds'] = isset($data['failureIds']) ? $data['failureIds'] : null; + $this->setIfExists('successIds', $data ?? [], null); + $this->setIfExists('failureIds', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets successIds * - * @return int[] + * @return int[]|null */ - public function getSuccessIds() + public function getSuccessIds(): ?array { return $this->container['successIds']; } @@ -223,12 +196,15 @@ public function getSuccessIds() /** * Sets successIds * - * @param int[] $successIds successIds + * @param int[]|null $successIds successIds * * @return $this */ - public function setSuccessIds($successIds) + public function setSuccessIds(?array $successIds): static { + if (is_null($successIds)) { + throw new InvalidArgumentException('non-nullable successIds cannot be null'); + } $this->container['successIds'] = $successIds; return $this; @@ -237,9 +213,9 @@ public function setSuccessIds($successIds) /** * Gets failureIds * - * @return int[] + * @return int[]|null */ - public function getFailureIds() + public function getFailureIds(): ?array { return $this->container['failureIds']; } @@ -247,89 +223,19 @@ public function getFailureIds() /** * Sets failureIds * - * @param int[] $failureIds failureIds + * @param int[]|null $failureIds failureIds * * @return $this */ - public function setFailureIds($failureIds) + public function setFailureIds(?array $failureIds): static { + if (is_null($failureIds)) { + throw new InvalidArgumentException('non-nullable failureIds cannot be null'); + } $this->container['failureIds'] = $failureIds; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/UpdateCampaignStatus.php b/lib/Models/UpdateCampaignStatus.php index 6c645df..e54adeb 100644 --- a/lib/Models/UpdateCampaignStatus.php +++ b/lib/Models/UpdateCampaignStatus.php @@ -2,119 +2,117 @@ /** * UpdateCampaignStatus * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * UpdateCampaignStatus Class Doc Comment * - * @category Class * @description Status of the campaign * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class UpdateCampaignStatus implements ModelInterface, ArrayAccess +class UpdateCampaignStatus extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'updateCampaignStatus'; + protected static string $openAPIModelName = 'updateCampaignStatus'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'status' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'status' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'status' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'status' => 'status' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'status' => 'setStatus' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'status' => 'getStatus' ]; @@ -122,9 +120,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -132,9 +130,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -142,34 +140,22 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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'; - const STATUS_SENT = 'sent'; - const STATUS_QUEUED = 'queued'; - const STATUS_REPLICATE = 'replicate'; - const STATUS_REPLICATE_TEMPLATE = 'replicateTemplate'; - const STATUS_DRAFT = 'draft'; - + public const STATUS_SUSPENDED = 'suspended'; + public const STATUS_ARCHIVE = 'archive'; + public const STATUS_DARCHIVE = 'darchive'; + public const STATUS_SENT = 'sent'; + public const STATUS_QUEUED = 'queued'; + public const STATUS_REPLICATE = 'replicate'; + public const STATUS_REPLICATE_TEMPLATE = 'replicateTemplate'; + public const STATUS_DRAFT = 'draft'; - /** * Gets allowable values of the enum * @@ -188,39 +174,38 @@ public function getStatusAllowableValues() self::STATUS_DRAFT, ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['status'] = isset($data['status']) ? $data['status'] : null; + $this->setIfExists('status', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -228,24 +213,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets status * - * @return string + * @return string|null */ - public function getStatus() + public function getStatus(): ?string { return $this->container['status']; } @@ -253,17 +226,21 @@ public function getStatus() /** * Sets status * - * @param string $status Note:- replicateTemplate status will be available only for template type campaigns. + * @param string|null $status Note:- **replicateTemplate** status will be available **only for template type campaigns.** * * @return $this */ - public function setStatus($status) + public function setStatus(?string $status): static { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowedValues, true)) { - throw new \InvalidArgumentException( + if (!in_array($status, $allowedValues, true)) { + throw new InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -272,79 +249,6 @@ public function setStatus($status) return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/UpdateChild.php b/lib/Models/UpdateChild.php deleted file mode 100644 index de73cf8..0000000 --- a/lib/Models/UpdateChild.php +++ /dev/null @@ -1,425 +0,0 @@ - 'string', - 'firstName' => 'string', - 'lastName' => 'string', - 'companyName' => 'string', - 'password' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'email' => 'email', - 'firstName' => null, - 'lastName' => null, - 'companyName' => null, - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'email' => 'email', - 'firstName' => 'firstName', - 'lastName' => 'lastName', - 'companyName' => 'companyName', - 'password' => 'password' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'email' => 'setEmail', - 'firstName' => 'setFirstName', - 'lastName' => 'setLastName', - 'companyName' => 'setCompanyName', - 'password' => 'setPassword' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'email' => 'getEmail', - 'firstName' => 'getFirstName', - 'lastName' => 'getLastName', - 'companyName' => 'getCompanyName', - '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 - */ - public function __construct(array $data = null) - { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['firstName'] = isset($data['firstName']) ? $data['firstName'] : null; - $this->container['lastName'] = isset($data['lastName']) ? $data['lastName'] : null; - $this->container['companyName'] = isset($data['companyName']) ? $data['companyName'] : null; - $this->container['password'] = isset($data['password']) ? $data['password'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets email - * - * @return string - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string $email New Email address to update the child account - * - * @return $this - */ - public function setEmail($email) - { - $this->container['email'] = $email; - - return $this; - } - - /** - * Gets firstName - * - * @return string - */ - public function getFirstName() - { - return $this->container['firstName']; - } - - /** - * Sets firstName - * - * @param string $firstName New First name to use to update the child account - * - * @return $this - */ - public function setFirstName($firstName) - { - $this->container['firstName'] = $firstName; - - return $this; - } - - /** - * Gets lastName - * - * @return string - */ - public function getLastName() - { - return $this->container['lastName']; - } - - /** - * Sets lastName - * - * @param string $lastName New Last name to use to update the child account - * - * @return $this - */ - public function setLastName($lastName) - { - $this->container['lastName'] = $lastName; - - return $this; - } - - /** - * Gets companyName - * - * @return string - */ - public function getCompanyName() - { - return $this->container['companyName']; - } - - /** - * Sets companyName - * - * @param string $companyName New Company name to use to update the child account - * - * @return $this - */ - public function setCompanyName($companyName) - { - $this->container['companyName'] = $companyName; - - return $this; - } - - /** - * Gets password - * - * @return string - */ - public function getPassword() - { - return $this->container['password']; - } - - /** - * Sets password - * - * @param string $password New password for the child account to login - * - * @return $this - */ - public function setPassword($password) - { - $this->container['password'] = $password; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/UpdateChildAccountStatus.php b/lib/Models/UpdateChildAccountStatus.php deleted file mode 100644 index 89b7167..0000000 --- a/lib/Models/UpdateChildAccountStatus.php +++ /dev/null @@ -1,395 +0,0 @@ - 'bool', - 'transactionalSms' => 'bool', - 'marketingAutomation' => 'bool', - 'smsCampaign' => 'bool' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'transactionalEmail' => null, - 'transactionalSms' => null, - 'marketingAutomation' => null, - 'smsCampaign' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'transactionalEmail' => 'transactionalEmail', - 'transactionalSms' => 'transactionalSms', - 'marketingAutomation' => 'marketingAutomation', - 'smsCampaign' => 'smsCampaign' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'transactionalEmail' => 'setTransactionalEmail', - 'transactionalSms' => 'setTransactionalSms', - 'marketingAutomation' => 'setMarketingAutomation', - 'smsCampaign' => 'setSmsCampaign' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'transactionalEmail' => 'getTransactionalEmail', - 'transactionalSms' => 'getTransactionalSms', - 'marketingAutomation' => 'getMarketingAutomation', - 'smsCampaign' => 'getSmsCampaign' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['transactionalEmail'] = isset($data['transactionalEmail']) ? $data['transactionalEmail'] : null; - $this->container['transactionalSms'] = isset($data['transactionalSms']) ? $data['transactionalSms'] : null; - $this->container['marketingAutomation'] = isset($data['marketingAutomation']) ? $data['marketingAutomation'] : null; - $this->container['smsCampaign'] = isset($data['smsCampaign']) ? $data['smsCampaign'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets transactionalEmail - * - * @return bool - */ - public function getTransactionalEmail() - { - return $this->container['transactionalEmail']; - } - - /** - * Sets transactionalEmail - * - * @param bool $transactionalEmail Status of Transactional Email Platform activation for your account (true=enabled, false=disabled) - * - * @return $this - */ - public function setTransactionalEmail($transactionalEmail) - { - $this->container['transactionalEmail'] = $transactionalEmail; - - return $this; - } - - /** - * Gets transactionalSms - * - * @return bool - */ - public function getTransactionalSms() - { - return $this->container['transactionalSms']; - } - - /** - * Sets transactionalSms - * - * @param bool $transactionalSms Status of Transactional SMS Platform activation for your account (true=enabled, false=disabled) - * - * @return $this - */ - public function setTransactionalSms($transactionalSms) - { - $this->container['transactionalSms'] = $transactionalSms; - - return $this; - } - - /** - * Gets marketingAutomation - * - * @return bool - */ - public function getMarketingAutomation() - { - return $this->container['marketingAutomation']; - } - - /** - * Sets marketingAutomation - * - * @param bool $marketingAutomation Status of Marketing Automation Platform activation for your account (true=enabled, false=disabled) - * - * @return $this - */ - public function setMarketingAutomation($marketingAutomation) - { - $this->container['marketingAutomation'] = $marketingAutomation; - - return $this; - } - - /** - * Gets smsCampaign - * - * @return bool - */ - public function getSmsCampaign() - { - return $this->container['smsCampaign']; - } - - /** - * Sets smsCampaign - * - * @param bool $smsCampaign Status of SMS Campaign Platform activation for your account (true=enabled, false=disabled) - * - * @return $this - */ - public function setSmsCampaign($smsCampaign) - { - $this->container['smsCampaign'] = $smsCampaign; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/UpdateChildDomain.php b/lib/Models/UpdateChildDomain.php deleted file mode 100644 index c5e4e96..0000000 --- a/lib/Models/UpdateChildDomain.php +++ /dev/null @@ -1,305 +0,0 @@ - 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - '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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'domain' => 'domain' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'domain' => 'setDomain' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - '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 - */ - public function __construct(array $data = null) - { - $this->container['domain'] = isset($data['domain']) ? $data['domain'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets domain - * - * @return string - */ - public function getDomain() - { - return $this->container['domain']; - } - - /** - * Sets domain - * - * @param string $domain Value for the sender domain that will replace the existing domain - * - * @return $this - */ - public function setDomain($domain) - { - $this->container['domain'] = $domain; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/UpdateContact.php b/lib/Models/UpdateContact.php index 83e8045..96e3709 100644 --- a/lib/Models/UpdateContact.php +++ b/lib/Models/UpdateContact.php @@ -2,62 +2,64 @@ /** * UpdateContact * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * UpdateContact Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class UpdateContact implements ModelInterface, ArrayAccess +class UpdateContact extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'updateContact'; + protected static string $openAPIModelName = 'updateContact'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ - 'attributes' => 'object', + protected static array $openAPITypes = [ + 'attributes' => 'array', 'extId' => 'string', 'emailBlacklisted' => 'bool', 'smsBlacklisted' => 'bool', @@ -69,9 +71,9 @@ class UpdateContact implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'attributes' => null, 'extId' => null, 'emailBlacklisted' => null, @@ -82,32 +84,34 @@ class UpdateContact implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'attributes' => false, + 'extId' => false, + 'emailBlacklisted' => false, + 'smsBlacklisted' => false, + 'listIds' => false, + 'unlinkListIds' => false, + 'smtpBlacklistSender' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'attributes' => 'attributes', 'extId' => 'ext_id', 'emailBlacklisted' => 'emailBlacklisted', @@ -120,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'attributes' => 'setAttributes', 'extId' => 'setExtId', 'emailBlacklisted' => 'setEmailBlacklisted', @@ -135,9 +139,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'attributes' => 'getAttributes', 'extId' => 'getExtId', 'emailBlacklisted' => 'getEmailBlacklisted', @@ -151,9 +155,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -161,9 +165,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -171,81 +175,55 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['attributes'] = isset($data['attributes']) ? $data['attributes'] : null; - $this->container['extId'] = isset($data['extId']) ? $data['extId'] : null; - $this->container['emailBlacklisted'] = isset($data['emailBlacklisted']) ? $data['emailBlacklisted'] : null; - $this->container['smsBlacklisted'] = isset($data['smsBlacklisted']) ? $data['smsBlacklisted'] : null; - $this->container['listIds'] = isset($data['listIds']) ? $data['listIds'] : null; - $this->container['unlinkListIds'] = isset($data['unlinkListIds']) ? $data['unlinkListIds'] : null; - $this->container['smtpBlacklistSender'] = isset($data['smtpBlacklistSender']) ? $data['smtpBlacklistSender'] : null; + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('extId', $data ?? [], null); + $this->setIfExists('emailBlacklisted', $data ?? [], null); + $this->setIfExists('smsBlacklisted', $data ?? [], null); + $this->setIfExists('listIds', $data ?? [], null); + $this->setIfExists('unlinkListIds', $data ?? [], null); + $this->setIfExists('smtpBlacklistSender', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets attributes * - * @return object + * @return array|null */ - public function getAttributes() + public function getAttributes(): ?array { return $this->container['attributes']; } @@ -253,12 +231,15 @@ public function getAttributes() /** * Sets attributes * - * @param object $attributes Pass the set of attributes to be updated. These attributes must be present in your account. Values that don't match the attribute type (e.g. text or string in a date attribute) will be ignored.To update existing email address of a contact with the new one please pass EMAIL in attributes. For example, `{ \"EMAIL\":\"newemail@domain.com\", \"FNAME\":\"Ellie\", \"LNAME\":\"Roger\"}`. The attribute's parameter should be passed in capital letter while updating a contact. Keep in mind transactional attributes can be updated the same way as normal attributes. Mobile Number in \"SMS\" field should be passed with proper country code. For example {\"SMS\":\"+91xxxxxxxxxx\"} or {\"SMS\":\"0091xxxxxxxxxx\"} + * @param array|null $attributes Pass the set of attributes to be updated. **These attributes must be present in your account**. To update existing email address of a contact with the new one please pass EMAIL in attributes. For example, **{ \"EMAIL\":\"newemail@domain.com\", \"FNAME\":\"Ellie\", \"LNAME\":\"Roger\", \"COUNTRIES\":[\"India\",\"China\"]}**. The attribute's parameter should be passed in capital letter while updating a contact. Values that don't match the attribute type (e.g. text or string in a date attribute) will be ignored. Keep in mind transactional attributes can be updated the same way as normal attributes. Mobile Number in **SMS** field should be passed with proper country code. For example: **{\"SMS\":\"+91xxxxxxxxxx\"} or {\"SMS\":\"0091xxxxxxxxxx\"}** * * @return $this */ - public function setAttributes($attributes) + public function setAttributes(?array $attributes): static { + if (is_null($attributes)) { + throw new InvalidArgumentException('non-nullable attributes cannot be null'); + } $this->container['attributes'] = $attributes; return $this; @@ -267,9 +248,9 @@ public function setAttributes($attributes) /** * Gets extId * - * @return string + * @return string|null */ - public function getExtId() + public function getExtId(): ?string { return $this->container['extId']; } @@ -277,12 +258,15 @@ public function getExtId() /** * Sets extId * - * @param string $extId Pass your own Id to update ext_id of a contact. + * @param string|null $extId Pass your own Id to update ext_id of a contact. * * @return $this */ - public function setExtId($extId) + public function setExtId(?string $extId): static { + if (is_null($extId)) { + throw new InvalidArgumentException('non-nullable extId cannot be null'); + } $this->container['extId'] = $extId; return $this; @@ -291,9 +275,9 @@ public function setExtId($extId) /** * Gets emailBlacklisted * - * @return bool + * @return bool|null */ - public function getEmailBlacklisted() + public function getEmailBlacklisted(): ?bool { return $this->container['emailBlacklisted']; } @@ -301,12 +285,15 @@ public function getEmailBlacklisted() /** * Sets emailBlacklisted * - * @param bool $emailBlacklisted Set/unset this field to blacklist/allow the contact for emails (emailBlacklisted = true) + * @param bool|null $emailBlacklisted Set/unset this field to blacklist/allow the contact for emails (emailBlacklisted = true) * * @return $this */ - public function setEmailBlacklisted($emailBlacklisted) + public function setEmailBlacklisted(?bool $emailBlacklisted): static { + if (is_null($emailBlacklisted)) { + throw new InvalidArgumentException('non-nullable emailBlacklisted cannot be null'); + } $this->container['emailBlacklisted'] = $emailBlacklisted; return $this; @@ -315,9 +302,9 @@ public function setEmailBlacklisted($emailBlacklisted) /** * Gets smsBlacklisted * - * @return bool + * @return bool|null */ - public function getSmsBlacklisted() + public function getSmsBlacklisted(): ?bool { return $this->container['smsBlacklisted']; } @@ -325,12 +312,15 @@ public function getSmsBlacklisted() /** * Sets smsBlacklisted * - * @param bool $smsBlacklisted Set/unset this field to blacklist/allow the contact for SMS (smsBlacklisted = true) + * @param bool|null $smsBlacklisted Set/unset this field to blacklist/allow the contact for SMS (smsBlacklisted = true) * * @return $this */ - public function setSmsBlacklisted($smsBlacklisted) + public function setSmsBlacklisted(?bool $smsBlacklisted): static { + if (is_null($smsBlacklisted)) { + throw new InvalidArgumentException('non-nullable smsBlacklisted cannot be null'); + } $this->container['smsBlacklisted'] = $smsBlacklisted; return $this; @@ -339,9 +329,9 @@ public function setSmsBlacklisted($smsBlacklisted) /** * Gets listIds * - * @return int[] + * @return int[]|null */ - public function getListIds() + public function getListIds(): ?array { return $this->container['listIds']; } @@ -349,12 +339,15 @@ public function getListIds() /** * Sets listIds * - * @param int[] $listIds Ids of the lists to add the contact to + * @param int[]|null $listIds Ids of the lists to add the contact to * * @return $this */ - public function setListIds($listIds) + public function setListIds(?array $listIds): static { + if (is_null($listIds)) { + throw new InvalidArgumentException('non-nullable listIds cannot be null'); + } $this->container['listIds'] = $listIds; return $this; @@ -363,9 +356,9 @@ public function setListIds($listIds) /** * Gets unlinkListIds * - * @return int[] + * @return int[]|null */ - public function getUnlinkListIds() + public function getUnlinkListIds(): ?array { return $this->container['unlinkListIds']; } @@ -373,12 +366,15 @@ public function getUnlinkListIds() /** * Sets unlinkListIds * - * @param int[] $unlinkListIds Ids of the lists to remove the contact from + * @param int[]|null $unlinkListIds Ids of the lists to remove the contact from * * @return $this */ - public function setUnlinkListIds($unlinkListIds) + public function setUnlinkListIds(?array $unlinkListIds): static { + if (is_null($unlinkListIds)) { + throw new InvalidArgumentException('non-nullable unlinkListIds cannot be null'); + } $this->container['unlinkListIds'] = $unlinkListIds; return $this; @@ -387,9 +383,9 @@ public function setUnlinkListIds($unlinkListIds) /** * Gets smtpBlacklistSender * - * @return string[] + * @return string[]|null */ - public function getSmtpBlacklistSender() + public function getSmtpBlacklistSender(): ?array { return $this->container['smtpBlacklistSender']; } @@ -397,89 +393,19 @@ public function getSmtpBlacklistSender() /** * Sets smtpBlacklistSender * - * @param string[] $smtpBlacklistSender transactional email forbidden sender for contact. Use only for email Contact + * @param string[]|null $smtpBlacklistSender transactional email forbidden sender for contact. Use only for email Contact * * @return $this */ - public function setSmtpBlacklistSender($smtpBlacklistSender) + public function setSmtpBlacklistSender(?array $smtpBlacklistSender): static { + if (is_null($smtpBlacklistSender)) { + throw new InvalidArgumentException('non-nullable smtpBlacklistSender cannot be null'); + } $this->container['smtpBlacklistSender'] = $smtpBlacklistSender; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/UpdateCouponCollection.php b/lib/Models/UpdateCouponCollection.php deleted file mode 100644 index c8a2808..0000000 --- a/lib/Models/UpdateCouponCollection.php +++ /dev/null @@ -1,308 +0,0 @@ - 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'defaultCoupon' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'defaultCoupon' => 'defaultCoupon' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'defaultCoupon' => 'setDefaultCoupon' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'defaultCoupon' => 'getDefaultCoupon' - ]; - - /** - * 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 - */ - public function __construct(array $data = null) - { - $this->container['defaultCoupon'] = isset($data['defaultCoupon']) ? $data['defaultCoupon'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['defaultCoupon'] === null) { - $invalidProperties[] = "'defaultCoupon' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets defaultCoupon - * - * @return string - */ - public function getDefaultCoupon() - { - return $this->container['defaultCoupon']; - } - - /** - * Sets defaultCoupon - * - * @param string $defaultCoupon A default coupon to be used in case there are no coupons left - * - * @return $this - */ - public function setDefaultCoupon($defaultCoupon) - { - $this->container['defaultCoupon'] = $defaultCoupon; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Models/UpdateCouponCollection200Response.php b/lib/Models/UpdateCouponCollection200Response.php new file mode 100644 index 0000000..c8f5db6 --- /dev/null +++ b/lib/Models/UpdateCouponCollection200Response.php @@ -0,0 +1,284 @@ + + */ +class UpdateCouponCollection200Response extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'updateCouponCollection_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'defaultCoupon' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'uuidv4', + 'name' => 'uuidv4', + 'defaultCoupon' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'defaultCoupon' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'defaultCoupon' => 'defaultCoupon' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'defaultCoupon' => 'setDefaultCoupon' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'defaultCoupon' => 'getDefaultCoupon' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('defaultCoupon', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['defaultCoupon'] === null) { + $invalidProperties[] = "'defaultCoupon' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The id of the collection + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name The name of the collection + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets defaultCoupon + * + * @return string + */ + public function getDefaultCoupon(): string + { + return $this->container['defaultCoupon']; + } + + /** + * Sets defaultCoupon + * + * @param string $defaultCoupon The default coupon of the collection + * + * @return $this + */ + public function setDefaultCoupon(string $defaultCoupon): static + { + if (is_null($defaultCoupon)) { + throw new InvalidArgumentException('non-nullable defaultCoupon cannot be null'); + } + $this->container['defaultCoupon'] = $defaultCoupon; + + return $this; + } +} + + diff --git a/lib/Models/UpdateCouponCollectionRequest.php b/lib/Models/UpdateCouponCollectionRequest.php new file mode 100644 index 0000000..096e4fb --- /dev/null +++ b/lib/Models/UpdateCouponCollectionRequest.php @@ -0,0 +1,309 @@ + + */ +class UpdateCouponCollectionRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'updateCouponCollection_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'defaultCoupon' => 'string', + 'expirationDate' => '\DateTime', + 'remainingDaysAlert' => 'int', + 'remainingCouponsAlert' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'defaultCoupon' => null, + 'expirationDate' => 'date-time', + 'remainingDaysAlert' => null, + 'remainingCouponsAlert' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'defaultCoupon' => false, + 'expirationDate' => false, + 'remainingDaysAlert' => false, + 'remainingCouponsAlert' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'defaultCoupon' => 'defaultCoupon', + 'expirationDate' => 'expirationDate', + 'remainingDaysAlert' => 'remainingDaysAlert', + 'remainingCouponsAlert' => 'remainingCouponsAlert' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'defaultCoupon' => 'setDefaultCoupon', + 'expirationDate' => 'setExpirationDate', + 'remainingDaysAlert' => 'setRemainingDaysAlert', + 'remainingCouponsAlert' => 'setRemainingCouponsAlert' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'defaultCoupon' => 'getDefaultCoupon', + 'expirationDate' => 'getExpirationDate', + 'remainingDaysAlert' => 'getRemainingDaysAlert', + 'remainingCouponsAlert' => 'getRemainingCouponsAlert' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('defaultCoupon', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('remainingDaysAlert', $data ?? [], null); + $this->setIfExists('remainingCouponsAlert', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets defaultCoupon + * + * @return string|null + */ + public function getDefaultCoupon(): ?string + { + return $this->container['defaultCoupon']; + } + + /** + * Sets defaultCoupon + * + * @param string|null $defaultCoupon A default coupon to be used in case there are no coupons left + * + * @return $this + */ + public function setDefaultCoupon(?string $defaultCoupon): static + { + if (is_null($defaultCoupon)) { + throw new InvalidArgumentException('non-nullable defaultCoupon cannot be null'); + } + $this->container['defaultCoupon'] = $defaultCoupon; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate(): ?\DateTime + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Specify an expiration date for the coupon collection in RFC3339 format. Use null to remove the expiration date. + * + * @return $this + */ + public function setExpirationDate(?\DateTime $expirationDate): static + { + if (is_null($expirationDate)) { + throw new InvalidArgumentException('non-nullable expirationDate cannot be null'); + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets remainingDaysAlert + * + * @return int|null + */ + public function getRemainingDaysAlert(): ?int + { + return $this->container['remainingDaysAlert']; + } + + /** + * Sets remainingDaysAlert + * + * @param int|null $remainingDaysAlert Send a notification alert (email) when the remaining days until the expiration date are equal or fall bellow this number. Use null to disable alerts. + * + * @return $this + */ + public function setRemainingDaysAlert(?int $remainingDaysAlert): static + { + if (is_null($remainingDaysAlert)) { + throw new InvalidArgumentException('non-nullable remainingDaysAlert cannot be null'); + } + $this->container['remainingDaysAlert'] = $remainingDaysAlert; + + return $this; + } + + /** + * Gets remainingCouponsAlert + * + * @return int|null + */ + public function getRemainingCouponsAlert(): ?int + { + return $this->container['remainingCouponsAlert']; + } + + /** + * Sets remainingCouponsAlert + * + * @param int|null $remainingCouponsAlert Send a notification alert (email) when the remaining coupons count is equal or fall bellow this number. Use null to disable alerts. + * + * @return $this + */ + public function setRemainingCouponsAlert(?int $remainingCouponsAlert): static + { + if (is_null($remainingCouponsAlert)) { + throw new InvalidArgumentException('non-nullable remainingCouponsAlert cannot be null'); + } + $this->container['remainingCouponsAlert'] = $remainingCouponsAlert; + + return $this; + } +} + + diff --git a/lib/Models/UpdateEmailCampaign.php b/lib/Models/UpdateEmailCampaign.php index d7a5470..1521ae8 100644 --- a/lib/Models/UpdateEmailCampaign.php +++ b/lib/Models/UpdateEmailCampaign.php @@ -2,61 +2,63 @@ /** * UpdateEmailCampaign * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * UpdateEmailCampaign Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class UpdateEmailCampaign implements ModelInterface, ArrayAccess +class UpdateEmailCampaign extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'updateEmailCampaign'; + protected static string $openAPIModelName = 'updateEmailCampaign'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'tag' => 'string', 'sender' => '\Brevo\Client\Models\UpdateEmailCampaignSender', 'name' => 'string', @@ -75,7 +77,7 @@ class UpdateEmailCampaign implements ModelInterface, ArrayAccess 'footer' => 'string', 'header' => 'string', 'utmCampaign' => 'string', - 'params' => 'object', + 'params' => 'array', 'sendAtBestTime' => 'bool', 'abTesting' => 'bool', 'subjectA' => 'string', @@ -87,15 +89,16 @@ class UpdateEmailCampaign implements ModelInterface, ArrayAccess 'initialQuota' => 'int', 'increaseRate' => 'int', 'unsubscriptionPageId' => 'string', - 'updateFormId' => 'string' + 'updateFormId' => 'string', + 'emailExpirationDate' => '\Brevo\Client\Models\UpdateEmailCampaignEmailExpirationDate' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'tag' => null, 'sender' => null, 'name' => null, @@ -126,36 +129,64 @@ class UpdateEmailCampaign implements ModelInterface, ArrayAccess 'initialQuota' => 'int64', 'increaseRate' => 'int64', 'unsubscriptionPageId' => null, - 'updateFormId' => null + 'updateFormId' => null, + 'emailExpirationDate' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'tag' => false, + 'sender' => false, + 'name' => false, + 'htmlContent' => false, + 'htmlUrl' => false, + 'scheduledAt' => false, + 'subject' => false, + 'previewText' => false, + 'replyTo' => false, + 'toField' => false, + 'recipients' => false, + 'attachmentUrl' => false, + 'inlineImageActivation' => false, + 'mirrorActive' => false, + 'recurring' => false, + 'footer' => false, + 'header' => false, + 'utmCampaign' => false, + 'params' => false, + 'sendAtBestTime' => false, + 'abTesting' => false, + 'subjectA' => false, + 'subjectB' => false, + 'splitRule' => false, + 'winnerCriteria' => false, + 'winnerDelay' => false, + 'ipWarmupEnable' => false, + 'initialQuota' => false, + 'increaseRate' => false, + 'unsubscriptionPageId' => false, + 'updateFormId' => false, + 'emailExpirationDate' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'tag' => 'tag', 'sender' => 'sender', 'name' => 'name', @@ -186,15 +217,16 @@ public static function swaggerFormats() 'initialQuota' => 'initialQuota', 'increaseRate' => 'increaseRate', 'unsubscriptionPageId' => 'unsubscriptionPageId', - 'updateFormId' => 'updateFormId' + 'updateFormId' => 'updateFormId', + 'emailExpirationDate' => 'emailExpirationDate' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'tag' => 'setTag', 'sender' => 'setSender', 'name' => 'setName', @@ -225,15 +257,16 @@ public static function swaggerFormats() 'initialQuota' => 'setInitialQuota', 'increaseRate' => 'setIncreaseRate', 'unsubscriptionPageId' => 'setUnsubscriptionPageId', - 'updateFormId' => 'setUpdateFormId' + 'updateFormId' => 'setUpdateFormId', + 'emailExpirationDate' => 'setEmailExpirationDate' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'tag' => 'getTag', 'sender' => 'getSender', 'name' => 'getName', @@ -264,16 +297,17 @@ public static function swaggerFormats() 'initialQuota' => 'getInitialQuota', 'increaseRate' => 'getIncreaseRate', 'unsubscriptionPageId' => 'getUnsubscriptionPageId', - 'updateFormId' => 'getUpdateFormId' + 'updateFormId' => 'getUpdateFormId', + 'emailExpirationDate' => 'getEmailExpirationDate' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -281,9 +315,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -291,28 +325,16 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const WINNER_CRITERIA_OPEN = 'open'; - const WINNER_CRITERIA_CLICK = 'click'; - + public const WINNER_CRITERIA_OPEN = 'open'; + public const WINNER_CRITERIA_CLICK = 'click'; - /** * Gets allowable values of the enum * @@ -325,62 +347,61 @@ public function getWinnerCriteriaAllowableValues() self::WINNER_CRITERIA_CLICK, ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['tag'] = isset($data['tag']) ? $data['tag'] : null; - $this->container['sender'] = isset($data['sender']) ? $data['sender'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['htmlContent'] = isset($data['htmlContent']) ? $data['htmlContent'] : null; - $this->container['htmlUrl'] = isset($data['htmlUrl']) ? $data['htmlUrl'] : null; - $this->container['scheduledAt'] = isset($data['scheduledAt']) ? $data['scheduledAt'] : null; - $this->container['subject'] = isset($data['subject']) ? $data['subject'] : null; - $this->container['previewText'] = isset($data['previewText']) ? $data['previewText'] : null; - $this->container['replyTo'] = isset($data['replyTo']) ? $data['replyTo'] : null; - $this->container['toField'] = isset($data['toField']) ? $data['toField'] : null; - $this->container['recipients'] = isset($data['recipients']) ? $data['recipients'] : null; - $this->container['attachmentUrl'] = isset($data['attachmentUrl']) ? $data['attachmentUrl'] : null; - $this->container['inlineImageActivation'] = isset($data['inlineImageActivation']) ? $data['inlineImageActivation'] : false; - $this->container['mirrorActive'] = isset($data['mirrorActive']) ? $data['mirrorActive'] : null; - $this->container['recurring'] = isset($data['recurring']) ? $data['recurring'] : false; - $this->container['footer'] = isset($data['footer']) ? $data['footer'] : null; - $this->container['header'] = isset($data['header']) ? $data['header'] : null; - $this->container['utmCampaign'] = isset($data['utmCampaign']) ? $data['utmCampaign'] : null; - $this->container['params'] = isset($data['params']) ? $data['params'] : null; - $this->container['sendAtBestTime'] = isset($data['sendAtBestTime']) ? $data['sendAtBestTime'] : null; - $this->container['abTesting'] = isset($data['abTesting']) ? $data['abTesting'] : false; - $this->container['subjectA'] = isset($data['subjectA']) ? $data['subjectA'] : null; - $this->container['subjectB'] = isset($data['subjectB']) ? $data['subjectB'] : null; - $this->container['splitRule'] = isset($data['splitRule']) ? $data['splitRule'] : null; - $this->container['winnerCriteria'] = isset($data['winnerCriteria']) ? $data['winnerCriteria'] : null; - $this->container['winnerDelay'] = isset($data['winnerDelay']) ? $data['winnerDelay'] : null; - $this->container['ipWarmupEnable'] = isset($data['ipWarmupEnable']) ? $data['ipWarmupEnable'] : false; - $this->container['initialQuota'] = isset($data['initialQuota']) ? $data['initialQuota'] : null; - $this->container['increaseRate'] = isset($data['increaseRate']) ? $data['increaseRate'] : null; - $this->container['unsubscriptionPageId'] = isset($data['unsubscriptionPageId']) ? $data['unsubscriptionPageId'] : null; - $this->container['updateFormId'] = isset($data['updateFormId']) ? $data['updateFormId'] : null; + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('htmlContent', $data ?? [], null); + $this->setIfExists('htmlUrl', $data ?? [], null); + $this->setIfExists('scheduledAt', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('previewText', $data ?? [], null); + $this->setIfExists('replyTo', $data ?? [], null); + $this->setIfExists('toField', $data ?? [], null); + $this->setIfExists('recipients', $data ?? [], null); + $this->setIfExists('attachmentUrl', $data ?? [], null); + $this->setIfExists('inlineImageActivation', $data ?? [], false); + $this->setIfExists('mirrorActive', $data ?? [], null); + $this->setIfExists('recurring', $data ?? [], false); + $this->setIfExists('footer', $data ?? [], null); + $this->setIfExists('header', $data ?? [], null); + $this->setIfExists('utmCampaign', $data ?? [], null); + $this->setIfExists('params', $data ?? [], null); + $this->setIfExists('sendAtBestTime', $data ?? [], null); + $this->setIfExists('abTesting', $data ?? [], false); + $this->setIfExists('subjectA', $data ?? [], null); + $this->setIfExists('subjectB', $data ?? [], null); + $this->setIfExists('splitRule', $data ?? [], null); + $this->setIfExists('winnerCriteria', $data ?? [], null); + $this->setIfExists('winnerDelay', $data ?? [], null); + $this->setIfExists('ipWarmupEnable', $data ?? [], false); + $this->setIfExists('initialQuota', $data ?? [], null); + $this->setIfExists('increaseRate', $data ?? [], null); + $this->setIfExists('unsubscriptionPageId', $data ?? [], null); + $this->setIfExists('updateFormId', $data ?? [], null); + $this->setIfExists('emailExpirationDate', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -395,7 +416,8 @@ public function listInvalidProperties() $allowedValues = $this->getWinnerCriteriaAllowableValues(); if (!is_null($this->container['winnerCriteria']) && !in_array($this->container['winnerCriteria'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'winnerCriteria', must be one of '%s'", + "invalid value '%s' for 'winnerCriteria', must be one of '%s'", + $this->container['winnerCriteria'], implode("', '", $allowedValues) ); } @@ -419,24 +441,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets tag * - * @return string + * @return string|null */ - public function getTag() + public function getTag(): ?string { return $this->container['tag']; } @@ -444,12 +454,15 @@ public function getTag() /** * Sets tag * - * @param string $tag Tag of the campaign + * @param string|null $tag Tag of the campaign * * @return $this */ - public function setTag($tag) + public function setTag(?string $tag): static { + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } $this->container['tag'] = $tag; return $this; @@ -458,9 +471,9 @@ public function setTag($tag) /** * Gets sender * - * @return \Brevo\Client\Models\UpdateEmailCampaignSender + * @return \Brevo\Client\Models\UpdateEmailCampaignSender|null */ - public function getSender() + public function getSender(): ?\Brevo\Client\Models\UpdateEmailCampaignSender { return $this->container['sender']; } @@ -468,12 +481,15 @@ public function getSender() /** * Sets sender * - * @param \Brevo\Client\Models\UpdateEmailCampaignSender $sender sender + * @param \Brevo\Client\Models\UpdateEmailCampaignSender|null $sender sender * * @return $this */ - public function setSender($sender) + public function setSender(?\Brevo\Client\Models\UpdateEmailCampaignSender $sender): static { + if (is_null($sender)) { + throw new InvalidArgumentException('non-nullable sender cannot be null'); + } $this->container['sender'] = $sender; return $this; @@ -482,9 +498,9 @@ public function setSender($sender) /** * Gets name * - * @return string + * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -492,12 +508,15 @@ public function getName() /** * Sets name * - * @param string $name Name of the campaign + * @param string|null $name Name of the campaign * * @return $this */ - public function setName($name) + public function setName(?string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -506,9 +525,9 @@ public function setName($name) /** * Gets htmlContent * - * @return string + * @return string|null */ - public function getHtmlContent() + public function getHtmlContent(): ?string { return $this->container['htmlContent']; } @@ -516,12 +535,15 @@ public function getHtmlContent() /** * Sets htmlContent * - * @param string $htmlContent Body of the message (HTML version). If the campaign is designed using Drag & Drop editor via HTML content, then the design page will not have Drag & Drop editor access for that campaign. REQUIRED if htmlUrl is empty + * @param string|null $htmlContent Body of the message (HTML version). If the campaign is designed using Drag & Drop editor via HTML content, then the design page will not have Drag & Drop editor access for that campaign. **REQUIRED if htmlUrl is empty** * * @return $this */ - public function setHtmlContent($htmlContent) + public function setHtmlContent(?string $htmlContent): static { + if (is_null($htmlContent)) { + throw new InvalidArgumentException('non-nullable htmlContent cannot be null'); + } $this->container['htmlContent'] = $htmlContent; return $this; @@ -530,9 +552,9 @@ public function setHtmlContent($htmlContent) /** * Gets htmlUrl * - * @return string + * @return string|null */ - public function getHtmlUrl() + public function getHtmlUrl(): ?string { return $this->container['htmlUrl']; } @@ -540,12 +562,15 @@ public function getHtmlUrl() /** * Sets htmlUrl * - * @param string $htmlUrl Url which contents the body of the email message. REQUIRED if htmlContent is empty + * @param string|null $htmlUrl Url which contents the body of the email message. **REQUIRED if htmlContent is empty** * * @return $this */ - public function setHtmlUrl($htmlUrl) + public function setHtmlUrl(?string $htmlUrl): static { + if (is_null($htmlUrl)) { + throw new InvalidArgumentException('non-nullable htmlUrl cannot be null'); + } $this->container['htmlUrl'] = $htmlUrl; return $this; @@ -554,9 +579,9 @@ public function setHtmlUrl($htmlUrl) /** * Gets scheduledAt * - * @return string + * @return string|null */ - public function getScheduledAt() + public function getScheduledAt(): ?string { return $this->container['scheduledAt']; } @@ -564,12 +589,15 @@ public function getScheduledAt() /** * Sets scheduledAt * - * @param string $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. If sendAtBestTime is set to true, your campaign will be sent according to the date passed (ignoring the time part). + * @param string|null $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.** If sendAtBestTime is set to true, your campaign will be sent according to the date passed (ignoring the time part). * * @return $this */ - public function setScheduledAt($scheduledAt) + public function setScheduledAt(?string $scheduledAt): static { + if (is_null($scheduledAt)) { + throw new InvalidArgumentException('non-nullable scheduledAt cannot be null'); + } $this->container['scheduledAt'] = $scheduledAt; return $this; @@ -578,9 +606,9 @@ public function setScheduledAt($scheduledAt) /** * Gets subject * - * @return string + * @return string|null */ - public function getSubject() + public function getSubject(): ?string { return $this->container['subject']; } @@ -588,12 +616,15 @@ public function getSubject() /** * Sets subject * - * @param string $subject Subject of the campaign + * @param string|null $subject Subject of the campaign * * @return $this */ - public function setSubject($subject) + public function setSubject(?string $subject): static { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } $this->container['subject'] = $subject; return $this; @@ -602,9 +633,9 @@ public function setSubject($subject) /** * Gets previewText * - * @return string + * @return string|null */ - public function getPreviewText() + public function getPreviewText(): ?string { return $this->container['previewText']; } @@ -612,12 +643,15 @@ public function getPreviewText() /** * Sets previewText * - * @param string $previewText Preview text or preheader of the email campaign + * @param string|null $previewText Preview text or preheader of the email campaign * * @return $this */ - public function setPreviewText($previewText) + public function setPreviewText(?string $previewText): static { + if (is_null($previewText)) { + throw new InvalidArgumentException('non-nullable previewText cannot be null'); + } $this->container['previewText'] = $previewText; return $this; @@ -626,9 +660,9 @@ public function setPreviewText($previewText) /** * Gets replyTo * - * @return string + * @return string|null */ - public function getReplyTo() + public function getReplyTo(): ?string { return $this->container['replyTo']; } @@ -636,12 +670,15 @@ public function getReplyTo() /** * Sets replyTo * - * @param string $replyTo Email on which campaign recipients will be able to reply to + * @param string|null $replyTo Email on which campaign recipients will be able to reply to * * @return $this */ - public function setReplyTo($replyTo) + public function setReplyTo(?string $replyTo): static { + if (is_null($replyTo)) { + throw new InvalidArgumentException('non-nullable replyTo cannot be null'); + } $this->container['replyTo'] = $replyTo; return $this; @@ -650,9 +687,9 @@ public function setReplyTo($replyTo) /** * Gets toField * - * @return string + * @return string|null */ - public function getToField() + public function getToField(): ?string { return $this->container['toField']; } @@ -660,12 +697,15 @@ public function getToField() /** * Sets toField * - * @param string $toField To personalize the «To» Field. If you want to include the first name and last name of your recipient, add {FNAME} {LNAME}. These contact attributes must already exist in your Brevo account. If input parameter 'params' used please use {{contact.FNAME}} {{contact.LNAME}} for personalization + * @param string|null $toField To personalize the **To** Field. If you want to include the first name and last name of your recipient, add **{FNAME} {LNAME}**. These contact attributes must already exist in your Brevo account. If input parameter **params** used please use **{{contact.FNAME}} {{contact.LNAME}}** for personalization * * @return $this */ - public function setToField($toField) + public function setToField(?string $toField): static { + if (is_null($toField)) { + throw new InvalidArgumentException('non-nullable toField cannot be null'); + } $this->container['toField'] = $toField; return $this; @@ -674,9 +714,9 @@ public function setToField($toField) /** * Gets recipients * - * @return \Brevo\Client\Models\UpdateEmailCampaignRecipients + * @return \Brevo\Client\Models\UpdateEmailCampaignRecipients|null */ - public function getRecipients() + public function getRecipients(): ?\Brevo\Client\Models\UpdateEmailCampaignRecipients { return $this->container['recipients']; } @@ -684,12 +724,15 @@ public function getRecipients() /** * Sets recipients * - * @param \Brevo\Client\Models\UpdateEmailCampaignRecipients $recipients recipients + * @param \Brevo\Client\Models\UpdateEmailCampaignRecipients|null $recipients recipients * * @return $this */ - public function setRecipients($recipients) + public function setRecipients(?\Brevo\Client\Models\UpdateEmailCampaignRecipients $recipients): static { + if (is_null($recipients)) { + throw new InvalidArgumentException('non-nullable recipients cannot be null'); + } $this->container['recipients'] = $recipients; return $this; @@ -698,9 +741,9 @@ public function setRecipients($recipients) /** * Gets attachmentUrl * - * @return string + * @return string|null */ - public function getAttachmentUrl() + public function getAttachmentUrl(): ?string { return $this->container['attachmentUrl']; } @@ -708,12 +751,15 @@ 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 + * @param string|null $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) + public function setAttachmentUrl(?string $attachmentUrl): static { + if (is_null($attachmentUrl)) { + throw new InvalidArgumentException('non-nullable attachmentUrl cannot be null'); + } $this->container['attachmentUrl'] = $attachmentUrl; return $this; @@ -722,9 +768,9 @@ public function setAttachmentUrl($attachmentUrl) /** * Gets inlineImageActivation * - * @return bool + * @return bool|null */ - public function getInlineImageActivation() + public function getInlineImageActivation(): ?bool { return $this->container['inlineImageActivation']; } @@ -732,12 +778,15 @@ 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. + * @param bool|null $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) + public function setInlineImageActivation(?bool $inlineImageActivation): static { + if (is_null($inlineImageActivation)) { + throw new InvalidArgumentException('non-nullable inlineImageActivation cannot be null'); + } $this->container['inlineImageActivation'] = $inlineImageActivation; return $this; @@ -746,9 +795,9 @@ public function setInlineImageActivation($inlineImageActivation) /** * Gets mirrorActive * - * @return bool + * @return bool|null */ - public function getMirrorActive() + public function getMirrorActive(): ?bool { return $this->container['mirrorActive']; } @@ -756,12 +805,15 @@ 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 + * @param bool|null $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) + public function setMirrorActive(?bool $mirrorActive): static { + if (is_null($mirrorActive)) { + throw new InvalidArgumentException('non-nullable mirrorActive cannot be null'); + } $this->container['mirrorActive'] = $mirrorActive; return $this; @@ -770,9 +822,9 @@ public function setMirrorActive($mirrorActive) /** * Gets recurring * - * @return bool + * @return bool|null */ - public function getRecurring() + public function getRecurring(): ?bool { return $this->container['recurring']; } @@ -780,12 +832,15 @@ 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 + * @param bool|null $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) + public function setRecurring(?bool $recurring): static { + if (is_null($recurring)) { + throw new InvalidArgumentException('non-nullable recurring cannot be null'); + } $this->container['recurring'] = $recurring; return $this; @@ -794,9 +849,9 @@ public function setRecurring($recurring) /** * Gets footer * - * @return string + * @return string|null */ - public function getFooter() + public function getFooter(): ?string { return $this->container['footer']; } @@ -804,12 +859,15 @@ public function getFooter() /** * Sets footer * - * @param string $footer Footer of the email campaign + * @param string|null $footer Footer of the email campaign * * @return $this */ - public function setFooter($footer) + public function setFooter(?string $footer): static { + if (is_null($footer)) { + throw new InvalidArgumentException('non-nullable footer cannot be null'); + } $this->container['footer'] = $footer; return $this; @@ -818,9 +876,9 @@ public function setFooter($footer) /** * Gets header * - * @return string + * @return string|null */ - public function getHeader() + public function getHeader(): ?string { return $this->container['header']; } @@ -828,12 +886,15 @@ public function getHeader() /** * Sets header * - * @param string $header Header of the email campaign + * @param string|null $header Header of the email campaign * * @return $this */ - public function setHeader($header) + public function setHeader(?string $header): static { + if (is_null($header)) { + throw new InvalidArgumentException('non-nullable header cannot be null'); + } $this->container['header'] = $header; return $this; @@ -842,9 +903,9 @@ public function setHeader($header) /** * Gets utmCampaign * - * @return string + * @return string|null */ - public function getUtmCampaign() + public function getUtmCampaign(): ?string { return $this->container['utmCampaign']; } @@ -852,12 +913,15 @@ 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 + * @param string|null $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) + public function setUtmCampaign(?string $utmCampaign): static { + if (is_null($utmCampaign)) { + throw new InvalidArgumentException('non-nullable utmCampaign cannot be null'); + } $this->container['utmCampaign'] = $utmCampaign; return $this; @@ -866,9 +930,9 @@ public function setUtmCampaign($utmCampaign) /** * Gets params * - * @return object + * @return array|null */ - public function getParams() + public function getParams(): ?array { return $this->container['params']; } @@ -876,12 +940,15 @@ public function getParams() /** * Sets params * - * @param object $params Pass the set of attributes to customize the type 'classic' campaign. For example, {\"FNAME\":\"Joe\", \"LNAME\":\"Doe\"}. The 'params' field will get updated, only if the campaign is in New Template Language, else ignored. The New Template Language is dependent on the values of 'subject', 'htmlContent/htmlUrl', 'sender.name' & 'toField' + * @param array|null $params Pass the set of attributes to customize the type classic campaign. For example: **{\"FNAME\":\"Joe\", \"LNAME\":\"Doe\"}**. Only available if **type** is **classic**. It's considered only if campaign is in _New Template Language format_. The New Template Language is dependent on the values of **subject, htmlContent/htmlUrl, sender.name & toField** * * @return $this */ - public function setParams($params) + public function setParams(?array $params): static { + if (is_null($params)) { + throw new InvalidArgumentException('non-nullable params cannot be null'); + } $this->container['params'] = $params; return $this; @@ -890,9 +957,9 @@ public function setParams($params) /** * Gets sendAtBestTime * - * @return bool + * @return bool|null */ - public function getSendAtBestTime() + public function getSendAtBestTime(): ?bool { return $this->container['sendAtBestTime']; } @@ -900,12 +967,15 @@ public function getSendAtBestTime() /** * Sets sendAtBestTime * - * @param bool $sendAtBestTime Set this to true if you want to send your campaign at best time. Note:- if true, warmup ip will be disabled. + * @param bool|null $sendAtBestTime Set this to true if you want to send your campaign at best time. Note:- **if true, warmup ip will be disabled.** * * @return $this */ - public function setSendAtBestTime($sendAtBestTime) + public function setSendAtBestTime(?bool $sendAtBestTime): static { + if (is_null($sendAtBestTime)) { + throw new InvalidArgumentException('non-nullable sendAtBestTime cannot be null'); + } $this->container['sendAtBestTime'] = $sendAtBestTime; return $this; @@ -914,9 +984,9 @@ public function setSendAtBestTime($sendAtBestTime) /** * Gets abTesting * - * @return bool + * @return bool|null */ - public function getAbTesting() + public function getAbTesting(): ?bool { return $this->container['abTesting']; } @@ -924,12 +994,15 @@ public function getAbTesting() /** * Sets abTesting * - * @param bool $abTesting Status of A/B Test. abTesting = false means it is disabled, & abTesting = true means it is enabled. 'subjectA', 'subjectB', 'splitRule', 'winnerCriteria' & 'winnerDelay' will be considered if abTesting is set to true. 'subject' if passed is ignored. Can be set to true only if 'sendAtBestTime' is 'false'. You will be able to set up two subject lines for your campaign and send them to a random sample of your total recipients. Half of the test group will receive version A, and the other half will receive version B + * @param bool|null $abTesting Status of A/B Test. abTesting = false means it is disabled & abTesting = true means it is enabled. **subjectA, subjectB, splitRule, winnerCriteria & winnerDelay** will be considered when abTesting is set to true. subjectA & subjectB are mandatory together & subject if passed is ignored. **Can be set to true only if sendAtBestTime is false**. You will be able to set up two subject lines for your campaign and send them to a random sample of your total recipients. Half of the test group will receive version A, and the other half will receive version B * * @return $this */ - public function setAbTesting($abTesting) + public function setAbTesting(?bool $abTesting): static { + if (is_null($abTesting)) { + throw new InvalidArgumentException('non-nullable abTesting cannot be null'); + } $this->container['abTesting'] = $abTesting; return $this; @@ -938,9 +1011,9 @@ public function setAbTesting($abTesting) /** * Gets subjectA * - * @return string + * @return string|null */ - public function getSubjectA() + public function getSubjectA(): ?string { return $this->container['subjectA']; } @@ -948,12 +1021,15 @@ public function getSubjectA() /** * Sets subjectA * - * @param string $subjectA Subject A of the campaign. Considered if abTesting = true. subjectA & subjectB should have unique value + * @param string|null $subjectA Subject A of the campaign. **Mandatory if abTesting = true**. subjectA & subjectB should have unique value * * @return $this */ - public function setSubjectA($subjectA) + public function setSubjectA(?string $subjectA): static { + if (is_null($subjectA)) { + throw new InvalidArgumentException('non-nullable subjectA cannot be null'); + } $this->container['subjectA'] = $subjectA; return $this; @@ -962,9 +1038,9 @@ public function setSubjectA($subjectA) /** * Gets subjectB * - * @return string + * @return string|null */ - public function getSubjectB() + public function getSubjectB(): ?string { return $this->container['subjectB']; } @@ -972,12 +1048,15 @@ public function getSubjectB() /** * Sets subjectB * - * @param string $subjectB Subject B of the campaign. Considered if abTesting = true. subjectA & subjectB should have unique value + * @param string|null $subjectB Subject B of the campaign. **Mandatory if abTesting = true**. subjectA & subjectB should have unique value * * @return $this */ - public function setSubjectB($subjectB) + public function setSubjectB(?string $subjectB): static { + if (is_null($subjectB)) { + throw new InvalidArgumentException('non-nullable subjectB cannot be null'); + } $this->container['subjectB'] = $subjectB; return $this; @@ -986,9 +1065,9 @@ public function setSubjectB($subjectB) /** * Gets splitRule * - * @return int + * @return int|null */ - public function getSplitRule() + public function getSplitRule(): ?int { return $this->container['splitRule']; } @@ -996,18 +1075,21 @@ public function getSplitRule() /** * Sets splitRule * - * @param int $splitRule Add the size of your test groups. Considered if abTesting = true. We'll send version A and B to a random sample of recipients, and then the winning version to everyone else + * @param int|null $splitRule Add the size of your test groups. **Mandatory if abTesting = true & 'recipients' is passed**. We'll send version A and B to a random sample of recipients, and then the winning version to everyone else * * @return $this */ - public function setSplitRule($splitRule) + public function setSplitRule(?int $splitRule): static { + if (is_null($splitRule)) { + throw new InvalidArgumentException('non-nullable splitRule cannot be null'); + } - if (!is_null($splitRule) && ($splitRule > 50)) { - throw new \InvalidArgumentException('invalid value for $splitRule when calling UpdateEmailCampaign., must be smaller than or equal to 50.'); + if (($splitRule > 50)) { + throw new InvalidArgumentException('invalid value for $splitRule when calling UpdateEmailCampaign., must be smaller than or equal to 50.'); } - if (!is_null($splitRule) && ($splitRule < 1)) { - throw new \InvalidArgumentException('invalid value for $splitRule when calling UpdateEmailCampaign., must be bigger than or equal to 1.'); + if (($splitRule < 1)) { + throw new InvalidArgumentException('invalid value for $splitRule when calling UpdateEmailCampaign., must be bigger than or equal to 1.'); } $this->container['splitRule'] = $splitRule; @@ -1018,9 +1100,9 @@ public function setSplitRule($splitRule) /** * Gets winnerCriteria * - * @return string + * @return string|null */ - public function getWinnerCriteria() + public function getWinnerCriteria(): ?string { return $this->container['winnerCriteria']; } @@ -1028,17 +1110,21 @@ public function getWinnerCriteria() /** * Sets winnerCriteria * - * @param string $winnerCriteria Choose the metrics that will determinate the winning version. Considered if 'splitRule' >= 1 and < 50. If splitRule = 50, 'winnerCriteria' is ignored if passed or alreday exist in record + * @param string|null $winnerCriteria Choose the metrics that will determinate the winning version. **Mandatory if _splitRule_ >= 1 and < 50**. If splitRule = 50, `winnerCriteria` is ignored if passed * * @return $this */ - public function setWinnerCriteria($winnerCriteria) + public function setWinnerCriteria(?string $winnerCriteria): static { + if (is_null($winnerCriteria)) { + throw new InvalidArgumentException('non-nullable winnerCriteria cannot be null'); + } $allowedValues = $this->getWinnerCriteriaAllowableValues(); - if (!is_null($winnerCriteria) && !in_array($winnerCriteria, $allowedValues, true)) { - throw new \InvalidArgumentException( + if (!in_array($winnerCriteria, $allowedValues, true)) { + throw new InvalidArgumentException( sprintf( - "Invalid value for 'winnerCriteria', must be one of '%s'", + "Invalid value '%s' for 'winnerCriteria', must be one of '%s'", + $winnerCriteria, implode("', '", $allowedValues) ) ); @@ -1051,9 +1137,9 @@ public function setWinnerCriteria($winnerCriteria) /** * Gets winnerDelay * - * @return int + * @return int|null */ - public function getWinnerDelay() + public function getWinnerDelay(): ?int { return $this->container['winnerDelay']; } @@ -1061,18 +1147,21 @@ public function getWinnerDelay() /** * Sets winnerDelay * - * @param int $winnerDelay Choose the duration of the test in hours. Maximum is 7 days, pass 24*7 = 168 hours. The winning version will be sent at the end of the test. Considered if 'splitRule' >= 1 and < 50. If splitRule = 50, 'winnerDelay' is ignored if passed or alreday exist in record + * @param int|null $winnerDelay Choose the duration of the test in hours. Maximum is 7 days, pass 24*7 = 168 hours. The winning version will be sent at the end of the test. **Mandatory if _splitRule_ >= 1 and < 50**. If splitRule = 50, `winnerDelay` is ignored if passed * * @return $this */ - public function setWinnerDelay($winnerDelay) + public function setWinnerDelay(?int $winnerDelay): static { + if (is_null($winnerDelay)) { + throw new InvalidArgumentException('non-nullable winnerDelay cannot be null'); + } - if (!is_null($winnerDelay) && ($winnerDelay > 168)) { - throw new \InvalidArgumentException('invalid value for $winnerDelay when calling UpdateEmailCampaign., must be smaller than or equal to 168.'); + if (($winnerDelay > 168)) { + throw new InvalidArgumentException('invalid value for $winnerDelay when calling UpdateEmailCampaign., must be smaller than or equal to 168.'); } - if (!is_null($winnerDelay) && ($winnerDelay < 1)) { - throw new \InvalidArgumentException('invalid value for $winnerDelay when calling UpdateEmailCampaign., must be bigger than or equal to 1.'); + if (($winnerDelay < 1)) { + throw new InvalidArgumentException('invalid value for $winnerDelay when calling UpdateEmailCampaign., must be bigger than or equal to 1.'); } $this->container['winnerDelay'] = $winnerDelay; @@ -1083,9 +1172,9 @@ public function setWinnerDelay($winnerDelay) /** * Gets ipWarmupEnable * - * @return bool + * @return bool|null */ - public function getIpWarmupEnable() + public function getIpWarmupEnable(): ?bool { return $this->container['ipWarmupEnable']; } @@ -1093,12 +1182,15 @@ public function getIpWarmupEnable() /** * Sets ipWarmupEnable * - * @param bool $ipWarmupEnable Available for dedicated ip clients. Set this to true if you wish to warm up your ip. + * @param bool|null $ipWarmupEnable **Available for dedicated ip clients**. Set this to true if you wish to warm up your ip. * * @return $this */ - public function setIpWarmupEnable($ipWarmupEnable) + public function setIpWarmupEnable(?bool $ipWarmupEnable): static { + if (is_null($ipWarmupEnable)) { + throw new InvalidArgumentException('non-nullable ipWarmupEnable cannot be null'); + } $this->container['ipWarmupEnable'] = $ipWarmupEnable; return $this; @@ -1107,9 +1199,9 @@ public function setIpWarmupEnable($ipWarmupEnable) /** * Gets initialQuota * - * @return int + * @return int|null */ - public function getInitialQuota() + public function getInitialQuota(): ?int { return $this->container['initialQuota']; } @@ -1117,12 +1209,15 @@ public function getInitialQuota() /** * Sets initialQuota * - * @param int $initialQuota Set an initial quota greater than 1 for warming up your ip. We recommend you set a value of 3000. + * @param int|null $initialQuota Set an initial quota greater than 1 for warming up your ip. We recommend you set a value of 3000. * * @return $this */ - public function setInitialQuota($initialQuota) + public function setInitialQuota(?int $initialQuota): static { + if (is_null($initialQuota)) { + throw new InvalidArgumentException('non-nullable initialQuota cannot be null'); + } $this->container['initialQuota'] = $initialQuota; return $this; @@ -1131,9 +1226,9 @@ public function setInitialQuota($initialQuota) /** * Gets increaseRate * - * @return int + * @return int|null */ - public function getIncreaseRate() + public function getIncreaseRate(): ?int { return $this->container['increaseRate']; } @@ -1141,18 +1236,21 @@ public function getIncreaseRate() /** * Sets increaseRate * - * @param int $increaseRate Set a percentage increase rate for warming up your ip. We recommend you set the increase rate to 30% per day. If you want to send the same number of emails every day, set the daily increase value to 0%. + * @param int|null $increaseRate Set a percentage increase rate for warming up your ip. We recommend you set the increase rate to 30% per day. If you want to send the same number of emails every day, set the daily increase value to 0%. * * @return $this */ - public function setIncreaseRate($increaseRate) + public function setIncreaseRate(?int $increaseRate): static { + if (is_null($increaseRate)) { + throw new InvalidArgumentException('non-nullable increaseRate cannot be null'); + } - if (!is_null($increaseRate) && ($increaseRate > 100)) { - throw new \InvalidArgumentException('invalid value for $increaseRate when calling UpdateEmailCampaign., must be smaller than or equal to 100.'); + if (($increaseRate > 100)) { + throw new InvalidArgumentException('invalid value for $increaseRate when calling UpdateEmailCampaign., must be smaller than or equal to 100.'); } - if (!is_null($increaseRate) && ($increaseRate < 0)) { - throw new \InvalidArgumentException('invalid value for $increaseRate when calling UpdateEmailCampaign., must be bigger than or equal to 0.'); + if (($increaseRate < 0)) { + throw new InvalidArgumentException('invalid value for $increaseRate when calling UpdateEmailCampaign., must be bigger than or equal to 0.'); } $this->container['increaseRate'] = $increaseRate; @@ -1163,9 +1261,9 @@ public function setIncreaseRate($increaseRate) /** * Gets unsubscriptionPageId * - * @return string + * @return string|null */ - public function getUnsubscriptionPageId() + public function getUnsubscriptionPageId(): ?string { return $this->container['unsubscriptionPageId']; } @@ -1173,12 +1271,15 @@ public function getUnsubscriptionPageId() /** * Sets unsubscriptionPageId * - * @param string $unsubscriptionPageId Enter an unsubscription page id. The page id is a 24 digit alphanumeric id that can be found in the URL when editing the page. + * @param string|null $unsubscriptionPageId Enter an unsubscription page id. The page id is a 24 digit alphanumeric id that can be found in the URL when editing the page. * * @return $this */ - public function setUnsubscriptionPageId($unsubscriptionPageId) + public function setUnsubscriptionPageId(?string $unsubscriptionPageId): static { + if (is_null($unsubscriptionPageId)) { + throw new InvalidArgumentException('non-nullable unsubscriptionPageId cannot be null'); + } $this->container['unsubscriptionPageId'] = $unsubscriptionPageId; return $this; @@ -1187,9 +1288,9 @@ public function setUnsubscriptionPageId($unsubscriptionPageId) /** * Gets updateFormId * - * @return string + * @return string|null */ - public function getUpdateFormId() + public function getUpdateFormId(): ?string { return $this->container['updateFormId']; } @@ -1197,88 +1298,45 @@ public function getUpdateFormId() /** * Sets updateFormId * - * @param string $updateFormId Mandatory if templateId is used containing the {{ update_profile }} tag. Enter an update profile form id. The form id is a 24 digit alphanumeric id that can be found in the URL when editing the form. + * @param string|null $updateFormId **Mandatory if templateId is used containing the {{ update_profile }} tag**. Enter an update profile form id. The form id is a 24 digit alphanumeric id that can be found in the URL when editing the form. * * @return $this */ - public function setUpdateFormId($updateFormId) + public function setUpdateFormId(?string $updateFormId): static { + if (is_null($updateFormId)) { + throw new InvalidArgumentException('non-nullable updateFormId cannot be null'); + } $this->container['updateFormId'] = $updateFormId; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 + * Gets emailExpirationDate * - * @return void + * @return \Brevo\Client\Models\UpdateEmailCampaignEmailExpirationDate|null */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function getEmailExpirationDate(): ?\Brevo\Client\Models\UpdateEmailCampaignEmailExpirationDate { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } + return $this->container['emailExpirationDate']; } /** - * Unsets offset. - * - * @param integer $offset Offset + * Sets emailExpirationDate * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object + * @param \Brevo\Client\Models\UpdateEmailCampaignEmailExpirationDate|null $emailExpirationDate emailExpirationDate * - * @return string + * @return $this */ - public function __toString() + public function setEmailExpirationDate(?\Brevo\Client\Models\UpdateEmailCampaignEmailExpirationDate $emailExpirationDate): static { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); + if (is_null($emailExpirationDate)) { + throw new InvalidArgumentException('non-nullable emailExpirationDate cannot be null'); } + $this->container['emailExpirationDate'] = $emailExpirationDate; - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + return $this; } } diff --git a/lib/Models/UpdateEmailCampaignEmailExpirationDate.php b/lib/Models/UpdateEmailCampaignEmailExpirationDate.php new file mode 100644 index 0000000..b8b32db --- /dev/null +++ b/lib/Models/UpdateEmailCampaignEmailExpirationDate.php @@ -0,0 +1,294 @@ + + */ +class UpdateEmailCampaignEmailExpirationDate extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'updateEmailCampaign_emailExpirationDate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'duration' => 'int', + 'unit' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'duration' => 'int64', + 'unit' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'duration' => false, + 'unit' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'duration' => 'duration', + 'unit' => 'unit' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'duration' => 'setDuration', + 'unit' => 'setUnit' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'duration' => 'getDuration', + 'unit' => 'getUnit' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const UNIT_DAYS = 'days'; + public const UNIT_WEEKS = 'weeks'; + public const UNIT_MONTHS = 'months'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getUnitAllowableValues() + { + return [ + self::UNIT_DAYS, + self::UNIT_WEEKS, + self::UNIT_MONTHS, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('duration', $data ?? [], null); + $this->setIfExists('unit', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['duration']) && ($this->container['duration'] > 3600)) { + $invalidProperties[] = "invalid value for 'duration', must be smaller than or equal to 3600."; + } + + if (!is_null($this->container['duration']) && ($this->container['duration'] < 1)) { + $invalidProperties[] = "invalid value for 'duration', must be bigger than or equal to 1."; + } + + $allowedValues = $this->getUnitAllowableValues(); + if (!is_null($this->container['unit']) && !in_array($this->container['unit'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'unit', must be one of '%s'", + $this->container['unit'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets duration + * + * @return int|null + */ + public function getDuration(): ?int + { + return $this->container['duration']; + } + + /** + * Sets duration + * + * @param int|null $duration Duration of the email expiry. maximum duration can be 3600 days or 480 weeks or 120 months. + * + * @return $this + */ + public function setDuration(?int $duration): static + { + if (is_null($duration)) { + throw new InvalidArgumentException('non-nullable duration cannot be null'); + } + + if (($duration > 3600)) { + throw new InvalidArgumentException('invalid value for $duration when calling UpdateEmailCampaignEmailExpirationDate., must be smaller than or equal to 3600.'); + } + if (($duration < 1)) { + throw new InvalidArgumentException('invalid value for $duration when calling UpdateEmailCampaignEmailExpirationDate., must be bigger than or equal to 1.'); + } + + $this->container['duration'] = $duration; + + return $this; + } + + /** + * Gets unit + * + * @return string|null + */ + public function getUnit(): ?string + { + return $this->container['unit']; + } + + /** + * Sets unit + * + * @param string|null $unit unit of the duration + * + * @return $this + */ + public function setUnit(?string $unit): static + { + if (is_null($unit)) { + throw new InvalidArgumentException('non-nullable unit cannot be null'); + } + $allowedValues = $this->getUnitAllowableValues(); + if (!in_array($unit, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'unit', must be one of '%s'", + $unit, + implode("', '", $allowedValues) + ) + ); + } + $this->container['unit'] = $unit; + + return $this; + } +} + + diff --git a/lib/Models/UpdateEmailCampaignRecipients.php b/lib/Models/UpdateEmailCampaignRecipients.php index 2a2bc8d..d917966 100644 --- a/lib/Models/UpdateEmailCampaignRecipients.php +++ b/lib/Models/UpdateEmailCampaignRecipients.php @@ -2,62 +2,64 @@ /** * UpdateEmailCampaignRecipients * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * UpdateEmailCampaignRecipients Class Doc Comment * - * @category Class * @description Segment ids and List ids to include/exclude from campaign * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class UpdateEmailCampaignRecipients implements ModelInterface, ArrayAccess +class UpdateEmailCampaignRecipients extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'updateEmailCampaign_recipients'; + protected static string $openAPIModelName = 'updateEmailCampaign_recipients'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'exclusionListIds' => 'int[]', 'listIds' => 'int[]', 'segmentIds' => 'int[]' @@ -66,41 +68,39 @@ class UpdateEmailCampaignRecipients implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'exclusionListIds' => 'int64', 'listIds' => 'int64', 'segmentIds' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'exclusionListIds' => false, + 'listIds' => false, + 'segmentIds' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'exclusionListIds' => 'exclusionListIds', 'listIds' => 'listIds', 'segmentIds' => 'segmentIds' @@ -109,9 +109,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'exclusionListIds' => 'setExclusionListIds', 'listIds' => 'setListIds', 'segmentIds' => 'setSegmentIds' @@ -120,9 +120,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'exclusionListIds' => 'getExclusionListIds', 'listIds' => 'getListIds', 'segmentIds' => 'getSegmentIds' @@ -132,9 +132,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -142,9 +142,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -152,77 +152,51 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['exclusionListIds'] = isset($data['exclusionListIds']) ? $data['exclusionListIds'] : null; - $this->container['listIds'] = isset($data['listIds']) ? $data['listIds'] : null; - $this->container['segmentIds'] = isset($data['segmentIds']) ? $data['segmentIds'] : null; + $this->setIfExists('exclusionListIds', $data ?? [], null); + $this->setIfExists('listIds', $data ?? [], null); + $this->setIfExists('segmentIds', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets exclusionListIds * - * @return int[] + * @return int[]|null */ - public function getExclusionListIds() + public function getExclusionListIds(): ?array { return $this->container['exclusionListIds']; } @@ -230,12 +204,15 @@ public function getExclusionListIds() /** * Sets exclusionListIds * - * @param int[] $exclusionListIds List ids which have to be excluded from a campaign + * @param int[]|null $exclusionListIds List ids which have to be excluded from a campaign * * @return $this */ - public function setExclusionListIds($exclusionListIds) + public function setExclusionListIds(?array $exclusionListIds): static { + if (is_null($exclusionListIds)) { + throw new InvalidArgumentException('non-nullable exclusionListIds cannot be null'); + } $this->container['exclusionListIds'] = $exclusionListIds; return $this; @@ -244,9 +221,9 @@ public function setExclusionListIds($exclusionListIds) /** * Gets listIds * - * @return int[] + * @return int[]|null */ - public function getListIds() + public function getListIds(): ?array { return $this->container['listIds']; } @@ -254,12 +231,15 @@ public function getListIds() /** * Sets listIds * - * @param int[] $listIds Lists Ids to send the campaign to. Campaign should only be updated with listIds if listIds were used to create it. REQUIRED if already not present in campaign and scheduledAt is not empty + * @param int[]|null $listIds Lists Ids to send the campaign to. **Campaign should only be updated with listIds if listIds were used to create it. REQUIRED if already not present in campaign and scheduledAt is not empty** * * @return $this */ - public function setListIds($listIds) + public function setListIds(?array $listIds): static { + if (is_null($listIds)) { + throw new InvalidArgumentException('non-nullable listIds cannot be null'); + } $this->container['listIds'] = $listIds; return $this; @@ -268,9 +248,9 @@ public function setListIds($listIds) /** * Gets segmentIds * - * @return int[] + * @return int[]|null */ - public function getSegmentIds() + public function getSegmentIds(): ?array { return $this->container['segmentIds']; } @@ -278,89 +258,19 @@ public function getSegmentIds() /** * Sets segmentIds * - * @param int[] $segmentIds Mandatory if listIds are not used. Campaign should only be updated with segmentIds if segmentIds were used to create it. Segment ids to send the campaign to. + * @param int[]|null $segmentIds **Mandatory if listIds are not used. Campaign should only be updated with segmentIds if segmentIds were used to create it.** Segment ids to send the campaign to. * * @return $this */ - public function setSegmentIds($segmentIds) + public function setSegmentIds(?array $segmentIds): static { + if (is_null($segmentIds)) { + throw new InvalidArgumentException('non-nullable segmentIds cannot be null'); + } $this->container['segmentIds'] = $segmentIds; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/UpdateEmailCampaignSender.php b/lib/Models/UpdateEmailCampaignSender.php index 996d840..fde75c1 100644 --- a/lib/Models/UpdateEmailCampaignSender.php +++ b/lib/Models/UpdateEmailCampaignSender.php @@ -2,62 +2,64 @@ /** * UpdateEmailCampaignSender * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * UpdateEmailCampaignSender Class Doc Comment * - * @category Class - * @description Sender details including id or email and name (optional). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example `{\"name\":\"xyz\", \"email\":\"example@abc.com\"}` , `{\"name\":\"xyz\", \"id\":123}` + * @description Sender details including id or email and name (optional). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example: **{\"name\":\"xyz\", \"email\":\"example@abc.com\"}** **{\"name\":\"xyz\", \"id\":123}** * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class UpdateEmailCampaignSender implements ModelInterface, ArrayAccess +class UpdateEmailCampaignSender extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'updateEmailCampaign_sender'; + protected static string $openAPIModelName = 'updateEmailCampaign_sender'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string', 'email' => 'string', 'id' => 'int' @@ -66,41 +68,39 @@ class UpdateEmailCampaignSender implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null, 'email' => 'email', 'id' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'email' => false, + 'id' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name', 'email' => 'email', 'id' => 'id' @@ -109,9 +109,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName', 'email' => 'setEmail', 'id' => 'setId' @@ -120,9 +120,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName', 'email' => 'getEmail', 'id' => 'getId' @@ -132,9 +132,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -142,9 +142,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -152,77 +152,51 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * - * @return string + * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -230,12 +204,15 @@ public function getName() /** * Sets name * - * @param string $name Sender Name from which the campaign emails are sent + * @param string|null $name Sender Name from which the campaign emails are sent * * @return $this */ - public function setName($name) + public function setName(?string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -244,9 +221,9 @@ public function setName($name) /** * Gets email * - * @return string + * @return string|null */ - public function getEmail() + public function getEmail(): ?string { return $this->container['email']; } @@ -254,12 +231,15 @@ public function getEmail() /** * Sets email * - * @param string $email Sender email from which the campaign emails are sent + * @param string|null $email Sender email from which the campaign emails are sent * * @return $this */ - public function setEmail($email) + public function setEmail(?string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -268,9 +248,9 @@ public function setEmail($email) /** * Gets id * - * @return int + * @return int|null */ - public function getId() + public function getId(): ?int { return $this->container['id']; } @@ -278,89 +258,19 @@ public function getId() /** * Sets id * - * @param int $id Select the sender for the campaign on the basis of sender id. In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email). + * @param int|null $id Select the sender for the campaign on the basis of sender id. **In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email)**. * * @return $this */ - public function setId($id) + public function setId(?int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/UpdateExternalFeed.php b/lib/Models/UpdateExternalFeed.php index 26bc855..f1f837f 100644 --- a/lib/Models/UpdateExternalFeed.php +++ b/lib/Models/UpdateExternalFeed.php @@ -2,68 +2,70 @@ /** * UpdateExternalFeed * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * UpdateExternalFeed Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class UpdateExternalFeed implements ModelInterface, ArrayAccess +class UpdateExternalFeed extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'updateExternalFeed'; + protected static string $openAPIModelName = 'updateExternalFeed'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string', 'url' => 'string', 'authType' => 'string', 'username' => 'string', 'password' => 'string', 'token' => 'string', - 'headers' => '\Brevo\Client\Models\GetExternalFeedByUUIDHeaders[]', + 'headers' => '\Brevo\Client\Models\GetExternalFeedByUUIDHeadersInner[]', 'maxRetries' => 'int', 'cache' => 'bool' ]; @@ -71,9 +73,9 @@ class UpdateExternalFeed implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null, 'url' => 'url', 'authType' => null, @@ -86,32 +88,36 @@ class UpdateExternalFeed implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'url' => false, + 'authType' => false, + 'username' => false, + 'password' => false, + 'token' => false, + 'headers' => false, + 'maxRetries' => false, + 'cache' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name', 'url' => 'url', 'authType' => 'authType', @@ -126,9 +132,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName', 'url' => 'setUrl', 'authType' => 'setAuthType', @@ -143,9 +149,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName', 'url' => 'getUrl', 'authType' => 'getAuthType', @@ -161,9 +167,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -171,9 +177,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -181,28 +187,16 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const AUTH_TYPE_BASIC = 'basic'; - const AUTH_TYPE_TOKEN = 'token'; - const AUTH_TYPE_NO_AUTH = 'noAuth'; - - + public const AUTH_TYPE_BASIC = 'basic'; + public const AUTH_TYPE_TOKEN = 'token'; + public const AUTH_TYPE_NO_AUTH = 'noAuth'; /** * Gets allowable values of the enum @@ -218,46 +212,45 @@ public function getAuthTypeAllowableValues() ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['authType'] = isset($data['authType']) ? $data['authType'] : null; - $this->container['username'] = isset($data['username']) ? $data['username'] : null; - $this->container['password'] = isset($data['password']) ? $data['password'] : null; - $this->container['token'] = isset($data['token']) ? $data['token'] : null; - $this->container['headers'] = isset($data['headers']) ? $data['headers'] : null; - $this->container['maxRetries'] = isset($data['maxRetries']) ? $data['maxRetries'] : null; - $this->container['cache'] = isset($data['cache']) ? $data['cache'] : false; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('authType', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('password', $data ?? [], null); + $this->setIfExists('token', $data ?? [], null); + $this->setIfExists('headers', $data ?? [], null); + $this->setIfExists('maxRetries', $data ?? [], 5); + $this->setIfExists('cache', $data ?? [], false); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; $allowedValues = $this->getAuthTypeAllowableValues(); if (!is_null($this->container['authType']) && !in_array($this->container['authType'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'authType', must be one of '%s'", + "invalid value '%s' for 'authType', must be one of '%s'", + $this->container['authType'], implode("', '", $allowedValues) ); } @@ -273,24 +266,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * - * @return string + * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -298,12 +279,15 @@ public function getName() /** * Sets name * - * @param string $name Name of the feed + * @param string|null $name Name of the feed * * @return $this */ - public function setName($name) + public function setName(?string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -312,9 +296,9 @@ public function setName($name) /** * Gets url * - * @return string + * @return string|null */ - public function getUrl() + public function getUrl(): ?string { return $this->container['url']; } @@ -322,12 +306,15 @@ public function getUrl() /** * Sets url * - * @param string $url URL of the feed + * @param string|null $url URL of the feed * * @return $this */ - public function setUrl($url) + public function setUrl(?string $url): static { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } $this->container['url'] = $url; return $this; @@ -336,9 +323,9 @@ public function setUrl($url) /** * Gets authType * - * @return string + * @return string|null */ - public function getAuthType() + public function getAuthType(): ?string { return $this->container['authType']; } @@ -346,17 +333,21 @@ public function getAuthType() /** * Sets authType * - * @param string $authType Auth type of the feed: * `basic` * `token` * `noAuth` + * @param string|null $authType Auth type of the feed: * `basic` * `token` * `noAuth` * * @return $this */ - public function setAuthType($authType) + public function setAuthType(?string $authType): static { + if (is_null($authType)) { + throw new InvalidArgumentException('non-nullable authType cannot be null'); + } $allowedValues = $this->getAuthTypeAllowableValues(); - if (!is_null($authType) && !in_array($authType, $allowedValues, true)) { - throw new \InvalidArgumentException( + if (!in_array($authType, $allowedValues, true)) { + throw new InvalidArgumentException( sprintf( - "Invalid value for 'authType', must be one of '%s'", + "Invalid value '%s' for 'authType', must be one of '%s'", + $authType, implode("', '", $allowedValues) ) ); @@ -369,9 +360,9 @@ public function setAuthType($authType) /** * Gets username * - * @return string + * @return string|null */ - public function getUsername() + public function getUsername(): ?string { return $this->container['username']; } @@ -379,12 +370,15 @@ public function getUsername() /** * Sets username * - * @param string $username Username for authType `basic` + * @param string|null $username Username for authType `basic` * * @return $this */ - public function setUsername($username) + public function setUsername(?string $username): static { + if (is_null($username)) { + throw new InvalidArgumentException('non-nullable username cannot be null'); + } $this->container['username'] = $username; return $this; @@ -393,9 +387,9 @@ public function setUsername($username) /** * Gets password * - * @return string + * @return string|null */ - public function getPassword() + public function getPassword(): ?string { return $this->container['password']; } @@ -403,12 +397,15 @@ public function getPassword() /** * Sets password * - * @param string $password Password for authType `basic` + * @param string|null $password Password for authType `basic` * * @return $this */ - public function setPassword($password) + public function setPassword(?string $password): static { + if (is_null($password)) { + throw new InvalidArgumentException('non-nullable password cannot be null'); + } $this->container['password'] = $password; return $this; @@ -417,9 +414,9 @@ public function setPassword($password) /** * Gets token * - * @return string + * @return string|null */ - public function getToken() + public function getToken(): ?string { return $this->container['token']; } @@ -427,12 +424,15 @@ public function getToken() /** * Sets token * - * @param string $token Token for authType `token` + * @param string|null $token Token for authType `token` * * @return $this */ - public function setToken($token) + public function setToken(?string $token): static { + if (is_null($token)) { + throw new InvalidArgumentException('non-nullable token cannot be null'); + } $this->container['token'] = $token; return $this; @@ -441,9 +441,9 @@ public function setToken($token) /** * Gets headers * - * @return \Brevo\Client\Models\GetExternalFeedByUUIDHeaders[] + * @return \Brevo\Client\Models\GetExternalFeedByUUIDHeadersInner[]|null */ - public function getHeaders() + public function getHeaders(): ?array { return $this->container['headers']; } @@ -451,12 +451,15 @@ public function getHeaders() /** * Sets headers * - * @param \Brevo\Client\Models\GetExternalFeedByUUIDHeaders[] $headers Custom headers for the feed + * @param \Brevo\Client\Models\GetExternalFeedByUUIDHeadersInner[]|null $headers Custom headers for the feed * * @return $this */ - public function setHeaders($headers) + public function setHeaders(?array $headers): static { + if (is_null($headers)) { + throw new InvalidArgumentException('non-nullable headers cannot be null'); + } $this->container['headers'] = $headers; return $this; @@ -465,9 +468,9 @@ public function setHeaders($headers) /** * Gets maxRetries * - * @return int + * @return int|null */ - public function getMaxRetries() + public function getMaxRetries(): ?int { return $this->container['maxRetries']; } @@ -475,18 +478,21 @@ public function getMaxRetries() /** * Sets maxRetries * - * @param int $maxRetries Maximum number of retries on the feed url + * @param int|null $maxRetries Maximum number of retries on the feed url * * @return $this */ - public function setMaxRetries($maxRetries) + public function setMaxRetries(?int $maxRetries): static { + if (is_null($maxRetries)) { + throw new InvalidArgumentException('non-nullable maxRetries cannot be null'); + } - if (!is_null($maxRetries) && ($maxRetries > 5)) { - throw new \InvalidArgumentException('invalid value for $maxRetries when calling UpdateExternalFeed., must be smaller than or equal to 5.'); + if (($maxRetries > 5)) { + throw new InvalidArgumentException('invalid value for $maxRetries when calling UpdateExternalFeed., must be smaller than or equal to 5.'); } - if (!is_null($maxRetries) && ($maxRetries < 0)) { - throw new \InvalidArgumentException('invalid value for $maxRetries when calling UpdateExternalFeed., must be bigger than or equal to 0.'); + if (($maxRetries < 0)) { + throw new InvalidArgumentException('invalid value for $maxRetries when calling UpdateExternalFeed., must be bigger than or equal to 0.'); } $this->container['maxRetries'] = $maxRetries; @@ -497,9 +503,9 @@ public function setMaxRetries($maxRetries) /** * Gets cache * - * @return bool + * @return bool|null */ - public function getCache() + public function getCache(): ?bool { return $this->container['cache']; } @@ -507,89 +513,19 @@ public function getCache() /** * Sets cache * - * @param bool $cache Toggle caching of feed url response + * @param bool|null $cache Toggle caching of feed url response * * @return $this */ - public function setCache($cache) + public function setCache(?bool $cache): static { + if (is_null($cache)) { + throw new InvalidArgumentException('non-nullable cache cannot be null'); + } $this->container['cache'] = $cache; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/UpdateList.php b/lib/Models/UpdateList.php index 1413509..b8f9fec 100644 --- a/lib/Models/UpdateList.php +++ b/lib/Models/UpdateList.php @@ -2,61 +2,63 @@ /** * UpdateList * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * UpdateList Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class UpdateList implements ModelInterface, ArrayAccess +class UpdateList extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'updateList'; + protected static string $openAPIModelName = 'updateList'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string', 'folderId' => 'int' ]; @@ -64,40 +66,37 @@ class UpdateList implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null, 'folderId' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'folderId' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name', 'folderId' => 'folderId' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName', 'folderId' => 'setFolderId' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName', 'folderId' => 'getFolderId' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,76 +145,50 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['folderId'] = isset($data['folderId']) ? $data['folderId'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('folderId', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * - * @return string + * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -223,12 +196,15 @@ public function getName() /** * Sets name * - * @param string $name Name of the list. Either of the two parameters (name, folderId) can be updated at a time. + * @param string|null $name Name of the list. Either of the two parameters (name, folderId) can be updated at a time. * * @return $this */ - public function setName($name) + public function setName(?string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -237,9 +213,9 @@ public function setName($name) /** * Gets folderId * - * @return int + * @return int|null */ - public function getFolderId() + public function getFolderId(): ?int { return $this->container['folderId']; } @@ -247,89 +223,19 @@ public function getFolderId() /** * Sets folderId * - * @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. + * @param int|null $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) + public function setFolderId(?int $folderId): static { + if (is_null($folderId)) { + throw new InvalidArgumentException('non-nullable folderId cannot be null'); + } $this->container['folderId'] = $folderId; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/UpdateLoyaltyProgramPayload.php b/lib/Models/UpdateLoyaltyProgramPayload.php new file mode 100644 index 0000000..684aaed --- /dev/null +++ b/lib/Models/UpdateLoyaltyProgramPayload.php @@ -0,0 +1,278 @@ + + */ +class UpdateLoyaltyProgramPayload extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'updateLoyaltyProgramPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'description' => 'string', + 'meta' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'description' => null, + 'meta' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'description' => false, + 'meta' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'description' => 'description', + 'meta' => 'meta' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'description' => 'setDescription', + 'meta' => 'setMeta' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'description' => 'getDescription', + 'meta' => 'getMeta' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('meta', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Loyalty Program name + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Loyalty Program description + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets meta + * + * @return object|null + */ + public function getMeta(): ?object + { + return $this->container['meta']; + } + + /** + * Sets meta + * + * @param object|null $meta Loyalty Program meta data + * + * @return $this + */ + public function setMeta(?object $meta): static + { + if (is_null($meta)) { + throw new InvalidArgumentException('non-nullable meta cannot be null'); + } + $this->container['meta'] = $meta; + + return $this; + } +} + + diff --git a/lib/Models/UpdateSender.php b/lib/Models/UpdateSender.php index f847c8d..19fb240 100644 --- a/lib/Models/UpdateSender.php +++ b/lib/Models/UpdateSender.php @@ -2,104 +2,104 @@ /** * UpdateSender * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * UpdateSender Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class UpdateSender implements ModelInterface, ArrayAccess +class UpdateSender extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'updateSender'; + protected static string $openAPIModelName = 'updateSender'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string', 'email' => 'string', - 'ips' => '\Brevo\Client\Models\CreateSenderIps[]' + 'ips' => '\Brevo\Client\Models\CreateSenderIpsInner[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null, 'email' => 'email', 'ips' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'email' => false, + 'ips' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name', 'email' => 'email', 'ips' => 'ips' @@ -108,9 +108,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName', 'email' => 'setEmail', 'ips' => 'setIps' @@ -119,9 +119,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName', 'email' => 'getEmail', 'ips' => 'getIps' @@ -131,9 +131,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -141,9 +141,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -151,77 +151,51 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['ips'] = isset($data['ips']) ? $data['ips'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('ips', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * - * @return string + * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -229,12 +203,15 @@ public function getName() /** * Sets name * - * @param string $name From Name to update the sender + * @param string|null $name From Name to update the sender * * @return $this */ - public function setName($name) + public function setName(?string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -243,9 +220,9 @@ public function setName($name) /** * Gets email * - * @return string + * @return string|null */ - public function getEmail() + public function getEmail(): ?string { return $this->container['email']; } @@ -253,12 +230,15 @@ public function getEmail() /** * Sets email * - * @param string $email From Email to update the sender + * @param string|null $email From Email to update the sender * * @return $this */ - public function setEmail($email) + public function setEmail(?string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -267,9 +247,9 @@ public function setEmail($email) /** * Gets ips * - * @return \Brevo\Client\Models\CreateSenderIps[] + * @return \Brevo\Client\Models\CreateSenderIpsInner[]|null */ - public function getIps() + public function getIps(): ?array { return $this->container['ips']; } @@ -277,89 +257,19 @@ public function getIps() /** * Sets ips * - * @param \Brevo\Client\Models\CreateSenderIps[] $ips Only in case of dedicated IP, IPs to associate to the sender. If passed, will replace all the existing IPs. + * @param \Brevo\Client\Models\CreateSenderIpsInner[]|null $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) + public function setIps(?array $ips): static { + if (is_null($ips)) { + throw new InvalidArgumentException('non-nullable ips cannot be null'); + } $this->container['ips'] = $ips; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/UpdateSmsCampaign.php b/lib/Models/UpdateSmsCampaign.php index 85122a3..c68680a 100644 --- a/lib/Models/UpdateSmsCampaign.php +++ b/lib/Models/UpdateSmsCampaign.php @@ -2,61 +2,63 @@ /** * UpdateSmsCampaign * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * UpdateSmsCampaign Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class UpdateSmsCampaign implements ModelInterface, ArrayAccess +class UpdateSmsCampaign extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'updateSmsCampaign'; + protected static string $openAPIModelName = 'updateSmsCampaign'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string', 'sender' => 'string', 'content' => 'string', @@ -70,9 +72,9 @@ class UpdateSmsCampaign implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null, 'sender' => null, 'content' => null, @@ -84,32 +86,35 @@ class UpdateSmsCampaign implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'sender' => false, + 'content' => false, + 'recipients' => false, + 'scheduledAt' => false, + 'unicodeEnabled' => false, + 'organisationPrefix' => false, + 'unsubscribeInstruction' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name', 'sender' => 'sender', 'content' => 'content', @@ -123,9 +128,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName', 'sender' => 'setSender', 'content' => 'setContent', @@ -139,9 +144,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName', 'sender' => 'getSender', 'content' => 'getContent', @@ -156,9 +161,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -166,9 +171,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -176,58 +181,44 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['sender'] = isset($data['sender']) ? $data['sender'] : null; - $this->container['content'] = isset($data['content']) ? $data['content'] : null; - $this->container['recipients'] = isset($data['recipients']) ? $data['recipients'] : null; - $this->container['scheduledAt'] = isset($data['scheduledAt']) ? $data['scheduledAt'] : null; - $this->container['unicodeEnabled'] = isset($data['unicodeEnabled']) ? $data['unicodeEnabled'] : false; - $this->container['organisationPrefix'] = isset($data['organisationPrefix']) ? $data['organisationPrefix'] : null; - $this->container['unsubscribeInstruction'] = isset($data['unsubscribeInstruction']) ? $data['unsubscribeInstruction'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('recipients', $data ?? [], null); + $this->setIfExists('scheduledAt', $data ?? [], null); + $this->setIfExists('unicodeEnabled', $data ?? [], false); + $this->setIfExists('organisationPrefix', $data ?? [], null); + $this->setIfExists('unsubscribeInstruction', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -238,24 +229,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * - * @return string + * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -263,12 +242,15 @@ public function getName() /** * Sets name * - * @param string $name Name of the campaign + * @param string|null $name Name of the campaign * * @return $this */ - public function setName($name) + public function setName(?string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -277,9 +259,9 @@ public function setName($name) /** * Gets sender * - * @return string + * @return string|null */ - public function getSender() + public function getSender(): ?string { return $this->container['sender']; } @@ -287,14 +269,17 @@ public function getSender() /** * Sets sender * - * @param string $sender Name of the sender. **The number of characters is limited to 11 for alphanumeric characters and 15 for numeric characters** + * @param string|null $sender Name of the sender. **The number of characters is limited to 11 for alphanumeric characters and 15 for numeric characters** * * @return $this */ - public function setSender($sender) + public function setSender(?string $sender): static { - if (!is_null($sender) && (mb_strlen($sender) > 15)) { - throw new \InvalidArgumentException('invalid length for $sender when calling UpdateSmsCampaign., must be smaller than or equal to 15.'); + if (is_null($sender)) { + throw new InvalidArgumentException('non-nullable sender cannot be null'); + } + if ((mb_strlen($sender) > 15)) { + throw new InvalidArgumentException('invalid length for $sender when calling UpdateSmsCampaign., must be smaller than or equal to 15.'); } $this->container['sender'] = $sender; @@ -305,9 +290,9 @@ public function setSender($sender) /** * Gets content * - * @return string + * @return string|null */ - public function getContent() + public function getContent(): ?string { return $this->container['content']; } @@ -315,12 +300,15 @@ 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 + * @param string|null $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) + public function setContent(?string $content): static { + if (is_null($content)) { + throw new InvalidArgumentException('non-nullable content cannot be null'); + } $this->container['content'] = $content; return $this; @@ -329,9 +317,9 @@ public function setContent($content) /** * Gets recipients * - * @return \Brevo\Client\Models\CreateSmsCampaignRecipients + * @return \Brevo\Client\Models\CreateSmsCampaignRecipients|null */ - public function getRecipients() + public function getRecipients(): ?\Brevo\Client\Models\CreateSmsCampaignRecipients { return $this->container['recipients']; } @@ -339,12 +327,15 @@ public function getRecipients() /** * Sets recipients * - * @param \Brevo\Client\Models\CreateSmsCampaignRecipients $recipients recipients + * @param \Brevo\Client\Models\CreateSmsCampaignRecipients|null $recipients recipients * * @return $this */ - public function setRecipients($recipients) + public function setRecipients(?\Brevo\Client\Models\CreateSmsCampaignRecipients $recipients): static { + if (is_null($recipients)) { + throw new InvalidArgumentException('non-nullable recipients cannot be null'); + } $this->container['recipients'] = $recipients; return $this; @@ -353,9 +344,9 @@ public function setRecipients($recipients) /** * Gets scheduledAt * - * @return string + * @return string|null */ - public function getScheduledAt() + public function getScheduledAt(): ?string { return $this->container['scheduledAt']; } @@ -363,12 +354,15 @@ public function getScheduledAt() /** * Sets scheduledAt * - * @param string $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. + * @param string|null $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) + public function setScheduledAt(?string $scheduledAt): static { + if (is_null($scheduledAt)) { + throw new InvalidArgumentException('non-nullable scheduledAt cannot be null'); + } $this->container['scheduledAt'] = $scheduledAt; return $this; @@ -377,9 +371,9 @@ public function setScheduledAt($scheduledAt) /** * Gets unicodeEnabled * - * @return bool + * @return bool|null */ - public function getUnicodeEnabled() + public function getUnicodeEnabled(): ?bool { return $this->container['unicodeEnabled']; } @@ -387,12 +381,15 @@ public function getUnicodeEnabled() /** * Sets unicodeEnabled * - * @param bool $unicodeEnabled Format of the message. It indicates whether the content should be treated as unicode or not. + * @param bool|null $unicodeEnabled Format of the message. It indicates whether the content should be treated as unicode or not. * * @return $this */ - public function setUnicodeEnabled($unicodeEnabled) + public function setUnicodeEnabled(?bool $unicodeEnabled): static { + if (is_null($unicodeEnabled)) { + throw new InvalidArgumentException('non-nullable unicodeEnabled cannot be null'); + } $this->container['unicodeEnabled'] = $unicodeEnabled; return $this; @@ -401,9 +398,9 @@ public function setUnicodeEnabled($unicodeEnabled) /** * Gets organisationPrefix * - * @return string + * @return string|null */ - public function getOrganisationPrefix() + public function getOrganisationPrefix(): ?string { return $this->container['organisationPrefix']; } @@ -411,12 +408,15 @@ public function getOrganisationPrefix() /** * Sets organisationPrefix * - * @param string $organisationPrefix A recognizable prefix will ensure your audience knows who you are. Recommended by U.S. carriers. This will be added as your Brand Name before the message content. **Prefer verifying maximum length of 160 characters including this prefix in message content to avoid multiple sending of same sms.** + * @param string|null $organisationPrefix A recognizable prefix will ensure your audience knows who you are. Recommended by U.S. carriers. This will be added as your Brand Name before the message content. **Prefer verifying maximum length of 160 characters including this prefix in message content to avoid multiple sending of same sms.** * * @return $this */ - public function setOrganisationPrefix($organisationPrefix) + public function setOrganisationPrefix(?string $organisationPrefix): static { + if (is_null($organisationPrefix)) { + throw new InvalidArgumentException('non-nullable organisationPrefix cannot be null'); + } $this->container['organisationPrefix'] = $organisationPrefix; return $this; @@ -425,9 +425,9 @@ public function setOrganisationPrefix($organisationPrefix) /** * Gets unsubscribeInstruction * - * @return string + * @return string|null */ - public function getUnsubscribeInstruction() + public function getUnsubscribeInstruction(): ?string { return $this->container['unsubscribeInstruction']; } @@ -435,89 +435,19 @@ public function getUnsubscribeInstruction() /** * Sets unsubscribeInstruction * - * @param string $unsubscribeInstruction Instructions to unsubscribe from future communications. Recommended by U.S. carriers. Must include **STOP** keyword. This will be added as instructions after the end of message content. **Prefer verifying maximum length of 160 characters including this instructions in message content to avoid multiple sending of same sms.** + * @param string|null $unsubscribeInstruction Instructions to unsubscribe from future communications. Recommended by U.S. carriers. Must include **STOP** keyword. This will be added as instructions after the end of message content. **Prefer verifying maximum length of 160 characters including this instructions in message content to avoid multiple sending of same sms.** * * @return $this */ - public function setUnsubscribeInstruction($unsubscribeInstruction) + public function setUnsubscribeInstruction(?string $unsubscribeInstruction): static { + if (is_null($unsubscribeInstruction)) { + throw new InvalidArgumentException('non-nullable unsubscribeInstruction cannot be null'); + } $this->container['unsubscribeInstruction'] = $unsubscribeInstruction; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/UpdateSmtpTemplate.php b/lib/Models/UpdateSmtpTemplate.php index 90ca350..75cdae3 100644 --- a/lib/Models/UpdateSmtpTemplate.php +++ b/lib/Models/UpdateSmtpTemplate.php @@ -2,61 +2,63 @@ /** * UpdateSmtpTemplate * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * UpdateSmtpTemplate Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class UpdateSmtpTemplate implements ModelInterface, ArrayAccess +class UpdateSmtpTemplate extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'updateSmtpTemplate'; + protected static string $openAPIModelName = 'updateSmtpTemplate'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'tag' => 'string', 'sender' => '\Brevo\Client\Models\UpdateSmtpTemplateSender', 'templateName' => 'string', @@ -72,9 +74,9 @@ class UpdateSmtpTemplate implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'tag' => null, 'sender' => null, 'templateName' => null, @@ -88,32 +90,37 @@ class UpdateSmtpTemplate implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'tag' => false, + 'sender' => false, + 'templateName' => false, + 'htmlContent' => false, + 'htmlUrl' => false, + 'subject' => false, + 'replyTo' => false, + 'toField' => false, + 'attachmentUrl' => false, + 'isActive' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'tag' => 'tag', 'sender' => 'sender', 'templateName' => 'templateName', @@ -129,9 +136,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'tag' => 'setTag', 'sender' => 'setSender', 'templateName' => 'setTemplateName', @@ -147,9 +154,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'tag' => 'getTag', 'sender' => 'getSender', 'templateName' => 'getTemplateName', @@ -166,9 +173,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -176,9 +183,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -186,84 +193,58 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['tag'] = isset($data['tag']) ? $data['tag'] : null; - $this->container['sender'] = isset($data['sender']) ? $data['sender'] : null; - $this->container['templateName'] = isset($data['templateName']) ? $data['templateName'] : null; - $this->container['htmlContent'] = isset($data['htmlContent']) ? $data['htmlContent'] : null; - $this->container['htmlUrl'] = isset($data['htmlUrl']) ? $data['htmlUrl'] : null; - $this->container['subject'] = isset($data['subject']) ? $data['subject'] : null; - $this->container['replyTo'] = isset($data['replyTo']) ? $data['replyTo'] : null; - $this->container['toField'] = isset($data['toField']) ? $data['toField'] : null; - $this->container['attachmentUrl'] = isset($data['attachmentUrl']) ? $data['attachmentUrl'] : null; - $this->container['isActive'] = isset($data['isActive']) ? $data['isActive'] : null; + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('templateName', $data ?? [], null); + $this->setIfExists('htmlContent', $data ?? [], null); + $this->setIfExists('htmlUrl', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('replyTo', $data ?? [], null); + $this->setIfExists('toField', $data ?? [], null); + $this->setIfExists('attachmentUrl', $data ?? [], null); + $this->setIfExists('isActive', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets tag * - * @return string + * @return string|null */ - public function getTag() + public function getTag(): ?string { return $this->container['tag']; } @@ -271,12 +252,15 @@ public function getTag() /** * Sets tag * - * @param string $tag Tag of the template + * @param string|null $tag Tag of the template * * @return $this */ - public function setTag($tag) + public function setTag(?string $tag): static { + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } $this->container['tag'] = $tag; return $this; @@ -285,9 +269,9 @@ public function setTag($tag) /** * Gets sender * - * @return \Brevo\Client\Models\UpdateSmtpTemplateSender + * @return \Brevo\Client\Models\UpdateSmtpTemplateSender|null */ - public function getSender() + public function getSender(): ?\Brevo\Client\Models\UpdateSmtpTemplateSender { return $this->container['sender']; } @@ -295,12 +279,15 @@ public function getSender() /** * Sets sender * - * @param \Brevo\Client\Models\UpdateSmtpTemplateSender $sender sender + * @param \Brevo\Client\Models\UpdateSmtpTemplateSender|null $sender sender * * @return $this */ - public function setSender($sender) + public function setSender(?\Brevo\Client\Models\UpdateSmtpTemplateSender $sender): static { + if (is_null($sender)) { + throw new InvalidArgumentException('non-nullable sender cannot be null'); + } $this->container['sender'] = $sender; return $this; @@ -309,9 +296,9 @@ public function setSender($sender) /** * Gets templateName * - * @return string + * @return string|null */ - public function getTemplateName() + public function getTemplateName(): ?string { return $this->container['templateName']; } @@ -319,12 +306,15 @@ public function getTemplateName() /** * Sets templateName * - * @param string $templateName Name of the template + * @param string|null $templateName Name of the template * * @return $this */ - public function setTemplateName($templateName) + public function setTemplateName(?string $templateName): static { + if (is_null($templateName)) { + throw new InvalidArgumentException('non-nullable templateName cannot be null'); + } $this->container['templateName'] = $templateName; return $this; @@ -333,9 +323,9 @@ public function setTemplateName($templateName) /** * Gets htmlContent * - * @return string + * @return string|null */ - public function getHtmlContent() + public function getHtmlContent(): ?string { return $this->container['htmlContent']; } @@ -343,12 +333,15 @@ public function getHtmlContent() /** * Sets htmlContent * - * @param string $htmlContent Required if htmlUrl is empty. If the template is designed using Drag & Drop editor via HTML content, then the design page will not have Drag & Drop editor access for that template. Body of the message (HTML must have more than 10 characters) + * @param string|null $htmlContent **Required if htmlUrl is empty**. If the template is designed using Drag & Drop editor via HTML content, then the design page will not have Drag & Drop editor access for that template. Body of the message (HTML must have more than 10 characters) * * @return $this */ - public function setHtmlContent($htmlContent) + public function setHtmlContent(?string $htmlContent): static { + if (is_null($htmlContent)) { + throw new InvalidArgumentException('non-nullable htmlContent cannot be null'); + } $this->container['htmlContent'] = $htmlContent; return $this; @@ -357,9 +350,9 @@ public function setHtmlContent($htmlContent) /** * Gets htmlUrl * - * @return string + * @return string|null */ - public function getHtmlUrl() + public function getHtmlUrl(): ?string { return $this->container['htmlUrl']; } @@ -367,12 +360,15 @@ public function getHtmlUrl() /** * Sets htmlUrl * - * @param string $htmlUrl Required if htmlContent is empty. URL to the body of the email (HTML) + * @param string|null $htmlUrl **Required if htmlContent is empty**. URL to the body of the email (HTML) * * @return $this */ - public function setHtmlUrl($htmlUrl) + public function setHtmlUrl(?string $htmlUrl): static { + if (is_null($htmlUrl)) { + throw new InvalidArgumentException('non-nullable htmlUrl cannot be null'); + } $this->container['htmlUrl'] = $htmlUrl; return $this; @@ -381,9 +377,9 @@ public function setHtmlUrl($htmlUrl) /** * Gets subject * - * @return string + * @return string|null */ - public function getSubject() + public function getSubject(): ?string { return $this->container['subject']; } @@ -391,12 +387,15 @@ public function getSubject() /** * Sets subject * - * @param string $subject Subject of the email + * @param string|null $subject Subject of the email * * @return $this */ - public function setSubject($subject) + public function setSubject(?string $subject): static { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } $this->container['subject'] = $subject; return $this; @@ -405,9 +404,9 @@ public function setSubject($subject) /** * Gets replyTo * - * @return string + * @return string|null */ - public function getReplyTo() + public function getReplyTo(): ?string { return $this->container['replyTo']; } @@ -415,12 +414,15 @@ public function getReplyTo() /** * Sets replyTo * - * @param string $replyTo Email on which campaign recipients will be able to reply to + * @param string|null $replyTo Email on which campaign recipients will be able to reply to * * @return $this */ - public function setReplyTo($replyTo) + public function setReplyTo(?string $replyTo): static { + if (is_null($replyTo)) { + throw new InvalidArgumentException('non-nullable replyTo cannot be null'); + } $this->container['replyTo'] = $replyTo; return $this; @@ -429,9 +431,9 @@ public function setReplyTo($replyTo) /** * Gets toField * - * @return string + * @return string|null */ - public function getToField() + public function getToField(): ?string { return $this->container['toField']; } @@ -439,12 +441,15 @@ public function getToField() /** * Sets toField * - * @param string $toField To personalize the «To» Field. If you want to include the first name and last name of your recipient, add {FNAME} {LNAME}. These contact attributes must already exist in your Brevo account. If input parameter 'params' used please use {{contact.FNAME}} {{contact.LNAME}} for personalization + * @param string|null $toField To personalize the **To** Field. If you want to include the first name and last name of your recipient, add **{FNAME} {LNAME}**. These contact attributes must already exist in your Brevo account. If input parameter **params** used please use **{{contact.FNAME}} {{contact.LNAME}}** for personalization * * @return $this */ - public function setToField($toField) + public function setToField(?string $toField): static { + if (is_null($toField)) { + throw new InvalidArgumentException('non-nullable toField cannot be null'); + } $this->container['toField'] = $toField; return $this; @@ -453,9 +458,9 @@ public function setToField($toField) /** * Gets attachmentUrl * - * @return string + * @return string|null */ - public function getAttachmentUrl() + public function getAttachmentUrl(): ?string { return $this->container['attachmentUrl']; } @@ -463,12 +468,15 @@ 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 + * @param string|null $attachmentUrl Absolute url of the attachment (**no local file**). Extensions 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) + public function setAttachmentUrl(?string $attachmentUrl): static { + if (is_null($attachmentUrl)) { + throw new InvalidArgumentException('non-nullable attachmentUrl cannot be null'); + } $this->container['attachmentUrl'] = $attachmentUrl; return $this; @@ -477,9 +485,9 @@ public function setAttachmentUrl($attachmentUrl) /** * Gets isActive * - * @return bool + * @return bool|null */ - public function getIsActive() + public function getIsActive(): ?bool { return $this->container['isActive']; } @@ -487,89 +495,19 @@ public function getIsActive() /** * Sets isActive * - * @param bool $isActive Status of the template. isActive = false means template is inactive, isActive = true means template is active + * @param bool|null $isActive Status of the template. isActive = false means template is inactive, isActive = true means template is active * * @return $this */ - public function setIsActive($isActive) + public function setIsActive(?bool $isActive): static { + if (is_null($isActive)) { + throw new InvalidArgumentException('non-nullable isActive cannot be null'); + } $this->container['isActive'] = $isActive; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/UpdateSmtpTemplateSender.php b/lib/Models/UpdateSmtpTemplateSender.php index 037ec9c..9b80242 100644 --- a/lib/Models/UpdateSmtpTemplateSender.php +++ b/lib/Models/UpdateSmtpTemplateSender.php @@ -2,62 +2,64 @@ /** * UpdateSmtpTemplateSender * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * UpdateSmtpTemplateSender Class Doc Comment * - * @category Class - * @description Sender details including id or email and name (optional). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example `{\"name\":\"xyz\", \"email\":\"example@abc.com\"}` , `{\"name\":\"xyz\", \"id\":123}` + * @description Sender details including id or email and name (_optional_). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example: **{\"name\":\"xyz\", \"email\":\"example@abc.com\"}** **{\"name\":\"xyz\", \"id\":123}** * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class UpdateSmtpTemplateSender implements ModelInterface, ArrayAccess +class UpdateSmtpTemplateSender extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'updateSmtpTemplate_sender'; + protected static string $openAPIModelName = 'updateSmtpTemplate_sender'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string', 'email' => 'string', 'id' => 'int' @@ -66,41 +68,39 @@ class UpdateSmtpTemplateSender implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null, 'email' => 'email', 'id' => 'int64' ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'email' => false, + 'id' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name', 'email' => 'email', 'id' => 'id' @@ -109,9 +109,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName', 'email' => 'setEmail', 'id' => 'setId' @@ -120,9 +120,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName', 'email' => 'getEmail', 'id' => 'getId' @@ -132,9 +132,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -142,9 +142,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -152,77 +152,51 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * - * @return string + * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -230,12 +204,15 @@ public function getName() /** * Sets name * - * @param string $name Name of the sender + * @param string|null $name Name of the sender * * @return $this */ - public function setName($name) + public function setName(?string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -244,9 +221,9 @@ public function setName($name) /** * Gets email * - * @return string + * @return string|null */ - public function getEmail() + public function getEmail(): ?string { return $this->container['email']; } @@ -254,12 +231,15 @@ public function getEmail() /** * Sets email * - * @param string $email Email of the sender + * @param string|null $email Email of the sender * * @return $this */ - public function setEmail($email) + public function setEmail(?string $email): static { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -268,9 +248,9 @@ public function setEmail($email) /** * Gets id * - * @return int + * @return int|null */ - public function getId() + public function getId(): ?int { return $this->container['id']; } @@ -278,89 +258,19 @@ public function getId() /** * Sets id * - * @param int $id Select the sender for the template on the basis of sender id. In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email). + * @param int|null $id Select the sender for the template on the basis of sender id. _In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email)_. * * @return $this */ - public function setId($id) + public function setId(?int $id): static { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/UpdateTierGroup404Response.php b/lib/Models/UpdateTierGroup404Response.php new file mode 100644 index 0000000..31b854e --- /dev/null +++ b/lib/Models/UpdateTierGroup404Response.php @@ -0,0 +1,207 @@ + + */ +class UpdateTierGroup404Response extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'updateTierGroup_404_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + '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(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage(): ?string + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return $this + */ + public function setMessage(?string $message): static + { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } +} + + diff --git a/lib/Models/UpdateTierGroupRequest.php b/lib/Models/UpdateTierGroupRequest.php new file mode 100644 index 0000000..f8a16cb --- /dev/null +++ b/lib/Models/UpdateTierGroupRequest.php @@ -0,0 +1,377 @@ + + */ +class UpdateTierGroupRequest extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'updateTierGroupRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'tierOrder' => 'string', + 'upgradeStrategy' => 'string', + 'downgradeStrategy' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'tierOrder' => 'uuid', + 'upgradeStrategy' => null, + 'downgradeStrategy' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'tierOrder' => false, + 'upgradeStrategy' => false, + 'downgradeStrategy' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'tierOrder' => 'tierOrder', + 'upgradeStrategy' => 'upgradeStrategy', + 'downgradeStrategy' => 'downgradeStrategy' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'tierOrder' => 'setTierOrder', + 'upgradeStrategy' => 'setUpgradeStrategy', + 'downgradeStrategy' => 'setDowngradeStrategy' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'tierOrder' => 'getTierOrder', + 'upgradeStrategy' => 'getUpgradeStrategy', + 'downgradeStrategy' => 'getDowngradeStrategy' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + public const UPGRADE_STRATEGY_REAL_TIME = 'real_time'; + public const UPGRADE_STRATEGY_ANNIVERSARY = 'anniversary'; + public const DOWNGRADE_STRATEGY_REAL_TIME = 'real_time'; + public const DOWNGRADE_STRATEGY_ANNIVERSARY = 'anniversary'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getUpgradeStrategyAllowableValues() + { + return [ + self::UPGRADE_STRATEGY_REAL_TIME, + self::UPGRADE_STRATEGY_ANNIVERSARY, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDowngradeStrategyAllowableValues() + { + return [ + self::DOWNGRADE_STRATEGY_REAL_TIME, + self::DOWNGRADE_STRATEGY_ANNIVERSARY, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('tierOrder', $data ?? [], null); + $this->setIfExists('upgradeStrategy', $data ?? [], 'real_time'); + $this->setIfExists('downgradeStrategy', $data ?? [], 'real_time'); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = $this->getUpgradeStrategyAllowableValues(); + if (!is_null($this->container['upgradeStrategy']) && !in_array($this->container['upgradeStrategy'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'upgradeStrategy', must be one of '%s'", + $this->container['upgradeStrategy'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDowngradeStrategyAllowableValues(); + if (!is_null($this->container['downgradeStrategy']) && !in_array($this->container['downgradeStrategy'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'downgradeStrategy', must be one of '%s'", + $this->container['downgradeStrategy'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the tier group + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets tierOrder + * + * @return string|null + */ + public function getTierOrder(): ?string + { + return $this->container['tierOrder']; + } + + /** + * Sets tierOrder + * + * @param string|null $tierOrder Order of the tiers in the group in ascending order + * + * @return $this + */ + public function setTierOrder(?string $tierOrder): static + { + if (is_null($tierOrder)) { + throw new InvalidArgumentException('non-nullable tierOrder cannot be null'); + } + $this->container['tierOrder'] = $tierOrder; + + return $this; + } + + /** + * Gets upgradeStrategy + * + * @return string|null + */ + public function getUpgradeStrategy(): ?string + { + return $this->container['upgradeStrategy']; + } + + /** + * Sets upgradeStrategy + * + * @param string|null $upgradeStrategy Select real_time to upgrade tier on real time balance updates. Select anniversary to upgrade tier on subscription anniversary. + * + * @return $this + */ + public function setUpgradeStrategy(?string $upgradeStrategy): static + { + if (is_null($upgradeStrategy)) { + throw new InvalidArgumentException('non-nullable upgradeStrategy cannot be null'); + } + $allowedValues = $this->getUpgradeStrategyAllowableValues(); + if (!in_array($upgradeStrategy, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'upgradeStrategy', must be one of '%s'", + $upgradeStrategy, + implode("', '", $allowedValues) + ) + ); + } + $this->container['upgradeStrategy'] = $upgradeStrategy; + + return $this; + } + + /** + * Gets downgradeStrategy + * + * @return string|null + */ + public function getDowngradeStrategy(): ?string + { + return $this->container['downgradeStrategy']; + } + + /** + * Sets downgradeStrategy + * + * @param string|null $downgradeStrategy Select real_time to downgrade tier on real time balance updates. Select anniversary to downgrade tier on subscription anniversary. + * + * @return $this + */ + public function setDowngradeStrategy(?string $downgradeStrategy): static + { + if (is_null($downgradeStrategy)) { + throw new InvalidArgumentException('non-nullable downgradeStrategy cannot be null'); + } + $allowedValues = $this->getDowngradeStrategyAllowableValues(); + if (!in_array($downgradeStrategy, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'downgradeStrategy', must be one of '%s'", + $downgradeStrategy, + implode("', '", $allowedValues) + ) + ); + } + $this->container['downgradeStrategy'] = $downgradeStrategy; + + return $this; + } +} + + diff --git a/lib/Models/UpdateUserResponse.php b/lib/Models/UpdateUserResponse.php new file mode 100644 index 0000000..c08aa09 --- /dev/null +++ b/lib/Models/UpdateUserResponse.php @@ -0,0 +1,278 @@ + + */ +class UpdateUserResponse extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'updateUserResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'status' => 'string', + 'creditNotes' => 'string[]', + 'invoiceId' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'status' => null, + 'creditNotes' => null, + 'invoiceId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'status' => false, + 'creditNotes' => false, + 'invoiceId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'status' => 'status', + 'creditNotes' => 'credit_notes', + 'invoiceId' => 'invoice_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'status' => 'setStatus', + 'creditNotes' => 'setCreditNotes', + 'invoiceId' => 'setInvoiceId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'status' => 'getStatus', + 'creditNotes' => 'getCreditNotes', + 'invoiceId' => 'getInvoiceId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('creditNotes', $data ?? [], null); + $this->setIfExists('invoiceId', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + return $invalidProperties; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus(): string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status Status of the API operation. + * + * @return $this + */ + public function setStatus(string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets creditNotes + * + * @return string[]|null + */ + public function getCreditNotes(): ?array + { + return $this->container['creditNotes']; + } + + /** + * Sets creditNotes + * + * @param string[]|null $creditNotes Credit note + * + * @return $this + */ + public function setCreditNotes(?array $creditNotes): static + { + if (is_null($creditNotes)) { + throw new InvalidArgumentException('non-nullable creditNotes cannot be null'); + } + $this->container['creditNotes'] = $creditNotes; + + return $this; + } + + /** + * Gets invoiceId + * + * @return string[]|null + */ + public function getInvoiceId(): ?array + { + return $this->container['invoiceId']; + } + + /** + * Sets invoiceId + * + * @param string[]|null $invoiceId Invoice id + * + * @return $this + */ + public function setInvoiceId(?array $invoiceId): static + { + if (is_null($invoiceId)) { + throw new InvalidArgumentException('non-nullable invoiceId cannot be null'); + } + $this->container['invoiceId'] = $invoiceId; + + return $this; + } +} + + diff --git a/lib/Models/UpdateWebhook.php b/lib/Models/UpdateWebhook.php index c3df9b8..5c4e770 100644 --- a/lib/Models/UpdateWebhook.php +++ b/lib/Models/UpdateWebhook.php @@ -2,76 +2,78 @@ /** * UpdateWebhook * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * UpdateWebhook Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class UpdateWebhook implements ModelInterface, ArrayAccess +class UpdateWebhook extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'updateWebhook'; + protected static string $openAPIModelName = 'updateWebhook'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'url' => 'string', 'description' => 'string', 'events' => 'string[]', 'domain' => 'string', 'batched' => 'bool', - 'auth' => '\Brevo\Client\Models\GetWebhookAuth', - 'headers' => '\Brevo\Client\Models\GetWebhookHeaders[]' + 'auth' => 'object', + 'headers' => 'object[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'url' => 'url', 'description' => null, 'events' => null, @@ -82,32 +84,34 @@ class UpdateWebhook implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'url' => false, + 'description' => false, + 'events' => false, + 'domain' => false, + 'batched' => false, + 'auth' => false, + 'headers' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'url' => 'url', 'description' => 'description', 'events' => 'events', @@ -120,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'url' => 'setUrl', 'description' => 'setDescription', 'events' => 'setEvents', @@ -135,9 +139,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'url' => 'getUrl', 'description' => 'getDescription', 'events' => 'getEvents', @@ -151,9 +155,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -161,9 +165,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -171,43 +175,31 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } + public const EVENTS_SENT = 'sent'; + public const EVENTS_HARD_BOUNCE = 'hardBounce'; + public const EVENTS_SOFT_BOUNCE = 'softBounce'; + public const EVENTS_BLOCKED = 'blocked'; + public const EVENTS_SPAM = 'spam'; + public const EVENTS_DELIVERED = 'delivered'; + public const EVENTS_REQUEST = 'request'; + public const EVENTS_CLICK = 'click'; + public const EVENTS_INVALID = 'invalid'; + public const EVENTS_DEFERRED = 'deferred'; + public const EVENTS_OPENED = 'opened'; + public const EVENTS_UNIQUE_OPENED = 'uniqueOpened'; + public const EVENTS_UNSUBSCRIBED = 'unsubscribed'; + public const EVENTS_LIST_ADDITION = 'listAddition'; + public const EVENTS_CONTACT_UPDATED = 'contactUpdated'; + public const EVENTS_CONTACT_DELETED = 'contactDeleted'; + public const EVENTS_INBOUND_EMAIL_PROCESSED = 'inboundEmailProcessed'; - const EVENTS_SENT = 'sent'; - const EVENTS_HARD_BOUNCE = 'hardBounce'; - const EVENTS_SOFT_BOUNCE = 'softBounce'; - const EVENTS_BLOCKED = 'blocked'; - const EVENTS_SPAM = 'spam'; - const EVENTS_DELIVERED = 'delivered'; - const EVENTS_REQUEST = 'request'; - const EVENTS_CLICK = 'click'; - const EVENTS_INVALID = 'invalid'; - const EVENTS_DEFERRED = 'deferred'; - const EVENTS_OPENED = 'opened'; - const EVENTS_UNIQUE_OPENED = 'uniqueOpened'; - const EVENTS_UNSUBSCRIBED = 'unsubscribed'; - const EVENTS_LIST_ADDITION = 'listAddition'; - const EVENTS_CONTACT_UPDATED = 'contactUpdated'; - const EVENTS_CONTACT_DELETED = 'contactDeleted'; - const EVENTS_INBOUND_EMAIL_PROCESSED = 'inboundEmailProcessed'; - - - /** * Gets allowable values of the enum * @@ -235,62 +227,48 @@ public function getEventsAllowableValues() self::EVENTS_INBOUND_EMAIL_PROCESSED, ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - $this->container['events'] = isset($data['events']) ? $data['events'] : null; - $this->container['domain'] = isset($data['domain']) ? $data['domain'] : null; - $this->container['batched'] = isset($data['batched']) ? $data['batched'] : null; - $this->container['auth'] = isset($data['auth']) ? $data['auth'] : null; - $this->container['headers'] = isset($data['headers']) ? $data['headers'] : null; + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('events', $data ?? [], null); + $this->setIfExists('domain', $data ?? [], null); + $this->setIfExists('batched', $data ?? [], null); + $this->setIfExists('auth', $data ?? [], null); + $this->setIfExists('headers', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets url * - * @return string + * @return string|null */ - public function getUrl() + public function getUrl(): ?string { return $this->container['url']; } @@ -298,12 +276,15 @@ public function getUrl() /** * Sets url * - * @param string $url URL of the webhook + * @param string|null $url URL of the webhook * * @return $this */ - public function setUrl($url) + public function setUrl(?string $url): static { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } $this->container['url'] = $url; return $this; @@ -312,9 +293,9 @@ public function setUrl($url) /** * Gets description * - * @return string + * @return string|null */ - public function getDescription() + public function getDescription(): ?string { return $this->container['description']; } @@ -322,12 +303,15 @@ public function getDescription() /** * Sets description * - * @param string $description Description of the webhook + * @param string|null $description Description of the webhook * * @return $this */ - public function setDescription($description) + public function setDescription(?string $description): static { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } $this->container['description'] = $description; return $this; @@ -336,9 +320,9 @@ public function setDescription($description) /** * Gets events * - * @return string[] + * @return string[]|null */ - public function getEvents() + public function getEvents(): ?array { return $this->container['events']; } @@ -346,15 +330,18 @@ public function getEvents() /** * Sets events * - * @param string[] $events - Events triggering the webhook. Possible values for **Transactional** type webhook: #### `sent` OR `request`, `delivered`, `hardBounce`, `softBounce`, `blocked`, `spam`, `invalid`, `deferred`, `click`, `opened`, `uniqueOpened` and `unsubscribed` - Possible values for **Marketing** type webhook: #### `spam`, `opened`, `click`, `hardBounce`, `softBounce`, `unsubscribed`, `listAddition` & `delivered` - Possible values for **Inbound** type webhook: #### `inboundEmailProcessed` + * @param string[]|null $events - Events triggering the webhook. Possible values for **Transactional** type webhook: #### `sent` OR `request`, `delivered`, `hardBounce`, `softBounce`, `blocked`, `spam`, `invalid`, `deferred`, `click`, `opened`, `uniqueOpened` and `unsubscribed` - Possible values for **Marketing** type webhook: #### `spam`, `opened`, `click`, `hardBounce`, `softBounce`, `unsubscribed`, `listAddition` & `delivered` - Possible values for **Inbound** type webhook: #### `inboundEmailProcessed` * * @return $this */ - public function setEvents($events) + public function setEvents(?array $events): static { + if (is_null($events)) { + throw new InvalidArgumentException('non-nullable events cannot be null'); + } $allowedValues = $this->getEventsAllowableValues(); - if (!is_null($events) && array_diff($events, $allowedValues)) { - throw new \InvalidArgumentException( + if (array_diff($events, $allowedValues)) { + throw new InvalidArgumentException( sprintf( "Invalid value for 'events', must be one of '%s'", implode("', '", $allowedValues) @@ -369,9 +356,9 @@ public function setEvents($events) /** * Gets domain * - * @return string + * @return string|null */ - public function getDomain() + public function getDomain(): ?string { return $this->container['domain']; } @@ -379,12 +366,15 @@ public function getDomain() /** * Sets domain * - * @param string $domain Inbound domain of webhook, used in case of event type `inbound` + * @param string|null $domain Inbound domain of webhook, used in case of event type `inbound` * * @return $this */ - public function setDomain($domain) + public function setDomain(?string $domain): static { + if (is_null($domain)) { + throw new InvalidArgumentException('non-nullable domain cannot be null'); + } $this->container['domain'] = $domain; return $this; @@ -393,9 +383,9 @@ public function setDomain($domain) /** * Gets batched * - * @return bool + * @return bool|null */ - public function getBatched() + public function getBatched(): ?bool { return $this->container['batched']; } @@ -403,12 +393,15 @@ public function getBatched() /** * Sets batched * - * @param bool $batched To send batched webhooks + * @param bool|null $batched Batching configuration of the webhook, we send batched webhooks if its true * * @return $this */ - public function setBatched($batched) + public function setBatched(?bool $batched): static { + if (is_null($batched)) { + throw new InvalidArgumentException('non-nullable batched cannot be null'); + } $this->container['batched'] = $batched; return $this; @@ -417,9 +410,9 @@ public function setBatched($batched) /** * Gets auth * - * @return \Brevo\Client\Models\GetWebhookAuth + * @return object|null */ - public function getAuth() + public function getAuth(): ?object { return $this->container['auth']; } @@ -427,12 +420,15 @@ public function getAuth() /** * Sets auth * - * @param \Brevo\Client\Models\GetWebhookAuth $auth auth + * @param object|null $auth Authentication header to be send with the webhook requests * * @return $this */ - public function setAuth($auth) + public function setAuth(?object $auth): static { + if (is_null($auth)) { + throw new InvalidArgumentException('non-nullable auth cannot be null'); + } $this->container['auth'] = $auth; return $this; @@ -441,9 +437,9 @@ public function setAuth($auth) /** * Gets headers * - * @return \Brevo\Client\Models\GetWebhookHeaders[] + * @return object[]|null */ - public function getHeaders() + public function getHeaders(): ?array { return $this->container['headers']; } @@ -451,89 +447,19 @@ public function getHeaders() /** * Sets headers * - * @param \Brevo\Client\Models\GetWebhookHeaders[] $headers Custom headers to be send with webhooks + * @param object[]|null $headers headers * * @return $this */ - public function setHeaders($headers) + public function setHeaders(?array $headers): static { + if (is_null($headers)) { + throw new InvalidArgumentException('non-nullable headers cannot be null'); + } $this->container['headers'] = $headers; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/UpdateWhatsAppCampaign.php b/lib/Models/UpdateWhatsAppCampaign.php index 8affe31..0ce49eb 100644 --- a/lib/Models/UpdateWhatsAppCampaign.php +++ b/lib/Models/UpdateWhatsAppCampaign.php @@ -2,61 +2,63 @@ /** * UpdateWhatsAppCampaign * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * UpdateWhatsAppCampaign Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class UpdateWhatsAppCampaign implements ModelInterface, ArrayAccess +class UpdateWhatsAppCampaign extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'updateWhatsAppCampaign'; + protected static string $openAPIModelName = 'updateWhatsAppCampaign'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'campaignName' => 'string', 'campaignStatus' => 'string', 'rescheduleFor' => 'string', @@ -66,9 +68,9 @@ class UpdateWhatsAppCampaign implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'campaignName' => null, 'campaignStatus' => null, 'rescheduleFor' => null, @@ -76,32 +78,31 @@ class UpdateWhatsAppCampaign implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'campaignName' => false, + 'campaignStatus' => false, + 'rescheduleFor' => false, + 'recipients' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'campaignName' => 'campaignName', 'campaignStatus' => 'campaignStatus', 'rescheduleFor' => 'rescheduleFor', @@ -111,9 +112,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'campaignName' => 'setCampaignName', 'campaignStatus' => 'setCampaignStatus', 'rescheduleFor' => 'setRescheduleFor', @@ -123,9 +124,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'campaignName' => 'getCampaignName', 'campaignStatus' => 'getCampaignStatus', 'rescheduleFor' => 'getRescheduleFor', @@ -136,9 +137,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -146,9 +147,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -156,28 +157,16 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const CAMPAIGN_STATUS_SCHEDULED = 'scheduled'; - const CAMPAIGN_STATUS_SUSPENDED = 'suspended'; - + public const CAMPAIGN_STATUS_SCHEDULED = 'scheduled'; + public const CAMPAIGN_STATUS_SUSPENDED = 'suspended'; - /** * Gets allowable values of the enum * @@ -190,42 +179,41 @@ public function getCampaignStatusAllowableValues() self::CAMPAIGN_STATUS_SUSPENDED, ]; } - /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['campaignName'] = isset($data['campaignName']) ? $data['campaignName'] : null; - $this->container['campaignStatus'] = isset($data['campaignStatus']) ? $data['campaignStatus'] : 'scheduled'; - $this->container['rescheduleFor'] = isset($data['rescheduleFor']) ? $data['rescheduleFor'] : null; - $this->container['recipients'] = isset($data['recipients']) ? $data['recipients'] : null; + $this->setIfExists('campaignName', $data ?? [], null); + $this->setIfExists('campaignStatus', $data ?? [], 'scheduled'); + $this->setIfExists('rescheduleFor', $data ?? [], null); + $this->setIfExists('recipients', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; $allowedValues = $this->getCampaignStatusAllowableValues(); if (!is_null($this->container['campaignStatus']) && !in_array($this->container['campaignStatus'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'campaignStatus', must be one of '%s'", + "invalid value '%s' for 'campaignStatus', must be one of '%s'", + $this->container['campaignStatus'], implode("', '", $allowedValues) ); } @@ -233,24 +221,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets campaignName * - * @return string + * @return string|null */ - public function getCampaignName() + public function getCampaignName(): ?string { return $this->container['campaignName']; } @@ -258,12 +234,15 @@ public function getCampaignName() /** * Sets campaignName * - * @param string $campaignName Name of the campaign + * @param string|null $campaignName Name of the campaign * * @return $this */ - public function setCampaignName($campaignName) + public function setCampaignName(?string $campaignName): static { + if (is_null($campaignName)) { + throw new InvalidArgumentException('non-nullable campaignName cannot be null'); + } $this->container['campaignName'] = $campaignName; return $this; @@ -272,9 +251,9 @@ public function setCampaignName($campaignName) /** * Gets campaignStatus * - * @return string + * @return string|null */ - public function getCampaignStatus() + public function getCampaignStatus(): ?string { return $this->container['campaignStatus']; } @@ -282,17 +261,21 @@ public function getCampaignStatus() /** * Sets campaignStatus * - * @param string $campaignStatus Status of the campaign + * @param string|null $campaignStatus Status of the campaign * * @return $this */ - public function setCampaignStatus($campaignStatus) + public function setCampaignStatus(?string $campaignStatus): static { + if (is_null($campaignStatus)) { + throw new InvalidArgumentException('non-nullable campaignStatus cannot be null'); + } $allowedValues = $this->getCampaignStatusAllowableValues(); - if (!is_null($campaignStatus) && !in_array($campaignStatus, $allowedValues, true)) { - throw new \InvalidArgumentException( + if (!in_array($campaignStatus, $allowedValues, true)) { + throw new InvalidArgumentException( sprintf( - "Invalid value for 'campaignStatus', must be one of '%s'", + "Invalid value '%s' for 'campaignStatus', must be one of '%s'", + $campaignStatus, implode("', '", $allowedValues) ) ); @@ -305,9 +288,9 @@ public function setCampaignStatus($campaignStatus) /** * Gets rescheduleFor * - * @return string + * @return string|null */ - public function getRescheduleFor() + public function getRescheduleFor(): ?string { return $this->container['rescheduleFor']; } @@ -315,12 +298,15 @@ public function getRescheduleFor() /** * Sets rescheduleFor * - * @param string $rescheduleFor Reschedule the sending UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of campaign. **Prefer to pass your timezone in date-time format for accurate result.For example: **2017-06-01T12:30:00+02:00** Use this field to update the scheduledAt of any existing draft or scheduled WhatsApp campaign. + * @param string|null $rescheduleFor Reschedule the sending UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of campaign. **Prefer to pass your timezone in date-time format for accurate result.For example: **2017-06-01T12:30:00+02:00** Use this field to update the scheduledAt of any existing draft or scheduled WhatsApp campaign. * * @return $this */ - public function setRescheduleFor($rescheduleFor) + public function setRescheduleFor(?string $rescheduleFor): static { + if (is_null($rescheduleFor)) { + throw new InvalidArgumentException('non-nullable rescheduleFor cannot be null'); + } $this->container['rescheduleFor'] = $rescheduleFor; return $this; @@ -329,9 +315,9 @@ public function setRescheduleFor($rescheduleFor) /** * Gets recipients * - * @return \Brevo\Client\Models\CreateWhatsAppCampaignRecipients + * @return \Brevo\Client\Models\CreateWhatsAppCampaignRecipients|null */ - public function getRecipients() + public function getRecipients(): ?\Brevo\Client\Models\CreateWhatsAppCampaignRecipients { return $this->container['recipients']; } @@ -339,89 +325,19 @@ public function getRecipients() /** * Sets recipients * - * @param \Brevo\Client\Models\CreateWhatsAppCampaignRecipients $recipients recipients + * @param \Brevo\Client\Models\CreateWhatsAppCampaignRecipients|null $recipients recipients * * @return $this */ - public function setRecipients($recipients) + public function setRecipients(?\Brevo\Client\Models\CreateWhatsAppCampaignRecipients $recipients): static { + if (is_null($recipients)) { + throw new InvalidArgumentException('non-nullable recipients cannot be null'); + } $this->container['recipients'] = $recipients; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/UploadImageModel.php b/lib/Models/UploadImageModel.php index 4f64eb4..96350d8 100644 --- a/lib/Models/UploadImageModel.php +++ b/lib/Models/UploadImageModel.php @@ -2,118 +2,116 @@ /** * UploadImageModel * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * UploadImageModel Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class UploadImageModel implements ModelInterface, ArrayAccess +class UploadImageModel extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'uploadImageModel'; + protected static string $openAPIModelName = 'uploadImageModel'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'url' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ - 'url' => 'string' + protected static array $openAPIFormats = [ + 'url' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'url' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'url' => 'url' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'url' => 'setUrl' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'url' => 'getUrl' ]; @@ -121,9 +119,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -131,9 +129,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -141,78 +139,49 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['url'] = isset($data['url']) ? $data['url'] : null; + $this->setIfExists('url', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; - if ($this->container['url'] === null) { - $invalidProperties[] = "'url' can't be null"; - } return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets url * - * @return string + * @return string|null */ - public function getUrl() + public function getUrl(): ?string { return $this->container['url']; } @@ -220,89 +189,19 @@ public function getUrl() /** * Sets url * - * @param string $url URL of the image uploaded + * @param string|null $url URL of the image uploaded * * @return $this */ - public function setUrl($url) + public function setUrl(?string $url): static { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } $this->container['url'] = $url; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/UploadImageToGallery.php b/lib/Models/UploadImageToGallery.php index 3b7124a..fabc8c2 100644 --- a/lib/Models/UploadImageToGallery.php +++ b/lib/Models/UploadImageToGallery.php @@ -2,61 +2,63 @@ /** * UploadImageToGallery * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * UploadImageToGallery Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class UploadImageToGallery implements ModelInterface, ArrayAccess +class UploadImageToGallery extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'uploadImageToGallery'; + protected static string $openAPIModelName = 'uploadImageToGallery'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'imageUrl' => 'string', 'name' => 'string' ]; @@ -64,40 +66,37 @@ class UploadImageToGallery implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'imageUrl' => null, 'name' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'imageUrl' => false, + 'name' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'imageUrl' => 'imageUrl', 'name' => 'name' ]; @@ -105,9 +104,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'imageUrl' => 'setImageUrl', 'name' => 'setName' ]; @@ -115,9 +114,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'imageUrl' => 'getImageUrl', 'name' => 'getName' ]; @@ -126,9 +125,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -136,9 +135,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -146,52 +145,38 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['imageUrl'] = isset($data['imageUrl']) ? $data['imageUrl'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -201,24 +186,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets imageUrl * * @return string */ - public function getImageUrl() + public function getImageUrl(): string { return $this->container['imageUrl']; } @@ -226,12 +199,15 @@ public function getImageUrl() /** * Sets imageUrl * - * @param string $imageUrl The absolute url of the image (no local file). Maximum allowed size for image is 2MB. Allowed extensions for images are - jpeg, jpg, png, bmp, gif. + * @param string $imageUrl The absolute url of the image (**no local file**). Maximum allowed size for image is **2MB**. Allowed extensions for images are: #### jpeg, jpg, png, bmp, gif. * * @return $this */ - public function setImageUrl($imageUrl) + public function setImageUrl(string $imageUrl): static { + if (is_null($imageUrl)) { + throw new InvalidArgumentException('non-nullable imageUrl cannot be null'); + } $this->container['imageUrl'] = $imageUrl; return $this; @@ -240,9 +216,9 @@ public function setImageUrl($imageUrl) /** * Gets name * - * @return string + * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -250,89 +226,19 @@ public function getName() /** * Sets name * - * @param string $name Name of the image. + * @param string|null $name Name of the image. * * @return $this */ - public function setName($name) + public function setName(?string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/ValidateRewardPayload.php b/lib/Models/ValidateRewardPayload.php new file mode 100644 index 0000000..88c48af --- /dev/null +++ b/lib/Models/ValidateRewardPayload.php @@ -0,0 +1,309 @@ + + */ +class ValidateRewardPayload extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'validateRewardPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'contactId' => 'float', + 'loyaltySubscriptionId' => 'string', + 'code' => 'string', + 'attributedRewardId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'contactId' => null, + 'loyaltySubscriptionId' => null, + 'code' => null, + 'attributedRewardId' => 'uuid' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'contactId' => false, + 'loyaltySubscriptionId' => false, + 'code' => false, + 'attributedRewardId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'contactId' => 'contactId', + 'loyaltySubscriptionId' => 'loyaltySubscriptionId', + 'code' => 'code', + 'attributedRewardId' => 'attributedRewardId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'contactId' => 'setContactId', + 'loyaltySubscriptionId' => 'setLoyaltySubscriptionId', + 'code' => 'setCode', + 'attributedRewardId' => 'setAttributedRewardId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'contactId' => 'getContactId', + 'loyaltySubscriptionId' => 'getLoyaltySubscriptionId', + 'code' => 'getCode', + 'attributedRewardId' => 'getAttributedRewardId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('contactId', $data ?? [], null); + $this->setIfExists('loyaltySubscriptionId', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('attributedRewardId', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets contactId + * + * @return float|null + */ + public function getContactId(): ?float + { + return $this->container['contactId']; + } + + /** + * Sets contactId + * + * @param float|null $contactId Contact to attribute the reward + * + * @return $this + */ + public function setContactId(?float $contactId): static + { + if (is_null($contactId)) { + throw new InvalidArgumentException('non-nullable contactId cannot be null'); + } + $this->container['contactId'] = $contactId; + + return $this; + } + + /** + * Gets loyaltySubscriptionId + * + * @return string|null + */ + public function getLoyaltySubscriptionId(): ?string + { + return $this->container['loyaltySubscriptionId']; + } + + /** + * Sets loyaltySubscriptionId + * + * @param string|null $loyaltySubscriptionId One of contactId or loyaltySubscriptionId is required + * + * @return $this + */ + public function setLoyaltySubscriptionId(?string $loyaltySubscriptionId): static + { + if (is_null($loyaltySubscriptionId)) { + throw new InvalidArgumentException('non-nullable loyaltySubscriptionId cannot be null'); + } + $this->container['loyaltySubscriptionId'] = $loyaltySubscriptionId; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode(): ?string + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code Code to validate + * + * @return $this + */ + public function setCode(?string $code): static + { + if (is_null($code)) { + throw new InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets attributedRewardId + * + * @return string|null + */ + public function getAttributedRewardId(): ?string + { + return $this->container['attributedRewardId']; + } + + /** + * Sets attributedRewardId + * + * @param string|null $attributedRewardId One of code or attributed reward id is required + * + * @return $this + */ + public function setAttributedRewardId(?string $attributedRewardId): static + { + if (is_null($attributedRewardId)) { + throw new InvalidArgumentException('non-nullable attributedRewardId cannot be null'); + } + $this->container['attributedRewardId'] = $attributedRewardId; + + return $this; + } +} + + diff --git a/lib/Models/ValidatedRewardResponse.php b/lib/Models/ValidatedRewardResponse.php new file mode 100644 index 0000000..88f2617 --- /dev/null +++ b/lib/Models/ValidatedRewardResponse.php @@ -0,0 +1,207 @@ + + */ +class ValidatedRewardResponse extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'validatedRewardResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'authorize' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'authorize' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'authorize' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'authorize' => 'authorize' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'authorize' => 'setAuthorize' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'authorize' => 'getAuthorize' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('authorize', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets authorize + * + * @return bool|null + */ + public function getAuthorize(): ?bool + { + return $this->container['authorize']; + } + + /** + * Sets authorize + * + * @param bool|null $authorize Validated reward respone + * + * @return $this + */ + public function setAuthorize(?bool $authorize): static + { + if (is_null($authorize)) { + throw new InvalidArgumentException('non-nullable authorize cannot be null'); + } + $this->container['authorize'] = $authorize; + + return $this; + } +} + + diff --git a/lib/Models/ValidationError.php b/lib/Models/ValidationError.php new file mode 100644 index 0000000..7099627 --- /dev/null +++ b/lib/Models/ValidationError.php @@ -0,0 +1,207 @@ + + */ +class ValidationError extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'validationError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'error' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'error' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'error' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'error' => 'getError' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets error + * + * @return string|null + */ + public function getError(): ?string + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string|null $error Validation error message + * + * @return $this + */ + public function setError(?string $error): static + { + if (is_null($error)) { + throw new InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } +} + + diff --git a/lib/Models/VariablesItems.php b/lib/Models/VariablesItems.php index 6e2af07..b96b328 100644 --- a/lib/Models/VariablesItems.php +++ b/lib/Models/VariablesItems.php @@ -2,61 +2,63 @@ /** * VariablesItems * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * VariablesItems Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class VariablesItems implements ModelInterface, ArrayAccess +class VariablesItems extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'variablesItems'; + protected static string $openAPIModelName = 'variablesItems'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string', 'default' => 'string', 'datatype' => 'string' @@ -65,41 +67,39 @@ class VariablesItems implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null, 'default' => null, 'datatype' => null ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'default' => false, + 'datatype' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name', 'default' => 'default', 'datatype' => 'datatype' @@ -108,9 +108,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName', 'default' => 'setDefault', 'datatype' => 'setDatatype' @@ -119,9 +119,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName', 'default' => 'getDefault', 'datatype' => 'getDatatype' @@ -131,9 +131,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -141,9 +141,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -151,77 +151,51 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['default'] = isset($data['default']) ? $data['default'] : null; - $this->container['datatype'] = isset($data['datatype']) ? $data['datatype'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('default', $data ?? [], null); + $this->setIfExists('datatype', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * - * @return string + * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -229,12 +203,15 @@ public function getName() /** * Sets name * - * @param string $name name + * @param string|null $name name * * @return $this */ - public function setName($name) + public function setName(?string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -243,9 +220,9 @@ public function setName($name) /** * Gets default * - * @return string + * @return string|null */ - public function getDefault() + public function getDefault(): ?string { return $this->container['default']; } @@ -253,12 +230,15 @@ public function getDefault() /** * Sets default * - * @param string $default default + * @param string|null $default default * * @return $this */ - public function setDefault($default) + public function setDefault(?string $default): static { + if (is_null($default)) { + throw new InvalidArgumentException('non-nullable default cannot be null'); + } $this->container['default'] = $default; return $this; @@ -267,9 +247,9 @@ public function setDefault($default) /** * Gets datatype * - * @return string + * @return string|null */ - public function getDatatype() + public function getDatatype(): ?string { return $this->container['datatype']; } @@ -277,89 +257,19 @@ public function getDatatype() /** * Sets datatype * - * @param string $datatype datatype + * @param string|null $datatype datatype * * @return $this */ - public function setDatatype($datatype) + public function setDatatype(?string $datatype): static { + if (is_null($datatype)) { + throw new InvalidArgumentException('non-nullable datatype cannot be null'); + } $this->container['datatype'] = $datatype; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/VersionInfo.php b/lib/Models/VersionInfo.php new file mode 100644 index 0000000..8553ff1 --- /dev/null +++ b/lib/Models/VersionInfo.php @@ -0,0 +1,445 @@ + + */ +class VersionInfo extends AbstractModel +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'versionInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'loyaltyProgramId' => 'string', + 'loyaltyVersionId' => 'int', + 'parentVersionId' => 'int', + 'state' => 'string', + 'publishedAt' => '\DateTime', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'loyaltyProgramId' => 'uuid', + 'loyaltyVersionId' => null, + 'parentVersionId' => null, + 'state' => null, + 'publishedAt' => 'date-time', + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'loyaltyProgramId' => false, + 'loyaltyVersionId' => false, + 'parentVersionId' => false, + 'state' => false, + 'publishedAt' => false, + 'createdAt' => false, + 'updatedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'loyaltyProgramId' => 'loyaltyProgramId', + 'loyaltyVersionId' => 'loyaltyVersionId', + 'parentVersionId' => 'parentVersionId', + 'state' => 'state', + 'publishedAt' => 'publishedAt', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'loyaltyProgramId' => 'setLoyaltyProgramId', + 'loyaltyVersionId' => 'setLoyaltyVersionId', + 'parentVersionId' => 'setParentVersionId', + 'state' => 'setState', + 'publishedAt' => 'setPublishedAt', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'loyaltyProgramId' => 'getLoyaltyProgramId', + 'loyaltyVersionId' => 'getLoyaltyVersionId', + 'parentVersionId' => 'getParentVersionId', + 'state' => 'getState', + 'publishedAt' => 'getPublishedAt', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('loyaltyProgramId', $data ?? [], null); + $this->setIfExists('loyaltyVersionId', $data ?? [], null); + $this->setIfExists('parentVersionId', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('publishedAt', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Version Name + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets loyaltyProgramId + * + * @return string|null + */ + public function getLoyaltyProgramId(): ?string + { + return $this->container['loyaltyProgramId']; + } + + /** + * Sets loyaltyProgramId + * + * @param string|null $loyaltyProgramId Loyalty Program Id + * + * @return $this + */ + public function setLoyaltyProgramId(?string $loyaltyProgramId): static + { + if (is_null($loyaltyProgramId)) { + throw new InvalidArgumentException('non-nullable loyaltyProgramId cannot be null'); + } + $this->container['loyaltyProgramId'] = $loyaltyProgramId; + + return $this; + } + + /** + * Gets loyaltyVersionId + * + * @return int|null + */ + public function getLoyaltyVersionId(): ?int + { + return $this->container['loyaltyVersionId']; + } + + /** + * Sets loyaltyVersionId + * + * @param int|null $loyaltyVersionId Loyalty Version Id + * + * @return $this + */ + public function setLoyaltyVersionId(?int $loyaltyVersionId): static + { + if (is_null($loyaltyVersionId)) { + throw new InvalidArgumentException('non-nullable loyaltyVersionId cannot be null'); + } + $this->container['loyaltyVersionId'] = $loyaltyVersionId; + + return $this; + } + + /** + * Gets parentVersionId + * + * @return int|null + */ + public function getParentVersionId(): ?int + { + return $this->container['parentVersionId']; + } + + /** + * Sets parentVersionId + * + * @param int|null $parentVersionId Parent Version Id + * + * @return $this + */ + public function setParentVersionId(?int $parentVersionId): static + { + if (is_null($parentVersionId)) { + throw new InvalidArgumentException('non-nullable parentVersionId cannot be null'); + } + $this->container['parentVersionId'] = $parentVersionId; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState(): ?string + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state Version State + * + * @return $this + */ + public function setState(?string $state): static + { + if (is_null($state)) { + throw new InvalidArgumentException('non-nullable state cannot be null'); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets publishedAt + * + * @return \DateTime|null + */ + public function getPublishedAt(): ?\DateTime + { + return $this->container['publishedAt']; + } + + /** + * Sets publishedAt + * + * @param \DateTime|null $publishedAt Version Publish date + * + * @return $this + */ + public function setPublishedAt(?\DateTime $publishedAt): static + { + if (is_null($publishedAt)) { + throw new InvalidArgumentException('non-nullable publishedAt cannot be null'); + } + $this->container['publishedAt'] = $publishedAt; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Version creation date + * + * @return $this + */ + public function setCreatedAt(?\DateTime $createdAt): static + { + if (is_null($createdAt)) { + throw new InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt(): ?\DateTime + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Version last modification date + * + * @return $this + */ + public function setUpdatedAt(?\DateTime $updatedAt): static + { + if (is_null($updatedAt)) { + throw new InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } +} + + diff --git a/lib/Models/WhatsappCampStats.php b/lib/Models/WhatsappCampStats.php index 9e92538..38e9c3e 100644 --- a/lib/Models/WhatsappCampStats.php +++ b/lib/Models/WhatsappCampStats.php @@ -2,61 +2,63 @@ /** * WhatsappCampStats * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * WhatsappCampStats Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class WhatsappCampStats implements ModelInterface, ArrayAccess +class WhatsappCampStats extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'WhatsappCampStats'; + protected static string $openAPIModelName = 'WhatsappCampStats'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'sent' => 'int', 'delivered' => 'int', 'read' => 'int', @@ -67,9 +69,9 @@ class WhatsappCampStats implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'sent' => null, 'delivered' => null, 'read' => null, @@ -78,45 +80,45 @@ class WhatsappCampStats implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'sent' => false, + 'delivered' => false, + 'read' => false, + 'unsubscribe' => false, + 'notSent' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'sent' => 'sent', 'delivered' => 'delivered', 'read' => 'read', 'unsubscribe' => 'unsubscribe', - 'notSent' => 'not_sent' + 'notSent' => 'notSent' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'sent' => 'setSent', 'delivered' => 'setDelivered', 'read' => 'setRead', @@ -127,9 +129,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'sent' => 'getSent', 'delivered' => 'getDelivered', 'read' => 'getRead', @@ -141,9 +143,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -151,9 +153,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -161,55 +163,41 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['sent'] = isset($data['sent']) ? $data['sent'] : null; - $this->container['delivered'] = isset($data['delivered']) ? $data['delivered'] : null; - $this->container['read'] = isset($data['read']) ? $data['read'] : null; - $this->container['unsubscribe'] = isset($data['unsubscribe']) ? $data['unsubscribe'] : null; - $this->container['notSent'] = isset($data['notSent']) ? $data['notSent'] : null; + $this->setIfExists('sent', $data ?? [], null); + $this->setIfExists('delivered', $data ?? [], null); + $this->setIfExists('read', $data ?? [], null); + $this->setIfExists('unsubscribe', $data ?? [], null); + $this->setIfExists('notSent', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -231,24 +219,12 @@ public function listInvalidProperties() return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets sent * * @return int */ - public function getSent() + public function getSent(): int { return $this->container['sent']; } @@ -260,8 +236,11 @@ public function getSent() * * @return $this */ - public function setSent($sent) + public function setSent(int $sent): static { + if (is_null($sent)) { + throw new InvalidArgumentException('non-nullable sent cannot be null'); + } $this->container['sent'] = $sent; return $this; @@ -272,7 +251,7 @@ public function setSent($sent) * * @return int */ - public function getDelivered() + public function getDelivered(): int { return $this->container['delivered']; } @@ -284,8 +263,11 @@ public function getDelivered() * * @return $this */ - public function setDelivered($delivered) + public function setDelivered(int $delivered): static { + if (is_null($delivered)) { + throw new InvalidArgumentException('non-nullable delivered cannot be null'); + } $this->container['delivered'] = $delivered; return $this; @@ -296,7 +278,7 @@ public function setDelivered($delivered) * * @return int */ - public function getRead() + public function getRead(): int { return $this->container['read']; } @@ -308,8 +290,11 @@ public function getRead() * * @return $this */ - public function setRead($read) + public function setRead(int $read): static { + if (is_null($read)) { + throw new InvalidArgumentException('non-nullable read cannot be null'); + } $this->container['read'] = $read; return $this; @@ -320,7 +305,7 @@ public function setRead($read) * * @return int */ - public function getUnsubscribe() + public function getUnsubscribe(): int { return $this->container['unsubscribe']; } @@ -332,8 +317,11 @@ public function getUnsubscribe() * * @return $this */ - public function setUnsubscribe($unsubscribe) + public function setUnsubscribe(int $unsubscribe): static { + if (is_null($unsubscribe)) { + throw new InvalidArgumentException('non-nullable unsubscribe cannot be null'); + } $this->container['unsubscribe'] = $unsubscribe; return $this; @@ -344,7 +332,7 @@ public function setUnsubscribe($unsubscribe) * * @return int */ - public function getNotSent() + public function getNotSent(): int { return $this->container['notSent']; } @@ -356,85 +344,15 @@ public function getNotSent() * * @return $this */ - public function setNotSent($notSent) + public function setNotSent(int $notSent): static { + if (is_null($notSent)) { + throw new InvalidArgumentException('non-nullable notSent cannot be null'); + } $this->container['notSent'] = $notSent; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/Models/WhatsappCampTemplate.php b/lib/Models/WhatsappCampTemplate.php index 8614d26..a1cb796 100644 --- a/lib/Models/WhatsappCampTemplate.php +++ b/lib/Models/WhatsappCampTemplate.php @@ -2,61 +2,63 @@ /** * WhatsappCampTemplate * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client\Models; -use \ArrayAccess; -use \Brevo\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use Brevo\Client\ObjectSerializer; /** * WhatsappCampTemplate Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements ArrayAccess */ -class WhatsappCampTemplate implements ModelInterface, ArrayAccess +class WhatsappCampTemplate extends AbstractModel { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'WhatsappCampTemplate'; + protected static string $openAPIModelName = 'WhatsappCampTemplate'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerTypes = [ + protected static array $openAPITypes = [ 'name' => 'string', 'category' => 'string', 'language' => 'string', @@ -73,9 +75,9 @@ class WhatsappCampTemplate implements ModelInterface, ArrayAccess /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $swaggerFormats = [ + protected static array $openAPIFormats = [ 'name' => null, 'category' => null, 'language' => null, @@ -90,32 +92,38 @@ class WhatsappCampTemplate implements ModelInterface, ArrayAccess ]; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'category' => false, + 'language' => false, + 'containsButton' => false, + 'displayHeader' => false, + 'headerType' => false, + 'components' => false, + 'headerVariables' => false, + 'bodyVariables' => false, + 'buttonType' => false, + 'hideFooter' => false + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; /** * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'name' => 'name', 'category' => 'category', 'language' => 'language', @@ -132,9 +140,9 @@ public static function swaggerFormats() /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'name' => 'setName', 'category' => 'setCategory', 'language' => 'setLanguage', @@ -151,9 +159,9 @@ public static function swaggerFormats() /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'name' => 'getName', 'category' => 'getCategory', 'language' => 'getLanguage', @@ -171,9 +179,9 @@ public static function swaggerFormats() * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -181,9 +189,9 @@ public static function attributeMap() /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -191,85 +199,59 @@ public static function setters() /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { 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[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['category'] = isset($data['category']) ? $data['category'] : null; - $this->container['language'] = isset($data['language']) ? $data['language'] : null; - $this->container['containsButton'] = isset($data['containsButton']) ? $data['containsButton'] : null; - $this->container['displayHeader'] = isset($data['displayHeader']) ? $data['displayHeader'] : null; - $this->container['headerType'] = isset($data['headerType']) ? $data['headerType'] : null; - $this->container['components'] = isset($data['components']) ? $data['components'] : null; - $this->container['headerVariables'] = isset($data['headerVariables']) ? $data['headerVariables'] : null; - $this->container['bodyVariables'] = isset($data['bodyVariables']) ? $data['bodyVariables'] : null; - $this->container['buttonType'] = isset($data['buttonType']) ? $data['buttonType'] : null; - $this->container['hideFooter'] = isset($data['hideFooter']) ? $data['hideFooter'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('language', $data ?? [], null); + $this->setIfExists('containsButton', $data ?? [], null); + $this->setIfExists('displayHeader', $data ?? [], null); + $this->setIfExists('headerType', $data ?? [], null); + $this->setIfExists('components', $data ?? [], null); + $this->setIfExists('headerVariables', $data ?? [], null); + $this->setIfExists('bodyVariables', $data ?? [], null); + $this->setIfExists('buttonType', $data ?? [], null); + $this->setIfExists('hideFooter', $data ?? [], null); } /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; return $invalidProperties; } - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** * Gets name * - * @return string + * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -277,12 +259,15 @@ public function getName() /** * Sets name * - * @param string $name name of the template + * @param string|null $name name of the template * * @return $this */ - public function setName($name) + public function setName(?string $name): static { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -291,9 +276,9 @@ public function setName($name) /** * Gets category * - * @return string + * @return string|null */ - public function getCategory() + public function getCategory(): ?string { return $this->container['category']; } @@ -301,12 +286,15 @@ public function getCategory() /** * Sets category * - * @param string $category description of the template + * @param string|null $category description of the template * * @return $this */ - public function setCategory($category) + public function setCategory(?string $category): static { + if (is_null($category)) { + throw new InvalidArgumentException('non-nullable category cannot be null'); + } $this->container['category'] = $category; return $this; @@ -315,9 +303,9 @@ public function setCategory($category) /** * Gets language * - * @return string + * @return string|null */ - public function getLanguage() + public function getLanguage(): ?string { return $this->container['language']; } @@ -325,12 +313,15 @@ public function getLanguage() /** * Sets language * - * @param string $language language of the template + * @param string|null $language language of the template * * @return $this */ - public function setLanguage($language) + public function setLanguage(?string $language): static { + if (is_null($language)) { + throw new InvalidArgumentException('non-nullable language cannot be null'); + } $this->container['language'] = $language; return $this; @@ -339,9 +330,9 @@ public function setLanguage($language) /** * Gets containsButton * - * @return bool + * @return bool|null */ - public function getContainsButton() + public function getContainsButton(): ?bool { return $this->container['containsButton']; } @@ -349,12 +340,15 @@ public function getContainsButton() /** * Sets containsButton * - * @param bool $containsButton containsButton + * @param bool|null $containsButton containsButton * * @return $this */ - public function setContainsButton($containsButton) + public function setContainsButton(?bool $containsButton): static { + if (is_null($containsButton)) { + throw new InvalidArgumentException('non-nullable containsButton cannot be null'); + } $this->container['containsButton'] = $containsButton; return $this; @@ -363,9 +357,9 @@ public function setContainsButton($containsButton) /** * Gets displayHeader * - * @return bool + * @return bool|null */ - public function getDisplayHeader() + public function getDisplayHeader(): ?bool { return $this->container['displayHeader']; } @@ -373,12 +367,15 @@ public function getDisplayHeader() /** * Sets displayHeader * - * @param bool $displayHeader displayHeader + * @param bool|null $displayHeader displayHeader * * @return $this */ - public function setDisplayHeader($displayHeader) + public function setDisplayHeader(?bool $displayHeader): static { + if (is_null($displayHeader)) { + throw new InvalidArgumentException('non-nullable displayHeader cannot be null'); + } $this->container['displayHeader'] = $displayHeader; return $this; @@ -387,9 +384,9 @@ public function setDisplayHeader($displayHeader) /** * Gets headerType * - * @return string + * @return string|null */ - public function getHeaderType() + public function getHeaderType(): ?string { return $this->container['headerType']; } @@ -397,12 +394,15 @@ public function getHeaderType() /** * Sets headerType * - * @param string $headerType type of header + * @param string|null $headerType type of header * * @return $this */ - public function setHeaderType($headerType) + public function setHeaderType(?string $headerType): static { + if (is_null($headerType)) { + throw new InvalidArgumentException('non-nullable headerType cannot be null'); + } $this->container['headerType'] = $headerType; return $this; @@ -411,9 +411,9 @@ public function setHeaderType($headerType) /** * Gets components * - * @return \Brevo\Client\Models\ComponentItems[] + * @return \Brevo\Client\Models\ComponentItems[]|null */ - public function getComponents() + public function getComponents(): ?array { return $this->container['components']; } @@ -421,12 +421,15 @@ public function getComponents() /** * Sets components * - * @param \Brevo\Client\Models\ComponentItems[] $components array of component item objects + * @param \Brevo\Client\Models\ComponentItems[]|null $components array of component item objects * * @return $this */ - public function setComponents($components) + public function setComponents(?array $components): static { + if (is_null($components)) { + throw new InvalidArgumentException('non-nullable components cannot be null'); + } $this->container['components'] = $components; return $this; @@ -435,9 +438,9 @@ public function setComponents($components) /** * Gets headerVariables * - * @return \Brevo\Client\Models\VariablesItems[] + * @return \Brevo\Client\Models\VariablesItems[]|null */ - public function getHeaderVariables() + public function getHeaderVariables(): ?array { return $this->container['headerVariables']; } @@ -445,12 +448,15 @@ public function getHeaderVariables() /** * Sets headerVariables * - * @param \Brevo\Client\Models\VariablesItems[] $headerVariables array of variables item object + * @param \Brevo\Client\Models\VariablesItems[]|null $headerVariables array of variables item object * * @return $this */ - public function setHeaderVariables($headerVariables) + public function setHeaderVariables(?array $headerVariables): static { + if (is_null($headerVariables)) { + throw new InvalidArgumentException('non-nullable headerVariables cannot be null'); + } $this->container['headerVariables'] = $headerVariables; return $this; @@ -459,9 +465,9 @@ public function setHeaderVariables($headerVariables) /** * Gets bodyVariables * - * @return \Brevo\Client\Models\VariablesItems[] + * @return \Brevo\Client\Models\VariablesItems[]|null */ - public function getBodyVariables() + public function getBodyVariables(): ?array { return $this->container['bodyVariables']; } @@ -469,12 +475,15 @@ public function getBodyVariables() /** * Sets bodyVariables * - * @param \Brevo\Client\Models\VariablesItems[] $bodyVariables array of variables item variables + * @param \Brevo\Client\Models\VariablesItems[]|null $bodyVariables array of variables item variables * * @return $this */ - public function setBodyVariables($bodyVariables) + public function setBodyVariables(?array $bodyVariables): static { + if (is_null($bodyVariables)) { + throw new InvalidArgumentException('non-nullable bodyVariables cannot be null'); + } $this->container['bodyVariables'] = $bodyVariables; return $this; @@ -483,9 +492,9 @@ public function setBodyVariables($bodyVariables) /** * Gets buttonType * - * @return string + * @return string|null */ - public function getButtonType() + public function getButtonType(): ?string { return $this->container['buttonType']; } @@ -493,12 +502,15 @@ public function getButtonType() /** * Sets buttonType * - * @param string $buttonType buttonType + * @param string|null $buttonType buttonType * * @return $this */ - public function setButtonType($buttonType) + public function setButtonType(?string $buttonType): static { + if (is_null($buttonType)) { + throw new InvalidArgumentException('non-nullable buttonType cannot be null'); + } $this->container['buttonType'] = $buttonType; return $this; @@ -507,9 +519,9 @@ public function setButtonType($buttonType) /** * Gets hideFooter * - * @return bool + * @return bool|null */ - public function getHideFooter() + public function getHideFooter(): ?bool { return $this->container['hideFooter']; } @@ -517,89 +529,19 @@ public function getHideFooter() /** * Sets hideFooter * - * @param bool $hideFooter hideFooter + * @param bool|null $hideFooter hideFooter * * @return $this */ - public function setHideFooter($hideFooter) + public function setHideFooter(?bool $hideFooter): static { + if (is_null($hideFooter)) { + throw new InvalidArgumentException('non-nullable hideFooter cannot be null'); + } $this->container['hideFooter'] = $hideFooter; return $this; } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - 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 - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } } diff --git a/lib/ObjectSerializer.php b/lib/ObjectSerializer.php index a71301f..e20ab36 100644 --- a/lib/ObjectSerializer.php +++ b/lib/ObjectSerializer.php @@ -2,83 +2,122 @@ /** * ObjectSerializer * - * PHP version 5 + * PHP version 8.1 * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Brevo API * - * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | + * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity | * - * OpenAPI spec version: 3.0.0 + * The version of the OpenAPI document: 3.0.0 * Contact: contact@brevo.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.29 + * @generated Generated by: https://openapi-generator.tech + * Generator version: 7.9.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ namespace Brevo\Client; +use DateTimeInterface; +use DateTime; +use GuzzleHttp\Psr7\Utils; +use Brevo\Client\Models\ModelInterface; + /** * ObjectSerializer Class Doc Comment * - * @category Class * @package Brevo\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ class ObjectSerializer { + /** @var string */ + private static string $dateTimeFormat = DateTimeInterface::ATOM; + + /** + * Change the date format + * + * @param string $format the new date format to use + * + * @return void + */ + public static function setDateTimeFormat(string $format): void + { + self::$dateTimeFormat = $format; + } + /** * Serialize data * - * @param mixed $data the data to serialize - * @param string $type the SwaggerType of the data - * @param string $format the format of the Swagger type of the data + * @param mixed $data the data to serialize + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * - * @return string|object serialized form of $data + * @return scalar|object|array|null serialized form of $data */ - public static function sanitizeForSerialization($data, $type = null, $format = null) + public static function sanitizeForSerialization(mixed $data, string $type = null, string $format = null): mixed { if (is_scalar($data) || null === $data) { return $data; - } elseif ($data instanceof \DateTime) { - return ($format === 'date') ? $data->format('Y-m-d') : $data->format(\DateTime::ATOM); - } elseif (is_array($data)) { + } + + if ($data instanceof DateTime) { + return ($format === 'date') ? $data->format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if ($data instanceof \BackedEnum) { + return $data->value; + } + + if (is_array($data)) { foreach ($data as $property => $value) { $data[$property] = self::sanitizeForSerialization($value); } return $data; - } elseif ($data instanceof \stdClass) { - foreach ($data as $property => $value) { - $data->$property = self::sanitizeForSerialization($value); - } - return $data; - } elseif (is_object($data)) { + } + + if (is_object($data)) { $values = []; - $formats = $data::swaggerFormats(); - foreach ($data::swaggerTypes() as $property => $swaggerType) { - $getter = $data::getters()[$property]; - $value = $data->$getter(); - 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(), true)) { - $imploded = implode("', '", $swaggerType::getAllowableEnumValues()); - throw new \InvalidArgumentException("Invalid value for enum '$swaggerType', must be one of: '$imploded'"); + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + if (is_subclass_of($openAPIType, '\BackedEnum')) { + if (is_scalar($value)) { + $value = $openAPIType::tryFrom($value); + if ($value === null) { + $imploded = implode("', '", array_map(fn($case) => $case->value, $openAPIType::cases())); + throw new \InvalidArgumentException( + sprintf( + "Invalid value for enum '%s', must be one of: '%s'", + $openAPIType::class, + $imploded + ) + ); + } + } + } + } + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } } - if ($value !== null) { - $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $swaggerType, $formats[$property]); + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); } } return (object)$values; @@ -95,7 +134,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n * * @return string the sanitized filename */ - public static function sanitizeFilename($filename) + public static function sanitizeFilename(string $filename): string { if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { return $match[1]; @@ -104,6 +143,18 @@ public static function sanitizeFilename($filename) } } + /** + * Shorter timestamp microseconds to 6 digits length. + * + * @param string $timestamp Original timestamp + * + * @return string the shorten timestamp + */ + public static function sanitizeTimestamp(string $timestamp): string + { + return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); + } + /** * Take value and turn it into a string suitable for inclusion in * the path, by url-encoding. @@ -112,28 +163,147 @@ public static function sanitizeFilename($filename) * * @return string the serialized object */ - public static function toPathValue($value) + public static function toPathValue(string $value): string { return rawurlencode(self::toString($value)); } /** - * Take value and turn it into a string suitable for inclusion in - * the query, by imploding comma-separated if it's an object. - * If it's a string, pass through unchanged. It will be url-encoded - * later. + * Checks if a value is empty, based on its OpenAPI type. * - * @param string[]|string|\DateTime $object an object to be serialized to a string + * @param mixed $value + * @param string $openApiType * - * @return string the serialized object + * @return bool true if $value is empty */ - public static function toQueryValue($object) + private static function isEmptyValue(mixed $value, string $openApiType): bool { - if (is_array($object)) { - return implode(',', $object); - } else { - return self::toString($object); + # If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + # Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + return match ($openApiType) { + # For numeric values, false and '' are considered empty. + # This comparison is safe for floating point values, since the previous call to empty() will + # filter out values that don't match 0. + 'int','integer' => $value !== 0, + 'number'|'float' => $value !== 0 && $value !== 0.0, + + # For boolean values, '' is considered empty + 'bool','boolean' => !in_array($value, [false, 0], true), + + # For string values, '' is considered empty. + 'string' => $value === '', + + # For all the other types, any value at this point can be considered empty. + default => true + }; + } + + /** + * Take query parameter properties and turn it into an array suitable for + * native http_build_query or GuzzleHttp\Psr7\Query::build. + * + * @param mixed $value Parameter value + * @param string $paramName Parameter name + * @param string $openApiType OpenAPIType e.g. array or object + * @param string $style Parameter serialization style + * @param bool $explode Parameter explode option + * @param bool $required Whether query param is required or not + * + * @return array + */ + public static function toQueryValue( + mixed $value, + string $paramName, + string $openApiType = 'string', + string $style = 'form', + bool $explode = true, + bool $required = true + ): array { + + # Check if we should omit this parameter from the query. This should only happen when: + # - Parameter is NOT required; AND + # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + # example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { + if ($required) { + return ["{$paramName}" => '']; + } else { + return []; + } } + + # Handle DateTime objects in query + if($openApiType === "\DateTime" && $value instanceof DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + + $query = []; + $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; + + // since \GuzzleHttp\Psr7\Query::build fails with nested arrays + // need to flatten array first + $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { + if (!is_array($arr)) return $arr; + + foreach ($arr as $k => $v) { + $prop = ($style === 'deepObject') ? "{$name}[{$k}]" : $k; + + if (is_array($v)) { + $flattenArray($v, $prop, $result); + } else { + if ($style !== 'deepObject' && !$explode) { + // push key itself + $result[] = $prop; + } + $result[$prop] = $v; + } + } + return $result; + }; + + $value = $flattenArray($value, $paramName); + + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { + return $value; + } + + if ('boolean' === $openApiType && is_bool($value)) { + $value = self::convertBoolToQueryStringFormat($value); + } + + // handle style in serializeCollection + $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); + + return $query; + } + + /** + * Convert boolean value to format for query string. + * + * @param bool $value Boolean value + * + * @return int|string Boolean value in format + */ + public static function convertBoolToQueryStringFormat(bool $value): int|string + { + if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { + return $value ? 'true' : 'false'; + } + + return (int) $value; } /** @@ -145,8 +315,13 @@ public static function toQueryValue($object) * * @return string the header string */ - public static function toHeaderValue($value) + public static function toHeaderValue(string $value): string { + $callable = [$value, 'toHeaderValue']; + if (is_callable($callable)) { + return $callable(); + } + return self::toString($value); } @@ -159,7 +334,7 @@ public static function toHeaderValue($value) * * @return string the form string */ - public static function toFormValue($value) + public static function toFormValue(string|\SplFileObject $value): string { if ($value instanceof \SplFileObject) { return $value->getRealPath(); @@ -172,17 +347,20 @@ public static function toFormValue($value) * Take value and turn it into a string suitable for inclusion in * the parameter. If it's a string, pass through unchanged * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". * - * @param string|\DateTime $value the value of the parameter + * @param string|bool|DateTime $value the value of the parameter * * @return string the header string */ - public static function toString($value) + public static function toString(string|bool|DateTime $value): string { - if ($value instanceof \DateTime) { // datetime in ISO8601 format - return $value->format(\DateTime::ATOM); + if ($value instanceof DateTime) { // datetime in ISO8601 format + return $value->format(self::$dateTimeFormat); + } elseif (is_bool($value)) { + return $value ? 'true' : 'false'; } else { - return $value; + return (string) $value; } } @@ -190,51 +368,60 @@ public static function toString($value) * Serialize an array to a string. * * @param array $collection collection to serialize to a string - * @param string $collectionFormat the format use for serialization (csv, + * @param string $style the format use for serialization (csv, * ssv, tsv, pipes, multi) * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array * * @return string */ - public static function serializeCollection(array $collection, $collectionFormat, $allowCollectionFormatMulti = false) + public static function serializeCollection(array $collection, string $style, bool $allowCollectionFormatMulti = false): string { - if ($allowCollectionFormatMulti && ('multi' === $collectionFormat)) { + if ($allowCollectionFormatMulti && ('multi' === $style)) { // http_build_query() almost does the job for us. We just // need to fix the result of multidimensional arrays. return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); } - switch ($collectionFormat) { - case 'pipes': - return implode('|', $collection); - - case 'tsv': - return implode("\t", $collection); - - case 'ssv': - return implode(' ', $collection); - - case 'csv': - // Deliberate fall through. CSV is default format. - default: - return implode(',', $collection); - } + return match ($style) { + 'pipeDelimited', 'pipes' => implode('|', $collection), + 'tsv' => implode("\t", $collection), + 'spaceDelimited', 'ssv' => implode(' ', $collection), + default => implode(',', $collection), + }; } /** * Deserialize a JSON string into an object * - * @param mixed $data object or primitive to be deserialized - * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[]|null $httpHeaders HTTP headers * - * @return object|array|null an single or an array of $class instances + * @return mixed a single or an array of $class instances */ - public static function deserialize($data, $class, $httpHeaders = null) + public static function deserialize(mixed $data, string $class, array $httpHeaders = null): mixed { if (null === $data) { return null; - } elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int] + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + + if (!is_array($data)) { + throw new \InvalidArgumentException("Invalid array '$class'"); + } + + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } + + if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); $inner = substr($class, 4, -1); $deserialized = []; if (strrpos($inner, ",") !== false) { @@ -245,37 +432,49 @@ public static function deserialize($data, $class, $httpHeaders = null) } } return $deserialized; - } elseif (strcasecmp(substr($class, -2), '[]') === 0) { - $subClass = substr($class, 0, -2); - $values = []; - foreach ($data as $key => $value) { - $values[] = self::deserialize($value, $subClass, null); - } - return $values; - } elseif ($class === 'object') { - settype($data, 'array'); + } + + if ($class === 'mixed') { + settype($data, gettype($data)); return $data; - } elseif ($class === '\DateTime') { - // Some API's return an invalid, empty string as a + } + + if ($class === '\DateTime') { + // Some APIs return an invalid, empty string as a // date-time property. DateTime::__construct() will return // the current time for empty input which is probably not // what is meant. The invalid empty string is probably to // be interpreted as a missing field/value. Let's handle // this graceful. if (!empty($data)) { - return new \DateTime($data); + try { + return new DateTime($data); + } catch (\Exception $exception) { + // Some APIs return a date-time with too high nanosecond + // precision for php's DateTime to handle. + // With provided regexp 6 digits of microseconds saved + return new DateTime(self::sanitizeTimestamp($data)); + } } else { return null; } - } elseif (in_array($class, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { - settype($data, $class); - return $data; - } elseif ($class === '\SplFileObject') { + } + + if ($class === '\Psr\Http\Message\StreamInterface') { + return Utils::streamFor($data); + } + + if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + /** @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)) { + if ( + is_array($httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) + && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) + ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); } else { $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); @@ -288,13 +487,34 @@ public static function deserialize($data, $class, $httpHeaders = null) fclose($file); return new \SplFileObject($filename, 'r'); - } elseif (method_exists($class, 'getAllowableEnumValues')) { - if (!in_array($data, $class::getAllowableEnumValues(), true)) { - $imploded = implode("', '", $class::getAllowableEnumValues()); + } + + /** @psalm-suppress ParadoxicalCondition */ + // handle primitive types + if (in_array($class, ['\DateTime', '\SplFileObject'], true)) { + return $data; + } elseif (in_array($class, ['array', 'bool', 'boolean', 'float', 'double', 'int', 'integer', 'object', 'string', 'null'], true)) { + // type ref: https://www.php.net/manual/en/function.settype.php + // byte, mixed, void in the old php client were removed + settype($data, $class); + return $data; + } + + + if (is_subclass_of($class, '\BackedEnum')) { + $data = $class::tryFrom($data); + if ($data === null) { + $imploded = implode("', '", array_map(fn($case) => $case->value, $class::cases())); throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); } return $data; } else { + $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + // If a discriminator is defined and points to a valid subclass, use it. $discriminator = $class::DISCRIMINATOR; if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { @@ -303,20 +523,89 @@ public static function deserialize($data, $class, $httpHeaders = null) $class = $subclass; } } + + /** @var ModelInterface $instance */ $instance = new $class(); - foreach ($instance::swaggerTypes() as $property => $type) { + foreach ($instance::openAPITypes() as $property => $type) { $propertySetter = $instance::setters()[$property]; - if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + continue; } - $propertyValue = $data->{$instance::attributeMap()[$property]}; - if (isset($propertyValue)) { + if (isset($data->{$instance::attributeMap()[$property]})) { + $propertyValue = $data->{$instance::attributeMap()[$property]}; $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); } } return $instance; } } + + /** + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; + } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index c12ee14..69a837e 100755 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,21 +1,18 @@ - - - - ./test/Api - ./test/Model - - - - - - ./lib/Api - ./lib/Model - - + + + + ./lib/Api + ./lib/Models + + + + + ./tests/Api + ./tests/Model + + + + + diff --git a/test/Api/AttributesApiTest.php b/test/Api/AttributesApiTest.php deleted file mode 100644 index 705876e..0000000 --- a/test/Api/AttributesApiTest.php +++ /dev/null @@ -1,113 +0,0 @@ -